Add daisyui

Add wrapper scripts and fetch JS for nix compatibility
This commit is contained in:
2026-06-11 19:21:48 -04:00
parent 92c7599962
commit 745deb8809
4 changed files with 84 additions and 0 deletions

View File

@@ -38,6 +38,40 @@
]; ];
}; };
daisyui-version = "v5.5.23";
daisyui = pkgs.stdenvNoCC.mkDerivation {
name = "daisyui";
src = pkgs.fetchurl {
url = "https://github.com/saadeghi/daisyui/releases/download/${daisyui-version}/daisyui.js";
sha256 = "sha256-IHsOrki86HGPW02ERe3gXTatzWJjjQ6EPQ3eodW/yXw=";
};
unpackPhase = "true";
installPhase = ''
mkdir "$out"
cp "$src" "$out/daisyui.js"
'';
};
daisyui-theme = pkgs.stdenvNoCC.mkDerivation {
name = "daisyui-theme";
src = pkgs.fetchurl {
url = "https://github.com/saadeghi/daisyui/releases/download/${daisyui-version}/daisyui-theme.js";
sha256 = "sha256-p/ofznslFSKQ87UuP4XV4bvU7xmAkci/WRlAznJt9MY=";
};
unpackPhase = "true";
installPhase = ''
mkdir "$out"
cp "$src" "$out/daisyui-theme.js"
'';
};
rust = pkgs.rust-bin.stable.latest.default.override { rust = pkgs.rust-bin.stable.latest.default.override {
targets = [ "wasm32-unknown-unknown" ]; targets = [ "wasm32-unknown-unknown" ];
}; };
@@ -52,6 +86,9 @@
in in
rec { rec {
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
DAISYUI_PATH = "${daisyui}";
DAISYUI_THEME_PATH = "${daisyui-theme}";
buildInputs = with pkgs; [ buildInputs = with pkgs; [
rust rust
] ++ build-pkgs; ] ++ build-pkgs;
@@ -63,6 +100,9 @@
name = "libretunes"; name = "libretunes";
src = ./.; src = ./.;
DAISYUI_PATH = "${daisyui}";
DAISYUI_THEME_PATH = "${daisyui-theme}";
cargoLock.lockFile = ./Cargo.lock; cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [

View File

@@ -0,0 +1,18 @@
let daisyui_theme = null;
try {
daisyui_theme = require('daisyui/theme');
} catch (e) { }
if (daisyui_theme == null) {
try {
daisyui_theme = require(`${process.env.DAISYUI_THEME_PATH}/daisyui-theme.js`);
} catch (e) { }
}
if (daisyui_theme == null) {
console.error('Could not find DaisyUI/theme');
throw new Error('Could not find DaisyUI/theme');
}
export default daisyui_theme.default || daisyui_theme;

18
style/daisyui-wrapper.js Normal file
View File

@@ -0,0 +1,18 @@
let daisyui = null;
try {
daisyui = require('daisyui');
} catch (e) { }
if (daisyui == null) {
try {
daisyui = require(`${process.env.DAISYUI_PATH}/daisyui.js`);
} catch (e) { }
}
if (daisyui == null) {
console.error('Could not find DaisyUI');
throw new Error('Could not find DaisyUI');
}
export default daisyui.default || daisyui;

View File

@@ -1,3 +1,11 @@
@import "tailwindcss"; @import "tailwindcss";
@plugin "./daisyui-wrapper.js" {
themes: all;
};
@plugin "./daisyui-theme-wrapper.js" {
};
@source not "*"; @source not "*";
@source "./src/**/*.{rs,html,css}"; @source "./src/**/*.{rs,html,css}";