Use crane to build dyesub-tool trunk project

main
Elnu 1 year ago
parent ab01e329d1
commit 42d12b6888

@ -1,9 +1,66 @@
{
"nodes": {
"crane": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1692750383,
"narHash": "sha256-n5P5HOXuu23UB1h9PuayldnRRVQuXJLpoO+xqtMO3ws=",
"owner": "ipetkov",
"repo": "crane",
"rev": "ef5d11e3c2e5b3924eb0309dba2e1fea2d9062ae",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
@ -52,13 +109,39 @@
},
"root": {
"inputs": {
"crane": "crane",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
"rust-overlay": "rust-overlay_2"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils",
"flake-utils": [
"crane",
"flake-utils"
],
"nixpkgs": [
"crane",
"nixpkgs"
]
},
"locked": {
"lastModified": 1691374719,
"narHash": "sha256-HCodqnx1Mi2vN4f3hjRPc7+lSQy18vRn8xWW68GeQOg=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "b520a3889b24aaf909e287d19d406862ced9ffc9",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"rust-overlay_2": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
@ -89,6 +172,21 @@
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

@ -17,9 +17,13 @@ Updating `cargoHash`:
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, rust-overlay }:
outputs = { self, nixpkgs, rust-overlay, crane }:
let
overlays = [ (import rust-overlay) ];
system = "x86_64-linux";
@ -70,16 +74,29 @@ Updating `cargoHash`:
description = "A tool for generating dye sublimation transfer sheet SVGs for Japanese thumb shift keycaps.";
};
});
dyesub-tool = rustPlatformWasm.buildRustPackage (rustSettings // {
pname = "dyesub-tool";
version = "0.1.0";
buildAndTestSubdir = "dyesub-tool";
buildInputs = with pkgs; [ trunk ];
cargoHash = "sha256-KSBTEBHuWaenIVaKUMDRFToYxcTA/TFwsIG10WNP47g=";
dyesub-tool = let
rustToolchain = pkgs.rust-bin.nightly.latest.minimal.override {
targets = [ "wasm32-unknown-unknown" ];
};
craneLib = ((crane.mkLib pkgs).overrideToolchain rustToolchain).overrideScope' (final: prev: {
wasm-bindgen-cli = pkgs.wasm-bindgen-cli;
});
crateNameFromCargoToml = packageName: craneLib.crateNameFromCargoToml { cargoToml = ./${packageName}/Cargo.toml; };
in craneLib.buildTrunkPackage {
inherit (crateNameFromCargoToml "dyesub-tool") pname version;
src = with pkgs.lib; cleanSourceWith {
src = ./.;
filter = path: type:
(hasSuffix "\.html" path) ||
(hasSuffix "\.css" path) ||
(craneLib.filterCargoSources path type)
;
};
trunkIndexPath = "dyesub-tool/index.html";
meta = meta // {
description = "A tool for generating dye sublimation transfer sheet SVGs for Japanese thumb shift keycaps.";
};
});
};
};
};
}

Loading…
Cancel
Save