You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

115 lines
4.0 KiB

  1. /* Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
  2. Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
  3. This file is part of Guix.
  4. 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. 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 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/guile-bootstrap-2.0.6.tar.xz;
  28. sha256 = "93b537766dfab3ad287143523751e3ec02dd32d3ccaf88ad2d31c63158f342ee";
  29. };
  30. x86_64 = pkgs.fetchurl {
  31. url = http://www.fdn.fr/~lcourtes/software/guix/packages/x86_64-linux/guile-bootstrap-2.0.6.tar.xz;
  32. sha256 = "0467a82cbe4136f60a79eb4176011bf88cf28ea19c9ad9defa365811ff8e11cf";
  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 ];
  42. buildNativeInputs = with pkgs; [ texinfo gettext cvs pkgconfig ];
  43. configureFlags =
  44. [ "--with-nix-prefix=${pkgs.nix}" ];
  45. };
  46. build =
  47. { system ? builtins.currentSystem }:
  48. let pkgs = import nixpkgs { inherit system; }; in
  49. pkgs.releaseTools.nixBuild {
  50. name = "guix";
  51. buildInputs = [ pkgs.guile ];
  52. buildNativeInputs = [ pkgs.pkgconfig ];
  53. src = jobs.tarball;
  54. configureFlags =
  55. [ "--with-nix-prefix=${pkgs.nix}"
  56. "--with-libgcrypt-prefix=${pkgs.libgcrypt}"
  57. ];
  58. preBuild =
  59. # Use our pre-downloaded bootstrap tarballs instead of letting
  60. # the build system download it over and over again.
  61. '' mkdir -p distro/packages/bootstrap/{i686,x86_64}-linux
  62. cp -v "${bootstrap_guile.i686}" \
  63. distro/packages/bootstrap/i686-linux/guile-bootstrap-2.0.6.tar.xz
  64. cp -v "${bootstrap_guile.x86_64}" \
  65. distro/packages/bootstrap/x86_64-linux/guile-bootstrap-2.0.6.tar.xz
  66. '';
  67. # XXX: Since we need to talk to a running daemon, for the benefit of
  68. # `nixpkgs-derivation*' & co., we need to escape the chroot.
  69. preConfigure = "export NIX_REMOTE=daemon";
  70. __noChroot = true;
  71. inherit succeedOnFailure keepBuildDirectory
  72. buildOutOfSourceTree;
  73. };
  74. # Jobs to test the distro.
  75. distro = {
  76. hello =
  77. { system ? builtins.currentSystem }:
  78. let
  79. pkgs = import nixpkgs { inherit system; };
  80. guix = jobs.build { inherit system; };
  81. in
  82. # XXX: We have no way to tell the Nix code to swallow the .drv
  83. # produced by `guix-build', so we have a pointless indirection
  84. # here. This could be worked around by generating Nix code
  85. # from the .drv, and importing that.
  86. pkgs.releaseTools.nixBuild {
  87. src = null;
  88. name = "guix-hello";
  89. phases = "buildPhase";
  90. buildPhase = "${guix}/bin/guix-build --no-substitutes hello | tee $out";
  91. __noChroot = true;
  92. };
  93. };
  94. };
  95. in
  96. jobs