feat: Update flakes with proper wasm compilation
This commit is contained in:
11
flake.lock
generated
11
flake.lock
generated
@@ -34,10 +34,10 @@
|
||||
"crates-io-index": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1763363725,
|
||||
"narHash": "sha256-cxr5xIKZFP45yV1ZHFTB1sHo5YGiR3FA8D9vAfDizMo=",
|
||||
"lastModified": 1772013874,
|
||||
"narHash": "sha256-WwDhEeVOnAfH1PKpqHNdGFylmbtmTk5hk7cS+0C6Scg=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "0382002e816a4cbd17d8d5b172f08b848aa22ff6",
|
||||
"rev": "94b5f7911c9131b53988424c964f721a3f22714d",
|
||||
"shallow": true,
|
||||
"type": "git",
|
||||
"url": "https://github.com/rust-lang/crates.io-index"
|
||||
@@ -50,7 +50,9 @@
|
||||
},
|
||||
"crates-nix": {
|
||||
"inputs": {
|
||||
"crates-io-index": "crates-io-index"
|
||||
"crates-io-index": [
|
||||
"crates-io-index"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1763364255,
|
||||
@@ -124,6 +126,7 @@
|
||||
"inputs": {
|
||||
"advisory-db": "advisory-db",
|
||||
"crane": "crane",
|
||||
"crates-io-index": "crates-io-index",
|
||||
"crates-nix": "crates-nix",
|
||||
"flake-utils": "flake-utils",
|
||||
"nix-github-actions": "nix-github-actions",
|
||||
|
||||
36
flake.nix
36
flake.nix
@@ -9,7 +9,6 @@
|
||||
url = "github:nix-community/nix-github-actions";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
crates-nix.url = "github:uttarayan21/crates.nix";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
@@ -18,6 +17,14 @@
|
||||
url = "github:rustsec/advisory-db";
|
||||
flake = false;
|
||||
};
|
||||
crates-io-index = {
|
||||
url = "git+https://github.com/rust-lang/crates.io-index?shallow=1";
|
||||
flake = false;
|
||||
};
|
||||
crates-nix = {
|
||||
url = "github:uttarayan21/crates.nix";
|
||||
inputs.crates-io-index.follows = "crates-io-index";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
@@ -55,9 +62,14 @@
|
||||
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
|
||||
craneLibLLvmTools = (crane.mkLib pkgs).overrideToolchain toolchainWithLLvmTools;
|
||||
|
||||
crates = crates-nix.mkLib {inherit pkgs;};
|
||||
lockedCrateVersion = crateName: lockFile: ((builtins.elemAt (builtins.filter (item: item.name == crateName) (builtins.fromTOML (builtins.readFile lockFile)).package)) 0).version;
|
||||
|
||||
src = let
|
||||
filterBySuffix = path: exts: lib.any (ext: lib.hasSuffix ext path) exts;
|
||||
sourceFilters = path: type: (craneLib.filterCargoSources path type) || filterBySuffix path [".c" ".h" ".hpp" ".cpp" ".cc"];
|
||||
sourceFilters = path: type:
|
||||
(craneLib.filterCargoSources path type)
|
||||
|| filterBySuffix path [".html"];
|
||||
in
|
||||
lib.cleanSourceWith {
|
||||
filter = sourceFilters;
|
||||
@@ -87,8 +99,11 @@
|
||||
libiconv
|
||||
apple-sdk_26
|
||||
]);
|
||||
wasm-bindgen-cli = crates.buildCrate "wasm-bindgen-cli" {
|
||||
version = lockedCrateVersion "wasm-bindgen" ./Cargo.lock;
|
||||
};
|
||||
};
|
||||
cargoArtifacts = craneLib.buildPackage commonArgs;
|
||||
cargoArtifacts = craneLib.buildTrunkPackage commonArgs;
|
||||
in {
|
||||
checks =
|
||||
{
|
||||
@@ -123,19 +138,10 @@
|
||||
};
|
||||
|
||||
packages = let
|
||||
pkg = craneLib.buildPackage (commonArgs
|
||||
pkg = craneLib.buildTrunkPackage (
|
||||
commonArgs
|
||||
// {inherit cargoArtifacts;}
|
||||
// {
|
||||
postInstall = ''
|
||||
mkdir -p $out/bin
|
||||
mkdir -p $out/share/bash-completions
|
||||
mkdir -p $out/share/fish/vendor_completions.d
|
||||
mkdir -p $out/share/zsh/site-functions
|
||||
$out/bin/${name} completions bash > $out/share/bash-completions/${name}.bash
|
||||
$out/bin/${name} completions fish > $out/share/fish/vendor_completions.d/${name}.fish
|
||||
$out/bin/${name} completions zsh > $out/share/zsh/site-functions/_${name}
|
||||
'';
|
||||
});
|
||||
);
|
||||
in {
|
||||
"${name}" = pkg;
|
||||
default = pkg;
|
||||
|
||||
Reference in New Issue
Block a user