Make rust library work

This commit is contained in:
Surma
2024-08-14 15:12:06 +01:00
parent 6d061d8fa2
commit ee61b9fb18
4 changed files with 90 additions and 37 deletions

View File

@@ -19,6 +19,25 @@
"type": "github"
}
},
"fenix_2": {
"inputs": {
"nixpkgs": "nixpkgs_3",
"rust-analyzer-src": "rust-analyzer-src_2"
},
"locked": {
"lastModified": 1723616992,
"narHash": "sha256-jDHYfEECzFwZm4huz7AbPjlH3jJ4/2ns9PddtFA5XMY=",
"owner": "nix-community",
"repo": "fenix",
"rev": "7bad6c7ff73b784a9c7de9147626c8d5d5072809",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
@@ -69,11 +88,28 @@
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1723362943,
"narHash": "sha256-dFZRVSgmJkyM0bkPpaYRtG/kRMRTorUIDj8BxoOt1T4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a58bc8ad779655e790115244571758e8de055e3d",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-helpers": "rust-helpers",
"squoosh-codec-builders": "squoosh-codec-builders",
"wasm-bindgen": "wasm-bindgen"
}
},
@@ -94,6 +130,23 @@
"type": "github"
}
},
"rust-analyzer-src_2": {
"flake": false,
"locked": {
"lastModified": 1723561310,
"narHash": "sha256-a3KMMsIDvdo+ClLabh5wfJoa17YTSvy2wDLb8yZCXvc=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "78c2bdce860dbd996a8083224d01a96660dd6a15",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"rust-helpers": {
"inputs": {
"fenix": "fenix",
@@ -103,12 +156,36 @@
},
"locked": {
"lastModified": 1,
"narHash": "sha256-AP5n4QOJS+7V9O0hnZPavnvctfsgfwybu5XOT1HdRcw=",
"path": "/nix/store/azy8v63kkb5d39z0zmpixx3hhq2l4h6i-source/nix/rust-helpers",
"narHash": "sha256-PvUYYFjHMePbyU/CWQa3uIZB+3YNz+SMtuekxTChdyE=",
"path": "../../nix/rust-helpers",
"type": "path"
},
"original": {
"path": "/nix/store/azy8v63kkb5d39z0zmpixx3hhq2l4h6i-source/nix/rust-helpers",
"path": "../../nix/rust-helpers",
"type": "path"
}
},
"squoosh-codec-builders": {
"inputs": {
"fenix": "fenix_2",
"nixpkgs": [
"nixpkgs"
],
"rust-helpers": [
"rust-helpers"
],
"wasm-bindgen": [
"wasm-bindgen"
]
},
"locked": {
"lastModified": 1,
"narHash": "sha256-OBp4z5JBmhbxEKPmfD0YLAxn3TeMYhO4yhyMRbj0b1E=",
"path": "../../nix/squoosh-codec-builders",
"type": "path"
},
"original": {
"path": "../../nix/squoosh-codec-builders",
"type": "path"
}
},
@@ -135,12 +212,12 @@
},
"locked": {
"lastModified": 1,
"narHash": "sha256-gb2y+PtDL1uqCVebD4ViN5ruWOmHLburm1gp6xWxx9Y=",
"path": "/nix/store/azy8v63kkb5d39z0zmpixx3hhq2l4h6i-source/nix/wasm-bindgen",
"narHash": "sha256-uszruLy8B1/xmT7lKjAuKPdxLr6qGqOI32H767V590g=",
"path": "../../nix/wasm-bindgen",
"type": "path"
},
"original": {
"path": "/nix/store/azy8v63kkb5d39z0zmpixx3hhq2l4h6i-source/nix/wasm-bindgen",
"path": "../../nix/wasm-bindgen",
"type": "path"
}
}

View File

@@ -3,16 +3,15 @@
nixpkgs.url = "github:nixos/nixpkgs/24.05";
flake-utils.url = "github:numtide/flake-utils";
wasm-bindgen = {
url = "../../nix/wasm-bindgen";
url = "path:../../nix/wasm-bindgen";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
rust-helpers = {
url = "../../nix/rust-helpers";
url = "path:../../nix/rust-helpers";
inputs.nixpkgs.follows = "nixpkgs";
};
squoosh-codec-builders = {
url = "../../nix/squoosh-codec-builders";
url = "path:../../nix/squoosh-codec-builders";
inputs.nixpkgs.follows = "nixpkgs";
inputs.rust-helpers.follows = "rust-helpers";
inputs.wasm-bindgen.follows = "wasm-bindgen";
@@ -24,6 +23,7 @@
nixpkgs,
flake-utils,
squoosh-codec-builders,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
@@ -31,10 +31,6 @@
let
src = ./.;
in
# wasm-bindgen-bin = wasm-bindgen.lib.buildFromCargoLock {
# inherit system cargoLock;
# sha256 = "sha256-HTElSB76gqCpDu8S0ZJlfd/S4ftMrbwxFgJM9OXBRz8=";
# };
{
packages = rec {
default = resize-squoosh;
@@ -44,28 +40,8 @@
cargoLock = {
lockFile = "${src}/Cargo.lock";
};
wasmBindgenSha = "sha256-HTElSB76gqCpDu8S0ZJlfd/S4ftMrbwxFgJM9OXBRz8=";
};
# resize-squoosh = stdenv.mkDerivation {
# name = "squoosh-resize";
# inherit src;
# nativeBuildInputs = [
# toolchain
# wasm-bindgen-bin
# ];
# dontConfigure = true;
# buildPhase = ''
# runHook preBuild
# export CARGO_HOME=$TMPDIR/.cargo
# cargo build \
# --config 'source.crates-io.replace-with="vendored-sources"' \
# --config 'source.vendored-sources.directory="${vendoredDependencies}"' \
# --offline \
# --target ${target} -r
# wasm-bindgen --target web --out-dir $out ./target/wasm32-unknown-unknown/release/*.wasm
# runHook postBuild
# '';
# dontInstall = true;
# };
installScript = writeShellScriptBin "install.sh" ''
${pkgs.coreutils}/bin/mkdir -p wasm_build

View File

@@ -3,11 +3,11 @@
nixpkgs.url = "github:nixos/nixpkgs/24.05";
fenix.url = "github:nix-community/fenix";
wasm-bindgen = {
url = "../wasm-bindgen";
url = "path:../wasm-bindgen";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-helpers = {
url = "../rust-helpers";
url = "path:../rust-helpers";
inputs.nixpkgs.follows = "nixpkgs";
};
};