diff --git a/impure.nix b/impure.nix index d719f8ac7..e45d9f74d 100644 --- a/impure.nix +++ b/impure.nix @@ -49,7 +49,7 @@ let "${args.name}-min-staging" = mkFlavoredHost (args // { variant = "min"; branch = "staging-staging"; }); }; - hosts = lib.foldl' (acc: host: acc // (mkHost host)) {} [ + hosts = lib.foldl' (acc: host: acc // mkHost host) {} [ { name = "crappy"; system = "armv7l-linux"; } { name = "desko"; system = "x86_64-linux"; } { name = "lappy"; system = "x86_64-linux"; } @@ -57,6 +57,31 @@ let { name = "rescue"; system = "x86_64-linux"; } { name = "servo"; system = "x86_64-linux"; } ]; + + subAttrs = attrs: lib.filterAttrs (name: value: builtins.isAttrs value) attrs; + subAttrNames = attrs: builtins.attrNames (subAttrs attrs); + + # given the path to a package, and that package, returns a list of all attr-paths (stringified) + # which should be updated as part of that package (including the package in question). + mkUpdateList = prefix: pkg: (lib.optionals (pkg ? updateScript) [ prefix ]) ++ + lib.foldl' + (acc: nestedName: acc ++ mkUpdateListIfAuto "${prefix}.${nestedName}" pkg."${nestedName}") + [] + (lib.optionals (pkg.recurseForDerivations or false) (subAttrNames pkg)) + ; + # a package can set `passthru.updateWithSuper = false;` if it doesn't want to be auto-updated. + mkUpdateListIfAuto = prefix: pkg: lib.optionals (pkg.updateWithSuper or true) (mkUpdateList prefix pkg); + + mkUpdateTargets = prefix: pkg: let + updateList = mkUpdateList prefix pkg; + in lib.optionalAttrs (updateList != []) { + "${prefix}" = mkUpdateList prefix pkg; + } // lib.foldl' + (acc: subPkgName: acc // mkUpdateTargets "${prefix}.${subPkgName}" pkg."${subPkgName}") + {} + (if pkg.recurseForDerivations or false then subAttrNames pkg else []) + ; in { inherit hosts; -} // (mkPkgs {}) + updateTargets = mkUpdateTargets "sane" (mkPkgs {}).sane; +} // mkPkgs {} diff --git a/pkgs/additional/sofacoustics/default.nix b/pkgs/additional/sofacoustics/default.nix index d5a7d3b68..5d1bcc418 100644 --- a/pkgs/additional/sofacoustics/default.nix +++ b/pkgs/additional/sofacoustics/default.nix @@ -8,6 +8,8 @@ symlinkJoin, }: lib.makeScope newScope (self: with self; { + updateWithSuper = false; #< don't update datasets unless user explicitly asks for that, because there are *so many*, and unchanging + downloadSofacoustics = prefix: database: name: hash: stdenvNoCC.mkDerivation (finalAttrs: { name = "${database}-${name}"; src = fetchurl { @@ -41,6 +43,7 @@ lib.makeScope newScope (self: with self; { # - anthropometrics: # "hrtf, dtf: HRTFs and DTFs, respectively, equalized between 300 Hz and 18 kHz" # "hrtf b/c/d, dtf b/c/d: HRTFs and DTFs, equalized between 50 Hz and 18 kHz for hi-fi auralizations ("b" vs. "c" and "d" differ each other in their starting positions and the order of measurement positions: b: 0°→0°, c/d: 270°→270°; subject being rotated clockwise ↻; "c" measurements were recorded until 2023 in the ARI lab in Wohllebengasse, "d" measuremens are recorded in the new ARI lab in Postsparkasse since 2024)." + b_nh2 = "sha256-+4EDf8Mn/RRUzuXaqj3bjKgIQGNFx1Pkxr8X211TzfM="; b_nh4 = "sha256-OtBsa5OWymBOlfqYM8oKkm9CeCO/1rWgmEX0H3T+zUM="; b_nh5 = "sha256-M+9YHle9vZgZSeLn+77w1bRDF8eQZ/N4kZhYPsJin0E="; @@ -237,6 +240,7 @@ lib.makeScope newScope (self: with self; { # created by: # (python) for i in range(1002, 1060): print(f'irc_{i} = "sha256-irc_{i}";') # (sh) ./scripts/update sofacoustics.listen + irc_1002 = "sha256-w+qp4F6fsg5ZGrR3nG+GWKa8tvDK/Rp9Ke8CTN4yJkY="; irc_1003 = "sha256-BjjOPHTud5pkv9Q1wPS4Ns2mVeul1Ub54BwHxfa+5/U="; irc_1004 = "sha256-wJ5udlnACbDvz3+KP2UP+hta+2b9p/NxSfihnq97EMA="; @@ -317,6 +321,7 @@ lib.makeScope newScope (self: with self; { # # not present here: ICO2m_*, UV02m_*, UV05m_*, UV1m_*, UV2m_*. # - i don't understand the difference between those variants -- i think it's about numerical precision (so UV02m would be the best?) + ICO1m_00001 = "sha256-OQRaNbvmj1Wctp0Md+pYDp8OdyVjf8/bLToXH+6mtsQ="; ICO1m_00002 = "sha256-3eooXmbggF1NB4J6xH17J2j/3IFwunpP/5+7oMyJaZw="; ICO1m_00003 = "sha256-Q03qYa7mHM63lAYh7VLQPiMwMnW681KDUr+oxrprILY="; diff --git a/scripts/update b/scripts/update index 72e735b57..3326e9631 100755 --- a/scripts/update +++ b/scripts/update @@ -52,8 +52,8 @@ getPkgs() { debug "creating requisite .drv store paths" nix-instantiate -A nix "$NIX_FILES_TOP" nix-instantiate -A nixpkgs "$NIX_FILES_TOP" - debug "querying attributes which match '$attrPrefix'" - local attrs=$(nix-env -f "$NIX_FILES_TOP" --query --available --attr-path --no-name -A "$attrPrefix" --show-trace) + debug "querying packages to update as part of '$attrPrefix'" + local attrs=$(nix eval --raw -f "$NIX_FILES_TOP" updateTargets."$attrPrefix" --apply 'builtins.concatStringsSep " "') debug "got: $attrs" attrsArr+=($attrs) } @@ -66,7 +66,7 @@ updateOnePkg() { return fi - local updateScript=$(nix eval --raw -f "$NIX_FILES_TOP" $attrPath.passthru.updateScript --apply 'builtins.concatStringsSep "'" "'"') + local updateScript=$(nix eval --raw -f "$NIX_FILES_TOP" $attrPath.passthru.updateScript --apply 'builtins.concatStringsSep " "') if [ -z "$updateScript" ]; then warn "don't know how to update '$attrPath'" return