From 991cc8fc88279c640b34fd4f1f64590b37603019 Mon Sep 17 00:00:00 2001 From: Schrottkatze Date: Tue, 5 Mar 2024 13:10:08 +0100 Subject: [PATCH 1/7] add input remapping module with easier configuration --- hosts/catbook-j/configuration.nix | 17 ++++- modules/desktop/default.nix | 29 +------- modules/desktop/evremap.nix | 39 ----------- modules/desktop/input/default.nix | 15 ++++ modules/desktop/input/evremap.nix | 110 ++++++++++++++++++++++++++++++ modules/desktop/x.nix | 18 +++++ other/remaps-catbook-j.toml | 22 ------ 7 files changed, 161 insertions(+), 89 deletions(-) delete mode 100644 modules/desktop/evremap.nix create mode 100644 modules/desktop/input/default.nix create mode 100644 modules/desktop/input/evremap.nix create mode 100644 modules/desktop/x.nix delete mode 100644 other/remaps-catbook-j.toml diff --git a/hosts/catbook-j/configuration.nix b/hosts/catbook-j/configuration.nix index 9379ded..406f484 100644 --- a/hosts/catbook-j/configuration.nix +++ b/hosts/catbook-j/configuration.nix @@ -26,7 +26,22 @@ social.enable = true; mail.enable = true; gaming.enable = true; - evremap.enable = true; + }; + input.remapping = { + enable = true; + devices."AT Translated Set 2 keyboard" = { + swapKeys = [ + ["KEY_Y" "KEY_Z"] + ["KEY_LEFTALT" "KEY_LEFTMETA"] + ]; + dual_role = [ + { + input = "KEY_CAPSLOCK"; + hold = ["KEY_LEFTCTRL"]; + tap = ["KEY_ESC"]; + } + ]; + }; }; terminal.enable = true; }; diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index cfc104f..2e519bd 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -30,10 +30,11 @@ in ./social.nix ./mail.nix ./specific-hardware - ./evremap.nix ./xmonad.nix ./fonts.nix ./firefox.nix + ./x.nix + ./input ]; i18n.inputMethod = { @@ -52,32 +53,6 @@ in services = { printing.enable = true; gnome.gnome-keyring.enable = true; - - xserver = { - enable = true; - - xkb = { - layout = "us"; - variant = "altgr-intl"; - }; - - libinput = { - enable = true; - }; - - desktopManager = { - xterm.enable = false; - }; - - displayManager = { - defaultSession = "none+xmonad"; - gdm.enable = true; - }; - - windowManager.xmonad = { - enable = true; - }; - }; }; programs.xss-lock = { diff --git a/modules/desktop/evremap.nix b/modules/desktop/evremap.nix deleted file mode 100644 index cbb72a2..0000000 --- a/modules/desktop/evremap.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.jade.desktop.evremap; - evremap = pkgs.rustPlatform.buildRustPackage { - pname = "evremap"; - version = "0.1.0"; - src = pkgs.fetchFromGitHub { - owner = "wez"; - repo = "evremap"; - rev = "4480c4eda223b98899b0fbd926bc34f7bd0e1a18"; - sha256 = "sha256-BxSrphgW1n465FX6bKVkq6O0XE2JqanfSYlsGwWUWkQ="; - }; - cargoHash = ""; - cargoLock.lockFile = ../../other/evremap.Cargo.lock; - postPatch = '' - cp ${../../other/evremap.Cargo.lock} Cargo.lock - ''; - nativeBuildInputs = [pkgs.pkg-config]; - buildInputs = [pkgs.libevdev]; - }; -in - with lib; { - options.jade.desktop.evremap = { - enable = mkEnableOption "Enable evremap"; - }; - config = mkIf cfg.enable { - systemd.services.evremap = { - script = "${evremap}/bin/evremap remap ${../../other/remaps-${config.networking.hostName}.toml}"; - wantedBy = ["multi-user.target"]; - unitConfig = { - Restart = "on-failure"; - }; - }; - }; - } diff --git a/modules/desktop/input/default.nix b/modules/desktop/input/default.nix new file mode 100644 index 0000000..88302da --- /dev/null +++ b/modules/desktop/input/default.nix @@ -0,0 +1,15 @@ +{...}: { + imports = [ + ./evremap.nix + ]; + services.xserver = { + xkb = { + layout = "us"; + variant = "altgr-intl"; + }; + + libinput = { + enable = true; + }; + }; +} diff --git a/modules/desktop/input/evremap.nix b/modules/desktop/input/evremap.nix new file mode 100644 index 0000000..bc9a1da --- /dev/null +++ b/modules/desktop/input/evremap.nix @@ -0,0 +1,110 @@ +{ + pkgs, + config, + lib, + utils, + ... +}: let + cfg = config.jade.input.remapping; + evremap = pkgs.rustPlatform.buildRustPackage { + pname = "evremap"; + version = "0.1.0"; + src = pkgs.fetchFromGitHub { + owner = "wez"; + repo = "evremap"; + rev = "4480c4eda223b98899b0fbd926bc34f7bd0e1a18"; + sha256 = "sha256-BxSrphgW1n465FX6bKVkq6O0XE2JqanfSYlsGwWUWkQ="; + }; + cargoHash = ""; + cargoLock.lockFile = ../../../other/evremap.Cargo.lock; + postPatch = '' + cp ${../../../other/evremap.Cargo.lock} Cargo.lock + ''; + nativeBuildInputs = [pkgs.pkg-config]; + buildInputs = [pkgs.libevdev]; + }; + toml = pkgs.formats.toml {}; +in + with lib; { + options.jade.input.remapping = { + enable = mkEnableOption "Enable evremap"; + devices = mkOption { + type = types.attrsOf (types.submodule ({name, ...}: { + options = { + device_name = mkOption { + type = types.str; + description = "The device name"; + default = name; + }; + remap = mkOption { + type = types.listOf (types.submodule ({...}: { + options.input = mkOption {type = types.listOf types.str;}; + options.output = mkOption {type = types.listOf types.str;}; + })); + default = []; + }; + swapKeys = mkOption { + description = "Lists with two keys to be swapped on the keyboard layout."; + type = types.listOf ( + # verify that each key swapping list contains two elements + types.addCheck (types.listOf types.str) (v: builtins.length v == 2) + ); + default = []; + }; + dual_role = mkOption { + type = types.listOf (types.submodule ({...}: { + options.input = mkOption {type = types.str;}; + options.hold = mkOption {type = types.listOf types.str;}; + options.tap = mkOption {type = types.listOf types.str;}; + })); + default = []; + }; + }; + })); + }; + }; + config = mkIf cfg.enable ( + with builtins; let + devs = map ({ + device_name, + remap, + swapKeys, + dual_role, + }: { + inherit device_name dual_role; + + # expand swapKeys to normal remaps + remap = concatLists [ + remap + (lib.lists.flatten (map (keys: [ + { + input = [(head keys)]; + output = [(lib.lists.last keys)]; + } + { + input = [(lib.lists.last keys)]; + output = [(head keys)]; + } + ]) + swapKeys)) + ]; + }) (attrValues cfg.devices); + in { + # generate numbered systemd services for each device to be remapped + # https://github.com/wez/evremap/issues/17 + systemd.services = listToAttrs (genList (i: { + name = "evremap${toString i}"; + value = let + cfgFile = toml.generate "remaps-${toString i}.toml" (elemAt devs i); + in { + script = "${evremap}/bin/evremap remap ${cfgFile}"; + wantedBy = ["multi-user.target"]; + unitConfig = { + Restart = "on-failure"; + }; + }; + }) (length devs)); + environment.systemPackages = [evremap]; + } + ); + } diff --git a/modules/desktop/x.nix b/modules/desktop/x.nix new file mode 100644 index 0000000..dab34ec --- /dev/null +++ b/modules/desktop/x.nix @@ -0,0 +1,18 @@ +{...}: { + services.xserver = { + enable = true; + + desktopManager = { + xterm.enable = false; + }; + + displayManager = { + defaultSession = "none+xmonad"; + gdm.enable = true; + }; + + windowManager.xmonad = { + enable = true; + }; + }; +} diff --git a/other/remaps-catbook-j.toml b/other/remaps-catbook-j.toml deleted file mode 100644 index 6a6067f..0000000 --- a/other/remaps-catbook-j.toml +++ /dev/null @@ -1,22 +0,0 @@ -device_name = "AT Translated Set 2 keyboard" - -[[remap]] -input = [ "KEY_Y" ] -output = [ "KEY_Z" ] - -[[remap]] -input = [ "KEY_Z" ] -output = [ "KEY_Y" ] - -[[remap]] -input = [ "KEY_LEFTALT" ] -output = [ "KEY_LEFTMETA" ] - -[[remap]] -input = [ "KEY_LEFTMETA" ] -output = [ "KEY_LEFTALT" ] - -[[dual_role]] -input = "KEY_CAPSLOCK" -hold = ["KEY_LEFTCTRL"] -tap = ["KEY_ESC"] From 193b0065574bb44d61391efd2809dc2a98548b86 Mon Sep 17 00:00:00 2001 From: Schrottkatze Date: Tue, 5 Mar 2024 13:10:25 +0100 Subject: [PATCH 2/7] add aliases for toggling caps lock --- other/config.nu | 3 +++ 1 file changed, 3 insertions(+) diff --git a/other/config.nu b/other/config.nu index 7b1d322..2a1a022 100644 --- a/other/config.nu +++ b/other/config.nu @@ -831,3 +831,6 @@ alias cr = cargo run; alias cl = cargo clippy; alias cb = cargo build; alias cch = cargo check; + +alias togglecaps = xdotool key Caps_Lock; +alias TOGGLECAPS = togglecaps; From 7829fcd0ce98759b8f50ee91182e3151cb9d8289 Mon Sep 17 00:00:00 2001 From: Schrottkatze Date: Tue, 5 Mar 2024 13:38:05 +0100 Subject: [PATCH 3/7] merge kmscon and tty configs --- common.nix | 19 ------------------- modules/default.nix | 1 - modules/shell/default.nix | 1 + modules/{kmscon.nix => shell/tty.nix} | 20 ++++++++++++++++++++ 4 files changed, 21 insertions(+), 20 deletions(-) rename modules/{kmscon.nix => shell/tty.nix} (88%) diff --git a/common.nix b/common.nix index 29b73ee..774f65f 100644 --- a/common.nix +++ b/common.nix @@ -90,25 +90,6 @@ with builtins; { }; }; - console.colors = [ - "282828" - "cc241d" - "98971a" - "d79921" - "458588" - "b16286" - "689d6a" - "a89984" - "928374" - "fb4934" - "b8bb26" - "fabd2f" - "83a598" - "d3869b" - "8ec07c" - "ebdbb2" - ]; - # nitrokey services.udev.packages = [pkgs.nitrokey-udev-rules]; services.pcscd.enable = true; diff --git a/modules/default.nix b/modules/default.nix index eb9042c..50424f2 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -6,7 +6,6 @@ ./flatpak.nix ./firewall.nix ./git.nix - ./kmscon.nix ./mprocs.nix ]; } diff --git a/modules/shell/default.nix b/modules/shell/default.nix index 4134bbc..a78c9fa 100644 --- a/modules/shell/default.nix +++ b/modules/shell/default.nix @@ -6,6 +6,7 @@ ./zellij.nix ./carapace.nix ./direnv.nix + ./tty.nix ]; programs.mosh.enable = true; } diff --git a/modules/kmscon.nix b/modules/shell/tty.nix similarity index 88% rename from modules/kmscon.nix rename to modules/shell/tty.nix index 4c859bd..3070907 100644 --- a/modules/kmscon.nix +++ b/modules/shell/tty.nix @@ -34,6 +34,26 @@ (getAttr (substring 5 2 (toUpper color)) hexLookupTable) ]); in { + # TODO: global colorscheme vars for everything + console.colors = [ + "282828" + "cc241d" + "98971a" + "d79921" + "458588" + "b16286" + "689d6a" + "a89984" + "928374" + "fb4934" + "b8bb26" + "fabd2f" + "83a598" + "d3869b" + "8ec07c" + "ebdbb2" + ]; + services.kmscon = { enable = true; fonts = [ From ede1765ee84319a454c4ab6a729dec7be5de82e9 Mon Sep 17 00:00:00 2001 From: Schrottkatze Date: Tue, 5 Mar 2024 13:49:22 +0100 Subject: [PATCH 4/7] move hardware key configs into one file --- common.nix | 10 ----- hosts/catbook-j/configuration.nix | 44 +------------------ .../monosodium-glutamate-g/configuration.nix | 38 +--------------- hosts/potatobook-g/configuration.nix | 9 ---- modules/desktop/specific-hardware/default.nix | 1 + .../specific-hardware/hardware_key.nix | 20 +++++++++ 6 files changed, 24 insertions(+), 98 deletions(-) create mode 100644 modules/desktop/specific-hardware/hardware_key.nix diff --git a/common.nix b/common.nix index 774f65f..d93b56b 100644 --- a/common.nix +++ b/common.nix @@ -29,9 +29,6 @@ with builtins; { environment = { systemPackages = with pkgs; [ - # pynitrokey - # nitrokey-app2 - veracrypt htmlq @@ -90,10 +87,6 @@ with builtins; { }; }; - # nitrokey - services.udev.packages = [pkgs.nitrokey-udev-rules]; - services.pcscd.enable = true; - programs = { ssh.startAgent = false; gnupg.agent = { @@ -138,9 +131,6 @@ with builtins; { users.users.jade = { isNormalUser = true; extraGroups = ["wheel" "input" "uinput" "libvirtd" "adbusers" "dialout" "plugdev" "wireshark"]; - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOaE8TFsIazpn4OnHvHcRpOFr9FfvMaWOiEjmHsmnAoE cardno:000F_70CD7D05" - ]; }; zramSwap = { diff --git a/hosts/catbook-j/configuration.nix b/hosts/catbook-j/configuration.nix index 406f484..71d44e0 100644 --- a/hosts/catbook-j/configuration.nix +++ b/hosts/catbook-j/configuration.nix @@ -103,55 +103,15 @@ "/crypto_keyfile.bin" = null; }; - # nixpkgs = { - # overlays = [ - # (self: super: { - # linux_zen_xeniafied = pkgs.linuxPackagesFor (pkgs.linuxKernel.kernels.linux_zen.override { - # structuredExtraConfig = with lib.kernel; { - # "FB" = yes; - # "FRAMEBUFFER_CONSOLE" = yes; - # "VGA_CONSOLE" = yes; - # "VIDEO_SELECT" = yes; - # LOGO = lib.mkForce yes; - # LOGO_LINUX_CLUT224 = yes; - # }; - # ignoreConfigErrors = true; - # }); - # }) - # ]; - # }; - boot.kernelPackages = pkgs.linuxPackages_zen; - # boot.kernelPatches = [ - # { - # name = "fomx"; - # patch = ../../other/0001-fomx.patch; - # } - # ]; - services.xserver.displayManager.autoLogin = { enable = true; user = "jade"; }; - networking.hostName = "catbook-j"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Enable networking + # networking networking.networkmanager.enable = true; - - security.pam.services.jade.u2fAuth = true; - programs.i3lock.u2fSupport = true; - security.pam.u2f = { - enable = true; - cue = true; - control = "sufficient"; - authFile = "/home/jade/.ssh/u2f_keys"; - }; + networking.hostName = "catbook-j"; i18n.extraLocaleSettings = { LC_ADDRESS = "de_DE.UTF-8"; diff --git a/hosts/monosodium-glutamate-g/configuration.nix b/hosts/monosodium-glutamate-g/configuration.nix index 7010b36..b6cb3d9 100644 --- a/hosts/monosodium-glutamate-g/configuration.nix +++ b/hosts/monosodium-glutamate-g/configuration.nix @@ -8,24 +8,6 @@ ../../modules ]; - # nixpkgs = { - # overlays = [ - # (self: super: { - # linux_zen_xeniafied = pkgs.linuxPackagesFor (pkgs.linuxKernel.kernels.linux_zen.override { - # structuredExtraConfig = with lib.kernel; { - # "FB" = yes; - # "FRAMEBUFFER_CONSOLE" = yes; - # "VGA_CONSOLE" = yes; - # "VIDEO_SELECT" = yes; - # LOGO = lib.mkForce yes; - # LOGO_LINUX_CLUT224 = yes; - # }; - # ignoreConfigErrors = true; - # }); - # }) - # ]; - # }; - jade = { flatpak.enable = true; desktop = { @@ -46,16 +28,8 @@ systemd-boot.enable = true; efi.canTouchEfiVariables = true; }; - # latest linux kernel - #boot.kernelPackages = pkgs.linuxPackages_latest; - #boot.kernelPackages = pkgs.linux_zen_xeniafied; + kernelPackages = pkgs.linuxPackages_zen; - # boot.kernelPatches = [ - # { - # name = "fomx"; - # patch = ../other/0001-fomx.patch; - # } - # ]; binfmt.emulatedSystems = ["aarch64-linux"]; }; @@ -82,16 +56,6 @@ enableRedistributableFirmware = true; }; - security.pam.services.jade.u2fAuth = true; - programs.i3lock.u2fSupport = true; - - security.pam.u2f = { - enable = true; - cue = true; - control = "sufficient"; - authFile = "/home/jade/.ssh/u2f_keys"; - }; - # missing: menu-qalc picom-jonaburg environment.systemPackages = with pkgs; [ # TODO: clean up. diff --git a/hosts/potatobook-g/configuration.nix b/hosts/potatobook-g/configuration.nix index 28a2e87..c45c889 100644 --- a/hosts/potatobook-g/configuration.nix +++ b/hosts/potatobook-g/configuration.nix @@ -116,17 +116,8 @@ services.gnome.gnome-keyring.enable = true; programs.seahorse.enable = true; security.pam.services.jade.enableGnomeKeyring = true; - security.pam.services.jade.u2fAuth = true; systemd.services."NetworkManager-wait-online".enable = false; - programs.i3lock.u2fSupport = true; - - security.pam.u2f = { - enable = true; - cue = true; - control = "sufficient"; - authFile = "/home/jade/.ssh/u2f_keys"; - }; # services.pixiecore = # let diff --git a/modules/desktop/specific-hardware/default.nix b/modules/desktop/specific-hardware/default.nix index 8faabd2..a28d10f 100644 --- a/modules/desktop/specific-hardware/default.nix +++ b/modules/desktop/specific-hardware/default.nix @@ -7,5 +7,6 @@ imports = [ ./spacenav.nix ./wacom.nix + ./hardware_key.nix ]; } diff --git a/modules/desktop/specific-hardware/hardware_key.nix b/modules/desktop/specific-hardware/hardware_key.nix new file mode 100644 index 0000000..8510d86 --- /dev/null +++ b/modules/desktop/specific-hardware/hardware_key.nix @@ -0,0 +1,20 @@ +{pkgs, ...}: { + # nitrokey + services.udev.packages = [pkgs.nitrokey-udev-rules]; + + # smartcard daemon + services.pcscd.enable = true; + + # authenticate using hw key + security.pam = { + services.jade.u2fAuth = true; + u2f = { + enable = true; + cue = true; + control = "sufficient"; + authFile = "/home/jade/.ssh/u2f_keys"; + }; + }; + + programs.i3lock.u2fSupport = true; +} From 9a7768ff5bf7d7d7df74df3f56fbd69e2ecbd2e0 Mon Sep 17 00:00:00 2001 From: Schrottkatze Date: Tue, 5 Mar 2024 13:53:39 +0100 Subject: [PATCH 5/7] move git and mprocs configs to shell module --- modules/default.nix | 2 -- modules/shell/default.nix | 2 ++ modules/{ => shell}/git.nix | 0 modules/{ => shell}/mprocs.nix | 0 4 files changed, 2 insertions(+), 2 deletions(-) rename modules/{ => shell}/git.nix (100%) rename modules/{ => shell}/mprocs.nix (100%) diff --git a/modules/default.nix b/modules/default.nix index 50424f2..2a976f1 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -5,7 +5,5 @@ ./terminal.nix ./flatpak.nix ./firewall.nix - ./git.nix - ./mprocs.nix ]; } diff --git a/modules/shell/default.nix b/modules/shell/default.nix index a78c9fa..6f7f4db 100644 --- a/modules/shell/default.nix +++ b/modules/shell/default.nix @@ -7,6 +7,8 @@ ./carapace.nix ./direnv.nix ./tty.nix + ./git.nix + ./mprocs.nix ]; programs.mosh.enable = true; } diff --git a/modules/git.nix b/modules/shell/git.nix similarity index 100% rename from modules/git.nix rename to modules/shell/git.nix diff --git a/modules/mprocs.nix b/modules/shell/mprocs.nix similarity index 100% rename from modules/mprocs.nix rename to modules/shell/mprocs.nix From 7bacabf0d324085555d5485bdf634f89480ee28c Mon Sep 17 00:00:00 2001 From: Schrottkatze Date: Tue, 5 Mar 2024 17:10:35 +0100 Subject: [PATCH 6/7] biiiiig refactor (part 1) --- hosts/catbook-j/configuration.nix | 3 -- modules/default.nix | 5 ++- .../audio.nix | 0 .../compositing.nix | 0 modules/desktop-environment/default.nix | 11 +++++ .../dunst.nix | 0 modules/desktop-environment/flatpak.nix | 16 +++++++ .../desktop-environment/panels/default.nix | 6 +++ .../panels}/polybar.nix | 0 .../panels/xmobar/default.nix | 33 ++++++++++++++ .../panels}/xmobar/xmobar.hs | 0 .../{ => desktop-environment}/terminal.nix | 0 .../desktop-environment/xmonad/default.nix | 25 +++++++++++ .../desktop-environment}/xmonad/xmonad.hs | 0 modules/desktop/default.nix | 7 --- modules/desktop/xmonad.nix | 43 ------------------- modules/flatpak.nix | 24 ----------- .../default.nix | 0 .../hardware_key.nix | 0 .../spacenav.nix | 0 .../specific-hardware => hardware}/wacom.nix | 0 modules/{desktop => }/input/default.nix | 0 modules/{desktop => }/input/evremap.nix | 4 +- 23 files changed, 96 insertions(+), 81 deletions(-) rename modules/{desktop => desktop-environment}/audio.nix (100%) rename modules/{desktop => desktop-environment}/compositing.nix (100%) create mode 100644 modules/desktop-environment/default.nix rename modules/{desktop => desktop-environment}/dunst.nix (100%) create mode 100644 modules/desktop-environment/flatpak.nix create mode 100644 modules/desktop-environment/panels/default.nix rename modules/{desktop => desktop-environment/panels}/polybar.nix (100%) create mode 100644 modules/desktop-environment/panels/xmobar/default.nix rename {haskell => modules/desktop-environment/panels}/xmobar/xmobar.hs (100%) rename modules/{ => desktop-environment}/terminal.nix (100%) create mode 100644 modules/desktop-environment/xmonad/default.nix rename {haskell => modules/desktop-environment}/xmonad/xmonad.hs (100%) delete mode 100644 modules/desktop/xmonad.nix delete mode 100644 modules/flatpak.nix rename modules/{desktop/specific-hardware => hardware}/default.nix (100%) rename modules/{desktop/specific-hardware => hardware}/hardware_key.nix (100%) rename modules/{desktop/specific-hardware => hardware}/spacenav.nix (100%) rename modules/{desktop/specific-hardware => hardware}/wacom.nix (100%) rename modules/{desktop => }/input/default.nix (100%) rename modules/{desktop => }/input/evremap.nix (96%) diff --git a/hosts/catbook-j/configuration.nix b/hosts/catbook-j/configuration.nix index 71d44e0..6361745 100644 --- a/hosts/catbook-j/configuration.nix +++ b/hosts/catbook-j/configuration.nix @@ -17,9 +17,7 @@ ../../modules ]; jade = { - flatpak.enable = true; desktop = { - compositing.enable = true; syncthing.enable = true; kdeconnect.enable = true; cloud.enable = true; @@ -43,7 +41,6 @@ ]; }; }; - terminal.enable = true; }; hardware.trackpoint = { diff --git a/modules/default.nix b/modules/default.nix index 2a976f1..adf3726 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -2,8 +2,9 @@ imports = [ ./shell ./desktop - ./terminal.nix - ./flatpak.nix + ./hardware ./firewall.nix + ./desktop-environment + ./input ]; } diff --git a/modules/desktop/audio.nix b/modules/desktop-environment/audio.nix similarity index 100% rename from modules/desktop/audio.nix rename to modules/desktop-environment/audio.nix diff --git a/modules/desktop/compositing.nix b/modules/desktop-environment/compositing.nix similarity index 100% rename from modules/desktop/compositing.nix rename to modules/desktop-environment/compositing.nix diff --git a/modules/desktop-environment/default.nix b/modules/desktop-environment/default.nix new file mode 100644 index 0000000..896469c --- /dev/null +++ b/modules/desktop-environment/default.nix @@ -0,0 +1,11 @@ +{...}: { + imports = [ + ./audio.nix + ./compositing.nix + ./dunst.nix + ./panels + ./xmonad + ./terminal.nix + ./flatpak.nix + ]; +} diff --git a/modules/desktop/dunst.nix b/modules/desktop-environment/dunst.nix similarity index 100% rename from modules/desktop/dunst.nix rename to modules/desktop-environment/dunst.nix diff --git a/modules/desktop-environment/flatpak.nix b/modules/desktop-environment/flatpak.nix new file mode 100644 index 0000000..cf8b7b2 --- /dev/null +++ b/modules/desktop-environment/flatpak.nix @@ -0,0 +1,16 @@ +{ + config, + lib, + pkgs, + ... +}: { + services.flatpak.enable = true; + xdg.portal = { + enable = true; + # TODO + config.common.default = "*"; + extraPortals = [ + pkgs.xdg-desktop-portal-gtk + ]; + }; +} diff --git a/modules/desktop-environment/panels/default.nix b/modules/desktop-environment/panels/default.nix new file mode 100644 index 0000000..920a7dc --- /dev/null +++ b/modules/desktop-environment/panels/default.nix @@ -0,0 +1,6 @@ +{...}: { + imports = [ + ./xmobar + ./polybar.nix + ]; +} diff --git a/modules/desktop/polybar.nix b/modules/desktop-environment/panels/polybar.nix similarity index 100% rename from modules/desktop/polybar.nix rename to modules/desktop-environment/panels/polybar.nix diff --git a/modules/desktop-environment/panels/xmobar/default.nix b/modules/desktop-environment/panels/xmobar/default.nix new file mode 100644 index 0000000..32a11aa --- /dev/null +++ b/modules/desktop-environment/panels/xmobar/default.nix @@ -0,0 +1,33 @@ +{ + lib, + pkgs, + ... +}: { + home-manager.users.jade = { + config, + pkgs, + ... + }: let + xmobarGhc = pkgs.haskellPackages.ghcWithPackages (pkgs: + with pkgs; [ + xmobar + statgrab + ]); + in { + home = { + packages = [xmobarGhc]; + file."xmobar.hs" = rec { + source = ./xmobar.hs; + target = ".config/xmobar/xmobar.hs"; + onChange = '' + ${xmobarGhc}/bin/ghc -threaded ${target} + ${pkgs.busybox}/bin/pkill xmobar + ${pkgs.haskellPackages.xmonad}/bin/xmonad --restart + ''; + }; + }; + programs.xmobar = { + enable = true; + }; + }; +} diff --git a/haskell/xmobar/xmobar.hs b/modules/desktop-environment/panels/xmobar/xmobar.hs similarity index 100% rename from haskell/xmobar/xmobar.hs rename to modules/desktop-environment/panels/xmobar/xmobar.hs diff --git a/modules/terminal.nix b/modules/desktop-environment/terminal.nix similarity index 100% rename from modules/terminal.nix rename to modules/desktop-environment/terminal.nix diff --git a/modules/desktop-environment/xmonad/default.nix b/modules/desktop-environment/xmonad/default.nix new file mode 100644 index 0000000..ec930e4 --- /dev/null +++ b/modules/desktop-environment/xmonad/default.nix @@ -0,0 +1,25 @@ +{ + lib, + pkgs, + ... +}: { + home-manager.users.jade = { + config, + pkgs, + ... + }: { + home.packages = [pkgs.xmonadctl]; + xsession.windowManager.xmonad = { + enable = true; + enableContribAndExtras = true; + config = ./xmonad.hs; + }; + home.file.wallpaper = { + target = "Pictures/wallpaper.jpg"; + source = ../../../other/wallpaper.jpg; + onChange = '' + feh --bg-fill ~/Pictures/wallpaper.jpg; + ''; + }; + }; +} diff --git a/haskell/xmonad/xmonad.hs b/modules/desktop-environment/xmonad/xmonad.hs similarity index 100% rename from haskell/xmonad/xmonad.hs rename to modules/desktop-environment/xmonad/xmonad.hs diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 2e519bd..00e872b 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -15,26 +15,19 @@ in with lib; { imports = [ - ./audio.nix ./gaming.nix ./creative.nix # TODO: more fine grained choices, not every setup needs fspy or rawtherapee - ./dunst.nix - ./compositing.nix ./ios-compat.nix ./syncthing.nix ./kdeconnect.nix ./themeing.nix ./cloud.nix ./networking.nix - ./polybar.nix ./social.nix ./mail.nix - ./specific-hardware - ./xmonad.nix ./fonts.nix ./firefox.nix ./x.nix - ./input ]; i18n.inputMethod = { diff --git a/modules/desktop/xmonad.nix b/modules/desktop/xmonad.nix deleted file mode 100644 index 9f806a3..0000000 --- a/modules/desktop/xmonad.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ - lib, - pkgs, - ... -}: { - home-manager.users.jade = { - config, - pkgs, - ... - }: let - xmobarGhc = pkgs.haskellPackages.ghcWithPackages (pkgs: - with pkgs; [ - xmobar - statgrab - ]); - in { - home.packages = [xmobarGhc pkgs.xmonadctl]; - programs.xmobar = { - enable = true; - }; - home.file."xmobar.hs" = rec { - source = ../../haskell/xmobar/xmobar.hs; - target = ".config/xmobar/xmobar.hs"; - onChange = '' - ${xmobarGhc}/bin/ghc -threaded ${target} - ${pkgs.busybox}/bin/pkill xmobar - ${pkgs.haskellPackages.xmonad}/bin/xmonad --restart - ''; - }; - xsession.windowManager.xmonad = { - enable = true; - enableContribAndExtras = true; - config = ../../haskell/xmonad/xmonad.hs; - }; - home.file.wallpaper = { - target = "Pictures/wallpaper.jpg"; - source = ../../other/wallpaper.jpg; - onChange = '' - feh --bg-fill ~/Pictures/wallpaper.jpg; - ''; - }; - }; -} diff --git a/modules/flatpak.nix b/modules/flatpak.nix deleted file mode 100644 index e3683fe..0000000 --- a/modules/flatpak.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: let - cfg = config.jade.flatpak; -in - with lib; { - options.jade.flatpak = { - enable = mkEnableOption "Enable flatpak"; - }; - config = mkIf cfg.enable { - services.flatpak.enable = true; - xdg.portal = { - enable = true; - # TODO - config.common.default = "*"; - extraPortals = [ - pkgs.xdg-desktop-portal-gtk - ]; - }; - }; - } diff --git a/modules/desktop/specific-hardware/default.nix b/modules/hardware/default.nix similarity index 100% rename from modules/desktop/specific-hardware/default.nix rename to modules/hardware/default.nix diff --git a/modules/desktop/specific-hardware/hardware_key.nix b/modules/hardware/hardware_key.nix similarity index 100% rename from modules/desktop/specific-hardware/hardware_key.nix rename to modules/hardware/hardware_key.nix diff --git a/modules/desktop/specific-hardware/spacenav.nix b/modules/hardware/spacenav.nix similarity index 100% rename from modules/desktop/specific-hardware/spacenav.nix rename to modules/hardware/spacenav.nix diff --git a/modules/desktop/specific-hardware/wacom.nix b/modules/hardware/wacom.nix similarity index 100% rename from modules/desktop/specific-hardware/wacom.nix rename to modules/hardware/wacom.nix diff --git a/modules/desktop/input/default.nix b/modules/input/default.nix similarity index 100% rename from modules/desktop/input/default.nix rename to modules/input/default.nix diff --git a/modules/desktop/input/evremap.nix b/modules/input/evremap.nix similarity index 96% rename from modules/desktop/input/evremap.nix rename to modules/input/evremap.nix index bc9a1da..1880eb9 100644 --- a/modules/desktop/input/evremap.nix +++ b/modules/input/evremap.nix @@ -16,9 +16,9 @@ sha256 = "sha256-BxSrphgW1n465FX6bKVkq6O0XE2JqanfSYlsGwWUWkQ="; }; cargoHash = ""; - cargoLock.lockFile = ../../../other/evremap.Cargo.lock; + cargoLock.lockFile = ../../other/evremap.Cargo.lock; postPatch = '' - cp ${../../../other/evremap.Cargo.lock} Cargo.lock + cp ${../../other/evremap.Cargo.lock} Cargo.lock ''; nativeBuildInputs = [pkgs.pkg-config]; buildInputs = [pkgs.libevdev]; From 2a5e635c0dd9ac5ab0ee2e48fb7f1c113ca2a289 Mon Sep 17 00:00:00 2001 From: Schrottkatze Date: Tue, 5 Mar 2024 18:51:30 +0100 Subject: [PATCH 7/7] make terminal module default module thingy --- modules/desktop-environment/terminal.nix | 79 ++++++++++-------------- 1 file changed, 33 insertions(+), 46 deletions(-) diff --git a/modules/desktop-environment/terminal.nix b/modules/desktop-environment/terminal.nix index 1366350..23ce2cb 100644 --- a/modules/desktop-environment/terminal.nix +++ b/modules/desktop-environment/terminal.nix @@ -1,49 +1,36 @@ -{ - config, - lib, - pkgs, - ... -}: let - cfg = config.jade.terminal; -in - with lib; { - options.jade.terminal = { - enable = mkEnableOption "Enable Kitty"; - }; - config = mkIf cfg.enable { - environment.sessionVariables = rec { - TERMINAL = "kitty"; +{...}: { + environment.sessionVariables = { + TERMINAL = "kitty"; + }; + home-manager.users.jade = {pkgs, ...}: { + programs.kitty = { + enable = true; + font = { + name = "FiraCode Nerd Font"; + size = 11; }; - home-manager.users.jade = {pkgs, ...}: { - programs.kitty = { - enable = true; - font = { - name = "FiraCode Nerd Font"; - size = 11; - }; - settings = { - #adjust_column_width = "70%"; - color0 = "#282828"; - color8 = "#928374"; - color1 = "#cc241d"; - color9 = "#fb4934"; - color2 = "#98971a"; - color10 = "#b8bb26"; - color3 = "#d79921"; - color11 = "#fabd2f"; - color4 = "#458588"; - color12 = "#83a598"; - color5 = "#b16286"; - color13 = "#d3869b"; - color6 = "#689d6a"; - color14 = "#8ec07c"; - color7 = "#a89984"; - color15 = "#ebdbb2"; - foreground = "#ebdbb2"; - background = "#282828"; - confirm_os_window_close = 0; - }; - }; + settings = { + #adjust_column_width = "70%"; + color0 = "#282828"; + color8 = "#928374"; + color1 = "#cc241d"; + color9 = "#fb4934"; + color2 = "#98971a"; + color10 = "#b8bb26"; + color3 = "#d79921"; + color11 = "#fabd2f"; + color4 = "#458588"; + color12 = "#83a598"; + color5 = "#b16286"; + color13 = "#d3869b"; + color6 = "#689d6a"; + color14 = "#8ec07c"; + color7 = "#a89984"; + color15 = "#ebdbb2"; + foreground = "#ebdbb2"; + background = "#282828"; + confirm_os_window_close = 0; }; }; - } + }; +}