mirror of
https://codeberg.org/demostf/inspector.git
synced 2026-06-03 10:04:09 +02:00
flake reorg
This commit is contained in:
parent
e2f74f1fa5
commit
b522666665
5 changed files with 93 additions and 67 deletions
47
flake.nix
47
flake.nix
|
|
@ -24,21 +24,9 @@
|
|||
overlays = [
|
||||
(import rust-overlay)
|
||||
(final: prev: {
|
||||
npmlock2nix = import npmlock2nix { pkgs = final; };
|
||||
rust-wasm = (final.rust-bin.stable.latest.default.override {
|
||||
targets = [ "wasm32-unknown-unknown" ];
|
||||
});
|
||||
demo-inspector-wasm = import ./wasm.nix final;
|
||||
nodejs = final.nodejs_20;
|
||||
|
||||
node_modules = final.npmlock2nix.v2.node_modules {
|
||||
src = ./www;
|
||||
nodejs = final.nodejs;
|
||||
localPackages = {
|
||||
"demo-inspector" = final.demo-inspector-wasm;
|
||||
};
|
||||
};
|
||||
npmlock2nix = import npmlock2nix {pkgs = final;};
|
||||
})
|
||||
(import ./overlay.nix)
|
||||
];
|
||||
pkgs = import nixpkgs {
|
||||
inherit system overlays;
|
||||
|
|
@ -46,7 +34,6 @@
|
|||
in rec {
|
||||
devShells.default = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
rust-wasm
|
||||
cargo-edit
|
||||
bacon
|
||||
wasm-pack
|
||||
|
|
@ -56,26 +43,14 @@
|
|||
];
|
||||
};
|
||||
|
||||
packages.demo-inspector-wasm = pkgs.demo-inspector-wasm;
|
||||
|
||||
packages.node_modules = pkgs.node_modules;
|
||||
|
||||
packages.demo-inspector = pkgs.stdenv.mkDerivation rec {
|
||||
name = "demo-inspector";
|
||||
version = "0.1.0";
|
||||
|
||||
src = ./www;
|
||||
|
||||
nativeBuildInputs = with pkgs; [nodejs_20];
|
||||
buildPhase = with pkgs; ''
|
||||
cp -r ${node_modules}/node_modules ./node_modules
|
||||
npm run build
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
cp -r dist $out
|
||||
'';
|
||||
packages = rec {
|
||||
wasm = pkgs.demo-inspector-wasm;
|
||||
node_modules = pkgs.demo-inspector-node-modules;
|
||||
demo-inspector = pkgs.demo-inspector;
|
||||
default = demo-inspector;
|
||||
};
|
||||
})
|
||||
// {
|
||||
overlays.default = import ./overlay.nix;
|
||||
};
|
||||
defaultPackage = packages.demo-inspector;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
12
modules.nix
Normal file
12
modules.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
npmlock2nix,
|
||||
nodejs_20,
|
||||
demo-inspector-wasm,
|
||||
}:
|
||||
npmlock2nix.v2.node_modules {
|
||||
src = ./www;
|
||||
nodejs = nodejs_20;
|
||||
localPackages = {
|
||||
"demo-inspector" = demo-inspector-wasm;
|
||||
};
|
||||
}
|
||||
5
overlay.nix
Normal file
5
overlay.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
prev: final: {
|
||||
demo-inspector-wasm = final.callPackage ./wasm.nix {};
|
||||
demo-inspector-node-modules = final.callPackage ./modules.nix {};
|
||||
demo-inspector = final.callPackage ./package.nix {};
|
||||
}
|
||||
21
package.nix
Normal file
21
package.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
stdenv,
|
||||
nodejs_20,
|
||||
demo-inspector-node-modules,
|
||||
}:
|
||||
stdenv.mkDerivation rec {
|
||||
name = "demo-inspector";
|
||||
version = "0.1.0";
|
||||
|
||||
src = ./www;
|
||||
|
||||
nativeBuildInputs = [nodejs_20];
|
||||
buildPhase = ''
|
||||
cp -r ${demo-inspector-node-modules}/node_modules ./node_modules
|
||||
npm run build
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
cp -r dist $out
|
||||
'';
|
||||
}
|
||||
31
wasm.nix
31
wasm.nix
|
|
@ -1,23 +1,36 @@
|
|||
pkgs: let
|
||||
{
|
||||
rustPlatform,
|
||||
nodejs_20,
|
||||
pkg-config,
|
||||
openssl,
|
||||
fetchCrate,
|
||||
rust-bin,
|
||||
wasm-pack,
|
||||
binaryen,
|
||||
}: let
|
||||
deps = (builtins.fromTOML (builtins.readFile ./wasm/Cargo.toml)).dependencies;
|
||||
wasm-bindgen-cli = pkgs.rustPlatform.buildRustPackage rec {
|
||||
wasm-bindgen-cli = rustPlatform.buildRustPackage rec {
|
||||
pname = "wasm-bindgen-cli";
|
||||
version = deps.wasm-bindgen.version;
|
||||
src = pkgs.fetchCrate {
|
||||
src = fetchCrate {
|
||||
inherit pname version;
|
||||
sha256 = "sha256-IPxP68xtNSpwJjV2yNMeepAS0anzGl02hYlSTvPocz8=";
|
||||
};
|
||||
|
||||
cargoSha256 = "sha256-pBeQaG6i65uJrJptZQLuIaCb/WCQMhba1Z1OhYqA8Zc=";
|
||||
nativeBuildInputs = [ pkgs.pkg-config ];
|
||||
nativeBuildInputs = [pkg-config];
|
||||
|
||||
buildInputs = with pkgs; [ openssl ];
|
||||
buildInputs = [openssl];
|
||||
|
||||
checkInputs = [ pkgs.nodejs_20 ];
|
||||
checkInputs = [nodejs_20];
|
||||
|
||||
dontCargoCheck = true;
|
||||
};
|
||||
in pkgs.rustPlatform.buildRustPackage rec {
|
||||
rust-wasm = rust-bin.stable.latest.default.override {
|
||||
targets = ["wasm32-unknown-unknown"];
|
||||
};
|
||||
in
|
||||
rustPlatform.buildRustPackage rec {
|
||||
name = "demo-inspector-wasm";
|
||||
version = "0.1.0";
|
||||
|
||||
|
|
@ -28,7 +41,7 @@ in pkgs.rustPlatform.buildRustPackage rec {
|
|||
src = ./wasm;
|
||||
|
||||
WASM_PACK_CACHE = "/build/cache";
|
||||
nativeBuildInputs = [pkgs.rust-wasm pkgs.wasm-pack wasm-bindgen-cli pkgs.binaryen];
|
||||
nativeBuildInputs = [rust-wasm wasm-pack wasm-bindgen-cli binaryen];
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
(
|
||||
|
|
@ -43,4 +56,4 @@ in pkgs.rustPlatform.buildRustPackage rec {
|
|||
installPhase = ''
|
||||
cp -r pkg $out
|
||||
'';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue