Skip to content

Commit

Permalink
init with minimal exporting & inputs extending api
Browse files Browse the repository at this point in the history
  • Loading branch information
Pacman99 committed Dec 24, 2022
0 parents commit 4649807
Show file tree
Hide file tree
Showing 3 changed files with 406 additions and 0 deletions.
22 changes: 22 additions & 0 deletions de-systemize.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
let
l = builtins;
/*
A helper function which hides the complexities of dealing
with 'system' properly from you, while still providing
escape hatches when dealing with cross-compilation.
You can use this function independently of the rest of std.
*/
deSystemize = let
iteration = cutoff: system: fragment:
if ! (l.isAttrs fragment) || cutoff == 0
then fragment
else if l.hasAttr "${system}" fragment && ! l.isFunction fragment.${system}
then fragment // fragment.${system}
else if l.hasAttr "${system}" fragment && l.isFunction fragment.${system}
then fragment // {__functor = _: fragment.${system};}
else l.mapAttrs (_: iteration (cutoff - 1) system) fragment;
in
iteration 3;
in
deSystemize
144 changes: 144 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4649807

Please sign in to comment.