From cc7b5c0f957cd9a48a70192c8eeb57c9949dcde5 Mon Sep 17 00:00:00 2001 From: DavHau Date: Tue, 20 Feb 2024 18:44:47 +0700 Subject: [PATCH] pdm: add rudimentary devShell Also fix lock script to not swallow error messages --- modules/dream2nix/WIP-python-pdm/default.nix | 8 +++++++- modules/dream2nix/core/lock/default.nix | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/dream2nix/WIP-python-pdm/default.nix b/modules/dream2nix/WIP-python-pdm/default.nix index 269c2aa7cc..4ad95d4cb3 100644 --- a/modules/dream2nix/WIP-python-pdm/default.nix +++ b/modules/dream2nix/WIP-python-pdm/default.nix @@ -75,6 +75,7 @@ in { buildPackages curl jq + mkShell runCommand stdenvNoCC stdenv @@ -100,6 +101,11 @@ in { # all packages attrs prefixed with version (lib.attrValues config.groups.default.packages); }; + public.devShell = let + interpreter = config.deps.python.withPackages (ps: config.mkDerivation.propagatedBuildInputs); + in config.deps.mkShell { + packages = [interpreter]; + }; groups = let groupNames = lib.attrNames groups_with_deps; populateGroup = groupname: let @@ -131,7 +137,7 @@ in { (dream2nix.overrides.python.${name} or {}) ]; inherit name; - version = pkg.version; + version = lib.mkDefault pkg.version; buildPythonPackage = { format = lib.mkDefault ( if lib.hasSuffix ".whl" source.file diff --git a/modules/dream2nix/core/lock/default.nix b/modules/dream2nix/core/lock/default.nix index 58b5d4bb89..9d4c128e67 100644 --- a/modules/dream2nix/core/lock/default.nix +++ b/modules/dream2nix/core/lock/default.nix @@ -27,7 +27,7 @@ repo_path = Path(subprocess.run( ['${config.paths.findRoot}'], # noqa: E501 - check=True, text=True, capture_output=True + check=True, text=True, stdout=subprocess.PIPE ).stdout.strip()) lock_path_rel = Path('${config.paths.package}/${config.paths.lockFile}') # noqa: E501 lock_path = repo_path / lock_path_rel.relative_to(lock_path_rel.anchor)