1
0
Fork 0

Move pkgsets folder into project root to conform with option naming.

Add simple package filter to auto remove broken packages.
This commit is contained in:
Kevin Baensch 2020-03-27 13:25:54 +01:00
parent 5242db83e2
commit ad76922338
Signed by: derped
GPG Key ID: C0F1D326C7626543
36 changed files with 18 additions and 5 deletions

13
fn.nix
View File

@ -17,4 +17,17 @@ rec {
lsf = p: (lst { p = p; }); lsf = p: (lst { p = p; });
lsd = p: (lst { p = p; t = "directory"; b = true; }); lsd = p: (lst { p = p; t = "directory"; b = true; });
lsfRec = p: b: flatten ((map (np: lsfRec np b) (lsd p)) ++ (lst { p = p; b = b; })); lsfRec = p: b: flatten ((map (np: lsfRec np b) (lsd p)) ++ (lst { p = p; b = b; }));
hasAttrs = aList: d: (map
(a:
(ifelse (isList a)
(hasAttrByPath a d)
(hasAttr a d)))
aList);
pkgFilter = l: (filter
(p: (
ifelse (elem true (hasAttrs [["meta" "broken"]] p))
(warn "Package ${p.name} is marked as broken." false)
true)
)
l);
} }

View File

@ -7,14 +7,14 @@ let
cfg = config.machine; cfg = config.machine;
fn = import (toString ../fn.nix) { inherit lib; }; fn = import (toString ../fn.nix) { inherit lib; };
metapkgs = let metapkgs = let
pPath = (toString ./../pkgs/pkgsets); pPath = (toString ../pkgsets);
in (lists.forEach (fn.lsfRec pPath true) (v: replaceStrings [ "${pPath}/" "/" ".nix" ] [ "" "::" "" ] v)); in (lists.forEach (fn.lsfRec pPath true) (v: replaceStrings [ "${pPath}/" "/" ".nix" ] [ "" "::" "" ] v));
pkgOption = pname: { pkgOption = pname: {
name = pname; name = pname;
value = rec { value = rec {
pkgwrap = mkOption { pkgwrap = mkOption {
type = with types; oneOf [ package (listOf package) ]; type = with types; oneOf [ package (listOf package) ];
default = cfg.pkgsets."${pname}".pkgs; default = (fn.pkgFilter cfg.pkgsets."${pname}".pkgs);
description = '' description = ''
Package Wrapper for packages using a wrapper function (like python, emacs, haskell, ...) Package Wrapper for packages using a wrapper function (like python, emacs, haskell, ...)
''; '';

View File

@ -5,7 +5,7 @@ with lib;
let let
cfg = config.machine; cfg = config.machine;
fn = import (toString ../fn.nix) { inherit lib; }; fn = import (toString ../fn.nix) { inherit lib; };
pkgsets = map (v: (toString ./.) + "/pkgsets/${v}") (fn.lsf (toString ./pkgsets)); pkgsets = map (v: (toString ../.) + "/pkgsets/${v}") (fn.lsf (toString ../pkgsets));
in { in {
imports = pkgsets; imports = pkgsets;

View File

@ -4,7 +4,7 @@ with lib;
let let
gitpkgs = import /nixpkgs {}; gitpkgs = import /nixpkgs {};
fn = import (toString ../../fn.nix) { inherit lib; }; fn = import (toString ../fn.nix) { inherit lib; };
modefiles = fn.lst { p = (toString ./emacs); b = true; }; modefiles = fn.lst { p = (toString ./emacs); b = true; };
in rec { in rec {
# nixpkgs.overlays = [ # nixpkgs.overlays = [
@ -13,7 +13,7 @@ in rec {
# })) # }))
# ]; # ];
imports = [ imports = [
../../options/emacs-init.nix ../options/emacs-init.nix
] ++ modefiles; ] ++ modefiles;
programs.emacs.init = { programs.emacs.init = {