diff --git a/dev/flake.lock b/dev/flake.lock index b309054..d3935b8 100644 --- a/dev/flake.lock +++ b/dev/flake.lock @@ -236,16 +236,15 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1668145650, - "narHash": "sha256-RJsYVz7j6HhXQtcFQJz9bZsgwFG8MblmOt8A4iD1AlY=", - "owner": "hercules-ci", + "lastModified": 1678375184, + "narHash": "sha256-8Cb7fbWhbsd5uleegvkXeGUir9xbSFsW2COVSK4gIzA=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "b106ff14ede4034f8771025f8ac785144358f3cd", + "rev": "8009798849bc1e8d3540b0dd38e3a3260257bd88", "type": "github" }, "original": { - "owner": "hercules-ci", - "ref": "options-markdown-and-errors", + "owner": "NixOS", "repo": "nixpkgs", "type": "github" } diff --git a/dev/flake.nix b/dev/flake.nix index 61815c8..b0af470 100644 --- a/dev/flake.nix +++ b/dev/flake.nix @@ -6,7 +6,7 @@ # As a consequence, this flake is a little non-standard, and # we can't use the `nix` CLI as expected. - nixpkgs.url = "github:hercules-ci/nixpkgs/options-markdown-and-errors"; + nixpkgs.url = "github:NixOS/nixpkgs"; pre-commit-hooks-nix.url = "github:cachix/pre-commit-hooks.nix"; pre-commit-hooks-nix.inputs.nixpkgs.follows = "nixpkgs"; hercules-ci-effects.url = "github:hercules-ci/hercules-ci-effects"; diff --git a/dev/tests/eval-tests.nix b/dev/tests/eval-tests.nix index 6db2fb0..e0dedae 100644 --- a/dev/tests/eval-tests.nix +++ b/dev/tests/eval-tests.nix @@ -1,3 +1,7 @@ +# Run with +# +# nix build -f dev checks.x86_64-linux.eval-tests + rec { f-p = builtins.getFlake (toString ../..); flake-parts = f-p; @@ -48,6 +52,33 @@ rec { }; }; + flakeModulesDeclare = mkFlake + { inputs.self = { outPath = ./.; }; } + ({ config, ... }: { + imports = [ flake-parts.flakeModules.flakeModules ]; + systems = [ ]; + flake.flakeModules.default = { lib, ... }: { + options.flake.test123 = lib.mkOption { default = "option123"; }; + imports = [ config.flake.flakeModules.extra ]; + }; + flake.flakeModules.extra = { + flake.test123 = "123test"; + }; + }); + + flakeModulesImport = mkFlake + { inputs.self = { }; } + { + imports = [ flakeModulesDeclare.flakeModules.default ]; + }; + + flakeModulesDisable = mkFlake + { inputs.self = { }; } + { + imports = [ flakeModulesDeclare.flakeModules.default ]; + disabledModules = [ flakeModulesDeclare.flakeModules.extra ]; + }; + nixpkgsWithoutEasyOverlay = import nixpkgs { system = "x86_64-linux"; overlays = [ ]; @@ -113,6 +144,10 @@ rec { # - `hello_new` shows that the `final` wiring works assert nixpkgsWithEasyOverlay.hello_new == nixpkgsWithEasyOverlay.hello; + assert flakeModulesImport.test123 == "123test"; + + assert flakeModulesDisable.test123 == "option123"; + ok; result = runTests "ok"; diff --git a/modules/flakeModules.nix b/extras/flakeModules.nix similarity index 94% rename from modules/flakeModules.nix rename to extras/flakeModules.nix index b1d3aff..3c76e2b 100644 --- a/modules/flakeModules.nix +++ b/extras/flakeModules.nix @@ -16,6 +16,7 @@ let default = { }; apply = mapAttrs (k: v: { _file = "${toString self.outPath}/flake.nix#flakeModules.${k}"; + key = "${toString self.outPath}/flake.nix#flakeModules.${k}"; imports = [ v ]; }); description = '' diff --git a/flake.lock b/flake.lock index 9aaf672..7f5ecc3 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "nixpkgs-lib": { "locked": { "dir": "lib", - "lastModified": 1677407201, - "narHash": "sha256-3blwdI9o1BAprkvlByHvtEm5HAIRn/XPjtcfiunpY7s=", + "lastModified": 1678375444, + "narHash": "sha256-XIgHfGvjFvZQ8hrkfocanCDxMefc/77rXeHvYdzBMc8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7f5639fa3b68054ca0b062866dc62b22c3f11505", + "rev": "130fa0baaa2b93ec45523fdcde942f6844ee9f6e", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 5d5ad20..a127e8c 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,6 @@ outputs = { self, nixpkgs-lib, ... }: { lib = import ./lib.nix { inherit (nixpkgs-lib) lib; }; - flakeModules.flakeModules = ./modules/flakeModules.nix; templates = { default = { path = ./template/default; @@ -24,6 +23,7 @@ }; flakeModules = { easyOverlay = ./extras/easyOverlay.nix; + flakeModules = ./extras/flakeModules.nix; }; };