add flake and move to npm
This commit is contained in:
64
flake.nix
Normal file
64
flake.nix
Normal 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"
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user