feat!(flake): convert to fs-defined configurations
Place all configurations in `machines/${manager}/${system}/${hostname}/...`: - `${manager}` - One of `nixos`, `nix-on-droid`, `nix-darwin` or `home-manager` - `${system}` - A system's architecture (can be many) - `${hostname}` - A system's hostname (can be many) The flake now automatically generates the needed configurations based on the above structure. It only generates configurations for valid directory structures: - It wouldn't generate a NixOS config if there isn't a `configuration.nix` file - ...
This commit is contained in:
parent
b0110b3e64
commit
dd2391d905
9 changed files with 176 additions and 66 deletions
36
lib/default.nix
Normal file
36
lib/default.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{ lib, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mapAttrs;
|
||||
inherit (lib.attrsets) filterAttrs;
|
||||
in
|
||||
rec {
|
||||
recurseDir = dir:
|
||||
mapAttrs
|
||||
(file: type:
|
||||
if type == "directory"
|
||||
then recurseDir "${dir}/${file}"
|
||||
else type
|
||||
)
|
||||
(builtins.readDir dir);
|
||||
|
||||
# VVV - Implying `attrs` is the output of `recurseDir` - VVV
|
||||
|
||||
hasFiles = files: attrs:
|
||||
builtins.all
|
||||
(b: b)
|
||||
(builtins.map
|
||||
(file:
|
||||
builtins.hasAttr file attrs &&
|
||||
builtins.getAttr file attrs == "regular")
|
||||
files);
|
||||
|
||||
hasDirectories = directories: attrs:
|
||||
builtins.all
|
||||
(b: b)
|
||||
(builtins.map
|
||||
(directory:
|
||||
builtins.hasAttr directory attrs &&
|
||||
builtins.getAttr directory attrs == "set")
|
||||
directories);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue