diff options
Diffstat (limited to 'lib/mk_darwin.nix')
-rw-r--r-- | lib/mk_darwin.nix | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/mk_darwin.nix b/lib/mk_darwin.nix new file mode 100644 index 0000000..1da4dc3 --- /dev/null +++ b/lib/mk_darwin.nix @@ -0,0 +1,23 @@ +{ self, unstable, nix-darwin, ... } @ args: +{ + mkDarwin = { name, nixpkgs ? unstable, system ? "aarch64-darwin", overlays ? null, extraModules ? null }: + nix-darwin.lib.darwinSystem ( + let + configFolder = "${self}/darwin"; + entryPoint = "${configFolder}/${name}/configuration.nix"; + in + { + system = system; + pkgs = import nixpkgs { inherit system; }; + + modules = [ + { + networking.hostName = name; + system.configurationRevision = self.rev or self.dirtyRev; + } + entryPoint + ] ++ nixpkgs.lib.optional (overlays != null) { nixpkgs.overlays = overlays; } + ++ nixpkgs.lib.optionals (extraModules != null) extraModules; + } + ); +} |