mirror of
https://github.com/Gerg-L/nixos.git
synced 2025-12-10 08:53:56 -05:00
fix _file in /hosts
This commit is contained in:
parent
dd08a1d70d
commit
66b902c1f5
1 changed files with 9 additions and 7 deletions
|
|
@ -32,7 +32,13 @@ rec {
|
||||||
path:
|
path:
|
||||||
builtins.filter (lib.hasSuffix ".nix") (map toString (lib.filesystem.listFilesRecursive path));
|
builtins.filter (lib.hasSuffix ".nix") (map toString (lib.filesystem.listFilesRecursive path));
|
||||||
|
|
||||||
importAll = path: map (module: (import module inputs)) (listNixFilesRecursive path);
|
fixModuleSystem =
|
||||||
|
file:
|
||||||
|
lib.pipe file [
|
||||||
|
builtins.readFile
|
||||||
|
(builtins.replaceStrings (lib.singleton "#_file") (lib.singleton ''_file = "${file}";''))
|
||||||
|
(builtins.toFile (builtins.baseNameOf file))
|
||||||
|
];
|
||||||
|
|
||||||
mkModules =
|
mkModules =
|
||||||
path:
|
path:
|
||||||
|
|
@ -43,11 +49,7 @@ rec {
|
||||||
(lib.removeSuffix ".nix")
|
(lib.removeSuffix ".nix")
|
||||||
(lib.removePrefix "${toString path}/")
|
(lib.removePrefix "${toString path}/")
|
||||||
];
|
];
|
||||||
value = lib.pipe name [
|
value = fixModuleSystem name;
|
||||||
builtins.readFile
|
|
||||||
(builtins.replaceStrings (lib.singleton "#_file") (lib.singleton ''_file = "${name}";''))
|
|
||||||
(builtins.toFile (builtins.baseNameOf path))
|
|
||||||
];
|
|
||||||
}) (listNixFilesRecursive path)
|
}) (listNixFilesRecursive path)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -81,7 +83,7 @@ rec {
|
||||||
in
|
in
|
||||||
builtins.concatLists [
|
builtins.concatLists [
|
||||||
(importWithInputs' (builtins.attrValues self.nixosModules))
|
(importWithInputs' (builtins.attrValues self.nixosModules))
|
||||||
(importWithInputs' (listNixFilesRecursive "${self}/hosts/${name}"))
|
(importWithInputs' (map fixModuleSystem (listNixFilesRecursive (../. + "/hosts/${name}"))))
|
||||||
(import "${unstable}/nixos/modules/module-list.nix")
|
(import "${unstable}/nixos/modules/module-list.nix")
|
||||||
(lib.singleton {
|
(lib.singleton {
|
||||||
networking.hostName = name;
|
networking.hostName = name;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue