reo101
df9ce2d4e2
Update flake (`neovim-nightly-overlay` is fixed) Format all `.nix` files Unify package/module argument order: - `inputs`, `outputs`, `lib`, `pkgs`, `config`, ... Move Jellyfin config to a `NixOS` module (first one, yay) Add `direnv` to `reo101-shell` modules (was used, but not defined as wanted) - TODO: make it optional (module config options)
36 lines
771 B
Nix
36 lines
771 B
Nix
{ 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);
|
|
}
|