feat(dev-env): shell scripts (git-hooks, worktree, deploy, regtest, nav) and smoke test
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
7960f82494
commit
dbd9e76027
13 changed files with 2496 additions and 0 deletions
173
modules/dev-env/tests/smoke.nix
Normal file
173
modules/dev-env/tests/smoke.nix
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
# Standalone smoke test for the dev-env module.
|
||||
#
|
||||
# Builds a minimal nixosConfiguration that imports only the dev-env
|
||||
# module (plus a minimum-bootable stub) and exercises a representative
|
||||
# slice of the option schema:
|
||||
#
|
||||
# - worktree-based project with upstream + github fork (3 remotes)
|
||||
# - worktree-based project without upstream (origin only)
|
||||
# - isClone project with upstream
|
||||
# - minimal project (mkProject defaults)
|
||||
# - tmux session schema
|
||||
# - deploy targets
|
||||
#
|
||||
# Consumed by the top-level flake.nix as `checks.${system}.dev-env-*`
|
||||
# so `nix flake check` catches regressions without loading the full
|
||||
# omni system. The three checks render small files
|
||||
# (projects.json, config.sh, tmux-sessions.json) which is cheap to
|
||||
# build even without a binary cache.
|
||||
#
|
||||
# Run directly:
|
||||
# nix flake check
|
||||
# nix build .#checks.x86_64-linux.dev-env-projects-json
|
||||
# cat $(nix build --no-link --print-out-paths .#checks.x86_64-linux.dev-env-projects-json)
|
||||
#
|
||||
# This is NOT bootable as a real system — the fileSystem/bootloader
|
||||
# stubs only exist to satisfy module evaluation. Do not try to deploy.
|
||||
{ nixpkgs, home-manager }:
|
||||
|
||||
nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
home-manager.nixosModules.home-manager
|
||||
|
||||
# The dev-env module itself.
|
||||
../default.nix
|
||||
|
||||
# No omni stub needed: dev-env is self-contained (uses its own
|
||||
# `dev-env.user` and standard `virtualisation.docker.enable`, with no
|
||||
# `config.omni.*` references). This standalone build IS the proof of
|
||||
# that decoupling.
|
||||
|
||||
# Minimal host stub + dev-env exercise.
|
||||
(
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
# ---- Minimum bootable stubs (never actually booted) ----
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "none";
|
||||
fsType = "tmpfs";
|
||||
};
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
nixpkgs.hostPlatform = "x86_64-linux";
|
||||
system.stateVersion = "25.11";
|
||||
|
||||
# home-manager wants these set even with zero users.
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
|
||||
# ---- Exercise the dev-env schema ----
|
||||
|
||||
dev-env = {
|
||||
enable = true;
|
||||
|
||||
# Explicit root — don't depend on config.dev-env.user defaulting.
|
||||
root = "/tmp/dev-env-smoke";
|
||||
|
||||
forgejo = {
|
||||
host = "git.example.com";
|
||||
org = "test-org";
|
||||
};
|
||||
|
||||
github.forkUser = "testuser";
|
||||
|
||||
deploy = {
|
||||
flakeInput = "deploy-flake";
|
||||
targets = {
|
||||
host-a = "root@10.0.0.1";
|
||||
host-b = "root@10.0.0.2";
|
||||
};
|
||||
deriveProjectsFromInputs = false;
|
||||
};
|
||||
|
||||
# Disable regtest to avoid dragging docker into the eval.
|
||||
regtest.enable = false;
|
||||
|
||||
tmux = {
|
||||
enable = true;
|
||||
sessions.dev = {
|
||||
cwd = "lnbits";
|
||||
windows = [
|
||||
{
|
||||
name = "dev";
|
||||
cwd = "lnbits/dev";
|
||||
cmd = "nvim .";
|
||||
}
|
||||
{
|
||||
name = "term";
|
||||
cwd = "lnbits/dev";
|
||||
cmd = null;
|
||||
}
|
||||
{
|
||||
name = "git";
|
||||
cwd = "lnbits/dev";
|
||||
cmd = "lazygit";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Use mkProject so we exercise the lib helper in addition to
|
||||
# the raw submodule schema.
|
||||
projects =
|
||||
let
|
||||
mk = config.dev-env.lib.mkProject;
|
||||
in
|
||||
{
|
||||
# Worktree-based with upstream + github-fork (3 remotes).
|
||||
worktree-with-upstream = mk {
|
||||
name = "worktree-with-upstream";
|
||||
category = "shared";
|
||||
upstream = "https://github.com/upstream-org/worktree-with-upstream";
|
||||
worktrees = {
|
||||
main = {
|
||||
branch = "main";
|
||||
};
|
||||
dev = {
|
||||
branch = "dev";
|
||||
};
|
||||
feature = {
|
||||
branch = "feature/x";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Worktree-based, no upstream (origin only).
|
||||
worktree-no-upstream = mk {
|
||||
name = "worktree-no-upstream";
|
||||
category = "shared";
|
||||
worktrees = {
|
||||
alpha = {
|
||||
branch = "alpha";
|
||||
};
|
||||
beta = {
|
||||
branch = "beta";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Single-clone with upstream (rebase helper target).
|
||||
clone-with-upstream = mk {
|
||||
name = "clone-with-upstream";
|
||||
category = "test";
|
||||
upstream = "https://github.com/upstream-org/clone-with-upstream";
|
||||
isClone = true;
|
||||
};
|
||||
|
||||
# Minimal project — mkProject defaults fill everything.
|
||||
minimal = mk {
|
||||
name = "minimal";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue