From 2423081e2aad7e5b18859945b7c1cfff63dab080 Mon Sep 17 00:00:00 2001 From: 514fpv Date: Wed, 17 Jan 2024 19:31:56 +0800 Subject: [PATCH] feat: add minimal system option --- global/util/default.nix | 13 ------------- home/util/home.nix | 10 +++++++--- home/util/nixos.nix | 34 +++++++++++++++++++++++++--------- 3 files changed, 32 insertions(+), 25 deletions(-) delete mode 100644 global/util/default.nix diff --git a/global/util/default.nix b/global/util/default.nix deleted file mode 100644 index feb08b7b..00000000 --- a/global/util/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ pkgs -, lib -, config -, ... }: with lib; let - cfg = config.global.util; -in { - options.global.util = { }; - - config = { - programs.zsh.enable = true; - environment.shells = singleton pkgs.zsh; - }; -} diff --git a/home/util/home.nix b/home/util/home.nix index dcb69b34..cc5834d0 100644 --- a/home/util/home.nix +++ b/home/util/home.nix @@ -1,10 +1,14 @@ { pkgs , lib , config -, ... }: with lib; { +, ... }: with lib; let + cfg = config.passthrough.util; +in { home.packages = with pkgs; [ - pv file wget nix-index - e2fsprogs lsscsi zip unzip + pv file wget e2fsprogs + ] ++ optionals (!cfg.minimal) [ + nix-index + lsscsi zip unzip pciutils usbutils nvme-cli ] ++ optionals config.passthrough.gui [ gtk-engine-murrine diff --git a/home/util/nixos.nix b/home/util/nixos.nix index b0eca5bf..f8943085 100644 --- a/home/util/nixos.nix +++ b/home/util/nixos.nix @@ -2,15 +2,31 @@ , lib , config , ... }: with lib; let + cfg = config.home.util; gui = with config.global.gui; ( enable && session ); in { - users.home.persist.directories = [ - ".cache/nix-index" - ] ++ - optionals gui [ - ".local/share/Mission Planner" - ".config/ExpressLRS Configurator" - ".config/betaflight-configurator" - ".config/inav-configurator" - ]; + options.home.util = { + minimal = mkEnableOption "minimal system environment with less packages"; + }; + + config = { + users.homeModules = [ + # this module passes util configuration to home-manager + { passthrough.util = cfg; } + ]; + + programs.zsh.enable = true; + environment.shells = singleton pkgs.zsh; + + users.home.persist.directories = [ ] ++ + optionals (!cfg.minimal) [ + ".cache/nix-index" + ] ++ + optionals gui [ + ".local/share/Mission Planner" + ".config/ExpressLRS Configurator" + ".config/betaflight-configurator" + ".config/inav-configurator" + ]; + }; }