new flake

This commit is contained in:
2023-12-01 22:42:33 +00:00
parent 5d7b023166
commit 8c0f9076d8
25 changed files with 593 additions and 1254 deletions

19
modules/nixos/default.nix Normal file
View File

@@ -0,0 +1,19 @@
{lib, ...}:
with lib; let
# Recursively constructs an attrset of a given folder, recursing on directories, value of attrs is the filetype
getDir = dir:
mapAttrs (
file: type:
if type == "directory"
then getDir "${dir}/${file}"
else type
) (builtins.readDir dir);
# Collects all files of a directory as a list of strings of paths
files = dir: collect isString (mapAttrsRecursive (path: type: concatStringsSep "/" path) (getDir dir));
# Filters out directories that don't end with .nix or are this file, also makes the strings absolute
validFiles = dir: map (file: ./. + "/${file}") (filter (file: hasSuffix ".nix" file && file != "default.nix" && ! lib.hasPrefix "x/taffybar/" file) (files dir));
in {
imports = validFiles ./.;
}