crea shenvs, añade infrastructura para paquetes
This commit is contained in:
parent
5016c4f3d9
commit
a2209c4f8e
5 changed files with 55 additions and 3 deletions
32
pkgs/default.nix
Normal file
32
pkgs/default.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
pkgs:
|
||||
with pkgs.lib; let
|
||||
inherit (pkgs) buildEnv callPackage writeTextDir;
|
||||
|
||||
importAll = { root, exclude ? [] }:
|
||||
|
||||
# adapted from 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))
|
||||
|
||||
in {
|
||||
shenvs = let
|
||||
build = name: { paths, enter ? null }: buildEnv {
|
||||
name = "shenv-${name}";
|
||||
paths = (optional (enter != null) (writeTextDir "lib/shenv/enter" enter))
|
||||
++ paths;
|
||||
};
|
||||
in mapAttrs (name: shenv: build name (shenv pkgs)) (importAll {
|
||||
root = ../shenvs;
|
||||
exclude = [ "config" ];
|
||||
});
|
||||
}
|
Reference in a new issue