From f70f90c42207ede0c3b21b785e2650beeecc161c Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Sat, 10 Jun 2023 00:23:02 +1000 Subject: [PATCH] flake: add `packages.darwin-{option,rebuild}` --- flake.nix | 11 +++++++++++ modules/nix/nix-darwin.nix | 6 ++++-- pkgs/nix-tools/default.nix | 7 +++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 pkgs/nix-tools/default.nix diff --git a/flake.nix b/flake.nix index 14b16fba..dab4739d 100644 --- a/flake.nix +++ b/flake.nix @@ -64,7 +64,18 @@ packages = forAllSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; + + darwin = self.lib.darwinSystem { + inherit system; + modules = [ ]; + }; + + nix-tools = pkgs.callPackage ./pkgs/nix-tools { inherit darwin; }; in { + default = self.packages.${system}.darwin-rebuild; + + inherit (nix-tools) darwin-rebuild darwin-option; + darwin-uninstaller = pkgs.callPackage ./pkgs/darwin-uninstaller { nix-darwin = self; }; }); }; diff --git a/modules/nix/nix-darwin.nix b/modules/nix/nix-darwin.nix index fceecc25..a96fdb2f 100644 --- a/modules/nix/nix-darwin.nix +++ b/modules/nix/nix-darwin.nix @@ -1,7 +1,5 @@ { config, pkgs, lib, ... }: -with lib; - let inherit (pkgs) stdenv; @@ -39,5 +37,9 @@ in darwin-rebuild ]; + system.build = { + inherit darwin-option darwin-rebuild; + }; + }; } diff --git a/pkgs/nix-tools/default.nix b/pkgs/nix-tools/default.nix new file mode 100644 index 00000000..93fd3e38 --- /dev/null +++ b/pkgs/nix-tools/default.nix @@ -0,0 +1,7 @@ +{ darwin }: + +let + inherit (darwin) config; +in { + inherit (config.system.build) darwin-option darwin-rebuild; +}