Mirror of GNU Guix
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.

116 lines
4.1 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. "--with-libgcrypt-prefix=${pkgs.libgcrypt}"
  46. ];
  47. };
  48. build =
  49. { system ? builtins.currentSystem }:
  50. let pkgs = import nixpkgs { inherit system; }; in
  51. pkgs.releaseTools.nixBuild {
  52. name = "guix";
  53. buildInputs = [ pkgs.guile ];
  54. buildNativeInputs = [ pkgs.pkgconfig ];
  55. src = jobs.tarball;
  56. configureFlags =
  57. [ "--with-nix-prefix=${pkgs.nix}"
  58. "--with-libgcrypt-prefix=${pkgs.libgcrypt}"
  59. ];
  60. preBuild =
  61. # Use our pre-downloaded bootstrap tarballs instead of letting
  62. # the build system download it over and over again.
  63. '' mkdir -p distro/packages/bootstrap/{i686,x86_64}-linux
  64. cp -v "${bootstrap_guile.i686}" \
  65. distro/packages/bootstrap/i686-linux/guile-bootstrap-2.0.6.tar.xz
  66. cp -v "${bootstrap_guile.x86_64}" \
  67. distro/packages/bootstrap/x86_64-linux/guile-bootstrap-2.0.6.tar.xz
  68. '';
  69. # XXX: Since we need to talk to a running daemon, for the benefit of
  70. # `nixpkgs-derivation*' & co., we need to escape the chroot.
  71. preConfigure = "export NIX_REMOTE=daemon";
  72. __noChroot = true;
  73. inherit succeedOnFailure keepBuildDirectory
  74. buildOutOfSourceTree;
  75. };
  76. # Jobs to test the distro.
  77. distro = {
  78. hello =
  79. { system ? builtins.currentSystem }:
  80. let
  81. pkgs = import nixpkgs { inherit system; };
  82. guix = jobs.build { inherit system; };
  83. in
  84. # XXX: We have no way to tell the Nix code to swallow the .drv
  85. # produced by `guix-build', so we have a pointless indirection
  86. # here. This could be worked around by generating Nix code
  87. # from the .drv, and importing that.
  88. pkgs.releaseTools.nixBuild {
  89. src = null;
  90. name = "guix-hello";
  91. phases = "buildPhase";
  92. buildPhase = "${guix}/bin/guix-build --no-substitutes hello | tee $out";
  93. __noChroot = true;
  94. };
  95. };
  96. };
  97. in
  98. jobs