Commit | Line | Data |
---|---|---|
2152e3c5 LC |
1 | /* Guix --- Nix package management from Guile. -*- coding: utf-8 -*- |
2 | Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org> | |
3 | ||
4 | This file is part of Guix. | |
5 | ||
6 | 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 | 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 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 | ||
cc9abfd0 LC |
25 | buildOutOfSourceTree = true; |
26 | succeedOnFailure = true; | |
27 | keepBuildDirectory = true; | |
28 | ||
1c52c42f LC |
29 | # The Guile used to bootstrap the whole thing. It's normally |
30 | # downloaded by the build system, but here we download it via a | |
31 | # fixed-output derivation and stuff it into the build tree. | |
32 | bootstrap_guile = | |
33 | let pkgs = import nixpkgs {}; in { | |
34 | i686 = pkgs.fetchurl { | |
35 | url = http://www.fdn.fr/~lcourtes/software/guix/packages/i686-linux/guile-bootstrap-2.0.6.tar.xz; | |
36 | sha256 = "93b537766dfab3ad287143523751e3ec02dd32d3ccaf88ad2d31c63158f342ee"; | |
37 | }; | |
38 | ||
39 | x86_64 = pkgs.fetchurl { | |
40 | url = http://www.fdn.fr/~lcourtes/software/guix/packages/x86_64-linux/guile-bootstrap-2.0.6.tar.xz; | |
41 | sha256 = "0467a82cbe4136f60a79eb4176011bf88cf28ea19c9ad9defa365811ff8e11cf"; | |
42 | }; | |
43 | }; | |
44 | ||
2152e3c5 LC |
45 | jobs = { |
46 | tarball = | |
47 | let pkgs = import nixpkgs {}; in | |
48 | pkgs.releaseTools.sourceTarball { | |
49 | name = "guix-tarball"; | |
50 | src = <guix>; | |
5fb86803 | 51 | buildInputs = with pkgs; [ guile sqlite bzip2 git libgcrypt ]; |
8587b542 | 52 | buildNativeInputs = with pkgs; [ texinfo gettext cvs pkgconfig ]; |
6cb3ccf8 | 53 | preAutoconf = ''git config submodule.nix.url "${<nix>}"''; |
2152e3c5 | 54 | configureFlags = |
5fb86803 LC |
55 | [ "--with-libgcrypt-prefix=${pkgs.libgcrypt}" |
56 | "--localstatedir=/nix/var/nix" | |
6709752f | 57 | ]; |
2152e3c5 LC |
58 | }; |
59 | ||
60 | build = | |
61 | { system ? builtins.currentSystem }: | |
62 | ||
63 | let pkgs = import nixpkgs { inherit system; }; in | |
64 | pkgs.releaseTools.nixBuild { | |
65 | name = "guix"; | |
5fb86803 | 66 | buildInputs = with pkgs; [ guile sqlite bzip2 libgcrypt ]; |
2152e3c5 LC |
67 | buildNativeInputs = [ pkgs.pkgconfig ]; |
68 | src = jobs.tarball; | |
69 | configureFlags = | |
5fb86803 LC |
70 | [ "--with-libgcrypt-prefix=${pkgs.libgcrypt}" |
71 | "--localstatedir=/nix/var/nix" | |
ad102c46 | 72 | ]; |
2152e3c5 | 73 | |
1c52c42f LC |
74 | preBuild = |
75 | # Use our pre-downloaded bootstrap tarballs instead of letting | |
76 | # the build system download it over and over again. | |
77 | '' mkdir -p distro/packages/bootstrap/{i686,x86_64}-linux | |
78 | cp -v "${bootstrap_guile.i686}" \ | |
79 | distro/packages/bootstrap/i686-linux/guile-bootstrap-2.0.6.tar.xz | |
80 | cp -v "${bootstrap_guile.x86_64}" \ | |
81 | distro/packages/bootstrap/x86_64-linux/guile-bootstrap-2.0.6.tar.xz | |
82 | ''; | |
83 | ||
cc9abfd0 LC |
84 | inherit succeedOnFailure keepBuildDirectory |
85 | buildOutOfSourceTree; | |
2152e3c5 | 86 | }; |
9144af5a LC |
87 | |
88 | ||
b35c0f86 LC |
89 | build_disable_daemon = |
90 | { system ? builtins.currentSystem }: | |
91 | ||
92 | let | |
93 | pkgs = import nixpkgs { inherit system; }; | |
94 | build = jobs.build { inherit system; }; | |
95 | in | |
96 | pkgs.lib.overrideDerivation build ({ configureFlags, ... }: { | |
97 | configureFlags = configureFlags ++ [ "--disable-daemon" ]; | |
98 | buildInputs = with pkgs; [ guile nixUnstable pkgconfig ]; | |
99 | ||
100 | # Since we need to talk to a running daemon, we need to escape | |
101 | # the chroot. | |
102 | preConfigure = "export NIX_REMOTE=daemon"; | |
103 | __noChroot = true; | |
104 | }); | |
105 | ||
9144af5a LC |
106 | # Jobs to test the distro. |
107 | distro = { | |
108 | hello = | |
109 | { system ? builtins.currentSystem }: | |
110 | ||
111 | let | |
112 | pkgs = import nixpkgs { inherit system; }; | |
113 | guix = jobs.build { inherit system; }; | |
114 | in | |
f03da4a0 | 115 | # XXX: We have no way to tell the Nix code to swallow the .drv |
9144af5a LC |
116 | # produced by `guix-build', so we have a pointless indirection |
117 | # here. This could be worked around by generating Nix code | |
118 | # from the .drv, and importing that. | |
119 | pkgs.releaseTools.nixBuild { | |
120 | src = null; | |
48da001f | 121 | name = "guix-hello"; |
9144af5a | 122 | phases = "buildPhase"; |
f03da4a0 | 123 | buildPhase = "${guix}/bin/guix-build --no-substitutes hello | tee $out"; |
9144af5a LC |
124 | __noChroot = true; |
125 | }; | |
126 | }; | |
2152e3c5 LC |
127 | }; |
128 | in | |
129 | jobs |