Files
LibreTunes/flake.nix
Ethan Girouard 5890b1486e
All checks were successful
Push Workflows / rustfmt (push) Successful in 9s
Push Workflows / mdbook (push) Successful in 13s
Push Workflows / mdbook-server (push) Successful in 33s
Push Workflows / docs (push) Successful in 1m36s
Push Workflows / clippy (push) Successful in 1m59s
Push Workflows / test (push) Successful in 3m47s
Push Workflows / leptos-test (push) Successful in 3m46s
Push Workflows / build (push) Successful in 4m58s
Push Workflows / nix-build (push) Successful in 7m40s
Push Workflows / docker-build (push) Successful in 9m13s
Update libretunes_macro
2025-10-20 18:15:28 -04:00

90 lines
2.3 KiB
Nix

{
description = "LibreTunes build and development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
buildPkgs = with pkgs; [
(rust-bin.fromRustupToolchainFile ./rust-toolchain.toml)
cargo-leptos
clang
openssl
postgresql
imagemagick
pkg-config
tailwindcss_4
binaryen
];
in
{
devShells.default = pkgs.mkShell {
LIBCLANG_PATH = pkgs.lib.makeLibraryPath [ pkgs.llvmPackages_latest.libclang.lib ];
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ pkgs.libgcc.lib ];
buildInputs = with pkgs; buildPkgs ++ [
diesel-cli
mdbook
];
shellHook = ''
set -a
[[ -f .env ]] && source .env
set +a
'';
};
packages.default = pkgs.rustPlatform.buildRustPackage {
name = "libretunes";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
# Needed because of git dependency
outputHashes = {
"libretunes_macro-0.1.0" = "sha256-e5hcT3fCvhyaCMPHslTkLqFE03id5Vg7/SekyVn1JI4=";
};
};
LIBCLANG_PATH = pkgs.lib.makeLibraryPath [ pkgs.llvmPackages_latest.libclang.lib ];
nativeBuildInputs = with pkgs; buildPkgs ++ [
makeWrapper
];
buildInputs = with pkgs; [
openssl
imagemagick
];
buildPhase = ''
cargo-leptos build --precompress --release
'';
installPhase = ''
mkdir -p $out/bin
install -t $out target/release/libretunes
cp -r target/site $out/site
makeWrapper $out/libretunes $out/bin/libretunes \
--set LEPTOS_SITE_ROOT $out/site \
--set LD_LIBRARY_PATH ${pkgs.libgcc.lib}
'';
doCheck = false;
};
}
);
}