Decided it would be best if hydra just provided the latest stable nixpkgs for us to use. This way there is no need for an udpate script that polutes our logs with update submodule commits.
101 lines
3.2 KiB
Nix
101 lines
3.2 KiB
Nix
{ nixpkgs # Checked out nixpkgs git repe
|
|
? { outPath = ./upstream;
|
|
revCount = 56789;
|
|
shortRev = "gfedcba";
|
|
}
|
|
, ccpkgs # Checked out ccpkgs git repo
|
|
? { outPath = ./.;
|
|
revCount = 56789;
|
|
shortRev = "gfedcba";
|
|
}
|
|
, stableBranch ? false
|
|
, supportedSystems ? [ "x86_64-linx" ] }:
|
|
|
|
|
|
# Free up the nixpkgs and ccpkgs name for binding to final product.
|
|
#
|
|
let
|
|
# nixpkgsGit - git checkout of nixpkgs
|
|
# ccpkgsGit - git checkout of ccpkgs
|
|
#
|
|
nixpkgsGit = nixpkgs;
|
|
ccpkgsGit = ccpkgs;
|
|
|
|
# Tarball hydra release product for the ccpkgs channel.
|
|
#
|
|
# 1. Generate an unpacked channel for the associated nixpkgs in the store.
|
|
# 2. Symlink this into the top-level directory as upstream (nixpkgs is used).
|
|
# 3. Stick in the standard version files.
|
|
# 4. Let releaseTools.sourceTarball handle the details of exposing it as a hydra product.
|
|
#
|
|
in let
|
|
|
|
# pkgs - Packages sucked in from the given ccpkgs git version.
|
|
#
|
|
pkgs = import ccpkgsGit { upstream = nixpkgsGit; };
|
|
|
|
# version - Version number of nixpkgs (and hence ccpkgs too)
|
|
# versionSuffix - Version suffix based on git commnit
|
|
#
|
|
# Code lifted from nixos/release.nix.
|
|
#
|
|
version = pkgs.lib.fileContents ./.version;
|
|
versionSuffix =
|
|
(if stableBranch then "." else "beta") + "${toString (nixpkgsGit.revCount - 114283)}.${nixpkgsGit.shortRev}";
|
|
|
|
# nixpkgs - The store path containing the unpacked nixpkgs channel.
|
|
#
|
|
# 1. Generate a channel tarball from the git repo via the nixos/release.nix expression for hydra.
|
|
# 2. Unpack this into the store using the nix/unpack-channel.nix expression used by nix-channel.
|
|
#
|
|
nixpkgs =
|
|
let
|
|
# version - Version of checked out nixpkgs
|
|
#
|
|
version = pkgs.lib.fileContents (nixpkgsGit + /.version);
|
|
|
|
# channel - Store path containing the channel release tarballs.
|
|
#
|
|
# The nixos.channel attribute from nixos/release.nix builds the nixpkgs channel tarballs.
|
|
#
|
|
channel =
|
|
( import (nixpkgsGit + /nixos/release.nix) {
|
|
nixpkgs = nixpkgsGit;
|
|
inherit stableBranch supportedSystems;
|
|
} ).channel;
|
|
|
|
# nixpkgs - The store path containing the unpacked nixpkgs channel.
|
|
#
|
|
# The nix provided nix/unpack-channel.nix function extracts the nixpkgs from the channel,
|
|
#
|
|
nixpkgs =
|
|
( import <nix/unpack-channel.nix> rec {
|
|
name = "nixos";
|
|
channelName = "${name}-${version}";
|
|
src = channel + /tarballs + "/${name}-${version}${versionSuffix}.tar.xz";
|
|
binaryCacheURL = https://cache.nixos.org;
|
|
} );
|
|
in
|
|
nixpkgs;
|
|
|
|
# Tweak the nixos make-channel code to include the upstream channel.
|
|
#
|
|
# 1. Replace the git repo nixpkgs with a copy of the unpacked nixpkgs channel.
|
|
#
|
|
channel =
|
|
( import (nixpkgsGit + /nixos/lib/make-channel.nix) {
|
|
inherit pkgs version versionSuffix;
|
|
nixpkgs = ccpkgsGit;
|
|
} ).overrideAttrs ( original: {
|
|
name = "ccpkgs-channel";
|
|
distPhase =
|
|
''
|
|
rm -fr upstream
|
|
cp -rd ${nixpkgs}/nixos-${version} upstream
|
|
'' + original.distPhase;
|
|
} );
|
|
|
|
in
|
|
|
|
{ inherit channel; }
|