Use buildDioxusWebApp builder
All checks were successful
Push Workflows / rustfmt (push) Successful in 5s
Push Workflows / tailwind-build (push) Successful in 5s
Push Workflows / clippy (push) Successful in 51s
Push Workflows / test (push) Successful in 58s
Push Workflows / docs (push) Successful in 58s
Push Workflows / build (push) Successful in 1m54s
Push Workflows / nix-build (push) Successful in 5m32s
All checks were successful
Push Workflows / rustfmt (push) Successful in 5s
Push Workflows / tailwind-build (push) Successful in 5s
Push Workflows / clippy (push) Successful in 51s
Push Workflows / test (push) Successful in 58s
Push Workflows / docs (push) Successful in 58s
Push Workflows / build (push) Successful in 1m54s
Push Workflows / nix-build (push) Successful in 5m32s
This commit is contained in:
29
flake.nix
29
flake.nix
@@ -12,6 +12,8 @@
|
||||
daisyui.url = "git+https://git.mregirouard.com/nix/daisyui.git";
|
||||
|
||||
tailwindcss-with-pkgs.url = "git+https://git.mregirouard.com/nix/tailwindcss-with-pkgs.git";
|
||||
|
||||
dx-build.url = "git+https://gitea.mregirouard.com/nix/dx-build.git";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }@inputs:
|
||||
@@ -41,6 +43,7 @@
|
||||
wasm-bindgen-overlay
|
||||
inputs.daisyui.overlays.default
|
||||
inputs.tailwindcss-with-pkgs.overlays.default
|
||||
inputs.dx-build.overlays.default
|
||||
];
|
||||
};
|
||||
|
||||
@@ -59,6 +62,8 @@
|
||||
];
|
||||
|
||||
rev = if builtins.hasAttr "rev" self then self.rev else self.dirtyRev;
|
||||
|
||||
pkg-info = (pkgs.lib.trivial.importTOML ./Cargo.toml).package;
|
||||
in
|
||||
rec {
|
||||
devShells.default = pkgs.mkShell {
|
||||
@@ -69,8 +74,9 @@
|
||||
|
||||
packages.default = packages.web;
|
||||
|
||||
packages.web = pkgs.rustPlatform.buildRustPackage {
|
||||
name = "libretunes";
|
||||
packages.web = pkgs.rustPlatform.buildDioxusWebApp {
|
||||
pname = pkg-info.name;
|
||||
version = pkg-info.version;
|
||||
src = ./.;
|
||||
|
||||
GIT_REV = rev;
|
||||
@@ -78,24 +84,13 @@
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
makeWrapper
|
||||
] ++ build-pkgs;
|
||||
(tailwindcss_4.withPackages [daisyui daisyui-theme])
|
||||
wasm-bindgen-cli_0_2_123
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
preBuild = ''
|
||||
# dx build will run tailwindcss anyways, but doing it first here is faster and clearer if it fails
|
||||
tailwindcss --input style/tailwind.css --output assets/tailwind.css
|
||||
|
||||
dx build --release --frozen --web
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out/bin"
|
||||
install -t "$out" target/dx/libretunes/release/web/server
|
||||
|
||||
cp -r target/dx/libretunes/release/web/public "$out/public"
|
||||
|
||||
makeWrapper "$out/server" "$out/bin/libretunes" \
|
||||
--set DIOXUS_PUBLIC_PATH "$out/public"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user