From d8730fb86facadbef22d3df7f8a743a56e7ed53c Mon Sep 17 00:00:00 2001 From: Ersin Akinci Date: Sun, 20 Oct 2019 19:08:05 -0700 Subject: [PATCH 01/19] Document import syntax --- doc/manual/expressions/builtins.xml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/manual/expressions/builtins.xml b/doc/manual/expressions/builtins.xml index 465fa1e0b001..21da8b87b284 100644 --- a/doc/manual/expressions/builtins.xml +++ b/doc/manual/expressions/builtins.xml @@ -733,13 +733,21 @@ builtins.genList (x: x * x) 5 import path + import + <path> builtins.import path + builtins.import + <path> Load, parse and return the Nix expression in the file path. If path is a directory, the file default.nix - in that directory is loaded. Evaluation aborts if the + in that directory is loaded. If the + <path> syntax is used, the path will be resolved + relative to those listed in the NIX_PATH environment + variable (see the section on NIX_PATH + for details on how the resolution works). Evaluation aborts if the file doesn’t exist or contains an incorrect Nix expression. import implements Nix’s module system: you can put any Nix expression (such as a set or a function) in a From 9be7787ec04d604a4e65a22a6b9ae56567aaf618 Mon Sep 17 00:00:00 2001 From: Ersin Akinci Date: Mon, 21 Oct 2019 13:12:41 -0700 Subject: [PATCH 02/19] Revert "Document import syntax" This reverts commit d8730fb86facadbef22d3df7f8a743a56e7ed53c. --- doc/manual/expressions/builtins.xml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/doc/manual/expressions/builtins.xml b/doc/manual/expressions/builtins.xml index 21da8b87b284..465fa1e0b001 100644 --- a/doc/manual/expressions/builtins.xml +++ b/doc/manual/expressions/builtins.xml @@ -733,21 +733,13 @@ builtins.genList (x: x * x) 5 import path - import - <path> builtins.import path - builtins.import - <path> Load, parse and return the Nix expression in the file path. If path is a directory, the file default.nix - in that directory is loaded. If the - <path> syntax is used, the path will be resolved - relative to those listed in the NIX_PATH environment - variable (see the section on NIX_PATH - for details on how the resolution works). Evaluation aborts if the + in that directory is loaded. Evaluation aborts if the file doesn’t exist or contains an incorrect Nix expression. import implements Nix’s module system: you can put any Nix expression (such as a set or a function) in a From b7a936224ee6e1ad9c842f618bbd5bc1864ebd54 Mon Sep 17 00:00:00 2001 From: Ersin Akinci Date: Mon, 21 Oct 2019 14:11:26 -0700 Subject: [PATCH 03/19] Add hint about path in builtins.import --- doc/manual/expressions/builtins.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/manual/expressions/builtins.xml b/doc/manual/expressions/builtins.xml index 465fa1e0b001..8b53cd57854f 100644 --- a/doc/manual/expressions/builtins.xml +++ b/doc/manual/expressions/builtins.xml @@ -746,6 +746,10 @@ builtins.genList (x: x * x) 5 separate file, and use it from Nix expressions in other files. + Unlike some languages, import is a regular + function in Nix. Paths using the angle bracket syntax (e.g., import <foo>) are normal + values (see ). + A Nix expression loaded by import must not contain any free variables (identifiers that are not defined in the Nix expression itself and are not From f107a270026596e525bdf8df0e2d331783ec4a10 Mon Sep 17 00:00:00 2001 From: Ersin Akinci Date: Mon, 21 Oct 2019 14:16:55 -0700 Subject: [PATCH 04/19] Tweak path hint --- doc/manual/expressions/builtins.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/manual/expressions/builtins.xml b/doc/manual/expressions/builtins.xml index 8b53cd57854f..f39b393bf719 100644 --- a/doc/manual/expressions/builtins.xml +++ b/doc/manual/expressions/builtins.xml @@ -747,7 +747,8 @@ builtins.genList (x: x * x) 5 files. Unlike some languages, import is a regular - function in Nix. Paths using the angle bracket syntax (e.g., import <foo>) are normal + function in Nix. Paths using the angle bracket syntax (e.g., + import <foo>) are normal path values (see ). A Nix expression loaded by import must From c92ea927e508f3c06b6b3ee68e1f0565264cac2c Mon Sep 17 00:00:00 2001 From: Chaz Schlarp Date: Tue, 22 Oct 2019 16:04:49 -0700 Subject: [PATCH 05/19] Remove superfluous IAM action for S3 cache `s3:ListObjects` isn't a real IAM action, but _is_ the name of an S3 API method. `s3:ListBucket` is the relevant action for that method. https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazons3.html --- doc/manual/packages/s3-substituter.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/manual/packages/s3-substituter.xml b/doc/manual/packages/s3-substituter.xml index 1722090efecc..868b5a66dc3c 100644 --- a/doc/manual/packages/s3-substituter.xml +++ b/doc/manual/packages/s3-substituter.xml @@ -159,7 +159,6 @@ the S3 URL: "s3:ListBucket", "s3:ListBucketMultipartUploads", "s3:ListMultipartUploadParts", - "s3:ListObjects", "s3:PutObject" ], "Resource": [ From 2f96a89646c6e55e2f1bbb80805dcbbe60fa94ae Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 23 Oct 2019 21:24:00 +0200 Subject: [PATCH 06/19] install-multi-user.sh: Remove unused variables https://hydra.nixos.org/build/104119659 --- scripts/install-multi-user.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/install-multi-user.sh b/scripts/install-multi-user.sh index d060e5165a8b..13762cba3897 100644 --- a/scripts/install-multi-user.sh +++ b/scripts/install-multi-user.sh @@ -19,9 +19,6 @@ readonly BLUE_UL='\033[38;4;34m' readonly GREEN='\033[38;32m' readonly GREEN_UL='\033[38;4;32m' readonly RED='\033[38;31m' -readonly RED_UL='\033[38;4;31m' -readonly YELLOW='\033[38;33m' -readonly YELLOW_UL='\033[38;4;33m' readonly NIX_USER_COUNT="32" readonly NIX_BUILD_GROUP_ID="30000" From 70cab0587dcbc2d0600c07c96b477a2ea2fcd6f3 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 25 Oct 2019 07:23:05 -0400 Subject: [PATCH 07/19] Switch to nixpkgs 19.09 --- release.nix | 2 +- shell.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/release.nix b/release.nix index 0fe6835186b0..8fcf04680dea 100644 --- a/release.nix +++ b/release.nix @@ -1,5 +1,5 @@ { nix ? builtins.fetchGit ./. -, nixpkgs ? builtins.fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-19.03.tar.gz +, nixpkgs ? builtins.fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-19.09.tar.gz , officialRelease ? false , systems ? [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ] }: diff --git a/shell.nix b/shell.nix index 8167f87a2929..9c504f024e9e 100644 --- a/shell.nix +++ b/shell.nix @@ -1,6 +1,6 @@ { useClang ? false }: -with import (builtins.fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-19.03.tar.gz) {}; +with import (builtins.fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-19.09.tar.gz) {}; with import ./release-common.nix { inherit pkgs; }; From 3a968f5152d6f65ea3d9fdd36df3c188a4e20e24 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 25 Oct 2019 07:28:47 -0400 Subject: [PATCH 08/19] Add Meson and Ninja dependencies --- release-common.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release-common.nix b/release-common.nix index 2e8a951b9cd2..39e3d7fba60b 100644 --- a/release-common.nix +++ b/release-common.nix @@ -50,7 +50,8 @@ rec { buildDeps = [ curl bzip2 xz brotli editline - openssl pkgconfig sqlite boehmgc + meson ninja pkgconfig + openssl sqlite boehmgc boost # Tests From 7ae66bbef5e92f4a0bba49780d8c316f134884f2 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 25 Oct 2019 10:39:02 -0400 Subject: [PATCH 09/19] meson: Define HAVE_STRUCT_DIRENT_D_TYPE macro --- meson.build | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index fac6c4fd30fb..717a0e370318 100644 --- a/meson.build +++ b/meson.build @@ -161,7 +161,8 @@ if (cpp.has_header('sys/ndir.h')) description : 'Define to 1 if you have the header file, and it defines `DIR`') endif -if (cpp.has_header('dirent.h')) +has_dirent_h = cpp.has_header('dirent.h') +if (has_dirent_h) config_h.set( 'HAVE_DIRENT_H', 1, description : 'Define to 1 if you have the header file, and it defines `DIR`') @@ -307,6 +308,23 @@ if meson.get_compiler('cpp').compiles( description : 'Define to 1 if you have the `pubsetbuf` function.') endif + + +# checking data types +#============================================================================ + + +dirent_h_prefix = ''' + #include + #include +''' + +# Code taken from glib, thanks! +if has_dirent_h and meson.get_compiler('cpp').has_member('struct dirent', 'd_type', prefix: dirent_h_prefix) + define = 'HAVE_STRUCT_@0@_@1@'.format('dirent'.to_upper(), 'd_type'.underscorify().to_upper()) + config_h.set(define, 1) +endif + # required dependancies #============================================================================ @@ -549,4 +567,4 @@ project_dirs = [ foreach dir : project_dirs subdir(dir) -endforeach \ No newline at end of file +endforeach From a142164e746644e20f66908c156ca913bef4664f Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 25 Oct 2019 10:39:33 -0400 Subject: [PATCH 10/19] meson: Don't look for libraries in lib dir 1. First of all, this doesn't work in nixpkgs. Per [1], gcc ignores `-L` for purposes of `--print-file-dirs`, which breaks horribly on linux. But if we don't pass extra dirs, meosn first just tries `-l...`, which does work. 2. Even if it did work, `libdir` means where we are installing libs, not where libs are expected to be found. Those are not necessarily the same (again, nixpkgs), and even when they are and non-standard, it is better to use DESTDIR or have a modified toolchain. [1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87758 --- meson.build | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/meson.build b/meson.build index 717a0e370318..0bfdd533c911 100644 --- a/meson.build +++ b/meson.build @@ -346,8 +346,8 @@ tar = find_program('tar', required : true) bzip2 = find_program('bzip2', required : true) gzip = find_program('gzip', required : true) xz = find_program('xz', required : true) -dot = find_program('dot', required : true) -lsof = find_program('lsof', required : true) +dot = find_program('dot', required : false) +lsof = find_program('lsof', required : false) tr = find_program('tr', required : true) coreutils = run_command('dirname', cat.path()).stdout().strip() @@ -377,9 +377,9 @@ description : 'Whether link() works on symlinks') #-------------------------------------------------- boost_dep = declare_dependency( dependencies : [ - cpp.find_library('libboost_system', dirs : libdir), - cpp.find_library('libboost_context', dirs : libdir), - cpp.find_library('libboost_thread', dirs : libdir)], + cpp.find_library('boost_system'), + cpp.find_library('boost_context'), + cpp.find_library('boost_thread')], link_args : get_option('boost_link_args')) if (boost_dep.found()) @@ -406,7 +406,7 @@ libbrotli_dep = declare_dependency( # Look for OpenSSL, a required dependency. #-------------------------------------------------- openssl_dep = declare_dependency( - dependencies: cpp.find_library('libssl', dirs : libdir), + dependencies: cpp.find_library('ssl'), link_args : get_option('openssl_link_args')) @@ -434,14 +434,14 @@ pthread_dep = declare_dependency( # Look for libdl, a required dependency. #-------------------------------------------------- libdl_dep = declare_dependency( - dependencies : cpp.find_library('dl', dirs : libdir), + dependencies : cpp.find_library('dl'), link_args : get_option('dl_link_args')) # Look for libbz2, a required dependency. #-------------------------------------------------- libbz2_dep = declare_dependency( - dependencies : cpp.find_library('bz2', dirs : libdir), + dependencies : cpp.find_library('bz2'), link_args : get_option('bz2_link_args')) @@ -453,7 +453,7 @@ libbz2_dep = declare_dependency( # editline.h when the pkg-config approach fails. editline_dep = declare_dependency( - dependencies : cpp.find_library('libeditline'), + dependencies : cpp.find_library('editline'), link_args : get_option('editline_link_args')) if not ( @@ -476,7 +476,7 @@ endif #-------------------------------------------------- if (get_option('with_libsodium')) libsodium_dep = declare_dependency( - dependencies : cpp.find_library('libsodium', dirs : libdir), + dependencies : cpp.find_library('sodium'), link_args : get_option('sodium_link_args')) config_h.set('HAVE_SODIUM', 1, description : 'Whether to use libsodium for cryptography.') else From 727dc569a7a13b038d550b8c98a79d5928424d9b Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 4 Nov 2019 12:37:24 -0500 Subject: [PATCH 11/19] Remove abstractions in HAVE_STRUCT_DIRENT_D_TYPE code --- meson.build | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/meson.build b/meson.build index a0543d202e01..50d4dfc0c93e 100644 --- a/meson.build +++ b/meson.build @@ -321,10 +321,8 @@ dirent_h_prefix = ''' #include ''' -# Code taken from glib, thanks! if has_dirent_h and meson.get_compiler('cpp').has_member('struct dirent', 'd_type', prefix: dirent_h_prefix) - define = 'HAVE_STRUCT_@0@_@1@'.format('dirent'.to_upper(), 'd_type'.underscorify().to_upper()) - config_h.set(define, 1) + config_h.set('HAVE_STRUCT_DIRENT_D_TYPE', 1) endif # required dependancies From 1be6ab4d3eb4d6b04c322b9ed0a108c2b5354ec5 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 26 Oct 2019 05:16:39 -0400 Subject: [PATCH 12/19] Make libsodium an auto dependency This means do autodetection if the user doesn't specify. --- meson.build | 5 +++-- meson_options.txt | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 50d4dfc0c93e..9e20c499f3ca 100644 --- a/meson.build +++ b/meson.build @@ -474,9 +474,10 @@ endif # Look for libsodium, an optional dependency. #-------------------------------------------------- -if (get_option('with_libsodium')) +libsodium_lib = cpp.find_library('sodium', required: get_option('with_libsodium')) +if (libsodium_lib.found()) libsodium_dep = declare_dependency( - dependencies : cpp.find_library('sodium'), + dependencies : libsodium_lib, link_args : get_option('sodium_link_args')) config_h.set('HAVE_SODIUM', 1, description : 'Whether to use libsodium for cryptography.') else diff --git a/meson_options.txt b/meson_options.txt index 9bad1b2c4c65..8d8e5dab53e1 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -153,8 +153,8 @@ option( option( 'with_libsodium', - type : 'boolean', - value : 'true', + type : 'feature', + value : 'auto', description : 'build nix with shared libs') option( From 90f9f4aef781fc5c3ead8652fc408a431f480905 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 26 Oct 2019 06:27:27 -0400 Subject: [PATCH 13/19] non-existent wrapper depedendency .found() should be false too --- meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 9e20c499f3ca..27c347a59351 100644 --- a/meson.build +++ b/meson.build @@ -481,7 +481,7 @@ if (libsodium_lib.found()) link_args : get_option('sodium_link_args')) config_h.set('HAVE_SODIUM', 1, description : 'Whether to use libsodium for cryptography.') else - libsodium_dep = declare_dependency() + libsodium_dep = dependency('', required: false) endif @@ -495,7 +495,7 @@ if (get_option('with_gc')) 'HAVE_BOEHMGC', 1, description : 'Whether to use the Boehm garbage collector.') else - gc_dep = declare_dependency() + gc_dep = dependency('', required: false) endif From 12ce28bdf21d1f261132bdefe3dac25b1aab7dcc Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 1 Nov 2019 11:23:08 -0400 Subject: [PATCH 14/19] Clean up descriptions in Meson 1. Fix that for libsodium 2. Consistently capitalize --- meson.build | 4 ++-- meson_options.txt | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 27c347a59351..44c858d9d8da 100644 --- a/meson.build +++ b/meson.build @@ -44,7 +44,7 @@ config_h = configuration_data() config_h.set( 'HAVE_CXX17', 1, - description : 'define if the compiler supports basic C++17 syntax') + description : 'Define if the compiler supports basic C++17 syntax') package_name = meson.project_name() config_h.set_quoted( @@ -383,7 +383,7 @@ boost_dep = declare_dependency( link_args : get_option('boost_link_args')) if (boost_dep.found()) - config_h.set('HAVE_BOOST', 1, description : 'define if the Boost library is available.') + config_h.set('HAVE_BOOST', 1, description : 'Define if the Boost library is available.') endif diff --git a/meson_options.txt b/meson_options.txt index 8d8e5dab53e1..96fced7d376d 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -149,19 +149,19 @@ option( 'with_gc', type : 'boolean', value : 'false', - description : 'build nix with Boehm garbage collector') + description : 'Build nix with Boehm garbage collector') option( 'with_libsodium', type : 'feature', value : 'auto', - description : 'build nix with shared libs') + description : 'Build nix with libsodium') option( 'with_s3', type : 'boolean', value : 'false', - description : 'build nix with s3') + description : 'Build nix with s3') option( 'with_coreutils_bin', @@ -182,7 +182,7 @@ option( 'build_shared_libs', type : 'boolean', value : 'false', - description : 'build nix with shared libs') + description : 'Build nix with shared libs') option( 'sandbox_shell', From be144b854a79a2e6c3b2746d29252c7d4447d206 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 4 Nov 2019 13:11:49 -0500 Subject: [PATCH 15/19] Steps towards cross support - `crossSystem` in `shell.nix` - `buildInputs` vs `nativeBuildInputs` --- release-common.nix | 19 ++++++++++++++----- release.nix | 5 ++++- shell.nix | 12 +++++++++--- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/release-common.nix b/release-common.nix index 39e3d7fba60b..39cba173f880 100644 --- a/release-common.nix +++ b/release-common.nix @@ -36,7 +36,7 @@ rec { "--with-sandbox-shell=${sh}/bin/busybox" ]; - tarballDeps = + tarballDeps = with pkgs.buildPackages; [ bison flex libxml2 @@ -47,11 +47,20 @@ rec { autoreconfHook ]; + nativeBuildDeps = [ + pkgconfig + ]; + buildDeps = - [ curl - bzip2 xz brotli editline - meson ninja pkgconfig - openssl sqlite boehmgc + [ + curl + bzip2 + xz + brotli + editline + openssl + sqlite + boehmgc boost # Tests diff --git a/release.nix b/release.nix index 8fcf04680dea..4b43a370069e 100644 --- a/release.nix +++ b/release.nix @@ -23,7 +23,8 @@ let src = nix; inherit officialRelease; - buildInputs = tarballDeps ++ buildDeps; + nativeBuildInputs = tarballDeps ++ nativeBuildDeps; + buildInputs = buildDeps; configureFlags = "--enable-gc"; @@ -65,6 +66,7 @@ let name = "nix"; src = tarball; + nativeBuildInputs = nativeBuildDeps; buildInputs = buildDeps; preConfigure = @@ -196,6 +198,7 @@ let name = "nix-build"; src = tarball; + nativeBuildInputs = nativeBuildDeps; buildInputs = buildDeps; dontInstall = false; diff --git a/shell.nix b/shell.nix index 9c504f024e9e..f22dee6ee9b6 100644 --- a/shell.nix +++ b/shell.nix @@ -1,13 +1,19 @@ -{ useClang ? false }: +{ useClang ? false, crossSystem ? null }: -with import (builtins.fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-19.09.tar.gz) {}; +let + pkgsSrc = builtins.fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-19.09.tar.gz; +in + +with import pkgsSrc { inherit crossSystem; }; with import ./release-common.nix { inherit pkgs; }; (if useClang then clangStdenv else stdenv).mkDerivation { name = "nix"; - buildInputs = buildDeps ++ tarballDeps ++ perlDeps; + nativeBuildInputs = nativeBuildDeps ++ tarballDeps; + + buildInputs = buildDeps ++ perlDeps; inherit configureFlags; From 3db52b8c56f09a7d94ab14a02345731455247fe9 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 25 Oct 2019 05:53:35 -0400 Subject: [PATCH 16/19] Add Meson and Ninja to `nativeBuildDeps` --- release-common.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/release-common.nix b/release-common.nix index 39cba173f880..a77d6948f9d6 100644 --- a/release-common.nix +++ b/release-common.nix @@ -49,6 +49,8 @@ rec { nativeBuildDeps = [ pkgconfig + meson + ninja ]; buildDeps = From 291e1d81535b0f0c4957cde0e1983177d384955d Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 25 Oct 2019 15:37:38 -0400 Subject: [PATCH 17/19] Push `with` deeper in release-common.nix --- release-common.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/release-common.nix b/release-common.nix index a77d6948f9d6..c0ca480e43cc 100644 --- a/release-common.nix +++ b/release-common.nix @@ -1,11 +1,13 @@ { pkgs }: -with pkgs; +let + inherit (pkgs) stdenv lib curl; +in rec { # Use "busybox-sandbox-shell" if present, # if not (legacy) fallback and hope it's sufficient. - sh = pkgs.busybox-sandbox-shell or (busybox.override { + sh = pkgs.busybox-sandbox-shell or (pkgs.busybox.override { useMusl = true; enableStatic = true; enableMinimal = true; @@ -47,13 +49,13 @@ rec { autoreconfHook ]; - nativeBuildDeps = [ + nativeBuildDeps = with pkgs.buildPackages; [ pkgconfig meson ninja ]; - buildDeps = + buildDeps = with pkgs; [ curl bzip2 @@ -84,7 +86,7 @@ rec { */ })); - perlDeps = + perlDeps = with pkgs; [ perl perlPackages.DBDSQLite ]; From cd2e1d10abf80d886b4ebfc52fcc806c687ba14d Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 26 Oct 2019 06:22:30 -0400 Subject: [PATCH 18/19] Add `mesonFlags` to nix code --- release-common.nix | 9 +++++++++ release.nix | 2 ++ shell.nix | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/release-common.nix b/release-common.nix index c0ca480e43cc..1da042d95550 100644 --- a/release-common.nix +++ b/release-common.nix @@ -2,6 +2,10 @@ let inherit (pkgs) stdenv lib curl; + # TODO upstream + mesonFlag = key: value: "-D${key}=${value}"; + mesonBool = feature: cond: mesonFlag feature (if cond then "true" else "false"); + mesonFeature = feature: cond: mesonFlag feature (if cond then "enabled" else "disabled"); in rec { @@ -31,6 +35,11 @@ rec { ''; }); + mesonFlags = [ + (mesonBool "with_gc" true) + (mesonFeature "with_libsodium" stdenv.hostPlatform.isLinux) + ]; + configureFlags = [ "--enable-gc" diff --git a/release.nix b/release.nix index 4b43a370069e..a93fd8275688 100644 --- a/release.nix +++ b/release.nix @@ -82,6 +82,8 @@ let ''} ''; + inherit mesonFlags; + configureFlags = configureFlags ++ [ "--sysconfdir=/etc" ]; diff --git a/shell.nix b/shell.nix index f22dee6ee9b6..f723ca2f8150 100644 --- a/shell.nix +++ b/shell.nix @@ -15,7 +15,7 @@ with import ./release-common.nix { inherit pkgs; }; buildInputs = buildDeps ++ perlDeps; - inherit configureFlags; + inherit mesonFlags configureFlags; enableParallelBuilding = true; From b380f75867d48e6af461513d26803b61250d9c80 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 4 Nov 2019 14:20:15 -0500 Subject: [PATCH 19/19] Clean up libseccomp_dep --- meson.build | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 44c858d9d8da..afa0f3255d51 100644 --- a/meson.build +++ b/meson.build @@ -520,15 +520,16 @@ endif # OS Specific checks #============================================================================ # Look for libsecppomp, required for Linux sandboxing. -libseccomp_dep = '' if sys_name.contains('linux') - libseccomp_dep = dependency('libseccomp', version : '>= 2.3.1', required: false) - if not (libseccomp_dep.found()) - error('Nix requires libseccomp on a linux host system') - endif + libseccomp_dep = dependency( + 'libseccomp', + version : '>= 2.3.1', + not_found_message : 'Nix requires libseccomp on a linux host system') config_h.set( 'HAVE_SECCOMP', 1, - description : 'Whether seccomp is available and should be used for sandboxing.') + description : 'Whether seccomp is available and should be used for sandboxing.') +else + libseccomp_dep = dependency('', required: false) endif if (sys_name.contains('freebsd'))