Last active
May 19, 2018 21:55
-
-
Save ryantm/076e45eff4ff89756a7b8e63a78c26fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
pkgs = import <nixpkgs> {}; | |
pname = a: (builtins.parseDrvName pkgs."${a}".name).name; | |
versionParts = a: | |
builtins.splitVersion (builtins.parseDrvName pkgs."${a}".name).version; | |
separator = "_"; | |
path = n : v: | |
if v == [] | |
then n | |
else "${n}${separator}${builtins.concatStringsSep "_" v}"; | |
versions = versionParts: | |
if builtins.length versionParts == 0 | |
then [[]] | |
else | |
[[]] ++ | |
(builtins.map | |
(rest: [(builtins.elemAt versionParts 0)] ++ rest) | |
(versions (builtins.tail versionParts))); | |
validPaths = a: | |
builtins.concatStringsSep " or " | |
(builtins.map | |
(vs: path (pname a) vs) | |
(versions (versionParts a))); | |
policy = a: "${a} | ${validPaths a} "; | |
attrpaths = [ | |
#"qt56" | |
"autoconf213" | |
"automake111x" | |
"libgit2_0_25" | |
"apacheKafka_0_10" | |
"dbus-sharp-glib-2_0" | |
"antlr3_5" | |
"bison3" | |
"automoc4" | |
"fplll_20160331" | |
"owncloud-client" | |
"libavc1394" | |
"icu58" | |
]; | |
in | |
{ | |
result = | |
builtins.concatStringsSep "\n" (builtins.map policy attrpaths) | |
+ "\n"; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nix eval --raw -f policy.nix result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment