選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

154 行
5.0 KiB

  1. { lib, stdenv, fetchurl, fetchFromGitHub, perl, curl, bzip2, sqlite, openssl ? null, xz
  2. , pkgconfig, boehmgc, perlPackages, libsodium, aws-sdk-cpp, brotli
  3. , autoreconfHook, autoconf-archive, bison, flex, libxml2, libxslt, docbook5, docbook5_xsl
  4. , libseccomp, busybox-sandbox-shell
  5. , hostPlatform, buildPlatform
  6. , storeDir ? "/nix/store"
  7. , stateDir ? "/nix/var"
  8. , confDir ? "/etc"
  9. }:
  10. let
  11. sh = busybox-sandbox-shell;
  12. common = { name, suffix ? "", src, fromGit ? false }: stdenv.mkDerivation rec {
  13. inherit name src;
  14. version = lib.getVersion name;
  15. is20 = lib.versionAtLeast version "2.0pre";
  16. VERSION_SUFFIX = lib.optionalString fromGit suffix;
  17. outputs = [ "out" "dev" "man" "doc" ];
  18. nativeBuildInputs =
  19. [ pkgconfig ]
  20. ++ lib.optionals (!is20) [ curl perl ]
  21. ++ lib.optionals fromGit [ autoreconfHook autoconf-archive bison flex libxml2 libxslt docbook5 docbook5_xsl ];
  22. buildInputs = [ curl openssl sqlite xz bzip2 ]
  23. ++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
  24. ++ lib.optionals is20 [ brotli ] # Since 1.12
  25. ++ lib.meta.enableIfAvailable libseccomp
  26. ++ lib.optional ((stdenv.isLinux || stdenv.isDarwin) && is20)
  27. (aws-sdk-cpp.override {
  28. apis = ["s3"];
  29. customMemoryManagement = false;
  30. });
  31. propagatedBuildInputs = [ boehmgc ];
  32. # Seems to be required when using std::atomic with 64-bit types
  33. NIX_LDFLAGS = lib.optionalString (stdenv.system == "armv6l-linux") "-latomic";
  34. configureFlags =
  35. [ "--with-store-dir=${storeDir}"
  36. "--localstatedir=${stateDir}"
  37. "--sysconfdir=${confDir}"
  38. "--disable-init-state"
  39. "--enable-gc"
  40. ]
  41. ++ lib.optionals (!is20) [
  42. "--with-dbi=${perlPackages.DBI}/${perl.libPrefix}"
  43. "--with-dbd-sqlite=${perlPackages.DBDSQLite}/${perl.libPrefix}"
  44. "--with-www-curl=${perlPackages.WWWCurl}/${perl.libPrefix}"
  45. ] ++ lib.optionals (is20 && stdenv.isLinux) [
  46. "--with-sandbox-shell=${sh}/bin/busybox"
  47. ]
  48. ++ lib.optional (
  49. hostPlatform != buildPlatform && hostPlatform ? nix && hostPlatform.nix ? system
  50. ) ''--with-system=${hostPlatform.nix.system}''
  51. # RISC-V support in progress https://github.com/seccomp/libseccomp/pull/50
  52. ++ lib.optional (!libseccomp.meta.available) "--disable-seccomp-sandboxing";
  53. makeFlags = "profiledir=$(out)/etc/profile.d";
  54. installFlags = "sysconfdir=$(out)/etc";
  55. doInstallCheck = true; # not cross
  56. # socket path becomes too long otherwise
  57. preInstallCheck = lib.optional stdenv.isDarwin "export TMPDIR=/tmp";
  58. separateDebugInfo = stdenv.isLinux;
  59. enableParallelBuilding = true;
  60. meta = {
  61. description = "Powerful package manager that makes package management reliable and reproducible";
  62. longDescription = ''
  63. Nix is a powerful package manager for Linux and other Unix systems that
  64. makes package management reliable and reproducible. It provides atomic
  65. upgrades and rollbacks, side-by-side installation of multiple versions of
  66. a package, multi-user package management and easy setup of build
  67. environments.
  68. '';
  69. homepage = https://nixos.org/;
  70. license = stdenv.lib.licenses.lgpl2Plus;
  71. maintainers = [ stdenv.lib.maintainers.eelco ];
  72. platforms = stdenv.lib.platforms.all;
  73. outputsToInstall = [ "out" "man" ];
  74. };
  75. passthru = { inherit fromGit; };
  76. };
  77. perl-bindings = { nix }: stdenv.mkDerivation {
  78. name = "nix-perl-" + nix.version;
  79. inherit (nix) src;
  80. postUnpack = "sourceRoot=$sourceRoot/perl";
  81. nativeBuildInputs =
  82. [ perl pkgconfig curl nix libsodium ]
  83. ++ lib.optionals nix.fromGit [ autoreconfHook autoconf-archive ];
  84. configureFlags =
  85. [ "--with-dbi=${perlPackages.DBI}/${perl.libPrefix}"
  86. "--with-dbd-sqlite=${perlPackages.DBDSQLite}/${perl.libPrefix}"
  87. ];
  88. preConfigure = "export NIX_STATE_DIR=$TMPDIR";
  89. preBuild = "unset NIX_INDENT_MAKE";
  90. };
  91. in rec {
  92. nix = nixStable;
  93. nix1 = (common rec {
  94. name = "nix-1.11.16";
  95. src = fetchurl {
  96. url = "http://nixos.org/releases/nix/${name}/${name}.tar.xz";
  97. sha256 = "0ca5782fc37d62238d13a620a7b4bff6a200bab1bd63003709249a776162357c";
  98. };
  99. }) // { perl-bindings = nixStable; };
  100. nixStable = (common rec {
  101. name = "nix-2.0";
  102. src = fetchurl {
  103. url = "http://nixos.org/releases/nix/${name}/${name}.tar.xz";
  104. sha256 = "7024d327314bf92c1d3e6cccd944929828a44b24093954036bfb0115a92f5a14";
  105. };
  106. }) // { perl-bindings = perl-bindings { nix = nixStable; }; };
  107. nixUnstable = nix;
  108. /*
  109. nixUnstable = (lib.lowPrio (common rec {
  110. name = "nix-2.0${suffix}";
  111. suffix = "pre5968_a6c0b773";
  112. src = fetchFromGitHub {
  113. owner = "NixOS";
  114. repo = "nix";
  115. rev = "a6c0b773b72d4e30690e01f1f1dcffc28f2d9ea1";
  116. sha256 = "0i8wcblcjw3291ba6ki4llw3fgm8ylp9q52kajkyr58dih537346";
  117. };
  118. fromGit = true;
  119. })) // { perl-bindings = perl-bindings { nix = nixUnstable; }; };
  120. */
  121. }