add flake and move to npm

This commit is contained in:
Joakim Repomaa
2026-02-22 22:23:49 +02:00
parent 9f661e4d57
commit 5ae9386fcd
11 changed files with 6579 additions and 1635 deletions

64
flake.nix Normal file
View File

@@ -0,0 +1,64 @@
{
description = "Router Dashboard - SvelteKit static site";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages.default = pkgs.buildNpmPackage {
pname = "router-dash";
version = "0.0.1";
src = ./.;
npmDepsHash = "sha256-2XxcsvKeYp+SVBx6Z2uB/34qUr7AderMxXKjm/kS8F0=";
buildPhase = ''
runHook preBuild
npm run build
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/share/router-dash
cp -r build/* $out/share/router-dash/
runHook postInstall
'';
meta = with pkgs.lib; {
description = "Router Dashboard - A SvelteKit static web interface";
license = licenses.mit;
platforms = platforms.all;
};
};
devShells.default = pkgs.mkShell {
packages = with pkgs; [
nodejs
];
shellHook = ''
echo "Router Dash development environment"
echo " npm run dev - Start development server"
echo " npm run build - Build static site"
'';
};
}
);
}