mirror of
https://github.com/sajenim/javascript-template.git
synced 2025-12-16 19:40:39 +08:00
Features: - Nix + Flakes for reproducible environments - Bun (fast JavaScript runtime) - Vite (development server & build tool) - ESLint + Prettier (linting & formatting) - Devshell commands via just - Modular structure using flake-parts - Omnix template support for initialization
43 lines
889 B
Nix
43 lines
889 B
Nix
{inputs, lib, ...}: let
|
|
# FHS compatibility for NixOS (steam-run wrapper)
|
|
# Enable if bun-installed binaries fail to find system libraries
|
|
fhs = false;
|
|
in {
|
|
perSystem = {system, ...}: let
|
|
pkgs = import inputs.nixpkgs {
|
|
inherit system;
|
|
config.allowUnfree = fhs;
|
|
};
|
|
|
|
fhsPackages = lib.optionals fhs [
|
|
pkgs.steam-run
|
|
];
|
|
|
|
fhsSetup = lib.optionalString fhs ''
|
|
alias bun="steam-run bun"
|
|
'';
|
|
in {
|
|
devShells.default = pkgs.mkShell {
|
|
nativeBuildInputs = with pkgs;
|
|
[
|
|
bun
|
|
eslint
|
|
just
|
|
prettierd
|
|
]
|
|
++ fhsPackages;
|
|
|
|
shellHook = ''
|
|
${fhsSetup}
|
|
|
|
if [ -f package.json ]; then
|
|
echo "Installing dependencies..."
|
|
bun install
|
|
fi
|
|
|
|
echo ""
|
|
echo "💡 Run 'just' to see available commands"
|
|
'';
|
|
};
|
|
};
|
|
}
|