Commit Graph

193 Commits

Author SHA1 Message Date
purepani
3ebbda3982
pdm: Adds example for pdm 2024-06-11 11:16:01 -05:00
purepani
bee7a60b36
pip: Change example package to remove hyphen 2024-06-09 13:42:05 -05:00
Paul Haerle
6a169a73bd
Python DevShells (for pip) (#951)
* fetchPipMetadata: set meta.mainProgram

* fetchPipMetadata: deduplicate test fixtures

* fetchPipMetadata: add is_direct to lock file

* devShell: proof of concept

* python-local-development: add editables example

* devshell: simplify editables interface

* buildPythonPackage: remove editable option again

* devshell: use findRoot for editables

* devshell: add support for .whl sources

* devshell: avoid polluting the shells environment

* devshell: make editable.nix flatter

because there's only 1 attr left now

* devshell: fix pyEnv by filtering editables

from the environment.

* devshell: skip existing editables

* devshell: remove patched pyEnv, rewrite sys.path

* devshell: add special case for root package

* python-local-development: improve editable example

* python-local-development: filter source

* devshell: reset site_dir on each load

* pip: don't ignoreCollisions in pyEnv

* pip: default to no sitecustomize.py...

and teach the devshell how to load it

* pip: rewrite editable in python

* editable: use shutil.copytree

* editable: refactor into functions

* editables: add suport for console_scripts

* improve pip editables interface

- change editables interface to use bool or path
- expose public.shellHook for composition
- use shellHook by default in public.devShell
- extend example to include a script

* improve edtiable support:

- remove dependency on root package build
- always set root package as editable by default
- compute dit-info dir by calling a packages build backend or extracting directly from the wheel
- only pass required sources to editables shell hook
- add build inputs of all editables to teh dev shell
- move editables state to .dream2nix/python to remove likelyhood of collision with other ecosystems state
- delete editables state if editables configuration changed

* refine python editable support:

- never copy dependency sources
- force user to specify a local path

---------

Co-authored-by: DavHau <hsngrmpf+github@gmail.com>
2024-05-17 01:00:09 +02:00
DavHau
beceb215cc examples/python: fix apache-airflow example 2024-03-25 06:15:31 +00:00
DavHau
87c725e8db python: remove catchConflicts = false overrides
Those are not needed anymore since the hook has been improved in nixpkgs
2024-03-17 07:32:33 +00:00
DavHau
b727a07775 override: unify overriding across modules
Add options `overrides.${name}` and `overrideAll` to all language modules that manage a dependency tree.

This is done in a backward compatible fashion. Old options for overriding dependencies continue working, though those are not displayed in the manual anymore.

For the following modules the manual now suggest using the new unified override options:
- for pip: use `pip.overrides` and `pip.overrideAll` instead of  `pip.drvs`
- for nodejs-granular-v3: use `nodejs-granular-v3.overrides` and `nodejs-granular-v3.overrideAll` instead of `nodejs-granular-v3.deps`
- `php-granular`: use `php-granular.override` and `php-granular.overrideAll` instead of `php-granular.deps`
2024-03-13 14:25:41 +07:00
DavHau
211528826c cleanup core options
- don't import eval-cache and flags modules by default (those have never been used so far)
- mark options of package-func as internal. Those are for maintainers only and don't need to be rendered by default
2024-03-12 09:41:59 +00:00
DavHau
a1d2290029 docs: fix template attr in examples readme 2024-03-12 07:33:46 +00:00
DavHau
deb4c98014 docs: fix links to examples 2024-03-11 10:41:05 +00:00
DavHau
42838c5909 examples: cleanup and rename to simplify
- name example more consistently, eg. `{language}-packaging-{feature}` or `{language}-local-development-{feature}`
- move some examples to the modules integration tests directory instead as their purpose was mainly testing and they weren't good example
- module owned checks: import via flake if available
2024-03-09 04:45:59 +00:00
DavHau
887022b8c1 update nixpkgs:
- downgrade mitmproxy to avoid breakage
- add test for pip lock script
- fix bug in flake compat implementation (https://github.com/nix-community/flake-compat/pull/4#issuecomment-1950301370)
- small fix in docs for lock and eval-cache
- fix lock refresh script: don't swallow errors
2024-02-24 13:47:45 +00:00
Johannes Kirschbauer
8a040b7a96 nodejs: add simple nextjs example 2024-02-15 07:22:18 +00:00
DavHau
16f2c654c6 pdm: stop using config.deps.python3 in favor of config.deps.python 2024-01-24 08:09:56 +00:00
DavHau
0fb528d452 pdm: refresh pdm.lock on 'nix run .#{package}.lock' 2024-01-07 17:40:55 +00:00
DavHau
0f2d06b43e examples: add readme for packages examples 2024-01-07 06:28:34 +00:00
DavHau
67c1356f20 update nixpkgs 2023-12-12 09:52:44 +00:00
DavHau
c25e88974f nodejs-devshell-v3: init 2023-11-17 07:35:09 +00:00
DavHau
8db4cb1121 examples: minimize nodejs-project example 2023-11-15 08:44:40 +00:00
DavHau
7cb0fded82 nodejs: fix backward compat for nodejs-package-json
- revert recent changes on nodejs-package-json
- instead introduce nodejs-package-json-v3

This way, existing users won't face breakages in the api
2023-11-08 07:34:15 +00:00
DavHau
24e81d5ce8 examples: rename repo examples 2023-11-07 19:08:27 +07:00
DavHau
1c47a7cfba examples: move repo-flake-groups to /misc/drafts 2023-11-07 19:08:27 +07:00
DavHau
3030cd5877 examples/python-pdm: migrate to ./packages 2023-11-07 19:08:27 +07:00
DavHau
bce7ab631d nodejs-package-json: use v3 lock file 2023-11-07 18:45:35 +07:00
DavHau
d8e4b477e3 refactor: move dev related things to /dev-flake
The goal is to reduce the flake inputs visible to the user
Still, the top-level flake re-exposes the outputs of the dev-flake, but
without exposing its inputs. This means a devShell is still available in
the top-level, for example.

This also removes the /modules/flake.nix. Its original purpose was
separating the modules inputs from the development inputs, but this is
now done the opposite way around by moving the dev inputs to
/dev-flake/flake.nix.
2023-11-05 03:42:18 +00:00
DavHau
5914156eb7 examples: add flake.nix to each example
This makes hte examples more standalone and suitable for copy & paste
2023-10-31 11:36:21 +00:00
DavHau
61bc3b1377 examples: remove dream2nix- prefix 2023-10-30 21:42:51 +00:00
t4ccer
1a7a59e001 Remove Haskell example readme 2023-10-30 20:35:34 +00:00
t4ccer
c5b2624352 More robust source locking 2023-10-30 20:35:34 +00:00
t4ccer
2313bdf946 Don't fixup dependencies to prevent moving directories 2023-10-30 20:35:34 +00:00
t4ccer
42d9efb91b Clean up haskell stuff 2023-10-30 20:35:34 +00:00
t4ccer
d903c85d7a Simplify lock file 2023-10-30 20:35:34 +00:00
t4ccer
92375aa5fd Add toy Haskell example 2023-10-30 20:35:34 +00:00
Johannes Kirschbauer
f9f8b595d6 Docs: add comment to flake template 2023-10-29 12:36:14 +00:00
DavHau
aac7f3f77e pdm: build package with deps 2023-10-22 00:50:36 +00:00
hsjobeki
0c6910060f add versions to group packages 2023-10-18 16:54:32 +00:00
Johannes Kirschbauer
419d6f08c4
add new node builder mono-module (#748)
* add new node builder mono-module

* add example

* nodejs-builder-v3: rename to WIP-nodejs-builder-v3

* fix tests

---------

Co-authored-by: DavHau <hsngrmpf+github@gmail.com>
2023-10-17 20:59:10 +01:00
DavHau
72e4fd904d buildRustPackage: add example package 2023-10-17 18:12:32 +00:00
DavHau
cd7dee14ae modules: fixup more nodejs modules for docs rendering 2023-10-11 21:43:01 +00:00
DavHau
e6800060c9 modules: fixups nodejs modules to render docs 2023-10-11 21:12:59 +00:00
DavHau
5e938ebb20 findCycles: add some unit tests 2023-10-10 16:57:18 +00:00
DavHau
541655a6fb examples/pdm: pin nixpkgs to dream2nix nixpkgs 2023-10-08 12:53:39 +00:00
waalge
e9fac8985c fix: nixpkgs follows d2n 2023-10-07 12:52:30 +02:00
DavHau
c4bc9c1f27 feat(pdm): build default group
Also implement source fetching
2023-10-01 00:49:05 +01:00
DavHau
03b1e05f7b fix(spago): fix flake inputs 2023-09-30 15:56:55 +01:00
Andrea Ciceri
e4a9da41ad WIP 2023-09-30 15:56:55 +01:00
DavHau
4eeee078f7 chore(pdm): update example lock file 2023-09-29 14:46:15 +01:00
DavHau
98f7fac5a1 chore(python-pdm): rename python-pdm -> WIP-python-pdm 2023-09-28 19:19:18 +01:00
Frederik Rietdijk
c78d39119a wip pdm init 2023-09-28 19:11:18 +01:00
Jairo Llopis
25e07594f4 fix: improve handling of local python dependencies
The pip locker [sometimes created a URL without hash][1] to reflect that there was a local source.

This produced the following error when trying to evaluate that derivation:

    … from call site

      at /nix/store/qdzdi6qvrqxfqxhi3j70d5dsl9f5jpby-source/modules/dream2nix/pip/default.nix:86:28:

        85|       mkDerivation = {
        86|         src = l.mkDefault (fetchers.${metadata.sources.${config.name}.type} metadata.sources.${config.name});
          |                            ^
        87|         doCheck = l.mkDefault false;

    … while calling 'url'

      at /nix/store/qdzdi6qvrqxfqxhi3j70d5dsl9f5jpby-source/modules/dream2nix/pip/default.nix:57:11:

        56|   fetchers = {
        57|     url = info: l.fetchurl {inherit (info) url sha256;};
          |           ^
        58|     git = info: config.deps.fetchgit {inherit (info) url sha256 rev;};

    error: value is null while a string was expected

Of course, one cannot call `builtins.fetchurl` without a `sha256` argument.

Now, local dependencies are specified exactly like that in the lock file. Now, we'll fetch nothing when dealing with local dependencies.

Also, their evaluation when generating `preFixup` attribute is delayed until build time. This was a bigger problem due to the previous bug, but in any case it should still help to reduce evaluation overhead.

FWIW, sometimes local sources might not really exit in the derivation source tree until build time. For example, when building aggregated sources with meta-repo management tools such as Mr. Chef.

[1]: 40b65e4598/pkgs/fetchPipMetadata/src/fetch_pip_metadata/lock_file_from_report.py (L72C28-L72C28)
2023-09-22 10:49:10 +01:00
DavHau
4eb5478fdd feat(paths): allow paths.package to be an absolute path 2023-09-21 11:00:03 +02:00