Commit Graph

613 Commits

Author SHA1 Message Date
DavHau
aab1b396e8 feat: strongly simplified discoverers.
This aims to reduce the complexity of adding support for new ecosystems to dream2nix.

Now`discoverProject` can be defined in a translator, which allows to detect projects for that translator with a simple 3-liner.

This should be the default, and only later if complexity is required a fully featured discoverer needs to be implemented.
2022-06-01 23:29:47 +02:00
DavHau
2047caab52 python ffi: ensure store paths don't lose context 2022-06-01 23:07:40 +02:00
DavHau
7c02eb5e0b fix builder template to fit #155 2022-06-01 23:04:12 +02:00
DavHau
c7c59c8353 simpleTranslate2: ignore irrelevant dependency objects 2022-06-01 23:02:15 +02:00
DavHau
965d1b1a31 cleanup: remove dead code from getDreamLockPath 2022-06-01 23:01:55 +02:00
Yusuf Bera Ertan
9b6638a1a7
feat: implement makeOutputs that outputs systemless structure (#161)
* feat: return underlying d2n instance if pkgs was passed to init, document init pkgs

* feat: implement makeOutputs

* tests: dont fail if resolveImpure fails

* feat: make init return a dream2nix instance, rework makeFlakeOutputs code

* feat: default to source if config.projectRoot is not specified, update examples and readme

* fix: update the simple template

* docs: clarify init in readme

* docs: change readme numbering to back to 1

* refactor: dont default projectRoot to source

* docs: make extensive example use makeFlakeOutputs, link per-pkgs d2n example in readme

* fix: call loadConfig correctly
2022-06-01 22:53:46 +02:00
Yusuf Bera Ertan
ca7f4d0a7f
fix(rust/builders): dont default to rev as ref part while generating Cargo.lock (#163) 2022-05-30 23:58:15 +03:00
DavHau
39facf29df fix templates for pure/impure translator 2022-05-30 18:30:05 +02:00
DavHau
3d0ed21c2a fix contribute app and templates.
adapt to changes from #155
2022-05-30 14:14:56 +02:00
Yusuf Bera Ertan
8d275a1dc9
fix: expose all builder outputs (#162)
* fix: expose all builder outputs

* fix: don't recursively update into derivations
2022-05-29 22:16:44 +02:00
DavHau
c83389fd43 Fix: #152 parse npm:package-name@ver correctly
closes #160

Co-authored-by: tgunnoe
2022-05-29 22:01:08 +02:00
Yusuf Bera Ertan
645c6fd98e
refactor: implement a validation system for builders / translators, reorganize files (#155)
* refactor: implement a validation system for builders / translators etc, organize files

* refactor: use seq instead of complicated validation function for validator

* feat: allow adding discoverers, translators and builders via config

* refactor: rework discoverers to use makeSubsystemModules as well

* fix: validate extra modules properly

* feat: support inline modules

* feat: use extra attribute for extending

* feat: make fetchers extensible properly

* fix: add name to extra fetchers

* feat: support list for extra

* docs: add some comment to lib/modules.nix

* fix: get extra module args from extraArgs

* fix: collect all modules instead of only collecting modules for built-in subsystems

* refactor: minor improvements

* refactor: improve how default subsystem modules are declared

* fix: translators and builders are directly under subsystem now

* fix: correct attribute path, remove unused argument

* fix: correct translators attribute paths

* fix: correct file paths and translators attribute paths

* fix: use correct translator attr path in wrapPureTranslator

* fix: update unit tests code

* fix: remove extra paranthesis in unit tests code

* tests: add an extended dream2nix example

* refactor: replace recursiveUpdate usage with normal update op

* tests: fix and extend d2n-extended example

* fix: pass config to d2n instance in wrap pure translator script

* fix: correct toFile usage

* fix: pass config to dlib in more places

* fix: pass config to d2n instance in aggregated hashes cli and gomod2nix translator

* refactor: remove unused extra modules validation, add warning for function modules

* fix: remove non-existent inherited variable

* docs: update translator attr path in contributors guide

* docs: add docs for extending dream2nix

* refactor: comment more code, warn for function modules only if extra is an attrset decl

* docs: fix some typos

* docs: explain some stuff in extending d2n better

* fix: print function modules warning when it is a function

* tests: add a new example that tests adding new subsystem and config.extra as nix file

* tests: use cargo-toml as translator on d2n-extended to potentially catch more bugs

* feat: add ifd warning for builders

* tests: use build-rust-package builder instead of crane builder in d2n-extended to also test it instead of only testing crane builder

* fix(rust/builders): always write the generated Cargo.lock so it doesnt get out of sync with our dream-lock

* fix(rust/builders): delete cargo lock before writing it?

* refactor: also print ifd warnings for translators

* docs: link extending d2n doc in readme, link examples in extending d2n

* docs: example naming (translators.new -> translators.example-translator)

* feat: allow setting nix files for modules declarations (eg. subsystems, subsystems.translators)

* refactor: move IFD warnings to src/lib/builders.nix / translators.nix respectively

* refactor: throw instead of warning if function declarations for modules are used

* refactor: fix throw usage

* refactor: improve modules code

* chore(deps): update nixpkgs

* fix: correct some map usages

* fix: use correct attr path for extra modules

* chore: update examples flake inputs

* style: minor formatting changes
2022-05-29 21:42:47 +02:00
DavHau
4b3dfb101f fix broken tsconfig converter script
-  see 72e73fa255 (r74144832)
2022-05-21 14:18:51 +02:00
DavHau
cf39c16a6b yarn-lock: generate unit tests for cardano-js-sdk 2022-05-20 15:35:31 +02:00
DavHau
01c0df4eaf Merge remote-tracking branch 'nrdxp/yarn-fix' 2022-05-20 15:35:22 +02:00
Yusuf Bera Ertan
3a5ed1a596
refactor(builder/crane): use runCommandNoCC instead of runCommand 2022-05-20 15:07:32 +03:00
Timothy DeHerrera
58cafa92ab
fix: bad regex in yarn translator
Also don't allow evaluation to fail, but instead provide default value.
2022-05-19 14:37:56 -06:00
DavHau
7b0162c227 fix builders template 2022-05-19 18:30:06 +02:00
DavHau
13b7536e28 improve builder template 2022-05-19 17:26:28 +02:00
DavHau
efe9698305 refactor: clean up builder interface 2022-05-19 16:54:32 +02:00
Yusuf Bera Ertan
ce73e1a256
fix(rust/builders): change a null default to a string default so hasPrefix doesnt error 2022-05-18 22:52:12 +03:00
Yusuf Bera Ertan
1bfa39b68e
fix(translator/cargo-toml): fix comment, actually inherit options from cargo-lock 2022-05-18 19:16:07 +03:00
Yusuf Bera Ertan
00bef62ae7
fix(rust/builders): remove IFD while using writeCargoLock 2022-05-18 19:13:40 +03:00
Yusuf Bera Ertan
2fd96e44e9
feat: implement cargo-toml impure translator for rust subsystem (#144) 2022-05-18 09:21:56 +03:00
DavHau
ad48c2134c Merge remote-tracking branch 'jaen/resolve-path-sources-relative-to-source-root' 2022-05-17 20:11:55 +02:00
DavHau
0ace4f5e05
fix src/fetchers/default-fetcher.nix 2022-05-17 20:11:32 +02:00
DavHau
bb5be4955d fix typo in builder template 2022-05-17 19:31:47 +02:00
DavHau
1e016126ef fix path sources not supplied with root[Name|Version] 2022-05-17 12:57:03 +02:00
DavHau
8574ecf381 nodejs: account for empty dependencies 2022-05-17 12:16:49 +02:00
Yusuf Bera Ertan
34a272a39c
fix(fetcher): make sourceRoot be used after rootName and rootVersion are tried for path sources 2022-05-15 23:11:37 +03:00
Tomek Mańko
15b822a040 Resolve path sources relative to the source root 2022-05-08 21:29:01 +02:00
DavHau
e5d0e9cdb0 fix comment python discoverer 2022-05-06 15:47:47 +02:00
dusk
aaa946287e
refactor(translator/cargo-lock): dont add name and version to crates-io source (#142) 2022-05-05 22:53:46 +03:00
dusk
d9fbf0d0a8
tests: add cargo-lock translator test with git dependencies (#140) 2022-05-05 00:58:26 +03:00
Yusuf Bera Ertan
3c5bf628ef
fix(fetcher/git): handle ref checking correctly 2022-05-04 22:39:54 +03:00
Yusuf Bera Ertan
1b79f68d98
fix(translator/cargo-lock): dont assume parsed.type exists, use null if it doesnt 2022-05-04 20:38:11 +03:00
dusk
8966d32215
feat: allow ref to be specified in git source (#137)
* feat: allow ref to be specified in git source

* feat(translator/cargo-lock): add ref to git source if one is provided

* refactor(fetcher/git): also check for null for ref

Co-authored-by: DavHau <hsngrmpf+github@gmail.com>

* refactor(fetcher/git): move ref check for rev to a let in to avoid recomputing it

* refactor(fetcher/git): do null check for inp.ref in refAndRev

Co-authored-by: DavHau <hsngrmpf+github@gmail.com>
2022-05-03 21:23:50 +02:00
Yusuf Bera Ertan
c807bf85af
fix(translator/cargo-lock): try to get crates-io checksum from the metadata table of a cargo-lock, if it exists 2022-05-03 06:19:53 +03:00
Yusuf Bera Ertan
5a4076a881
fix(translator/cargo-lock): attempt to fix dep entry parsing bug 2022-05-03 05:57:00 +03:00
Yusuf Bera Ertan
a2cbbb576c
feat: expose makeOutputsForDreamLock 2022-05-02 13:05:55 +03:00
Gérald Lelong
8df4f0beee
don't mv ../.cargo/config if it doesn't exist (#133) 2022-04-28 19:33:27 +02:00
dusk
1c8faf4882
Another round of rust fixes (#130)
* fix(builder/build-rust-package): don't hardcode cargo config path

* refactor(rust): vendor every dependency in cargo lock to fix some build issues, clarify some code

* fix(builder/build-rust-package): cargoCheckFlags -> cargoTestFlags
2022-04-27 11:57:41 +02:00
dusk
c93972bd52
fix(translator/cargo-lock): prioritize workspaceToml for path dependencies (#128)
* fix(translator/cargo-lock): prioritize workspaceToml for path dependencies

* fix(builder/rust): replace paths with quotation marks so we dont accidentally replace features
2022-04-26 00:10:59 +02:00
dusk
c303f3a754
Attempt to fix #113 (#115)
* fix(translator/cargo-lock): flatten workspace member paths to fix coerce error

* wip

* get a list of crates in discover and pass to translator

* prevent re-reading directory tree

Co-authored-by: DavHau <hsngrmpf+github@gmail.com>

* fix path dependency creation

* use correct attr path

* get subsystemInfo properly

* fix discoverCrates

* default to empty subsystemInfo.crates

* fix replacePathsWithAbsolute

* fix hasAttr usage

* dont put fullPath in subsystemInfo

Co-authored-by: DavHau <hsngrmpf+github@gmail.com>
2022-04-25 01:32:29 +02:00
DavHau
f8796aba28
Merge pull request #127 from happysalada/fix_electron_darwin_hook
electron: fix darwin build
2022-04-24 21:05:43 +02:00
DavHau
b68a9ee61c add: dlib.sanitizePath 2022-04-24 20:40:42 +02:00
happysalada
262e647b67 electron: fix darwin build 2022-04-24 11:25:03 -04:00
DavHau
40d3e16050 improve resolveImpure error message
closes #111
2022-04-24 12:46:02 +02:00
DavHau
31c258880c add unit tests for cargo-lock translator 2022-04-24 12:05:04 +02:00
DavHau
3a293cc914 automatic unit tests for pure translators
- translators can now enable unit tests via `generateUnitTestsForProjects`
2022-04-24 12:04:08 +02:00
DavHau
d47b764ef7 refactor: move simpleTranslate2 to dlib 2022-04-23 15:52:46 +02:00
DavHau
60d9308a7b refactor: wrapPureTranslator2 -> wrapPureTranslator 2022-04-23 14:50:17 +02:00
DavHau
3b81f4e35b refactor: translatorsV2 -> translators 2022-04-23 14:48:00 +02:00
DavHau
e8410dc566 fix pure translator template 2022-04-23 13:19:13 +02:00
DavHau
2480581482 change config default for packagesDir: packages -> dream2nix-packages 2022-04-22 22:53:02 +02:00
DavHau
74e8474a21 fix: exclude packagesDir and overridesDirs from invalidationHash 2022-04-22 22:45:35 +02:00
DavHau
890183d2c6 remove more legacy translator code 2022-04-20 17:06:58 +02:00
DavHau
0bd073908f fix typo: aggregates -> aggregated 2022-04-20 16:59:12 +02:00
DavHau
34f1ff3e23 remove deprecated interfaces:
- makeOutputs
- translators.translators
2022-04-20 16:58:38 +02:00
DavHau
feb7eabd0c fixup cargo-lock translator 2022-04-17 14:42:48 +02:00
DavHau
2331a0aa02 fix value is a string error when overriding sources 2022-04-17 14:42:37 +02:00
Yusuf Bera Ertan
2eb9461868
feat: port cargo lock translator to simpleTranslate2 2022-04-16 14:03:33 +03:00
DavHau
25d8bf5125 start moving crago-lock to translator v2 interface 2022-04-15 01:16:32 +02:00
DavHau
e9b336953a Merge branch 'main' into cargo-lock-subpackages 2022-04-15 00:34:25 +02:00
DavHau
8eebb32a52 update translator templates 2022-04-14 23:58:40 +02:00
Yusuf Bera Ertan
07c7d7d2dc
fix: make cargo-lock translator handle discovered project path deps seperately, handle store path source paths correctly 2022-04-12 06:29:49 +03:00
Yusuf Bera Ertan
1cca528ec6
fix(translator/cargo-lock): filter out root member (.) since we already parse this 2022-04-10 17:53:25 +03:00
Yusuf Bera Ertan
aa6099ecf2
feat(translator/cargo-lock): use discoveredProjects to find dependencies that are outside of a packages source 2022-04-10 17:22:58 +03:00
DavHau
e939aa6810 fix: rust source path self reference
fixes #107
2022-04-04 16:55:08 +01:00
DavHau
be7f4f488d rust: fallback to relPath if name not in Cargo.toml 2022-04-04 16:34:23 +01:00
DavHau
ecf409e502 ignore peerDependencies for top level package
fixes #105
2022-04-04 15:40:47 +01:00
DavHau
0bcb6ec0f5 remove .#resolve
(in favor of .#package-name.resolve)

fixes #106
2022-04-04 12:36:45 +01:00
DavHau
0ceb2b95b4 fix: injecting unknown dependency breaks eval
fixes #104
2022-04-04 11:52:34 +01:00
tgunnoe
fb232c8cb0 fix: typo workspaceDependencies 2022-03-30 14:54:14 -04:00
tgunnoe
d019c19164 fix: use name attr before workspace path 2022-03-30 14:54:14 -04:00
DavHau
170a157b1f add comment for filteredRequires in package-lock transl. 2022-03-30 16:46:46 +07:00
DavHau
7afa741704 fix: navigating to relPath in package-json transl. 2022-03-30 16:23:27 +07:00
DavHau
ec30059894 some fixes for package-json and package-lock
- fix missing git & ssh in pacakge-json translator
- package-lock: if dependency missing, raise warning instead of error.
2022-03-30 16:17:55 +07:00
DavHau
f2d40e70cb remove tests-impure 2022-03-28 23:34:56 +07:00
DavHau
502a2fefc5 fix aggregated fetching 2022-03-28 23:20:44 +07:00
DavHau
98ca5ea9bc treat subsystemInfo as translatorArgs 2022-03-28 13:53:06 +07:00
DavHau
489f1ab2c7 remove cli and cli2 2022-03-27 22:40:54 +07:00
DavHau
48439d7e8b rename: lib2 -> lib 2022-03-27 22:32:08 +07:00
DavHau
0593d9d931 remove lib.nix 2022-03-27 22:31:17 +07:00
DavHau
065c283b75 add sourceOverrides to lib2 2022-03-27 21:45:31 +07:00
DavHau
783a64d33a allow selecting builder via lib2 2022-03-27 20:08:22 +07:00
DavHau
c121372991 fix broken format-dream-lock.py 2022-03-25 19:30:46 +07:00
DavHau
6882b06562 fix typo makeFlakeOutpus -> makeFlakeOutputs 2022-03-15 23:24:16 +07:00
DavHau
0ef1821bdc toposort discovered projects to improve selection of main project 2022-03-14 10:15:19 +07:00
DavHau
cd223d4669 python: fix pip translator 2022-03-14 10:14:23 +07:00
DavHau
753452e0fb add discoverer for python 2022-03-14 10:14:01 +07:00
DavHau
e840c50ec7 mark pip translator as experimental 2022-03-13 13:06:58 +07:00
DavHau
07d43c4536 fix python translator + builder 2022-03-13 13:01:20 +07:00
DavHau
c90bcd7389 disable go translator 2022-03-12 23:08:02 +07:00
DavHau
40dedd358a fix: simpleTranslate[2]: filter out store paths 2022-03-12 19:43:46 +07:00
DavHau
38cfc11d5c fix: getRoot trying to resolve root of mainPackage 2022-03-12 19:07:58 +07:00
DavHau
5b1a71c10e add discoverer for rust 2022-03-12 17:51:43 +07:00
DavHau
1fbd29bc66 introduce dlib.construct for safe object cosntruction 2022-03-12 14:38:20 +07:00
DavHau
83c1d872d7
Merge pull request #99 from tgunnoe/git-plus-resolved
fix: parse resolved keys with git+https correctly
2022-03-12 14:15:18 +07:00
tgunnoe
9b1ca860f0 fix: parse resolved keys with git+https correctly 2022-03-11 23:26:56 -05:00
DavHau
5beb65e370 refactor yarn-lock translator 2022-03-10 17:10:21 +07:00
DavHau
d0cfed18e7 add inject for lib2 2022-03-10 17:05:34 +07:00
DavHau
6341f38026 nodejs improvements:
- create passthru.dependencies
- always include peerDeps
- correctly write `location` to dream lock
2022-03-10 14:43:12 +07:00
DavHau
ae169b42ac fix: path of path dependencies not computer correctly 2022-03-10 14:41:29 +07:00
DavHau
3f46f3fad2 fix: count workspaces as dependencies 2022-03-10 14:01:18 +07:00
DavHau
5e8758f22d yarn-lock transaltor fixes
- pick correct lock file fo nested workspaces
- add workspaces to dependencies
2022-03-10 14:00:35 +07:00
DavHau
bac2e77dbf resolve: don't write empty json on failure 2022-03-10 13:58:48 +07:00
DavHau
6b015ff9f5 fixup formatting issues 2022-03-07 18:06:28 +07:00
DavHau
076a1c9aff treewide: format with alejandra 1.0.0
closes #84
2022-03-07 18:06:18 +07:00
DavHau
7641236307
Merge pull request #97 from yusdacra/rust/crane-fixes
fix(rust): dont use hardcoded CARGO_HOME to /build
2022-03-07 17:02:54 +07:00
DavHau
058bc6cf9b dix dream-lock formatting in makeTranslateScript 2022-03-07 11:30:33 +07:00
Yusuf Bera Ertan
09552b21ba
fix(rust): dont use hardcoded CARGO_HOME to /build 2022-03-06 17:19:39 +03:00
DavHau
dac0e8dba9 always export resolveImpure attribute 2022-03-06 00:56:53 +07:00
DavHau
0ce62ee50a
Merge pull request #96 from yusdacra/rust/crane-fixes
fix(rust): fix source replacement config write for crane
2022-03-06 00:43:28 +07:00
DavHau
90649d117a fix invalidationHash logic + remove .#resolve messages 2022-03-06 00:38:06 +07:00
Yusuf Bera Ertan
6895578bea
fix(rust/crane): make crane main build drv only build the package we want to build 2022-03-05 20:29:22 +03:00
Yusuf Bera Ertan
2494b772e2
fix(rust): fix source replacement config write for crane
also make it so that buildRustPackage and crane builder both use same CARGO_HOME
for more consistency
2022-03-05 20:16:31 +03:00
DavHau
77763c957e feature: add new dream-lock.json files to git 2022-03-06 00:05:13 +07:00
DavHau
bc3c3820b0 fix fallback on existing dream-lock.json 2022-03-05 23:55:42 +07:00
DavHau
924bb494e6 feature: nix run .#resolveImpure 2022-03-05 23:34:09 +07:00
DavHau
1878b8f247 feature: add .resolve to every package 2022-03-05 18:44:01 +07:00
DavHau
e7f65555cb translator v2 iface to accept only one project 2022-03-05 16:17:14 +07:00
DavHau
4828105acb translateProjects: return resolved projects 2022-03-05 15:13:48 +07:00
DavHau
b97b84f943 rename: resolveProjectsFromSource -> translateProjects 2022-03-05 14:48:17 +07:00
DavHau
f8f37dd50e lib2: enable packageOverrides 2022-03-05 14:29:55 +07:00
DavHau
6d4b62be79 fix: error on non-top-level workspace roots 2022-03-05 11:42:56 +07:00
DavHau
2a696e7198 nodejs: filter projects duric dicovery 2022-03-05 10:49:43 +07:00
DavHau
16f3667c2c expose cli2 2022-03-04 21:31:43 +07:00
DavHau
b1b80111d2 automatically add dreamLockPath to discovered projects 2022-03-04 21:24:47 +07:00
DavHau
017b2e0144 WIP: cli2 init 2022-03-04 20:45:43 +07:00
DavHau
c7411e67be fix: hashPath and hashFile missing nix options 2022-03-04 20:45:33 +07:00
zimbatm
46dd1ab167
use one nixpkgs instance
Push the nix configuration into the CLI so we don't need the overlay,
and so we don't need to create another instance of nixpkgs.

This also means that the python CLI can be executed directly as long as
the user has a recent-enough version of nix and make iterations a bit
faster.

For more details, see
https://zimbatm.com/notes/1000-instances-of-nixpkgs
2022-03-04 13:26:16 +01:00
DavHau
848c424c03 fix: don't error out on impure unresolved projects 2022-03-03 15:58:07 +07:00
DavHau
2b6bcb7b75 add settings argument to lib2.makeFlakeOutputs 2022-03-03 15:48:30 +07:00
DavHau
29741906b2 Handle edge cases with npm workspaces:
- fixes #93
- package.json workspaces is an attrset instead of list
- workspaces pointing to non-existent directory
- workspaces pointing to a directory whithout a package.json
2022-03-02 19:00:09 +07:00
DavHau
5b8a09c764 nodejs: execute npm run build on all workspace packages 2022-03-02 16:03:23 +07:00
DavHau
193b852534 yarn-translator: enable workspace support 2022-03-02 15:33:54 +07:00
DavHau
07a2e7cd9f fixes for yarn-lock translator 2022-03-02 12:44:12 +07:00
DavHau
54b9d1a61e fix: single file lookup via prepareSourceTreeInternal 2022-03-02 12:43:46 +07:00
DavHau
95c6595165 yarn-lock translator: use simpleTranslate2 2022-03-02 12:05:43 +07:00
DavHau
97c75df083 introduce simpleTranslate2
This is a refined interface improving upon simpleTranslate
2022-03-02 12:05:15 +07:00
DavHau
ff01488c42 update yarn-lock translator to v2 interface (no workspaces yet) 2022-03-01 17:56:42 +07:00
DavHau
021e1ef928 factor out some funcs from package-lock -> nodejsUtils 2022-03-01 15:57:20 +07:00
DavHau
1fc9998b0f add flake output projectsJson 2022-03-01 14:21:26 +07:00
DavHau
89a0c4f4c3 handle empty yarn.lock correctly 2022-03-01 13:47:01 +07:00
DavHau
e075f98a90 fix: externalDir not copied to store 2022-02-28 12:11:55 +07:00
DavHau
958bdd6699 Squashed commit of the following:
commit c580c24b82
Author: Yusuf Bera Ertan <y.bera003.06@protonmail.com>
Date:   Sun Feb 27 21:51:58 2022 +0300

    feat: expose builders in lib.init

commit 2fe01e1715
Author: Yusuf Bera Ertan <y.bera003.06@protonmail.com>
Date:   Sun Feb 27 18:37:39 2022 +0300

    fix(rust/crane): make sure cargo only builds the package we want

...(more)
2022-02-28 11:25:39 +07:00
DavHau
e12bc2fef3 fix: no effect when passing builder to makeFlakeOutputs 2022-02-27 23:59:16 +07:00
DavHau
6cf61ee767 allow selecting builder in makeFlakeOutputs 2022-02-27 23:33:10 +07:00
DavHau
70f30b6eef fix bug: package-lock translator not detecting devDependencies 2022-02-27 19:48:17 +07:00
DavHau
7ff0d5d0e8 add field _generic.location to dream-lock 2022-02-27 19:06:38 +07:00
DavHau
6fb2ec0e6a imrpove nodejs discovery
- use dream-lock transaltor for packages without any dependencies
- scan sub-directories of non-project dirs
2022-02-27 18:46:38 +07:00
DavHau
d76407b4cd expose project discovery via lib2 2022-02-27 17:26:13 +07:00
DavHau
c470172eea improve realizeProjects & resolveProjectsFromSource 2022-02-27 17:25:24 +07:00
DavHau
6a232399ad improve error handling when invalid args passed 2022-02-27 15:48:05 +07:00
DavHau
ed9bdd2fa2 small fixes in translators and resolving 2022-02-27 15:37:09 +07:00
DavHau
d8d0856c96 replace transl. package-lock with package-lock2 2022-02-27 15:36:25 +07:00
DavHau
14954c7d14 init translatorV2 downwards compatibility 2022-02-27 14:07:51 +07:00
DavHau
0ba71a6d1b fix bug when no workspaces in package.json 2022-02-27 00:50:57 +07:00
DavHau
a9f9eaad2a move some more funcs from utils to dlib 2022-02-27 00:50:15 +07:00
DavHau
79a8805656 filter projects in package-lock2 translator 2022-02-26 20:52:55 +07:00
DavHau
cca2b5c402 introduce realizeProjects 2022-02-26 20:52:26 +07:00
DavHau
35af8a5801 fix getNodeFromPath edge cases 2022-02-26 20:50:44 +07:00
DavHau
fa4998d1f4 nodejs builder: export all packages from dream-lock 2022-02-26 20:49:57 +07:00
DavHau
838db1097e make V1 translators V2 comaptible 2022-02-26 10:59:06 +07:00
DavHau
4cb3b20aae proejctRoot default value -> null 2022-02-26 10:57:22 +07:00
DavHau
b1872eb866 fixup resolveAllProjects 2022-02-26 00:54:52 +07:00
DavHau
8fbd1d51a9 fix output of package-lock2 translator 2022-02-25 21:38:08 +07:00
DavHau
57bc7e9c41 WIP: init resolveAllProjects 2022-02-25 21:36:15 +07:00
DavHau
025c4d059f refactor makeOutputs: init makeOutputsForDreamLock 2022-02-25 18:35:13 +07:00
DavHau
0c7e66d79a refactor translators: introduce all 2022-02-25 16:44:48 +07:00
DavHau
5004d7eb5a move parsing helpers from utils to dlib 2022-02-25 16:40:02 +07:00
DavHau
fdaf0589d5 init: package-lock2 translator 2022-02-25 15:11:32 +07:00
DavHau
2afaae4f5b fix and improve prepareSourceTree 2022-02-25 15:11:15 +07:00
DavHau
42507e645c remove dreampkgs reference from readme 2022-02-25 12:52:44 +07:00
DavHau
82389dc014 nodejs builder: only export main package 2022-02-25 12:43:44 +07:00
DavHau
fb8928ae0a implement project discoverer for nodejs 2022-02-25 11:03:50 +07:00
DavHau
afcf7158ae implement projectName for most translators 2022-02-23 19:59:25 +07:00
DavHau
10bbe80f13 refactor: tlib -> dlib.translators 2022-02-23 19:25:52 +07:00
DavHau
b78958849d remove dependency nix-parsec 2022-02-23 19:12:33 +07:00
DavHau
ae3172315e new yarn parser (supports yarn2) 2022-02-23 19:06:08 +07:00
DavHau
6a46a26700 extend translator templates with projectName 2022-02-23 17:40:19 +07:00
DavHau
485eb0be73 feature: allow omitting pname on makeFlakeOutputs 2022-02-23 17:35:01 +07:00
DavHau
7e78d8b37b move some translator funcs to system independent lib 2022-02-23 16:51:47 +07:00
DavHau
8f2fd2afed rename: compatiblePaths -> compatible 2022-02-23 15:29:53 +07:00
DavHau
02eb4a1cf4 refactor: source instead of inputDirectories/Files 2022-02-23 15:26:34 +07:00
DavHau
b4fef5baf0 make some translator functions system independent
- introduce `dlib` - system independent lib
- refactor all translators, to make functions extraArgs and conpatiblePaths system independent
2022-02-23 14:59:42 +07:00
DavHau
3e19b05b9a fix: sourceOverrides not applied to path sources 2022-02-23 12:15:27 +07:00
DavHau
59754b406d nodejs: fix 2 bugs in granular builder
1. package.json dependencies can be a list
2. bin symlinking for namespace packages
2022-02-23 12:13:50 +07:00
DavHau
d19ec4932b fix --no-default-nix description 2022-02-23 12:11:25 +07:00
DavHau
195d0a7e03 fix bug when translatorArgs contained integer 2022-02-22 21:00:40 +07:00
DavHau
a1449936ff fix projectRoot config missing 2022-02-22 20:24:53 +07:00
DavHau
767db79095 raname: riseAndShine -> make[Flake]Outputs 2022-02-22 20:21:33 +07:00
DavHau
d8300cb909 Always build from dream-lock.json if exists
- add an invalidationHash to dream-lock.json
- always evaluate dream-lock.json if exists
- warn user if dream-lock.json doesn't exist
2022-02-22 18:23:49 +07:00
DavHau
ba967fcbe0 remove (most) interactivity of CLI 2022-02-22 15:10:01 +07:00
DavHau
2772c26105 integrate impure translation with flakes
Now if dream2nix is used via flakes and impure translation is required, the user will be isntructed to `nix run ...` something to generate the missing dream-lock.
2022-02-22 15:04:16 +07:00
Yusuf Bera Ertan
129134fcd3
fix(rust): don't vendor path deps, handle git dep configs more correctly, handle cyclic deps correctly 2022-02-20 12:16:09 +03:00
Yusuf Bera Ertan
947fb621a8
fix(rust): write cargo checksum for path dependencies 2022-02-10 20:30:26 +03:00
DavHau
2167b7e993 fix bug in rust packages structure 2022-02-10 12:47:58 +07:00
DavHau
04901e48d2 update dream-lock.example for rust subsystem 2022-02-10 11:44:50 +07:00
DavHau
4f35c7b633 rust translator/builder to use dream-lock packages 2022-02-10 11:43:14 +07:00
DavHau
f634038bbf WIP - adapt code to dream lock changes 2022-02-10 11:43:14 +07:00
DavHau
28c29947cd dream-lock structure changes
remove fields:
 - translator
 - translatedBy
 - mainPackageName
 - mainPackageVersion
add fields:
 - defaultPackage
 - packages
2022-02-10 11:43:14 +07:00
DavHau
ea3d1a2ac1 simplify example flake.nix
fixes a bug where a source tree input was interpreted as a laoded dream-lock
2022-02-09 15:13:49 +07:00
DavHau
817f4d3ba0 package-json transl.: add arg 'npmArgs' 2022-02-04 13:40:56 +07:00
Yusuf Bera Ertan
405e63e941
feat: throw an error in getSourceSpec if the requested dep doesnt exist 2022-01-16 13:00:53 +03:00
Yusuf Bera Ertan
2477a55fbb
fix(rust): put relative paths instead of store paths in lockfile for path deps 2022-01-16 12:56:54 +03:00
Yusuf Bera Ertan
e8c4baf602
feat(rust): use script instead of nix code to find crate paths 2022-01-16 12:56:54 +03:00
Yusuf Bera Ertan
3c6af2acbf
feat(rust): remove git deps from subsystem attrs, use getSourceSpec instead 2022-01-16 12:56:54 +03:00
Yusuf Bera Ertan
c9ea0f7c13
feat: add getSourceSpec 2022-01-16 12:56:54 +03:00
Yusuf Bera Ertan
1d8fc17b93
feat(rust): extend the dream.lock.example.json for the subsystem 2022-01-16 12:56:54 +03:00
Yusuf Bera Ertan
5d18abcdab
fix(rust): write cargo-checksum for vendored git dependencies
fix(rust): copy sources instead of symlinking so we can write cargo checksum

feat(rust): add trace for is git

feat(rust): add trace for is git

feat(rust): add trace for git deps

feat(rust): add trace for git deps

fix(rust): use findFirst not findSingle for finding git dep

fix(rust): remove is git trace

refactor(rust): remove unused code
2022-01-16 12:56:54 +03:00
Yusuf Bera Ertan
901f8a4fc8
fix(rust): pass git dependency parsed information to builders, generate cargo config for git dependencies
fix(rust): fix infinite recursion caused by same name

fix(rust): split gitDeps, generate vendor entries properly

fix(rust): fix infinite recursion in builder

fix(rust): apply git source type to generated vendor entries after applying replace-with

fix(rust): don't overwrite cargo config with generated entries
2022-01-16 12:56:54 +03:00
Yusuf Bera Ertan
e5e88a03b5
feat(rust): workaround git dependencies that are in a workspace by locating the crate source more accurately
fix(rust): copy over findCratePath to builder

fix(rust): correct getAllFiles usage
2022-01-16 12:56:54 +03:00
Yusuf Bera Ertan
f380a81016
fix(rust): dont use src.name
feat(rust): add trace to builder
2022-01-16 12:56:54 +03:00
Max
2132262d5c yarn-lock: allow empty quoted strings 2022-01-13 19:34:36 +01:00
Tom Bereknyei
d2143bb96d Parse unquoted strings in yarn.lock
Sometimes there will be unquoted strings (eg: latest) in dependecy
positions. They are resolved elsewhere but results in a parse error.
2022-01-10 11:03:52 -05:00
DavHau
e69cb52ab0 nodejs builder+translator improvements 2021-12-22 17:31:37 +01:00
DavHau
792deb6a6b feature: CLI: add --sub-dirs flag to enable recursive package transaltion 2021-12-22 17:28:34 +01:00
DavHau
72e73fa255 bugfix: unable to parse tsconfig with comments 2021-12-19 17:06:44 +01:00
DavHau
013dc86524 improve electron support 2021-12-19 14:39:33 +01:00
DavHau
a08f5eb25a merge dev 2021-12-11 11:12:52 +07:00
DavHau
8934508e66 refactor simpleTranslate 2021-12-11 09:13:26 +07:00
DavHau
6a96f26e14 nodejs builder: support electron apps 2021-12-11 09:07:14 +07:00
DavHau
dafda69911 add.py: imporve handling+naming of subpackages 2021-12-11 09:05:59 +07:00
DavHau
87b6959039 fix updating packages + add test 2021-12-09 15:47:08 +07:00
DavHau
728677b654 nodejs package-json: improve + add arguments 2021-12-09 14:46:12 +07:00
DavHau
ed08f9e24c fix fetchers: npm, pypi 2021-12-09 12:55:32 +07:00
DavHau
d608742406 fix: yarn-lock translator 2021-12-08 23:29:09 +07:00
DavHau
1358e1a303 always use internal overrides 2021-12-08 23:18:21 +07:00
DavHau
12c9f565aa nodejs: use package name set via CLI 2021-12-08 23:18:21 +07:00
DavHau
c441eabbb8 make nodejs configurable 2021-12-08 23:18:21 +07:00
Yusuf Bera Ertan
0e236db189
fix(build-rust-package): use produceDerivation to apply overrides to the resulting package(s) 2021-12-03 07:40:55 +03:00
DavHau
d3a279875e feature: support multiple packages per source 2021-12-02 14:15:40 +07:00
DavHau
133b2d0093 fix shortcuts + pname, version handling 2021-11-30 12:36:49 +07:00
Yusuf Bera Ertan
0903f5ea43
feat: pass version and pname to fetchers (#60)
* feat: pass version and pname to fetchers, adjust schema for new behaviour

* fix: name -> pname

* refactor: move override warning to simpleTranslate, flatten dependencyInfo
2021-11-30 12:20:27 +07:00
DavHau
c5126b2053 feature: installMethod copy 2021-11-29 18:44:30 +07:00
Yusuf Bera Ertan
bfcd5b6f35
feat: cargo lock translator, rust builder (#59) 2021-11-29 18:34:53 +07:00
DavHau
fb42313192 bugfix add.py 2021-11-24 09:44:43 +07:00
DavHau
b8dc44d0f2 feature: translate subdir of source via ?dir=foo 2021-11-24 08:50:05 +07:00
DavHau
9d2d385273 test nix funcs with pytest via nix_ffi.py 2021-11-20 11:34:04 +07:00
DavHau
5ad6855226 fix: aggregated fetching 2021-11-18 12:09:14 +07:00
DavHau
553d29724f bugfixes: fixes #54, fixes #55
- add package vie http URL
- create default.nix for debugging
- package-lock parse `npm:` reference
2021-11-18 11:33:24 +07:00
DavHau
4cf80a1460 add test for aggregated fetching: github source 2021-11-17 17:40:09 +07:00
DavHau
e99487cee9 rename sourcesCombinedHash -> sourcesAggregatedHash 2021-11-17 17:12:02 +07:00
DavHau
97e2fef121 fix & improve aggregated source fetching 2021-11-17 17:09:25 +07:00
DavHau
87157ecc8b fix NIX_PATH impurity in writePureShellScript 2021-11-17 12:18:22 +07:00
DavHau
b4b7435ca3
Merge branch 'dev' into go 2021-11-17 11:28:22 +07:00
DavHau
3b5b9096e1 hercules ci + improvements
- yarn-lock: add nodejs version argument
 - add impure tests
 - add ci.nix for hercules
2021-11-17 11:23:31 +07:00
Akshat Agarwal
ff9e30b242 add go support using gomod2nix
Co-authored-by: DavHau <hsngrmpf+github@gmail.com>
2021-11-16 23:28:05 +05:30
DavHau
ec63d19cf5 add.py: refactor spaghetti into functions 2021-11-16 17:02:22 +07:00
DavHau
1c31d53605 fix: add packages via git URL + params; fetch submodules 2021-11-16 08:50:00 +07:00
DavHau
079ec025dc nodejs builder: fix executing $buildScript 2021-11-15 18:10:22 +07:00
DavHau
f1e34e0e89 builder API; move override logic into produceDerivation
This should simplify writing builders
2021-11-13 17:41:48 +07:00
DavHau
163db67245 package-lock: handle resolved=false 2021-11-12 21:52:57 +07:00
DavHau
3ec6baf2c4 support parsing github:... URLs 2021-11-12 21:52:32 +07:00
DavHau
def2b8b499 package-lock translator: deal with more weirdnes 2021-11-12 14:34:48 +07:00
DavHau
6d2a9fd95e nodejs buider: fix crash on empty string bin field 2021-11-11 19:08:25 +07:00
DavHau
48af5f0ec1 nodejs builder: just exclude cyclic deps 2021-11-10 14:05:51 +07:00
DavHau
6097051a5f automatically add new packages to git 2021-11-10 13:11:33 +07:00
DavHau
9302d24fc3 add name argument to package-lock translator 2021-11-10 13:11:21 +07:00
DavHau
baa442739f add template and docs for contributing builder 2021-11-08 11:47:15 +07:00
DavHau
791bb7638f pure translator template based on simpleTranslate 2021-11-08 09:44:27 +07:00
DavHau
8f743b24d4 yarn-lock: fix parsing github URL with revision 2021-11-07 23:59:46 +07:00
DavHau
9fc0623a48 nodejs builder: improve phases 2021-11-07 15:18:28 +07:00
DavHau
9ff7a0ab58 CLI improvements
- rename command package -> add
  - improve handling of dream2nix config
  - improve purity of cli execution
  - automatically find git repo root
  - improve package update cli
2021-11-07 15:18:28 +07:00
DavHau
60d89f776f improve flake interfaces and apps
- improve exposing apps for other flakes
  - configure overridesDirs via config
2021-11-07 15:18:28 +07:00
DavHau
39db511926 improve override system
- add utils.satisfiesSemver (from poetry2nix)
  - nix-parsec add LICENSE from https://github.com/nprindle/nix-parsec/issues/5
  - remove builtin overrides (moved to dreampkgs)
2021-11-07 15:18:28 +07:00
DavHau
bccf3b25c7 multiple override dirs, nodejs improvements
- nodejs builder: symlink sub dependencies
  - allow multiple directories with overrides
  - rename app: cli -> dream2nix
2021-11-07 15:18:28 +07:00
DavHau
62317e6501 fix: inject 2021-11-07 15:18:28 +07:00
DavHau
74a2a2351e ask to create default.nix by default 2021-11-07 15:18:14 +07:00
DavHau
a936cf44a5 rename dream.lock -> dream-lock.json 2021-11-04 15:48:40 +07:00
DavHau
a1d0ed99a8 restructure / rename dream-lock attributes 2021-11-04 15:36:12 +07:00
DavHau
c2e9d3adf4 yarn: remove noOptional + improve UI 2021-11-04 15:02:44 +07:00
DavHau
b1cb420434 fixes for yarn translator and node builder 2021-11-03 10:46:02 +07:00
DavHau
aa81800846 fixes and improvements for nodejs
- add system specific dream2nix to flake outputs
   - add more overrides
   - overrides allow regex as key
2021-11-02 15:13:34 +07:00
DavHau
f1662dabe5 cleanup package.json translator 2021-11-01 15:16:39 +07:00
DavHau
4ef9af0f73 add translator.package.json
- update default.nix template
  - add npm to dream lock schema
  - handle empty depedency graph in readDreamLock
2021-11-01 14:42:02 +07:00
DavHau
5a00d557b9 add npm fetcher 2021-11-01 13:48:23 +07:00
DavHau
03ef2e4c7a detect cycles in pure nix 2021-11-01 13:30:37 +07:00
DavHau
2fd7782af4 nodejs: enable dev deps by default 2021-11-01 13:30:37 +07:00
DavHau
6850db9cc4 cli: rename --extra-arg -> --arg 2021-11-01 13:30:37 +07:00
DavHau
c120dbe328 allow passing translatorArgs to riseAndShine 2021-11-01 13:30:31 +07:00
DavHau
8189d77a7e fix unpackging tgz with broken permissions 2021-11-01 10:03:10 +07:00
DavHau
b23e9ef8f3 make output packages flakes compatible
- closes #39
2021-11-01 00:14:36 +07:00
DavHau
cd6095406b split nodejs builder into different phases 2021-10-31 21:43:45 +07:00
DavHau
0d1e36f770 init: dream2nix overrides 2021-10-31 10:38:51 +07:00
DavHau
120b2d0ee0 improve overrides:
- make overrides referenceable
  - automatically detect override functions for attributes
2021-10-30 19:23:55 +07:00
DavHau
d20f318b58 rename several things
- rename fetcher 'fetchurl' -> 'http'
  - rename specialArgs -> extraArgs
  - rename order_dict -> sort_dict
2021-10-29 21:18:58 +07:00
DavHau
52740e8f96 Tests + refactor externls
- add flake checks
  - refactor handling of external sources
  - rename 'dependenciesRemoved' -> 'cyclicDependencies'
2021-10-29 21:18:58 +07:00
DavHau
c4b110bc38 output schema flakes-style 2021-10-29 16:59:56 +07:00
DavHau
607be5f99c nodejs: improve builder
- stop using npm install
  - run postinstall scripts
  - make binaries of direct dependencies available during build
2021-10-29 16:21:42 +07:00
Daniel Thwaites
84a2a606cc
fix typo emtpy → empty 2021-10-29 07:37:21 +01:00
DavHau
c5881e2db1 pass nodeDeps as path 2021-10-28 14:23:53 +07:00
DavHau
9d8292878a stop using string substitutions in installPhase 2021-10-27 14:42:57 +07:00
DavHau
9e2b46edfd improve nodejs builder + bug fixes
- add option `dontNpmInstall`
  - handle package incompatible to platform
  - replace version in package.json on mismatch
  - fix generated versions for github revisions
2021-10-27 13:24:36 +07:00
DavHau
1219a10592 overrides: allow passing functions for attributes 2021-10-27 13:24:36 +07:00
DavHau
d6dc1560cc fix update command 2021-10-26 20:06:43 +07:00
DavHau
99a87ea7cd add getCyclicDependencies to dream-lock interface 2021-10-26 19:46:55 +07:00
DavHau
1cbc64fe73 nodejs: never execute scripts on installation 2021-10-26 19:29:19 +07:00