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

This commit is contained in:
2026-08-04 20:58:25 -04:00
parent c41a2474e6
commit ea2bc49600
2 changed files with 28 additions and 17 deletions

16
flake.lock generated
View File

@@ -15,6 +15,21 @@
"url": "https://git.mregirouard.com/nix/daisyui.git" "url": "https://git.mregirouard.com/nix/daisyui.git"
} }
}, },
"dx-build": {
"locked": {
"lastModified": 1785888038,
"narHash": "sha256-zhUWl+BXYBBIHuLsjlLh+8RL6ymrUCLCnBL7I6/BAGw=",
"ref": "refs/heads/main",
"rev": "c3fbf020a501226c0ef7c1f6a394d9799c3cf52f",
"revCount": 3,
"type": "git",
"url": "https://gitea.mregirouard.com/nix/dx-build.git"
},
"original": {
"type": "git",
"url": "https://gitea.mregirouard.com/nix/dx-build.git"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
@@ -52,6 +67,7 @@
"root": { "root": {
"inputs": { "inputs": {
"daisyui": "daisyui", "daisyui": "daisyui",
"dx-build": "dx-build",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay", "rust-overlay": "rust-overlay",

View File

@@ -12,6 +12,8 @@
daisyui.url = "git+https://git.mregirouard.com/nix/daisyui.git"; daisyui.url = "git+https://git.mregirouard.com/nix/daisyui.git";
tailwindcss-with-pkgs.url = "git+https://git.mregirouard.com/nix/tailwindcss-with-pkgs.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: outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }@inputs:
@@ -41,6 +43,7 @@
wasm-bindgen-overlay wasm-bindgen-overlay
inputs.daisyui.overlays.default inputs.daisyui.overlays.default
inputs.tailwindcss-with-pkgs.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; rev = if builtins.hasAttr "rev" self then self.rev else self.dirtyRev;
pkg-info = (pkgs.lib.trivial.importTOML ./Cargo.toml).package;
in in
rec { rec {
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
@@ -69,8 +74,9 @@
packages.default = packages.web; packages.default = packages.web;
packages.web = pkgs.rustPlatform.buildRustPackage { packages.web = pkgs.rustPlatform.buildDioxusWebApp {
name = "libretunes"; pname = pkg-info.name;
version = pkg-info.version;
src = ./.; src = ./.;
GIT_REV = rev; GIT_REV = rev;
@@ -78,24 +84,13 @@
cargoLock.lockFile = ./Cargo.lock; cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
makeWrapper (tailwindcss_4.withPackages [daisyui daisyui-theme])
] ++ build-pkgs; 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 # 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 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"
''; '';
}; };
} }