Files
inter-hub/devenv.nix
tegwick 7972b38820
Some checks failed
Test / test (push) Has been cancelled
feat(build): tune GHC for haskelseed (8 CPU / 30 GiB)
- .ghci: -j1 → -j4 for parallel module compilation
- scripts/compile-check: auto-detect high-RAM hosts (>16GB) and
  set GHCRTS="-A256m -M20g" to reduce GC pressure
- devenv.nix: update comment only (GHCRTS still set at runtime)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 01:32:36 +02:00

69 lines
3.4 KiB
Nix

# devenv.nix — required by devenv v2+.
#
# IHP's flake module (flake.nix) provides the full devenv shell via
# `inputs.devenv.flakeModule`: Haskell toolchain, PostgreSQL, ghcid,
# and RunDevServer. This file satisfies devenv v2's file-presence
# requirement and adds project-specific overrides on top.
#
# Duplicates the settings from flake.nix devenv.shells.default so they
# are applied under both devenv v1 (flake path) and devenv v2 (this file).
{ pkgs, lib, config, inputs, ... }:
# devenv.nix — devenv v2 shell configuration.
#
# `devenv shell` reads only this file (not flake.nix's devenv.shells.default).
# IHP's flake module configures devenv.shells.default — that is only visible
# to `nix develop`. This file therefore duplicates the IHP-critical parts so
# that `devenv shell` also has a working Haskell + IHP_LIB environment.
#
# devenv.yaml registers IHP as a devenv input (pinned rev matching flake.lock)
# and applies IHP's nixpkgs overlay, making pkgs.ghc the IHP Haskell package
# set (ihp, ihp-hspec, ghcid, etc.).
{
# ── Resource limits (constrained host: 2 CPU / ~3.8 GiB RAM) ─────────────
# -A32m: smaller minor heap; -M2g: hard heap ceiling.
# -N1 omitted: requires -threaded, which breaks IHP tools.
# GHC parallel module compilation is capped via -j4 in .ghci.
env.GHCRTS = "-A32m -M2g";
# ── IHP environment variables ─────────────────────────────────────────────
# IHP_LIB is read by .ghci (applicationGhciConfig) and by scripts/compile-check.
# IHP is the legacy name used by older Makefiles.
env.IHP_LIB = "${inputs.ihp.packages.${pkgs.stdenv.system}.ihp-env-var-backwards-compat}";
env.IHP = "${inputs.ihp.packages.${pkgs.stdenv.system}.ihp-env-var-backwards-compat}";
# ── Haskell toolchain ─────────────────────────────────────────────────────
# IHP's nixpkgs overlay (applied via devenv.yaml overlays) makes pkgs.ghc
# the IHP-augmented Haskell package set. pkgs.ghc.ghc is the GHC compiler.
languages.haskell.enable = true;
languages.haskell.package = pkgs.ghc.ghc.withPackages (p: with p; [
p.ihp
# Project runtime dependencies (mirrors flake.nix haskellPackages)
http-conduit
aeson
string-conversions
cryptohash-sha256
base16-bytestring
random-bytestring
yaml
network-uri
# Dev / test tools
cabal-install
hlint
hspec
p.ihp-hspec
]);
# ghcid is used by scripts/compile-check-core; not auto-added by devenv.
# LSP disabled — heavy binary not needed for CI-style compile checks.
languages.haskell.lsp.enable = false;
# ── Extra packages ────────────────────────────────────────────────────────
packages = [
pkgs.ghc.ghcid
pkgs.nodePackages.tailwindcss
];
# ── Processes ─────────────────────────────────────────────────────────────
# Tailwind CSS watcher — not part of IHP's core devenv module.
processes.tailwind.exec = "tailwindcss -c tailwind/tailwind.config.js -i ./tailwind/app.css -o static/app.css --watch=always";
}