Skip to content

Instantly share code, notes, and snippets.

@Ericson2314
Forked from DavidEGrayson/nixpkgs-pr-test.nix
Last active December 1, 2016 00:13
Show Gist options
  • Save Ericson2314/fc745290db68b20235bdc457961b3658 to your computer and use it in GitHub Desktop.
Save Ericson2314/fc745290db68b20235bdc457961b3658 to your computer and use it in GitHub Desktop.
{ me ? "5acef014fd9ca6119226d7c5373b1b8cc4df1376"
, base ? "b09435ea51caaae1865e667aaa32f7cba4cc4ff2"
}:
rec {
inherit me base;
myNixpkgsFunc = import (builtins.fetchTarball "https://github.com/Ericson2314/nixpkgs/archive/${me}.tar.gz");
myNixpkgs = myNixpkgsFunc {};
baseNixpkgsFunc = import (builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/${base}.tar.gz");
baseNixpkgs = baseNixpkgsFunc {};
myTestsPass = (import ./nixpkgs/test/cross_system.nix).testsPass;
gcc6Same = myNixpkgs.gcc6 == baseNixpkgs.gcc6;
gcc5Same = myNixpkgs.gcc5 == baseNixpkgs.gcc5;
gcc49Same = myNixpkgs.gcc49 == baseNixpkgs.gcc49;
gcc48Same = myNixpkgs.gcc48 == baseNixpkgs.gcc48;
gcc45Same = myNixpkgs.gcc45 == baseNixpkgs.gcc45;
gccSame = gcc6Same && gcc5Same && gcc49Same && gcc45Same;
helloSame = rpiHello myNixpkgsFunc == rpiHello baseNixpkgsFunc;
customStdenv = npf: args: npf ({ config.replaceStdenv = { pkgs }: pkgs.stdenv // { inherit (pkgs) asdf; }; } // args);
helloCustomStdenv = rpiHello (customStdenv myNixpkgsFunc) == rpiHello (customStdenv baseNixpkgsFunc);
ghcCustomStdenv = (customStdenv myNixpkgsFunc {}).ghc == (customStdenv baseNixpkgsFunc {}).ghc;
darwinArgs = { system = "x86_64-darwin"; };
linuxArgs = { system = "x86_64-linux"; };
ghcDarwin = (myNixpkgsFunc darwinArgs).ghc == (baseNixpkgsFunc darwinArgs).ghc;
ghcLinux = (myNixpkgsFunc linuxArgs).ghc == (baseNixpkgsFunc linuxArgs).ghc;
testsPass = gccSame && helloSame && helloCustomStdenv && ghcCustomStdenv
&& ghcDarwin && ghcLinux;
rpiHello = nixpkgsFunc: let
rpiCrossSystem = {
config = "armv6l-unknown-linux-gnueabi";
bigEndian = false;
arch = "arm";
float = "hard";
fpu = "vfp";
withTLS = true;
libc = "glibc";
platform = myNixpkgs.platforms.raspberrypi;
openssl.system = "linux-generic32";
gcc = {
arch = "armv6";
fpu = "vfp";
float = "softfp";
abi = "aapcs-linux";
};
};
rpiPkgs = nixpkgsFunc { crossSystem = rpiCrossSystem; };
in rpiPkgs.hello.crossDrv;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment