From facfd016619d08a277ccc58bfac96906860bee07 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Thu, 23 Jan 2025 21:55:22 -0500 Subject: [PATCH] Make zsh install conditional. --- nix/configuration/hosts/neelix/default.nix | 1 + nix/configuration/hosts/odo/default.nix | 1 + nix/configuration/roles/zsh/default.nix | 75 +++++++++++++--------- 3 files changed, 47 insertions(+), 30 deletions(-) diff --git a/nix/configuration/hosts/neelix/default.nix b/nix/configuration/hosts/neelix/default.nix index 9fdba20..d11b62f 100644 --- a/nix/configuration/hosts/neelix/default.nix +++ b/nix/configuration/hosts/neelix/default.nix @@ -31,4 +31,5 @@ me.lvfs.enable = true; me.sound.enable = true; me.zrepl.enable = true; + me.zsh.enable = true; } diff --git a/nix/configuration/hosts/odo/default.nix b/nix/configuration/hosts/odo/default.nix index 17e9537..7a15d09 100644 --- a/nix/configuration/hosts/odo/default.nix +++ b/nix/configuration/hosts/odo/default.nix @@ -58,4 +58,5 @@ me.wasm.enable = true; me.waybar.enable = true; me.zrepl.enable = true; + me.zsh.enable = true; } diff --git a/nix/configuration/roles/zsh/default.nix b/nix/configuration/roles/zsh/default.nix index bbd15dc..1a7478d 100644 --- a/nix/configuration/roles/zsh/default.nix +++ b/nix/configuration/roles/zsh/default.nix @@ -55,36 +55,51 @@ in { imports = [ ]; - environment.systemPackages = with pkgs; [ - zsh - ]; - - users.users.talexander.shell = pkgs.zsh; - environment.shells = with pkgs; [ zsh ]; - - programs.zsh = { - enable = true; - }; - - home-manager.users.talexander = - { pkgs, ... }: - { - home.file.".zshrc" = { - source = "${zshrc}"; - }; - }; - - environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) { - hideMounts = true; - users.talexander = { - directories = [ - { - directory = ".histdb"; - user = "talexander"; - group = "talexander"; - mode = "0700"; - } - ]; + options.me = { + zsh.enable = lib.mkOption { + type = lib.types.bool; + default = false; + example = true; + description = "Whether we want to install zsh."; }; }; + + config = lib.mkIf config.me.zsh.enable ( + lib.mkMerge [ + { + environment.systemPackages = with pkgs; [ + zsh + ]; + + users.users.talexander.shell = pkgs.zsh; + environment.shells = with pkgs; [ zsh ]; + + programs.zsh = { + enable = true; + }; + + home-manager.users.talexander = + { pkgs, ... }: + { + home.file.".zshrc" = { + source = "${zshrc}"; + }; + }; + + environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) { + hideMounts = true; + users.talexander = { + directories = [ + { + directory = ".histdb"; + user = "talexander"; + group = "talexander"; + mode = "0700"; + } + ]; + }; + }; + } + ] + ); }