Merge branch 'master' into cross-compiling-postgresql

This commit is contained in:
Ding Xiang Fei 2018-07-27 14:13:12 +08:00
commit a33d4ed984
18 changed files with 252 additions and 88 deletions

View File

@ -424,7 +424,7 @@ available.
At some point you'll likely have multiple packages which you would
like to be able to use in different projects. In order to minimise unnecessary
duplication we now look at how you can maintain yourself a repository with your
duplication we now look at how you can maintain a repository with your
own packages. The important functions here are `import` and `callPackage`.
### Including a derivation using `callPackage`
@ -647,7 +647,7 @@ in python.withPackages(ps: [ps.blaze])).env
The `buildPythonApplication` function is practically the same as `buildPythonPackage`.
The difference is that `buildPythonPackage` by default prefixes the names of the packages with the version of the interpreter.
Because with an application we're not interested in multiple version the prefix is dropped.
Because this is irrelevant for applications, the prefix is omitted.
#### `toPythonApplication` function
@ -1021,7 +1021,7 @@ If you need to change a package's attribute(s) from `configuration.nix` you coul
};
```
`pythonPackages.zerobin` is now globally overriden. All packages and also the
`pythonPackages.zerobin` is now globally overridden. All packages and also the
`zerobin` NixOS service use the new definition.
Note that `python-super` refers to the old package set and `python-self`
to the new, overridden version.

View File

@ -16,6 +16,7 @@ rec {
isAarch64 = { cpu = { family = "arm"; bits = 64; }; };
isMips = { cpu = { family = "mips"; }; };
isRiscV = { cpu = { family = "riscv"; }; };
isSparc = { cpu = { family = "sparc"; }; };
isWasm = { cpu = { family = "wasm"; }; };
is32bit = { cpu = { bits = 32; }; };

View File

@ -93,6 +93,9 @@ rec {
riscv32 = { bits = 32; significantByte = littleEndian; family = "riscv"; };
riscv64 = { bits = 64; significantByte = littleEndian; family = "riscv"; };
sparc = { bits = 32; significantByte = bigEndian; family = "sparc"; };
sparc64 = { bits = 64; significantByte = bigEndian; family = "sparc"; };
wasm32 = { bits = 32; significantByte = littleEndian; family = "wasm"; };
wasm64 = { bits = 64; significantByte = littleEndian; family = "wasm"; };
};

View File

@ -1,43 +1,9 @@
{ lib }:
let
zipIntBits = f: x: y:
let
# (intToBits 6) -> [ 0 1 1 ]
intToBits = x:
if x == 0 || x == -1 then
[]
else
let
headbit = if (x / 2) * 2 != x then 1 else 0; # x & 1
tailbits = if x < 0 then ((x + 1) / 2) - 1 else x / 2; # x >> 1
in
[headbit] ++ (intToBits tailbits);
# (bitsToInt [ 0 1 1 ] 0) -> 6
# (bitsToInt [ 0 1 0 ] 1) -> -6
bitsToInt = l: signum:
if l == [] then
(if signum == 0 then 0 else -1)
else
(builtins.head l) + (2 * (bitsToInt (builtins.tail l) signum));
xsignum = if x < 0 then 1 else 0;
ysignum = if y < 0 then 1 else 0;
zipListsWith' = fst: snd:
if fst==[] && snd==[] then
[]
else if fst==[] then
[(f xsignum (builtins.head snd))] ++ (zipListsWith' [] (builtins.tail snd))
else if snd==[] then
[(f (builtins.head fst) ysignum )] ++ (zipListsWith' (builtins.tail fst) [] )
else
[(f (builtins.head fst) (builtins.head snd))] ++ (zipListsWith' (builtins.tail fst) (builtins.tail snd));
in
assert (builtins.isInt x) && (builtins.isInt y);
bitsToInt (zipListsWith' (intToBits x) (intToBits y)) (f xsignum ysignum);
in
rec {
## Simple (higher order) functions
/* The identity function
For when you need a function that does nothing.
@ -59,7 +25,7 @@ rec {
## Named versions corresponding to some builtin operators.
/* Concat two strings */
/* Concatenate two lists */
concat = x: y: x ++ y;
/* boolean or */
@ -69,13 +35,19 @@ rec {
and = x: y: x && y;
/* bitwise and */
bitAnd = builtins.bitAnd or zipIntBits (a: b: if a==1 && b==1 then 1 else 0);
bitAnd = builtins.bitAnd
or import ./zip-int-bits.nix
(a: b: if a==1 && b==1 then 1 else 0);
/* bitwise or */
bitOr = builtins.bitOr or zipIntBits (a: b: if a==1 || b==1 then 1 else 0);
bitOr = builtins.bitOr
or import ./zip-int-bits.nix
(a: b: if a==1 || b==1 then 1 else 0);
/* bitwise xor */
bitXor = builtins.bitXor or zipIntBits (a: b: if a!=b then 1 else 0);
bitXor = builtins.bitXor
or import ./zip-int-bits.nix
(a: b: if a!=b then 1 else 0);
/* bitwise not */
bitNot = builtins.sub (-1);
@ -93,10 +65,22 @@ rec {
*/
mergeAttrs = x: y: x // y;
# Flip the order of the arguments of a binary function.
/* Flip the order of the arguments of a binary function.
Example:
flip concat [1] [2]
=> [ 2 1 ]
*/
flip = f: a: b: f b a;
# Apply function if argument is non-null
/* Apply function if argument is non-null.
Example:
mapNullable (x: x+1) null
=> null
mapNullable (x: x+1) 22
=> 23
*/
mapNullable = f: a: if isNull a then a else f a;
# Pull in some builtins not included elsewhere.
@ -105,20 +89,30 @@ rec {
isInt isFloat add sub lessThan
seq deepSeq genericClosure;
inherit (lib.strings) fileContents;
release = fileContents ../.version;
versionSuffix = let suffixFile = ../.version-suffix; in
if pathExists suffixFile then fileContents suffixFile else "pre-git";
## nixpks version strings
# Return the Nixpkgs version number.
# The current full nixpkgs version number.
version = release + versionSuffix;
# The current nixpkgs version number as string.
release = lib.strings.fileContents ../.version;
# The current nixpkgs version suffix as string.
versionSuffix =
let suffixFile = ../.version-suffix;
in if pathExists suffixFile
then lib.strings.fileContents suffixFile
else "pre-git";
nixpkgsVersion = builtins.trace "`lib.nixpkgsVersion` is deprecated, use `lib.version` instead!" version;
# Whether we're being called by nix-shell.
inNixShell = builtins.getEnv "IN_NIX_SHELL" != "";
## Integer operations
# Return minimum/maximum of two numbers.
min = x: y: if x < y then x else y;
max = x: y: if x > y then x else y;
@ -133,6 +127,9 @@ rec {
*/
mod = base: int: base - (int * (builtins.div base int));
## Comparisons
/* C-style comparisons
a < b, compare a b => -1
@ -162,17 +159,20 @@ rec {
cmp "fooa" "a" => -1
# while
compare "fooa" "a" => 1
*/
splitByAndCompare = p: yes: no: a: b:
if p a
then if p b then yes a b else -1
else if p b then 1 else no a b;
/* Reads a JSON file. */
importJSON = path:
builtins.fromJSON (builtins.readFile path);
## Warnings and asserts
/* See https://github.com/NixOS/nix/issues/749. Eventually we'd like these
to expand to Nix builtins that carry metadata so that Nix can filter out
the INFO messages without parsing the message string.
@ -188,28 +188,36 @@ rec {
warn = msg: builtins.trace "WARNING: ${msg}";
info = msg: builtins.trace "INFO: ${msg}";
# | Add metadata about expected function arguments to a function.
# The metadata should match the format given by
# builtins.functionArgs, i.e. a set from expected argument to a bool
# representing whether that argument has a default or not.
# setFunctionArgs : (a → b) → Map String Bool → (a → b)
#
# This function is necessary because you can't dynamically create a
# function of the { a, b ? foo, ... }: format, but some facilities
# like callPackage expect to be able to query expected arguments.
## Function annotations
/* Add metadata about expected function arguments to a function.
The metadata should match the format given by
builtins.functionArgs, i.e. a set from expected argument to a bool
representing whether that argument has a default or not.
setFunctionArgs : (a b) Map String Bool (a b)
This function is necessary because you can't dynamically create a
function of the { a, b ? foo, ... }: format, but some facilities
like callPackage expect to be able to query expected arguments.
*/
setFunctionArgs = f: args:
{ # TODO: Should we add call-time "type" checking like built in?
__functor = self: f;
__functionArgs = args;
};
# | Extract the expected function arguments from a function.
# This works both with nix-native { a, b ? foo, ... }: style
# functions and functions with args set with 'setFunctionArgs'. It
# has the same return type and semantics as builtins.functionArgs.
# setFunctionArgs : (a → b) → Map String Bool.
/* Extract the expected function arguments from a function.
This works both with nix-native { a, b ? foo, ... }: style
functions and functions with args set with 'setFunctionArgs'. It
has the same return type and semantics as builtins.functionArgs.
setFunctionArgs : (a b) Map String Bool.
*/
functionArgs = f: f.__functionArgs or (builtins.functionArgs f);
/* Check whether something is a function or something
annotated with function args.
*/
isFunction = f: builtins.isFunction f ||
(f ? __functor && isFunction (f.__functor f));
}

39
lib/zip-int-bits.nix Normal file
View File

@ -0,0 +1,39 @@
/* Helper function to implement a fallback for the bit operators
`bitAnd`, `bitOr` and `bitXOr` on older nix version.
See ./trivial.nix
*/
f: x: y:
let
# (intToBits 6) -> [ 0 1 1 ]
intToBits = x:
if x == 0 || x == -1 then
[]
else
let
headbit = if (x / 2) * 2 != x then 1 else 0; # x & 1
tailbits = if x < 0 then ((x + 1) / 2) - 1 else x / 2; # x >> 1
in
[headbit] ++ (intToBits tailbits);
# (bitsToInt [ 0 1 1 ] 0) -> 6
# (bitsToInt [ 0 1 0 ] 1) -> -6
bitsToInt = l: signum:
if l == [] then
(if signum == 0 then 0 else -1)
else
(builtins.head l) + (2 * (bitsToInt (builtins.tail l) signum));
xsignum = if x < 0 then 1 else 0;
ysignum = if y < 0 then 1 else 0;
zipListsWith' = fst: snd:
if fst==[] && snd==[] then
[]
else if fst==[] then
[(f xsignum (builtins.head snd))] ++ (zipListsWith' [] (builtins.tail snd))
else if snd==[] then
[(f (builtins.head fst) ysignum )] ++ (zipListsWith' (builtins.tail fst) [] )
else
[(f (builtins.head fst) (builtins.head snd))] ++ (zipListsWith' (builtins.tail fst) (builtins.tail snd));
in
assert (builtins.isInt x) && (builtins.isInt y);
bitsToInt (zipListsWith' (intToBits x) (intToBits y)) (f xsignum ysignum)

View File

@ -589,6 +589,11 @@
github = "c0bw3b";
name = "Renaud";
};
c0deaddict = {
email = "josvanbakel@protonmail.com";
github = "c0deaddict";
name = "Jos van Bakel";
};
c0dehero = {
email = "codehero@nerdpol.ch";
name = "CodeHero";

View File

@ -555,12 +555,12 @@ rec {
spotbugs = buildEclipseUpdateSite rec {
name = "spotbugs-${version}";
version = "3.1.5";
version = "3.1.6";
src = fetchzip {
stripRoot = false;
url = "https://github.com/spotbugs/spotbugs/releases/download/${version}/eclipsePlugin.zip";
sha256 = "0fxdirz6ik9rqykm2lcr720apsaqgngr4c7q793rjb9b3bn30c85";
sha256 = "1qsams12n64slp00nfc9v943sy9bzffzm7anqqaz2hjw64iia7fh";
};
meta = with stdenv.lib; {

View File

@ -94,6 +94,14 @@ self:
# Expects bash to be at /bin/bash
helm-rtags = markBroken super.helm-rtags;
# Build same version as Haskell package
hindent = super.hindent.overrideAttrs (attrs: {
version = external.hindent.version;
src = external.hindent.src;
packageRequires = [ self.haskell-mode ];
propagatedUserEnvPkgs = [ external.hindent ];
});
# upstream issue: missing file header
ido-complete-space-or-hyphen = markBroken super.ido-complete-space-or-hyphen;

View File

@ -108,6 +108,14 @@ self:
# Expects bash to be at /bin/bash
helm-rtags = markBroken super.helm-rtags;
# Build same version as Haskell package
hindent = super.hindent.overrideAttrs (attrs: {
version = external.hindent.version;
src = external.hindent.src;
packageRequires = [ self.haskell-mode ];
propagatedUserEnvPkgs = [ external.hindent ];
});
# upstream issue: missing file header
ido-complete-space-or-hyphen = markBroken super.ido-complete-space-or-hyphen;

View File

@ -0,0 +1,48 @@
{ stdenv, fetchFromGitHub, makeWrapper, perl, perlPackages }: stdenv.mkDerivation rec {
name = "sieve-connect-${version}";
version = "0.89";
src = fetchFromGitHub {
owner = "philpennock";
repo = "sieve-connect";
rev = "v${version}";
sha256 = "0g7cv29wd5673inl4c87xb802k86bj6gcwh131xrbbg0a0g1c8fp";
};
buildInputs = [ perl ];
nativeBuildInputs = [ makeWrapper ];
preBuild = ''
# Fixes failing build when not building in git repo
mkdir .git
touch .git/HEAD
echo "${version}" > versionfile
echo "$(date +%Y-%m-%d)" > datefile
'';
buildFlags = [ "PERL5LIB=${stdenv.lib.makePerlPath [ perlPackages.FileSlurp ]}" "bin" "man" ];
installPhase = ''
mkdir -p $out/bin $out/share/man/man1
install -m 755 sieve-connect $out/bin
gzip -c sieve-connect.1 > $out/share/man/man1/sieve-connect.1.gz
wrapProgram $out/bin/sieve-connect \
--prefix PERL5LIB : "${stdenv.lib.makePerlPath (with perlPackages; [
AuthenSASL Socket6 IOSocketInet6 IOSocketSSL NetSSLeay NetDNS PodUsage
TermReadKey TermReadLineGnu ])}"
'';
meta = with stdenv.lib; {
description = "A client for the MANAGESIEVE Protocol";
longDescription = ''
This is sieve-connect. A client for the ManageSieve protocol,
as specifed in RFC 5804. Historically, this was MANAGESIEVE as
implemented by timsieved in Cyrus IMAP.
'';
homepage = https://github.com/philpennock/sieve-connect;
license = licenses.bsd3;
platforms = platforms.unix;
maintainers = with maintainers; [ das_j ];
};
}

View File

@ -185,6 +185,8 @@ stdenv.mkDerivation {
"mips64" = "btsmip";
"mips64el" = "ltsmip";
}.${targetPlatform.parsed.cpu.name}
else if targetPlatform.isPowerPC then "powerpc"
else if targetPlatform.isSparc then "sparc"
else throw "unknown emulation for platform: " + targetPlatform.config;
in targetPlatform.platform.bfdEmulation or (fmt + sep + arch);

View File

@ -0,0 +1,19 @@
{ buildPythonPackage, fetchPypi, lib }:
buildPythonPackage rec {
pname = "rfc7464";
version = "17.7.0";
src = fetchPypi {
inherit pname version;
sha256 = "1hcn6h38qplfcmq392cs58r01k16k202bqyap4br02376pr4ik7a";
extension = "zip";
};
meta = with lib; {
homepage = https://github.com/moshez/rfc7464;
description = "RFC 7464 is a proposed standard for streaming JSON documents.";
license = [ licenses.mit ];
maintainers = with maintainers; [ shlevy ];
};
}

View File

@ -206,6 +206,13 @@ in
buildFlags = [ "--with-system-v8=true" ];
};
libxml-ruby = attrs: {
buildFlags = [
"--with-xml2-lib=${libxml2.out}/lib"
"--with-xml2-include=${libxml2.dev}/include/libxml2"
];
};
msgpack = attrs: {
buildInputs = [ libmsgpack ];
};
@ -395,4 +402,8 @@ in
'';
};
zookeeper = attrs: {
buildInputs = stdenv.lib.optionals stdenv.isDarwin [ darwin.cctools ];
};
}

View File

@ -0,0 +1,20 @@
{ lib, buildPythonApplication, fetchPypi, pyserial, pyudev }:
buildPythonApplication rec {
pname = "rshell";
version = "0.0.14";
src = fetchPypi {
inherit pname version;
sha256 = "12gh9l13lwnlp330jl3afy3wgfkpjvdxr43flrg9k9kyyhbr191g";
};
propagatedBuildInputs = [ pyserial pyudev ];
meta = with lib; {
homepage = https://github.com/dhylands/rshell;
description = "Remote Shell for MicroPython";
license = licenses.mit;
maintainers = with maintainers; [ c0deaddict ];
};
}

View File

@ -85,6 +85,7 @@ let
--replace 'LDFLAGS :=' 'LDFLAGS := -ltls -lssl -lcrypto'
'';
separateDebugInfo = true;
enableParallelBuilding = true;
makeFlags = [ "all" "fdb_java" ]
@ -92,7 +93,9 @@ let
# it gets statically linked in
++ lib.optional (!lib.versionAtLeast version "6.0") [ "fdb_c" ]
# Needed environment overrides
++ [ "KVRELEASE=1" ];
++ [ "KVRELEASE=1"
"NOSTRIP=1"
];
# on 6.0 and later, we can specify all this information manually
configurePhase = lib.optionalString (lib.versionAtLeast version "6.0") ''
@ -152,9 +155,9 @@ in with builtins; {
};
foundationdb60 = makeFdb rec {
version = "6.0.2pre2430_${substring 0 8 rev}";
version = "6.0.3pre2446_${substring 0 8 rev}";
branch = "release-6.0";
rev = "7938d247a5eaf886a176575de6592b76374df58c";
sha256 = "0g8h2zs0f3aacs7x4hyjh0scybv33gjj6dqfb789h4n6r4gd7d9h";
rev = "dd5481fb60ee1652986b2a028b31dcbb6cb171b5";
sha256 = "0mhlb728badk1h3410jbhy7f48m3jjnjna26wwyw5680xz72d6dm";
};
}

View File

@ -5065,6 +5065,8 @@ with pkgs;
siege = callPackage ../tools/networking/siege {};
sieve-connect = callPackage ../applications/networking/sieve-connect {};
sigal = callPackage ../applications/misc/sigal {
inherit (pythonPackages) buildPythonApplication fetchPypi;
};
@ -11719,6 +11721,8 @@ with pkgs;
ronn = callPackage ../development/tools/ronn { };
rshell = python3.pkgs.callPackage ../development/tools/rshell { };
rubberband = callPackage ../development/libraries/rubberband {
inherit (vamp) vampSDK;
};

View File

@ -298,23 +298,6 @@ let
helm-words = callPackage ../applications/editors/emacs-modes/helm-words { };
hindent = melpaBuild rec {
pname = "hindent";
version = external.hindent.version;
src = external.hindent.src;
packageRequires = [ haskell-mode ];
propagatedUserEnvPkgs = [ external.hindent ];
recipe = writeText "recipe" ''
(hindent
:repo "commercialhaskell/hindent" :fetcher github
:files ("elisp/*.el"))
'';
meta = {
description = "Indent haskell code using the \"hindent\" program";
license = bsd3;
};
};
icicles = callPackage ../applications/editors/emacs-modes/icicles { };
redshank = callPackage ../applications/editors/emacs-modes/redshank { };

View File

@ -17923,6 +17923,8 @@ EOF
z3 = (toPythonModule (pkgs.z3.override {
inherit python;
})).python;
rfc7464 = callPackage ../development/python-modules/rfc7464 { };
});
in fix' (extends overrides packages)