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:
16
flake.lock
generated
16
flake.lock
generated
@@ -15,6 +15,21 @@
|
||||
"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": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
@@ -52,6 +67,7 @@
|
||||
"root": {
|
||||
"inputs": {
|
||||
"daisyui": "daisyui",
|
||||
"dx-build": "dx-build",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay",
|
||||
|
||||
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