mirror of
https://github.com/sajenim/javascript-template.git
synced 2025-12-17 03:50:40 +08:00
Moved template directories into templates/ subdirectory (templates/vanilla/ and templates/nextjs/) with complete Nix configuration in each. This ensures initialized projects have the full development environment with Nix, Bun, and all tooling out of the box. Changes: - Created templates/vanilla/ with flake.nix, nix/, .envrc, and all files - Created templates/nextjs/ with flake.nix, nix/, .envrc, and all files - Updated template paths in nix/modules/template.nix
45 lines
927 B
Nix
45 lines
927 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
|
|
nodejs
|
|
typescript
|
|
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"
|
|
'';
|
|
};
|
|
};
|
|
}
|