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

View file

@ -5,7 +5,7 @@ with lib;
let
cfg = config.machine;
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 {
imports = pkgsets;

View file

@ -4,7 +4,7 @@ with lib;
let
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; };
in rec {
# nixpkgs.overlays = [
@ -13,7 +13,7 @@ in rec {
# }))
# ];
imports = [
../../options/emacs-init.nix
../options/emacs-init.nix
] ++ modefiles;
programs.emacs.init = {