mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-23 06:21:30 +03:00
examples/python-pdm: migrate to ./packages
This commit is contained in:
parent
bce7ab631d
commit
3030cd5877
19
examples/packages/single-language/python-pdm/default.nix
Normal file
19
examples/packages/single-language/python-pdm/default.nix
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
config,
|
||||
dream2nix,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
dream2nix.modules.dream2nix.WIP-python-pdm
|
||||
];
|
||||
pdm.lockfile = ./pdm.lock;
|
||||
pdm.pyproject = ./pyproject.toml;
|
||||
pdm.pythonInterpreter = config.deps.python3;
|
||||
mkDerivation = {
|
||||
src = ./.;
|
||||
buildInputs = [
|
||||
config.deps.python3.pkgs.pdm-backend
|
||||
];
|
||||
};
|
||||
}
|
32
examples/packages/single-language/python-pdm/flake.nix
Normal file
32
examples/packages/single-language/python-pdm/flake.nix
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
description = "My flake with dream2nix packages";
|
||||
|
||||
inputs = {
|
||||
dream2nix.url = "github:nix-community/dream2nix";
|
||||
nixpkgs.follows = "dream2nix/nixpkgs";
|
||||
};
|
||||
|
||||
outputs = inputs @ {
|
||||
self,
|
||||
dream2nix,
|
||||
nixpkgs,
|
||||
...
|
||||
}: let
|
||||
system = "x86_64-linux";
|
||||
in {
|
||||
# All packages defined in ./packages/<name> are automatically added to the flake outputs
|
||||
# e.g., 'packages/hello/default.nix' becomes '.#packages.hello'
|
||||
packages.${system}.default = dream2nix.lib.evalModules {
|
||||
packageSets.nixpkgs = inputs.dream2nix.inputs.nixpkgs.legacyPackages.${system};
|
||||
modules = [
|
||||
./default.nix
|
||||
{
|
||||
paths.projectRoot = ./.;
|
||||
# can be changed to ".git" or "flake.nix" to get rid of .project-root
|
||||
paths.projectRootFile = "flake.nix";
|
||||
paths.package = ./.;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
{
|
||||
description = "My flake with dream2nix packages";
|
||||
|
||||
inputs = {
|
||||
dream2nix.url = "github:nix-community/dream2nix";
|
||||
nixpkgs.follows = "dream2nix/nixpkgs";
|
||||
};
|
||||
|
||||
outputs = inputs @ {
|
||||
self,
|
||||
dream2nix,
|
||||
nixpkgs,
|
||||
...
|
||||
}: let
|
||||
system = "x86_64-linux";
|
||||
lib = nixpkgs.lib;
|
||||
module = {
|
||||
config,
|
||||
lib,
|
||||
dream2nix,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
dream2nix.modules.dream2nix.WIP-python-pdm
|
||||
];
|
||||
pdm.lockfile = ./pdm.lock;
|
||||
pdm.pyproject = ./pyproject.toml;
|
||||
pdm.pythonInterpreter = nixpkgs.legacyPackages.python3;
|
||||
mkDerivation = {
|
||||
src = ./.;
|
||||
buildInputs = [
|
||||
config.deps.python3.pkgs.pdm-backend
|
||||
];
|
||||
};
|
||||
};
|
||||
evaled = lib.evalModules {
|
||||
modules = [module];
|
||||
specialArgs.dream2nix = dream2nix;
|
||||
specialArgs.packageSets.nixpkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
};
|
||||
in {
|
||||
packages.${system} = {
|
||||
my-project = evaled.config.public;
|
||||
};
|
||||
};
|
||||
}
|
@ -97,8 +97,6 @@ in {
|
||||
imported;
|
||||
example-repo-flake =
|
||||
(importFlake ../../examples/repo-flake/flake.nix).packages.${system}.hello;
|
||||
example-repo-flake-pdm =
|
||||
(importFlake ../../examples/repo-flake-pdm/flake.nix).packages.${system}.my-project;
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -146,7 +146,7 @@
|
||||
};
|
||||
};
|
||||
tests_parseLockData = let
|
||||
lock_data = lib.importTOML ./../../../examples/repo-flake-pdm/pdm.lock;
|
||||
lock_data = lib.importTOML ./../../../examples/packages/single-language/python-pdm/pdm.lock;
|
||||
version = "2.31.0";
|
||||
parsed = libpdm.parseLockData {
|
||||
inherit lock_data;
|
||||
@ -179,7 +179,7 @@
|
||||
};
|
||||
tests_groupsWithDeps = let
|
||||
environ = linux_environ;
|
||||
pyproject = libpdm.loadPdmPyProject (lib.importTOML ./../../../examples/repo-flake-pdm/pyproject.toml);
|
||||
pyproject = libpdm.loadPdmPyProject (lib.importTOML ./../../../examples/packages/single-language/python-pdm/pyproject.toml);
|
||||
groups_with_deps = libpdm.groupsWithDeps {
|
||||
inherit environ pyproject;
|
||||
};
|
||||
@ -200,7 +200,7 @@
|
||||
|
||||
tests_getDepsRecursively = let
|
||||
environ = linux_environ;
|
||||
lock_data = lib.importTOML ./../../../examples/repo-flake-pdm/pdm.lock;
|
||||
lock_data = lib.importTOML ./../../../examples/packages/single-language/python-pdm/pdm.lock;
|
||||
parsed_lock_data = libpdm.parseLockData {
|
||||
inherit environ lock_data;
|
||||
selector = libpdm.preferWheelSelector;
|
||||
@ -235,8 +235,8 @@
|
||||
|
||||
tests_selectForGroups = let
|
||||
environ = linux_environ;
|
||||
pyproject = libpdm.loadPdmPyProject (lib.importTOML ./../../../examples/repo-flake-pdm/pyproject.toml);
|
||||
lock_data = lib.importTOML ./../../../examples/repo-flake-pdm/pdm.lock;
|
||||
pyproject = libpdm.loadPdmPyProject (lib.importTOML ./../../../examples/packages/single-language/python-pdm/pyproject.toml);
|
||||
lock_data = lib.importTOML ./../../../examples/packages/single-language/python-pdm/pdm.lock;
|
||||
groups_with_deps = libpdm.groupsWithDeps {
|
||||
inherit environ pyproject;
|
||||
};
|
||||
|
@ -20,8 +20,8 @@ in {
|
||||
test_pdm = let
|
||||
config = eval {
|
||||
# TODO: create fixtures
|
||||
pdm.lockfile = ./../../../examples/repo-flake-pdm/pdm.lock;
|
||||
pdm.pyproject = ./../../../examples/repo-flake-pdm/pyproject.toml;
|
||||
pdm.lockfile = ./../../../examples/packages/single-language/python-pdm/pdm.lock;
|
||||
pdm.pyproject = ./../../../examples/packages/single-language/python-pdm/pyproject.toml;
|
||||
};
|
||||
in {
|
||||
expr = (lib.head (lib.attrValues config.groups.default.packages.certifi)).public ? drvPath;
|
||||
|
Loading…
Reference in New Issue
Block a user