-
-
Save thoughtpolice/b3832241c3495e0be3de0e98346cb425 to your computer and use it in GitHub Desktop.
bcachefs-tools hydra
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/result* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
bcachefs-tools = "https://github.com/thoughtpolice/bcachefs-tools.git"; | |
hydra = "https://gist.github.com/b3832241c3495e0be3de0e98346cb425.git"; | |
branches = [ "new-man" ]; | |
convert = pkgs: branch: | |
let common = { type = "git"; emailresponsible = false; }; | |
url = "${bcachefs-tools} ${branch}"; | |
in { enabled = 1; | |
hidden = false; | |
description = "${branch} builds"; | |
nixexprinput = "hydra"; | |
nixexprpath = "release.nix"; | |
checkinterval = 250; | |
schedulingshares = 100; | |
enableemail = false; | |
emailoverride = ""; | |
keepnr = 50; | |
inputs = | |
{ hydra = common // { value = hydra; }; | |
bcachefs-tools = common // { value = url; }; | |
nixpkgs = common // { value = "https://github.com/nixos/nixpkgs.git ${pkgs.rev}"; }; | |
}; | |
}; | |
in | |
{ declInput }: | |
let | |
json = builtins.fromJSON (builtins.readFile ./nixpkgs.json); | |
pkgs = import ./nixpkgs.nix {}; | |
spec = builtins.toJSON (pkgs.lib.genAttrs branches (name: convert json name)); | |
in | |
{ | |
jobsets = pkgs.runCommand "spec.json" {} '' | |
cat <<EOF | |
${builtins.toXML declInput} | |
EOF | |
cat > $out <<EOF | |
${spec} | |
EOF | |
''; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# `builtins.fetchTarball` only accepts a `sha256` argument in Nix version 1.12 | |
# or later, so here we provide a function that can provide a compatible interface | |
# to Nix 1.11 or Nix 1.12 | |
# | |
# TODO FIXME: remove this sometime after Nix 1.12 goes stable | |
{ url # URL of the nixpkgs tarball to download | |
, rev # The Git revision of nixpkgs to fetch | |
, sha256 # The SHA256 of the downloaded data | |
, system ? builtins.currentSystem # This is overridable if necessary | |
}: | |
with { | |
ifThenElse = { bool, thenValue, elseValue }: ( | |
if bool then thenValue else elseValue); | |
}; | |
ifThenElse { | |
bool = (0 <= builtins.compareVersions builtins.nixVersion "1.12"); | |
# In Nix 1.12, we can just give a `sha256` to `builtins.fetchTarball`. | |
thenValue = (builtins.fetchTarball { inherit url sha256; }); | |
# This hack should at least work for Nix 1.11 | |
elseValue = ( | |
(rec { | |
tarball = import <nix/fetchurl.nix> { inherit url sha256; }; | |
builtin-paths = import <nix/config.nix>; | |
script = builtins.toFile "nixpkgs-unpacker" '' | |
"$coreutils/mkdir" "$out" | |
cd "$out" | |
"$gzip" --decompress < "$tarball" | "$tar" -x --strip-components=1 | |
''; | |
nixpkgs = builtins.derivation { | |
name = "nixpkgs-${builtins.substring 0 6 rev}"; | |
builder = builtins.storePath builtin-paths.shell; | |
args = [ script ]; | |
inherit tarball system; | |
tar = builtins.storePath builtin-paths.tar; | |
gzip = builtins.storePath builtin-paths.gzip; | |
coreutils = builtins.storePath builtin-paths.coreutils; | |
}; | |
}).nixpkgs); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"enabled": 1, | |
"hidden": true, | |
"description": "Jobsets", | |
"nixexprinput": "src", | |
"nixexprpath": "default.nix", | |
"checkinterval": 300, | |
"schedulingshares": 100, | |
"enableemail": false, | |
"emailoverride": "", | |
"keepnr": 10, | |
"inputs": { | |
"src": { | |
"type": "git", | |
"value": "https://gist.github.com/b3832241c3495e0be3de0e98346cb425.git", | |
"emailresponsible": false | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"url": "https://github.com/nixos/nixpkgs/archive/6d2ab189159e9438be83da4ee251e4e620f6730e.tar.gz", | |
"rev": "6d2ab189159e9438be83da4ee251e4e620f6730e", | |
"sha256": "0p2biqnfahx96b5zy2abg4wab4ykcywq8362yjqhwdjd3k09rv48" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ system ? builtins.currentSystem | |
, config ? {} | |
}: | |
let | |
# Grab the versions we specified in the JSON file | |
nixpkgs = builtins.fromJSON (builtins.readFile ./nixpkgs.json); | |
# Bootstrap a copy of nixpkgs, based on this. | |
src = builtins.fetchTarball { | |
name = "nixpkgs-${builtins.substring 0 6 nixpkgs.rev}"; | |
inherit (nixpkgs) url sha256; | |
}; | |
in import src { inherit system config; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ nixpkgs | |
, bcachefs-tools | |
}: | |
let | |
pkgs = import nixpkgs {}; | |
systems = | |
[ "x86_64-linux" | |
]; | |
meta = { maintainers = [ "aseipp@pobox.com" ]; }; | |
version = bcachefs-tools.shortRev; | |
relname = "bcachefs-tools-${version}"; | |
jobs = rec { | |
tarball = pkgs.releaseTools.sourceTarball rec { | |
name = "bcachefs-tools-tarball"; | |
src = bcachefs-tools; | |
inherit version meta; | |
buildInputs = with pkgs; [ xz perl ]; | |
distPhase = '' | |
relname=bcachefs-tools-${version} | |
mkdir ../$relname | |
cp -prd . ../$relname | |
rm -rf ../$relname/.git/ | |
mkdir -p $out/tarballs | |
tar cvfJ $out/tarballs/$relname.tar.xz -C .. $relname | |
make man-html | |
mkdir -p $out/share/doc/bcachefs-tools/html | |
cp man/*.html man/*.css $out/share/doc/bcachefs-tools/html/ | |
echo "doc manual $out/share/doc/bcachefs-tools/html" >> $out/nix-support/hydra-build-products | |
''; | |
}; | |
build = pkgs.lib.genAttrs systems (system: | |
(import "${bcachefs-tools}/release.nix" { inherit system bcachefs-tools; }).bcachefs-tools | |
); | |
## -- Release builds | |
release = pkgs.releaseTools.aggregate { | |
name = "bcachefs-tools-${version}"; | |
constituents = | |
[ tarball | |
build.x86_64-linux | |
]; | |
meta = meta // { description = "Release critical builds"; }; | |
}; | |
}; | |
in jobs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env nix-shell | |
#! nix-shell -i bash -p jq curl | |
## Utility to automatically update nixpkgs.json quickly and easily from either | |
## the Nixpkgs upstream or a custom fork. Runs interactively using `nix-shell` | |
## for zero-install footprint. | |
set -e | |
API=https://api.github.com/repos | |
URL="https://github.com/nixos/nixpkgs" | |
if [[ "x$1" == "x" ]]; then | |
echo -n "No revision, so grabbing latest upstream Nixpkgs master commit... " | |
REV=$(curl -s "${API}/nixos/nixpkgs/commits/master" | jq -r '.sha') | |
echo "OK, got ${REV:0:9}" | |
else | |
if [[ "x$2" == "x" ]]; then | |
REV="$1" | |
echo "Custom revision (but no repo) provided, using nixpkgs upstream" | |
else | |
REV="$2" | |
URL="$1" | |
echo "Custom revision in upstream ${URL} will be used" | |
fi | |
fi | |
DOWNLOAD="$URL/archive/$REV.tar.gz" | |
echo "Updating to nixpkgs revision ${REV:0:9} from $URL" | |
SHA256=$(nix-prefetch-url --unpack "$DOWNLOAD") | |
cat > nixpkgs.json <<EOF | |
{ | |
"url": "$DOWNLOAD", | |
"rev": "$REV", | |
"sha256": "$SHA256" | |
} | |
EOF | |
echo "Updated nixpkgs.json" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment