Skip to content

Commit

Permalink
fix: general pasteuriz instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
lina2358 committed Nov 11, 2022
1 parent 145a37b commit 75a1f84
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 27 deletions.
5 changes: 4 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion make-honey.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions make-mead.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -12,7 +12,7 @@ in
in
evalConfig {
inherit system;
modules = [extra config];
modules = [extra beeOptions config];
};
in
l.mapAttrs (evalNode {}) comb
37 changes: 14 additions & 23 deletions pasteurize.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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\";'";
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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);
};
Expand Down Expand Up @@ -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;}

0 comments on commit 75a1f84

Please sign in to comment.