Factor out commonality between release.nix and shell.nix

This commit is contained in:
Eelco Dolstra 2018-03-14 19:11:13 +01:00
parent ca14b14200
commit c04bca3401
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
3 changed files with 43 additions and 48 deletions

View file

@ -1,9 +1,11 @@
{ pkgs }: { pkgs }:
with pkgs;
rec { rec {
# Use "busybox-sandbox-shell" if present, # Use "busybox-sandbox-shell" if present,
# if not (legacy) fallback and hope it's sufficient. # if not (legacy) fallback and hope it's sufficient.
sh = pkgs.busybox-sandbox-shell or (pkgs.busybox.override { sh = pkgs.busybox-sandbox-shell or (busybox.override {
useMusl = true; useMusl = true;
enableStatic = true; enableStatic = true;
enableMinimal = true; enableMinimal = true;
@ -30,7 +32,41 @@ rec {
configureFlags = configureFlags =
[ "--disable-init-state" [ "--disable-init-state"
"--enable-gc" "--enable-gc"
] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [ ] ++ lib.optionals stdenv.isLinux [
"--with-sandbox-shell=${sh}/bin/busybox" "--with-sandbox-shell=${sh}/bin/busybox"
]; ];
tarballDeps =
[ bison
flex
libxml2
libxslt
docbook5
docbook5_xsl
autoconf-archive
autoreconfHook
];
buildDeps =
[ curl
bzip2 xz brotli
openssl pkgconfig sqlite boehmgc
boost
# Tests
git
mercurial
]
++ lib.optional stdenv.isLinux libseccomp
++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
++ lib.optional (stdenv.isLinux || stdenv.isDarwin)
(aws-sdk-cpp.override {
apis = ["s3"];
customMemoryManagement = false;
});
perlDeps =
[ perl
perlPackages.DBDSQLite
];
} }

View file

@ -14,6 +14,8 @@ let
tarball = tarball =
with pkgs; with pkgs;
with import ./release-common.nix { inherit pkgs; };
releaseTools.sourceTarball { releaseTools.sourceTarball {
name = "nix-tarball"; name = "nix-tarball";
version = builtins.readFile ./version; version = builtins.readFile ./version;
@ -21,13 +23,7 @@ let
src = nix; src = nix;
inherit officialRelease; inherit officialRelease;
buildInputs = buildInputs = tarballDeps ++ buildDeps;
[ curl bison flex libxml2 libxslt
bzip2 xz brotli
pkgconfig sqlite libsodium boehmgc
docbook5 docbook5_xsl
autoconf-archive
] ++ lib.optional stdenv.isLinux libseccomp;
configureFlags = "--enable-gc"; configureFlags = "--enable-gc";
@ -67,23 +63,7 @@ let
name = "nix"; name = "nix";
src = tarball; src = tarball;
buildInputs = buildInputs = buildDeps;
[ curl
bzip2 xz brotli
openssl pkgconfig sqlite boehmgc
boost
# Tests
git
mercurial
]
++ lib.optional stdenv.isLinux libseccomp
++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
++ lib.optional (stdenv.isLinux || stdenv.isDarwin)
(aws-sdk-cpp.override {
apis = ["s3"];
customMemoryManagement = false;
});
configureFlags = configureFlags ++ configureFlags = configureFlags ++
[ "--sysconfdir=/etc" ]; [ "--sysconfdir=/etc" ];

View file

@ -7,28 +7,7 @@ with import ./release-common.nix { inherit pkgs; };
(if useClang then clangStdenv else stdenv).mkDerivation { (if useClang then clangStdenv else stdenv).mkDerivation {
name = "nix"; name = "nix";
buildInputs = buildInputs = buildDeps ++ tarballDeps ++ perlDeps;
[ curl bison flex libxml2 libxslt
bzip2 xz brotli
pkgconfig sqlite libsodium boehmgc
docbook5 docbook5_xsl
autoconf-archive
(aws-sdk-cpp.override {
apis = ["s3"];
customMemoryManagement = false;
})
autoreconfHook
boost
# For nix-perl
perl
perlPackages.DBDSQLite
# Tests
git
mercurial
]
++ lib.optional stdenv.isLinux libseccomp;
inherit configureFlags; inherit configureFlags;