Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 69 lines 2.0 kB view raw
1{ 2 runCommand, 3 version, 4 src, 5 nix, 6 lib, 7 stdenv, 8 pkgs, 9 pkgsi686Linux, 10 pkgsStatic, 11 nixosTests, 12 self_attribute_name, 13}: 14{ 15 srcVersion = 16 runCommand "nix-src-version" 17 { 18 inherit version; 19 } 20 '' 21 # This file is an implementation detail, but it's a good sanity check 22 # If upstream changes that, we'll have to adapt. 23 srcVersion=$(cat ${src}/.version) 24 echo "Version in nix nix expression: $version" 25 echo "Version in nix.src: $srcVersion" 26 ${ 27 if self_attribute_name == "git" then 28 # Major and minor must match, patch can be missing or have a suffix like a commit hash. That's all fine. 29 '' 30 majorMinor() { 31 echo "$1" | sed -n -e 's/\([0-9]*\.[0-9]*\).*/\1/p' 32 } 33 if (set -x; [ "$(majorMinor "$version")" != "$(majorMinor "$srcVersion")" ]); then 34 echo "Version mismatch!" 35 exit 1 36 fi 37 '' 38 else 39 # exact match 40 '' 41 if [ "$version" != "$srcVersion" ]; then 42 echo "Version mismatch!" 43 exit 1 44 fi 45 '' 46 } 47 touch $out 48 ''; 49 50 /** 51 Intended to test `lib`, but also a good smoke test for Nix 52 */ 53 nixpkgs-lib = import ../../../../lib/tests/test-with-nix.nix { 54 inherit lib pkgs; 55 inherit nix; 56 }; 57} 58// lib.optionalAttrs stdenv.hostPlatform.isLinux { 59 nixStatic = pkgsStatic.nixVersions.${self_attribute_name}; 60 61 # Basic smoke tests that needs to pass when upgrading nix. 62 # Note that this test does only test the nixVersions.stable attribute. 63 misc = nixosTests.nix-misc.default; 64 upgrade = nixosTests.nix-upgrade; 65 simpleUefiSystemdBoot = nixosTests.installer.simpleUefiSystemdBoot; 66} 67// lib.optionalAttrs (stdenv.hostPlatform.system == "x86_64-linux") { 68 nixi686 = pkgsi686Linux.nixVersions.${self_attribute_name}; 69}