From 73340250f8e141124fd38a12a7412480dcd00a3c Mon Sep 17 00:00:00 2001 From: sefidel Date: Sun, 19 Jan 2025 09:03:42 +1000 Subject: feat(lib): add mkDarwin --- lib/mk_darwin.nix | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lib/mk_darwin.nix 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; + } + ); +} -- cgit 1.4.1