Format using nixfmt rfc style
This commit is contained in:
parent
d07a224bbc
commit
f6be5f8b80
37 changed files with 934 additions and 612 deletions
|
|
@ -1,52 +1,62 @@
|
|||
{ self, lib, ... }:
|
||||
|
||||
let
|
||||
inherit (builtins) attrValues readDir pathExists concatLists;
|
||||
inherit (lib) id mapAttrsToList filterAttrs hasPrefix hasSuffix nameValuePair removeSuffix;
|
||||
inherit (builtins)
|
||||
attrValues
|
||||
readDir
|
||||
pathExists
|
||||
concatLists
|
||||
;
|
||||
inherit (lib)
|
||||
id
|
||||
mapAttrsToList
|
||||
filterAttrs
|
||||
hasPrefix
|
||||
hasSuffix
|
||||
nameValuePair
|
||||
removeSuffix
|
||||
;
|
||||
inherit (self.attrs) mapFilterAttrs;
|
||||
in
|
||||
rec {
|
||||
mapModules = dir: fn:
|
||||
mapFilterAttrs
|
||||
(n: v:
|
||||
v != null &&
|
||||
!(hasPrefix "_" n))
|
||||
(n: v:
|
||||
let path = "${toString dir}/${n}"; in
|
||||
if v == "directory" && pathExists "${path}/default.nix"
|
||||
then nameValuePair n (fn path)
|
||||
else if v == "regular" &&
|
||||
n != "default.nix" &&
|
||||
hasSuffix ".nix" n
|
||||
then nameValuePair (removeSuffix ".nix" n) (fn path)
|
||||
else nameValuePair "" null)
|
||||
(readDir dir);
|
||||
mapModules =
|
||||
dir: fn:
|
||||
mapFilterAttrs (n: v: v != null && !(hasPrefix "_" n)) (
|
||||
n: v:
|
||||
let
|
||||
path = "${toString dir}/${n}";
|
||||
in
|
||||
if v == "directory" && pathExists "${path}/default.nix" then
|
||||
nameValuePair n (fn path)
|
||||
else if v == "regular" && n != "default.nix" && hasSuffix ".nix" n then
|
||||
nameValuePair (removeSuffix ".nix" n) (fn path)
|
||||
else
|
||||
nameValuePair "" null
|
||||
) (readDir dir);
|
||||
|
||||
mapModules' = dir: fn:
|
||||
attrValues (mapModules dir fn);
|
||||
mapModules' = dir: fn: attrValues (mapModules dir fn);
|
||||
|
||||
mapModulesRec = dir: fn:
|
||||
mapFilterAttrs
|
||||
(n: v:
|
||||
v != null &&
|
||||
!(hasPrefix "_" n))
|
||||
(n: v:
|
||||
let path = "${toString dir}/${n}"; in
|
||||
if v == "directory"
|
||||
then nameValuePair n (mapModulesRec path fn)
|
||||
else if v == "regular" && n != "default.nix" && hasSuffix ".nix" n
|
||||
then nameValuePair (removeSuffix ".nix" n) (fn path)
|
||||
else nameValuePair "" null)
|
||||
(readDir dir);
|
||||
mapModulesRec =
|
||||
dir: fn:
|
||||
mapFilterAttrs (n: v: v != null && !(hasPrefix "_" n)) (
|
||||
n: v:
|
||||
let
|
||||
path = "${toString dir}/${n}";
|
||||
in
|
||||
if v == "directory" then
|
||||
nameValuePair n (mapModulesRec path fn)
|
||||
else if v == "regular" && n != "default.nix" && hasSuffix ".nix" n then
|
||||
nameValuePair (removeSuffix ".nix" n) (fn path)
|
||||
else
|
||||
nameValuePair "" null
|
||||
) (readDir dir);
|
||||
|
||||
mapModulesRec' = dir: fn:
|
||||
mapModulesRec' =
|
||||
dir: fn:
|
||||
let
|
||||
dirs =
|
||||
mapAttrsToList
|
||||
(k: _: "${dir}/${k}")
|
||||
(filterAttrs
|
||||
(n: v: v == "directory" && !(hasPrefix "_" n))
|
||||
(readDir dir));
|
||||
dirs = mapAttrsToList (k: _: "${dir}/${k}") (
|
||||
filterAttrs (n: v: v == "directory" && !(hasPrefix "_" n)) (readDir dir)
|
||||
);
|
||||
files = attrValues (mapModules dir id);
|
||||
paths = files ++ concatLists (map (d: mapModulesRec' d id) dirs);
|
||||
in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue