Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port php to v1 #550

Open
DavHau opened this issue Jul 4, 2023 · 9 comments
Open

port php to v1 #550

DavHau opened this issue Jul 4, 2023 · 9 comments

Comments

@DavHau
Copy link
Member

DavHau commented Jul 4, 2023

We probably want to create the following modules under v1/nix/modules/drv-parts:

  • php-composer-lock (the translator populating options.php-composer-lock.dreamLock)
  • php-granular (the builder reading the dreamLock option and generating a package)

And maybe also these modules:

  • php-composer-json (impure translator using the new lock module similar to how nodejs-package-json does it)
  • php-simple (the simple builder)

To get started I propose:

  • create a example under v1/nix/modules/drvs that imports php-composer-lock and php-granualar which fails
  • implement the v1/nix/moduels/drv-parts/php-composer-lock modules:
    • start by copying everything from v1/nix/moduels/drv-parts/nodejs-package-lock
    • adapt the interface.nix file
    • adapt the implementation of the default.nix file and ensure the internal dreamLock option is populated
    • for debugging use nix repl on the example created earlier to inspect the .config attr of the example package
  • implement the v1/nix/modules/drv-parts/php-grnular module.
    • see other builder modules like nodejs-granular for comparison
@DavHau DavHau mentioned this issue Jul 4, 2023
13 tasks
@aszenz aszenz mentioned this issue Jul 5, 2023
@aszenz
Copy link
Contributor

aszenz commented Jul 5, 2023

@DavHau Made a first try, ran into some difficulties

and ensure the internal dreamLock option is populated

How do i verify this is populated

for debugging use nix repl on the example created earlier to inspect the .config attr of the example

I did this

nix repl '<nixpkgs>'
 
phpPkg = import ./v1/nix/modules/drvs/doctrine-dbal

phpPkg {phpPkg {lib=lib;config={};} # What config to pass here

Now i'm not sure which config attr to inspect

@DavHau
Copy link
Member Author

DavHau commented Jul 5, 2023

You can do it like this:

nix-repl> :lf ./.
warning: Git tree '/home/grmpf/synced/projects/github/dream2nix' is dirty
Added 24 variables.

nix-repl> packages.x86_64-linux.doctrine-dbal.config.php-composer-lock.dreamLock

I made your example evaluate with this patch:

diff --git a/v1/nix/modules/drvs/doctrine-dbal/default.nix b/v1/nix/modules/drvs/doctrine-dbal/default.nix
index 41f03dae..5f384b15 100644
--- a/v1/nix/modules/drvs/doctrine-dbal/default.nix
+++ b/v1/nix/modules/drvs/doctrine-dbal/default.nix
@@ -1,13 +1,16 @@
 {
   lib,
   config,
+  dream2nix,
   ...
 }: let
   l = lib // builtins;
 in {
   imports = [
-    ../../drv-parts/php-composer-lock
-    ../../drv-parts/php-granular
+    # mkDerivation should later be imported by php-granular
+    dream2nix.modules.drv-parts.mkDerivation
+    dream2nix.modules.drv-parts.php-composer-lock
+    # dream2nix.modules.drv-parts.php-granular
   ];

   mkDerivation = {

@aszenz
Copy link
Contributor

aszenz commented Jul 5, 2023

You can do it like this:

nix-repl> :lf ./.
warning: Git tree '/home/grmpf/synced/projects/github/dream2nix' is dirty
Added 24 variables.

nix-repl> packages.x86_64-linux.doctrine-dbal.config.php-composer-lock.dreamLock

I made your example evaluate with this patch:

diff --git a/v1/nix/modules/drvs/doctrine-dbal/default.nix b/v1/nix/modules/drvs/doctrine-dbal/default.nix
index 41f03dae..5f384b15 100644
--- a/v1/nix/modules/drvs/doctrine-dbal/default.nix
+++ b/v1/nix/modules/drvs/doctrine-dbal/default.nix
@@ -1,13 +1,16 @@
 {
   lib,
   config,
+  dream2nix,
   ...
 }: let
   l = lib // builtins;
 in {
   imports = [
-    ../../drv-parts/php-composer-lock
-    ../../drv-parts/php-granular
+    # mkDerivation should later be imported by php-granular
+    dream2nix.modules.drv-parts.mkDerivation
+    dream2nix.modules.drv-parts.php-composer-lock
+    # dream2nix.modules.drv-parts.php-granular
   ];

   mkDerivation = {

Thanks, looks like i need to adapt the translator now for composer-lock files, is there a way to use the old composer translator in the v1 api:

The old one is here:
https://github.com/aszenz/dream2nix/blob/55aad667cdc11ebacc0bc8ab5c44770cc1d63e87/src/subsystems/php/translators/composer-lock/default.nix#L1-L21

@DavHau
Copy link
Member Author

DavHau commented Jul 5, 2023

Yes, you can copy the code and refactor it a little bit.
See for example how src/subsystems/nodejs/translators/package-lock/default.nix was moved and adapted to v1/nix/modules/drv-parts/nodejs-package-lock/translate.nix

@aszenz
Copy link
Contributor

aszenz commented Jul 8, 2023

I'm getting into some errors, when trying to evaluate :
:p packages.x86_64-linux.doctrine-dbal.config.php-composer-lock.dreamLock
Specifically related to calculating cyclic dependencies, pushed the code in the latest commit.ea1cee1

Stack trace of error nix-repl> :p packages.x86_64-linux.doctrine-dbal.config.php-composer-lock.dreamLock { _generic = { defaultPackage = "dbal"; location = ""; packages = { dbal = "unknown"; }; sourcesAggregatedHash = null; subsystem = "php"; }; _subsystem = { composerPluginApiSemver = { "composer/package-versions-deprecated@1.11.99.5" = "^1.1.0 || ^2.0"; "dealerdirect/phpcodesniffer-composer-installer@v1.0.0" = "^1.0 || ^2.0"; }; noDev = false; phpExtensions = [ "json" "pcre" "reflection" "spl" "tokenizer" "dom" "phar" "xmlwriter" "filter" "libxml" "mbstring" "xml" "simplexml" "ctype" ]; phpSemver = "^7.4 || ^8.0"; }; cyclicDependencies = error: … while calling the 'foldl'' builtin
     at /nix/store/4k1iqphgli22w1qgmd9w47z5rjhnv0qd-source/v1/nix/lib/internal/simpleTranslate.nix:213:11:

      212|         in
      213|           l.foldl'
         |           ^
      214|           (cycles: cycle: (

   … from call site

     at /nix/store/4k1iqphgli22w1qgmd9w47z5rjhnv0qd-source/v1/nix/lib/internal/simpleTranslate.nix:208:13:

      207|           cyclesList =
      208|             findCycles
         |             ^
      209|             (nameVersionPair defaultPackage packages."${defaultPackage}")

   … while calling 'findCycles'

     at /nix/store/4k1iqphgli22w1qgmd9w47z5rjhnv0qd-source/v1/nix/lib/internal/simpleTranslate.nix:173:41:

      172|         let
      173|           findCycles = node: prevNodes: cycles: let
         |                                         ^
      174|             children = dependencyGraph."${node.name}"."${node.version}";

   … while calling anonymous lambda

     at /nix/store/4k1iqphgli22w1qgmd9w47z5rjhnv0qd-source/v1/nix/lib/internal/simpleTranslate.nix:118:18:

      117|           l.mapAttrs
      118|           (name: versions:
         |                  ^
      119|             l.mapAttrs

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   … while calling anonymous lambda

     at /nix/store/4lbmf3pbrsb0a5l4713mal64w8hp6na9-source/lib/attrsets.nix:518:24:

      517|     let f = attrPath:
      518|       zipAttrsWith (n: values:
         |                        ^
      519|         let here = attrPath ++ [n]; in

   error: cannot coerce a function to a string

@DavHau
Copy link
Member Author

DavHau commented Jul 8, 2023

The reason might be that the translator used simpleTranslate2 as a helper, but you now replaced it with simpleTranslate. It's probably best to migrate simpleTranslate2 to v1/nix/lib/internal and use it.

If you want I can help you with that. Just let me know.

@DavHau
Copy link
Member Author

DavHau commented Jul 8, 2023

I pushed a commit to https://github.com/nix-community/dream2nix/tree/aszenz-php, where I ported simpleTranslate2 to v1/ and adapted the translator.nix. Now it evaluates. I saw that you tried changing the whole translator to fit simpleTranslate, which I now reverted. Sorry for the confusion.

@aszenz
Copy link
Contributor

aszenz commented Jul 8, 2023

I pushed a commit to https://github.com/nix-community/dream2nix/tree/aszenz-php, where I ported simpleTranslate2 to v1/ and adapted the translator.nix. Now it evaluates. I saw that you tried changing the whole translator to fit simpleTranslate, which I now reverted. Sorry for the confusion.

Thanks it indeed evaluates, so now I could start porting the granular builder, is there a way to reuse the old api's php builder also?

@DavHau
Copy link
Member Author

DavHau commented Jul 8, 2023

Yes, start out by copying the builder to a new module under v1. Then refactor it to be a valid nixos module.

The module should import the mkDerivation module.

Instead of calling the mkDerivation function like before, you want to set the option config.mkDerivation with all the attributes that have previously been pased to mkDerivation function.

For examples for how to use the mkDerivation module, you can check the examples of the github.com/davhau/drv-parts project or other modules inside dream2nix v1 that import mkDerivation.

Just ping me if you have any more questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants