Skip to content

Commit

Permalink
release.nix: Use fetchTarball and fetchGit
Browse files Browse the repository at this point in the history
In particular, using fetchGit means we don't need hackery to clean the
source tree when building from an unclean tree.
  • Loading branch information
edolstra committed Dec 22, 2017
1 parent 62e214f commit 6d80870
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
3 changes: 1 addition & 2 deletions local.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
ifeq ($(MAKECMDGOALS), dist)
# Make sure we are in repo root with `--git-dir`
dist-files += $(shell git --git-dir=.git ls-files || find * -type f)
dist-files += $(shell cat .dist-files)
endif

dist-files += configure config.h.in nix.spec perl/configure
Expand Down
33 changes: 17 additions & 16 deletions release.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{ nix ? { outPath = ./.; revCount = 1234; shortRev = "abcdef"; }
, nixpkgs ? { outPath = <nixpkgs>; revCount = 1234; shortRev = "abcdef"; }
{ nix ? fetchGit ./.
, nixpkgs ? fetchTarball channel:nixos-17.09
, officialRelease ? false
, systems ? [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ]
}:

let

pkgs = import <nixpkgs> {};
pkgs = import nixpkgs {};

jobs = rec {

Expand All @@ -27,16 +27,14 @@ let
pkgconfig sqlite libsodium boehmgc
docbook5 docbook5_xsl
autoconf-archive
git
] ++ lib.optional stdenv.isLinux libseccomp;

configureFlags = "--enable-gc";

postUnpack = ''
# Clean up when building from a working tree.
if [[ -d $sourceRoot/.git ]]; then
git -C $sourceRoot clean -fd
fi
ls -la source
(cd source && find . -type f) | cut -c3- > source/.dist-files
cat source/.dist-files
'';

preConfigure = ''
Expand All @@ -62,7 +60,7 @@ let

build = pkgs.lib.genAttrs systems (system:

with import <nixpkgs> { inherit system; };
with import nixpkgs { inherit system; };

with import ./release-common.nix { inherit pkgs; };

Expand Down Expand Up @@ -105,7 +103,7 @@ let

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 {
name = "nix-perl";
Expand All @@ -131,7 +129,7 @@ let
binaryTarball = pkgs.lib.genAttrs systems (system:

# FIXME: temporarily use a different branch for the Darwin build.
with import <nixpkgs> { inherit system; };
with import nixpkgs { inherit system; };

let
toplevel = builtins.getAttr system jobs.build;
Expand Down Expand Up @@ -174,7 +172,7 @@ let


coverage =
with import <nixpkgs> { system = "x86_64-linux"; };
with import nixpkgs { system = "x86_64-linux"; };

releaseTools.coverageAnalysis {
name = "nix-build";
Expand Down Expand Up @@ -218,20 +216,23 @@ let

# System tests.
tests.remoteBuilds = (import ./tests/remote-builds.nix rec {
inherit nixpkgs;
nix = build.x86_64-linux; system = "x86_64-linux";
});

tests.nix-copy-closure = (import ./tests/nix-copy-closure.nix rec {
inherit nixpkgs;
nix = build.x86_64-linux; system = "x86_64-linux";
});

tests.setuid = pkgs.lib.genAttrs (pkgs.lib.filter (pkgs.lib.hasSuffix "-linux") systems) (system:
import ./tests/setuid.nix rec {
inherit nixpkgs;
nix = build.${system}; inherit system;
});

tests.binaryTarball =
with import <nixpkgs> { system = "x86_64-linux"; };
with import nixpkgs { system = "x86_64-linux"; };
vmTools.runInLinuxImage (runCommand "nix-binary-tarball-test"
{ diskImage = vmTools.diskImages.ubuntu1204x86_64;
}
Expand All @@ -250,7 +251,7 @@ let
''); # */

tests.evalNixpkgs =
import <nixpkgs/pkgs/top-level/make-tarball.nix> {
import (nixpkgs + "/pkgs/top-level/make-tarball.nix") {
inherit nixpkgs;
inherit pkgs;
nix = build.x86_64-linux;
Expand Down Expand Up @@ -304,7 +305,7 @@ let
makeRPM =
system: diskImageFun: extraPackages:

with import <nixpkgs> { inherit system; };
with import nixpkgs { inherit system; };

releaseTools.rpmBuild rec {
name = "nix-rpm";
Expand All @@ -326,7 +327,7 @@ let
makeDeb =
system: diskImageFun: extraPackages: extraDebPackages:

with import <nixpkgs> { inherit system; };
with import nixpkgs { inherit system; };

releaseTools.debBuild {
name = "nix-deb";
Expand Down
4 changes: 2 additions & 2 deletions tests/nix-copy-closure.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# 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 {

Expand Down
4 changes: 2 additions & 2 deletions tests/remote-builds.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# 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 (

Expand Down
4 changes: 2 additions & 2 deletions tests/setuid.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# 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 {

Expand Down

3 comments on commit 6d80870

@shlevy
Copy link
Member

@shlevy shlevy commented on 6d80870 Dec 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ†

@dtzWill
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks building nixUnstable (1.12) with stable nix (1.11), due to both lack of fetchGit and support for channel: syntax.

Is that intentional?

My main concern is it presents a bit of a bootstrapping problem re:upgrade path.

... time for nix 1.11 to have an with import <future> {};? 😝

@knedlsepp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also breaks the hydra.nixos.org build.

Please sign in to comment.