Commit Graph

271 Commits

Author SHA1 Message Date
DavHau
7292ee5455 python/pdm: improve implementation and UI
- implement per dependency sourceSelector option
- update pyproject.nix
- update nix-unit
2023-12-04 07:46:08 +00:00
DavHau
9ce00f86e9 update pyproject-nix 2023-12-03 10:35:52 +00:00
DavHau
4b155e6a5d docs: render docs also for core modules 2023-12-03 08:53:50 +00:00
DavHau
2f344133c3 groups: rename to WIP-groups
to make the status of this module more clear
2023-12-03 07:41:58 +00:00
DavHau
c25e88974f nodejs-devshell-v3: init 2023-11-17 07:35:09 +00:00
DavHau
db35339b1e test: add per module testing infra
So far, /examples was the only place with packages that are built in the CI pipeline.
This change allows us to add package build tests to individual modules at the location where the module is defined. This has several benefits:

- We are not forced to add unnecessary examples in order to maintain test coverage
- When modules get removed, their tests will be removed alongside
- It allows us to keep old modules around and assure they keep working without having to keep outdated examples in /examples
2023-11-17 07:27:54 +00:00
Yusuf Bera Ertan
3f1cbc8e93
feat(rust): update & support crane version v0.15.0, fix some issues (#788) 2023-11-10 17:11:30 +10:00
Yusuf Bera Ertan
f1a9f36bf7
fix(rust-cargo-lock): handle workspace = true for license, description and homepage package attributes (#787) 2023-11-09 00:11:56 +10: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
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
9f507c9341 docs: improve docs for groups 2023-11-07 16:34:00 +07:00
DavHau
3b42e5a8e4 docs: fix missing options for modules
- render all top-level options declared by a module
2023-11-07 16:34:00 +07:00
DavHau
edda831f76 groups: update readme 2023-11-07 15:39:25 +07:00
DavHau
581a7cff0b flake: separate top-level from dev-flake fully 2023-11-05 03:42:18 +00: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
1f680838ab lib: move to /lib from /modules/flake-parts/lib 2023-11-05 03:23:11 +00:00
DavHau
0ed0a765d6 pdm: update pyproject-nix dependency 2023-11-04 06:36:34 +00:00
adisbladis
2c8f520108 pdm: Use fetchFromPypi from pyproject.nix 2023-11-04 06:36:34 +00:00
adisbladis
e28ae15e36 pdm: Remove universal wheel file name test
It was broken by changes in pyproject.nix and doesn't seem to be in use anyway.
2023-11-04 06:36:34 +00:00
adisbladis
e16b6544e2 pdm: Select wheel using pyproject.nix 2023-11-04 06:36:34 +00:00
adisbladis
203dc17210 Bump pyproject.nix 2023-11-04 06:36:34 +00:00
DavHau
954bacb0a6 chore: more formatter into separate flake module 2023-10-31 12:09:56 +00:00
DavHau
bc2e8ddb64 chore put pre-commit-checks into extra file 2023-10-31 15:00:35 +03:00
DavHau
543315a7cf chore: move devShells to separate module 2023-10-31 11:46:26 +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
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
DavHau
3789a1bdb7 pdm: allow selecting multiple groups 2023-10-29 23:14:00 +00:00
DavHau
dd4cdb252c pdm: reformat lib.nix 2023-10-29 23:14:00 +00:00
DavHau
c39edb8532 groups: rename commonModule -> overrideAll 2023-10-29 23:14:00 +00:00
DavHau
752936f0c2 groups: implement global and local overrides
implement options:
- options.overrides
- options.groups.<name>.overrides

Having this, it should not be necessary anymore to override members of a group directly. Instead the logic can be bound to package names, either globally for all groups, or locally for a single group.

We should probably also rename :
- `options.commonModule` -> `options.overrideAll`
- `options.groups.<name>.commonModules` -> `options.groups.<name>.overrideAll`
2023-10-29 01:59:54 +00:00
DavHau
4bd6022300 nodejs-granular-v3: fix option prefix 2023-10-28 23:51:11 +00:00
DavHau
a900b3a332 lib: make all modules use new lib locations 2023-10-25 10:11:54 +00:00
DavHau
c6c1a430ff lib: move to /modules/flake-parts/lib 2023-10-24 23:08:13 +00:00
DavHau
cf82f7a1ed docs: configure highlight.js 2023-10-23 19:31:57 +00:00
DavHau
ce51fbf18b groups: improve docs 2023-10-23 19:17:06 +00:00
DavHau
31fb84a7f5 groups: rename conf -> module 2023-10-23 13:28:57 +00:00
DavHau
7f753eb025 groups: change structure
renames:
- packages.foo."1.0.0" -> packages.foo."1.0.0".conf
- packagesEval.foo."1.0.0" -> packages.foo."1.0.0".evaluated
- public.packages.foo."1.0.0" -> packages.foo."1.0.0".public
2023-10-23 00:35:34 +00:00
DavHau
731ac1daf1 docs: better summary + embed modules README.md 2023-10-22 22:10:43 +00:00
DavHau
c3c5769aba multi-derivation-package: init 2023-10-22 21:42:07 +00:00
DavHau
8b5ddd6fe9 lib/types: init 2023-10-22 20:53:02 +00:00
DavHau
aac7f3f77e pdm: build package with deps 2023-10-22 00:50:36 +00:00
DavHau
19fce43579 selectWheel: init 2023-10-21 23:31:45 +00:00
hsjobeki
0c6910060f add versions to group packages 2023-10-18 16:54:32 +00:00
DavHau
c3e07bf838 findCycles: revert to original file 2023-10-17 23:00:27 +00:00
hsjobeki
fb0a14d9f4 format 2023-10-17 23:00:27 +00:00
hsjobeki
a0c32a2333 add more graph utilities 2023-10-17 23:00:27 +00:00
purepani
276ad03e9a fix(pdm): Make parsed_deps lowercase 2023-10-17 20:38:52 +00:00
Andrea Ciceri
44703d424e fix(spago): lock script uses correct package-set rev 2023-10-17 21:24:48 +01: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
b10f3495e5 checks: add system attribute 2023-10-17 18:12:32 +00:00
DavHau
72e4fd904d buildRustPackage: add example package 2023-10-17 18:12:32 +00:00
DavHau
1caf997f69 linkchecker: disable because of performance issues 2023-10-12 00:55:37 +02:00
DavHau
5798a23484 docs: add reference documentation to website 2023-10-12 00:55:37 +02:00
DavHau
d2e9a494d1 modules: fixup core modules for docs rendering 2023-10-12 00:51:07 +02: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
164b965b44 modules: fixups for documentation rendering 2023-10-11 20:44:36 +00:00
DavHau
dc43eeb495 modules: various fixups for rendering docs 2023-10-11 20:28:38 +00:00
DavHau
af64cc5644 docs: improve module reference rendering 2023-10-11 00:39:50 +00:00
DavHau
585b98cc99 docs: render first module via site module 2023-10-11 00:39:50 +00:00
DavHau
212fcf4cde docs: add missing descriptions for core module 2023-10-11 00:39:50 +00:00
DavHau
e945481137 WIP: adopt flake-parts docs modules for dream2nix 2023-10-11 00:39:50 +00:00
DavHau
87d65e704e init flake parts docs modules 2023-10-11 00:39:50 +00:00
Jairo Llopis
cf853080a3 feat: allow specifying env for fetchPipMetadata
This helps for configuring pip with environment variables. See https://github.com/nix-community/dream2nix/discussions/697 for more context.

pip: remove callPackage
2023-10-08 21:40:16 +00:00
purepani
4c0d029add fix(groups): fix type on override parameter 2023-10-08 16:20:25 +00:00
DavHau
07a3dab254 checks: add all packages to checks 2023-10-08 14:28:50 +02:00
DavHau
88087f6b88 modules: export also core modules 2023-10-08 00:28:18 +02:00
Frederik Rietdijk
6f791d1cc8 pdm: add non-default groups as well 2023-10-07 12:49:58 +02:00
Yusuf Bera Ertan
5e2577caaf fix(rust-crane): don't forget to pass mkDerivation.meta to main derivation 2023-10-04 00:54:38 +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
Frederik Rietdijk
657c329d0b pdm lib: recurse into dependencies 2023-09-29 20:47:33 +01:00
Frederik Rietdijk
b2d2ba121b pdm: no need tos split filename from url with new format 2023-09-29 20:47:33 +01:00
DavHau
c627b56063 fix(examples): fix shadowed dream2nix arg 2023-09-29 20:16:42 +01:00
DavHau
a7d92db293 fix(modules): pass modules inputs correctly 2023-09-29 19:00:30 +01:00
Frederik Rietdijk
074e0c3924 pdm lib: add several type annotations 2023-09-29 14:46:15 +01:00
DavHau
fc86213f00 fix(pdm/parseLockData): filter deps properly 2023-09-29 14:46:15 +01:00
DavHau
2f9c0c28d9 feat(python-pdm): iterate 2023-09-29 01:32:03 +01:00
DavHau
6b89285dbc feat(python-pdm): initialize wheel filtering 2023-09-28 20:46:32 +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
Jairo Llopis
16552e5813 feat: allow to split buildInputs in python derivations
Follow-up of https://github.com/nix-community/dream2nix/pull/676#discussion_r1326998054, now dependencies marked as buildInputs won't be included as propagatedBuildInputs for python derivations.
2023-09-22 10:45:19 +01:00
Jairo Llopis
56308a22ef feat: output pyEnv for pip derivations
In case you're building a python environment instead of a package, this output is very handy.
2023-09-22 01:47:43 +01:00
DavHau
0d3146539a fix(paths): don't force projectRoot to be in store 2023-09-21 14:39:18 +02:00
DavHau
e913ec992b ci: remove ./ci.nix 2023-09-21 11:00:03 +02:00
DavHau
4eb5478fdd feat(paths): allow paths.package to be an absolute path 2023-09-21 11:00:03 +02:00
Jairo Llopis
8576970852 fix: forward incoming modules when using importPackages interface
Before this patch, if a user calls `importPackages` and includes custom modules in the call, those would be lost.

@moduon MT-1075
2023-09-18 18:12:59 +02:00
DavHau
f8626675d4 fix(php): exclude xml extension
This extension leads to a breakage in composer
2023-09-18 17:56:27 +02:00
DavHau
fbcdc4a0a6 fix(pip): don't invalidate lock file on python minor version updates 2023-09-18 17:56:27 +02:00
Yusuf Bera Ertan
40b65e4598
fix(rust-crane): use crane functions from config.deps.crane options (#689) 2023-09-18 00:08:54 +00:00
Yusuf Bera Ertan
d6f2f567ad
fix(rust-crane): actually pull craneSource from config.deps (#688) 2023-09-18 00:01:48 +00:00
DavHau
398fd949e1 fix(pip): don't set addAutoPatchelfSearchPath on darwin 2023-09-14 17:05:59 +02:00
DavHau
7a07ef5a41 refactor(lock): introduce mkLazy
This seems like a cleaner way to make the value for lock.content more lazy and not trigger errors because paths.XXX is not set in unit tests
2023-09-14 13:51:08 +02:00
DavHau
8d1dbd0e1f fix(lock): remove flakes command from error
The suggested copy paste attribute path is often wrong as it depends on the individual repository setup that dream2nix doesn't control.

Instead now simply hint to `nix run` the .lock attribute
2023-09-14 11:40:51 +02:00
DavHau
9cc6f02d94 feat(lock): lock file invalidation via lock.invalidationData 2023-09-14 11:30:37 +02:00
DavHau
8d5178a665 fix(pip): set dontStrip for all dependencies
Stripping is slow on large binary wheels and doesn't provide much benefit as it seems
It also prevents some breakages that can occur after stripping.
2023-09-12 01:18:07 +02:00
DavHau
740b89d71a feat(ui): add .drvPath top-level attribute
This allows building evaluated dream2nix modules directly via the nix CLI without having to reference `.public`
2023-09-12 00:39:10 +02:00
DavHau
2ab0222416 feat(ui): add .lock attribute
This allows updating the lock file via `nix run .#{package}.lock` instead of ` nix run .#{package}.config.lock.refresh`

This is better as it's shorter, and the keyword `lock` is widely understood to lock dependencies.
2023-09-12 00:30:51 +02:00
DavHau
08d414a359 feat: community overrides
- Add community overrides accessible via dream2nix.overrides.{lang}.{pname}
- make the pip module use the overrides for dependencies
2023-09-12 00:07:04 +02:00
DavHau
f80d7426f6 fix(python-pyproject): remove default for pythonImportsCheck
The heuristic was not reliable
2023-09-11 23:34:25 +02:00
DavHau
c5bdcd7e67 feat(python): add module WIP-python-pyproject 2023-09-11 22:40:08 +02:00
DavHau
ad4cb86569 fix(pip): fix namespace packages collision error 2023-09-11 22:24:23 +02:00
DavHau
cfac73dbd1 feat(pip): allow pypiSnapshotDate to be null
For many users not having a snapshot date is a valid use case.
Also many users will expect their lock file to be updated to the latest dependency versions via a nix run .#package.config.lock.refresh. so it can be the default behavior.
2023-09-11 16:30:31 +02:00
DavHau
7a7e5bd661 fix(pip): ensure autoPatchelfHook finds python binary dependencies 2023-09-09 16:28:46 +02:00
DavHau
16b9241e2b modules.drv-parts: add deprecation error 2023-09-09 15:19:24 +02:00
DavHau
97d2648627 feat(lib/internal): add findCycles.nix 2023-09-06 10:37:43 +02:00
DavHau
873561e4fe fix(pip): change nixpkgs-overrides & remove default for top-level source
- nixpkgs-overrides are not lazy enough. They can lead to eval failures thrown in nixpkgs despite not being enabled. Therefore we better use the `import` as an enable mechanism instead of the `enable` option.
We keep the enable option to allow for users to disable the override module via mkForce
2023-09-06 02:07:25 +02:00
Yusuf Bera Ertan
1422324ae1 fix(rust-crane): pull stdenv from correct option, pass drvs separately in devshell 2023-09-06 00:48:26 +02:00
Yusuf Bera Ertan
d9eada06bc fix(rust-crane): add cargo to the devshell 2023-09-06 00:48:26 +02:00
Yusuf Bera Ertan
d7f83af526 fix(buildRustPackage): add patch workspace deps to build rust package 2023-09-06 00:48:26 +02:00
Yusuf Bera Ertan
ddca0cecf6 feat(rust-crane): add devshell to packages 2023-09-06 00:48:26 +02:00
DavHau
556f2e7114 feat(lib): add helper lib.importPackages
This makes the repo initialization simpler (see examples)
2023-09-06 00:43:37 +02:00
DavHau
79fc0de519 examples: templates for all example packages and repos 2023-09-06 00:12:47 +02:00
DavHau
0e9553062c nodejs-granular-v3: use new nodejs-package-lock-v3 module
Also add an example package
2023-09-05 18:52:42 +02:00
DavHau
0d3be890a7 nodejs-granular-v3: init (copy from nodejs-granular) 2023-09-05 18:52:42 +02:00
DavHau
d7a037e723 fix(nodejs-package-lock-v3): handle multiple versions & auto load packageLock 2023-09-05 18:45:57 +02:00
DavHau
1202352107 checks.nix-unit: fix nix-unit call 2023-09-05 16:22:57 +02:00
hsjobeki
44f946d814 init: package-lock.json V3 parser 2023-09-05 16:22:57 +02:00
Vincent Vanlaer
3fd2db74d3
Support git repositories in fetchPipMetadata; take 2 (#637)
* Make pip lock script use its own python version

To make the lock script independent of the python version used in the
user's project, it needs to use its own python environment. This was
already the case for the mitm proxy, but not yet for the lock script
itself. This commit ensures that the lock script uses its own python
environment, independent of the user python version, and shares it with
the mitm proxy.

* Fix IOKit dependency in htop example

* Add hash for git based packages

* Support install git dependencies

* Add test for pip with git dependency

* Update lockfiles for python example projects

This does not change any of the hashes or versions, just adds the type:
"url" property.

---------

Co-authored-by: DavHau <hsngrmpf+github@gmail.com>
2023-09-05 00:40:05 +02:00
DavHau
1c959a708c fix(pip): missing writeText dependency 2023-09-04 03:51:56 +00:00
DavHau
e0d25af360 refactor(fetchPipMetadata)
- add flake-module.nix
- remove custom logic to find the repo root
- use findRoot script to find repo root
- use gitMinimal instead of git
- use separate python version for lock script than the python version to lock for. This prevents rebuilds and allows defining a standalone fetchPipMetadata package
2023-09-03 22:47:21 +00:00
DavHau
cb801a7994 fix(pip): conflicting override priority 2023-09-03 12:35:07 +00:00
DavHau
f9ccbf3e3f feat(pip): add .devShell attribute to package 2023-09-03 12:35:07 +00:00
DavHau
203cd1c656 fix(pip): remove default for format
This prevents an error where mkDerivation.src is coerced to a string while it is null which leads to hard to debug scenarios

I don't think we need this default logic for the top-level. The logic is still kept for the dependencies.
2023-09-03 12:10:23 +00:00
DavHau
e2470b3171 fix(paths): fix computation of lock and cache file paths 2023-09-03 10:28:43 +00:00
DavHau
ddbd3a159b example-repo: use dream2nix.lib.evalModules 2023-09-03 01:09:42 +00:00
DavHau
5d561bbf35 Revert "Support install git dependencies"
This reverts commit ecffc169c3.
2023-09-02 23:50:02 +00:00
Vincent Vanlaer
ecffc169c3 Support install git dependencies 2023-09-02 23:41:36 +00:00
DavHau
ec55d1d74b cleanup: remove commented code 2023-09-02 23:38:22 +00:00
DavHau
87722db970 feat(paths): init new core module 'paths'
This is to improve package location finding at eval time and script execution time.

Deprecates options lock.{repoRoot,lockFileRel} as well as option eval-cache.{repoRoot, cacheFileRel}

Instead the user must now set:
  - paths.projectRoot: pointing to the repoRoot
  - paths.package: pointing to the package directory

- paths.projectRootFile can be used to define a marker file to find the project root. The default is '.git' but it could be set to 'flake.nix' for example
- lock files are by default put in the same directory as the package definition
2023-09-02 23:34:54 +00:00
DavHau
39885acca7 deps: simplify example 2023-09-02 19:35:04 +00:00
DavHau
c5f5b03944 refactor: rename modules.drv-parts => modules.dream2nix 2023-08-31 13:09:43 +00:00
DavHau
f4371d3e9b refactor(examples): re-categorize
new categories:
- basics
- single-language
- multi-language
2023-08-31 12:53:22 +00:00
DavHau
cf0bd2e99a
Port php to dream2nix modules (#623)
* init: composer

* initial attempt to translating composer lock

* fix(v1/php): use simpleTranslate2 instead of simpleTranslate

* chore: rebasing

* init: granular module

* lib/internal/simpleTranslate2: revert accidental changes

* php: fix php-granular builder module

* php-compser-lock: cleanup

---------

Co-authored-by: asrar <aszenz@gmail.com>
2023-08-29 17:47:13 +02:00
DavHau
9b721a5cd3 feat(rust-crane): get rid of depsDrvOptions and use mkDerivation as a submodule instead 2023-08-28 22:20:28 +00:00
DavHau
42ac2de3a3 feat(rust-crane): use mkDerivation instead of mainDrvOptions 2023-08-28 22:20:28 +00:00
DavHau
2954969468 refactor(rust-crane): move crane dependency out of config.deps 2023-08-28 22:20:28 +00:00
Yusuf Bera Ertan
6e8a22196b feat(rust): pass mkDerivation options to crane options, add options to specify arguments for main and deps derivations 2023-08-28 22:20:28 +00:00
Yusuf Bera Ertan
5b4775c457 refactor: remove devshell code from buildRustPackage 2023-08-28 22:20:28 +00:00
Yusuf Bera Ertan
39a895d579 feat(rust): add some options to crane builder, move rust drvs to examples dir 2023-08-28 22:20:28 +00:00
Yusuf Bera Ertan
b2ca3da052 feat(rust): port crane builder 2023-08-28 22:20:28 +00:00