Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a nix devShell for webapp development #3442

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 56 additions & 24 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 43 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
systems.url = "github:nix-systems/default";
naersk.url = "github:nix-community/naersk";

rust-overlay.url = "github:oxalica/rust-overlay";
# crane.url = "github:ipetkov/crane";
Expand Down Expand Up @@ -43,7 +44,7 @@
# This is useful when building crates as packages
# Note that it does require a `Cargo.lock` which this repo does not have
# craneLib = (inputs.crane.mkLib pkgs).overrideToolchain rustToolchain;
in
in rec
{
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
Expand All @@ -52,6 +53,18 @@
];
};

packages.dx = let
naersk' = pkgs.callPackage inputs.naersk {};
in naersk'.buildPackage {
name = "dioxus-cli";
src = ./.;
cargoBuildOptions = prev: prev ++ [ "-p" "dioxus-cli" ];

meta = {
mainProgram = "dx";
};
};

devShells.default = pkgs.mkShell {
name = "dioxus-dev";
buildInputs = rustBuildInputs;
Expand All @@ -64,6 +77,35 @@
export RUST_SRC_PATH="${rustToolchain}/lib/rustlib/src/rust/library";
'';
};

devShells.web = pkgs.mkShell {
name = "dioxus-web-devShell";
buildInputs = with pkgs; [
openssl
pkg-config
cacert

(rust-bin.stable.latest.default.override {
extensions = [ "rust-src" "rust-analyzer" "rust-std" ];
targets = [ "wasm32-unknown-unknown" ];
})
(pkgs.writeShellApplication {
name = "rustup";
text = ''
#!/bin/sh
echo "installed targets for active toolchain"
echo "--------------------------------------"
echo "wasm32-unknown-unknown"
echo "x86_64-unknown-linux-gnu"
'';
}) # mock rustup to pass dx toolchain verification
packages.dx
];
shellHook = ''

'';
};

};
};
}
Loading