gnu: gprolog: Update to 1.4.4.
[jackhill/guix/guix.git] / release.nix
1 /* GNU Guix --- Functional package management for GNU
2 Copyright (C) 2012, 2013 Ludovic Courtès <ludo@gnu.org>
3
4 This file is part of GNU Guix.
5
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.
10
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.
15
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/>. */
18
19 /* Release file to build Guix with Nix. Useful to bootstrap Guix on
20 Guix-enabled Hydra instances. */
21
22 let
23 nixpkgs = <nixpkgs>;
24
25 buildOutOfSourceTree = true;
26 succeedOnFailure = true;
27 keepBuildDirectory = true;
28
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.
32 unchroot =
33 let
34 pkgs = import nixpkgs {};
35
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" ];
40 in
41 drv:
42 if builtins.isAttrs drv
43 then pkgs.lib.overrideDerivation (pythonKludge drv) (args: {
44 __noChroot = true;
45 nativeBuildInputs = map unchroot args.nativeBuildInputs;
46 propagatedNativeBuildInputs =
47 map unchroot args.propagatedNativeBuildInputs;
48 })
49 else drv;
50
51 # Return a Nixpkgs with some derivations "unchrooted".
52 unchrootedNixpkgs = system:
53 import nixpkgs {
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;
58 };
59 inherit system;
60 };
61
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.
65 bootstrap_guile =
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";
70 };
71
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";
75 };
76 };
77
78 jobs = {
79 tarball =
80 unchroot
81 (let pkgs = unchrootedNixpkgs builtins.currentSystem; in
82 pkgs.releaseTools.sourceTarball {
83 name = "guix-tarball";
84 src = <guix>;
85 buildInputs =
86 let git_light = pkgs.git.override {
87 # Minimal Git to avoid building too many dependencies.
88 withManual = false;
89 pythonSupport = false;
90 svnSupport = false;
91 guiSupport = false;
92 };
93 in
94 [ git_light ] ++
95 (with pkgs; [ guile sqlite bzip2 libgcrypt ]);
96 nativeBuildInputs = with pkgs; [ texinfo gettext cvs pkgconfig ];
97 preAutoconf = ''git config submodule.nix.url "${<nix>}"'';
98 configureFlags =
99 [ "--with-libgcrypt-prefix=${pkgs.libgcrypt}"
100 "--localstatedir=/nix/var"
101 ];
102 });
103
104 build =
105 { system ? builtins.currentSystem }:
106
107 unchroot
108 (let pkgs = unchrootedNixpkgs system; in
109 pkgs.releaseTools.nixBuild {
110 name = "guix";
111 buildInputs = with pkgs; [ guile sqlite bzip2 libgcrypt ];
112 nativeBuildInputs = [ pkgs.pkgconfig ];
113 src = jobs.tarball;
114 configureFlags =
115 [ "--with-libgcrypt-prefix=${pkgs.libgcrypt}"
116 "--localstatedir=/nix/var"
117 ];
118
119 preBuild =
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
127 '';
128
129 inherit succeedOnFailure keepBuildDirectory
130 buildOutOfSourceTree;
131 });
132
133
134 build_disable_daemon =
135 { system ? builtins.currentSystem }:
136
137 unchroot
138 (let
139 pkgs = unchrootedNixpkgs system;
140 build = jobs.build { inherit system; };
141 in
142 pkgs.lib.overrideDerivation build ({ configureFlags, ... }: {
143 configureFlags = configureFlags ++ [ "--disable-daemon" ];
144 buildInputs = with pkgs; [ guile nixUnstable pkgconfig ];
145
146 # Since we need to talk to a running daemon, we need to escape
147 # the chroot.
148 preConfigure = "export NIX_REMOTE=daemon";
149 __noChroot = true;
150 }));
151
152 # Jobs to test the distro.
153 distro = {
154 hello =
155 { system ? builtins.currentSystem }:
156
157 let
158 pkgs = unchrootedNixpkgs system;
159 guix = jobs.build { inherit system; };
160 in
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 {
166 src = null;
167 name = "guix-hello";
168 phases = "buildPhase";
169 buildPhase = "${guix}/bin/guix-build --no-substitutes hello | tee $out";
170 __noChroot = true;
171 };
172 };
173 };
174 in
175 jobs