forked from fabian/nix_config
apply format
This commit is contained in:
parent
34e3cdaf81
commit
3044c426fd
7 changed files with 1442 additions and 90 deletions
3
pkgs/lib/default.nix
Normal file
3
pkgs/lib/default.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{callPackage}: {
|
||||
importAll = callPackage ./importAll.nix {};
|
||||
}
|
20
pkgs/lib/importAll.nix
Normal file
20
pkgs/lib/importAll.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{lib}: {
|
||||
root,
|
||||
exclude ? [],
|
||||
}:
|
||||
with builtins;
|
||||
with lib;
|
||||
# http://chriswarbo.net/projects/nixos/useful_hacks.html
|
||||
let
|
||||
basename = removeSuffix ".nix";
|
||||
|
||||
isMatch = name: type:
|
||||
(hasSuffix ".nix" name || type == "directory")
|
||||
&& ! elem name (map basename exclude);
|
||||
|
||||
entry = name: _: {
|
||||
name = basename name;
|
||||
value = import (root + "/${name}");
|
||||
};
|
||||
in
|
||||
mapAttrs' entry (filterAttrs isMatch (readDir root))
|
Loading…
Add table
Add a link
Reference in a new issue