Merge pull request #315 from tinybeachthor/cleanup

Cleanup
This commit is contained in:
DavHau 2022-10-01 22:52:19 +02:00 committed by GitHub
commit 730d42598e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 41 additions and 54 deletions

View File

@ -53,7 +53,7 @@
// {
isOriginal = false;
outPath = let
sanitizedName = utils.sanitizeDerivationName name;
sanitizedName = l.strings.sanitizeDerivationName name;
in "${sanitizedName}/${version}/${fetched.name}";
}
# handle already extracted sources
@ -63,7 +63,7 @@
// {
isOriginal = true;
outPath = let
sanitizedName = utils.sanitizeDerivationName name;
sanitizedName = l.strings.sanitizeDerivationName name;
in "${sanitizedName}/${version}/${fetched.original.name}";
}
# handle path sources
@ -219,7 +219,7 @@ in {
then
utils.extractSource {
source = "${FODAllSources}/${FODArgsAll."${name}"."${version}".outPath}";
name = dlib.sanitizeDerivationName name;
name = l.strings.sanitizeDerivationName name;
}
else "${FODAllSources}/${FODArgsAll."${name}"."${version}".outPath}"
else defaultFetched."${name}"."${version}")

View File

@ -26,7 +26,6 @@
recursiveUpdateUntilDepth
simpleTranslate2
translators
sanitizeDerivationName
sanitizePath
sanitizeRelativePath
subsystems
@ -280,9 +279,6 @@
recursiveUpdateUntilDepth = depth: lhs: rhs:
lib.recursiveUpdateUntil (path: _: _: (l.length path) > depth) lhs rhs;
sanitizeDerivationName = name:
lib.replaceStrings ["@" "/"] ["__at__" "__slash__"] name;
sanitizeRelativePath = path:
l.removePrefix "/" (l.toString (l.toPath "/${path}"));

View File

@ -21,7 +21,7 @@ in {
translateBin = {
# dream2nix utils
utils,
# nixpkgs dependenies
# nixpkgs dependencies
bash,
coreutils,
jq,

View File

@ -64,16 +64,14 @@ in {
})
subsystemAttrs.cabalHashes or {};
# the main package
defaultPackage = allPackages."${defaultPackageName}"."${defaultPackageVersion}";
# packages to export
packages =
lib.mapAttrs
(name: version: {
"${version}" = allPackages.${name}.${version};
})
args.packages;
{default = packages.${defaultPackageName};}
// (
lib.mapAttrs
(name: version: {"${version}" = allPackages.${name}.${version};})
args.packages
);
# manage packages in attrset to prevent duplicated evaluation
allPackages =
@ -119,7 +117,7 @@ in {
# Generates a derivation for a specific package name + version
makeOnePackage = name: version: let
pkg = compiler.mkDerivation (rec {
pname = utils.sanitizeDerivationName name;
pname = l.strings.sanitizeDerivationName name;
inherit version;
license = null;
@ -173,6 +171,6 @@ in {
# apply packageOverrides to current derivation
produceDerivation name pkg;
in {
inherit defaultPackage packages;
inherit packages;
};
}

View File

@ -75,8 +75,6 @@
})
args.packages);
devShell = devShells.default;
devShells =
{default = devShells.${defaultPackageName};}
// (

View File

@ -35,9 +35,8 @@
in
childrenRemoved;
getTranslatorNames = path: let
nodes = l.readDir path;
packageJson = l.fromJSON (l.readFile "${path}/package.json");
getTranslatorNames = tree: let
packageJson = tree.files."package.json".jsonContent;
translators =
# if the package has no dependencies we use the
# package-lock translator with `packageLock = null`
@ -47,8 +46,8 @@
&& (packageJson.workspaces or [] == [])
then ["package-lock"]
else
l.optionals (nodes ? "package-lock.json") ["package-lock"]
++ l.optionals (nodes ? "yarn.lock") ["yarn-lock"]
l.optionals (tree.files ? "package-lock.json") ["package-lock"]
++ l.optionals (tree.files ? "yarn.lock") ["yarn-lock"]
++ ["package-json"];
in
translators;
@ -166,7 +165,7 @@
inherit subsystem;
inherit (tree) relPath;
name = tree.files."package.json".jsonContent.name or tree.relPath;
translators = getTranslatorNames tree.fullPath;
translators = getTranslatorNames tree;
subsystemInfo = l.optionalAttrs (workspaces != []) {
workspaces =
l.map

View File

@ -12,7 +12,7 @@
apps,
subsystems,
utils,
# nixpkgs dependenies
# nixpkgs dependencies
bash,
coreutils,
git,

View File

@ -11,7 +11,7 @@
# dream2nix utils
subsystems,
utils,
# nixpkgs dependenies
# nixpkgs dependencies
bash,
coreutils,
git,

View File

@ -20,7 +20,7 @@
# dream2nix utils
subsystems,
utils,
# nixpkgs dependenies
# nixpkgs dependencies
bash,
coreutils,
moreutils,

View File

@ -12,7 +12,7 @@
apps,
subsystems,
utils,
# nixpkgs dependenies
# nixpkgs dependencies
coreutils,
curl,
jq,

View File

@ -80,6 +80,5 @@
in {
packages.${defaultPackageName}.${defaultPackageVersion} = package;
devShells.${defaultPackageName} = devShell;
inherit devShell;
};
}

View File

@ -11,7 +11,7 @@
# dream2nix utils
subsystems,
utils,
# nixpkgs dependenies
# nixpkgs dependencies
coreutils,
jq,
rustPlatform,

View File

@ -12,7 +12,7 @@
apps,
subsystems,
utils,
# nixpkgs dependenies
# nixpkgs dependencies
coreutils,
curl,
gnutar,

View File

@ -43,7 +43,7 @@ in {
translateBin = {
# dream2nix utils
utils,
# nixpkgs dependenies
# nixpkgs dependencies
bash,
coreutils,
jq,

View File

@ -56,26 +56,24 @@ in
/*
A list of projects returned by `discoverProjects`
Example:
[
{
"dreamLockPath": "packages/optimism/dream-lock.json",
"name": "optimism",
"relPath": "",
"subsystem": "nodejs",
"subsystemInfo": {
"workspaces": [
"packages/common-ts",
"packages/contracts",
"packages/core-utils",
]
},
"translator": "yarn-lock",
"translators": [
"yarn-lock",
"package-json"
{
"dreamLockPath": "packages/optimism/dream-lock.json",
"name": "optimism",
"relPath": "",
"subsystem": "nodejs",
"subsystemInfo": {
"workspaces": [
"packages/common-ts",
"packages/contracts",
"packages/core-utils",
]
}
]
},
"translator": "yarn-lock",
"translators": [
"yarn-lock",
"package-json"
]
}
*/
project,

View File

@ -65,7 +65,6 @@ in
parseGitUrl
readTextFile
recursiveUpdateUntilDepth
sanitizeDerivationName
traceJ
;