From 8b48ed06e2f6a9f746dfb47f315ba25265c75591 Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Tue, 1 Jul 2025 23:16:12 -0500 Subject: [PATCH] working-ish, not all options --- flake.nix | 16 ++++++++-------- options.nix => nixosModules/options.nix | 6 ++++++ nixosModules/scripts.nix | 16 ++++++++++++++++ 3 files changed, 30 insertions(+), 8 deletions(-) rename options.nix => nixosModules/options.nix (88%) create mode 100644 nixosModules/scripts.nix diff --git a/flake.nix b/flake.nix index bbaf70d..00cf7d6 100644 --- a/flake.nix +++ b/flake.nix @@ -19,7 +19,7 @@ { homeManagerModules.default = { ... }: { imports = [ - ./options.nix + ./nixosModules/options.nix ./home.nix ./git.nix inputs._1password-shell-plugins.hmModules.default @@ -31,7 +31,8 @@ nixosModules.default = { config, ... }: { imports = [ - ./options.nix + ./nixosModules/options.nix + ./nixosModules/scripts.nix inputs.home-manager.nixosModules.default ]; @@ -41,12 +42,11 @@ extraSpecialArgs = { inherit inputs; }; users.${config.user} = { imports = [ - self.homeManagerModules.default - { _module.args = { nixosConfig = config; }; } - # self.homeManagerModules.default { - # stateVersion = config.stateVersion; - # } - ]; + self.homeManagerModules.default { + user = config.user; + stateVersion = config.stateVersion; + } + ] ++ config.extraImports; }; }; }; diff --git a/options.nix b/nixosModules/options.nix similarity index 88% rename from options.nix rename to nixosModules/options.nix index 9a3e225..62b31b0 100644 --- a/options.nix +++ b/nixosModules/options.nix @@ -42,4 +42,10 @@ default = false; description = "Whether to enable 1 password stuff"; }; + + options.extraImports = lib.mkOption { + type = lib.types.listOf lib.types.anything; + default = []; + description = "Additional Home Manager modules to import"; + }; } diff --git a/nixosModules/scripts.nix b/nixosModules/scripts.nix new file mode 100644 index 0000000..d3b1c2c --- /dev/null +++ b/nixosModules/scripts.nix @@ -0,0 +1,16 @@ +{ config, pkgs, ... }: +let + hostName = config.networking.hostName; +in +{ + environment.systemPackages = with pkgs; [ + (pkgs.writeShellScriptBin "nfs" '' + sudo nixos-rebuild switch --flake $(readlink -f /etc/nixos)#${hostName} --impure + '') + (pkgs.writeShellScriptBin "nfsu" '' + FLAKE=$(readlink -f /etc/nixos) + nix flake update --flake $FLAKE --impure + sudo nixos-rebuild switch --flake $FLAKE#${hostName} --impure + '') + ]; +} \ No newline at end of file