From 30ad43e875247c95349a301530afa860ae1a2073 Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Mon, 18 Nov 2024 13:20:45 -0800 Subject: [PATCH] examples: drop nixpkgs-for-wasm-bindgen The examples were already hard coding a concrete version of wasm-bindgen-cli so having the extra input was both useless and confusing --- examples/trunk-workspace/flake.nix | 18 ++++++++---------- examples/trunk/flake.nix | 18 ++++++++---------- test/flake.lock | 17 ----------------- test/flake.nix | 4 ---- 4 files changed, 16 insertions(+), 41 deletions(-) diff --git a/examples/trunk-workspace/flake.nix b/examples/trunk-workspace/flake.nix index cea6939..a566071 100644 --- a/examples/trunk-workspace/flake.nix +++ b/examples/trunk-workspace/flake.nix @@ -4,10 +4,6 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - # The version of wasm-bindgen-cli needs to match the version in Cargo.lock - # Update this to include the version you need - nixpkgs-for-wasm-bindgen.url = "github:NixOS/nixpkgs/4e6868b1aa3766ab1de169922bb3826143941973"; - crane.url = "github:ipetkov/crane"; flake-utils.url = "github:numtide/flake-utils"; @@ -18,7 +14,7 @@ }; }; - outputs = { self, nixpkgs, crane, flake-utils, rust-overlay, nixpkgs-for-wasm-bindgen, ... }: + outputs = { self, nixpkgs, crane, flake-utils, rust-overlay, ... }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { @@ -33,11 +29,7 @@ # wasm32-unknown-unknown is required for trunk. targets = [ "wasm32-unknown-unknown" ]; }; - craneLib = ((crane.mkLib pkgs).overrideToolchain rustToolchainFor).overrideScope (_final: _prev: { - # The version of wasm-bindgen-cli needs to match the version in Cargo.lock. You - # can unpin this if your nixpkgs commit contains the appropriate wasm-bindgen-cli version - inherit (import nixpkgs-for-wasm-bindgen { inherit system; }) wasm-bindgen-cli; - }); + craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchainFor; # When filtering sources, we want to allow assets other than .rs files unfilteredRoot = ./.; # The original, unfiltered source @@ -113,6 +105,12 @@ version = "0.2.93"; hash = "sha256-DDdu5mM3gneraM85pAepBXWn3TMofarVR4NbjMdz3r0="; cargoHash = "sha256-birrg+XABBHHKJxfTKAMSlmTVYLmnmqMDfRnmG6g/YQ="; + # When updating to a new version comment out the above two lines and + # uncomment the bottom two lines. Then try to do a build, which will fail + # but will print out the correct value for `hash`. Replace the value and then + # repeat the process but this time the printed value will be for `cargoHash` + # hash = lib.fakeHash; + # cargoHash = lib.fakeHash; }; }); in diff --git a/examples/trunk/flake.nix b/examples/trunk/flake.nix index 2b2de6e..a31a565 100644 --- a/examples/trunk/flake.nix +++ b/examples/trunk/flake.nix @@ -4,10 +4,6 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - # The version of wasm-bindgen-cli needs to match the version in Cargo.lock - # Update this to include the version you need - nixpkgs-for-wasm-bindgen.url = "github:NixOS/nixpkgs/4e6868b1aa3766ab1de169922bb3826143941973"; - crane.url = "github:ipetkov/crane"; flake-utils.url = "github:numtide/flake-utils"; @@ -18,7 +14,7 @@ }; }; - outputs = { self, nixpkgs, crane, flake-utils, rust-overlay, nixpkgs-for-wasm-bindgen, ... }: + outputs = { self, nixpkgs, crane, flake-utils, rust-overlay, ... }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { @@ -33,11 +29,7 @@ # wasm32-unknown-unknown is required for trunk targets = [ "wasm32-unknown-unknown" ]; }; - craneLib = ((crane.mkLib pkgs).overrideToolchain rustToolchainFor).overrideScope (_final: _prev: { - # The version of wasm-bindgen-cli needs to match the version in Cargo.lock. You - # can unpin this if your nixpkgs commit contains the appropriate wasm-bindgen-cli version - inherit (import nixpkgs-for-wasm-bindgen { inherit system; }) wasm-bindgen-cli; - }); + craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchainFor; # When filtering sources, we want to allow assets other than .rs files unfilteredRoot = ./.; # The original, unfiltered source @@ -87,6 +79,12 @@ version = "0.2.93"; hash = "sha256-DDdu5mM3gneraM85pAepBXWn3TMofarVR4NbjMdz3r0="; cargoHash = "sha256-birrg+XABBHHKJxfTKAMSlmTVYLmnmqMDfRnmG6g/YQ="; + # When updating to a new version comment out the above two lines and + # uncomment the bottom two lines. Then try to do a build, which will fail + # but will print out the correct value for `hash`. Replace the value and then + # repeat the process but this time the printed value will be for `cargoHash` + # hash = lib.fakeHash; + # cargoHash = lib.fakeHash; }; }); diff --git a/test/flake.lock b/test/flake.lock index 5e23166..eada5f1 100644 --- a/test/flake.lock +++ b/test/flake.lock @@ -102,22 +102,6 @@ "type": "github" } }, - "nixpkgs-for-wasm-bindgen": { - "locked": { - "lastModified": 1691495139, - "narHash": "sha256-+zZIRTtXlA8gN8HPzczphPnB9L+yYpidBmFxKqWQy+A=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "4e6868b1aa3766ab1de169922bb3826143941973", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "4e6868b1aa3766ab1de169922bb3826143941973", - "type": "github" - } - }, "nixpkgs-latest-release": { "locked": { "lastModified": 1730651795, @@ -142,7 +126,6 @@ "flake-compat": "flake-compat", "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", - "nixpkgs-for-wasm-bindgen": "nixpkgs-for-wasm-bindgen", "nixpkgs-latest-release": "nixpkgs-latest-release", "rust-overlay": "rust-overlay" } diff --git a/test/flake.nix b/test/flake.nix index 79e5397..131564c 100644 --- a/test/flake.nix +++ b/test/flake.nix @@ -4,10 +4,6 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nixpkgs-latest-release.url = "github:NixOS/nixpkgs/release-24.05"; - # The version of wasm-bindgen-cli needs to match the version in Cargo.lock - # Update this to include the version you need - nixpkgs-for-wasm-bindgen.url = "github:NixOS/nixpkgs/4e6868b1aa3766ab1de169922bb3826143941973"; - advisory-db = { url = "github:rustsec/advisory-db"; flake = false;