mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-23 06:21:30 +03:00
add versions to group packages
This commit is contained in:
parent
c3e07bf838
commit
0c6910060f
@ -33,6 +33,6 @@
|
||||
specialArgs.packageSets.nixpkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
};
|
||||
in {
|
||||
packages.${system} = evaled.config.groups.default.public.packages;
|
||||
packages.${system}.requests = evaled.config.groups.default.public.packages.requests."2.31.0";
|
||||
};
|
||||
}
|
||||
|
@ -52,32 +52,34 @@ in {
|
||||
};
|
||||
|
||||
packages = lib.flip lib.mapAttrs deps' (name: pkg: {
|
||||
inherit name;
|
||||
version = pkg.version;
|
||||
imports = [
|
||||
dream2nix.modules.dream2nix.buildPythonPackage
|
||||
dream2nix.modules.dream2nix.mkDerivation
|
||||
dream2nix.modules.dream2nix.package-func
|
||||
];
|
||||
buildPythonPackage = {
|
||||
format =
|
||||
if lib.hasSuffix ".whl" pkg.source.file
|
||||
then "wheel"
|
||||
else "pyproject";
|
||||
};
|
||||
mkDerivation = {
|
||||
# required: { pname, file, version, hash, kind, curlOpts ? "" }:
|
||||
src = fetchFromPypi {
|
||||
pname = name;
|
||||
file = pkg.source.file;
|
||||
version = pkg.version;
|
||||
hash = pkg.source.hash;
|
||||
kind = "";
|
||||
${pkg.version} = {
|
||||
inherit name;
|
||||
version = pkg.version;
|
||||
imports = [
|
||||
dream2nix.modules.dream2nix.buildPythonPackage
|
||||
dream2nix.modules.dream2nix.mkDerivation
|
||||
dream2nix.modules.dream2nix.package-func
|
||||
];
|
||||
buildPythonPackage = {
|
||||
format =
|
||||
if lib.hasSuffix ".whl" pkg.source.file
|
||||
then "wheel"
|
||||
else "pyproject";
|
||||
};
|
||||
mkDerivation = {
|
||||
# required: { pname, file, version, hash, kind, curlOpts ? "" }:
|
||||
src = fetchFromPypi {
|
||||
pname = name;
|
||||
file = pkg.source.file;
|
||||
version = pkg.version;
|
||||
hash = pkg.source.hash;
|
||||
kind = "";
|
||||
};
|
||||
propagatedBuildInputs =
|
||||
lib.forEach
|
||||
parsed_lock_data.${name}.dependencies
|
||||
(depName: lib.head (lib.attrValues (config.groups.${groupname}.public.packages.${depName})));
|
||||
};
|
||||
propagatedBuildInputs =
|
||||
lib.forEach
|
||||
parsed_lock_data.${name}.dependencies
|
||||
(depName: config.groups.${groupname}.public.packages.${depName});
|
||||
};
|
||||
});
|
||||
in {inherit packages;};
|
||||
|
@ -22,20 +22,20 @@ in {
|
||||
'';
|
||||
};
|
||||
packages = lib.mkOption {
|
||||
type = t.lazyAttrsOf packageType;
|
||||
type = t.lazyAttrsOf (t.lazyAttrsOf packageType);
|
||||
description = ''
|
||||
The package configurations to evaluate
|
||||
'';
|
||||
};
|
||||
packagesEval = lib.mkOption {
|
||||
type = t.lazyAttrsOf (t.submoduleWith {modules = [];});
|
||||
type = t.lazyAttrsOf (t.lazyAttrsOf (t.submoduleWith {modules = [];}));
|
||||
description = ''
|
||||
The evaluated dream2nix package modules
|
||||
'';
|
||||
internal = true;
|
||||
};
|
||||
public.packages = lib.mkOption {
|
||||
type = t.lazyAttrsOf t.package;
|
||||
type = t.lazyAttrsOf (t.lazyAttrsOf t.package);
|
||||
description = ''
|
||||
The evaluated packages ready to consume
|
||||
'';
|
||||
@ -44,6 +44,9 @@ in {
|
||||
};
|
||||
config = {
|
||||
packagesEval = config.packages;
|
||||
public.packages = lib.mapAttrs (name: pkg: pkg.public) config.packagesEval;
|
||||
public.packages =
|
||||
lib.mapAttrs
|
||||
(name: versions: lib.mapAttrs (version: pkg: pkg.public) versions)
|
||||
config.packagesEval;
|
||||
};
|
||||
}
|
||||
|
@ -19,20 +19,20 @@
|
||||
in {
|
||||
test_groups_simple = let
|
||||
config = eval {
|
||||
groups.my-group.packages.hello = {...}: fixtures.basic-derivation;
|
||||
groups.my-group.packages.hello."1.0.0" = {...}: fixtures.basic-derivation;
|
||||
};
|
||||
in {
|
||||
expr = config.groups.my-group.public.packages.hello ? drvPath;
|
||||
expr = config.groups.my-group.public.packages.hello."1.0.0" ? drvPath;
|
||||
expected = true;
|
||||
};
|
||||
|
||||
test_groups_commonModule = let
|
||||
config = eval {
|
||||
groups.my-group.packages.hello = {...}: fixtures.basic-derivation;
|
||||
groups.my-group.packages.hello."1.0.0" = {...}: fixtures.basic-derivation;
|
||||
commonModule = {name = lib.mkForce "hello-mod";};
|
||||
};
|
||||
in {
|
||||
expr = "${config.groups.my-group.public.packages.hello.name}";
|
||||
expr = "${config.groups.my-group.public.packages.hello."1.0.0".name}";
|
||||
expected = "hello-mod";
|
||||
};
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ in {
|
||||
pdm.pyproject = ./../../../examples/dream2nix-repo-flake-pdm/pyproject.toml;
|
||||
};
|
||||
in {
|
||||
expr = config.groups.default.public.packages.certifi ? drvPath;
|
||||
expr = lib.head (lib.attrValues config.groups.default.public.packages.certifi) ? drvPath;
|
||||
expected = true;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user