From 8714f9e28529183d65d9f42ac92cdc5d70dbb6f7 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Tue, 10 Sep 2024 22:37:18 +0200 Subject: flake: put nixpkgs in NIX_PATH and system registry for flake configs Currently there are a bunch of really wacky hacks required to get nixpkgs path correctly set up under flake configs such that `nix run nixpkgs#hello` and `nix run -f '' hello` hit the nixpkgs that the system was built with. In particular you have to use specialArgs or an anonymous module, and everyone has to include this hack in their own configs. We can do this for users automatically. NixOS/nixpkgs@e456032addae76701eb17e6c03fc515fd78ad74f Co-authored-by: Antoine Cotten --- flake.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index e25fe6a..0f79d77 100644 --- a/flake.nix +++ b/flake.nix @@ -27,6 +27,7 @@ } ++ [ ({ lib, ... }: { nixpkgs.source = lib.mkDefault nixpkgs; + nixpkgs.flake.source = lib.mkDefault nixpkgs; system.checks.verifyNixPath = lib.mkDefault false; -- cgit v1.2.3 From db92fac3a9552ac3338977dcaf4cd15acf4aac08 Mon Sep 17 00:00:00 2001 From: Emily Date: Tue, 17 Sep 2024 21:24:24 +0100 Subject: flake: match NixOS definition of `nixpkgs.flake.source` Closes: #1082 --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 0f79d77..59db4ff 100644 --- a/flake.nix +++ b/flake.nix @@ -27,7 +27,7 @@ } ++ [ ({ lib, ... }: { nixpkgs.source = lib.mkDefault nixpkgs; - nixpkgs.flake.source = lib.mkDefault nixpkgs; + nixpkgs.flake.source = lib.mkDefault nixpkgs.outPath; system.checks.verifyNixPath = lib.mkDefault false; -- cgit v1.2.3 From c13549d7a632fc107bc8802463806fc2002c9c54 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Mon, 4 Nov 2024 13:40:00 +1100 Subject: examples: drop `ofborg` example We decided to drop this example as the package is not available in Nixpkgs and we won't be able to import it easily and keep this example evaluating as a useful smoke test. The code in this example is already documented under `services.ofborg.*` so any interested users can still find out how to set up `ofborg`. --- flake.nix | 1 - 1 file changed, 1 deletion(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 59db4ff..8d50f95 100644 --- a/flake.nix +++ b/flake.nix @@ -48,7 +48,6 @@ darwinModules.hydra = ./modules/examples/hydra.nix; darwinModules.lnl = ./modules/examples/lnl.nix; - darwinModules.ofborg = ./modules/examples/ofborg.nix; darwinModules.simple = ./modules/examples/simple.nix; templates.default = { -- cgit v1.2.3 From 68637ee7dbdb194755697930c36272ad115af4a6 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Sun, 3 Nov 2024 21:52:58 +1100 Subject: flake: expose `jobs` from `release.nix` as a flattened attrset --- flake.nix | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 8d50f95..48dc312 100644 --- a/flake.nix +++ b/flake.nix @@ -1,9 +1,12 @@ { - # WARNING this is very much still experimental. description = "A collection of darwin modules"; outputs = { self, nixpkgs }: let forAllSystems = nixpkgs.lib.genAttrs [ "aarch64-darwin" "x86_64-darwin" ]; + + jobs = forAllSystems (system: import ./release.nix { + inherit nixpkgs system; + }); in { lib = { evalConfig = import ./eval-config.nix; @@ -55,21 +58,7 @@ description = "nix flake init -t nix-darwin"; }; - checks = forAllSystems (system: let - simple = self.lib.darwinSystem { - modules = [ - self.darwinModules.simple - { nixpkgs.hostPlatform = system; } - ]; - }; - in { - simple = simple.system; - - inherit (simple.config.system.build.manual) - optionsJSON - manualHTML - manpages; - }); + checks = forAllSystems (system: jobs.${system}.tests // jobs.${system}.examples); packages = forAllSystems (system: let pkgs = import nixpkgs { @@ -80,6 +69,8 @@ default = self.packages.${system}.darwin-rebuild; inherit (pkgs) darwin-option darwin-rebuild darwin-version darwin-uninstaller; + + inherit (jobs.${system}.docs) manualHTML manpages optionsJSON; }); }; } -- cgit v1.2.3 From a82d72d25f67dff02afbd6fb72cd16e2ec040a68 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Thu, 7 Nov 2024 23:23:46 +1100 Subject: flake: expose docs on Linux as well --- flake.nix | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 48dc312..fb5545b 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,8 @@ description = "A collection of darwin modules"; outputs = { self, nixpkgs }: let - forAllSystems = nixpkgs.lib.genAttrs [ "aarch64-darwin" "x86_64-darwin" ]; + forAllSystems = nixpkgs.lib.genAttrs [ "aarch64-darwin" "x86_64-darwin" "aarch64-linux" "x86_64-linux" ]; + forDarwinSystems = nixpkgs.lib.genAttrs [ "aarch64-darwin" "x86_64-darwin" ]; jobs = forAllSystems (system: import ./release.nix { inherit nixpkgs system; @@ -58,9 +59,11 @@ description = "nix flake init -t nix-darwin"; }; - checks = forAllSystems (system: jobs.${system}.tests // jobs.${system}.examples); + checks = forDarwinSystems (system: jobs.${system}.tests // jobs.${system}.examples); - packages = forAllSystems (system: let + packages = forAllSystems (system: { + inherit (jobs.${system}.docs) manualHTML manpages optionsJSON; + } // (nixpkgs.lib.optionalAttrs (nixpkgs.lib.hasSuffix "darwin" system) (let pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.default ]; @@ -69,8 +72,6 @@ default = self.packages.${system}.darwin-rebuild; inherit (pkgs) darwin-option darwin-rebuild darwin-version darwin-uninstaller; - - inherit (jobs.${system}.docs) manualHTML manpages optionsJSON; - }); + }))); }; } -- cgit v1.2.3 From 2ff55ab1c5c238181c3b6f1bd78156e7d77812bb Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Fri, 8 Nov 2024 16:38:31 +1100 Subject: manual: get revision information when called from flake --- flake.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index fb5545b..2c1ae1b 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,8 @@ jobs = forAllSystems (system: import ./release.nix { inherit nixpkgs system; + + nix-darwin = self; }); in { lib = { -- cgit v1.2.3 From 0ef91bc148dc1873cdc21d8efbe3c65f91db311a Mon Sep 17 00:00:00 2001 From: Emily Date: Wed, 8 Jan 2025 19:10:22 +0000 Subject: flake: pin Nixpkgs explicitly --- flake.nix | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 2c1ae1b..92569fa 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,10 @@ { description = "A collection of darwin modules"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + }; + outputs = { self, nixpkgs }: let forAllSystems = nixpkgs.lib.genAttrs [ "aarch64-darwin" "x86_64-darwin" "aarch64-linux" "x86_64-linux" ]; forDarwinSystems = nixpkgs.lib.genAttrs [ "aarch64-darwin" "x86_64-darwin" ]; -- cgit v1.2.3