From 75a1f846255f55c8c019e2cf3461a557be875c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lina=20Avenda=C3=B1o?= Date: Fri, 11 Nov 2022 18:12:08 -0500 Subject: [PATCH] fix: general pasteuriz instrumentation --- flake.nix | 5 ++++- make-honey.nix | 3 ++- make-mead.nix | 4 ++-- pasteurize.nix | 37 ++++++++++++++----------------------- 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/flake.nix b/flake.nix index ca711ae..0b57219 100644 --- a/flake.nix +++ b/flake.nix @@ -75,7 +75,10 @@ }; } # soil - {packages.x86_64-linux = {inherit (inputs.disko.packages.x86_64-linux) disko;};} + { + packages.x86_64-linux = {inherit (inputs.disko.packages.x86_64-linux) disko;}; + devShells = std.harvest self ["_QUEEN" "devshells"]; + } { # tool: colmena -- "fill the jar on the soil with the honey!" colmenaHive = let diff --git a/make-honey.nix b/make-honey.nix index 35022a5..fe3e846 100644 --- a/make-honey.nix +++ b/make-honey.nix @@ -4,13 +4,14 @@ cellBlock ? "colmenaConfigurations", }: let l = nixpkgs.lib // builtins; - inherit (import ./pasteurize.nix {inherit nixpkgs cellBlock;}) pasteurize stir; + inherit (import ./pasteurize.nix {inherit nixpkgs cellBlock;}) pasteurize stir beeOptions; colmenaModules = [ colmena.nixosModules.assertionModule colmena.nixosModules.keyChownModule colmena.nixosModules.keyServiceModule colmena.nixosModules.deploymentOptions + beeOptions # still present, but we dont care ]; in self: let diff --git a/make-mead.nix b/make-mead.nix index f433d08..4bd8ed3 100644 --- a/make-mead.nix +++ b/make-mead.nix @@ -3,7 +3,7 @@ cellBlock ? "nixosConfigurations", }: let l = nixpkgs.lib // builtins; - inherit (import ./pasteurize.nix {inherit nixpkgs cellBlock;}) pasteurize stir; + inherit (import ./pasteurize.nix {inherit nixpkgs cellBlock;}) pasteurize stir beeOptions; in self: let comb = pasteurize self; @@ -12,7 +12,7 @@ in in evalConfig { inherit system; - modules = [extra config]; + modules = [extra beeOptions config]; }; in l.mapAttrs (evalNode {}) comb diff --git a/pasteurize.nix b/pasteurize.nix index 854cae6..83dc7f0 100644 --- a/pasteurize.nix +++ b/pasteurize.nix @@ -11,8 +11,8 @@ }) .evalModules; - beeOptions = config: { - bee = { + beeOptions = {config, ...}: { + options.bee = { system = l.mkOption { type = l.types.str; description = "divnix/hive requires you to set the host's system via 'config.bee.system = \"x86_64-linux\";'"; @@ -69,21 +69,15 @@ (erase ["nixpkgs" "crossSystem"]) (erase ["nixpkgs" "pkgs"]) ]; - config = { - _module = { - freeformType = l.types.unspecified; - check = true; - }; + config._module = { + freeformType = l.types.unspecified; + check = true; + }; + options._hive_erased = l.mkOption { + type = l.types.listOf l.types.unspecified; + internal = true; + default = []; }; - options = - { - _hive_erased = l.mkOption { - type = l.types.listOf l.types.unspecified; - internal = true; - default = []; - }; - } - // (beeOptions config); }; checkAndTransformConfigFor = user: target: out: config: let @@ -92,7 +86,7 @@ imports = [config]; inherit _file; }; - checked = (evalModulesMinimal {modules = [combCheckModule locatedConfig];}).config; + checked = (evalModulesMinimal {modules = [combCheckModule beeOptions locatedConfig];}).config; asserted = let failedAsserts = map (x: x.message) (l.filter (x: !x.assertion) checked._hive_erased); in @@ -190,13 +184,10 @@ # to happen on the `std` layer useNixpkgsModule = false; }; - evaled = let - # clean up again; was just used to communicate with this shake function - config' = l.removeAttrs config ["bee"]; - in + evaled = # need to use the extended lib lib.evalModules { - modules = [config' extra] ++ hmModules; + modules = [config beeOptions extra] ++ hmModules; specialArgs = { modulesPath = l.toString (config.bee.home + /modules); }; @@ -225,4 +216,4 @@ then evaled else throw "\nFailed assertions:\n${failedStr}" ); -in {inherit pasteurize stir cure shake showAssertions;} +in {inherit pasteurize stir cure shake showAssertions beeOptions;}