Files
inter-hub/devenv.nix
Bernd Worsch debc0b7d81
Some checks failed
Test / test (push) Has been cancelled
fix(WP-0014/A2): fix devenv shell — IHP_LIB, ghci, ghcid now available
Root cause: devenv shell reads devenv.nix only; IHP's Haskell setup is in
flake.nix's devenv.shells.default which is only loaded by nix develop.

Fix: create devenv.yaml to register IHP as a devenv input (pinned to the
same rev as flake.lock) with overlays.default applied.  Update devenv.nix
to set IHP_LIB/IHP env vars and enable languages.haskell with pkgs.ghc
(IHP-overlay GHC) + all project packages; add ghcid explicitly.

devenv.lock pins IHP at df3922d (matches flake.lock).

scripts/compile-check: updated header comments and added IHP_LIB echo;
switches from ghcid to ghci one-shot (ghcid not available in all shells).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 13:11:41 +00: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 -j1 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";
}