Nix activation script
let | |
pkgs = import <nixpkgs> {}; | |
lib = pkgs.lib; | |
addAttributeName = with lib; mapAttrs (a: v: v // { | |
text = '' | |
${v.text} | |
''; | |
}); | |
in | |
with lib; | |
(evalModules { | |
modules = [ | |
{ | |
options.aS = mkOption { | |
default = {}; | |
type = types.attrsOf types.unspecified; | |
apply = set: { | |
script = | |
'' | |
${ | |
let | |
set' = mapAttrs (n: v: if isString v then noDepEntry v else v) set; | |
withHeadlines = addAttributeName set'; | |
in textClosureMap id (withHeadlines) (attrNames withHeadlines) | |
} | |
''; | |
}; | |
}; | |
} | |
# when this is before instead of after, it works | |
# { | |
# aS.c = "c"; | |
# aS.a.deps = [ "c" ]; | |
# } | |
{ | |
aS.a = stringAfter ["b"] "a"; | |
aS.b = "b"; | |
} | |
{ | |
aS.c = "c"; | |
aS.a.deps = mkOverride 0 [ "c" ]; | |
} | |
]; | |
}).config.aS.script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment