mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-19 04:57:54 +00:00
slightly reduce repetition by pulling out a mergeAttrs definition
This commit is contained in:
parent
f4949c699a
commit
c350d8b736
24
flake.nix
24
flake.nix
@ -114,6 +114,12 @@
|
|||||||
# Make a singleton attribute set from the result of two functions.
|
# Make a singleton attribute set from the result of two functions.
|
||||||
singletonOf = f: g: x: { ${f x} = g x; };
|
singletonOf = f: g: x: { ${f x} = g x; };
|
||||||
|
|
||||||
|
# [attrset] -> attrset
|
||||||
|
#
|
||||||
|
# Merge a list of attrset into a single attrset with overlap preferring
|
||||||
|
# rightmost values.
|
||||||
|
mergeAttrs = pkgs.lib.foldr pkgs.lib.mergeAttrs {};
|
||||||
|
|
||||||
# makeRuntimeEnv :: string -> derivation
|
# makeRuntimeEnv :: string -> derivation
|
||||||
#
|
#
|
||||||
# Create a derivation that includes a Python runtime, Tahoe-LAFS, and
|
# Create a derivation that includes a Python runtime, Tahoe-LAFS, and
|
||||||
@ -149,10 +155,10 @@
|
|||||||
# flake's "default" package at the derivation corresponding to the
|
# flake's "default" package at the derivation corresponding to the
|
||||||
# default Python version we defined above. The package consists of a
|
# default Python version we defined above. The package consists of a
|
||||||
# Python environment with Tahoe-LAFS available to it.
|
# Python environment with Tahoe-LAFS available to it.
|
||||||
packages = with pkgs.lib;
|
packages =
|
||||||
foldr mergeAttrs {} ([
|
mergeAttrs (
|
||||||
{ default = self.packages.${system}.${packageName defaultPyVersion}; }
|
[ { default = self.packages.${system}.${packageName defaultPyVersion}; } ]
|
||||||
] ++ (builtins.map makeRuntimeEnv pythonVersions)
|
++ (builtins.map makeRuntimeEnv pythonVersions)
|
||||||
++ (builtins.map (singletonOf unitTestName makeTestEnv) pythonVersions)
|
++ (builtins.map (singletonOf unitTestName makeTestEnv) pythonVersions)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -208,13 +214,11 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
with pkgs.lib;
|
|
||||||
# Merge a default app definition with the rest of the apps.
|
# Merge a default app definition with the rest of the apps.
|
||||||
foldr mergeAttrs
|
mergeAttrs (
|
||||||
{ default = self.apps.${system}."tahoe-python3"; }
|
[ { default = self.apps.${system}."tahoe-python3"; } ]
|
||||||
(
|
++ (builtins.map makeUnitTestsApp pythonVersions)
|
||||||
(builtins.map makeUnitTestsApp pythonVersions) ++
|
++ (builtins.map makeTahoeApp pythonVersions)
|
||||||
(builtins.map makeTahoeApp pythonVersions)
|
|
||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user