From 9500cbd57d11a67953bcbc78720beed0bbbaec4c Mon Sep 17 00:00:00 2001 From: Tyler Beckman Date: Wed, 11 Dec 2024 20:09:53 -0700 Subject: [PATCH] Allow disabling home-manager parts for server --- flake.nix | 24 +++++++++++++++++++++++ home-manager/default.nix | 6 +++--- home-manager/home.nix | 18 ++++++++--------- home-manager/modules/accounts/default.nix | 4 ++-- home-manager/modules/shell/default.nix | 4 ++-- 5 files changed, 40 insertions(+), 16 deletions(-) diff --git a/flake.nix b/flake.nix index e95daf9..5f6fbc7 100755 --- a/flake.nix +++ b/flake.nix @@ -68,6 +68,16 @@ # Home manager home-manager.nixosModules.home-manager ./home-manager + { + hmOptions = { + plasma.enable = true; + beets.enable = true; + firefox.enable = true; + thunderbird.enable = true; + rescrobbled.enable = true; + vscode.enable = true; + }; + } ]; specialArgs = { @@ -84,6 +94,20 @@ # Better command-not-found nix-index-database.nixosModules.nix-index { programs.nix-index-database.comma.enable = true; } + + # Home manager + home-manager.nixosModules.home-manager + ./home-manager + { + hmOptions = { + plasma.enable = false; + beets.enable = false; + firefox.enable = false; + thunderbird.enable = false; + rescrobbled.enable = false; + vscode.enable = false; + }; + } ]; specialArgs = { diff --git a/home-manager/default.nix b/home-manager/default.nix index 9c76ef5..1047297 100755 --- a/home-manager/default.nix +++ b/home-manager/default.nix @@ -1,10 +1,10 @@ -{ inputs, system, secrets, ... }: +{ inputs, system, secrets, lib, config, ... }: { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.sharedModules = [ - inputs.plasma-manager.homeManagerModules.plasma-manager - ./custom-modules + (lib.mkIf config.hmOptions.plasma.enable inputs.plasma-manager.homeManagerModules.plasma-manager) + (lib.mkIf config.hmOptions.beets.enable ./custom-modules) ]; home-manager.extraSpecialArgs = { inherit inputs system secrets; diff --git a/home-manager/home.nix b/home-manager/home.nix index 9cb1a64..01157f9 100755 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -1,4 +1,4 @@ -{ ... }: +{ lib, config, ... }: { home.stateVersion = "24.05"; home.username = "ty"; @@ -6,17 +6,17 @@ imports = [ ./modules/packages.nix - ./modules/plasma.nix + (lib.mkIf config.hmOptions.plasma.enable ./modules/plasma.nix) ./modules/vcs - ./modules/firefox.nix - ./modules/thunderbird.nix + (lib.mkIf config.hmOptions.firefox.enable ./modules/firefox.nix) + (lib.mkIf config.hmOptions.thunderbird.enable ./modules/thunderbird.nix) ./modules/accounts ./modules/gpg.nix ./modules/shell - ./modules/vscode.nix - ./modules/desktop.nix - ./modules/gtk.nix - ./modules/beets.nix - ./modules/rescrobbled.nix + (lib.mkIf config.hmOptions.vscode.enable ./modules/vscode.nix) + (lib.mkIf config.hmOptions.plasma.enable ./modules/desktop.nix) + (lib.mkIf config.hmOptions.plasma.enable ./modules/gtk.nix) + (lib.mkIf config.hmOptions.beets.enable ./modules/beets.nix) + (lib.mkIf config.hmOptions.rescrobbled.enable ./modules/rescrobbled.nix) ]; } \ No newline at end of file diff --git a/home-manager/modules/accounts/default.nix b/home-manager/modules/accounts/default.nix index 9eaca80..e83e05b 100755 --- a/home-manager/modules/accounts/default.nix +++ b/home-manager/modules/accounts/default.nix @@ -1,7 +1,7 @@ -{ ... }: +{ lib, config, ... }: { imports = [ - ./email.nix + (lib.mkIf config.hmOptions.thunderbird.enable ./email.nix) ./ssh.nix ]; } \ No newline at end of file diff --git a/home-manager/modules/shell/default.nix b/home-manager/modules/shell/default.nix index 596315d..b53bf36 100644 --- a/home-manager/modules/shell/default.nix +++ b/home-manager/modules/shell/default.nix @@ -1,9 +1,9 @@ -{ ... }: +{ lib, config, ... }: { imports = [ ./btop.nix ./direnv.nix - ./konsole.nix + (lib.mkIf config.hmOptions.plasma.enable ./konsole.nix) ./starship.nix ./zsh.nix ];