build(flake): split into flake modules
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
|
||||
outputs = inputs @ {
|
||||
flake-parts,
|
||||
crate2nix,
|
||||
rust-overlay,
|
||||
...
|
||||
}:
|
||||
@@ -28,33 +27,22 @@
|
||||
"x86_64-linux"
|
||||
];
|
||||
|
||||
imports = [
|
||||
./nix/wasm-bindgen.nix
|
||||
./nix/wordle-solver.nix
|
||||
./nix/wordle-solver-wasm.nix
|
||||
./nix/wordle-solver-wasm-pkg.nix
|
||||
./nix/wordle-solver-web.nix
|
||||
];
|
||||
|
||||
perSystem = {
|
||||
pkgs,
|
||||
system,
|
||||
self',
|
||||
...
|
||||
}: let
|
||||
# Use rust-bin to generate the toolchain from rust-toolchain.toml
|
||||
rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
|
||||
cross-pkgs = pkgs.pkgsCross.wasm32-unknown-none;
|
||||
|
||||
toolchain = pkgs.callPackage ./nix/with-toolchain.nix {
|
||||
cargo = rust-toolchain;
|
||||
rustc = rust-toolchain;
|
||||
};
|
||||
crossToolchain = cross-pkgs.callPackage ./nix/with-toolchain.nix {
|
||||
cargo = rust-toolchain;
|
||||
rustc = rust-toolchain;
|
||||
};
|
||||
|
||||
wasm-bindgen = toolchain.pkgs.callPackage ./nix/wasm-bindgen.nix {};
|
||||
|
||||
root-crate = pkgs.callPackage ./nix/root-crate.nix {
|
||||
cargo = rust-toolchain;
|
||||
rustc = rust-toolchain;
|
||||
inherit crate2nix;
|
||||
};
|
||||
utils = import ./nix/utils.nix;
|
||||
rust-toolchain = utils.rust-toolchain pkgs;
|
||||
in {
|
||||
# Overlay pkgs with rust-bin
|
||||
_module.args.pkgs = import inputs.nixpkgs {
|
||||
@@ -63,22 +51,13 @@
|
||||
config.allowUnsupportedSystem = true;
|
||||
};
|
||||
|
||||
packages = {
|
||||
wordle-solver-web = pkgs.callPackage ./nix/wordle-solver-web.nix {inherit (self'.packages) wordle-solver-wasm-pkg;};
|
||||
wordle-solver-wasm = crossToolchain.pkgs.callPackage ./nix/wordle-solver-wasm.nix {};
|
||||
wordle-solver-wasm-pkg = pkgs.callPackage ./nix/wordle-solver-wasm-pkg.nix {
|
||||
inherit wasm-bindgen root-crate;
|
||||
inherit (self'.packages) wordle-solver-wasm;
|
||||
};
|
||||
wordle-solver = root-crate.build;
|
||||
default = self'.packages.wordle-solver;
|
||||
};
|
||||
packages.default = self'.packages.wordle-solver;
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
RA_LOG = "rust_analyzer=info";
|
||||
buildInputs = [
|
||||
rust-toolchain
|
||||
wasm-bindgen
|
||||
self'.packages.wasm-bindgen
|
||||
pkgs.nodejs
|
||||
pkgs.svelte-language-server
|
||||
pkgs.typescript-language-server
|
||||
|
||||
Reference in New Issue
Block a user