From 37571f6164f8e67160163b8cea1021eaceecd37d Mon Sep 17 00:00:00 2001 From: Wout Mertens Date: Tue, 23 Aug 2022 09:15:03 +0200 Subject: [PATCH] wip working --- flake.nix | 1 + .../nodejs/builders/granular/default.nix | 212 +++++++++--------- .../nodejs/builders/granular/fix-package.py | 95 ++++---- .../nodejs/builders/granular/link-bins.py | 2 +- .../nodejs/discoverers/default/default.nix | 30 +-- .../translators/package-lock-v2/default.nix | 81 ++++--- .../translators/package-lock-v2/v2-parse.nix | 34 +-- src/subsystems/translators.nix | 1 - 8 files changed, 240 insertions(+), 216 deletions(-) diff --git a/flake.nix b/flake.nix index 21cdde3a5d..67f2bc3a18 100644 --- a/flake.nix +++ b/flake.nix @@ -226,6 +226,7 @@ # a dev shell for working on dream2nix # use via 'nix develop . -c $SHELL' + # TODO only for the current system? devShells = forAllSystems (system: pkgs: let makeDevshell = import "${inp.devshell}/modules" pkgs; mkShell = config: diff --git a/src/subsystems/nodejs/builders/granular/default.nix b/src/subsystems/nodejs/builders/granular/default.nix index ae580be64f..ff583e32ea 100644 --- a/src/subsystems/nodejs/builders/granular/default.nix +++ b/src/subsystems/nodejs/builders/granular/default.nix @@ -1,11 +1,3 @@ -# TODO if build script in main, run with devModules -# TODO split build in multiple derivations -# - first derivation: -# - unpack without modules -# - if main, optional build step with devModules (discover with runcmd) -# - optional npm install w/ all deps + source-only cyclic -# - only inject deps when needed to prevent rebuilds. Remove deps after build. -# - second derivation: link with modules. Cyclic deps are joined. {...}: { type = "pure"; @@ -53,7 +45,8 @@ b = builtins; l = lib // builtins; - nodejsVersion = subsystemAttrs.nodejsVersion; + nodejsVersion = subsystemAttrs.nodejsVersion or null; + transitiveBinaries = subsystemAttrs.transitiveBinaries or null; isMainPackage = name: version: (args.packages."${name}" or null) == version; @@ -67,11 +60,6 @@ or (throw "Could not find nodejs version '${nodejsVersion}' in pkgs") else pkgs.nodejs; - nodeSources = runCommandLocal "node-sources" {} '' - tar --no-same-owner --no-same-permissions -xf ${nodejs.src} - mv node-* $out - ''; - allPackages = lib.mapAttrs (name: versions: @@ -136,14 +124,8 @@ cp -r --no-preserve=mode $electronDist $TMP/electron # configure electron toolchain - ${pkgs.jq}/bin/jq ".build.electronDist = \"$TMP/electron\"" package.json \ - | ${pkgs.moreutils}/bin/sponge package.json - - ${pkgs.jq}/bin/jq ".build.linux.target = \"dir\"" package.json \ - | ${pkgs.moreutils}/bin/sponge package.json - - ${pkgs.jq}/bin/jq ".build.npmRebuild = false" package.json \ - | ${pkgs.moreutils}/bin/sponge package.json + jq ".build.electronDist = \"$TMP/electron\" | .build.linux.target = \"dir\" | .build.npmRebuild = false" package.json > package.json.tmp + mv package.json.tmp package.json # execute electron-rebuild if available export headers=http://localhost:45034/ @@ -207,7 +189,7 @@ ( dep: let p = allPackages."${dep.name}"."${dep.version}"; - s = p.sourceInfo; + s = p.extraInfo; in # this dep is a cyclee !(isCyclee dep.name dep.version) @@ -242,7 +224,7 @@ myDeps = lib.filter (dep: let - s = dep.sourceInfo; + s = dep.extraInfo; in (withOptionals || !(s.optional or false)) && (!isMain || (withDev || !(s.dev or false)))) @@ -311,7 +293,6 @@ # if noDev was used, these are just the prod modules devModules = makeModules {withDev = true;}; - # TODO why is this needed? Seems to work without passthruDeps = l.listToAttrs (l.forEach deps @@ -347,35 +328,35 @@ then null else pkgs."electron_${electronVersionMajor}".headers; - sourceInfo = let - e = getSourceSpec name version; - try = builtins.tryEval (builtins.deepSeq e e); - in - if try.success - then try.value - else {}; - hasInstall = !(sourceInfo.noInstall or false); + hasExtraInfo = subsystemAttrs ? extraInfo; + extraInfo = subsystemAttrs.extraInfo.${name}.${version} or {}; + # If the translator doesn't provide extraInfo, assume scripts + hasInstall = + if hasExtraInfo + then extraInfo.hasInstallScript or false + else true; isMain = isMainPackage name version; pkg = produceDerivation name (stdenv.mkDerivation rec { inherit dependenciesJson electronHeaders - nodeSources version + transitiveBinaries + prodModules ; packageName = name; inherit pname; - # TODO why is this needed? It works without it? - # passthru.dependencies = passthruDeps; + passthru.dependencies = passthruDeps; passthru.devShell = import ./devShell.nix { inherit mkShell nodejs devModules; }; + passthru.extraInfo = extraInfo; /* For top-level packages install dependencies as full copies, as this reduces errors with build tooling that doesn't cope well with @@ -390,27 +371,45 @@ electronAppDir = "."; # only run build on the main package - runBuild = isMain; + runBuild = isMain && (subsystemAttrs.hasBuildScript or true); - src = getSource name version; + # can be overridden to define alternative install command + # (defaults to npm install steps) + buildScript = null; + shouldBuild = hasInstall || runBuild || buildScript != null || electronHeaders != null; + buildModules = + if runBuild + then devModules + else prodModules; + nodeSources = + if shouldBuild + then nodejs + else null; - nativeBuildInputs = [makeWrapper]; + # We don't need unpacked sources + src = let t = getSource name version; in t.original or t; - buildInputs = [jq nodejs python3]; + nativeBuildInputs = + if shouldBuild + then [makeWrapper] + else []; + + # We must provide nodejs even when not building to allow + # patchShebangs to find it for binaries + buildInputs = + if shouldBuild || (!hasExtraInfo || (extraInfo ? bin)) + then [jq nodejs python3] + else [python3]; # prevents running into ulimits passAsFile = ["dependenciesJson"]; preConfigurePhases = ["d2nLoadFuncsPhase" "d2nPatchPhase"]; - # can be overridden to define alternative install command - # (defaults to npm install steps) - buildScript = null; - shouldBuild = hasInstall || buildScript != null || electronHeaders != null; - # python script to modify some metadata to support installation # (see comments below on d2nPatchPhase) fixPackage = "${./fix-package.py}"; + linkBins = "${./link-bins.py}"; # costs performance and doesn't seem beneficial in most scenarios dontStrip = true; @@ -434,13 +433,10 @@ } ''; - # TODO: upstream fix to nixpkgs + # https://github.com/NixOS/nixpkgs/pull/50961#issuecomment-449638192 # example which requires this: # https://registry.npmjs.org/react-window-infinite-loader/-/react-window-infinite-loader-1.0.7.tgz - unpackCmd = - if lib.hasSuffix ".tgz" src - then "tar --delay-directory-restore -xf $src" - else null; + TAR_OPTIONS = "--delay-directory-restore"; unpackPhase = '' runHook preUnpack @@ -468,10 +464,8 @@ # Figure out what directory has been unpacked export packageDir="$(find . -maxdepth 1 -type d | tail -1)" - # TODO why is this needed? - # find "$packageDir" -type d -exec chmod u+x {} \; - # Restore write permissions - chmod -R u+w -- "$packageDir" + # Ensure write + directory execute permissions + chmod -R u+w,a+X -- "$packageDir" # Move the extracted tarball into the output folder mv -- "$packageDir" "$sourceRoot" @@ -479,8 +473,8 @@ then export strippedName="$(stripHash $src)" - # Restore write permissions - chmod -R u+w -- "$strippedName" + # Ensure write + directory execute permissions + chmod -R u+w,a+X -- "$strippedName" # Move the extracted directory into the output folder mv -- "$strippedName" "$sourceRoot" @@ -507,10 +501,6 @@ # - If package-lock.json exists, it is deleted, as it might conflict # with the parent package-lock.json. d2nPatchPhase = '' - if [ -z "$shouldBuild" ] && [ -n "$runBuild" ] && [ "$(jq '.scripts.build' ./package.json)" != "null" ]; then - shouldBuild=1 - fi - # delete package-lock.json as it can lead to conflicts rm -f package-lock.json @@ -533,23 +523,16 @@ configurePhase = '' runHook preConfigure - ${ - if prodModules != null - then '' - if [ -L $sourceRoot/node_modules ] || [ -e $sourceRoot/node_modules ]; then - echo Warning: The source $sourceRoot includes a node_modules directory. Replacing. >&2 - rm -rf $sourceRoot/node_modules - fi - ln -s ${prodModules} $sourceRoot/node_modules - if [ -d ${prodModules}/.bin ]; then - export PATH="$PATH:$sourceRoot/node_modules/.bin" - # pass down transitive binaries, like npm does - # all links are absolute so we can just copy - cp -af --no-preserve=mode ${prodModules}/.bin/. $out/bin/. - fi - '' - else "" - } + if [ -n "$buildModules" ]; then + if [ -L $sourceRoot/node_modules ] || [ -e $sourceRoot/node_modules ]; then + echo Warning: The source $sourceRoot includes a node_modules directory. Replacing. >&2 + rm -rf $sourceRoot/node_modules + fi + ln -s $buildModules $sourceRoot/node_modules + if [ -d $buildModules/.bin ]; then + export PATH="$PATH:$sourceRoot/node_modules/.bin" + fi + fi ${ # Here we copy cyclee deps into the cyclehead node_modules # so the cyclic deps can find each other @@ -580,43 +563,67 @@ # Runs the install command which defaults to 'npm run postinstall'. # Allows using custom install command by overriding 'buildScript'. # TODO this logic supposes a build script, which is not documented - buildPhase = '' - runHook preBuild - - if [ -n "$shouldBuild" ]; then - # execute electron-rebuild - if [ -n "$electronHeaders" ]; then - echo "executing electron-rebuild" - ${electron-rebuild} - fi + # for installing, we only need to run `npm run install` (pre and post scripts run automatically) + # https://github.com/npm/npm/issues/5919 + # TODO build first if has build, give it devModules during build + + buildPhase = + if shouldBuild + then '' + set -x + runHook preBuild + + if [ -n "$shouldBuild" ]; then + # execute electron-rebuild + if [ -n "$electronHeaders" ]; then + echo "executing electron-rebuild" + ${electron-rebuild} + fi - # execute install command - if [ -n "$buildScript" ]; then - if [ -f "$buildScript" ]; then - $buildScript + # execute install command + if [ -n "$buildScript" ]; then + if [ -f "$buildScript" ]; then + $buildScript + else + eval "$buildScript" + fi else - eval "$buildScript" + if [ -n "$runBuild" ]; then + # by default, only for top level packages, `npm run build` is executed + npm run --if-present build + fi + + # This seems to be the only script that needs running on install + npm --omit=dev --offline --nodedir=$nodeSources run --if-present install fi - elif [ -n "$runBuild" ]; then - # by default, only for top level packages, `npm run build` is executed - npm run --if-present build - else - npm --omit=dev --offline --nodedir=$nodeSources run --if-present preinstall - npm --omit=dev --offline --nodedir=$nodeSources run --if-present install - npm --omit=dev --offline --nodedir=$nodeSources run --if-present postinstall fi - fi - runHook postBuild - ''; + runHook postBuild + set +x + '' + else "true"; # Symlinks executables and manual pages to correct directories installPhase = '' runHook preInstall + if [ "$buildModules" != "$prodModules" ]; then + if [ -n "$prodModules" ]; then + ln -sf $prodModules $sourceRoot/node_modules + else + rm $sourceRoot/node_modules + fi + fi + echo "Symlinking bin entries from package.json" python $linkBins + if [ -n "$transitiveBinaries" ]; then + # pass down transitive binaries, like npm does + # all links are absolute so we can just copy + cp -af --no-preserve=mode $prodModules/.bin/. $out/bin/. + fi + if rmdir $out/bin 2>/dev/null; then # we didn't install any binaries rm $nodeModules/.bin @@ -650,8 +657,7 @@ ''; }); in - pkg - // {inherit sourceInfo;}; + pkg; in outputs; } diff --git a/src/subsystems/nodejs/builders/granular/fix-package.py b/src/subsystems/nodejs/builders/granular/fix-package.py index f7e902f0d7..a3e512a1c6 100644 --- a/src/subsystems/nodejs/builders/granular/fix-package.py +++ b/src/subsystems/nodejs/builders/granular/fix-package.py @@ -26,56 +26,55 @@ ) exit(3) -if shouldBuild != '': - # replace version - # If it is a github dependency referred by revision, - # we can not rely on the version inside the package.json. - # In case of an 'unknown' version coming from the dream lock, - # do not override the version from package.json - version = os.environ.get("version") - if version not in ["unknown", package_json.get('version')]: - print( - "WARNING: The version of this package defined by its package.json " - "doesn't match the version expected by dream2nix." - "\n -> Replacing version in package.json: " - f"{package_json.get('version')} -> {version}", - file=sys.stderr - ) - package_json['origVersion'] = package_json['version'] - package_json['version'] = version +# replace version +# If it is a github dependency referred by revision, +# we can not rely on the version inside the package.json. +# In case of an 'unknown' version coming from the dream lock, +# do not override the version from package.json +version = os.environ.get("version") +if version not in ["unknown", package_json.get('version')]: + print( + "WARNING: The version of this package defined by its package.json " + "doesn't match the version expected by dream2nix." + "\n -> Replacing version in package.json: " + f"{package_json.get('version')} -> {version}", + file=sys.stderr + ) + package_json['origVersion'] = package_json['version'] + package_json['version'] = version - # pinpoint exact versions - # This is mostly needed to replace git references with exact versions, - # as NPM install will otherwise re-fetch these - if 'dependencies' in package_json: - dependencies = package_json['dependencies'] - depsChanged = False - # dependencies can be a list or dict - for pname in dependencies: - if 'bundledDependencies' in package_json\ - and pname in package_json['bundledDependencies']: - continue - if pname not in available_deps: - print( - f"WARNING: Dependency {pname} wanted but not available. Ignoring.", - file=sys.stderr - ) - depsChanged = True - continue - version =\ - 'unknown' if isinstance(dependencies, list) else dependencies[pname] - if available_deps[pname] != version: - depsChanged = True - print( - f"package.json: Pinning version '{version}' to '{available_deps[pname]}'" - f" for dependency '{pname}'", - file=sys.stderr - ) - if depsChanged: - changed = True - package_json['dependencies'] = available_deps - package_json['origDependencies'] = dependencies +# pinpoint exact versions +# This is mostly needed to replace git references with exact versions, +# as NPM install will otherwise re-fetch these +if 'dependencies' in package_json: + dependencies = package_json['dependencies'] + depsChanged = False + # dependencies can be a list or dict + for pname in dependencies: + if 'bundledDependencies' in package_json\ + and pname in package_json['bundledDependencies']: + continue + if pname not in available_deps: + print( + f"WARNING: Dependency {pname} wanted but not available. Ignoring.", + file=sys.stderr + ) + depsChanged = True + continue + version =\ + 'unknown' if isinstance(dependencies, list) else dependencies[pname] + if available_deps[pname] != version: + depsChanged = True + print( + f"package.json: Pinning version '{version}' to '{available_deps[pname]}'" + f" for dependency '{pname}'", + file=sys.stderr + ) + if depsChanged: + changed = True + package_json['dependencies'] = available_deps + package_json['origDependencies'] = dependencies # write changes to package.json if changed: diff --git a/src/subsystems/nodejs/builders/granular/link-bins.py b/src/subsystems/nodejs/builders/granular/link-bins.py index 8d45b8a0bc..7664a8f3f6 100644 --- a/src/subsystems/nodejs/builders/granular/link-bins.py +++ b/src/subsystems/nodejs/builders/granular/link-bins.py @@ -29,7 +29,7 @@ def link(name, relpath): if isinstance(bin, str): # take name and remove .js extension from scripts - name = (package_json['name'].split('/')[-1]).rsplit('.js', 1)[0] + name = (bin.split('/')[-1]).rsplit('.js', 1)[0] link(name, bin) else: diff --git a/src/subsystems/nodejs/discoverers/default/default.nix b/src/subsystems/nodejs/discoverers/default/default.nix index 53576d778a..ba7ac5079b 100644 --- a/src/subsystems/nodejs/discoverers/default/default.nix +++ b/src/subsystems/nodejs/discoverers/default/default.nix @@ -35,9 +35,10 @@ in childrenRemoved; - getTranslatorNames = path: let - nodes = l.readDir path; - packageJson = getPackageJson path; + getTranslatorNames = subTree: let + # TODO use nodejsUtils.getWorkspaceLockFile + packageJson = subTree.files."package.json".jsonContent; + lockJson = subTree.files."package-lock.json".jsonContent or null; translators = # if the package has no dependencies we use the # package-lock translator with `packageLock = null` @@ -46,10 +47,8 @@ && (packageJson.devDependencies or {} == {}) && (packageJson.workspaces or [] == []) then ["package-lock"] - else if nodes ? "package-lock.json" + else if lockJson != null then let - # Wish there was a way to get the version without reading a 2MB file - lockJson = getLockJson path; lockVersion = lockJson.lockfileVersion or 0; in if lockVersion == 1 @@ -58,16 +57,11 @@ then ["package-lock-v2"] else ["package-json"] else - l.optionals (nodes ? "yarn.lock") ["yarn-lock"] + l.optionals (subTree.files ? "yarn.lock") ["yarn-lock"] ++ ["package-json"]; in translators; - # returns the parsed package.json of a given directory - getJson = jsonPath: l.fromJSON (l.readFile jsonPath); - getPackageJson = dirPath: getJson "${dirPath}/package.json"; - getLockJson = dirPath: getJson "${dirPath}/package-lock.json"; - # returns all relative paths to workspaces defined by a glob getWorkspacePaths = glob: tree: if l.hasSuffix "*" glob @@ -132,15 +126,13 @@ makeWorkspaceProjectInfo = tree: wsRelPath: parentInfo: dlib.construct.discoveredProject { inherit subsystem; - name = - (getPackageJson "${tree.fullPath}/${wsRelPath}").name - or "${parentInfo.name}/${wsRelPath}"; + name = (tree.getNodeFromPath wsRelPath).files."package.json".jsonContent.name or "${parentInfo.name}/${wsRelPath}"; relPath = dlib.sanitizeRelativePath "${tree.relPath}/${wsRelPath}"; translators = l.unique ( - (lib.filter (trans: l.elem trans ["package-lock" "yarn-lock"]) parentInfo.translators) - ++ (getTranslatorNames "${tree.fullPath}/${wsRelPath}") + (lib.filter (trans: l.elem trans ["package-lock" "package-lock-v2" "yarn-lock"]) parentInfo.translators) + ++ (getTranslatorNames (tree.getNodeFromPath wsRelPath)) ); subsystemInfo = { workspaceParent = tree.relPath; @@ -163,7 +155,7 @@ }) (tree.directories or {})); in - # skip if not a nodajs project + # skip if not a nodejs project if alreadyDiscovered ? "${tree.relPath}" @@ -183,7 +175,7 @@ then "noname" else tree.relPath ); - translators = getTranslatorNames tree.fullPath; + translators = getTranslatorNames tree; subsystemInfo = l.optionalAttrs (workspaces != []) { workspaces = l.map diff --git a/src/subsystems/nodejs/translators/package-lock-v2/default.nix b/src/subsystems/nodejs/translators/package-lock-v2/default.nix index a8d6eeedef..48c34bab02 100644 --- a/src/subsystems/nodejs/translators/package-lock-v2/default.nix +++ b/src/subsystems/nodejs/translators/package-lock-v2/default.nix @@ -47,17 +47,35 @@ rootDependencies = resolved.self.deps; - identifyGitSource = dependencyObject: + identifyGitSource = dep: # TODO: when integrity is there, and git url is github then use tarball instead - # ! (dependencyObject ? integrity) && - dlib.identifyGitUrl dependencyObject.url; + # ! (dep ? integrity) && + dlib.identifyGitUrl dep.url; - getVersion = dependencyObject: dependencyObject.version; + getVersion = dep: dep.version; - getPath = dependencyObject: - lib.removePrefix "file:" dependencyObject.url; + getPath = dep: + lib.removePrefix "file:" dep.url; - stripDep = dep: l.removeAttrs dep ["pname" "version" "deps"]; + getSource = { + url, + hash, + ... + }: {inherit url hash;}; + + # TODO check that this works with workspaces + extraInfo = b.foldl' (acc: dep: + if dep.extra != {} + then l.recursiveUpdate acc {${dep.pname}.${dep.version} = dep.extra;} + else acc) {} + resolved.allDeps; + + # TODO workspaces + hasBuildScript = let + pkgJson = + (nodejsUtils.getWorkspaceLockFile tree project "package.json").jsonContent; + in + (pkgJson.scripts or {}) ? build; in utils.simpleTranslate ({ @@ -81,40 +99,41 @@ subsystemName = "nodejs"; - subsystemAttrs = {nodejsVersion = args.nodejs;}; + subsystemAttrs = { + inherit extraInfo hasBuildScript; + nodejsVersion = args.nodejs; + }; # functions serializePackages = inputData: inputData; - getName = dependencyObject: dependencyObject.pname; + getName = dep: dep.pname; inherit getVersion; - # TODO handle npm link maybe? - getSourceType = dependencyObject: - if identifyGitSource dependencyObject - then "git" - else if lib.hasPrefix "file:" dependencyObject.url + # TODO handle npm link maybe? not sure what it looks like in lock + getSourceType = dep: + if lib.hasPrefix "file:" dep.url then "path" + else if identifyGitSource dep + then "git" else "http"; sourceConstructors = { - git = dependencyObject: - (stripDep dependencyObject) - // (dlib.parseGitUrl dependencyObject.url); - - http = dependencyObject: (stripDep dependencyObject); - - path = dependencyObject: - (stripDep dependencyObject) - // (dlib.construct.pathSource { - path = getPath dependencyObject; - rootName = project.name; - rootVersion = packageVersion; - }); + git = dep: + (getSource dep) + // (dlib.parseGitUrl dep.url); + + http = dep: (getSource dep); + + path = dep: (dlib.construct.pathSource { + path = getPath dep; + rootName = project.name; + rootVersion = packageVersion; + }); }; - getDependencies = dependencyObject: dependencyObject.deps; + getDependencies = dep: dep.deps; }); in rec { version = 2; @@ -134,6 +153,12 @@ in rec { type = "argument"; }; + transitiveBinaries = { + description = "Should all the binaries from all modules be available, or only those from dependencies"; + default = false; + type = "boolean"; + }; + # TODO: this should either be removed or only used to select # the nodejs version for translating, not for building. nodejs = { diff --git a/src/subsystems/nodejs/translators/package-lock-v2/v2-parse.nix b/src/subsystems/nodejs/translators/package-lock-v2/v2-parse.nix index 91dbf41b16..27a2a9f17d 100644 --- a/src/subsystems/nodejs/translators/package-lock-v2/v2-parse.nix +++ b/src/subsystems/nodejs/translators/package-lock-v2/v2-parse.nix @@ -58,6 +58,21 @@ assert (lib.elem lock.lockfileVersion [2 3]); let if n == "" then lockName else n; + + extraAttrs = { + # platforms this package works on + os = 1; + # this is a dev dependency + dev = 1; + # this is an optional dependency + optional = 1; + # this is an optional dev dependency + devOptional = 1; + # set of binary scripts { name = relativePath } + bin = 1; # pkg needs to run install scripts + hasInstallScript = 1; + }; + getExtra = pkg: b.intersectAttrs extraAttrs pkg; in { version ? "unknown", @@ -65,25 +80,13 @@ assert (lib.elem lock.lockfileVersion [2 3]); let resolved ? "file://${source}", # hash for content integrity ? null, - # platforms this package works on - os ? null, - # this is a dev dependency - dev ? false, - # this is an optional dependency - optional ? false, - # this is an optional dev dependency - devOptional ? false, - # set of binary scripts { name = relativePath } - bin ? {}, - # pkg needs to run install scripts - hasInstallScript ? false, dependencies ? null, devDependencies ? null, peerDependencies ? null, optionalDependencies ? null, peerDependenciesMeta ? null, ... - }: let + } @ pkg: let deps = lib.unique ((resolveDeps dependencies parts false) @@ -92,11 +95,10 @@ assert (lib.elem lock.lockfileVersion [2 3]); let ++ (resolveDeps peerDependencies parts true) ++ (resolveDeps peerDependenciesMeta parts true)); in { - inherit pname version deps os dev optional devOptional bin; + inherit pname version deps; url = resolved; hash = integrity; - # Storing negation so other translators don't have to have this feature - noInstall = !hasInstallScript; + extra = getExtra pkg; }; allDeps = lib.mapAttrsToList mapPkg pkgs; diff --git a/src/subsystems/translators.nix b/src/subsystems/translators.nix index af191bca35..3b3930f815 100644 --- a/src/subsystems/translators.nix +++ b/src/subsystems/translators.nix @@ -54,7 +54,6 @@ dreamLock = dreamLock'.result or dreamLock'; in dream2nix.utils.dreamLock.toJSON - # don't use nix to detect cycles, this will be more efficient in python (dreamLock // { _generic = builtins.removeAttrs dreamLock._generic [ \"cyclicDependencies\" ]; })