mirror of
https://github.com/Gerg-L/nixos.git
synced 2025-12-10 00:43:56 -05:00
mkPackages 2.0
This commit is contained in:
parent
6cb2c87bbc
commit
36176f647c
3 changed files with 39 additions and 7 deletions
|
|
@ -105,17 +105,49 @@ rec {
|
||||||
names
|
names
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/* /<name> -> packages named by directory
|
||||||
|
/<name>/call.nix -> callPackage override imported via import <file> pkgs
|
||||||
|
call.nix example
|
||||||
|
pkgs: {
|
||||||
|
inherit (pkgs.python3Packages) callPackage;
|
||||||
|
args = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
/<name>/package.nix -> the package itself
|
||||||
|
*/
|
||||||
mkPackages =
|
mkPackages =
|
||||||
path: pkgs:
|
path: pkgs:
|
||||||
lib.pipe path [
|
lib.pipe path [
|
||||||
listNixFilesRecursive
|
builtins.readDir
|
||||||
(map (
|
(lib.filterAttrs (_: v: v == "directory"))
|
||||||
x: {
|
(lib.mapAttrs (
|
||||||
name = lib.removeSuffix ".nix" (builtins.baseNameOf x);
|
n: _:
|
||||||
value = pkgs.callPackage x { };
|
let
|
||||||
|
addArgs =
|
||||||
|
x:
|
||||||
|
lib.setFunctionArgs x (
|
||||||
|
lib.mapAttrs
|
||||||
|
(
|
||||||
|
n: v:
|
||||||
|
{
|
||||||
|
inherit inputs self;
|
||||||
|
#sources = import ../npins;
|
||||||
}
|
}
|
||||||
|
.${n} or v
|
||||||
|
)
|
||||||
|
(lib.functionArgs x)
|
||||||
|
);
|
||||||
|
in
|
||||||
|
|
||||||
|
if builtins.pathExists "${path}/${n}/call.nix" then
|
||||||
|
let
|
||||||
|
x = import "${path}/${n}/call.nix" pkgs;
|
||||||
|
in
|
||||||
|
(addArgs x.callPackage "${path}/${n}/package.nix") x.args
|
||||||
|
else
|
||||||
|
(addArgs pkgs.callPackage "${path}/${n}/package.nix") {}
|
||||||
|
|
||||||
))
|
))
|
||||||
builtins.listToAttrs
|
|
||||||
];
|
];
|
||||||
_file = ./default.nix;
|
_file = ./default.nix;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue