From fe6d9f5730d08a7abaee597cc9e608bafd5902b9 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Fri, 1 Dec 2023 19:02:05 -0600 Subject: [PATCH 1/9] add flake to repo --- flake.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 flake.nix diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..91c1a42 --- /dev/null +++ b/flake.nix @@ -0,0 +1,21 @@ +{ + description = "Harmony GitHub collaboration tool"; + + inputs = { + nixpkgs.url = "https://github.com/nixos/nixpkgs"; + }; + + outputs = { self, nixpkgs }: + let + lib = nixpkgs.lib; + forAllSystems = lib.genAttrs lib.systems.flakeExposed; + in + { + packages = forAllSystems (system: + { + harmony = import ./default.nix { inherit system; }; + default = self.packages.${system}.harmony; + } + ); + }; +} From b9625ec645c598f662578183495bce9c60594ae8 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Fri, 1 Dec 2023 19:07:12 -0600 Subject: [PATCH 2/9] default.nix file --- default.nix | 3 +++ flake.nix | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 default.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..3d16604 --- /dev/null +++ b/default.nix @@ -0,0 +1,3 @@ +{ stdenv }: +stdenv.mkDerivation { +} diff --git a/flake.nix b/flake.nix index 91c1a42..0c6b592 100644 --- a/flake.nix +++ b/flake.nix @@ -13,7 +13,9 @@ { packages = forAllSystems (system: { - harmony = import ./default.nix { inherit system; }; + harmony = with nixpkgs.legacyPackages.${system}.default; + callPackage ./default.nix {}; + default = self.packages.${system}.harmony; } ); From b36a3e97f2674d90049b2426e418be3d6c0d9700 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Fri, 1 Dec 2023 19:22:38 -0600 Subject: [PATCH 3/9] generate lockfile. add beginning of derivation. update version check script. --- default.nix | 4 ++++ flake.lock | 26 ++++++++++++++++++++++++++ flake.nix | 4 ++-- version-check.sh | 5 +++-- 4 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 flake.lock diff --git a/default.nix b/default.nix index 3d16604..0076832 100644 --- a/default.nix +++ b/default.nix @@ -1,3 +1,7 @@ { stdenv }: stdenv.mkDerivation { + pname = "harmony"; + version = "2.6.1"; + + src = ./.; } diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..fa8157a --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1701476910, + "narHash": "sha256-ji5EgVv1tF2TkvYoBjgJyTK1ejmgCN0rsiN+1hLeYUE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9657d650935e9d16dbb463473b525333afa892a6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index 0c6b592..1d11a93 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "Harmony GitHub collaboration tool"; inputs = { - nixpkgs.url = "https://github.com/nixos/nixpkgs"; + nixpkgs.url = github:NixOS/nixpkgs; }; outputs = { self, nixpkgs }: @@ -13,7 +13,7 @@ { packages = forAllSystems (system: { - harmony = with nixpkgs.legacyPackages.${system}.default; + harmony = with nixpkgs.legacyPackages.${system}; callPackage ./default.nix {}; default = self.packages.${system}.harmony; diff --git a/version-check.sh b/version-check.sh index 2d196a5..6cebc52 100755 --- a/version-check.sh +++ b/version-check.sh @@ -3,11 +3,12 @@ pkgversion="$(cat harmony.ipkg | sed -n 's/version = \(.*\)/\1/p')" idrversion="$(cat src/AppVersion.idr | sed -n 's/appVersion = "\(.*\)"/\1/p')" npmversion="$(cat package.json | jq -r .version)" +nixversion="$(cat default.nix | sed -n 's/.*version = "\(.*\)";/\1/p')" -if [ "$pkgversion" == "$npmversion" ] && [ "$pkgversion" == "$idrversion" ]; then +if [ "$pkgversion" == "$npmversion" ] && [ "$pkgversion" == "$idrversion" ] && [ "$pkgversion" == "$nixversion" ]; then exit 0 else - echo "Idris package manifest version (${pkgversion}), in-source version (${idrversion}) and NPM package version (${npmversion}) do not agree!" + echo "Idris package manifest version (${pkgversion}), in-source version (${idrversion}), NPM package version (${npmversion}), and Nix version (${nixversion}) do not agree!" exit 1 fi From 3c5bd6be660e97816aa14aeb74f69da9d9058d27 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Fri, 1 Dec 2023 19:34:15 -0600 Subject: [PATCH 4/9] upate Makefile to run first step of a nix build --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b0deea8..259f06c 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ idris2-version = $(shell $(idris2) --version | sed -En 's/Idris 2, version ([^-] idris2-build = $(shell $(idris2) --version | sed -En 's/Idris 2, version [^-]+(.*)/\1/p') idris2-minor-version = $(shell echo ${idris2-version} | sed -En 's/0\.(.*)\../\1/p') -.PHONY: all build install package publish clean version +.PHONY: all build nix-build install package publish clean version all: build @@ -35,6 +35,12 @@ build: node_modules depends/idris-adds-${idris-adds-version} harmony: build +node2nix ?= nix run nixpkgs\#node2nix + +nix-build: + ${MAKE} clean + $(node2nix) -- --composition node2nix.nix -l + version: @(if [[ "${v}" == '' ]]; then echo "please set the 'v' variable."; exit 1; fi) sed -I '' "s/version = .*/version = ${v}/" ./harmony.ipkg From b48653413b5a3578d1d1d156d2c45942cf13bfac Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Fri, 1 Dec 2023 19:36:46 -0600 Subject: [PATCH 5/9] commit output of node2nix --- node-env.nix | 689 ++++++++++++++++++++++++++++++++++++++++++++++ node-packages.nix | 41 +++ node2nix.nix | 17 ++ 3 files changed, 747 insertions(+) create mode 100644 node-env.nix create mode 100644 node-packages.nix create mode 100644 node2nix.nix diff --git a/node-env.nix b/node-env.nix new file mode 100644 index 0000000..bc1e366 --- /dev/null +++ b/node-env.nix @@ -0,0 +1,689 @@ +# This file originates from node2nix + +{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile, writeShellScript}: + +let + # Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master + utillinux = if pkgs ? utillinux then pkgs.utillinux else pkgs.util-linux; + + python = if nodejs ? python then nodejs.python else python2; + + # Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise + tarWrapper = runCommand "tarWrapper" {} '' + mkdir -p $out/bin + + cat > $out/bin/tar <> $out/nix-support/hydra-build-products + ''; + }; + + # Common shell logic + installPackage = writeShellScript "install-package" '' + installPackage() { + local packageName=$1 src=$2 + + local strippedName + + local DIR=$PWD + cd $TMPDIR + + unpackFile $src + + # Make the base dir in which the target dependency resides first + mkdir -p "$(dirname "$DIR/$packageName")" + + if [ -f "$src" ] + then + # Figure out what directory has been unpacked + packageDir="$(find . -maxdepth 1 -type d | tail -1)" + + # Restore write permissions to make building work + find "$packageDir" -type d -exec chmod u+x {} \; + chmod -R u+w "$packageDir" + + # Move the extracted tarball into the output folder + mv "$packageDir" "$DIR/$packageName" + elif [ -d "$src" ] + then + # Get a stripped name (without hash) of the source directory. + # On old nixpkgs it's already set internally. + if [ -z "$strippedName" ] + then + strippedName="$(stripHash $src)" + fi + + # Restore write permissions to make building work + chmod -R u+w "$strippedName" + + # Move the extracted directory into the output folder + mv "$strippedName" "$DIR/$packageName" + fi + + # Change to the package directory to install dependencies + cd "$DIR/$packageName" + } + ''; + + # Bundle the dependencies of the package + # + # Only include dependencies if they don't exist. They may also be bundled in the package. + includeDependencies = {dependencies}: + lib.optionalString (dependencies != []) ( + '' + mkdir -p node_modules + cd node_modules + '' + + (lib.concatMapStrings (dependency: + '' + if [ ! -e "${dependency.packageName}" ]; then + ${composePackage dependency} + fi + '' + ) dependencies) + + '' + cd .. + '' + ); + + # Recursively composes the dependencies of a package + composePackage = { name, packageName, src, dependencies ? [], ... }@args: + builtins.addErrorContext "while evaluating node package '${packageName}'" '' + installPackage "${packageName}" "${src}" + ${includeDependencies { inherit dependencies; }} + cd .. + ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} + ''; + + pinpointDependencies = {dependencies, production}: + let + pinpointDependenciesFromPackageJSON = writeTextFile { + name = "pinpointDependencies.js"; + text = '' + var fs = require('fs'); + var path = require('path'); + + function resolveDependencyVersion(location, name) { + if(location == process.env['NIX_STORE']) { + return null; + } else { + var dependencyPackageJSON = path.join(location, "node_modules", name, "package.json"); + + if(fs.existsSync(dependencyPackageJSON)) { + var dependencyPackageObj = JSON.parse(fs.readFileSync(dependencyPackageJSON)); + + if(dependencyPackageObj.name == name) { + return dependencyPackageObj.version; + } + } else { + return resolveDependencyVersion(path.resolve(location, ".."), name); + } + } + } + + function replaceDependencies(dependencies) { + if(typeof dependencies == "object" && dependencies !== null) { + for(var dependency in dependencies) { + var resolvedVersion = resolveDependencyVersion(process.cwd(), dependency); + + if(resolvedVersion === null) { + process.stderr.write("WARNING: cannot pinpoint dependency: "+dependency+", context: "+process.cwd()+"\n"); + } else { + dependencies[dependency] = resolvedVersion; + } + } + } + } + + /* Read the package.json configuration */ + var packageObj = JSON.parse(fs.readFileSync('./package.json')); + + /* Pinpoint all dependencies */ + replaceDependencies(packageObj.dependencies); + if(process.argv[2] == "development") { + replaceDependencies(packageObj.devDependencies); + } + else { + packageObj.devDependencies = {}; + } + replaceDependencies(packageObj.optionalDependencies); + replaceDependencies(packageObj.peerDependencies); + + /* Write the fixed package.json file */ + fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2)); + ''; + }; + in + '' + node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"} + + ${lib.optionalString (dependencies != []) + '' + if [ -d node_modules ] + then + cd node_modules + ${lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies} + cd .. + fi + ''} + ''; + + # Recursively traverses all dependencies of a package and pinpoints all + # dependencies in the package.json file to the versions that are actually + # being used. + + pinpointDependenciesOfPackage = { packageName, dependencies ? [], production ? true, ... }@args: + '' + if [ -d "${packageName}" ] + then + cd "${packageName}" + ${pinpointDependencies { inherit dependencies production; }} + cd .. + ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} + fi + ''; + + # Extract the Node.js source code which is used to compile packages with + # native bindings + nodeSources = runCommand "node-sources" {} '' + tar --no-same-owner --no-same-permissions -xf ${nodejs.src} + mv node-* $out + ''; + + # Script that adds _integrity fields to all package.json files to prevent NPM from consulting the cache (that is empty) + addIntegrityFieldsScript = writeTextFile { + name = "addintegrityfields.js"; + text = '' + var fs = require('fs'); + var path = require('path'); + + function augmentDependencies(baseDir, dependencies) { + for(var dependencyName in dependencies) { + var dependency = dependencies[dependencyName]; + + // Open package.json and augment metadata fields + var packageJSONDir = path.join(baseDir, "node_modules", dependencyName); + var packageJSONPath = path.join(packageJSONDir, "package.json"); + + if(fs.existsSync(packageJSONPath)) { // Only augment packages that exist. Sometimes we may have production installs in which development dependencies can be ignored + console.log("Adding metadata fields to: "+packageJSONPath); + var packageObj = JSON.parse(fs.readFileSync(packageJSONPath)); + + if(dependency.integrity) { + packageObj["_integrity"] = dependency.integrity; + } else { + packageObj["_integrity"] = "sha1-000000000000000000000000000="; // When no _integrity string has been provided (e.g. by Git dependencies), add a dummy one. It does not seem to harm and it bypasses downloads. + } + + if(dependency.resolved) { + packageObj["_resolved"] = dependency.resolved; // Adopt the resolved property if one has been provided + } else { + packageObj["_resolved"] = dependency.version; // Set the resolved version to the version identifier. This prevents NPM from cloning Git repositories. + } + + if(dependency.from !== undefined) { // Adopt from property if one has been provided + packageObj["_from"] = dependency.from; + } + + fs.writeFileSync(packageJSONPath, JSON.stringify(packageObj, null, 2)); + } + + // Augment transitive dependencies + if(dependency.dependencies !== undefined) { + augmentDependencies(packageJSONDir, dependency.dependencies); + } + } + } + + if(fs.existsSync("./package-lock.json")) { + var packageLock = JSON.parse(fs.readFileSync("./package-lock.json")); + + if(![1, 2].includes(packageLock.lockfileVersion)) { + process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n"); + process.exit(1); + } + + if(packageLock.dependencies !== undefined) { + augmentDependencies(".", packageLock.dependencies); + } + } + ''; + }; + + # Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes + reconstructPackageLock = writeTextFile { + name = "reconstructpackagelock.js"; + text = '' + var fs = require('fs'); + var path = require('path'); + + var packageObj = JSON.parse(fs.readFileSync("package.json")); + + var lockObj = { + name: packageObj.name, + version: packageObj.version, + lockfileVersion: 2, + requires: true, + packages: { + "": { + name: packageObj.name, + version: packageObj.version, + license: packageObj.license, + bin: packageObj.bin, + dependencies: packageObj.dependencies, + engines: packageObj.engines, + optionalDependencies: packageObj.optionalDependencies + } + }, + dependencies: {} + }; + + function augmentPackageJSON(filePath, packages, dependencies) { + var packageJSON = path.join(filePath, "package.json"); + if(fs.existsSync(packageJSON)) { + var packageObj = JSON.parse(fs.readFileSync(packageJSON)); + packages[filePath] = { + version: packageObj.version, + integrity: "sha1-000000000000000000000000000=", + dependencies: packageObj.dependencies, + engines: packageObj.engines, + optionalDependencies: packageObj.optionalDependencies + }; + dependencies[packageObj.name] = { + version: packageObj.version, + integrity: "sha1-000000000000000000000000000=", + dependencies: {} + }; + processDependencies(path.join(filePath, "node_modules"), packages, dependencies[packageObj.name].dependencies); + } + } + + function processDependencies(dir, packages, dependencies) { + if(fs.existsSync(dir)) { + var files = fs.readdirSync(dir); + + files.forEach(function(entry) { + var filePath = path.join(dir, entry); + var stats = fs.statSync(filePath); + + if(stats.isDirectory()) { + if(entry.substr(0, 1) == "@") { + // When we encounter a namespace folder, augment all packages belonging to the scope + var pkgFiles = fs.readdirSync(filePath); + + pkgFiles.forEach(function(entry) { + if(stats.isDirectory()) { + var pkgFilePath = path.join(filePath, entry); + augmentPackageJSON(pkgFilePath, packages, dependencies); + } + }); + } else { + augmentPackageJSON(filePath, packages, dependencies); + } + } + }); + } + } + + processDependencies("node_modules", lockObj.packages, lockObj.dependencies); + + fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2)); + ''; + }; + + # Script that links bins defined in package.json to the node_modules bin directory + # NPM does not do this for top-level packages itself anymore as of v7 + linkBinsScript = writeTextFile { + name = "linkbins.js"; + text = '' + var fs = require('fs'); + var path = require('path'); + + var packageObj = JSON.parse(fs.readFileSync("package.json")); + + var nodeModules = Array(packageObj.name.split("/").length).fill("..").join(path.sep); + + if(packageObj.bin !== undefined) { + fs.mkdirSync(path.join(nodeModules, ".bin")) + + if(typeof packageObj.bin == "object") { + Object.keys(packageObj.bin).forEach(function(exe) { + if(fs.existsSync(packageObj.bin[exe])) { + console.log("linking bin '" + exe + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.bin[exe]), + path.join(nodeModules, ".bin", exe) + ); + } + else { + console.log("skipping non-existent bin '" + exe + "'"); + } + }) + } + else { + if(fs.existsSync(packageObj.bin)) { + console.log("linking bin '" + packageObj.bin + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.bin), + path.join(nodeModules, ".bin", packageObj.name.split("/").pop()) + ); + } + else { + console.log("skipping non-existent bin '" + packageObj.bin + "'"); + } + } + } + else if(packageObj.directories !== undefined && packageObj.directories.bin !== undefined) { + fs.mkdirSync(path.join(nodeModules, ".bin")) + + fs.readdirSync(packageObj.directories.bin).forEach(function(exe) { + if(fs.existsSync(path.join(packageObj.directories.bin, exe))) { + console.log("linking bin '" + exe + "'"); + fs.symlinkSync( + path.join("..", packageObj.name, packageObj.directories.bin, exe), + path.join(nodeModules, ".bin", exe) + ); + } + else { + console.log("skipping non-existent bin '" + exe + "'"); + } + }) + } + ''; + }; + + prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}: + let + forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com"; + in + '' + # Pinpoint the versions of all dependencies to the ones that are actually being used + echo "pinpointing versions of dependencies..." + source $pinpointDependenciesScriptPath + + # Patch the shebangs of the bundled modules to prevent them from + # calling executables outside the Nix store as much as possible + patchShebangs . + + # Deploy the Node.js package by running npm install. Since the + # dependencies have been provided already by ourselves, it should not + # attempt to install them again, which is good, because we want to make + # it Nix's responsibility. If it needs to install any dependencies + # anyway (e.g. because the dependency parameters are + # incomplete/incorrect), it fails. + # + # The other responsibilities of NPM are kept -- version checks, build + # steps, postprocessing etc. + + export HOME=$TMPDIR + cd "${packageName}" + runHook preRebuild + + ${lib.optionalString bypassCache '' + ${lib.optionalString reconstructLock '' + if [ -f package-lock.json ] + then + echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!" + echo "This will most likely result in version mismatches! We will remove the lock file and regenerate it!" + rm package-lock.json + else + echo "No package-lock.json file found, reconstructing..." + fi + + node ${reconstructPackageLock} + ''} + + node ${addIntegrityFieldsScript} + ''} + + npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild + + runHook postRebuild + + if [ "''${dontNpmInstall-}" != "1" ] + then + # NPM tries to download packages even when they already exist if npm-shrinkwrap is used. + rm -f npm-shrinkwrap.json + + npm ${forceOfflineFlag} --nodedir=${nodeSources} --no-bin-links --ignore-scripts ${npmFlags} ${lib.optionalString production "--production"} install + fi + + # Link executables defined in package.json + node ${linkBinsScript} + ''; + + # Builds and composes an NPM package including all its dependencies + buildNodePackage = + { name + , packageName + , version ? null + , dependencies ? [] + , buildInputs ? [] + , production ? true + , npmFlags ? "" + , dontNpmInstall ? false + , bypassCache ? false + , reconstructLock ? false + , preRebuild ? "" + , dontStrip ? true + , unpackPhase ? "true" + , buildPhase ? "true" + , meta ? {} + , ... }@args: + + let + extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ]; + in + stdenv.mkDerivation ({ + name = "${name}${if version == null then "" else "-${version}"}"; + buildInputs = [ tarWrapper python nodejs ] + ++ lib.optional (stdenv.isLinux) utillinux + ++ lib.optional (stdenv.isDarwin) libtool + ++ buildInputs; + + inherit nodejs; + + inherit dontStrip; # Stripping may fail a build for some package deployments + inherit dontNpmInstall preRebuild unpackPhase buildPhase; + + compositionScript = composePackage args; + pinpointDependenciesScript = pinpointDependenciesOfPackage args; + + passAsFile = [ "compositionScript" "pinpointDependenciesScript" ]; + + installPhase = '' + source ${installPackage} + + # Create and enter a root node_modules/ folder + mkdir -p $out/lib/node_modules + cd $out/lib/node_modules + + # Compose the package and all its dependencies + source $compositionScriptPath + + ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} + + # Create symlink to the deployed executable folder, if applicable + if [ -d "$out/lib/node_modules/.bin" ] + then + ln -s $out/lib/node_modules/.bin $out/bin + + # Fixup all executables + ls $out/bin/* | while read i + do + file="$(readlink -f "$i")" + chmod u+rwx "$file" + if isScript "$file" + then + sed -i 's/\r$//' "$file" # convert crlf to lf + fi + done + fi + + # Create symlinks to the deployed manual page folders, if applicable + if [ -d "$out/lib/node_modules/${packageName}/man" ] + then + mkdir -p $out/share + for dir in "$out/lib/node_modules/${packageName}/man/"* + do + mkdir -p $out/share/man/$(basename "$dir") + for page in "$dir"/* + do + ln -s $page $out/share/man/$(basename "$dir") + done + done + fi + + # Run post install hook, if provided + runHook postInstall + ''; + + meta = { + # default to Node.js' platforms + platforms = nodejs.meta.platforms; + } // meta; + } // extraArgs); + + # Builds a node environment (a node_modules folder and a set of binaries) + buildNodeDependencies = + { name + , packageName + , version ? null + , src + , dependencies ? [] + , buildInputs ? [] + , production ? true + , npmFlags ? "" + , dontNpmInstall ? false + , bypassCache ? false + , reconstructLock ? false + , dontStrip ? true + , unpackPhase ? "true" + , buildPhase ? "true" + , ... }@args: + + let + extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ]; + in + stdenv.mkDerivation ({ + name = "node-dependencies-${name}${if version == null then "" else "-${version}"}"; + + buildInputs = [ tarWrapper python nodejs ] + ++ lib.optional (stdenv.isLinux) utillinux + ++ lib.optional (stdenv.isDarwin) libtool + ++ buildInputs; + + inherit dontStrip; # Stripping may fail a build for some package deployments + inherit dontNpmInstall unpackPhase buildPhase; + + includeScript = includeDependencies { inherit dependencies; }; + pinpointDependenciesScript = pinpointDependenciesOfPackage args; + + passAsFile = [ "includeScript" "pinpointDependenciesScript" ]; + + installPhase = '' + source ${installPackage} + + mkdir -p $out/${packageName} + cd $out/${packageName} + + source $includeScriptPath + + # Create fake package.json to make the npm commands work properly + cp ${src}/package.json . + chmod 644 package.json + ${lib.optionalString bypassCache '' + if [ -f ${src}/package-lock.json ] + then + cp ${src}/package-lock.json . + chmod 644 package-lock.json + fi + ''} + + # Go to the parent folder to make sure that all packages are pinpointed + cd .. + ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} + + ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} + + # Expose the executables that were installed + cd .. + ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} + + mv ${packageName} lib + ln -s $out/lib/node_modules/.bin $out/bin + ''; + } // extraArgs); + + # Builds a development shell + buildNodeShell = + { name + , packageName + , version ? null + , src + , dependencies ? [] + , buildInputs ? [] + , production ? true + , npmFlags ? "" + , dontNpmInstall ? false + , bypassCache ? false + , reconstructLock ? false + , dontStrip ? true + , unpackPhase ? "true" + , buildPhase ? "true" + , ... }@args: + + let + nodeDependencies = buildNodeDependencies args; + extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "unpackPhase" "buildPhase" ]; + in + stdenv.mkDerivation ({ + name = "node-shell-${name}${if version == null then "" else "-${version}"}"; + + buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs; + buildCommand = '' + mkdir -p $out/bin + cat > $out/bin/shell < { + inherit system; + }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_14"}: + +let + nodeEnv = import ./node-env.nix { + inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript; + inherit pkgs nodejs; + libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; + }; +in +import ./node-packages.nix { + inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; + inherit nodeEnv; +} From f5d89b696e61824ea275aab6eed0f65e3de86671 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Fri, 1 Dec 2023 22:02:48 -0600 Subject: [PATCH 6/9] get things all the way through the build process --- .gitignore | 1 + Makefile | 16 +- default.nix | 36 ++- node-packages.nix | 766 +++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 813 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 07ac58e..7a6e930 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ harmony-npm.tar.gz .*.swp *.idr~ +result diff --git a/Makefile b/Makefile index 259f06c..ac10481 100644 --- a/Makefile +++ b/Makefile @@ -13,17 +13,26 @@ all: build depends/idris-adds-${idris-adds-version}: mkdir -p depends/idris-adds-${idris-adds-version} mkdir -p build/deps +ifeq ($(IDRIS_ADDS_SRC),) cd build/deps && \ git clone https://github.com/mattpolzin/idris-adds.git && \ cd idris-adds && \ git checkout ${idris-adds-version} && \ make && \ cp -R ./build/ttc/* ../../../depends/idris-adds-${idris-adds-version}/ +else + cd build/deps && \ + cp -R $(IDRIS_ADDS_SRC) ./idris-adds && \ + chmod -R +rw ./idris-adds && \ + cd idris-adds && \ + make && \ + cp -R ./build/ttc/* ../../../depends/idris-adds-${idris-adds-version}/ +endif -node_modules: +./node_modules/: package.json npm install -build: node_modules depends/idris-adds-${idris-adds-version} +build: ./node_modules/ depends/idris-adds-${idris-adds-version} IDRIS2_DATA=./support $(idris2) --build harmony.ipkg @if [[ ${idris2-minor-version} -gt 6 ]] || [[ "${idris2-build}" != '' ]]; then \ cp ./build/exec/harmony ./harmony; \ @@ -39,7 +48,8 @@ node2nix ?= nix run nixpkgs\#node2nix nix-build: ${MAKE} clean - $(node2nix) -- --composition node2nix.nix -l + $(node2nix) -- --composition node2nix.nix # -l # <- can't use -l for lockfile because lockfile version 3 not supported yet. + nix build . version: @(if [[ "${v}" == '' ]]; then echo "please set the 'v' variable."; exit 1; fi) diff --git a/default.nix b/default.nix index 0076832..212ddc1 100644 --- a/default.nix +++ b/default.nix @@ -1,7 +1,41 @@ -{ stdenv }: +{ stdenv, callPackage, fetchFromGitHub, idris2 }: +let + nodeDependencies = (callPackage ./node2nix.nix {}).nodeDependencies; + idrisAddsVersion = "0.3.0"; + idrisAddsSrc = fetchFromGitHub { + owner = "mattpolzin"; + repo = "idris-adds"; + rev = "${idrisAddsVersion}"; + hash = "sha256-OSu381nUNZqFJs4HzmMxGda60k7xsa1GulQq7kU/R2o="; + }; +in stdenv.mkDerivation { pname = "harmony"; version = "2.6.1"; + buildInputs = [ idris2 ]; + src = ./.; + + buildPhase = '' + runHook preBuild + + ln -s ${nodeDependencies}/lib/node_modules ./node_modules + export PATH="${nodeDependencies}/bin:$PATH" + export IDRIS_ADDS_SRC="${idrisAddsSrc}" + + make build + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/bin + cp harmony $out/bin/ + + runHook postInstall + ''; + } diff --git a/node-packages.nix b/node-packages.nix index 097a3d0..9f8c161 100644 --- a/node-packages.nix +++ b/node-packages.nix @@ -3,12 +3,774 @@ {nodeEnv, fetchurl, fetchgit, nix-gitignore, stdenv, lib, globalBuildInputs ? []}: let - sources = {}; + sources = { + "@kwsites/file-exists-1.1.1" = { + name = "_at_kwsites_slash_file-exists"; + packageName = "@kwsites/file-exists"; + version = "1.1.1"; + src = fetchurl { + url = "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz"; + sha512 = "m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw=="; + }; + }; + "@kwsites/promise-deferred-1.1.1" = { + name = "_at_kwsites_slash_promise-deferred"; + packageName = "@kwsites/promise-deferred"; + version = "1.1.1"; + src = fetchurl { + url = "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz"; + sha512 = "GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw=="; + }; + }; + "@octokit/app-13.1.8" = { + name = "_at_octokit_slash_app"; + packageName = "@octokit/app"; + version = "13.1.8"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/app/-/app-13.1.8.tgz"; + sha512 = "bCncePMguVyFpdBbnceFKfmPOuUD94T189GuQ0l00ZcQ+mX4hyPqnaWJlsXE2HSdA71eV7p8GPDZ+ErplTkzow=="; + }; + }; + "@octokit/auth-app-4.0.13" = { + name = "_at_octokit_slash_auth-app"; + packageName = "@octokit/auth-app"; + version = "4.0.13"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/auth-app/-/auth-app-4.0.13.tgz"; + sha512 = "NBQkmR/Zsc+8fWcVIFrwDgNXS7f4XDrkd9LHdi9DPQw1NdGHLviLzRO2ZBwTtepnwHXW5VTrVU9eFGijMUqllg=="; + }; + }; + "@octokit/auth-oauth-app-5.0.6" = { + name = "_at_octokit_slash_auth-oauth-app"; + packageName = "@octokit/auth-oauth-app"; + version = "5.0.6"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/auth-oauth-app/-/auth-oauth-app-5.0.6.tgz"; + sha512 = "SxyfIBfeFcWd9Z/m1xa4LENTQ3l1y6Nrg31k2Dcb1jS5ov7pmwMJZ6OGX8q3K9slRgVpeAjNA1ipOAMHkieqyw=="; + }; + }; + "@octokit/auth-oauth-device-4.0.5" = { + name = "_at_octokit_slash_auth-oauth-device"; + packageName = "@octokit/auth-oauth-device"; + version = "4.0.5"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/auth-oauth-device/-/auth-oauth-device-4.0.5.tgz"; + sha512 = "XyhoWRTzf2ZX0aZ52a6Ew5S5VBAfwwx1QnC2Np6Et3MWQpZjlREIcbcvVZtkNuXp6Z9EeiSLSDUqm3C+aMEHzQ=="; + }; + }; + "@octokit/auth-oauth-user-2.1.2" = { + name = "_at_octokit_slash_auth-oauth-user"; + packageName = "@octokit/auth-oauth-user"; + version = "2.1.2"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/auth-oauth-user/-/auth-oauth-user-2.1.2.tgz"; + sha512 = "kkRqNmFe7s5GQcojE3nSlF+AzYPpPv7kvP/xYEnE57584pixaFBH8Vovt+w5Y3E4zWUEOxjdLItmBTFAWECPAg=="; + }; + }; + "@octokit/auth-token-3.0.4" = { + name = "_at_octokit_slash_auth-token"; + packageName = "@octokit/auth-token"; + version = "3.0.4"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-3.0.4.tgz"; + sha512 = "TWFX7cZF2LXoCvdmJWY7XVPi74aSY0+FfBZNSXEXFkMpjcqsQwDSYVv5FhRFaI0V1ECnwbz4j59T/G+rXNWaIQ=="; + }; + }; + "@octokit/auth-unauthenticated-3.0.5" = { + name = "_at_octokit_slash_auth-unauthenticated"; + packageName = "@octokit/auth-unauthenticated"; + version = "3.0.5"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/auth-unauthenticated/-/auth-unauthenticated-3.0.5.tgz"; + sha512 = "yH2GPFcjrTvDWPwJWWCh0tPPtTL5SMgivgKPA+6v/XmYN6hGQkAto8JtZibSKOpf8ipmeYhLNWQ2UgW0GYILCw=="; + }; + }; + "@octokit/core-4.2.4" = { + name = "_at_octokit_slash_core"; + packageName = "@octokit/core"; + version = "4.2.4"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/core/-/core-4.2.4.tgz"; + sha512 = "rYKilwgzQ7/imScn3M9/pFfUf4I1AZEH3KhyJmtPdE2zfaXAn2mFfUy4FbKewzc2We5y/LlKLj36fWJLKC2SIQ=="; + }; + }; + "@octokit/endpoint-7.0.6" = { + name = "_at_octokit_slash_endpoint"; + packageName = "@octokit/endpoint"; + version = "7.0.6"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-7.0.6.tgz"; + sha512 = "5L4fseVRUsDFGR00tMWD/Trdeeihn999rTMGRMC1G/Ldi1uWlWJzI98H4Iak5DB/RVvQuyMYKqSK/R6mbSOQyg=="; + }; + }; + "@octokit/graphql-5.0.6" = { + name = "_at_octokit_slash_graphql"; + packageName = "@octokit/graphql"; + version = "5.0.6"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/graphql/-/graphql-5.0.6.tgz"; + sha512 = "Fxyxdy/JH0MnIB5h+UQ3yCoh1FG4kWXfFKkpWqjZHw/p+Kc8Y44Hu/kCgNBT6nU1shNumEchmW/sUO1JuQnPcw=="; + }; + }; + "@octokit/oauth-app-4.2.4" = { + name = "_at_octokit_slash_oauth-app"; + packageName = "@octokit/oauth-app"; + version = "4.2.4"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/oauth-app/-/oauth-app-4.2.4.tgz"; + sha512 = "iuOVFrmm5ZKNavRtYu5bZTtmlKLc5uVgpqTfMEqYYf2OkieV6VdxKZAb5qLVdEPL8LU2lMWcGpavPBV835cgoA=="; + }; + }; + "@octokit/oauth-authorization-url-5.0.0" = { + name = "_at_octokit_slash_oauth-authorization-url"; + packageName = "@octokit/oauth-authorization-url"; + version = "5.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/oauth-authorization-url/-/oauth-authorization-url-5.0.0.tgz"; + sha512 = "y1WhN+ERDZTh0qZ4SR+zotgsQUE1ysKnvBt1hvDRB2WRzYtVKQjn97HEPzoehh66Fj9LwNdlZh+p6TJatT0zzg=="; + }; + }; + "@octokit/oauth-methods-2.0.6" = { + name = "_at_octokit_slash_oauth-methods"; + packageName = "@octokit/oauth-methods"; + version = "2.0.6"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/oauth-methods/-/oauth-methods-2.0.6.tgz"; + sha512 = "l9Uml2iGN2aTWLZcm8hV+neBiFXAQ9+3sKiQe/sgumHlL6HDg0AQ8/l16xX/5jJvfxueqTW5CWbzd0MjnlfHZw=="; + }; + }; + "@octokit/openapi-types-18.1.1" = { + name = "_at_octokit_slash_openapi-types"; + packageName = "@octokit/openapi-types"; + version = "18.1.1"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-18.1.1.tgz"; + sha512 = "VRaeH8nCDtF5aXWnjPuEMIYf1itK/s3JYyJcWFJT8X9pSNnBtriDf7wlEWsGuhPLl4QIH4xM8fqTXDwJ3Mu6sw=="; + }; + }; + "@octokit/plugin-paginate-rest-6.1.2" = { + name = "_at_octokit_slash_plugin-paginate-rest"; + packageName = "@octokit/plugin-paginate-rest"; + version = "6.1.2"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-6.1.2.tgz"; + sha512 = "qhrmtQeHU/IivxucOV1bbI/xZyC/iOBhclokv7Sut5vnejAIAEXVcGQeRpQlU39E0WwK9lNvJHphHri/DB6lbQ=="; + }; + }; + "@octokit/plugin-rest-endpoint-methods-7.2.3" = { + name = "_at_octokit_slash_plugin-rest-endpoint-methods"; + packageName = "@octokit/plugin-rest-endpoint-methods"; + version = "7.2.3"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-7.2.3.tgz"; + sha512 = "I5Gml6kTAkzVlN7KCtjOM+Ruwe/rQppp0QU372K1GP7kNOYEKe8Xn5BW4sE62JAHdwpq95OQK/qGNyKQMUzVgA=="; + }; + }; + "@octokit/plugin-retry-4.1.6" = { + name = "_at_octokit_slash_plugin-retry"; + packageName = "@octokit/plugin-retry"; + version = "4.1.6"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-4.1.6.tgz"; + sha512 = "obkYzIgEC75r8+9Pnfiiqy3y/x1bc3QLE5B7qvv9wi9Kj0R5tGQFC6QMBg1154WQ9lAVypuQDGyp3hNpp15gQQ=="; + }; + }; + "@octokit/plugin-throttling-5.2.3" = { + name = "_at_octokit_slash_plugin-throttling"; + packageName = "@octokit/plugin-throttling"; + version = "5.2.3"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-5.2.3.tgz"; + sha512 = "C9CFg9mrf6cugneKiaI841iG8DOv6P5XXkjmiNNut+swePxQ7RWEdAZRp5rJoE1hjsIqiYcKa/ZkOQ+ujPI39Q=="; + }; + }; + "@octokit/request-6.2.8" = { + name = "_at_octokit_slash_request"; + packageName = "@octokit/request"; + version = "6.2.8"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/request/-/request-6.2.8.tgz"; + sha512 = "ow4+pkVQ+6XVVsekSYBzJC0VTVvh/FCTUUgTsboGq+DTeWdyIFV8WSCdo0RIxk6wSkBTHqIK1mYuY7nOBXOchw=="; + }; + }; + "@octokit/request-error-3.0.3" = { + name = "_at_octokit_slash_request-error"; + packageName = "@octokit/request-error"; + version = "3.0.3"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/request-error/-/request-error-3.0.3.tgz"; + sha512 = "crqw3V5Iy2uOU5Np+8M/YexTlT8zxCfI+qu+LxUB7SZpje4Qmx3mub5DfEKSO8Ylyk0aogi6TYdf6kxzh2BguQ=="; + }; + }; + "@octokit/tsconfig-1.0.2" = { + name = "_at_octokit_slash_tsconfig"; + packageName = "@octokit/tsconfig"; + version = "1.0.2"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/tsconfig/-/tsconfig-1.0.2.tgz"; + sha512 = "I0vDR0rdtP8p2lGMzvsJzbhdOWy405HcGovrspJ8RRibHnyRgggUSNO5AIox5LmqiwmatHKYsvj6VGFHkqS7lA=="; + }; + }; + "@octokit/types-10.0.0" = { + name = "_at_octokit_slash_types"; + packageName = "@octokit/types"; + version = "10.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/types/-/types-10.0.0.tgz"; + sha512 = "Vm8IddVmhCgU1fxC1eyinpwqzXPEYu0NrYzD3YZjlGjyftdLBTeqNblRC0jmJmgxbJIsQlyogVeGnrNaaMVzIg=="; + }; + }; + "@octokit/types-9.3.2" = { + name = "_at_octokit_slash_types"; + packageName = "@octokit/types"; + version = "9.3.2"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/types/-/types-9.3.2.tgz"; + sha512 = "D4iHGTdAnEEVsB8fl95m1hiz7D5YiRdQ9b/OEb3BYRVwbLsGHcRVPz+u+BgRLNk0Q0/4iZCBqDN96j2XNxfXrA=="; + }; + }; + "@octokit/webhooks-10.9.2" = { + name = "_at_octokit_slash_webhooks"; + packageName = "@octokit/webhooks"; + version = "10.9.2"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/webhooks/-/webhooks-10.9.2.tgz"; + sha512 = "hFVF/szz4l/Y/GQdKxNmQjUke0XJXK986p+ucIlubTGVPVtVtup5G1jarQfvCMBs9Fvlf9dvH8K83E4lefmofQ=="; + }; + }; + "@octokit/webhooks-methods-3.0.3" = { + name = "_at_octokit_slash_webhooks-methods"; + packageName = "@octokit/webhooks-methods"; + version = "3.0.3"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/webhooks-methods/-/webhooks-methods-3.0.3.tgz"; + sha512 = "2vM+DCNTJ5vL62O5LagMru6XnYhV4fJslK+5YUkTa6rWlW2S+Tqs1lF9Wr9OGqHfVwpBj3TeztWfVON/eUoW1Q=="; + }; + }; + "@octokit/webhooks-types-6.11.0" = { + name = "_at_octokit_slash_webhooks-types"; + packageName = "@octokit/webhooks-types"; + version = "6.11.0"; + src = fetchurl { + url = "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-6.11.0.tgz"; + sha512 = "AanzbulOHljrku1NGfafxdpTCfw2ENaWzH01N2vqQM+cUFbk868Cgh0xylz0JIM9BoKbfI++bdD6EYX0Q/UTEw=="; + }; + }; + "@types/aws-lambda-8.10.130" = { + name = "_at_types_slash_aws-lambda"; + packageName = "@types/aws-lambda"; + version = "8.10.130"; + src = fetchurl { + url = "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.130.tgz"; + sha512 = "HxTfLeGvD1wTJqIGwcBCpNmHKenja+We1e0cuzeIDFfbEj3ixnlTInyPR/81zAe0Ss/Ip12rFK6XNeMLVucOSg=="; + }; + }; + "@types/btoa-lite-1.0.2" = { + name = "_at_types_slash_btoa-lite"; + packageName = "@types/btoa-lite"; + version = "1.0.2"; + src = fetchurl { + url = "https://registry.npmjs.org/@types/btoa-lite/-/btoa-lite-1.0.2.tgz"; + sha512 = "ZYbcE2x7yrvNFJiU7xJGrpF/ihpkM7zKgw8bha3LNJSesvTtUNxbpzaT7WXBIryf6jovisrxTBvymxMeLLj1Mg=="; + }; + }; + "@types/jsonwebtoken-9.0.5" = { + name = "_at_types_slash_jsonwebtoken"; + packageName = "@types/jsonwebtoken"; + version = "9.0.5"; + src = fetchurl { + url = "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.5.tgz"; + sha512 = "VRLSGzik+Unrup6BsouBeHsf4d1hOEgYWTm/7Nmw1sXoN1+tRly/Gy/po3yeahnP4jfnQWWAhQAqcNfH7ngOkA=="; + }; + }; + "@types/node-20.10.2" = { + name = "_at_types_slash_node"; + packageName = "@types/node"; + version = "20.10.2"; + src = fetchurl { + url = "https://registry.npmjs.org/@types/node/-/node-20.10.2.tgz"; + sha512 = "37MXfxkb0vuIlRKHNxwCkb60PNBpR94u4efQuN4JgIAm66zfCDXGSAFCef9XUWFovX2R1ok6Z7MHhtdVXXkkIw=="; + }; + }; + "aggregate-error-3.1.0" = { + name = "aggregate-error"; + packageName = "aggregate-error"; + version = "3.1.0"; + src = fetchurl { + url = "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz"; + sha512 = "4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA=="; + }; + }; + "before-after-hook-2.2.3" = { + name = "before-after-hook"; + packageName = "before-after-hook"; + version = "2.2.3"; + src = fetchurl { + url = "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz"; + sha512 = "NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ=="; + }; + }; + "bottleneck-2.19.5" = { + name = "bottleneck"; + packageName = "bottleneck"; + version = "2.19.5"; + src = fetchurl { + url = "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz"; + sha512 = "VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw=="; + }; + }; + "btoa-lite-1.0.0" = { + name = "btoa-lite"; + packageName = "btoa-lite"; + version = "1.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz"; + sha512 = "gvW7InbIyF8AicrqWoptdW08pUxuhq8BEgowNajy9RhiE86fmGAGl+bLKo6oB8QP0CkqHLowfN0oJdKC/J6LbA=="; + }; + }; + "buffer-equal-constant-time-1.0.1" = { + name = "buffer-equal-constant-time"; + packageName = "buffer-equal-constant-time"; + version = "1.0.1"; + src = fetchurl { + url = "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz"; + sha512 = "zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA=="; + }; + }; + "clean-stack-2.2.0" = { + name = "clean-stack"; + packageName = "clean-stack"; + version = "2.2.0"; + src = fetchurl { + url = "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz"; + sha512 = "4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A=="; + }; + }; + "debug-4.3.4" = { + name = "debug"; + packageName = "debug"; + version = "4.3.4"; + src = fetchurl { + url = "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz"; + sha512 = "PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ=="; + }; + }; + "deprecation-2.3.1" = { + name = "deprecation"; + packageName = "deprecation"; + version = "2.3.1"; + src = fetchurl { + url = "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz"; + sha512 = "xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ=="; + }; + }; + "ecdsa-sig-formatter-1.0.11" = { + name = "ecdsa-sig-formatter"; + packageName = "ecdsa-sig-formatter"; + version = "1.0.11"; + src = fetchurl { + url = "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz"; + sha512 = "nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ=="; + }; + }; + "encoding-0.1.13" = { + name = "encoding"; + packageName = "encoding"; + version = "0.1.13"; + src = fetchurl { + url = "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz"; + sha512 = "ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A=="; + }; + }; + "fromentries-1.3.2" = { + name = "fromentries"; + packageName = "fromentries"; + version = "1.3.2"; + src = fetchurl { + url = "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz"; + sha512 = "cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg=="; + }; + }; + "iconv-lite-0.6.3" = { + name = "iconv-lite"; + packageName = "iconv-lite"; + version = "0.6.3"; + src = fetchurl { + url = "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz"; + sha512 = "4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw=="; + }; + }; + "indent-string-4.0.0" = { + name = "indent-string"; + packageName = "indent-string"; + version = "4.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz"; + sha512 = "EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg=="; + }; + }; + "is-plain-object-5.0.0" = { + name = "is-plain-object"; + packageName = "is-plain-object"; + version = "5.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz"; + sha512 = "VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="; + }; + }; + "jsonwebtoken-9.0.2" = { + name = "jsonwebtoken"; + packageName = "jsonwebtoken"; + version = "9.0.2"; + src = fetchurl { + url = "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz"; + sha512 = "PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ=="; + }; + }; + "jwa-1.4.1" = { + name = "jwa"; + packageName = "jwa"; + version = "1.4.1"; + src = fetchurl { + url = "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz"; + sha512 = "qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA=="; + }; + }; + "jws-3.2.2" = { + name = "jws"; + packageName = "jws"; + version = "3.2.2"; + src = fetchurl { + url = "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz"; + sha512 = "YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA=="; + }; + }; + "lodash.includes-4.3.0" = { + name = "lodash.includes"; + packageName = "lodash.includes"; + version = "4.3.0"; + src = fetchurl { + url = "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz"; + sha512 = "W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w=="; + }; + }; + "lodash.isboolean-3.0.3" = { + name = "lodash.isboolean"; + packageName = "lodash.isboolean"; + version = "3.0.3"; + src = fetchurl { + url = "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz"; + sha512 = "Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg=="; + }; + }; + "lodash.isinteger-4.0.4" = { + name = "lodash.isinteger"; + packageName = "lodash.isinteger"; + version = "4.0.4"; + src = fetchurl { + url = "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz"; + sha512 = "DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA=="; + }; + }; + "lodash.isnumber-3.0.3" = { + name = "lodash.isnumber"; + packageName = "lodash.isnumber"; + version = "3.0.3"; + src = fetchurl { + url = "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz"; + sha512 = "QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw=="; + }; + }; + "lodash.isplainobject-4.0.6" = { + name = "lodash.isplainobject"; + packageName = "lodash.isplainobject"; + version = "4.0.6"; + src = fetchurl { + url = "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz"; + sha512 = "oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA=="; + }; + }; + "lodash.isstring-4.0.1" = { + name = "lodash.isstring"; + packageName = "lodash.isstring"; + version = "4.0.1"; + src = fetchurl { + url = "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz"; + sha512 = "0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw=="; + }; + }; + "lodash.once-4.1.1" = { + name = "lodash.once"; + packageName = "lodash.once"; + version = "4.1.1"; + src = fetchurl { + url = "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz"; + sha512 = "Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg=="; + }; + }; + "lru-cache-6.0.0" = { + name = "lru-cache"; + packageName = "lru-cache"; + version = "6.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz"; + sha512 = "Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA=="; + }; + }; + "lru-cache-9.1.2" = { + name = "lru-cache"; + packageName = "lru-cache"; + version = "9.1.2"; + src = fetchurl { + url = "https://registry.npmjs.org/lru-cache/-/lru-cache-9.1.2.tgz"; + sha512 = "ERJq3FOzJTxBbFjZ7iDs+NiK4VI9Wz+RdrrAB8dio1oV+YvdPzUEE4QNiT2VD51DkIbCYRUUzCRkssXCHqSnKQ=="; + }; + }; + "ms-2.1.2" = { + name = "ms"; + packageName = "ms"; + version = "2.1.2"; + src = fetchurl { + url = "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz"; + sha512 = "sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="; + }; + }; + "ms-2.1.3" = { + name = "ms"; + packageName = "ms"; + version = "2.1.3"; + src = fetchurl { + url = "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz"; + sha512 = "6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="; + }; + }; + "node-fetch-2.7.0" = { + name = "node-fetch"; + packageName = "node-fetch"; + version = "2.7.0"; + src = fetchurl { + url = "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz"; + sha512 = "c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A=="; + }; + }; + "octokit-2.1.0" = { + name = "octokit"; + packageName = "octokit"; + version = "2.1.0"; + src = fetchurl { + url = "https://registry.npmjs.org/octokit/-/octokit-2.1.0.tgz"; + sha512 = "Pxi6uKTjBRZWgAwsw1NgHdRlL+QASCN35OYS7X79o7PtBME0CLXEroZmPtEwlWZbPTP+iDbEy2wCbSOgm0uGIQ=="; + }; + }; + "once-1.4.0" = { + name = "once"; + packageName = "once"; + version = "1.4.0"; + src = fetchurl { + url = "https://registry.npmjs.org/once/-/once-1.4.0.tgz"; + sha512 = "lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="; + }; + }; + "safe-buffer-5.2.1" = { + name = "safe-buffer"; + packageName = "safe-buffer"; + version = "5.2.1"; + src = fetchurl { + url = "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz"; + sha512 = "rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="; + }; + }; + "safer-buffer-2.1.2" = { + name = "safer-buffer"; + packageName = "safer-buffer"; + version = "2.1.2"; + src = fetchurl { + url = "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz"; + sha512 = "YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="; + }; + }; + "semver-7.5.4" = { + name = "semver"; + packageName = "semver"; + version = "7.5.4"; + src = fetchurl { + url = "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz"; + sha512 = "1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA=="; + }; + }; + "simple-git-3.21.0" = { + name = "simple-git"; + packageName = "simple-git"; + version = "3.21.0"; + src = fetchurl { + url = "https://registry.npmjs.org/simple-git/-/simple-git-3.21.0.tgz"; + sha512 = "oTzw9248AF5bDTMk9MrxsRzEzivMlY+DWH0yWS4VYpMhNLhDWnN06pCtaUyPnqv/FpsdeNmRqmZugMABHRPdDA=="; + }; + }; + "tr46-0.0.3" = { + name = "tr46"; + packageName = "tr46"; + version = "0.0.3"; + src = fetchurl { + url = "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz"; + sha512 = "N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="; + }; + }; + "undici-types-5.26.5" = { + name = "undici-types"; + packageName = "undici-types"; + version = "5.26.5"; + src = fetchurl { + url = "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz"; + sha512 = "JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="; + }; + }; + "universal-github-app-jwt-1.1.1" = { + name = "universal-github-app-jwt"; + packageName = "universal-github-app-jwt"; + version = "1.1.1"; + src = fetchurl { + url = "https://registry.npmjs.org/universal-github-app-jwt/-/universal-github-app-jwt-1.1.1.tgz"; + sha512 = "G33RTLrIBMFmlDV4u4CBF7dh71eWwykck4XgaxaIVeZKOYZRAAxvcGMRFTUclVY6xoUPQvO4Ne5wKGxYm/Yy9w=="; + }; + }; + "universal-user-agent-6.0.1" = { + name = "universal-user-agent"; + packageName = "universal-user-agent"; + version = "6.0.1"; + src = fetchurl { + url = "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz"; + sha512 = "yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ=="; + }; + }; + "webidl-conversions-3.0.1" = { + name = "webidl-conversions"; + packageName = "webidl-conversions"; + version = "3.0.1"; + src = fetchurl { + url = "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz"; + sha512 = "2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="; + }; + }; + "whatwg-url-5.0.0" = { + name = "whatwg-url"; + packageName = "whatwg-url"; + version = "5.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz"; + sha512 = "saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw=="; + }; + }; + "wrappy-1.0.2" = { + name = "wrappy"; + packageName = "wrappy"; + version = "1.0.2"; + src = fetchurl { + url = "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz"; + sha512 = "l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="; + }; + }; + "yallist-4.0.0" = { + name = "yallist"; + packageName = "yallist"; + version = "4.0.0"; + src = fetchurl { + url = "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz"; + sha512 = "3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="; + }; + }; + }; args = { name = "_at_mattpolzin_slash_harmony"; packageName = "@mattpolzin/harmony"; version = "2.6.1"; src = ./.; + dependencies = [ + sources."@kwsites/file-exists-1.1.1" + sources."@kwsites/promise-deferred-1.1.1" + sources."@octokit/app-13.1.8" + sources."@octokit/auth-app-4.0.13" + sources."@octokit/auth-oauth-app-5.0.6" + sources."@octokit/auth-oauth-device-4.0.5" + sources."@octokit/auth-oauth-user-2.1.2" + sources."@octokit/auth-token-3.0.4" + sources."@octokit/auth-unauthenticated-3.0.5" + sources."@octokit/core-4.2.4" + sources."@octokit/endpoint-7.0.6" + sources."@octokit/graphql-5.0.6" + sources."@octokit/oauth-app-4.2.4" + sources."@octokit/oauth-authorization-url-5.0.0" + sources."@octokit/oauth-methods-2.0.6" + sources."@octokit/openapi-types-18.1.1" + sources."@octokit/plugin-paginate-rest-6.1.2" + (sources."@octokit/plugin-rest-endpoint-methods-7.2.3" // { + dependencies = [ + sources."@octokit/types-10.0.0" + ]; + }) + sources."@octokit/plugin-retry-4.1.6" + sources."@octokit/plugin-throttling-5.2.3" + sources."@octokit/request-6.2.8" + sources."@octokit/request-error-3.0.3" + sources."@octokit/tsconfig-1.0.2" + sources."@octokit/types-9.3.2" + sources."@octokit/webhooks-10.9.2" + sources."@octokit/webhooks-methods-3.0.3" + sources."@octokit/webhooks-types-6.11.0" + sources."@types/aws-lambda-8.10.130" + sources."@types/btoa-lite-1.0.2" + sources."@types/jsonwebtoken-9.0.5" + sources."@types/node-20.10.2" + sources."aggregate-error-3.1.0" + sources."before-after-hook-2.2.3" + sources."bottleneck-2.19.5" + sources."btoa-lite-1.0.0" + sources."buffer-equal-constant-time-1.0.1" + sources."clean-stack-2.2.0" + (sources."debug-4.3.4" // { + dependencies = [ + sources."ms-2.1.2" + ]; + }) + sources."deprecation-2.3.1" + sources."ecdsa-sig-formatter-1.0.11" + sources."encoding-0.1.13" + sources."fromentries-1.3.2" + sources."iconv-lite-0.6.3" + sources."indent-string-4.0.0" + sources."is-plain-object-5.0.0" + sources."jsonwebtoken-9.0.2" + sources."jwa-1.4.1" + sources."jws-3.2.2" + sources."lodash.includes-4.3.0" + sources."lodash.isboolean-3.0.3" + sources."lodash.isinteger-4.0.4" + sources."lodash.isnumber-3.0.3" + sources."lodash.isplainobject-4.0.6" + sources."lodash.isstring-4.0.1" + sources."lodash.once-4.1.1" + sources."lru-cache-9.1.2" + sources."ms-2.1.3" + sources."node-fetch-2.7.0" + sources."octokit-2.1.0" + sources."once-1.4.0" + sources."safe-buffer-5.2.1" + sources."safer-buffer-2.1.2" + (sources."semver-7.5.4" // { + dependencies = [ + sources."lru-cache-6.0.0" + ]; + }) + sources."simple-git-3.21.0" + sources."tr46-0.0.3" + sources."undici-types-5.26.5" + sources."universal-github-app-jwt-1.1.1" + sources."universal-user-agent-6.0.1" + sources."webidl-conversions-3.0.1" + sources."whatwg-url-5.0.0" + sources."wrappy-1.0.2" + sources."yallist-4.0.0" + ]; buildInputs = globalBuildInputs; meta = { description = "Instill harmony between GitHub collaborators."; @@ -17,7 +779,7 @@ let }; production = true; bypassCache = true; - reconstructLock = false; + reconstructLock = true; }; in { From c017ccfed9fc70e4d6fe1a6fbd392ed366d558a2 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Fri, 1 Dec 2023 23:20:06 -0600 Subject: [PATCH 7/9] final tweaks to get that working --- Makefile | 2 +- default.nix | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index ac10481..837e14c 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ build: ./node_modules/ depends/idris-adds-${idris-adds-version} @if [[ ${idris2-minor-version} -gt 6 ]] || [[ "${idris2-build}" != '' ]]; then \ cp ./build/exec/harmony ./harmony; \ else \ - echo "#!/usr/bin/env node\n" > ./harmony; \ + echo "#!/usr/bin/env node" > ./harmony; \ cat ./build/exec/harmony >> ./harmony; \ fi @chmod +x ./harmony diff --git a/default.nix b/default.nix index 212ddc1..d0eb0dc 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,6 @@ -{ stdenv, callPackage, fetchFromGitHub, idris2 }: +{ stdenv, lib, callPackage, fetchFromGitHub, idris2, makeWrapper, nodejs }: let - nodeDependencies = (callPackage ./node2nix.nix {}).nodeDependencies; + nodeDependencies = (callPackage ./node2nix.nix { inherit nodejs; }).nodeDependencies; idrisAddsVersion = "0.3.0"; idrisAddsSrc = fetchFromGitHub { owner = "mattpolzin"; @@ -13,7 +13,8 @@ stdenv.mkDerivation { pname = "harmony"; version = "2.6.1"; - buildInputs = [ idris2 ]; + nativeBuildInputs = [ idris2 makeWrapper ]; + buildInputs = [ nodejs ]; src = ./.; @@ -35,6 +36,10 @@ stdenv.mkDerivation { mkdir -p $out/bin cp harmony $out/bin/ + wrapProgram $out/bin/harmony \ + --prefix PATH : ${lib.makeBinPath [ nodeDependencies ]} \ + --prefix NODE_PATH : ${nodeDependencies}/lib/node_modules + runHook postInstall ''; From edaeb9e77d6f668b2e8604694ac2df4cd30b3795 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Fri, 1 Dec 2023 23:28:11 -0600 Subject: [PATCH 8/9] Add Nix Flake to README --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index fb27965..5291eba 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,18 @@ You can install Harmony via npm directly by running `npm install -g @mattpolzin/ ### GitHub Release You can install any Harmony release by downloading the `harmony-npm.tar.gz` file from the GitHub Release page, unzipping it, and running `npm install --global`. +### Nix Flake +You can add Harmony to your Flake inputs as follows: +```nix + inputs = { + ... + harmony.url = "github:mattpolzin/harmony"; + harmony.inputs.nixpkgs.follows = "nixpkgs"; + }; +``` + +Then in your outputs, being Harmony into a package install list as `harmony.packages..harmony`. + ### From Source The build script assumes a HEAD build of Idris 2 is installed on your system. For an alternative, see the [Docker Build](#docker-build) instructions below. From 4a1612dfd4075caf4847f5dedfdc181def5c82c8 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Fri, 1 Dec 2023 23:36:15 -0600 Subject: [PATCH 9/9] Add README note about running with Nix directly --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5291eba..4137b2c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,10 @@ Harmony is a small tool that helps teams keep GitHub reviews running smoothly. I ## Dependencies ### Runtime -Running Harmony only requires NodeJS 14+ (and a local installation of `git`). +Running Harmony requires NodeJS 14+ (and a local installation of `git`) or alternatively Nix with flakes enabled. + +If you'd like to try Harmony out without even "installing" it and you have Nix installed with flakes enabled, you can run it as `nix run github:mattpolzin/harmony`. + ### Build time Building the latest commits of Harmony requires a HEAD build of the Idris 2 compiler. Each release page also indicates the version of Idris 2 that particular release will build against.