56 lines
1.4 KiB
Nix
56 lines
1.4 KiB
Nix
{
|
|
inputs = {
|
|
devshell.inputs.nixpkgs.follows = "nixpkgs";
|
|
devshell.url = "github:numtide/devshell";
|
|
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
};
|
|
|
|
outputs =
|
|
inputs:
|
|
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
|
systems = [ "x86_64-linux" ];
|
|
|
|
imports = [ inputs.devshell.flakeModule ];
|
|
|
|
perSystem =
|
|
{ pkgs, ... }:
|
|
{
|
|
devshells.default = {
|
|
packages = [
|
|
(pkgs.writeShellApplication {
|
|
name = "serve";
|
|
|
|
runtimeInputs = with pkgs; [
|
|
simple-http-server
|
|
tailwindcss_4
|
|
watchman
|
|
];
|
|
|
|
text = ''
|
|
set -o monitor
|
|
|
|
simple-http-server --index --nocache "$@" &
|
|
PID_SERVER=$!
|
|
|
|
tailwindcss --output tailwind.css --watch &
|
|
PID_TAILWIND=$!
|
|
|
|
cleanup() {
|
|
echo "Stopping processes..."
|
|
|
|
kill "$PID_SERVER" "$PID_TAILWIND" 2>/dev/null || true
|
|
wait "$PID_SERVER" "$PID_TAILWIND" 2>/dev/null || true
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
wait
|
|
'';
|
|
})
|
|
];
|
|
};
|
|
};
|
|
};
|
|
}
|