From 67b1265fb3d38ead5a57fee838405a2d997777c2 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 11 Dec 2018 21:18:22 +0000 Subject: bundlerEnv: ensure dependencies always included Suppose I have a Gemfile like this: source "https://rubygems.org" gem "actioncable" gem "websocket-driver", group: :test The gemset.nix generated by Bundix 2.4.1 will set ActionCable's groups to [ "default" ], and websocket-driver's to [ "test" ]. This means that the generated bundlerEnv wouldn't include websocket-driver unless the test group was included, even though it's required by the default group. This is arguably a bug in Bundix (websocket-driver's groups should probably be [ "default" "test" ] or just [ "default" ]), but there's no reason bundlerEnv should omit dependencies even given such an input -- it won't necessarily come from Bundix, and it would be good for bundlerEnv to do the right thing. To fix this, filterGemset is now a recursive function, that adds dependencies of gems in the group to the filtered gemset until it stabilises on the gems that match the required groups, and all of their recursive dependencies. --- lib/attrsets.nix | 9 +++++++++ lib/default.nix | 4 ++-- lib/fixed-points.nix | 10 ++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/attrsets.nix b/lib/attrsets.nix index 2a1b866dbc5..d374d229f59 100644 --- a/lib/attrsets.nix +++ b/lib/attrsets.nix @@ -94,6 +94,15 @@ rec { attrValues = builtins.attrValues or (attrs: attrVals (attrNames attrs) attrs); + /* Given a set of attribute names, return the set of the corresponding + attributes from the given set. + + Example: + getAttrs [ "a" "b" ] { a = 1; b = 2; c = 3; } + => { a = 1; b = 2; } + */ + getAttrs = names: attrs: genAttrs names (name: attrs.${name}); + /* Collect each attribute named `attr' from a list of attribute sets. Sets that don't contain the named attribute are ignored. diff --git a/lib/default.nix b/lib/default.nix index d7a05fec833..e4e3e7d325a 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -61,10 +61,10 @@ let boolToString mergeAttrs flip mapNullable inNixShell min max importJSON warn info nixpkgsVersion version mod compare splitByAndCompare functionArgs setFunctionArgs isFunction; - inherit (fixedPoints) fix fix' extends composeExtensions + inherit (fixedPoints) fix fix' converge extends composeExtensions makeExtensible makeExtensibleWithCustomName; inherit (attrsets) attrByPath hasAttrByPath setAttrByPath - getAttrFromPath attrVals attrValues catAttrs filterAttrs + getAttrFromPath attrVals attrValues getAttrs catAttrs filterAttrs filterAttrsRecursive foldAttrs collect nameValuePair mapAttrs mapAttrs' mapAttrsToList mapAttrsRecursive mapAttrsRecursiveCond genAttrs isDerivation toDerivation optionalAttrs diff --git a/lib/fixed-points.nix b/lib/fixed-points.nix index 7169c46fcbb..2f818c88de5 100644 --- a/lib/fixed-points.nix +++ b/lib/fixed-points.nix @@ -24,6 +24,16 @@ rec { # for a concrete example. fix' = f: let x = f x // { __unfix__ = f; }; in x; + # Return the fixpoint that `f` converges to when called recursively, starting + # with the input `x`. + # + # nix-repl> converge (x: x / 2) 16 + # 0 + converge = f: x: + if (f x) == x + then x + else converge f (f x); + # Modify the contents of an explicitly recursive attribute set in a way that # honors `self`-references. This is accomplished with a function # -- cgit 1.4.1 From 328fbcff60e9d6838d16b4228ed84d94d35cc18d Mon Sep 17 00:00:00 2001 From: Etienne Laurin Date: Tue, 11 Dec 2018 20:20:29 +0000 Subject: ikos: init at 2.1 --- lib/licenses.nix | 6 ++++ maintainers/maintainer-list.nix | 5 ++++ pkgs/development/tools/analysis/ikos/default.nix | 36 ++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 +++ 4 files changed, 51 insertions(+) create mode 100644 pkgs/development/tools/analysis/ikos/default.nix (limited to 'lib') diff --git a/lib/licenses.nix b/lib/licenses.nix index ed91b5adedb..5ef60b51063 100644 --- a/lib/licenses.nix +++ b/lib/licenses.nix @@ -505,6 +505,12 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec { free = false; }; + nasa13 = spdx { + spdxId = "NASA-1.3"; + fullName = "NASA Open Source Agreement 1.3"; + free = false; + }; + ncsa = spdx { spdxId = "NCSA"; fullName = "University of Illinois/NCSA Open Source License"; diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 93f035447a3..fd6d2efa7d8 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -401,6 +401,11 @@ github = "aszlig"; name = "aszlig"; }; + atnnn = { + email = "etienne@atnnn.com"; + github = "atnnn"; + name = "Etienne Laurin"; + }; auntie = { email = "auntieNeo@gmail.com"; github = "auntie"; diff --git a/pkgs/development/tools/analysis/ikos/default.nix b/pkgs/development/tools/analysis/ikos/default.nix new file mode 100644 index 00000000000..6f3df32f3c0 --- /dev/null +++ b/pkgs/development/tools/analysis/ikos/default.nix @@ -0,0 +1,36 @@ +{ stdenv, lib, fetchFromGitHub, cmake, boost +, gmp, llvm, clang, sqlite, python3 +, ocamlPackages, mpfr, ppl, doxygen, graphviz +}: + +let + python = python3.withPackages (ps: with ps; [ + pygments + ]); +in + +stdenv.mkDerivation rec { + name = "ikos"; + version = "2.1"; + + src = fetchFromGitHub { + owner = "NASA-SW-VnV"; + repo = name; + rev = "v${version}"; + sha256 = "09nf47hpk5w5az4c0hcr5hhwvpz8zg1byyg185542cpzbq1xj8cb"; + }; + + buildInputs = [ cmake boost gmp clang llvm sqlite python + ocamlPackages.apron mpfr ppl doxygen graphviz ]; + + cmakeFlags = "-DAPRON_ROOT=${ocamlPackages.apron}"; + + postBuild = "make doc"; + + meta = with lib; { + homepage = https://github.com/NASA-SW-VnV/ikos; + description = "Static analyzer for C/C++ based on the theory of Abstract Interpretation"; + license = licenses.nasa13; + maintainers = with maintainers; [ atnnn ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 64ef63f55ab..5300a80413d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8713,6 +8713,10 @@ in inherit (perlPackages) XMLSimple; }; + ikos = callPackage ../development/tools/analysis/ikos { + inherit (llvmPackages_7) stdenv clang llvm; + }; + include-what-you-use = callPackage ../development/tools/analysis/include-what-you-use { llvmPackages = llvmPackages_6; }; -- cgit 1.4.1 From 554851e689245b04e79dd0371465d13cdf057a0f Mon Sep 17 00:00:00 2001 From: Jörg Thalheim Date: Tue, 11 Dec 2018 23:48:27 +0000 Subject: platform.emulator: fix non-x86 systems --- lib/systems/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 25df5e17406..9b25052ab88 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -98,7 +98,7 @@ rec { in if final.parsed.kernel.name == pkgs.stdenv.hostPlatform.parsed.kernel.name && (final.parsed.cpu.name == pkgs.stdenv.hostPlatform.parsed.cpu.name || - (final.platform.isi686 && pkgs.stdenv.hostPlatform.isx86_64)) + (final.isi686 && pkgs.stdenv.hostPlatform.isx86_64)) then pkgs.runtimeShell else if final.isWindows then "${wine}/bin/${wine-name}" -- cgit 1.4.1