46 lines
1.1 KiB
Nix
46 lines
1.1 KiB
Nix
{
|
|
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
|
|
outputs =
|
|
inputs:
|
|
let
|
|
system = "x86_64-linux";
|
|
pkgs = import inputs.nixpkgs { inherit system; };
|
|
in
|
|
{
|
|
devShells.${system}.default = pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
(pkgs.writeShellApplication {
|
|
name = "serve";
|
|
|
|
runtimeInputs = with pkgs; [
|
|
simple-http-server
|
|
tailwindcss_3
|
|
];
|
|
|
|
text = ''
|
|
set -o monitor
|
|
|
|
simple-http-server --index --nocache "$@" &
|
|
PID_SERVER=$!
|
|
|
|
tailwindcss --input input.css \
|
|
--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
|
|
'';
|
|
})
|
|
];
|
|
};
|
|
};
|
|
}
|