[host/murex-pecten] Switch to sway, adapt config

This commit is contained in:
Malte Tammena 2022-03-12 23:23:53 +01:00
parent c87797ed9e
commit 4bf590117d
13 changed files with 186 additions and 75 deletions

View file

@ -82,14 +82,15 @@
imports = [ self.nixosModules.helix-texta ];
config.deployment = {
allowLocalDeployment = true;
targetHost = null;
targetHost = "helix-texta";
targetUser = "root";
};
};
murex-pecten = { name, nodes, pkgs, ... }: {
imports = [ self.nixosModules.murex-pecten ];
config.deployment = {
#allowLocalDeployment = true;
allowLocalDeployment = true;
targetHost = "murex-pecten";
targetUser = "root";
};
@ -98,7 +99,7 @@
cornu-aspersum = { ... }: {
imports = [ self.nixosModules.cornu-aspersum ];
config.deployment = {
targetHost = "ccqcraft.de";
targetHost = "cornu-aspersum";
targetUser = "root";
};
};

View file

@ -8,13 +8,12 @@
availableKernelModules =
[ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
kernelModules = [ "dm-snapshot" ];
kernelModules = [ "dm-snapshot" "amdgpu" ];
luks.devices."enc".device =
"/dev/disk/by-uuid/037d5dc5-17c3-4643-9ad8-7403d280b191";
};
kernelModules = [ "kvm-amd" ];
extraModulePackages = [ ];
};
fileSystems = {
@ -51,4 +50,9 @@
# Enable bluetooth
hardware.bluetooth.enable = true;
services.hardware.bolt.enable = true;
# Prevent GPP0 from waking up the device!
wakeup.toggleDevice = [ "GPP0" ];
services.xserver.videoDrivers = lib.mkForce [ "amdgpu" ];
}

View file

@ -27,6 +27,8 @@
};
};
settings.nvidiaUsed = true;
hardware = {
# high-resolution display
video.hidpi.enable = lib.mkDefault true;

View file

@ -30,11 +30,7 @@ in {
networking = {
hostName = "helix-texta";
# nm ftw
networkmanager = {
enable = true;
packages = with pkgs; [ networkmanager-vpnc ];
};
networkmanager.enable = true;
};
system.fsPackages = [ pkgs.sshfs ];

View file

@ -2,8 +2,10 @@
{
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
networking = {
hostName = "murex-pecten";
@ -12,18 +14,51 @@
system.fsPackages = [ pkgs.sshfs ];
services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
sound.enable = true;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
config.pipewire-pulse."stream.properties" = {
"channelmix.upmix" = true;
"channelmix.lfe-cutoff" = 150;
};
config.pipewire."default.clock.allowed-rates" = [ 48000 44100 ];
media-session.config.alsa-monitor = {
rules = [{
matches = [{
"node.name" =
"alsa_output.usb-Focusrite_Scarlett_Solo_USB_Y7ENM550A6399B-00.pro-output-0";
}];
actions = {
update-props = {
#"audio.rate" = 96000;
"api.alsa.headroom" = 1024;
};
};
}];
};
};
xdg.portal = {
enable = true;
extraPortals = with pkgs; [ xdg-desktop-portal-gtk xdg-desktop-portal-wlr ];
gtkUsePortal = true;
};
hardware = {
pulseaudio.enable = true;
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [ amdvlk ];
extraPackages32 = with pkgs; [ driversi686Linux.amdvlk ];
};
};
@ -153,6 +188,8 @@
vial
];
programs.sway.enable = true;
sops.defaultSopsFile = ../secrets/hosts/murex-pecten/secrets.yaml;
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
# TODO: Improve this
@ -170,6 +207,7 @@
};
environment.systemPackages = with pkgs; [
qt5.qtwayland
thunderbolt
chrysalis
openrgb

View file

@ -1,7 +1,7 @@
# Settings that most of my hosts can agree on, but
# some of these settings are overriden on a per-host basis.
{ pkgs, config, ... }:
{ pkgs, lib, config, ... }:
{
imports = [
@ -10,8 +10,17 @@
./grafana.nix
./radicale.nix
./restic.nix
./wakeup.nix
];
options.settings = with lib; {
nvidiaUsed = mkOption {
type = types.bool;
default = false;
description = "Whether or not an NVIDIA graphics card is used";
};
};
config = {
# Allow joypixels' license and unfree licenses in general
nixpkgs.config = {

31
modules/wakeup.nix Normal file
View file

@ -0,0 +1,31 @@
{ pkgs, lib, config, ... }:
let
cfg = config.wakeup;
createServiceName = dev: "toggle-acpi-${dev}";
createService = dev: {
description = "Toggle ${dev} wakeup setting";
serviceConfig.ExecStart = ''
/bin/sh -c "${pkgs.coreutils}/bin/echo ${dev} > /proc/acpi/wakeup"
'';
wantedBy = [ "multi-user.target" ];
};
in {
options.wakeup = with lib; {
toggleDevice = mkOption {
type = types.listOf types.str;
default = [ ];
description = "ACPI devices to toggle as wakeup devices";
};
};
config = {
systemd.services = let
pairs = map (dev:
lib.attrsets.nameValuePair (createServiceName dev) (createService dev))
cfg.toggleDevice;
in builtins.listToAttrs pairs;
};
}

View file

@ -1,9 +1,9 @@
{ lib, stdenv, fetchFromGitHub, hiDpi ? false }:
{ lib, stdenv, fetchFromGitHub, hiDPI ? false }:
let
lock = builtins.fromJSON (builtins.readFile ../flake.lock);
variant =
if hiDpi then "Gruvbox-Material-Dark-HIDPI" else "Gruvbox-Material-Dark";
if hiDPI then "Gruvbox-Material-Dark-HIDPI" else "Gruvbox-Material-Dark";
in stdenv.mkDerivation rec {
pname = lock.nodes.gruvbox-material-gtk.locked.repo;
version = lock.nodes.gruvbox-material-gtk.locked.rev;

View file

@ -1,6 +1,8 @@
{ pkgs, ... }:
{ pkgs, lib, nixosConfig, ... }:
rec {
let hiDPI = nixosConfig.hardware.video.hidpi.enable;
in rec {
home.packages = with pkgs; [
numix-cursor-theme
gtk-engine-murrine
@ -10,7 +12,7 @@ rec {
enable = true;
theme = {
package =
pkgs.callPackage ../../pkgs/gruvbox-material-gtk.nix { hiDpi = true; };
pkgs.callPackage ../../pkgs/gruvbox-material-gtk.nix { inherit hiDPI; };
name = "gruvbox-material";
};
iconTheme = {
@ -21,8 +23,9 @@ rec {
gtk2 = {
extraConfig = ''
gtk-cursor-theme-name = "Numix-Cursor-Light"
'' + (lib.optionalString hiDPI ''
gtk-cursor-theme-size = 48
'';
'');
};
gtk3 = {
@ -31,7 +34,7 @@ rec {
];
extraConfig = {
gtk-cursor-theme-name = "Numix-Cursor-Light";
gtk-cursor-theme-size = 48;
gtk-cursor-theme-size = lib.mkIf hiDPI 48;
};
};
};

View file

@ -58,6 +58,8 @@ in {
config = {
settings.sway.enable = true;
home = {
packages = with pkgs; [
aseprite

View file

@ -23,14 +23,14 @@ in {
scale = 2.0;
}
{
criteria = "DP-2";
criteria = "BenQ Corporation BenQ GW2270 P9J02423SL0";
mode = "1920x1080@60Hz";
position = "1920,0";
scale = 1.0;
transform = "270";
}
{
criteria = "DP-1";
criteria = "Goldstar Company Ltd IPS226 SerialNumber";
mode = "1920x1080@60Hz";
position = "3000,420";
scale = 1.0;
@ -38,6 +38,24 @@ in {
];
exec = notify "Docked";
};
dual = {
outputs = [
{
criteria = "BenQ Corporation BenQ GW2270 P9J02423SL0";
mode = "1920x1080@60Hz";
position = "1920,0";
scale = 1.0;
transform = "270";
}
{
criteria = "Goldstar Company Ltd IPS226 SerialNumber";
mode = "1920x1080@60Hz";
position = "3000,420";
scale = 1.0;
}
];
exec = notify "Dual";
};
};
};
}

View file

@ -1,9 +1,16 @@
{ pkgs, config, lib, ... }:
{ pkgs, config, lib, nixosConfig, ... }:
let
col = config.colors;
backgrounds = pkgs.fetchFromGitHub {
owner = "vctrblck";
repo = "gruvbox-wallpapers";
rev = "ff9ade4c49299e08c11bd8ce2f17cdae7f9b706d";
sha256 = "d28r/s+m32hqzF/S/ebyBCd5XLKJTFSaQXmMdHFUH64=";
};
bemenu = (import ./bemenu.nix) pkgs;
grim = "${pkgs.grim}/bin/grim";
wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy";
@ -69,6 +76,10 @@ let
text-caps-lock-color=#ebdbb2
'';
cfg = config.settings.sway;
nvidiaUsed = nixosConfig.settings.nvidiaUsed;
hiDPI = nixosConfig.hardware.video.hidpi.enable;
in {
imports = [
./gammastep.nix
@ -80,7 +91,11 @@ in {
./kanshi.nix
];
config = {
options.settings.sway = with lib; {
enable = mkEnableOption "Enable sway config";
};
config = lib.mkIf cfg.enable {
home.packages = [
pkgs.firaCodeNerd
@ -97,7 +112,7 @@ in {
wayland.windowManager.sway = {
enable = true;
extraOptions = [ "--unsupported-gpu" ];
extraOptions = lib.optional nvidiaUsed "--unsupported-gpu";
systemdIntegration = true;
wrapperFeatures = {
base = true;
@ -105,14 +120,6 @@ in {
};
extraSessionCommands = ''
__GLX_VENDOR_LIBRARY=nvidia
GBM_BACKEND=nvidia-drm
GBM_BACKEND_PATH=/etc/gbm
# Set DRM devices and fix cursor
export WLR_NO_HARDWARE_CURSORS=0
export WLR_DRM_DEVICES=/dev/dri/card0:/dev/dri/card1
# Let's not, since it breaks most games
#export SDL_VIDEODRIVER=wayland
# needs qt5.qtwayland in systemPackages
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
@ -121,11 +128,18 @@ in {
# Fix for some Java AWT applications (e.g. Android Studio),
# use this if they aren't displayed properly:
export _JAVA_AWT_WM_NONREPARENTING=1
# Breaks QT applications on wayland..
#export QT_WAYLAND_FORCE_DPI=physical
export XDG_CURRENT_DESKTOP=Sway
export XDG_SESSION_TYPE=wayland
'';
'' +
# TODO: See what actually is required here!
(lib.optionalString nvidiaUsed ''
# Set DRM devices and fix cursor
export WLR_NO_HARDWARE_CURSORS=0
export WLR_DRM_DEVICES=/dev/dri/card0:/dev/dri/card1
__GLX_VENDOR_LIBRARY=nvidia
GBM_BACKEND=nvidia-drm
GBM_BACKEND_PATH=/etc/gbm
'');
config = {
modifier = "Mod4";
@ -164,7 +178,8 @@ in {
position = "top";
}];
seat = { "*" = { xcursor_theme = "Numix-Cursor-Light 48"; }; };
seat."*".xcursor_theme =
if hiDPI then "Numix-Cursor-Light 48" else "Numix-Cursor-Light 32";
keybindings = let
mod = config.wayland.windowManager.sway.config.modifier;
@ -262,6 +277,12 @@ in {
xkb_variant = ",workman";
xkb_options = "compose:rctrl,grp:alt_space_toggle,grp_led:caps";
};
# Ducky One 2 TKL
"1241:661:USB-HID_Keyboard" = {
xkb_layout = "us,us";
xkb_variant = ",workman";
xkb_options = "compose:rwin,grp:alt_space_toggle,grp_led:caps";
};
# Fancy Keyboardio Atreus
"4617:8963:Keyboardio_Atreus_Keyboard" = {
xkb_layout = "us";
@ -284,7 +305,13 @@ in {
};
};
output = { eDP-1 = { bg = "~/Pictures/wallpapers/bg.jpg fill"; }; };
output = {
"Unknown 0x1500 0x00000000".bg = "${backgrounds}/forest2.jpg fill";
"Goldstar Company Ltd IPS226 SerialNumber".bg =
"${backgrounds}/future-town.jpg fill";
"BenQ Corporation BenQ GW2270 P9J02423SL0".bg =
"${backgrounds}/leaves3.jpg fill";
};
colors = let
primary = col.primary.hashRgb;
@ -326,35 +353,16 @@ in {
};
};
};
};
config.systemd.user.services = {
swaylock = {
Unit = {
Description = "Idle manager for Wayland";
Documentation = [ "man:swayidle(1)" ];
PartOf = "graphical-session.target";
};
Service = {
Type = "simple";
ExecStart = ''
${pkgs.swayidle}/bin/swayidle \
timeout 300 swaylock \
timeout 600 'systemctl suspend' \
'';
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
# Configure swaylock
config.xdg.configFile."swaylock/config".text = swaylockConfig;
xdg.configFile."swaylock/config".text = swaylockConfig;
# If running from tty1 start sway
config.xdg.configFile."fish/conf.d/sway.fish".text = ''
xdg.configFile."fish/conf.d/sway.fish".text = ''
set TTY1 (tty)
if test -z \"$DISPLAY\"; and test $TTY1 = '/dev/tty1'
systemd-cat -t sway sway
end
'';
};
}

View file

@ -51,8 +51,7 @@ in {
modules-left = [ "sway/workspaces" "sway/mode" "sway/window" ];
modules-center = [ "clock#time" "clock#date" ];
modules-right =
[ "custom/taskwarrior" "idle_inhibitor" "network" "battery" "tray" ];
modules-right = [ "custom/taskwarrior" "network" "battery" "tray" ];
modules = {
"sway/workspaces" = {