1 /* GNU Guix --- Functional package management for GNU
2 Copyright (C) 2012, 2013 Ludovic Courtès <ludo@gnu.org>
4 This file is part of GNU Guix.
6 GNU Guix is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or (at
9 your option) any later version.
11 GNU Guix is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. */
19 /* Release file to build Guix with Nix. Useful to bootstrap Guix on
20 Guix-enabled Hydra instances. */
25 buildOutOfSourceTree = true;
26 succeedOnFailure = true;
27 keepBuildDirectory = true;
29 # Run the given derivation in outside of a chroot. This hack is used on
30 # hydra.gnu.org where we want Guix derivations to run in a chroot that lacks
31 # /bin, whereas Nixpkgs relies on /bin/sh.
34 pkgs = import nixpkgs {};
36 # XXX: The `python' derivation contains a `modules' attribute that makes
37 # `overrideDerivation' fail with "cannot coerce an attribute set (except
38 # a derivation) to a string", so just remove it.
39 pythonKludge = drv: removeAttrs drv [ "modules" ];
42 if builtins.isAttrs drv
43 then pkgs.lib.overrideDerivation (pythonKludge drv) (args: {
45 nativeBuildInputs = map unchroot args.nativeBuildInputs;
46 propagatedNativeBuildInputs =
47 map unchroot args.propagatedNativeBuildInputs;
51 # Return a Nixpkgs with some derivations "unchrooted".
52 unchrootedNixpkgs = system:
54 # XXX: Hack to make sure these ones also get "unchrooted".
55 config.packageOverrides = pkgs: {
56 zlib = unchroot pkgs.zlib;
57 libunistring = unchroot pkgs.libunistring;
62 # The Guile used to bootstrap the whole thing. It's normally
63 # downloaded by the build system, but here we download it via a
64 # fixed-output derivation and stuff it into the build tree.
66 let pkgs = import nixpkgs {}; in {
67 i686 = pkgs.fetchurl {
68 url = http://www.fdn.fr/~lcourtes/software/guix/packages/i686-linux/20121219/guile-2.0.7.tar.xz;
69 sha256 = "45d1f9bfb9e4531a8f1c5a105f7ab094cd481b8a179ccc63cbabb73ce6b8437f";
72 x86_64 = pkgs.fetchurl {
73 url = http://www.fdn.fr/~lcourtes/software/guix/packages/x86_64-linux/20121219/guile-2.0.7.tar.xz;
74 sha256 = "953fbcc8db6e310626be79b67319cf4141dc23b296447952a99d95425b3a4dc1";
81 (let pkgs = unchrootedNixpkgs builtins.currentSystem; in
82 pkgs.releaseTools.sourceTarball {
83 name = "guix-tarball";
86 let git_light = pkgs.git.override {
87 # Minimal Git to avoid building too many dependencies.
89 pythonSupport = false;
95 (with pkgs; [ guile sqlite bzip2 libgcrypt ]);
96 nativeBuildInputs = with pkgs; [ texinfo gettext cvs pkgconfig ];
97 preAutoconf = ''git config submodule.nix.url "${<nix>}"'';
99 [ "--with-libgcrypt-prefix=${pkgs.libgcrypt}"
100 "--localstatedir=/nix/var"
105 { system ? builtins.currentSystem }:
108 (let pkgs = unchrootedNixpkgs system; in
109 pkgs.releaseTools.nixBuild {
111 buildInputs = with pkgs; [ guile sqlite bzip2 libgcrypt ];
112 nativeBuildInputs = [ pkgs.pkgconfig ];
115 [ "--with-libgcrypt-prefix=${pkgs.libgcrypt}"
116 "--localstatedir=/nix/var"
120 # Use our pre-downloaded bootstrap tarballs instead of letting
121 # the build system download it over and over again.
122 '' mkdir -p distro/packages/bootstrap/{i686,x86_64}-linux
123 cp -v "${bootstrap_guile.i686}" \
124 distro/packages/bootstrap/i686-linux/guile-2.0.7.tar.xz
125 cp -v "${bootstrap_guile.x86_64}" \
126 distro/packages/bootstrap/x86_64-linux/guile-2.0.7.tar.xz
129 inherit succeedOnFailure keepBuildDirectory
130 buildOutOfSourceTree;
134 build_disable_daemon =
135 { system ? builtins.currentSystem }:
139 pkgs = unchrootedNixpkgs system;
140 build = jobs.build { inherit system; };
142 pkgs.lib.overrideDerivation build ({ configureFlags, ... }: {
143 configureFlags = configureFlags ++ [ "--disable-daemon" ];
144 buildInputs = with pkgs; [ guile nixUnstable pkgconfig ];
146 # Since we need to talk to a running daemon, we need to escape
148 preConfigure = "export NIX_REMOTE=daemon";
152 # Jobs to test the distro.
155 { system ? builtins.currentSystem }:
158 pkgs = unchrootedNixpkgs system;
159 guix = jobs.build { inherit system; };
161 # XXX: We have no way to tell the Nix code to swallow the .drv
162 # produced by `guix-build', so we have a pointless indirection
163 # here. This could be worked around by generating Nix code
164 # from the .drv, and importing that.
165 pkgs.releaseTools.nixBuild {
168 phases = "buildPhase";
169 buildPhase = "${guix}/bin/guix-build --no-substitutes hello | tee $out";