Skip to content

Instantly share code, notes, and snippets.

@aszlig
Last active May 27, 2016 19:38
Show Gist options
  • Save aszlig/7350621 to your computer and use it in GitHub Desktop.
Save aszlig/7350621 to your computer and use it in GitHub Desktop.
Chromium autoupdate builds
{ chromium ? null, nixpkgs ? <nixpkgs>, systems ? [ "x86_64-linux" "i686-linux" ] }:
let
opkgs = import nixpkgs {
system = "x86_64-linux";
};
mkChromiumForSystem = system: chan: let
pkgs = import nixpkgs {
inherit system;
};
cpkg = if chromium == null
then pkgs.chromium.override
else pkgs.callPackage chromium;
in cpkg {
channel = chan;
gnomeSupport = true;
gnomeKeyringSupport = true;
proprietaryCodecs = true;
cupsSupport = true;
pulseSupport = true;
enablePepperFlash = system == "x86_64-linux";
enableWideVine = system == "x86_64-linux";
};
mkChromiumChanMapForSystem = system: let
buildChromium = mkChromiumForSystem system;
in opkgs.lib.genAttrs [ "stable" "beta" "dev" ] buildChromium;
in with opkgs.lib; rec {
build = opkgs.lib.genAttrs systems mkChromiumChanMapForSystem;
testAll = let
mkTest = system: chan: chromium:
opkgs.writeScript "test-chromium-${chan}.sh" ''
#!${opkgs.stdenv.shell}
if datadir="$(${opkgs.coreutils}/bin/mktemp -d)"; then
${chromium}/bin/chromium --user-data-dir="$datadir" "$@"
rm -rf "$datadir"
fi
'';
in opkgs.stdenv.mkDerivation {
name = "test-chromium";
buildCommand = ''
ensureDir "$out/bin"
cat > "$out/bin/test-chromium" <<EOF
${concatStrings (flip mapAttrsToList build (system: builds: ''
echo "Test scripts for architecture ${system}:" >&2
${concatStrings (flip mapAttrsToList builds (chan: chromium: ''
echo -n "Testing channel ${chan}..." >&2
${mkTest system chan chromium}
echo " done." >&2
''))}
''))}
EOF
chmod +x "$out/bin/test-chromium"
'';
};
vmTest = let
testFor = system: import "${nixpkgs}/nixos/tests/chromium.nix" {
inherit system;
channelMap = mkChromiumChanMapForSystem system;
};
in genAttrs systems testFor;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment