Commit Graph

613 Commits

Author SHA1 Message Date
DavHau
b83394e5f2
haskell: init cabal-plan translator (#192)
* haskell: init cabal-plan translator

* simplify cabal2json: take from new nixpkgs

* delete accidental copy of file

* fix example haskell-plan-json

* rename haskell examples
2022-07-12 21:45:29 +02:00
DavHau
10fecabe3a
add devShell outputs for nodejs ad python (#186)
* add devShell outputs for nodejs ad python

* nodejs devShell improvements

- do not export NODE_PATH
- create node_modules directory
- add .bin directories of direct dependencies to PATH

* nodejs: revise devShell logic

- fix namespaced modules symlinking to ./node_modules
- add all transitive exectables to ./node_modules/.bin
- add ./node_modules/.bin to PATH

* set nodejs version in eslint example

* nodejs: improve error message on failed node_modules symlink in devShell

* readme: add nodejs version setting to example
2022-07-12 18:54:35 +02:00
Yusuf Bera Ertan
4bb76f8a1b
fix: check if source type is path in replaceRootSources 2022-07-12 18:56:32 +03:00
Yusuf Bera Ertan
05167f7e6f
feat: indexers (#184)
* feat: add translate and shell commands

* feat: add indexer modules

* feat(nodejs): add a basic npm indexer

* feat: add an index app for indexing using an indexer

* feat(rust): add crates-io indexer

* refactor: use configFile in more places

* feat: implement translate-index app

* refactor: move indexers out of subsystems since they aren't subsystem specific

* fix: discard string context for config text

* docs: add a preliminary document for indexers

* docs: add examples for crates-io and npm indexer inputs

* feat: add support for setting sourceRoot in dream-lock, fix translate source patching

* fix: don't discard context from config passed as text

* fix: remove duplicate resolves

* fix: shell command

* refactor: remove useless nix calls, improve the apps

* feat: improve cli apps UX, implement runNixCmdInSrc, remove shell

* docs: more comments

* feat: add generatePackagesFromLocksTree util

* fix: pass args to generatePackagesFromDreamLocks correctly

* Update indexers.md

* chore: remove license from crates-io indexer

* fix: pass config loaded from env vars to loadConfig

* refactor: don't expose dream2nix internally

* feat: add makeOutputsForIndexes utility

* refactor: make make(Flake)OutputsForIndexes interface consistent with make(Flake)Outputs

* fix: allow passing pkgs to makeFlakeOutputsForIndexes

* fix: remove unused code

* fix: rename var to expected name

* refactor(utils/index): improve and fix overrideOutputs arg

* fix(utils/index): actually pass prev outputs to overrideOutputs

* refactor: patch all sources instead of using a seperate field in dream lock

* fix(utils/index): use .program to access the program

* fix: correct jq command in translate app

* refactor: improve translate app performance

* feat: add crates-io-simple indexer

* fix(apps/translate): only set dir if relPath is set

* fix(apps/callNixWithD2N): pin nixpkgs

* fix: unloaded config passed to dlib

* refactor: rewrite root source patching in nix

* tests: add a unit test for replace root sources

Co-authored-by: DavHau <hsngrmpf+github@gmail.com>
2022-07-12 12:33:04 +02:00
DavHau
c246205a90
Merge pull request #187 from blaggacao/main
fix: yarn lock translator & builder
2022-07-07 21:50:29 +02:00
Yusuf Bera Ertan
0f6dcb0c53
feat(rust): add devshells to rust builder outputs 2022-07-07 21:27:30 +03:00
David Arnold
a22566421f
fix: yarn fix-package
- the implicit or explicit specification of `bin:` does not effect
  wether the target needs to exist or not
- in fact, it need not exist
2022-07-04 16:51:17 -05:00
David Arnold
ac8a6ba77c
fix: yarn translator
- the package name is always the first fragment, the second fragment
  is an override

```diff
diff --git a/locks/cardano-sdk/dream-lock.json b/locks/cardano-sdk/dream-lock.json
index d7a4306a5..987ac3c75 100644
--- a/locks/cardano-sdk/dream-lock.json
+++ b/locks/cardano-sdk/dream-lock.json
@@ -851,6 +851,17 @@
         [ "to-fast-properties", "2.0.0" ]
       ]
     },
+    "@blockfrost/blockfrost-js": {
+      "2.0.4": [
+        [ "@blockfrost/openapi", "0.1.27" ],
+        [ "@emurgo/cardano-serialization-lib-nodejs", "8.1.0" ],
+        [ "@emurgo/cip14-js", "2.0.0" ],
+        [ "axios", "0.21.4" ],
+        [ "form-data", "4.0.0" ],
+        [ "retry-axios", "2.6.0" ],
+        [ "url-join", "4.0.1" ]
+      ]
+    },
     "@cardano-foundation/ledgerjs-hw-app-cardano": {
       "5.0.0": [
         [ "@ledgerhq/hw-transport", "5.51.1" ],
@@ -887,7 +898,7 @@
     },
     "@cardano-sdk/blockfrost": {
       "0.3.0": [
-        [ "blockfrost-js-ratelimited", "2.0.4" ],
+        [ "@blockfrost/blockfrost-js", "2.0.4" ],
         [ "@cardano-sdk/core", "0.3.0" ],
         [ "@cardano-sdk/util", "0.3.0" ],
         [ "shx", "0.3.4" ]
@@ -2661,17 +2672,6 @@
         [ "nanoassert", "1.1.0" ]
       ]
     },
-    "blockfrost-js-ratelimited": {
-      "2.0.4": [
-        [ "@blockfrost/openapi", "0.1.27" ],
-        [ "@emurgo/cardano-serialization-lib-nodejs", "8.1.0" ],
-        [ "@emurgo/cip14-js", "2.0.0" ],
-        [ "axios", "0.21.4" ],
-        [ "form-data", "4.0.0" ],
-        [ "retry-axios", "2.6.0" ],
-        [ "url-join", "4.0.1" ]
-      ]
-    },
     "body-parser": {
       "1.19.2": [
         [ "bytes", "3.1.2" ],
@@ -7603,6 +7603,13 @@
         "url": "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz"
       }
     },
+    "@blockfrost/blockfrost-js": {
+      "2.0.4": {
+        "hash": "sha512-kl0K5V98t/Ov9+/7xKevHKu5BKhW08FvqJX/iqHzEvh6js8LHcpre6J0MeOvyaypi3dIYqFkkid1b26Y+fgBig==",
+        "type": "http",
+        "url": "https://registry.yarnpkg.com/blockfrost-js-ratelimited/-/blockfrost-js-ratelimited-2.0.4.tgz"
+      }
+    },
     "@blockfrost/openapi": {
       "0.1.27": {
         "hash": "sha512-lCGFPZ5D87lwhwP6nowJsVsJEaSFSAi87ORIF3RSakohilZRCgxOA5j5xFDA4mccUnfy1vbTc+CaQ8TKOQPaDA==",
@@ -10216,13 +10223,6 @@
         "url": "https://registry.yarnpkg.com/blake2b-wasm/-/blake2b-wasm-1.1.7.tgz"
       }
     },
-    "blockfrost-js-ratelimited": {
-      "2.0.4": {
-        "hash": "sha512-kl0K5V98t/Ov9+/7xKevHKu5BKhW08FvqJX/iqHzEvh6js8LHcpre6J0MeOvyaypi3dIYqFkkid1b26Y+fgBig==",
-        "type": "http",
-        "url": "https://registry.yarnpkg.com/blockfrost-js-ratelimited/-/blockfrost-js-ratelimited-2.0.4.tgz"
-      }
-    },
     "bn.js": {
       "4.12.0": {
         "hash": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==",

```
2022-07-04 16:51:12 -05:00
DavHau
872bfa0648 minor fixes 2022-07-03 13:00:15 +02:00
DavHau
3bc8801c6f fix bug in cargo-toml translator 2022-07-03 12:41:08 +02:00
DavHau
768e63b832 python: remove WIP status of pip translator 2022-07-03 12:35:33 +02:00
DavHau
6f7199e060 python: implement extraSetupDeps, remove extraRequirements 2022-07-03 12:16:12 +02:00
DavHau
da52cf49f4 python: install with --no-build-isolation 2022-07-03 12:15:15 +02:00
DavHau
1477c6d9d8 fix: pass extraArgs defaults to impure translators 2022-07-03 12:14:33 +02:00
DavHau
1a30e4062a rname: builtins.path -> l.path 2022-07-02 15:55:14 +02:00
Yusuf Bera Ertan
52f7dd7b51
refactor: move docs cli nix expression 2022-06-22 21:13:27 +03:00
DavHau
30722d2fe0 makeOutputs: remove impure projects warning
- instead generate fake derivations which fail with hint on evalation
2022-06-22 13:16:09 +02:00
DavHau
3aa7a1365d python: apply overrides and fix override system 2022-06-22 13:16:09 +02:00
DavHau
bc029af0ae pip translator: fix bug when parsing .whl filename 2022-06-22 13:16:09 +02:00
DavHau
162e29d280 python discoverer: top level package name main 2022-06-22 13:16:09 +02:00
DavHau
33b53e87df improve pip translator
- keep pname from discovery phase
- allow passing argument extraRequirements
2022-06-22 13:16:09 +02:00
DavHau
0277813f56 resolveImpure: make this a package instead of an app
- the reason for this change is that the flake app structure can only be used inside `apps`. Nix run will not execute it if it is inside any other attribute
2022-06-22 13:16:09 +02:00
DavHau
cd0009e3c8 python: depend on setuptools by default 2022-06-22 13:16:09 +02:00
DavHau
78b14674cd fixup/improve python translator and builder
- translator: ensure setup requirements from pyproject.toml are respected
- builder: ensure setup requirements are installed first before the package is built
- simplify the python translator
- dont depend on mach-nix for dependency extraction
- use only pip download to extract dependencies
- allow impure pip translator to cache downloads
- fix dream-lock.json. location was missing
2022-06-22 13:16:09 +02:00
Yusuf Bera Ertan
f23add2b9c
fix(rust): apply overrideAttrs function properly to the final derivations 2022-06-21 18:44:45 +03:00
Yusuf Bera Ertan
16f11d2469
feat(rust/crane): passthru dependency derivation 2022-06-18 20:52:19 +03:00
Yusuf Bera Ertan
5f20f98aa2
feat: implement overrideRustToolchain for crane and build-rust-package (#175) 2022-06-18 18:24:05 +03:00
DavHau
ddf087ae91
Merge pull request #164 from nix-community/haskell
stack-lock translator & haskell builder
2022-06-18 15:05:59 +02:00
DavHau
2ce89fd481 haskell: clean up and add more comments 2022-06-16 18:49:37 +02:00
DavHau
7bbfd8e940 add documentation strings to stack-lock/utils.nix 2022-06-16 18:37:59 +02:00
DavHau
b45c224383 simpleTranslate2: improve unit tests. Be more lazy 2022-06-16 18:10:04 +02:00
Yusuf Bera Ertan
caa9c4b5ef
docs(cli): implement preview instead of just listing with fzf and bat 2022-06-16 00:01:55 +03:00
Yusuf Bera Ertan
709e4aa139
refactor: move docs script to seperate file 2022-06-15 23:44:18 +03:00
Andrea Ciceri
a65730e23d
Using cabal2json from nixpkgs instead that from a flake (#176)
* Nixpkgs input updated

Starting from now `cabal2json` is available in nixpkgs

* Using `cabal2json` from Nixpkgs

* Using more idiomatic `haskellLib` utils

* Formatting
2022-06-15 15:52:13 +02:00
Yusuf Bera Ertan
4c3df83175
Revert "crane builder: apply overrides to -deps derivations"
This reverts commit f13621b7d3.
2022-06-11 17:56:54 +03:00
ners
45e7a3bd50
Fix undefined attribute error (#172) 2022-06-11 13:14:21 +02:00
DavHau
f13621b7d3 crane builder: apply overrides to -deps derivations
fixes #171
2022-06-10 01:50:02 +02:00
DavHau
49ec670653 nodejs builder: support sources starting with dash 2022-06-07 16:39:10 +02:00
DavHau
ee92270f06 fix illegal derivation name introduced by builtins.path 2022-06-07 16:18:37 +02:00
DavHau
ed8a64c463 make builders not depend on dlib and utils 2022-06-07 16:04:20 +02:00
DavHau
31cee1a17a remove node2nix builder 2022-06-05 23:47:27 +02:00
DavHau
30401cbc9d fix example for haskell 2022-06-05 16:52:19 +02:00
DavHau
8836a3f422 WIP stack-lock translator & haskell builder 2022-06-05 16:51:37 +02:00
DavHau
d6d94d88db simpleTranslate2: ignore irrelevant dependency objects 2022-06-05 16:51:25 +02:00
DavHau
e37041d443 remove extraDependencies from simpleTranslate2
- this field is unneccessary and `extraObjects` should be sufficient
2022-06-05 16:47:48 +02:00
Yusuf Bera Ertan
39eeaaa450
refactor: use new flake output schema for default package and devshells (#168) 2022-06-05 13:17:41 +02:00
Yusuf Bera Ertan
a46486a67e
fix(builder/crane): remove code that triggers IFD, remove dependency on full project source for deps only drv (#166)
* fix(builder/crane): remove code that triggers IFD, remove dependency on full project source for deps only drv

* fix(rust/builders): pass pkgs to utils.nix

* fix(builder/crane): break dependency on whole project source in dependency derivation

* refactor(rust/builders): change nix version to be more close to when reading toFile paths was made non-IFD

* docs(translator/cargo-lock): make the safety comment about unsafeDiscardStringContext usage more clear

* chore(deps): update crane

* fix: use builtins.path to make paths content addressed and named properly in a few places, fix cargo-lock path replacements

* refactor(rust/builders): remove nix version check for writing cargo.lock to store

* tests: update dream2nix input before overriding it

* tests: remove 'flake.lock's, overriding input generates flake.lock correctly

* tests: use nixpkgs from dream2nix input in d2n-init-pkgs

* refactor: remove useless builtins.path calls

* fix: use writeText for writing generated Cargo.lock, toFile causes problems
2022-06-05 13:14:20 +02:00
DavHau
6bc00a70df improve comments in yarn-lock/parser.nix 2022-06-03 14:12:00 +02:00
DavHau
073fed4eb2 yarn-lock: add more comments to parser.nix 2022-06-02 09:48:53 +02:00
DavHau
4484d3bd75 Revert "simpleTranslate2: ignore irrelevant dependency objects"
This reverts commit c7c59c8353.
2022-06-01 23:29:53 +02:00
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