mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 15:11:34 +01:00
Use the pipe operator when applicable
This commit is contained in:
parent
61083d4359
commit
cd4e3ab2c1
2 changed files with 17 additions and 12 deletions
|
|
@ -5,19 +5,24 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
mkHost = hostname: {
|
mkHost = hostName: {
|
||||||
${hostname} = inputs.nixpkgs.lib.nixosSystem {
|
${hostName} = inputs.nixpkgs.lib.nixosSystem {
|
||||||
specialArgs = { inherit inputs self; };
|
specialArgs = { inherit inputs self; };
|
||||||
modules =
|
modules =
|
||||||
[
|
let
|
||||||
{ networking.hostName = hostname; }
|
userFiles =
|
||||||
"${self}/hosts/${hostname}"
|
"${self}/users"
|
||||||
]
|
|> builtins.readDir
|
||||||
++ builtins.filter (path: builtins.pathExists path) (
|
|> lib.filterAttrs (_: type: type == "directory")
|
||||||
map (user: "${self}/users/${user}/@${hostname}") (
|
|> builtins.attrNames
|
||||||
builtins.attrNames (lib.filterAttrs (_: v: v == "directory") (builtins.readDir "${self}/users"))
|
|> map (user: "${self}/users/${user}/@${hostName}")
|
||||||
)
|
|> builtins.filter (path: builtins.pathExists path);
|
||||||
);
|
in
|
||||||
|
lib.flatten [
|
||||||
|
{ networking = { inherit hostName; }; }
|
||||||
|
"${self}/hosts/${hostName}"
|
||||||
|
userFiles
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{ self, lib, ... }:
|
{ self, lib, ... }:
|
||||||
let
|
let
|
||||||
modulesOf = dir: builtins.filter (lib.hasSuffix ".nix") (lib.filesystem.listFilesRecursive dir);
|
modulesOf = dir: dir |> lib.filesystem.listFilesRecursive |> builtins.filter (lib.hasSuffix ".nix");
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake = {
|
flake = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue