git.delta.rocks / jrsonnet / refs/commits / f8886e1c85c3

difftreelog

feat set modulesPath specialArg

ypstxxyqYaroslav Bolyukin2026-01-22parent: #5973a7a.patch.diff
in: trunk

2 files changed

modifiedlib/flakePart.nixdiffbeforeafterboth
33 # To use user-provided nixpkgs, we first need to extract wanted nixpkgs attribute,33 # To use user-provided nixpkgs, we first need to extract wanted nixpkgs attribute,
34 # to do that, evaluate all the modules with only needed option declared.34 # to do that, evaluate all the modules with only needed option declared.
35 bootstrapEval = lib.evalModules {35 bootstrapEval = lib.evalModules {
36 class = "fleet";
37 prefix = ["fleetConfiguration"];
36 modules = [38 modules = [
37 module39 module
38 {40 {
50 };52 };
51 bootstrapNixpkgs = bootstrapEval.config.nixpkgs.buildUsing;53 bootstrapNixpkgs = bootstrapEval.config.nixpkgs.buildUsing;
52 normalEval = bootstrapNixpkgs.lib.evalModules {54 normalEval = bootstrapNixpkgs.lib.evalModules {
55 class = "fleet";
56 prefix = ["fleetConfiguration"];
53 modules = (import ../modules/module-list.nix) ++ [57 modules = (import ../modules/module-list.nix) ++ [
54 module58 module
55 (59 (
modifiedmodules/nixos.nixdiffbeforeafterboth
37 module:37 module:
38 let38 let
39 inherit (hostArgs.config) system;39 inherit (hostArgs.config) system;
40 modulesPath = "${config.nixpkgs.buildUsing}/nixos/modules";
40 in41 in
41 config.nixpkgs.buildUsing.lib.evalModules {42 config.nixpkgs.buildUsing.lib.evalModules {
43 class = "nixos";
44 prefix = ["fleetConfiguration" "hosts" hostArgs.config._module.args.name "nixos"];
42 modules = (import "${config.nixpkgs.buildUsing}/nixos/modules/module-list.nix") ++ [45 modules = (import "${modulesPath}/module-list.nix") ++ [
43 (module // { key = "attr<host.nixos>"; })46 (module // { key = "attr<host.nixos>"; })
44 (config.nixos // { key = "attr<fleet.nixos>"; })47 (config.nixos // { key = "attr<fleet.nixos>"; })
45 ];48 ];
46 specialArgs = {49 specialArgs = {
47 inherit fleetLib inputs self;50 inherit fleetLib inputs self modulesPath;
48 inputs' = mapAttrs (51 inputs' = mapAttrs (
49 inputName: input:52 inputName: input:
50 builtins.addErrorContext53 builtins.addErrorContext
56 "input is not a flake, perhaps flake = false was added to te input declaration?"59 "input is not a flake, perhaps flake = false was added to te input declaration?"
57 )60 )
58 ) inputs;61 ) inputs;
62 self' = builtins.addErrorContext "while retrieving system-dependent attributes for a flake's own outputs" (
63 _fleetFlakeRootConfig.perInput system self
64 );
59 };65 };
60 };66 };
61 };67 };
68 # (mkRemovedOptionModule ["nixosModules"] "replaced with hosts.*.nixos.imports.")74 # (mkRemovedOptionModule ["nixosModules"] "replaced with hosts.*.nixos.imports.")
69 # ];75 # ];
70 nixos = {76 nixos = {
71 config._module.args = {77 _module.args = {
72 nixosHosts = mapAttrs (_: value: value.nixos_unchecked.config) config.hosts;78 nixosHosts = mapAttrs (_: value: value.nixos_unchecked.config) config.hosts;
73 hosts = config.hosts;79 hosts = config.hosts;
74 host = hostArgs.config;80 host = hostArgs.config;