release.nix 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /* GNU Guix --- Functional package management for GNU
  2. Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
  3. This file is part of GNU Guix.
  4. GNU Guix is free software; you can redistribute it and/or modify it
  5. under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or (at
  7. your option) any later version.
  8. GNU Guix is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. */
  14. /* Release file to build Guix with Nix. Useful to bootstrap Guix on
  15. Guix-enabled Hydra instances. */
  16. let
  17. nixpkgs = <nixpkgs>;
  18. buildOutOfSourceTree = true;
  19. succeedOnFailure = true;
  20. keepBuildDirectory = true;
  21. # The Guile used to bootstrap the whole thing. It's normally
  22. # downloaded by the build system, but here we download it via a
  23. # fixed-output derivation and stuff it into the build tree.
  24. bootstrap_guile =
  25. let pkgs = import nixpkgs {}; in {
  26. i686 = pkgs.fetchurl {
  27. url = http://www.fdn.fr/~lcourtes/software/guix/packages/i686-linux/20121219/guile-2.0.7.tar.xz;
  28. sha256 = "45d1f9bfb9e4531a8f1c5a105f7ab094cd481b8a179ccc63cbabb73ce6b8437f";
  29. };
  30. x86_64 = pkgs.fetchurl {
  31. url = http://www.fdn.fr/~lcourtes/software/guix/packages/x86_64-linux/20121219/guile-2.0.7.tar.xz;
  32. sha256 = "953fbcc8db6e310626be79b67319cf4141dc23b296447952a99d95425b3a4dc1";
  33. };
  34. };
  35. jobs = {
  36. tarball =
  37. let pkgs = import nixpkgs {}; in
  38. pkgs.releaseTools.sourceTarball {
  39. name = "guix-tarball";
  40. src = <guix>;
  41. buildInputs = with pkgs; [ guile sqlite bzip2 git libgcrypt ];
  42. buildNativeInputs = with pkgs; [ texinfo gettext cvs pkgconfig ];
  43. preAutoconf = ''git config submodule.nix.url "${<nix>}"'';
  44. configureFlags =
  45. [ "--with-libgcrypt-prefix=${pkgs.libgcrypt}"
  46. "--localstatedir=/nix/var"
  47. ];
  48. };
  49. build =
  50. { system ? builtins.currentSystem }:
  51. let pkgs = import nixpkgs { inherit system; }; in
  52. pkgs.releaseTools.nixBuild {
  53. name = "guix";
  54. buildInputs = with pkgs; [ guile sqlite bzip2 libgcrypt ];
  55. buildNativeInputs = [ pkgs.pkgconfig ];
  56. src = jobs.tarball;
  57. configureFlags =
  58. [ "--with-libgcrypt-prefix=${pkgs.libgcrypt}"
  59. "--localstatedir=/nix/var"
  60. ];
  61. preBuild =
  62. # Use our pre-downloaded bootstrap tarballs instead of letting
  63. # the build system download it over and over again.
  64. '' mkdir -p distro/packages/bootstrap/{i686,x86_64}-linux
  65. cp -v "${bootstrap_guile.i686}" \
  66. distro/packages/bootstrap/i686-linux/guile-2.0.7.tar.xz
  67. cp -v "${bootstrap_guile.x86_64}" \
  68. distro/packages/bootstrap/x86_64-linux/guile-2.0.7.tar.xz
  69. '';
  70. inherit succeedOnFailure keepBuildDirectory
  71. buildOutOfSourceTree;
  72. };
  73. build_disable_daemon =
  74. { system ? builtins.currentSystem }:
  75. let
  76. pkgs = import nixpkgs { inherit system; };
  77. build = jobs.build { inherit system; };
  78. in
  79. pkgs.lib.overrideDerivation build ({ configureFlags, ... }: {
  80. configureFlags = configureFlags ++ [ "--disable-daemon" ];
  81. buildInputs = with pkgs; [ guile nixUnstable pkgconfig ];
  82. # Since we need to talk to a running daemon, we need to escape
  83. # the chroot.
  84. preConfigure = "export NIX_REMOTE=daemon";
  85. __noChroot = true;
  86. });
  87. # Jobs to test the distro.
  88. distro = {
  89. hello =
  90. { system ? builtins.currentSystem }:
  91. let
  92. pkgs = import nixpkgs { inherit system; };
  93. guix = jobs.build { inherit system; };
  94. in
  95. # XXX: We have no way to tell the Nix code to swallow the .drv
  96. # produced by `guix-build', so we have a pointless indirection
  97. # here. This could be worked around by generating Nix code
  98. # from the .drv, and importing that.
  99. pkgs.releaseTools.nixBuild {
  100. src = null;
  101. name = "guix-hello";
  102. phases = "buildPhase";
  103. buildPhase = "${guix}/bin/guix-build --no-substitutes hello | tee $out";
  104. __noChroot = true;
  105. };
  106. };
  107. };
  108. in
  109. jobs