Skip to content

Commit

Permalink
Cleanup dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
David Arnold committed Oct 2, 2020
1 parent c048d63 commit 1218190
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions data/eval-machines.nix
Original file line number Diff line number Diff line change
Expand Up @@ -108,32 +108,4 @@ rec {
'') nodes')}
'');

# Function needed to calculate the nixops arguments. This should work even when arguments
# are not set yet, so we fake arguments to be able to evaluate the require attribute of
# the nixops network expressions.

dummyArgs = f: builtins.listToAttrs (map (a: lib.nameValuePair a false) (builtins.attrNames (builtins.functionArgs f)));

getNixOpsExprs = l: lib.unique (lib.flatten (map getRequires l));

getRequires = f:
let
nixopsExpr = import f;
requires =
if builtins.isFunction nixopsExpr then
((nixopsExpr (dummyArgs nixopsExpr)).require or [])
else
(nixopsExpr.require or []);
in
[ f ] ++ map getRequires requires;

fileToArgs = f:
let
nixopsExpr = import f;
in
if builtins.isFunction nixopsExpr then
map (a: { "${a}" = builtins.toString f; } ) (builtins.attrNames (builtins.functionArgs nixopsExpr))
else [];

getNixOpsArgs = fs: lib.zipAttrs (lib.unique (lib.concatMap fileToArgs (getNixOpsExprs fs)));
}

0 comments on commit 1218190

Please sign in to comment.