refactor
This commit is contained in:
parent
f52a8f225b
commit
d7ce40ffa7
14 changed files with 38 additions and 30 deletions
18
lib.nix
Normal file
18
lib.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{ lib, ... }:
|
||||
rec {
|
||||
walk-dir =
|
||||
path:
|
||||
let
|
||||
dir = builtins.readDir path;
|
||||
in
|
||||
lib.mapAttrs' (name: value: {
|
||||
name = lib.removeSuffix ".nix" name;
|
||||
value =
|
||||
if value == "regular" then
|
||||
import (path + "/${name}")
|
||||
else if value == "directory" then
|
||||
walk-dir (path + "/${name}")
|
||||
else
|
||||
builtins.throw "Item of type ${value} are unsupported.";
|
||||
}) dir;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue