nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 124 lines 3.5 kB view raw
1/* 2 Nixpkgs unfree+redistributable packages. 3 4 NOTE: This file is used by the sister nix-community project. 5 6 The official Hydra instance only builds and provides binary caches for free 7 packages (as in OSI-approved). 8 9 Some unfree packages such as MongoDB, ZeroTier, ... take a while to be 10 built. While their license is not free, they allow redistribution of 11 build artefacts. 12 13 The sister project nix-community will build and distribute those packages 14 for a subset of the channels to <https://nix-community.cachix.org>. 15 16 See also: 17 18 * <https://hydra.nix-community.org/jobset/nixpkgs/unfree-redistributable> 19 * <https://github.com/nix-community/infra/pull/1406> 20 21 Test for example like this: 22 23 $ hydra-eval-jobs pkgs/top-level/release-unfree-redistributable.nix -I . 24*/ 25 26{ 27 # The platforms for which we build Nixpkgs. 28 supportedSystems ? [ 29 "x86_64-linux" 30 "aarch64-linux" 31 ], 32 # Attributes passed to nixpkgs. 33 nixpkgsArgs ? { 34 config = { 35 allowAliases = false; 36 allowUnfree = true; 37 cudaSupport = true; 38 inHydra = true; 39 }; 40 41 __allowFileset = false; 42 }, 43 # We only build the full package set on infrequently releasing channels. 44 full ? false, 45}: 46 47let 48 release-lib = import ./release-lib.nix { 49 inherit supportedSystems nixpkgsArgs; 50 }; 51 52 inherit (release-lib) 53 lib 54 mapTestOn 55 pkgs 56 ; 57 58 # similar to release-lib.packagePlatforms, but also includes some condition for which package to pick 59 packagesWith = 60 prefix: cond: 61 lib.mapAttrs ( 62 name: value: 63 let 64 attrPath = if prefix == "" then name else "${prefix}.${name}"; 65 res = builtins.tryEval ( 66 if lib.isDerivation value then 67 lib.optionals (cond attrPath value) ( 68 # logic copied from release-lib packagePlatforms 69 value.meta.hydraPlatforms 70 or (lib.subtractLists (value.meta.badPlatforms or [ ]) (value.meta.platforms or [ "x86_64-linux" ])) 71 ) 72 else if 73 value.recurseForDerivations or false 74 || value.recurseForRelease or false 75 || value.__recurseIntoDerivationForReleaseJobs or false 76 then 77 # Recurse 78 packagesWith attrPath cond value 79 else 80 [ ] 81 ); 82 in 83 lib.optionals res.success res.value 84 ); 85 86 # Unfree is any license not OSI-approved. 87 isUnfree = pkg: lib.lists.any (l: !(l.free or true)) (lib.lists.toList (pkg.meta.license or [ ])); 88 89 # Whenever the license allows re-distribution of the binaries 90 isRedistributable = 91 pkg: lib.lists.any (l: l.redistributable or false) (lib.lists.toList (pkg.meta.license or [ ])); 92 93 isSource = 94 pkg: !lib.lists.any (x: !(x.isSource)) (lib.lists.toList (pkg.meta.sourceProvenance or [ ])); 95 96 isNotLinuxKernel = 97 attrPath: !(lib.hasPrefix "linuxKernel" attrPath || lib.hasPrefix "linuxPackages" attrPath); 98 99 # This is handled by release-cuda.nix 100 isNotCudaPackage = attrPath: !(lib.hasPrefix "cuda" attrPath); 101 102 canSubstituteSrc = 103 pkg: 104 # requireFile don't allow using substituters and are therefor skipped 105 pkg.src.allowSubstitutes or true; 106 107 cond = 108 attrPath: pkg: 109 (isUnfree pkg) 110 && (isRedistributable pkg) 111 && (isSource pkg) 112 && (canSubstituteSrc pkg) 113 && ( 114 full 115 || 116 # We only build these heavy packages on releases 117 ((isNotCudaPackage attrPath) && (isNotLinuxKernel attrPath)) 118 ); 119 120 packages = packagesWith "" cond pkgs; 121 122 jobs = mapTestOn packages; 123in 124jobs