Commit Graph

219 Commits

Author SHA1 Message Date
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
DavHau
4234e462ce chore: re-generate all lock files 2023-09-18 17:56:27 +02:00
Yusuf Bera Ertan
599a42d247
refactor: update rust-package example to latest changes (#685) 2023-09-17 09:37:51 +00:00
Jairo Llopis
5a729cb75a docs: simplify python project example
Use `lib.importTOML`, clearer than the previous implementation.

Reuse more information from `pyproject`.
2023-09-15 10:33:20 +02:00
DavHau
a68165d109 chore: update lock files 2023-09-14 11:30:37 +02:00
DavHau
9cc6f02d94 feat(lock): lock file invalidation via lock.invalidationData 2023-09-14 11:30:37 +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
c5bdcd7e67 feat(python): add module WIP-python-pyproject 2023-09-11 22:40:08 +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
e079a21487 examples: simplify repo examples 2023-09-09 14:33:21 +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
45bf32881c fix(examples): fix rust-package example 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
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
0e9553062c nodejs-granular-v3: use new nodejs-package-lock-v3 module
Also add an example package
2023-09-05 18:52:42 +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
b40d88b4c3 examples: pick cheaper packages for nodejs
spare some eval time on CI checks
2023-09-05 00:03:21 +02:00
DavHau
b34ce70fdf refactor(examples): more meaningful names 2023-09-04 23:45:08 +02:00
DavHau
b296c9c868 examples: remove use of l = builtins // lib
Having this in the examples might confuse people
2023-09-04 21:30:27 +00:00
DavHau
5418f890b9 examples: add .project-root 2023-09-03 22:47:21 +00:00
DavHau
63fe4be09c fix(examples): use settings.nix 2023-09-03 08:32:17 +00:00
DavHau
165014ec90 examples: add dream2nix-repo-flake 2023-09-03 08:25:17 +00:00
DavHau
ddbd3a159b example-repo: use dream2nix.lib.evalModules 2023-09-03 01:09:42 +00:00
DavHau
1f071813d3 chore: update all lock files and move to new location 2023-09-02 23:34:54 +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
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
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
DavHau
8ffd5e2485 example: add pyproject example package 2023-08-28 15:27:03 +00:00
DavHau
d48babc7b5 examples: improve dream2nix-repo example 2023-07-29 15:29:06 +02:00
DavHau
890d60bcb4 examples: move to /examples from /modules/drvs 2023-07-29 15:08:40 +02:00
DavHau
ef388ef84c chore(modules): move core modules to ./modules/core 2023-07-29 12:36:13 +02:00
DavHau
fee831dd8f drv-parts: migrate some examples from drv-parts repo 2023-07-29 12:36:13 +02:00
DavHau
ac20d70957 examples: add dream2nix-repo
An example for a dream2nix repo with multiple packages
2023-07-24 22:21:37 +02:00
DavHau
336cbfc254 remove legacy examples + example tests 2023-07-18 19:13:11 +02:00
Grégoire Geis
5a3e87301f rust: add support for workspace-inherited crate versions 2023-07-04 21:43:35 +03:00
DavHau
771ff6e378 fix: remote location of cabal2json repo in examples 2023-03-13 12:45:31 +07:00
DavHau
b4b491bd77
Merge pull request #465 from max-privatevoid/flake-module-tweaks
flake-parts: add builder option + don't expose packages automatically
2023-02-16 09:19:56 +07:00
DavHau
f61d9311e2
Merge pull request #443 from oati/cabal-translator
haskell: add impure cabal-plan translator based on hackage translator
2023-02-01 15:01:17 +07:00
Max
5212f53cb9 examples: show manual package selection in flake-parts module 2023-01-31 17:41:55 +01:00
DavHau
073357486c haskell: cabal: fix project.toml of example 2023-01-31 16:03:43 +07:00
DavHau
759c70ed33
Merge pull request #431 from hsjobeki/nodejs/strict-builder-draft
new nodejs strict builder
2023-01-21 16:28:23 +08:00
Max
0b1dd7625a examples: don't set project name explicitly 2023-01-11 01:47:04 +01:00
Johannes Kirschbauer
f7eb51468a
Merge branch 'nix-community:main' into nodejs/strict-builder-draft 2023-01-04 11:13:05 +01:00
hsjobeki
49a2d7679f examples: fix small typo 2023-01-02 13:01:31 +01:00
hsjobeki
c65e34d386 remove: leftover example file 2022-12-30 22:51:54 +01:00
Erin
9e2f23d654 haskell: cabal translator: basic example based on the cabal-plan example 2022-12-30 15:39:27 -06:00
hsjobeki
1690984d06 add: structured output & fix example 2022-12-30 20:20:35 +01:00
hsjobeki
76ef564937 nodejs: add example how to use the new builder 2022-12-30 13:28:38 +01:00
Yusuf Bera Ertan
1cbc3aac3e
fix: use correct toolchain packages for rust_set-rust-toolchain example 2022-12-18 03:03:16 +03:00
DavHau
e82afbcb55 fix: python pip example 2022-12-15 14:53:22 +07:00
DavHau
011b8ba238 add example for defining projects as attrs 2022-12-13 13:40:46 +07:00
DavHau
a62727de80 add example for automatic project detection 2022-12-13 13:32:16 +07:00
DavHau
4b57061c04 fix example _d2n-extended: reference ./proejcts.toml 2022-12-13 12:46:38 +07:00
DavHau
01b5d43524 chore: use projects.toml in docs and examples 2022-12-13 12:42:03 +07:00
DavHau
8b4d355e80 chore: examples: _d2n-extend-devShell: override also default attribute 2022-12-09 11:22:27 +07:00
DavHau
ecc71875f5 chore: limit API surface; remove makeOutputs from examples 2022-12-04 01:17:34 +07:00
Antoine Carnec
fc71ea64a8 Removed erroneous pythonVersion argument 2022-12-01 16:18:19 +00:00
DavHau
ce047a9cea chore: stop promoting flake parts as api is in beta 2022-12-01 18:56:19 +07:00
DavHau
3dd3402908 feat: python: poetry: add flags pythonVersion, system 2022-11-23 12:52:36 +01:00
phaer
1885ab718d initialize poetry translator 2022-11-23 12:37:06 +01:00
phaer
0a60cec98c initialize poetry translator from templates 2022-11-23 12:37:06 +01:00
DavHau
b9225c85b4 chore: python: pip: rename pythonAttr -> pythonVersion 2022-11-23 12:15:03 +01:00
DavHau
8292f47f42 chore: python: rename pinned -> pip-freeze 2022-11-23 10:58:17 +01:00
Florian Friesdorf
8fe0f06a47 Add python translator for pinned packages
Co-authored-by: DavHau <hsngrmpf+github@gmail.com>
2022-11-22 18:06:20 +00:00
Yusuf Bera Ertan
da25b343c6
refactor: rename dream2nixInterface -> dream2nix-interface 2022-11-22 17:45:11 +03:00
Yusuf Bera Ertan
f44016a2d4
refactor: move dream2nix interface to modules 2022-11-20 09:03:09 +03:00
DavHau
a0c0260c14 chore: reduce packages built by .#tests-examples 2022-11-15 00:13:25 +01:00
DavHau
1eec3ec74f feat: add example for defining projects manually 2022-11-13 16:00:32 +01:00
Yusuf Bera Ertan
6f840b11f1
fix: rename checks in examples 2022-11-13 14:19:46 +03:00
Yusuf Bera Ertan
37c71736a7
refactor: change some examples sources to make them take less time on CI 2022-11-13 14:11:56 +03:00