release.nix: Use fetchTarball and fetchGit

In particular, using fetchGit means we don't need hackery to clean the
source tree when building from an unclean tree.
This commit is contained in:
Eelco Dolstra 2017-12-22 11:33:34 +01:00
parent 62e214fa6f
commit 6d80870832
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
5 changed files with 24 additions and 24 deletions

View file

@ -1,6 +1,5 @@
ifeq ($(MAKECMDGOALS), dist) ifeq ($(MAKECMDGOALS), dist)
# Make sure we are in repo root with `--git-dir` dist-files += $(shell cat .dist-files)
dist-files += $(shell git --git-dir=.git ls-files || find * -type f)
endif endif
dist-files += configure config.h.in nix.spec perl/configure dist-files += configure config.h.in nix.spec perl/configure

View file

@ -1,12 +1,12 @@
{ nix ? { outPath = ./.; revCount = 1234; shortRev = "abcdef"; } { nix ? fetchGit ./.
, nixpkgs ? { outPath = <nixpkgs>; revCount = 1234; shortRev = "abcdef"; } , nixpkgs ? fetchTarball channel:nixos-17.09
, officialRelease ? false , officialRelease ? false
, systems ? [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ] , systems ? [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ]
}: }:
let let
pkgs = import <nixpkgs> {}; pkgs = import nixpkgs {};
jobs = rec { jobs = rec {
@ -27,16 +27,14 @@ let
pkgconfig sqlite libsodium boehmgc pkgconfig sqlite libsodium boehmgc
docbook5 docbook5_xsl docbook5 docbook5_xsl
autoconf-archive autoconf-archive
git
] ++ lib.optional stdenv.isLinux libseccomp; ] ++ lib.optional stdenv.isLinux libseccomp;
configureFlags = "--enable-gc"; configureFlags = "--enable-gc";
postUnpack = '' postUnpack = ''
# Clean up when building from a working tree. ls -la source
if [[ -d $sourceRoot/.git ]]; then (cd source && find . -type f) | cut -c3- > source/.dist-files
git -C $sourceRoot clean -fd cat source/.dist-files
fi
''; '';
preConfigure = '' preConfigure = ''
@ -62,7 +60,7 @@ let
build = pkgs.lib.genAttrs systems (system: build = pkgs.lib.genAttrs systems (system:
with import <nixpkgs> { inherit system; }; with import nixpkgs { inherit system; };
with import ./release-common.nix { inherit pkgs; }; with import ./release-common.nix { inherit pkgs; };
@ -105,7 +103,7 @@ let
perlBindings = pkgs.lib.genAttrs systems (system: perlBindings = pkgs.lib.genAttrs systems (system:
let pkgs = import <nixpkgs> { inherit system; }; in with pkgs; let pkgs = import nixpkgs { inherit system; }; in with pkgs;
releaseTools.nixBuild { releaseTools.nixBuild {
name = "nix-perl"; name = "nix-perl";
@ -131,7 +129,7 @@ let
binaryTarball = pkgs.lib.genAttrs systems (system: binaryTarball = pkgs.lib.genAttrs systems (system:
# FIXME: temporarily use a different branch for the Darwin build. # FIXME: temporarily use a different branch for the Darwin build.
with import <nixpkgs> { inherit system; }; with import nixpkgs { inherit system; };
let let
toplevel = builtins.getAttr system jobs.build; toplevel = builtins.getAttr system jobs.build;
@ -174,7 +172,7 @@ let
coverage = coverage =
with import <nixpkgs> { system = "x86_64-linux"; }; with import nixpkgs { system = "x86_64-linux"; };
releaseTools.coverageAnalysis { releaseTools.coverageAnalysis {
name = "nix-build"; name = "nix-build";
@ -218,20 +216,23 @@ let
# System tests. # System tests.
tests.remoteBuilds = (import ./tests/remote-builds.nix rec { tests.remoteBuilds = (import ./tests/remote-builds.nix rec {
inherit nixpkgs;
nix = build.x86_64-linux; system = "x86_64-linux"; nix = build.x86_64-linux; system = "x86_64-linux";
}); });
tests.nix-copy-closure = (import ./tests/nix-copy-closure.nix rec { tests.nix-copy-closure = (import ./tests/nix-copy-closure.nix rec {
inherit nixpkgs;
nix = build.x86_64-linux; system = "x86_64-linux"; nix = build.x86_64-linux; system = "x86_64-linux";
}); });
tests.setuid = pkgs.lib.genAttrs (pkgs.lib.filter (pkgs.lib.hasSuffix "-linux") systems) (system: tests.setuid = pkgs.lib.genAttrs (pkgs.lib.filter (pkgs.lib.hasSuffix "-linux") systems) (system:
import ./tests/setuid.nix rec { import ./tests/setuid.nix rec {
inherit nixpkgs;
nix = build.${system}; inherit system; nix = build.${system}; inherit system;
}); });
tests.binaryTarball = tests.binaryTarball =
with import <nixpkgs> { system = "x86_64-linux"; }; with import nixpkgs { system = "x86_64-linux"; };
vmTools.runInLinuxImage (runCommand "nix-binary-tarball-test" vmTools.runInLinuxImage (runCommand "nix-binary-tarball-test"
{ diskImage = vmTools.diskImages.ubuntu1204x86_64; { diskImage = vmTools.diskImages.ubuntu1204x86_64;
} }
@ -250,7 +251,7 @@ let
''); # */ ''); # */
tests.evalNixpkgs = tests.evalNixpkgs =
import <nixpkgs/pkgs/top-level/make-tarball.nix> { import (nixpkgs + "/pkgs/top-level/make-tarball.nix") {
inherit nixpkgs; inherit nixpkgs;
inherit pkgs; inherit pkgs;
nix = build.x86_64-linux; nix = build.x86_64-linux;
@ -304,7 +305,7 @@ let
makeRPM = makeRPM =
system: diskImageFun: extraPackages: system: diskImageFun: extraPackages:
with import <nixpkgs> { inherit system; }; with import nixpkgs { inherit system; };
releaseTools.rpmBuild rec { releaseTools.rpmBuild rec {
name = "nix-rpm"; name = "nix-rpm";
@ -326,7 +327,7 @@ let
makeDeb = makeDeb =
system: diskImageFun: extraPackages: extraDebPackages: system: diskImageFun: extraPackages: extraDebPackages:
with import <nixpkgs> { inherit system; }; with import nixpkgs { inherit system; };
releaseTools.debBuild { releaseTools.debBuild {
name = "nix-deb"; name = "nix-deb";

View file

@ -1,8 +1,8 @@
# Test nix-copy-closure. # Test nix-copy-closure.
{ system, nix }: { nixpkgs, system, nix }:
with import <nixpkgs/nixos/lib/testing.nix> { inherit system; }; with import (nixpkgs + /nixos/lib/testing.nix) { inherit system; };
makeTest (let pkgA = pkgs.cowsay; pkgB = pkgs.wget; pkgC = pkgs.hello; in { makeTest (let pkgA = pkgs.cowsay; pkgB = pkgs.wget; pkgC = pkgs.hello; in {

View file

@ -1,8 +1,8 @@
# Test Nix's remote build feature. # Test Nix's remote build feature.
{ system, nix }: { nixpkgs, system, nix }:
with import <nixpkgs/nixos/lib/testing.nix> { inherit system; }; with import (nixpkgs + "/nixos/lib/testing.nix") { inherit system; };
makeTest ( makeTest (

View file

@ -1,8 +1,8 @@
# Verify that Linux builds cannot create setuid or setgid binaries. # Verify that Linux builds cannot create setuid or setgid binaries.
{ system, nix }: { nixpkgs, system, nix }:
with import <nixpkgs/nixos/lib/testing.nix> { inherit system; }; with import (nixpkgs + "/nixos/lib/testing.nix") { inherit system; };
makeTest { makeTest {