From 0f0409a489aa87f9055bc68f473c538a35e47dc6 Mon Sep 17 00:00:00 2001 From: Victor Mignot Date: Thu, 1 Aug 2024 21:40:51 +0200 Subject: [PATCH] Rework modules --- configurations/camelot/default.nix | 2 +- configurations/camelot/hardware.nix | 2 +- configurations/fuyuki/default.nix | 16 +- configurations/fuyuki/hardware.nix | 2 +- configurations/london/default.nix | 25 +- configurations/london/hardware.nix | 1 + configurations/okeanos/default.nix | 4 +- flake.nix | 14 +- machines.nix | 4 - modules/common/boot.nix | 6 +- modules/common/default.nix | 36 +- modules/common/hardware.nix | 11 +- modules/common/linux.nix | 61 +--- modules/common/nix.nix | 11 - modules/common/users.nix | 11 +- modules/default.nix | 11 + modules/server/builder.nix | 34 -- modules/workstation/bluetooth.nix | 4 +- modules/workstation/default.nix | 75 ++-- modules/workstation/desktop.nix | 15 +- .../home-manager/communication.nix | 37 +- modules/workstation/home-manager/default.nix | 3 - .../home-manager/desktop/alacritty.nix | 11 +- .../home-manager/desktop/default.nix | 73 +--- .../workstation/home-manager/desktop/sway.nix | 257 -------------- .../home-manager/desktop/sway/default.nix | 321 ++++++++++++++++++ .../home-manager/desktop/{ => sway}/mako.nix | 2 +- .../desktop/{ => sway}/swaylock.nix | 2 +- .../desktop/{ => sway}/waybar.nix | 3 +- .../home-manager/desktop/{ => sway}/wofi.nix | 2 +- .../home-manager/development/default.nix | 6 +- .../home-manager/development/embedded.nix | 6 +- modules/workstation/home-manager/fish.nix | 21 +- modules/workstation/home-manager/gpg.nix | 4 +- modules/workstation/home-manager/mail.nix | 6 +- modules/workstation/home-manager/termux.nix | 51 --- 36 files changed, 476 insertions(+), 674 deletions(-) create mode 100644 modules/default.nix delete mode 100644 modules/server/builder.nix delete mode 100644 modules/workstation/home-manager/desktop/sway.nix create mode 100644 modules/workstation/home-manager/desktop/sway/default.nix rename modules/workstation/home-manager/desktop/{ => sway}/mako.nix (89%) rename modules/workstation/home-manager/desktop/{ => sway}/swaylock.nix (95%) rename modules/workstation/home-manager/desktop/{ => sway}/waybar.nix (98%) rename modules/workstation/home-manager/desktop/{ => sway}/wofi.nix (96%) delete mode 100644 modules/workstation/home-manager/termux.nix diff --git a/configurations/camelot/default.nix b/configurations/camelot/default.nix index d9df8a1..29bf2d3 100644 --- a/configurations/camelot/default.nix +++ b/configurations/camelot/default.nix @@ -53,7 +53,7 @@ }; }; - machineUsers = { + my.users = { dala = { description = "Dala"; groups = [ "wheel" ]; diff --git a/configurations/camelot/hardware.nix b/configurations/camelot/hardware.nix index 5c66776..ab94f0f 100644 --- a/configurations/camelot/hardware.nix +++ b/configurations/camelot/hardware.nix @@ -32,7 +32,7 @@ swapDevices = [ { device = "/dev/disk/by-uuid/a7c628ab-c5cb-4094-89d0-19b153fbead4"; } ]; - hwAccelerationGPU = "intel"; + my.hardware.gpu = "intel"; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/configurations/fuyuki/default.nix b/configurations/fuyuki/default.nix index c550a08..c57b01c 100644 --- a/configurations/fuyuki/default.nix +++ b/configurations/fuyuki/default.nix @@ -15,11 +15,7 @@ deployment.targetHost = null; boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; - useLatestKernel = true; - - isProfessional = false; - allowUnfreePackages = true; - keymap = "us"; + console.keyMap = "us"; sops = { gnupg.sshKeyPaths = [ ]; @@ -31,7 +27,7 @@ secrets.wg0_private = { }; }; - machineUsers = { + my.users = { dala = { description = "Dala"; groups = [ @@ -45,10 +41,10 @@ uid = 1000; shell = pkgs.fish; - enableHomeManagerProfile = true; - homeManagerConfig = { + hmConfig = { programs.helix.enable = true; - desktop.monitors = [ + my.communications.matrix-client.enable = true; + my.desktop.sway.monitors = [ { name = "Chimei Innolux Corporation 0x14C9 Unknown"; resolution = "1920x1080@60.008Hz"; @@ -57,7 +53,7 @@ } ]; nixpkgs.config.allowUnfree = true; - development.embedded.enableTools = true; + my.development.embedded-tools.enable = true; }; }; }; diff --git a/configurations/fuyuki/hardware.nix b/configurations/fuyuki/hardware.nix index d018fbc..79663a8 100644 --- a/configurations/fuyuki/hardware.nix +++ b/configurations/fuyuki/hardware.nix @@ -13,7 +13,7 @@ boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - hwAccelerationGPU = "intel"; + my.hardware.gpu = "intel"; boot.initrd.luks.devices = { crypted-nixos = { diff --git a/configurations/london/default.nix b/configurations/london/default.nix index 0d26ac6..972bf7f 100644 --- a/configurations/london/default.nix +++ b/configurations/london/default.nix @@ -9,15 +9,9 @@ imports = [ ./hardware.nix ]; - # Meta - isProfessional = false; - deployment.targetHost = null; boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; - # Linux kernel - useLatestKernel = true; - # Custom udev rules for Nucleo's stlink interface services.udev.extraRules = '' ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b",MODE="660",GROUP="dialout",TAG+="uaccess" @@ -25,15 +19,7 @@ ''; # Nix - allowUnfreePackages = true; - - # Hardware acceleration - hwAccelerationGPU = "nvidia"; - - # Enable Docker - enableDocker = true; - - keymap = "fr"; + nixpkgs.config.allowUnfree = true; # System secrets sops = { @@ -66,7 +52,7 @@ }; # User config - machineUsers = { + my.users = { dala = { description = "Dala"; groups = [ @@ -82,10 +68,9 @@ ]; uid = 1000; shell = pkgs.fish; - enableHomeManagerProfile = true; - homeManagerConfig = { + hmConfig = { programs.helix.enable = true; - desktop.monitors = [ + my.desktop.sway.monitors = [ { name = "Iiyama North America PL2470H 0x0000047B"; resolution = "1920x1080@165.003Hz"; @@ -101,7 +86,7 @@ ]; nixpkgs.config.allowUnfree = true; - development.embedded.enableTools = true; + my.development.embedded-tools.enable = true; }; }; }; diff --git a/configurations/london/hardware.nix b/configurations/london/hardware.nix index 8881232..58a070f 100644 --- a/configurations/london/hardware.nix +++ b/configurations/london/hardware.nix @@ -41,5 +41,6 @@ swapDevices = [ { device = "/dev/disk/by-uuid/5fe5e76b-df3d-43ce-abf9-d2b63078df09"; } ]; + my.hardware.gpu = "nvidia"; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/configurations/okeanos/default.nix b/configurations/okeanos/default.nix index f907f23..5ccf671 100644 --- a/configurations/okeanos/default.nix +++ b/configurations/okeanos/default.nix @@ -10,11 +10,11 @@ # Use the extlinux boot loader. (NixOS wants to enable GRUB by default) boot.loader.grub.enable = false; - enableSystemdBoot = false; + my.systemd-boot.enable = false; # Enables the generation of /boot/extlinux/extlinux.conf boot.loader.generic-extlinux-compatible.enable = true; - machineUsers = { + my.users = { dala = { description = "Dala"; groups = [ "wheel" ]; diff --git a/flake.nix b/flake.nix index e23293f..b67746e 100644 --- a/flake.nix +++ b/flake.nix @@ -51,6 +51,7 @@ }: let machines = import ./machines.nix; + my = import ./modules; lixModules = { stable = lix-module-stable; unstable = lix-module-unstable; @@ -66,13 +67,7 @@ imports = [ lixModules.${config.nixpkgs}.nixosModules.default ./configurations/${name} - (if (config.type == "workstation") then ./modules/workstation else ./modules/server) - ( - if (config.type == "workstation" && config.enableHomeManager) then - home-manager.nixosModules.home-manager - else - { } - ) + (if config.enableHomeManager then home-manager.nixosModules.home-manager else { }) (if (config.system == "x86_64-linux") then lanzaboote.nixosModules.lanzaboote else { }) ]; @@ -111,7 +106,10 @@ defaults = { ... }: { - imports = [ sops-nix.nixosModules.sops ]; + imports = [ + sops-nix.nixosModules.sops + my.modules + ]; }; } // machinesNodes; diff --git a/machines.nix b/machines.nix index 6ff609b..9987b89 100644 --- a/machines.nix +++ b/machines.nix @@ -1,6 +1,5 @@ { london = { - type = "workstation"; nixpkgs = "unstable"; system = "x86_64-linux"; enableHomeManager = true; @@ -9,7 +8,6 @@ }; camelot = { - type = "server"; nixpkgs = "stable"; system = "x86_64-linux"; enableHomeManager = false; @@ -18,7 +16,6 @@ }; fuyuki = { - type = "workstation"; nixpkgs = "unstable"; system = "x86_64-linux"; enableHomeManager = true; @@ -27,7 +24,6 @@ }; okeanos = { - type = "server"; nixpkgs = "stable"; system = "aarch64-linux"; enableHomeManager = false; diff --git a/modules/common/boot.nix b/modules/common/boot.nix index 623e7e4..2b785cb 100644 --- a/modules/common/boot.nix +++ b/modules/common/boot.nix @@ -7,7 +7,7 @@ }: with lib; { - options.enableSystemdBoot = mkOption { + options.my.systemd-boot.enable = mkOption { type = types.bool; default = true; example = false; @@ -17,13 +17,13 @@ with lib; ''; }; - config.environment.systemPackages = lib.mkIf config.enableSystemdBoot [ pkgs.sbctl ]; + config.environment.systemPackages = lib.mkIf config.my.systemd-boot.enable [ pkgs.sbctl ]; config.boot = { loader.systemd-boot.enable = false; } // ( - if config.enableSystemdBoot then + if config.my.systemd-boot.enable then { lanzaboote = { enable = true; diff --git a/modules/common/default.nix b/modules/common/default.nix index 23bc08e..1b69eae 100644 --- a/modules/common/default.nix +++ b/modules/common/default.nix @@ -17,34 +17,12 @@ with lib; (modulesPath + "/installer/scan/not-detected.nix") ]; - options.isProfessional = mkOption { - type = types.bool; - default = false; - example = true; - description = '' - Whether or not this machine is used for professionnal purposes. - ''; - }; + # Only enable fish shell if there is at least one user using it. + programs.fish.enable = builtins.any (user: user.shell == pkgs.fish) ( + builtins.attrValues config.my.users + ); - options.enableDocker = mkOption { - type = types.bool; - default = false; - example = true; - description = '' - Whether or not to enable the docker stack. - ''; - }; - - config = { - virtualisation.docker.enable = config.enableDocker; - - # Only enable fish shell if there is at least one user using it. - programs.fish.enable = builtins.any (user: user.shell == pkgs.fish) ( - builtins.attrValues config.machineUsers - ); - - # We always want to disable the X server as only workstation use windows manager - # and they always use wayland. - services.xserver.enable = false; - }; + # We always want to disable the X server as only workstation use windows manager + # and they always use wayland. + services.xserver.enable = false; } diff --git a/modules/common/hardware.nix b/modules/common/hardware.nix index 4263d44..e7f044e 100644 --- a/modules/common/hardware.nix +++ b/modules/common/hardware.nix @@ -6,11 +6,12 @@ ... }: let + gpu = config.my.hardware.gpu; hwAccelerationOptionPath = if (machineProps == "unstable") then "graphics" else "opengl"; in with lib; { - options.hwAccelerationGPU = mkOption { + options.my.hardware.gpu = mkOption { type = types.nullOr ( types.enum [ "nvidia" @@ -26,14 +27,14 @@ with lib; }; config = { - boot.kernelParams = mkIf (config.hwAccelerationGPU == "intel") [ "i915.enable_guc=2" ]; + boot.kernelParams = mkIf (gpu == "intel") [ "i915.enable_guc=2" ]; # Small hack as this option path changes between 24.05 and unstable hardware.${hwAccelerationOptionPath} = { - enable = config.hwAccelerationGPU != null; + enable = gpu != null; extraPackages = with pkgs; [ - (mkIf (config.hwAccelerationGPU == "intel") intel-media-driver) - (mkIf (config.hwAccelerationGPU == "intel") intel-compute-runtime) + (mkIf (gpu == "intel") intel-media-driver) + (mkIf (gpu == "intel") intel-compute-runtime) ]; }; }; diff --git a/modules/common/linux.nix b/modules/common/linux.nix index 2b8f8a2..f7db748 100644 --- a/modules/common/linux.nix +++ b/modules/common/linux.nix @@ -1,58 +1,7 @@ +{ lib, ... }: { - lib, - config, - pkgs, - ... -}: -with lib; -{ - options.useLatestKernel = mkOption { - type = types.bool; - default = false; - example = true; - description = '' - Whether or not to use the latest Linux kernel version. - ''; - }; - - options.consoleFont = mkOption { - type = types.str; - default = "Lat2-Terminus16"; - description = '' - The font to use in the Linux console. - ''; - }; - - options.timeZone = mkOption { - type = types.str; - default = "Europe/Paris"; - description = '' - The system time zone. - ''; - }; - - options.locale = mkOption { - type = types.str; - default = "en_US.utf8"; - description = '' - The system locale. - ''; - }; - - options.keymap = mkOption { - type = types.str; - default = "fr"; - example = "fr"; - description = '' - The keyboard map used. - ''; - }; - - config = { - boot.kernelPackages = mkIf config.useLatestKernel pkgs.linuxPackages_latest; - time.timeZone = config.timeZone; - console.font = config.consoleFont; - console.keyMap = config.keymap; - i18n.defaultLocale = config.locale; - }; + console.keyMap = lib.mkDefault "fr"; + time.timeZone = lib.mkDefault "Europe/Paris"; + console.font = lib.mkDefault "Lat2-Terminus16"; + i18n.defaultLocale = lib.mkDefault "en_US.utf8"; } diff --git a/modules/common/nix.nix b/modules/common/nix.nix index 90f4a98..a791149 100644 --- a/modules/common/nix.nix +++ b/modules/common/nix.nix @@ -6,15 +6,6 @@ }: with lib; { - options.allowUnfreePackages = mkOption { - type = types.bool; - default = false; - example = true; - description = '' - Whether the system can use unfree derivations. - ''; - }; - config = { nix = { settings.sandbox = true; @@ -25,7 +16,5 @@ with lib; experimental-features = nix-command flakes ''; }; - - nixpkgs.config.allowUnfree = config.allowUnfreePackages; }; } diff --git a/modules/common/users.nix b/modules/common/users.nix index 717cecb..54a35a6 100644 --- a/modules/common/users.nix +++ b/modules/common/users.nix @@ -11,17 +11,12 @@ let shell = mkOption { type = types.package; }; - enableHomeManagerProfile = mkOption { - type = types.bool; - default = false; - }; - - homeManagerConfig = mkOption { default = { }; }; + hmConfig = mkOption { default = { }; }; }; }; in { - options.machineUsers = mkOption { type = types.attrsOf userModule; }; + options.my.users = mkOption { type = types.attrsOf userModule; }; config = { users.users = builtins.mapAttrs (name: value: { @@ -31,6 +26,6 @@ in extraGroups = value.groups; shell = value.shell; uid = mkIf (value.uid != null) value.uid; - }) config.machineUsers; + }) config.my.users; }; } diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..ac6cb59 --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,11 @@ +{ + modules = + { ... }: + { + imports = [ + ./common + ./server + ./workstation + ]; + }; +} diff --git a/modules/server/builder.nix b/modules/server/builder.nix deleted file mode 100644 index 268c775..0000000 --- a/modules/server/builder.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ lib, extraInfo, ... }: -with lib; -let - host = extraInfo.woodpeckerURI; -in -{ - options.server.build.enable = mkOption { - type = types.bool; - default = false; - example = false; - description = '' - Enable the build server stack. - ''; - }; - - config = lib.mkIf config.server.build.enable { - services.nginx.virtualHosts."${host}" = { - enableACME = true; - forceSSL = true; - locations."/" = { - proxyPass = "http://localhost:3007"; - }; - }; - - woodpecker-server = { - enable = true; - environment = { - WOODPECKER_HOST = "https://${domain}"; - WOODPECKER_SERVER_ADDR = ":3007"; - WOODPECKER_OPEN = "true"; - }; - }; - }; -} diff --git a/modules/workstation/bluetooth.nix b/modules/workstation/bluetooth.nix index 6dd6f04..abda9b7 100644 --- a/modules/workstation/bluetooth.nix +++ b/modules/workstation/bluetooth.nix @@ -1,7 +1,7 @@ { lib, config, ... }: with lib; { - options.enableBluetooth = mkOption { + options.my.hardware.bluetooth.enable = mkOption { type = types.bool; default = true; example = false; @@ -10,7 +10,7 @@ with lib; ''; }; - config = mkIf config.enableBluetooth { + config = mkIf config.my.hardware.bluetooth.enable { hardware.bluetooth = { enable = true; }; diff --git a/modules/workstation/default.nix b/modules/workstation/default.nix index 53e0d81..99e9a01 100644 --- a/modules/workstation/default.nix +++ b/modules/workstation/default.nix @@ -16,49 +16,42 @@ with lib; ./bluetooth.nix ]; - options.enableHomeManager = mkOption { - type = types.bool; - default = true; - example = false; - description = '' - Whether to install and use home-manager on this machine. - ''; - }; + config = + { + programs.dconf.enable = true; + security.polkit.enable = true; + services.dbus.enable = true; - config = { - enableHomeManager = machineProps.enableHomeManager; + fonts.fontconfig.enable = true; - home-manager.useGlobalPkgs = mkIf config.enableHomeManager true; - home-manager.useUserPackages = mkIf config.enableHomeManager true; - home-manager.sharedModules = mkIf config.enableHomeManager [ - ./home-manager - sopsHmModule - ]; - home-manager.extraSpecialArgs = { - keymap = config.keymap; - nvidiaGPU = (config.hwAccelerationGPU == "nvidia"); - }; - home-manager.users = builtins.mapAttrs ( - name: value: - mkIf value.enableHomeManagerProfile ( + services.gnome.gnome-keyring.enable = true; + } + // ( + if machineProps.enableHomeManager then { - home.username = name; - home.homeDirectory = "/home/${name}"; - home.stateVersion = machineProps.stateVersion; - programs.home-manager.enable = true; - enableFishShell = value.shell == pkgs.fish; - isProfessional = config.isProfessional; + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.sharedModules = [ + ./home-manager + sopsHmModule + ]; + home-manager.extraSpecialArgs = { + keymap = config.console.keyMap; + isNvidiaGpu = (config.my.hardware.gpu == "nvidia"); + }; + home-manager.users = builtins.mapAttrs ( + name: value: + { + home.username = name; + home.homeDirectory = "/home/${name}"; + home.stateVersion = machineProps.stateVersion; + programs.home-manager.enable = true; + programs.fish.enable = value.shell == pkgs.fish; + } + // value.hmConfig + ) config.my.users; } - // value.homeManagerConfig - ) - ) config.machineUsers; - - programs.dconf.enable = true; - security.polkit.enable = true; - services.dbus.enable = true; - - fonts.fontconfig.enable = true; - - services.gnome.gnome-keyring.enable = true; - }; + else + { } + ); } diff --git a/modules/workstation/desktop.nix b/modules/workstation/desktop.nix index f8fa81f..be0dfef 100644 --- a/modules/workstation/desktop.nix +++ b/modules/workstation/desktop.nix @@ -2,21 +2,26 @@ config, lib, pkgs, + machineProps, ... }: with lib; let - usersHasSway = builtins.any (user: config.home-manager.users.${user}.desktop.enableSwayStack) ( - builtins.attrNames config.machineUsers - ); + anySwayUser = + if machineProps.enableHomeManager then + builtins.any (user: config.home-manager.users.${user}.my.desktop.sway.enable) ( + builtins.attrNames config.my.users + ) + else + false; in { - programs.sway = mkIf usersHasSway { + programs.sway = mkIf anySwayUser { enable = true; wrapperFeatures.gtk = true; }; - xdg.portal = mkIf usersHasSway { + xdg.portal = mkIf anySwayUser { enable = true; xdgOpenUsePortal = true; wlr.enable = true; diff --git a/modules/workstation/home-manager/communication.nix b/modules/workstation/home-manager/communication.nix index 2e2aba0..cada1a1 100644 --- a/modules/workstation/home-manager/communication.nix +++ b/modules/workstation/home-manager/communication.nix @@ -4,38 +4,41 @@ config, ... }: +let + commConfig = config.my.communications; +in with lib; { - options = { - communication.discord.enable = mkOption { + options.my.communications = { + discord.enable = mkOption { type = types.bool; - default = !config.isProfessional; example = true; + default = false; }; - communication.slack.enable = mkOption { + slack.enable = mkOption { type = types.bool; - default = config.isProfessional; - example = true; - }; - - communication.weechat.enable = mkOption { - type = types.bool; - default = true; + default = false; example = false; }; - communication.matrix.enable = mkOption { + irc.enable = mkOption { type = types.bool; - default = !config.isProfessional; + default = false; + example = false; + }; + + matrix-client.enable = mkOption { + type = types.bool; + default = false; example = false; }; }; config.home.packages = with pkgs; [ - (mkIf config.communication.discord.enable (discord.override { nss = nss_latest; })) - (mkIf config.communication.slack.enable slack) - (mkIf config.communication.weechat.enable weechat) - (mkIf config.communication.matrix.enable element) + (mkIf commConfig.discord.enable (discord.override { nss = nss_latest; })) + (mkIf commConfig.slack.enable slack) + (mkIf commConfig.irc.enable weechat) + (mkIf commConfig.matrix-client.enable element) ]; } diff --git a/modules/workstation/home-manager/default.nix b/modules/workstation/home-manager/default.nix index c3cb2ab..8a4be78 100644 --- a/modules/workstation/home-manager/default.nix +++ b/modules/workstation/home-manager/default.nix @@ -24,15 +24,12 @@ in ./desktop ./development ./fish.nix - ./termux.nix ./gpg.nix ./communication.nix ./mail.nix ./helix.nix ]; - options.isProfessional = mkOption { type = types.bool; }; - config = { fonts.fontconfig.enable = true; diff --git a/modules/workstation/home-manager/desktop/alacritty.nix b/modules/workstation/home-manager/desktop/alacritty.nix index 8a76c64..b6b2783 100644 --- a/modules/workstation/home-manager/desktop/alacritty.nix +++ b/modules/workstation/home-manager/desktop/alacritty.nix @@ -1,14 +1,7 @@ { config, lib, ... }: with lib; -let - tmuxFix = { - env = { - TERM = "xterm-256color"; - }; - }; -in { - programs.alacritty = mkIf config.desktop.enableSwayStack { + programs.alacritty = { enable = true; settings = { font = { @@ -83,6 +76,6 @@ in window = { opacity = 1; }; - } // tmuxFix; + }; }; } diff --git a/modules/workstation/home-manager/desktop/default.nix b/modules/workstation/home-manager/desktop/default.nix index d4a4d28..f0e5951 100644 --- a/modules/workstation/home-manager/desktop/default.nix +++ b/modules/workstation/home-manager/desktop/default.nix @@ -1,77 +1,6 @@ -{ - lib, - config, - pkgs, - nvidiaGPU, - ... -}: -with lib; -let - desktopPackages = - with pkgs; - [ - grim - slurp - wl-clipboard - clipman - wf-recorder - (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) - qt5ct - libsForQt5.qtstyleplugin-kvantum - font-awesome - nordzy-cursor-theme - jetbrains-mono - xdg-utils - libnotify - adwaita-icon-theme - ] - ++ ( - if nvidiaGPU then - [ - vulkan-validation-layers - vulkan-headers - vulkan-caps-viewer - vulkan-extension-layer - vulkan-tools - ] - else - [ ] - ); -in { imports = [ - ./sway.nix + ./sway ./alacritty.nix - ./swaylock.nix - ./waybar.nix - ./wofi.nix - ./mako.nix ]; - - options.desktop.enableSwayStack = mkOption { - type = types.bool; - default = true; - }; - - config = mkIf config.desktop.enableSwayStack { - home.packages = desktopPackages; - - dconf = { - enable = true; - settings."org/gnome/desktop/interface".color-scheme = "prefer-dark"; - }; - - # Theming GTK - gtk = { - enable = true; - theme = { - name = "Nordic-darker"; - package = pkgs.nordic; - }; - cursorTheme = { - name = "Nordzy-cursors"; - package = pkgs.nordzy-cursor-theme; - }; - }; - }; } diff --git a/modules/workstation/home-manager/desktop/sway.nix b/modules/workstation/home-manager/desktop/sway.nix deleted file mode 100644 index 80250aa..0000000 --- a/modules/workstation/home-manager/desktop/sway.nix +++ /dev/null @@ -1,257 +0,0 @@ -{ - config, - pkgs, - lib, - keymap, - nvidiaGPU, - ... -}: -with lib; -let - isQwerty = keymap == "us"; - wlrRendererLine = if nvidiaGPU then "export WLR_RENDERER=vulkan" else ""; - gnomeSchema = "org.gnome.desktop.interface"; - monitorModule = types.submodule { - options = { - name = mkOption { type = types.str; }; - resolution = mkOption { type = types.str; }; - position = mkOption { type = types.str; }; - defaultWorkspace = mkOption { type = types.int; }; - }; - }; -in -{ - options = { - desktop.monitors = mkOption { type = types.listOf monitorModule; }; - }; - - config.wayland.windowManager.sway = mkIf config.desktop.enableSwayStack { - enable = true; - systemd.enable = false; - checkConfig = false; - - config = rec { - modifier = "Mod4"; - - left = "left"; - right = "right"; - up = "up"; - down = "down"; - - terminal = "${pkgs.alacritty}/bin/alacritty"; - menu = "${pkgs.wofi}/bin/wofi --show drun,run"; - - fonts = { - names = [ "pango:JetBrainsMono Nerd Font Mono" ]; - size = 11.0; - }; - - input = { - "*" = { - xkb_layout = keymap; - xkb_options = mkIf isQwerty "compose:ralt"; - }; - - "12951:6519:ZSA_Technology_Labs_Voyager" = { - xkb_layout = "us"; - xkb_options = "compose:ralt"; - }; - - "Synaptics TM3276-022" = { - dwt = "enabled"; - tap = "enabled"; - natural_scroll = "enabled"; - middle_emulation = "enabled"; - }; - }; - - seat = { - "seat0" = { - "xcursor_theme" = "Nordzy-cursors"; - }; - }; - output = - builtins.listToAttrs ( - builtins.map (monitor: { - name = monitor.name; - value = { - resolution = monitor.resolution; - position = monitor.position; - }; - }) config.desktop.monitors - ) - // { - "*".bg = "/home/dala/Perso/wallpapers/tanuki.jpg fill"; - }; - workspaceOutputAssign = map (monitor: { - output = monitor.name; - workspace = builtins.toString monitor.defaultWorkspace; - }) config.desktop.monitors; - startup = [ - { - command = '' - ${pkgs.swayidle}/bin/swayidle -w \ - timeout 1200 '${pkgs.swaylock}/bin/swaylock -f' \ - timeout 1800 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ - before-sleep '${pkgs.swaylock}/bin/swaylock -f' - ''; - } - { command = "${pkgs.nextcloud-client}/bin/nextcloud --background"; } - { command = "${pkgs.keepassxc}/bin/keepassxc"; } - { - command = '' - ${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${pkgs.clipman}/bin/clipman store --no-persist - ''; - } - { - command = "${pkgs.glib}/bin/gsettings set ${gnomeSchema} gtk-theme 'Nordic'"; - always = true; - } - { - command = "${pkgs.glib}/bin/gsettings set ${gnomeSchema} cursor-theme 'Nordzy-cursors'"; - always = true; - } - { - command = "${pkgs.glib}/bin/gsettings set ${gnomeSchema} font-name 'JetBrainsMono Nerd Font Mono'"; - always = true; - } - ]; - - modes = { - resize = { - "Left" = "resize shrink width 10px"; - "Down" = "resize grow height 10px"; - "Up" = "resize shrink height 10px"; - "Right" = "resize grow width 10px"; - - "Return" = "mode default"; - "Escape" = "mode default"; - }; - }; - - gaps = { - inner = 5; - smartGaps = true; - }; - - floating = { - modifier = "${modifier} normal"; - }; - - bars = [ { command = "${pkgs.waybar}/bin/waybar"; } ]; - - keybindings = { - "${modifier}+Return" = "exec ${terminal}"; - "${modifier}+Shift+q" = "kill"; - "${modifier}+d" = "exec ${menu}"; - "${modifier}+Shift+r" = "reload"; - "${modifier}+Shift+e" = "exec swaymsg exit"; - "${modifier}+Shift+l" = "exec swaylock -f"; - - "${modifier}+Left" = "focus left"; - "${modifier}+Down" = "focus down"; - "${modifier}+Up" = "focus up"; - "${modifier}+Right" = "focus right"; - - "${modifier}+Shift+Left" = "move left"; - "${modifier}+Shift+Down" = "move down"; - "${modifier}+Shift+Up" = "move up"; - "${modifier}+Shift+Right" = "move right"; - - "${modifier}+1" = "workspace 1"; - "${modifier}+2" = "workspace 2"; - "${modifier}+3" = "workspace 3"; - "${modifier}+4" = "workspace 4"; - "${modifier}+5" = "workspace 5"; - "${modifier}+6" = "workspace 6"; - "${modifier}+7" = "workspace 7"; - "${modifier}+8" = "workspace 8"; - "${modifier}+9" = "workspace 9"; - "${modifier}+0" = "workspace 10"; - - "${modifier}+ampersand" = "workspace 1"; - "${modifier}+eacute" = "workspace 2"; - "${modifier}+quotedbl" = "workspace 3"; - "${modifier}+apostrophe" = "workspace 4"; - "${modifier}+parenleft" = "workspace 5"; - "${modifier}+minus" = "workspace 6"; - "${modifier}+egrave" = "workspace 7"; - "${modifier}+underscore" = "workspace 8"; - "${modifier}+ccedilla" = "workspace 9"; - "${modifier}+agrave" = "workspace 10"; - - "${modifier}+Shift+1" = "move container to workspace 1"; - "${modifier}+Shift+2" = "move container to workspace 2"; - "${modifier}+Shift+3" = "move container to workspace 3"; - "${modifier}+Shift+4" = "move container to workspace 4"; - "${modifier}+Shift+5" = "move container to workspace 5"; - "${modifier}+Shift+6" = "move container to workspace 6"; - "${modifier}+Shift+7" = "move container to workspace 7"; - "${modifier}+Shift+8" = "move container to workspace 8"; - "${modifier}+Shift+9" = "move container to workspace 9"; - "${modifier}+Shift+0" = "move container to workspace 10"; - - "${modifier}+Shift+ampersand" = "move container to workspace 1"; - "${modifier}+Shift+eacute" = "move container to workspace 2"; - "${modifier}+Shift+quotedbl" = "move container to workspace 3"; - "${modifier}+Shift+apostrophe" = "move container to workspace 4"; - "${modifier}+Shift+parenleft" = "move container to workspace 5"; - "${modifier}+Shift+minus" = "move container to workspace 6"; - "${modifier}+Shift+egrave" = "move container to workspace 7"; - "${modifier}+Shift+underscore" = "move container to workspace 8"; - "${modifier}+Shift+ccedilla" = "move container to workspace 9"; - "${modifier}+Shift+agrave" = "move container to workspace 10"; - - "${modifier}+h" = "splith"; - "${modifier}+v" = "splitv"; - - "${modifier}+s" = "layout stacking"; - "${modifier}+w" = "layout tabbed"; - "${modifier}+e" = "layout toggle split"; - - "${modifier}+f" = "fullscreen"; - "${modifier}+Shift+space" = "floating toggle"; - "${modifier}+space" = "focus mode_toggle"; - "${modifier}+a" = "focus parent"; - - "${modifier}+Shift+parenright" = "move scratchpad"; - - "${modifier}+parenright" = "scratchpad show"; - - "${modifier}+r" = "mode resize"; - - "XF86AudioRaiseVolume" = "exec --no-startup-id pactl set-sink-volume 0 +5%"; # increase sound volume - "XF86AudioLowerVolume" = "exec --no-startup-id pactl set-sink-volume 0 -5%"; # decrease sound volume - "XF86AudioMute" = "exec --no-startup-id pactl set-sink-mute 0 toggle"; # mute sound - - "XF86MonBrightnessUp" = "exec --no-startup-id light -A 10"; - "XF86MonBrightnessDown" = "exec --no-startup-id light -U 10"; - - "Control+XF86AudioMute" = "exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle"; - - "Print" = "exec grim -g \"$(${pkgs.slurp}/bin/slurp)\" -t png - | wl-copy --type image/png"; - }; - }; - - extraConfig = '' - for_window [class=".*"] inhibit_idle fullscreen - for_window [app_id=".*"] inhibit_idle fullscreen - default_border pixel - ''; - - xwayland = false; - - extraSessionCommands = '' - ${wlrRendererLine} - export WLR_NO_HARDWARE_CURSORS=1 - export XDG_CURRENT_DESKTOP=sway - export _JAVA_AWT_WM_NONREPARENTING=1 - export NIXOS_OZONE_WL=1 - export QT_QPA_PLATFORM=wayland - export QT_QPA_PLATFORMTHEME=qt5ct - export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 - export MOZ_ENABLE_WAYLAND=1 - export SDL_VIDEODRIVER=wayland - ''; - }; -} diff --git a/modules/workstation/home-manager/desktop/sway/default.nix b/modules/workstation/home-manager/desktop/sway/default.nix new file mode 100644 index 0000000..4be5732 --- /dev/null +++ b/modules/workstation/home-manager/desktop/sway/default.nix @@ -0,0 +1,321 @@ +{ + config, + pkgs, + lib, + keymap, + isNvidiaGpu, + ... +}: +with lib; +let + isQwerty = keymap == "us"; + wlrRendererLine = if isNvidiaGpu then "export WLR_RENDERER=vulkan" else ""; + gnomeSchema = "org.gnome.desktop.interface"; + monitorModule = types.submodule { + options = { + name = mkOption { type = types.str; }; + resolution = mkOption { type = types.str; }; + position = mkOption { type = types.str; }; + defaultWorkspace = mkOption { type = types.int; }; + }; + }; + desktopPackages = + with pkgs; + [ + grim + slurp + wl-clipboard + clipman + wf-recorder + (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) + qt5ct + libsForQt5.qtstyleplugin-kvantum + font-awesome + nordzy-cursor-theme + jetbrains-mono + xdg-utils + libnotify + adwaita-icon-theme + ] + ++ ( + if isNvidiaGpu then + [ + vulkan-validation-layers + vulkan-headers + vulkan-caps-viewer + vulkan-extension-layer + vulkan-tools + ] + else + [ ] + ); +in +{ + imports = [ + ./swaylock.nix + ./waybar.nix + ./wofi.nix + ./mako.nix + ]; + + options = { + my.desktop.sway = { + enable = mkOption { + type = types.bool; + default = true; + }; + monitors = mkOption { type = types.listOf monitorModule; }; + }; + }; + + config = mkIf config.my.desktop.sway.enable { + home.packages = desktopPackages; + + dconf = { + enable = true; + settings."org/gnome/desktop/interface".color-scheme = "prefer-dark"; + }; + + # Theming GTK + gtk = { + enable = true; + theme = { + name = "Nordic-darker"; + package = pkgs.nordic; + }; + cursorTheme = { + name = "Nordzy-cursors"; + package = pkgs.nordzy-cursor-theme; + }; + }; + wayland.windowManager.sway = { + enable = true; + systemd.enable = false; + checkConfig = false; + + config = rec { + modifier = "Mod4"; + + left = "left"; + right = "right"; + up = "up"; + down = "down"; + + terminal = "${pkgs.alacritty}/bin/alacritty"; + menu = "${pkgs.wofi}/bin/wofi --show drun,run"; + + fonts = { + names = [ "pango:JetBrainsMono Nerd Font Mono" ]; + size = 11.0; + }; + + input = { + "*" = { + xkb_layout = keymap; + xkb_options = mkIf isQwerty "compose:ralt"; + }; + + "12951:6519:ZSA_Technology_Labs_Voyager" = { + xkb_layout = "us"; + xkb_options = "compose:ralt"; + }; + + "Synaptics TM3276-022" = { + dwt = "enabled"; + tap = "enabled"; + natural_scroll = "enabled"; + middle_emulation = "enabled"; + }; + }; + + seat = { + "seat0" = { + "xcursor_theme" = "Nordzy-cursors"; + }; + }; + output = + builtins.listToAttrs ( + builtins.map (monitor: { + name = monitor.name; + value = { + resolution = monitor.resolution; + position = monitor.position; + }; + }) config.my.desktop.sway.monitors + ) + // { + "*".bg = "/home/dala/Perso/wallpapers/tanuki.jpg fill"; + }; + workspaceOutputAssign = map (monitor: { + output = monitor.name; + workspace = builtins.toString monitor.defaultWorkspace; + }) config.my.desktop.sway.monitors; + startup = [ + { + command = '' + ${pkgs.swayidle}/bin/swayidle -w \ + timeout 1200 '${pkgs.swaylock}/bin/swaylock -f' \ + timeout 1800 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ + before-sleep '${pkgs.swaylock}/bin/swaylock -f' + ''; + } + { command = "${pkgs.nextcloud-client}/bin/nextcloud --background"; } + { command = "${pkgs.keepassxc}/bin/keepassxc"; } + { + command = '' + ${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${pkgs.clipman}/bin/clipman store --no-persist + ''; + } + { + command = "${pkgs.glib}/bin/gsettings set ${gnomeSchema} gtk-theme 'Nordic'"; + always = true; + } + { + command = "${pkgs.glib}/bin/gsettings set ${gnomeSchema} cursor-theme 'Nordzy-cursors'"; + always = true; + } + { + command = "${pkgs.glib}/bin/gsettings set ${gnomeSchema} font-name 'JetBrainsMono Nerd Font Mono'"; + always = true; + } + ]; + + modes = { + resize = { + "Left" = "resize shrink width 10px"; + "Down" = "resize grow height 10px"; + "Up" = "resize shrink height 10px"; + "Right" = "resize grow width 10px"; + + "Return" = "mode default"; + "Escape" = "mode default"; + }; + }; + + gaps = { + inner = 5; + smartGaps = true; + }; + + floating = { + modifier = "${modifier} normal"; + }; + + bars = [ { command = "${pkgs.waybar}/bin/waybar"; } ]; + + keybindings = { + "${modifier}+Return" = "exec ${terminal}"; + "${modifier}+Shift+q" = "kill"; + "${modifier}+d" = "exec ${menu}"; + "${modifier}+Shift+r" = "reload"; + "${modifier}+Shift+e" = "exec swaymsg exit"; + "${modifier}+Shift+l" = "exec swaylock -f"; + + "${modifier}+Left" = "focus left"; + "${modifier}+Down" = "focus down"; + "${modifier}+Up" = "focus up"; + "${modifier}+Right" = "focus right"; + + "${modifier}+Shift+Left" = "move left"; + "${modifier}+Shift+Down" = "move down"; + "${modifier}+Shift+Up" = "move up"; + "${modifier}+Shift+Right" = "move right"; + + "${modifier}+1" = "workspace 1"; + "${modifier}+2" = "workspace 2"; + "${modifier}+3" = "workspace 3"; + "${modifier}+4" = "workspace 4"; + "${modifier}+5" = "workspace 5"; + "${modifier}+6" = "workspace 6"; + "${modifier}+7" = "workspace 7"; + "${modifier}+8" = "workspace 8"; + "${modifier}+9" = "workspace 9"; + "${modifier}+0" = "workspace 10"; + + "${modifier}+ampersand" = "workspace 1"; + "${modifier}+eacute" = "workspace 2"; + "${modifier}+quotedbl" = "workspace 3"; + "${modifier}+apostrophe" = "workspace 4"; + "${modifier}+parenleft" = "workspace 5"; + "${modifier}+minus" = "workspace 6"; + "${modifier}+egrave" = "workspace 7"; + "${modifier}+underscore" = "workspace 8"; + "${modifier}+ccedilla" = "workspace 9"; + "${modifier}+agrave" = "workspace 10"; + + "${modifier}+Shift+1" = "move container to workspace 1"; + "${modifier}+Shift+2" = "move container to workspace 2"; + "${modifier}+Shift+3" = "move container to workspace 3"; + "${modifier}+Shift+4" = "move container to workspace 4"; + "${modifier}+Shift+5" = "move container to workspace 5"; + "${modifier}+Shift+6" = "move container to workspace 6"; + "${modifier}+Shift+7" = "move container to workspace 7"; + "${modifier}+Shift+8" = "move container to workspace 8"; + "${modifier}+Shift+9" = "move container to workspace 9"; + "${modifier}+Shift+0" = "move container to workspace 10"; + + "${modifier}+Shift+ampersand" = "move container to workspace 1"; + "${modifier}+Shift+eacute" = "move container to workspace 2"; + "${modifier}+Shift+quotedbl" = "move container to workspace 3"; + "${modifier}+Shift+apostrophe" = "move container to workspace 4"; + "${modifier}+Shift+parenleft" = "move container to workspace 5"; + "${modifier}+Shift+minus" = "move container to workspace 6"; + "${modifier}+Shift+egrave" = "move container to workspace 7"; + "${modifier}+Shift+underscore" = "move container to workspace 8"; + "${modifier}+Shift+ccedilla" = "move container to workspace 9"; + "${modifier}+Shift+agrave" = "move container to workspace 10"; + + "${modifier}+h" = "splith"; + "${modifier}+v" = "splitv"; + + "${modifier}+s" = "layout stacking"; + "${modifier}+w" = "layout tabbed"; + "${modifier}+e" = "layout toggle split"; + + "${modifier}+f" = "fullscreen"; + "${modifier}+Shift+space" = "floating toggle"; + "${modifier}+space" = "focus mode_toggle"; + "${modifier}+a" = "focus parent"; + + "${modifier}+Shift+parenright" = "move scratchpad"; + + "${modifier}+parenright" = "scratchpad show"; + + "${modifier}+r" = "mode resize"; + + "XF86AudioRaiseVolume" = "exec --no-startup-id pactl set-sink-volume 0 +5%"; # increase sound volume + "XF86AudioLowerVolume" = "exec --no-startup-id pactl set-sink-volume 0 -5%"; # decrease sound volume + "XF86AudioMute" = "exec --no-startup-id pactl set-sink-mute 0 toggle"; # mute sound + + "XF86MonBrightnessUp" = "exec --no-startup-id light -A 10"; + "XF86MonBrightnessDown" = "exec --no-startup-id light -U 10"; + + "Control+XF86AudioMute" = "exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle"; + + "Print" = "exec grim -g \"$(${pkgs.slurp}/bin/slurp)\" -t png - | wl-copy --type image/png"; + }; + }; + + extraConfig = '' + for_window [class=".*"] inhibit_idle fullscreen + for_window [app_id=".*"] inhibit_idle fullscreen + default_border pixel + ''; + + xwayland = false; + + extraSessionCommands = '' + ${wlrRendererLine} + export WLR_NO_HARDWARE_CURSORS=1 + export XDG_CURRENT_DESKTOP=sway + export _JAVA_AWT_WM_NONREPARENTING=1 + export NIXOS_OZONE_WL=1 + export QT_QPA_PLATFORM=wayland + export QT_QPA_PLATFORMTHEME=qt5ct + export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 + export MOZ_ENABLE_WAYLAND=1 + export SDL_VIDEODRIVER=wayland + ''; + }; + }; +} diff --git a/modules/workstation/home-manager/desktop/mako.nix b/modules/workstation/home-manager/desktop/sway/mako.nix similarity index 89% rename from modules/workstation/home-manager/desktop/mako.nix rename to modules/workstation/home-manager/desktop/sway/mako.nix index 07b57c1..56d4ef4 100644 --- a/modules/workstation/home-manager/desktop/mako.nix +++ b/modules/workstation/home-manager/desktop/sway/mako.nix @@ -1,7 +1,7 @@ { lib, config, ... }: with lib; { - services.mako = mkIf config.desktop.enableSwayStack { + services.mako = mkIf config.my.desktop.sway.enable { enable = true; layer = "overlay"; diff --git a/modules/workstation/home-manager/desktop/swaylock.nix b/modules/workstation/home-manager/desktop/sway/swaylock.nix similarity index 95% rename from modules/workstation/home-manager/desktop/swaylock.nix rename to modules/workstation/home-manager/desktop/sway/swaylock.nix index c94cc75..694921f 100644 --- a/modules/workstation/home-manager/desktop/swaylock.nix +++ b/modules/workstation/home-manager/desktop/sway/swaylock.nix @@ -1,7 +1,7 @@ { lib, config, ... }: with lib; { - programs.swaylock = mkIf config.desktop.enableSwayStack { + programs.swaylock = mkIf config.my.desktop.sway.enable { enable = true; settings = { diff --git a/modules/workstation/home-manager/desktop/waybar.nix b/modules/workstation/home-manager/desktop/sway/waybar.nix similarity index 98% rename from modules/workstation/home-manager/desktop/waybar.nix rename to modules/workstation/home-manager/desktop/sway/waybar.nix index 9ab637e..b6931e0 100644 --- a/modules/workstation/home-manager/desktop/waybar.nix +++ b/modules/workstation/home-manager/desktop/sway/waybar.nix @@ -1,9 +1,8 @@ { config, lib, ... }: with lib; { - programs.waybar = mkIf config.desktop.enableSwayStack { + programs.waybar = mkIf config.my.desktop.sway.enable { enable = true; - #systemd.enable = false; settings = [ { diff --git a/modules/workstation/home-manager/desktop/wofi.nix b/modules/workstation/home-manager/desktop/sway/wofi.nix similarity index 96% rename from modules/workstation/home-manager/desktop/wofi.nix rename to modules/workstation/home-manager/desktop/sway/wofi.nix index e334d69..cbbef79 100644 --- a/modules/workstation/home-manager/desktop/wofi.nix +++ b/modules/workstation/home-manager/desktop/sway/wofi.nix @@ -6,7 +6,7 @@ }: with lib; { - programs.wofi = mkIf config.desktop.enableSwayStack { + programs.wofi = mkIf config.my.desktop.sway.enable { enable = true; settings = { diff --git a/modules/workstation/home-manager/development/default.nix b/modules/workstation/home-manager/development/default.nix index b14e606..2719fc1 100644 --- a/modules/workstation/home-manager/development/default.nix +++ b/modules/workstation/home-manager/development/default.nix @@ -8,7 +8,7 @@ with lib; { imports = [ ./embedded.nix ]; - options.development.enableGit = mkOption { + options.my.development.git.enable = mkOption { type = types.bool; default = true; example = false; @@ -17,12 +17,12 @@ with lib; ''; }; - config.programs.git = mkIf config.development.enableGit { + config.programs.git = mkIf config.my.development.git.enable { enable = true; package = pkgs.gitAndTools.gitFull; userName = "Victor Mignot"; userEmail = "dala@dalaran.fr"; - signing = mkIf config.enableGPGKeyring { + signing = mkIf config.my.pgp.enable { key = "BEAFED3D"; signByDefault = true; }; diff --git a/modules/workstation/home-manager/development/embedded.nix b/modules/workstation/home-manager/development/embedded.nix index 45040e8..5dfb402 100644 --- a/modules/workstation/home-manager/development/embedded.nix +++ b/modules/workstation/home-manager/development/embedded.nix @@ -6,7 +6,7 @@ }: with lib; { - options.development.embedded.enableTools = mkOption { + options.my.development.embedded-tools.enable = mkOption { type = types.bool; default = false; example = true; @@ -15,7 +15,7 @@ with lib; ''; }; - options.development.embedded.toolsList = mkOption { + options.my.development.embedded-tools.packages = mkOption { type = types.listOf types.package; default = with pkgs; [ qemu @@ -23,5 +23,5 @@ with lib; ]; }; - config.home.packages = lib.mkIf config.development.embedded.enableTools config.development.embedded.toolsList; + config.home.packages = lib.mkIf config.my.development.embedded-tools.enable config.my.development.embedded-tools.packages; } diff --git a/modules/workstation/home-manager/fish.nix b/modules/workstation/home-manager/fish.nix index 905888e..28c6eee 100644 --- a/modules/workstation/home-manager/fish.nix +++ b/modules/workstation/home-manager/fish.nix @@ -6,12 +6,19 @@ ... }: with lib; +let + swayLaunchScript = + if config.my.desktop.sway.enable then + '' + if [ -z $DISPLAY ] && [ "$(tty)" = /dev/tty1 ] + exec sway + end + '' + else + ""; +in { - options.enableFishShell = mkOption { type = types.bool; }; - - config.programs.fish = mkIf config.enableFishShell { - enable = true; - + config.programs.fish = mkIf config.programs.fish.enable { plugins = [ { name = "bobthefish"; @@ -27,9 +34,7 @@ with lib; shellInit = '' set -g theme_color_scheme nord - if [ -z $DISPLAY ] && [ "$(tty)" = /dev/tty1 ] - exec sway - end + ${swayLauncScript} ''; }; } diff --git a/modules/workstation/home-manager/gpg.nix b/modules/workstation/home-manager/gpg.nix index 12fc272..3555b7b 100644 --- a/modules/workstation/home-manager/gpg.nix +++ b/modules/workstation/home-manager/gpg.nix @@ -6,7 +6,7 @@ }: with lib; { - options.enableGPGKeyring = mkOption { + options.my.pgp.enable = mkOption { type = types.bool; default = true; example = false; @@ -15,7 +15,7 @@ with lib; ''; }; - config = mkIf config.enableGPGKeyring { + config = mkIf config.my.pgp.enable { programs.gpg.enable = true; services.gpg-agent = { diff --git a/modules/workstation/home-manager/mail.nix b/modules/workstation/home-manager/mail.nix index c2fd402..4906173 100644 --- a/modules/workstation/home-manager/mail.nix +++ b/modules/workstation/home-manager/mail.nix @@ -37,10 +37,10 @@ let showSignature = "append"; }; - hasNoAddress = config.communication.mailAccounts == null; + hasNoAddress = config.my.communications.mail.accounts == null; in { - options.communication.mailAccounts = mkOption { + options.my.communications.mail.accounts = mkOption { type = types.nullOr (types.attrsOf mailAccountModule); default = null; }; @@ -75,7 +75,7 @@ in name = "${name}/${mb}"; }) defaultExtraMailboxes; }; - }) config.communication.mailAccounts; + }) config.my.communications.mail.accounts; services.mbsync.enable = true; programs.mbsync.enable = true; diff --git a/modules/workstation/home-manager/termux.nix b/modules/workstation/home-manager/termux.nix deleted file mode 100644 index 347ecf0..0000000 --- a/modules/workstation/home-manager/termux.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: -with lib; -let - tmuxExtraConfig = '' - set -ag terminal-overrides ",xterm-256color:RGB" - ''; -in -{ - options.enableTermux = mkOption { - type = types.bool; - default = true; - example = false; - description = '' - Enable termux and the associated config. - ''; - }; - - config.programs.tmux = mkIf config.enableTermux { - enable = true; - - # Make windows count start to 1 - baseIndex = 1; - - # Use 24h clock - clock24 = true; - - shell = if config.enableFishShell then "${pkgs.fish}/bin/fish" else "${pkgs.bash}/bin/bash"; - - keyMode = "vi"; - - tmuxp.enable = true; - - terminal = "tmux-256color"; - - plugins = with pkgs.tmuxPlugins; [ - { - plugin = nord; - extraConfig = '' - set -g @plugin "arcticicestudio/nord-tmux" - ''; - } - ]; - - extraConfig = tmuxExtraConfig; - }; -}