Created
October 27, 2025 08:40
-
-
Save Pandapip1/e63393311646a837393fb613b63ece3f to your computer and use it in GitHub Desktop.
Check bootstrap
This file contains hidden or 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
| { pkgs }: | |
| let | |
| # Recursively collect derivations safely, skipping anything that throws | |
| collectDerivationsSafe = root: | |
| let | |
| processQueue = values: seen: | |
| if values == [] then [] else | |
| let | |
| head = builtins.head values; | |
| tail = builtins.tail values; | |
| res = builtins.tryEval head; | |
| val = if res.success then res.value else null; | |
| key = builtins.toString head; | |
| alreadySeen = builtins.elem key seen; | |
| nextSeen = if alreadySeen then seen else seen ++ [key]; | |
| # flatten derivations / attr sets / lists safely | |
| nextValues = | |
| if alreadySeen || val == null then [] | |
| else if pkgs.lib.isDerivation val then [ val ] | |
| else if builtins.isAttrs val then | |
| builtins.concatLists ( | |
| builtins.map (v: | |
| let r = builtins.tryEval v; in | |
| if r.success then [ r.value ] else [] | |
| ) (builtins.attrValues val) | |
| ) | |
| else if builtins.isList val then | |
| builtins.concatLists ( | |
| builtins.map (v: | |
| let r = builtins.tryEval v; in | |
| if r.success then [ r.value ] else [] | |
| ) val | |
| ) | |
| else []; | |
| in | |
| nextValues ++ processQueue tail nextSeen; | |
| in | |
| processQueue [root] []; | |
| allDerivations = collectDerivationsSafe pkgs; | |
| # Check if a derivation is binaryNativeCode | |
| isBinaryNative = drv: | |
| if !pkgs.lib.isDerivation drv then false | |
| else let | |
| sp = ((drv.meta or {}).sourceProvenance or []); | |
| spList = if builtins.isList sp then sp else [ sp ]; | |
| in | |
| builtins.elem pkgs.lib.sourceTypes.binaryNativeCode spList; | |
| # Filter derivations: binaryNativeCode and free | |
| filtered = builtins.filter (drv: | |
| drv != null && | |
| pkgs.lib.isDerivation drv && | |
| isBinaryNative drv && | |
| ( | |
| let license = (drv.meta or {}).license or null; in | |
| license == null || (license.free or true) | |
| ) | |
| ) allDerivations; | |
| in | |
| builtins.map (drv: drv.outPath) filtered |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment