lol

various: move license check "behind" meta.unfree eval (#426642)

authored by

Wolfgang Walther and committed by
GitHub
186da0c5 066da58d

+93 -84
+56 -55
pkgs/applications/science/machine-learning/sc2-headless/default.nix
··· 8 8 licenseAccepted ? config.sc2-headless.accept_license or false, 9 9 }: 10 10 11 - if !licenseAccepted then 12 - throw '' 13 - You must accept the Blizzard® Starcraft® II AI and Machine Learning License at 14 - https://blzdistsc2-a.akamaihd.net/AI_AND_MACHINE_LEARNING_LICENSE.html 15 - by setting nixpkgs config option 'sc2-headless.accept_license = true;' 16 - '' 17 - else 18 - assert licenseAccepted; 19 - let 20 - maps = callPackage ./maps.nix { }; 21 - in 22 - stdenv.mkDerivation rec { 23 - version = "4.7.1"; 24 - pname = "sc2-headless"; 11 + let 12 + maps = callPackage ./maps.nix { inherit licenseAccepted; }; 13 + in 14 + stdenv.mkDerivation rec { 15 + version = "4.7.1"; 16 + pname = "sc2-headless"; 25 17 26 - src = fetchurl { 27 - url = "https://blzdistsc2-a.akamaihd.net/Linux/SC2.${version}.zip"; 28 - sha256 = "0q1ry9bd3dm8y4hvh57yfq7s05hl2k2sxi2wsl6h0r3w690v1kdd"; 29 - }; 18 + src = fetchurl { 19 + url = "https://blzdistsc2-a.akamaihd.net/Linux/SC2.${version}.zip"; 20 + sha256 = "0q1ry9bd3dm8y4hvh57yfq7s05hl2k2sxi2wsl6h0r3w690v1kdd"; 21 + }; 30 22 31 - unpackCmd = '' 32 - unzip -P 'iagreetotheeula' $curSrc 33 - ''; 23 + unpackCmd = 24 + if !licenseAccepted then 25 + throw '' 26 + You must accept the Blizzard® Starcraft® II AI and Machine Learning License at 27 + https://blzdistsc2-a.akamaihd.net/AI_AND_MACHINE_LEARNING_LICENSE.html 28 + by setting nixpkgs config option 'sc2-headless.accept_license = true;' 29 + '' 30 + else 31 + assert licenseAccepted; 32 + '' 33 + unzip -P 'iagreetotheeula' $curSrc 34 + ''; 34 35 35 - nativeBuildInputs = [ unzip ]; 36 + nativeBuildInputs = [ unzip ]; 36 37 37 - installPhase = '' 38 - mkdir -p $out 39 - cp -r . "$out" 40 - rm -r $out/Libs 38 + installPhase = '' 39 + mkdir -p $out 40 + cp -r . "$out" 41 + rm -r $out/Libs 41 42 42 - cp -ur "${maps.minigames}"/* "${maps.melee}"/* "${maps.ladder2017season1}"/* "${maps.ladder2017season2}"/* "${maps.ladder2017season3}"/* \ 43 - "${maps.ladder2017season4}"/* "${maps.ladder2018season1}"/* "${maps.ladder2018season2}"/* \ 44 - "${maps.ladder2018season3}"/* "${maps.ladder2018season4}"/* "${maps.ladder2019season1}"/* "$out"/Maps/ 45 - ''; 43 + cp -ur "${maps.minigames}"/* "${maps.melee}"/* "${maps.ladder2017season1}"/* "${maps.ladder2017season2}"/* "${maps.ladder2017season3}"/* \ 44 + "${maps.ladder2017season4}"/* "${maps.ladder2018season1}"/* "${maps.ladder2018season2}"/* \ 45 + "${maps.ladder2018season3}"/* "${maps.ladder2018season4}"/* "${maps.ladder2019season1}"/* "$out"/Maps/ 46 + ''; 46 47 47 - preFixup = '' 48 - find $out -type f -print0 | while IFS=''' read -d ''' -r file; do 49 - isELF "$file" || continue 50 - patchelf \ 51 - --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ 52 - --set-rpath ${ 53 - lib.makeLibraryPath [ 54 - stdenv.cc.cc 55 - stdenv.cc.libc 56 - ] 57 - } \ 58 - "$file" 59 - done 60 - ''; 48 + preFixup = '' 49 + find $out -type f -print0 | while IFS=''' read -d ''' -r file; do 50 + isELF "$file" || continue 51 + patchelf \ 52 + --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ 53 + --set-rpath ${ 54 + lib.makeLibraryPath [ 55 + stdenv.cc.cc 56 + stdenv.cc.libc 57 + ] 58 + } \ 59 + "$file" 60 + done 61 + ''; 61 62 62 - meta = { 63 - platforms = lib.platforms.linux; 64 - description = "Starcraft II headless linux client for machine learning research"; 65 - sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 66 - license = { 67 - fullName = "BLIZZARD® STARCRAFT® II AI AND MACHINE LEARNING LICENSE"; 68 - url = "https://blzdistsc2-a.akamaihd.net/AI_AND_MACHINE_LEARNING_LICENSE.html"; 69 - free = false; 70 - }; 71 - maintainers = [ ]; 63 + meta = { 64 + platforms = lib.platforms.linux; 65 + description = "Starcraft II headless linux client for machine learning research"; 66 + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 67 + license = { 68 + fullName = "BLIZZARD® STARCRAFT® II AI AND MACHINE LEARNING LICENSE"; 69 + url = "https://blzdistsc2-a.akamaihd.net/AI_AND_MACHINE_LEARNING_LICENSE.html"; 70 + free = false; 72 71 }; 73 - } 72 + maintainers = [ ]; 73 + }; 74 + }
+13 -4
pkgs/applications/science/machine-learning/sc2-headless/maps.nix
··· 1 1 { 2 2 fetchzip, 3 + licenseAccepted, 3 4 }: 4 5 let 5 6 fetchzip' = 6 - args: 7 - (fetchzip args).overrideAttrs (old: { 8 - UNZIP = "-j -P iagreetotheeula"; 9 - }); 7 + if !licenseAccepted then 8 + throw '' 9 + You must accept the Blizzard® Starcraft® II AI and Machine Learning License at 10 + https://blzdistsc2-a.akamaihd.net/AI_AND_MACHINE_LEARNING_LICENSE.html 11 + by setting nixpkgs config option 'sc2-headless.accept_license = true;' 12 + '' 13 + else 14 + assert licenseAccepted; 15 + args: 16 + (fetchzip args).overrideAttrs (old: { 17 + UNZIP = "-j -P iagreetotheeula"; 18 + }); 10 19 in 11 20 { 12 21 minigames = fetchzip {
+23 -23
pkgs/development/mobile/androidenv/compose-android-packages.nix
··· 631 631 # This derivation deploys the tools package and symlinks all the desired 632 632 # plugins that we want to use. If the license isn't accepted, prints all the licenses 633 633 # requested and throws. 634 - androidsdk = 635 - if !licenseAccepted then 636 - throw '' 637 - ${builtins.concatStringsSep "\n\n" (mkLicenseTexts licenseNames)} 634 + androidsdk = callPackage ./cmdline-tools.nix { 635 + inherit 636 + deployAndroidPackage 637 + os 638 + arch 639 + meta 640 + ; 638 641 639 - You must accept the following licenses: 640 - ${lib.concatMapStringsSep "\n" (str: " - ${str}") licenseNames} 642 + package = cmdline-tools-package; 641 643 642 - a) 643 - by setting nixpkgs config option 'android_sdk.accept_license = true;'. 644 - b) 645 - by an environment variable for a single invocation of the nix tools. 646 - $ export NIXPKGS_ACCEPT_ANDROID_SDK_LICENSE=1 647 - '' 648 - else 649 - callPackage ./cmdline-tools.nix { 650 - inherit 651 - deployAndroidPackage 652 - os 653 - arch 654 - meta 655 - ; 644 + postInstall = 645 + if !licenseAccepted then 646 + throw '' 647 + ${builtins.concatStringsSep "\n\n" (mkLicenseTexts licenseNames)} 656 648 657 - package = cmdline-tools-package; 649 + You must accept the following licenses: 650 + ${lib.concatMapStringsSep "\n" (str: " - ${str}") licenseNames} 658 651 659 - postInstall = '' 652 + a) 653 + by setting nixpkgs config option 'android_sdk.accept_license = true;'. 654 + b) 655 + by an environment variable for a single invocation of the nix tools. 656 + $ export NIXPKGS_ACCEPT_ANDROID_SDK_LICENSE=1 657 + '' 658 + else 659 + '' 660 660 # Symlink all requested plugins 661 661 ${linkPlugin { 662 662 name = "platform-tools"; ··· 769 769 '' 770 770 ) licenseNames} 771 771 ''; 772 - }; 772 + }; 773 773 }
+1 -2
pkgs/tools/misc/gams/default.nix
··· 8 8 optgamsFile ? null, 9 9 }: 10 10 11 - assert licenseFile != null; 12 - 13 11 stdenv.mkDerivation rec { 14 12 version = "25.0.2"; 15 13 pname = "gams"; ··· 23 21 dontBuild = true; 24 22 25 23 installPhase = 24 + assert licenseFile != null; 26 25 '' 27 26 mkdir -p "$out/bin" "$out/share/gams" 28 27 cp -a * "$out/share/gams"