feat: Update flakes with proper wasm compilation
This commit is contained in:
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