From 3d36a55e0b1a1cf614e2bf8f29da94232c3b80a1 Mon Sep 17 00:00:00 2001 From: Pacman99 Date: Thu, 18 Feb 2021 14:58:53 -0800 Subject: [PATCH] nix-darwin add sharedModules and extraSpecialArgs options --- nix-darwin/default.nix | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/nix-darwin/default.nix b/nix-darwin/default.nix index 9947ff855976..c529ca4a1020 100644 --- a/nix-darwin/default.nix +++ b/nix-darwin/default.nix @@ -12,7 +12,7 @@ let specialArgs = { lib = extendedLib; darwinConfig = config; - }; + } // cfg.extraSpecialArgs; modules = [ ({ name, ... }: { imports = import ../modules/modules.nix { @@ -29,7 +29,7 @@ let home.homeDirectory = config.users.users.${name}.home; }; }) - ]; + ] ++ cfg.sharedModules; }; in @@ -58,6 +58,24 @@ in ''; }; + extraSpecialArgs = mkOption { + type = types.attrs; + default = { }; + example = literalExample "{ modulesPath = ../modules; }"; + description = '' + Extra specialArgs passed to Home Manager. + ''; + }; + + sharedModules = mkOption { + type = with types; listOf (oneOf [ attrs (functionTo attrs) path ]); + default = [ ]; + example = literalExample "[ { home.packages = [ nixpkgs-fmt ]; } ]"; + description = '' + Extra modules added to all users. + ''; + }; + verbose = mkEnableOption "verbose output on activation"; users = mkOption {