From 58001efeb2470f77bd31501bb12c9c7b1951e8dd Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Fri, 30 Aug 2024 10:32:03 -0400 Subject: [PATCH] update: simpler update mechanism also fix a bad dependency --- Makefile | 13 +++---- nix/base-system/flake.lock | 18 ---------- nix/base-system/flake.nix | 7 +--- nix/packages/quint/default.nix | 4 +-- nix/packages/quint/node-env.nix | 4 +-- nix/packages/quint/node-packages.json | 3 ++ nix/packages/quint/node-packages.nix | 50 ++++++++++----------------- 7 files changed, 33 insertions(+), 66 deletions(-) create mode 100644 nix/packages/quint/node-packages.json diff --git a/Makefile b/Makefile index 99b7a01..4455827 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,11 @@ %-darwin: darwin-rebuild --flake ./nix/base-system $* -update-quint-%: - curl curl https://raw.githubusercontent.com/informalsystems/quint/$*/quint/package.json > nix/packages/quint/package.json - cd nix/packages/quint; nix run "nixpkgs#node2nix" -- -18 +update-quint: + #curl -L https://raw.githubusercontent.com/informalsystems/quint/$*/quint/package.json > nix/packages/quint/package.json + #curl -L https://raw.githubusercontent.com/informalsystems/quint/$*/quint/package-lock.json > nix/packages/quint/package-lock.json + cd nix/packages/quint; nix run "nixpkgs#node2nix" -- -18 -i node-packages.json #pactch the default.nix - sed -e 's#inherit nodeEnv;#inherit nodeEnv quint-src;#' -e 's/, system/, quint-src, system/' -i '' nix/packages/quint/default.nix - sed -e 's#src = \./\.#src = "$${quint-src}/quint"#' -e 's#nodeEnv, #quint-src, nodeEnv, #' -i '' nix/packages/quint/node-packages.nix - rm -f nix/packages/quint/package.json + #sed -e 's#inherit nodeEnv;#inherit nodeEnv quint-src;#' -e 's/, system/, quint-src, system/' -i '' nix/packages/quint/default.nix + #sed -e 's#src = \./\.#src = "$${quint-src}/quint"#' -e 's#nodeEnv, #quint-src, nodeEnv, #' -i '' nix/packages/quint/node-packages.nix + #rm -f nix/packages/quint/package*.json diff --git a/nix/base-system/flake.lock b/nix/base-system/flake.lock index 32c908f..3f5a755 100644 --- a/nix/base-system/flake.lock +++ b/nix/base-system/flake.lock @@ -803,23 +803,6 @@ "type": "github" } }, - "quint-src": { - "flake": false, - "locked": { - "lastModified": 1722257041, - "narHash": "sha256-VjAvaFO/OdqIYPqTNbbBZl7ah1GPGMVQJltZYkJx5IY=", - "owner": "informalsystems", - "repo": "quint", - "rev": "ba49e6820a0302ba788bce738587b1deb3a899d9", - "type": "github" - }, - "original": { - "owner": "informalsystems", - "ref": "v0.21.1", - "repo": "quint", - "type": "github" - } - }, "root": { "inputs": { "agenix-flake": "agenix-flake", @@ -835,7 +818,6 @@ "nixpkgs": "nixpkgs_8", "nixpkgs-darwin": "nixpkgs-darwin", "nurl-flake": "nurl-flake", - "quint-src": "quint-src", "roslyn-lsp": "roslyn-lsp", "runwhen-flake": "runwhen-flake", "rust-overlay-flake": "rust-overlay-flake", diff --git a/nix/base-system/flake.nix b/nix/base-system/flake.nix index e75608a..d3f9711 100644 --- a/nix/base-system/flake.nix +++ b/nix/base-system/flake.nix @@ -58,10 +58,6 @@ flake = false; }; heracles-flake.url = "github:zaphar/Heracles"; - quint-src = { - url = "github:informalsystems/quint/v0.21.1"; - flake = false; - }; }; outputs = { @@ -83,7 +79,6 @@ heracles-flake, neovim-flake, clio-flake, - quint-src, ... # We don't use the self or nixpkgs args here so we just glob it. }: rec { @@ -263,7 +258,7 @@ EOF"; gnumeric = prev.gnumeric.overrideAttrs(oldAttrs: { meta.broken = false; }); - quint = (pkgs.callPackage ../packages/quint/default.nix { inherit quint-src; }).package; + quint = (pkgs.callPackage ../packages/quint/default.nix {})."@informalsystems/quint"; }) rust-overlay ]; diff --git a/nix/packages/quint/default.nix b/nix/packages/quint/default.nix index 14f2bff..2e54104 100644 --- a/nix/packages/quint/default.nix +++ b/nix/packages/quint/default.nix @@ -2,7 +2,7 @@ {pkgs ? import { inherit system; - }, quint-src, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_18"}: + }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_18"}: let nodeEnv = import ./node-env.nix { @@ -13,5 +13,5 @@ let in import ./node-packages.nix { inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; - inherit nodeEnv quint-src; + inherit nodeEnv; } diff --git a/nix/packages/quint/node-env.nix b/nix/packages/quint/node-env.nix index 3dbcb13..bc1e366 100644 --- a/nix/packages/quint/node-env.nix +++ b/nix/packages/quint/node-env.nix @@ -109,7 +109,7 @@ let ); # Recursively composes the dependencies of a package - composePackage = { name, packageName, src, dependencies ? [], ... }: + composePackage = { name, packageName, src, dependencies ? [], ... }@args: builtins.addErrorContext "while evaluating node package '${packageName}'" '' installPackage "${packageName}" "${src}" ${includeDependencies { inherit dependencies; }} @@ -194,7 +194,7 @@ let # dependencies in the package.json file to the versions that are actually # being used. - pinpointDependenciesOfPackage = { packageName, dependencies ? [], production ? true, ... }: + pinpointDependenciesOfPackage = { packageName, dependencies ? [], production ? true, ... }@args: '' if [ -d "${packageName}" ] then diff --git a/nix/packages/quint/node-packages.json b/nix/packages/quint/node-packages.json new file mode 100644 index 0000000..bc593e9 --- /dev/null +++ b/nix/packages/quint/node-packages.json @@ -0,0 +1,3 @@ +[ + "@informalsystems/quint" +] diff --git a/nix/packages/quint/node-packages.nix b/nix/packages/quint/node-packages.nix index 05e9640..aeb2dbd 100644 --- a/nix/packages/quint/node-packages.nix +++ b/nix/packages/quint/node-packages.nix @@ -1,6 +1,6 @@ # This file has been generated by node2nix 1.11.1. Do not edit! -{quint-src, nodeEnv, fetchurl, fetchgit, nix-gitignore, stdenv, lib, globalBuildInputs ? []}: +{nodeEnv, fetchurl, fetchgit, nix-gitignore, stdenv, lib, globalBuildInputs ? []}: let sources = { @@ -256,13 +256,13 @@ let sha512 = "zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="; }; }; - "antlr4ts-0.5.0-dev" = { + "antlr4ts-0.5.0-alpha.4" = { name = "antlr4ts"; packageName = "antlr4ts"; - version = "0.5.0-dev"; + version = "antlr4ts-0.5.0-alpha.4"; src = fetchurl { - url = "https://registry.npmjs.org/antlr4ts/-/antlr4ts-0.5.0-dev.tgz"; - sha512 = "FXZRGC53ZejWLOMzxJ6IpgmGYNzBYeaoN5FBQe2Y6+iEA+JFNZz+J67TF84ajksmzVX8BUi+Ytx7oih+BWtA8A=="; + url = "https://registry.npmjs.org/antlr4ts/-/antlr4ts-0.5.0-alpha.4.tgz"; + sha512 = "sha512-WPQDt1B74OfPv/IMS2ekXAKkTZIHl88uMetg6q3OTqgFxZ/dxDXI0EWLyZid/1Pe6hTftyg5N7gel5wNAGxXyQ=="; }; }; "bignumber.js-9.1.2" = { @@ -355,13 +355,13 @@ let sha512 = "Ds/TEoZjwggRoz/Q2O7SE3i4Jm66mqTDfmdHdq/7DKVk3bro9Q8h6WdXKdPqFLMoqxrDK5SVRzHVPOS6uuGtrg=="; }; }; - "escalade-3.1.2" = { + "escalade-3.2.0" = { name = "escalade"; packageName = "escalade"; - version = "3.1.2"; + version = "3.2.0"; src = fetchurl { - url = "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz"; - sha512 = "ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA=="; + url = "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz"; + sha512 = "WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="; }; }; "fs-minipass-2.1.0" = { @@ -689,11 +689,16 @@ let }; }; }; - args = { +in +{ + "@informalsystems/quint" = nodeEnv.buildNodePackage { name = "_at_informalsystems_slash_quint"; packageName = "@informalsystems/quint"; version = "0.21.1"; - src = "${quint-src}/quint"; + src = fetchurl { + url = "https://registry.npmjs.org/@informalsystems/quint/-/quint-0.21.1.tgz"; + sha512 = "kqXHC4a+6N1L0UDFzHknryLmOGwEuLk5pQyiirAKyCvkSHGn6QmnZTdn0jJI2bUppA0BS1lANTLrC2UQOGdKQg=="; + }; dependencies = [ sources."@grpc/grpc-js-1.11.1" sources."@grpc/proto-loader-0.7.13" @@ -723,7 +728,7 @@ let sources."@types/seedrandom-3.0.8" sources."ansi-regex-5.0.1" sources."ansi-styles-4.3.0" - sources."antlr4ts-0.5.0-dev" + sources."antlr4ts-0.5.0-alpha.4" sources."bignumber.js-9.1.2" sources."buffer-from-1.1.2" sources."chalk-4.1.2" @@ -734,7 +739,7 @@ let sources."deprecation-2.3.1" sources."emoji-regex-8.0.0" sources."eol-0.9.1" - sources."escalade-3.1.2" + sources."escalade-3.2.0" (sources."fs-minipass-2.1.0" // { dependencies = [ sources."minipass-3.3.6" @@ -789,23 +794,4 @@ let bypassCache = true; reconstructLock = true; }; -in -{ - args = args; - sources = sources; - tarball = nodeEnv.buildNodeSourceDist args; - package = nodeEnv.buildNodePackage args; - shell = nodeEnv.buildNodeShell args; - nodeDependencies = nodeEnv.buildNodeDependencies (lib.overrideExisting args { - src = stdenv.mkDerivation { - name = args.name + "-package-json"; - src = nix-gitignore.gitignoreSourcePure [ - "*" - "!package.json" - "!package-lock.json" - ] args.src; - dontBuild = true; - installPhase = "mkdir -p $out; cp -r ./* $out;"; - }; - }); }