| 1 | /* GNU Guix --- Functional package management for GNU |
| 2 | Copyright (C) 2012 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 | # 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/20121219/guile-2.0.7.tar.xz; |
| 36 | sha256 = "45d1f9bfb9e4531a8f1c5a105f7ab094cd481b8a179ccc63cbabb73ce6b8437f"; |
| 37 | }; |
| 38 | |
| 39 | x86_64 = pkgs.fetchurl { |
| 40 | url = http://www.fdn.fr/~lcourtes/software/guix/packages/x86_64-linux/20121219/guile-2.0.7.tar.xz; |
| 41 | sha256 = "953fbcc8db6e310626be79b67319cf4141dc23b296447952a99d95425b3a4dc1"; |
| 42 | }; |
| 43 | }; |
| 44 | |
| 45 | jobs = { |
| 46 | tarball = |
| 47 | let pkgs = import nixpkgs {}; in |
| 48 | pkgs.releaseTools.sourceTarball { |
| 49 | name = "guix-tarball"; |
| 50 | src = <guix>; |
| 51 | buildInputs = with pkgs; [ guile sqlite bzip2 git libgcrypt ]; |
| 52 | buildNativeInputs = with pkgs; [ texinfo gettext cvs pkgconfig ]; |
| 53 | preAutoconf = ''git config submodule.nix.url "${<nix>}"''; |
| 54 | configureFlags = |
| 55 | [ "--with-libgcrypt-prefix=${pkgs.libgcrypt}" |
| 56 | "--localstatedir=/nix/var" |
| 57 | ]; |
| 58 | }; |
| 59 | |
| 60 | build = |
| 61 | { system ? builtins.currentSystem }: |
| 62 | |
| 63 | let pkgs = import nixpkgs { inherit system; }; in |
| 64 | pkgs.releaseTools.nixBuild { |
| 65 | name = "guix"; |
| 66 | buildInputs = with pkgs; [ guile sqlite bzip2 libgcrypt ]; |
| 67 | buildNativeInputs = [ pkgs.pkgconfig ]; |
| 68 | src = jobs.tarball; |
| 69 | configureFlags = |
| 70 | [ "--with-libgcrypt-prefix=${pkgs.libgcrypt}" |
| 71 | "--localstatedir=/nix/var" |
| 72 | ]; |
| 73 | |
| 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-2.0.7.tar.xz |
| 80 | cp -v "${bootstrap_guile.x86_64}" \ |
| 81 | distro/packages/bootstrap/x86_64-linux/guile-2.0.7.tar.xz |
| 82 | ''; |
| 83 | |
| 84 | inherit succeedOnFailure keepBuildDirectory |
| 85 | buildOutOfSourceTree; |
| 86 | }; |
| 87 | |
| 88 | |
| 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 | |
| 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 |
| 115 | # XXX: We have no way to tell the Nix code to swallow the .drv |
| 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; |
| 121 | name = "guix-hello"; |
| 122 | phases = "buildPhase"; |
| 123 | buildPhase = "${guix}/bin/guix-build --no-substitutes hello | tee $out"; |
| 124 | __noChroot = true; |
| 125 | }; |
| 126 | }; |
| 127 | }; |
| 128 | in |
| 129 | jobs |