Lebesque Configuration.

This commit is contained in:
Lorenzo Good 2025-02-03 13:00:31 -06:00
parent b2595f1936
commit 859556d0e6
Signed by: lorenzo
GPG key ID: 7FCD64BD81180ED0
18 changed files with 386 additions and 50 deletions

View file

@ -1,6 +1,6 @@
rec {
findNixFiles = dir: let
inherit (builtins) attrNames readDir pathExists concatMap hasSuffix;
inherit (builtins) attrNames readDir pathExists concatMap;
# Helper function to build full paths
fullPath = name: dir + "/${name}";
@ -16,11 +16,32 @@ rec {
path = fullPath name;
type = contents.${name};
in
if type == "regular" && hasSuffix ".nix" name
if type == "regular" && hasSuffix "nix" name
then [path]
else if type == "directory" && pathExists path
then findNixFiles path
else [];
in
concatMap processItem names;
getName = filename: let
parts = builtins.split "\\." filename;
base = builtins.head (builtins.split "\\." filename);
in
if builtins.length parts == 1
then filename
else base;
getSuffix = filename: let
parts = builtins.split "\\." filename;
end = builtins.tail (builtins.split "\\." filename);
in
if builtins.length parts == 1
then filename
else builtins.elemAt end (builtins.length end - 1);
hasSuffix = suffix: filename:
if (getSuffix filename) == suffix
then true
else false;
}