From fc876b2ea5f4893f3b35ec462fde7300cc7a8442 Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Thu, 6 Feb 2025 18:40:30 +0100 Subject: [PATCH] treewide: update options API The options API has been updated, in order for a more flexible setup with `local.modules.desktop.enable` being replaced with an enum of desktops at `local.systemVars.desktop`, which allows for switching desktop environments by changing a single option. This is so that we can switch to cosmic and only enable the programs we need (i.e. disable greetd because we use cosmic-greeter and enable terminals since that is desktop related). This is simpler than having a different module per desktop. --- hosts/solaire/default.nix | 3 +-- hosts/vamos/default.nix | 6 +----- modules/core/fonts.nix | 2 +- modules/core/hardware/fwupd.nix | 2 +- modules/core/hardware/printing.nix | 2 +- modules/core/security.nix | 2 +- modules/core/users.nix | 7 +++---- modules/options/homeVars.nix | 15 ++++++++++---- modules/options/modules/default.nix | 1 - modules/options/modules/hyprland.nix | 7 ------- modules/options/profiles/default.nix | 1 - modules/options/profiles/desktop.nix | 18 ----------------- modules/options/profiles/server.nix | 2 +- modules/options/systemVars.nix | 20 ++++++++++++++++--- modules/programs/anyrun/default.nix | 2 +- modules/programs/discord/default.nix | 2 +- modules/programs/editors/default.nix | 2 +- modules/programs/editors/neovim.nix | 2 +- modules/programs/fastfetch.nix | 2 +- modules/programs/firefox.nix | 2 +- modules/programs/hypr/idle.nix | 2 +- modules/programs/hypr/land/default.nix | 2 +- modules/programs/hypr/lock.nix | 2 +- modules/programs/hypr/paper.nix | 2 +- modules/programs/media/default.nix | 2 +- modules/programs/media/tidal-hifi.nix | 2 +- modules/programs/media/zathura.nix | 2 +- modules/programs/misc.nix | 2 +- modules/programs/nh.nix | 5 ++--- modules/programs/terminal/emulators/foot.nix | 3 ++- .../programs/terminal/emulators/ghostty.nix | 2 +- modules/programs/terminal/programs/bat.nix | 2 +- modules/programs/terminal/programs/direnv.nix | 2 +- modules/programs/terminal/programs/git.nix | 2 +- modules/programs/terminal/programs/misc.nix | 2 +- modules/programs/terminal/programs/tmux.nix | 2 +- modules/programs/terminal/shell/default.nix | 2 +- modules/programs/terminal/shell/nushell.nix | 2 +- modules/programs/terminal/shell/starship.nix | 2 +- modules/programs/terminal/shell/zoxide.nix | 2 +- modules/programs/terminal/shell/zsh.nix | 2 +- modules/programs/thunar.nix | 2 +- modules/programs/waybar.nix | 2 +- modules/programs/wlogout.nix | 2 +- modules/programs/xdg.nix | 2 +- modules/services/docker.nix | 2 +- modules/services/documentation.nix | 2 +- modules/services/flatpak.nix | 2 +- modules/services/gammastep.nix | 2 +- modules/services/gnome.nix | 2 +- modules/services/greetd.nix | 3 +-- modules/services/keyd.nix | 2 +- modules/services/kmscon.nix | 2 +- modules/services/location.nix | 2 +- modules/services/pipewire.nix | 2 +- modules/services/ssh.nix | 2 +- modules/services/swaync/default.nix | 2 +- 57 files changed, 83 insertions(+), 96 deletions(-) delete mode 100644 modules/options/modules/hyprland.nix delete mode 100644 modules/options/profiles/desktop.nix diff --git a/hosts/solaire/default.nix b/hosts/solaire/default.nix index 00305b1..eff3f8b 100644 --- a/hosts/solaire/default.nix +++ b/hosts/solaire/default.nix @@ -5,6 +5,7 @@ _: { systemVars = { hostName = "solaire"; username = "nezia"; + desktop = "Hyprland"; }; homeVars = { fullName = "Anthony Rodriguez"; @@ -13,12 +14,10 @@ _: { }; profiles = { - desktop.enable = true; gaming.enable = true; }; modules = { - hyprland.enable = true; nvidia.enable = true; }; }; diff --git a/hosts/vamos/default.nix b/hosts/vamos/default.nix index 3955ccb..286d5d6 100644 --- a/hosts/vamos/default.nix +++ b/hosts/vamos/default.nix @@ -8,6 +8,7 @@ _: { systemVars = { hostName = "vamos"; username = "nezia"; + desktop = "Hyprland"; }; homeVars = { @@ -17,12 +18,7 @@ _: { }; profiles = { - desktop.enable = true; laptop.enable = true; }; - - modules = { - hyprland.enable = true; - }; }; } diff --git a/modules/core/fonts.nix b/modules/core/fonts.nix index c2526a3..f07941e 100644 --- a/modules/core/fonts.nix +++ b/modules/core/fonts.nix @@ -4,7 +4,7 @@ config, ... }: { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { fonts = { enableDefaultPackages = false; packages = [ diff --git a/modules/core/hardware/fwupd.nix b/modules/core/hardware/fwupd.nix index db3e785..cbb38e2 100644 --- a/modules/core/hardware/fwupd.nix +++ b/modules/core/hardware/fwupd.nix @@ -3,7 +3,7 @@ config, ... }: { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { services.fwupd.enable = true; }; } diff --git a/modules/core/hardware/printing.nix b/modules/core/hardware/printing.nix index 39b1bc9..ff3ca96 100644 --- a/modules/core/hardware/printing.nix +++ b/modules/core/hardware/printing.nix @@ -4,7 +4,7 @@ config, ... }: { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { services = { # setup printing service printing.enable = true; diff --git a/modules/core/security.nix b/modules/core/security.nix index 478796b..b3907af 100644 --- a/modules/core/security.nix +++ b/modules/core/security.nix @@ -4,7 +4,7 @@ config, ... }: { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { security = { polkit.enable = true; polkit = { diff --git a/modules/core/users.nix b/modules/core/users.nix index ed82d92..1f039c4 100644 --- a/modules/core/users.nix +++ b/modules/core/users.nix @@ -4,14 +4,13 @@ ... }: let inherit (lib) mkIf; - inherit (config.local.systemVars) username; + inherit (config.local.systemVars) desktop username; inherit (config.local.homeVars) fullName; - inherit (config.local.profiles) desktop; in { users.users.${username} = { isNormalUser = true; description = fullName; - extraGroups = mkIf desktop.enable [ + extraGroups = mkIf (desktop != "none") [ "networkmanager" "audio" "video" @@ -20,7 +19,7 @@ in { ]; }; - hjem = mkIf desktop.enable { + hjem = mkIf (desktop != "none") { clobberByDefault = true; users.${username} = { enable = true; diff --git a/modules/options/homeVars.nix b/modules/options/homeVars.nix index 9942d30..9371730 100644 --- a/modules/options/homeVars.nix +++ b/modules/options/homeVars.nix @@ -4,23 +4,30 @@ options, ... }: let - inherit (lib) mkIf mkOption; + inherit (lib) mkOption; + inherit (lib.modules) mkIf; inherit (lib.types) str; in { options.local.homeVars = { fullName = mkOption { type = str; - description = "your full name (used for git commits and user description)"; + description = '' + your full name (used for git commits and user description) + ''; default = "User"; }; email = mkOption { type = str; - description = "your email (used for git commits)"; + description = '' + your email (used for git commits) + ''; default = null; }; signingKey = mkOption { type = str; - description = "your ssh public key (used for signing git commits)"; + description = '' + your ssh public key (used for signing git commits)" + ''; }; }; diff --git a/modules/options/modules/default.nix b/modules/options/modules/default.nix index a269b30..e042628 100644 --- a/modules/options/modules/default.nix +++ b/modules/options/modules/default.nix @@ -1,6 +1,5 @@ { imports = [ - ./hyprland.nix ./nvidia.nix ]; } diff --git a/modules/options/modules/hyprland.nix b/modules/options/modules/hyprland.nix deleted file mode 100644 index 928dc76..0000000 --- a/modules/options/modules/hyprland.nix +++ /dev/null @@ -1,7 +0,0 @@ -{lib, ...}: let - inherit (lib) mkEnableOption; -in { - options.local.modules.hyprland = { - enable = mkEnableOption "Hyprland modules"; - }; -} diff --git a/modules/options/profiles/default.nix b/modules/options/profiles/default.nix index 7c946dc..dfdfd8d 100644 --- a/modules/options/profiles/default.nix +++ b/modules/options/profiles/default.nix @@ -1,6 +1,5 @@ { imports = [ - ./desktop.nix ./gaming.nix ./laptop.nix ./server.nix diff --git a/modules/options/profiles/desktop.nix b/modules/options/profiles/desktop.nix deleted file mode 100644 index 5b0fb45..0000000 --- a/modules/options/profiles/desktop.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - lib, - config, - ... -}: let - inherit (lib) mkEnableOption; -in { - options = { - local.profiles.desktop.enable = mkEnableOption "the desktop profile"; - }; - - config.assertions = lib.mkIf config.local.profiles.desktop.enable [ - { - assertion = !config.local.profiles.server.enable; - message = "The desktop profile cannot be enabled if `local.profiles.server.enable` is set to true."; - } - ]; -} diff --git a/modules/options/profiles/server.nix b/modules/options/profiles/server.nix index a772aff..b913fa4 100644 --- a/modules/options/profiles/server.nix +++ b/modules/options/profiles/server.nix @@ -11,7 +11,7 @@ in { config.assertions = lib.mkIf config.local.profiles.server.enable [ { - assertion = !config.local.profiles.desktop.enable; + assertion = !(config.local.systemVars.desktop != "none"); message = "The server profile cannot be enabled if `local.profiles.desktop.enable` is set to true."; } diff --git a/modules/options/systemVars.nix b/modules/options/systemVars.nix index db75ccd..ab6e75b 100644 --- a/modules/options/systemVars.nix +++ b/modules/options/systemVars.nix @@ -4,19 +4,30 @@ ... }: let inherit (lib) mkOption; - inherit (lib.types) str; + inherit (lib.types) enum str; in { options.local.systemVars = { hostName = mkOption { type = str; - description = "hostname for the current host"; + description = '' + hostname for the current host + ''; default = null; }; username = mkOption { type = str; - description = "username for the home directory"; + description = '' + username for the home directory + ''; default = "user"; }; + desktop = mkOption { + type = enum ["none" "Hyprland" "cosmic"]; + default = "none"; + description = '' + the desktop environment to be used + ''; + }; }; config.assertions = [ @@ -26,5 +37,8 @@ in { { assertion = options.local.systemVars.username.isDefined; } + { + assertion = options.local.systemVars.desktop.isDefined; + } ]; } diff --git a/modules/programs/anyrun/default.nix b/modules/programs/anyrun/default.nix index c206915..dec8f38 100644 --- a/modules/programs/anyrun/default.nix +++ b/modules/programs/anyrun/default.nix @@ -8,7 +8,7 @@ inherit (lib) mkIf; inherit (config.local.systemVars) username; in { - config = mkIf config.local.modules.hyprland.enable { + config = mkIf (config.local.systemVars.desktop == "Hyprland") { hjem.users.${username} = { packages = [inputs.anyrun.packages.${pkgs.system}.anyrun-with-all-plugins]; files = { diff --git a/modules/programs/discord/default.nix b/modules/programs/discord/default.nix index b857f06..e16a4e9 100644 --- a/modules/programs/discord/default.nix +++ b/modules/programs/discord/default.nix @@ -22,7 +22,7 @@ ]; } (builtins.readFile ./krisp-patcher.py); in { - config = mkIf config.local.profiles.desktop.enable { + config = mkIf (config.local.systemVars.desktop != "none") { hjem.users.${username} = { packages = [discord krisp-patcher]; files.".config/Vencord/themes/midnight-base16.css".text = with styleCfg.scheme.palette; diff --git a/modules/programs/editors/default.nix b/modules/programs/editors/default.nix index f3db4f5..22b9a08 100644 --- a/modules/programs/editors/default.nix +++ b/modules/programs/editors/default.nix @@ -10,7 +10,7 @@ in { ./neovim.nix ]; - config = mkIf config.local.profiles.desktop.enable { + config = mkIf (config.local.systemVars.desktop != "none") { /* we don't want the default NixOS EDITOR value, which is nano and will override the `environment.d` setting. we have to unset it like this so that our systemd user variable will take precedence: diff --git a/modules/programs/editors/neovim.nix b/modules/programs/editors/neovim.nix index bfeb81a..473cfe3 100644 --- a/modules/programs/editors/neovim.nix +++ b/modules/programs/editors/neovim.nix @@ -239,7 +239,7 @@ }; }; in { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { hjem.users.${username} = { packages = [customNeovim.neovim]; }; diff --git a/modules/programs/fastfetch.nix b/modules/programs/fastfetch.nix index bde7fbd..30a104f 100644 --- a/modules/programs/fastfetch.nix +++ b/modules/programs/fastfetch.nix @@ -10,7 +10,7 @@ sha256 = "137k3i7z4va68v4rvrazy26szc7p2w59h7bc2h8japzjyj6xjs71"; }; in { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { hjem.users.${username} = { packages = [pkgs.fastfetch]; files = { diff --git a/modules/programs/firefox.nix b/modules/programs/firefox.nix index 2d4b2e7..d282241 100644 --- a/modules/programs/firefox.nix +++ b/modules/programs/firefox.nix @@ -144,7 +144,7 @@ }; }; in { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { hjem.users.${username} = { packages = [firefox]; files = { diff --git a/modules/programs/hypr/idle.nix b/modules/programs/hypr/idle.nix index 1f6e133..ce3f735 100644 --- a/modules/programs/hypr/idle.nix +++ b/modules/programs/hypr/idle.nix @@ -12,7 +12,7 @@ hyprlock = "${inputs.hyprlock.packages.${pkgs.system}.hyprlock}/bin/hyprlock"; in { - config = lib.mkIf config.local.modules.hyprland.enable { + config = lib.mkIf (config.local.systemVars.desktop == "Hyprland") { hjem.users.${username} = { packages = [hypridle]; files = { diff --git a/modules/programs/hypr/land/default.nix b/modules/programs/hypr/land/default.nix index 8195ba0..4738ea9 100644 --- a/modules/programs/hypr/land/default.nix +++ b/modules/programs/hypr/land/default.nix @@ -29,7 +29,7 @@ ''; }); in { - config = mkIf config.local.modules.hyprland.enable { + config = mkIf (config.local.systemVars.desktop == "Hyprland") { programs.hyprland = { enable = true; package = inputs.hyprland.packages.${pkgs.system}.hyprland; diff --git a/modules/programs/hypr/lock.nix b/modules/programs/hypr/lock.nix index ae1bfba..1902a78 100644 --- a/modules/programs/hypr/lock.nix +++ b/modules/programs/hypr/lock.nix @@ -14,7 +14,7 @@ styleCfg = config.local.style; rgbaPalette = builtins.mapAttrs (_: c: (lib'.rgba c 1)) styleCfg.scheme.palette; in { - config = mkIf config.local.modules.hyprland.enable { + config = mkIf (config.local.systemVars.desktop == "Hyprland") { hjem.users.${username} = { packages = [hyprlock]; files = { diff --git a/modules/programs/hypr/paper.nix b/modules/programs/hypr/paper.nix index c2d29b9..4b59ec9 100644 --- a/modules/programs/hypr/paper.nix +++ b/modules/programs/hypr/paper.nix @@ -11,7 +11,7 @@ inherit (config.local.style) wallpaper; inherit (inputs.hyprpaper.packages.${pkgs.system}) hyprpaper; in { - config = lib.mkIf config.local.modules.hyprland.enable { + config = lib.mkIf (config.local.systemVars.desktop == "Hyprland") { hjem.users.${username} = { packages = [hyprpaper]; files = { diff --git a/modules/programs/media/default.nix b/modules/programs/media/default.nix index 601ba70..e77808a 100644 --- a/modules/programs/media/default.nix +++ b/modules/programs/media/default.nix @@ -11,7 +11,7 @@ in { ./zathura.nix ]; - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { hjem.users.${username}.packages = [ pkgs.gnome-calculator pkgs.gthumb diff --git a/modules/programs/media/tidal-hifi.nix b/modules/programs/media/tidal-hifi.nix index 2080e85..467f4c5 100644 --- a/modules/programs/media/tidal-hifi.nix +++ b/modules/programs/media/tidal-hifi.nix @@ -7,7 +7,7 @@ inherit (config.local.systemVars) username; styleCfg = config.local.style; in { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { hjem.users.${username} = { packages = [pkgs.tidal-hifi]; files = { diff --git a/modules/programs/media/zathura.nix b/modules/programs/media/zathura.nix index 3a317ca..ce4758a 100644 --- a/modules/programs/media/zathura.nix +++ b/modules/programs/media/zathura.nix @@ -9,7 +9,7 @@ builtins.concatStringsSep "\n" (lib.mapAttrsToList (option: value: "set ${option} \"${toString value}\"") attrs); in { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { hjem.users.${username} = { packages = [pkgs.zathura]; files = { diff --git a/modules/programs/misc.nix b/modules/programs/misc.nix index 5654f7a..7ab3325 100644 --- a/modules/programs/misc.nix +++ b/modules/programs/misc.nix @@ -8,7 +8,7 @@ inherit (lib) mkIf; inherit (config.local.systemVars) username; in { - config = mkIf config.local.profiles.desktop.enable { + config = mkIf (config.local.systemVars.desktop != "none") { hjem.users.${username} = { packages = with pkgs; [ entr diff --git a/modules/programs/nh.nix b/modules/programs/nh.nix index e34a443..20a220f 100644 --- a/modules/programs/nh.nix +++ b/modules/programs/nh.nix @@ -4,10 +4,9 @@ ... }: let inherit (lib.modules) mkIf; - inherit (config.local.profiles) desktop; - inherit (config.local.systemVars) username; + inherit (config.local.systemVars) desktop username; in { - config = mkIf desktop.enable { + config = mkIf (desktop != "none") { programs.nh = { enable = true; clean = { diff --git a/modules/programs/terminal/emulators/foot.nix b/modules/programs/terminal/emulators/foot.nix index ada1641..f462101 100644 --- a/modules/programs/terminal/emulators/foot.nix +++ b/modules/programs/terminal/emulators/foot.nix @@ -5,6 +5,7 @@ ... }: let inherit (lib) optionalAttrs; + inherit (lib.modules) mkIf; inherit (config.local.systemVars) username; styleCfg = config.local.style; @@ -38,7 +39,7 @@ "21" = palette.base06; }; in { - config = lib.mkIf config.local.modules.hyprland.enable { + config = mkIf (config.local.systemVars.desktop != "none") { hjem.users.${username} = { packages = [pkgs.foot]; files = { diff --git a/modules/programs/terminal/emulators/ghostty.nix b/modules/programs/terminal/emulators/ghostty.nix index c299681..37d945b 100644 --- a/modules/programs/terminal/emulators/ghostty.nix +++ b/modules/programs/terminal/emulators/ghostty.nix @@ -45,7 +45,7 @@ selection-foreground = colors.base05; }; in { - config = mkIf config.local.profiles.desktop.enable { + config = mkIf (config.local.systemVars.desktop != "none") { hjem.users.${username} = { files = mkMerge [ { diff --git a/modules/programs/terminal/programs/bat.nix b/modules/programs/terminal/programs/bat.nix index 8fa94c7..67c838a 100644 --- a/modules/programs/terminal/programs/bat.nix +++ b/modules/programs/terminal/programs/bat.nix @@ -9,7 +9,7 @@ builtins.concatStringsSep "\n" (lib.mapAttrsToList (option: value: "--${option}=\"${value}\"") attrs); in { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { hjem.users.${username} = { packages = [ pkgs.bat diff --git a/modules/programs/terminal/programs/direnv.nix b/modules/programs/terminal/programs/direnv.nix index 28edce7..b42393e 100644 --- a/modules/programs/terminal/programs/direnv.nix +++ b/modules/programs/terminal/programs/direnv.nix @@ -3,7 +3,7 @@ config, ... }: { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { programs.direnv.enable = true; }; } diff --git a/modules/programs/terminal/programs/git.nix b/modules/programs/terminal/programs/git.nix index ffa6bef..6f28968 100644 --- a/modules/programs/terminal/programs/git.nix +++ b/modules/programs/terminal/programs/git.nix @@ -8,7 +8,7 @@ inherit (config.local.homeVars) signingKey; toINI = lib.generators.toINI {}; in { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { hjem.users.${username} = { packages = with pkgs; [git lazygit]; files = { diff --git a/modules/programs/terminal/programs/misc.nix b/modules/programs/terminal/programs/misc.nix index f8710d7..945523a 100644 --- a/modules/programs/terminal/programs/misc.nix +++ b/modules/programs/terminal/programs/misc.nix @@ -6,7 +6,7 @@ }: let inherit (config.local.systemVars) username; in { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { hjem.users.${username} = { packages = with pkgs; [ # archives diff --git a/modules/programs/terminal/programs/tmux.nix b/modules/programs/terminal/programs/tmux.nix index da828e2..2341656 100644 --- a/modules/programs/terminal/programs/tmux.nix +++ b/modules/programs/terminal/programs/tmux.nix @@ -4,7 +4,7 @@ osConfig, ... }: { - config = lib.mkIf osConfig.local.profiles.desktop.enable { + config = lib.mkIf (osConfig.local.systemVars.desktop != "none") { programs.tmux = { enable = true; prefix = "C-space"; diff --git a/modules/programs/terminal/shell/default.nix b/modules/programs/terminal/shell/default.nix index 49fc42c..b338f98 100644 --- a/modules/programs/terminal/shell/default.nix +++ b/modules/programs/terminal/shell/default.nix @@ -14,7 +14,7 @@ in { ./zsh.nix ]; - config = mkIf config.local.profiles.desktop.enable { + config = mkIf (config.local.systemVars.desktop != "none") { users.users.${username}.shell = pkgs.zsh; }; } diff --git a/modules/programs/terminal/shell/nushell.nix b/modules/programs/terminal/shell/nushell.nix index 0f5b250..78e2ac8 100644 --- a/modules/programs/terminal/shell/nushell.nix +++ b/modules/programs/terminal/shell/nushell.nix @@ -12,7 +12,7 @@ starshipCache = "${config.hjem.users.${username}.directory}/.cache/starship"; zoxideCache = "${config.hjem.users.${username}.directory}/.cache/zoxide"; in { - config = mkIf config.local.profiles.desktop.enable { + config = mkIf (config.local.systemVars.desktop != "none") { hjem.users.${username} = { packages = with pkgs; [carapace nushell]; files = { diff --git a/modules/programs/terminal/shell/starship.nix b/modules/programs/terminal/shell/starship.nix index cc58f2c..1d246d0 100644 --- a/modules/programs/terminal/shell/starship.nix +++ b/modules/programs/terminal/shell/starship.nix @@ -7,7 +7,7 @@ inherit (config.local.systemVars) username; toTOML = (pkgs.formats.toml {}).generate; in { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { hjem.users.${username} = { packages = [pkgs.starship]; files = { diff --git a/modules/programs/terminal/shell/zoxide.nix b/modules/programs/terminal/shell/zoxide.nix index a183294..d480b03 100644 --- a/modules/programs/terminal/shell/zoxide.nix +++ b/modules/programs/terminal/shell/zoxide.nix @@ -6,7 +6,7 @@ }: let inherit (config.local.systemVars) username; in { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { hjem.users.${username} = { packages = [pkgs.zoxide]; }; diff --git a/modules/programs/terminal/shell/zsh.nix b/modules/programs/terminal/shell/zsh.nix index 485cc0f..13dd308 100644 --- a/modules/programs/terminal/shell/zsh.nix +++ b/modules/programs/terminal/shell/zsh.nix @@ -7,7 +7,7 @@ inherit (lib) mkIf; inherit (config.local.systemVars) username; in { - config = mkIf config.local.profiles.desktop.enable { + config = mkIf (config.local.systemVars.desktop != "none") { programs.zsh.enable = true; hjem.users.${username} = { packages = [pkgs.zsh]; diff --git a/modules/programs/thunar.nix b/modules/programs/thunar.nix index 927e385..a5d9148 100644 --- a/modules/programs/thunar.nix +++ b/modules/programs/thunar.nix @@ -6,7 +6,7 @@ }: let inherit (lib) mkIf; in { - config = mkIf config.local.profiles.desktop.enable { + config = mkIf (config.local.systemVars.desktop != "none") { programs = { thunar = { enable = true; diff --git a/modules/programs/waybar.nix b/modules/programs/waybar.nix index 666d0cc..0e6aec2 100644 --- a/modules/programs/waybar.nix +++ b/modules/programs/waybar.nix @@ -10,7 +10,7 @@ styleCfg = config.local.style; betterTransition = "all 0.3s cubic-bezier(.55,-0.68,.48,1.682)"; in { - config = mkIf config.local.modules.hyprland.enable { + config = mkIf (config.local.systemVars.desktop == "Hyprland") { hjem.users.${username} = { packages = [ pkgs.waybar diff --git a/modules/programs/wlogout.nix b/modules/programs/wlogout.nix index 568158f..c72113e 100644 --- a/modules/programs/wlogout.nix +++ b/modules/programs/wlogout.nix @@ -17,7 +17,7 @@ in builtins.concatStringsSep "\n" (map formatItem items); in { - config = lib.mkIf config.local.modules.hyprland.enable { + config = lib.mkIf (config.local.systemVars.desktop == "Hyprland") { hjem.users.${username} = { packages = [pkgs.wlogout]; files = { diff --git a/modules/programs/xdg.nix b/modules/programs/xdg.nix index ca80011..03b9dcd 100644 --- a/modules/programs/xdg.nix +++ b/modules/programs/xdg.nix @@ -6,7 +6,7 @@ }: let inherit (config.local.systemVars) username; in { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { hjem.users.${username} = { files = { ".config/mimeapps.list".text = '' diff --git a/modules/services/docker.nix b/modules/services/docker.nix index 97ecd28..bcb3656 100644 --- a/modules/services/docker.nix +++ b/modules/services/docker.nix @@ -4,7 +4,7 @@ config, ... }: { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { virtualisation.podman = { enable = true; dockerCompat = true; diff --git a/modules/services/documentation.nix b/modules/services/documentation.nix index c715c55..84db333 100644 --- a/modules/services/documentation.nix +++ b/modules/services/documentation.nix @@ -3,7 +3,7 @@ config, ... }: { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { documentation = { enable = true; diff --git a/modules/services/flatpak.nix b/modules/services/flatpak.nix index bbf4f92..48e5e3d 100644 --- a/modules/services/flatpak.nix +++ b/modules/services/flatpak.nix @@ -3,7 +3,7 @@ config, ... }: { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { services.flatpak.enable = true; }; } diff --git a/modules/services/gammastep.nix b/modules/services/gammastep.nix index 75d2ec3..3bb8981 100644 --- a/modules/services/gammastep.nix +++ b/modules/services/gammastep.nix @@ -7,7 +7,7 @@ inherit (config.local.systemVars) username; toINI = lib.generators.toINI {}; in { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { hjem.users.${username} = { packages = [pkgs.gammastep]; files = { diff --git a/modules/services/gnome.nix b/modules/services/gnome.nix index 7a5865f..e4c3acd 100644 --- a/modules/services/gnome.nix +++ b/modules/services/gnome.nix @@ -4,7 +4,7 @@ config, ... }: { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { services = { # needed for GNOME services outside of GNOME Desktop dbus.packages = with pkgs; [ diff --git a/modules/services/greetd.nix b/modules/services/greetd.nix index 35de5be..a52e3f2 100644 --- a/modules/services/greetd.nix +++ b/modules/services/greetd.nix @@ -49,8 +49,7 @@ let }; }); in { - # TODO: perhaps turn this into a more generic module if we wanna use other wayland compositors - config = lib.mkIf config.local.modules.hyprland.enable { + config = lib.mkIf (config.local.systemVars.desktop == "Hyprland") { services.greetd = { enable = true; settings = { diff --git a/modules/services/keyd.nix b/modules/services/keyd.nix index 12e44f4..e74f82a 100644 --- a/modules/services/keyd.nix +++ b/modules/services/keyd.nix @@ -4,7 +4,7 @@ config, ... }: { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { services.keyd = { enable = true; keyboards.default = { diff --git a/modules/services/kmscon.nix b/modules/services/kmscon.nix index 758df65..f4d348d 100644 --- a/modules/services/kmscon.nix +++ b/modules/services/kmscon.nix @@ -4,7 +4,7 @@ config, ... }: { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { services.kmscon = { enable = true; fonts = [ diff --git a/modules/services/location.nix b/modules/services/location.nix index ac22b89..c006b98 100644 --- a/modules/services/location.nix +++ b/modules/services/location.nix @@ -3,7 +3,7 @@ config, ... }: { - config = lib.mkIf config.local.modules.hyprland.enable { + config = lib.mkIf (config.local.systemVars.desktop == "Hyprland") { location.provider = "geoclue2"; services.geoclue2 = { diff --git a/modules/services/pipewire.nix b/modules/services/pipewire.nix index 25cc868..56e72f9 100644 --- a/modules/services/pipewire.nix +++ b/modules/services/pipewire.nix @@ -8,7 +8,7 @@ inputs.nix-gaming.nixosModules.pipewireLowLatency ]; - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { services = { pulseaudio.enable = false; pipewire = { diff --git a/modules/services/ssh.nix b/modules/services/ssh.nix index b63c4ab..5e73c68 100644 --- a/modules/services/ssh.nix +++ b/modules/services/ssh.nix @@ -5,7 +5,7 @@ }: let inherit (config.local.systemVars) username; in { - config = lib.mkIf config.local.profiles.desktop.enable { + config = lib.mkIf (config.local.systemVars.desktop != "none") { programs.ssh = { startAgent = true; }; diff --git a/modules/services/swaync/default.nix b/modules/services/swaync/default.nix index 716e87d..b99cf2d 100644 --- a/modules/services/swaync/default.nix +++ b/modules/services/swaync/default.nix @@ -9,7 +9,7 @@ inherit (config.local.systemVars) username; inherit (lib') generateGtkColors; in { - config = lib.mkIf config.local.modules.hyprland.enable { + config = lib.mkIf (config.local.systemVars.desktop == "Hyprland") { hjem.users.${username} = { files = { ".config/swaync/config.json".text = toJSON {