This repository has been archived on 2026-06-22. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
lnbits-sensei/flake.nix
Padreug e38d313db2 feat(dev-env): backport matured dev-env implementation from /etc/nixos
Replace the stub dev-env with the real, working implementation that grew
in the reference machine config — de-identified for the public scaffold.

Nix layer:
- options.nix: full project schema (url/upstream/fork/category/
  worktreeRoot/worktrees{branch,path,remote}/isClone/deployFlakeInput),
  deploy.targets, github.forkUser, writeDirenvHints. Drops the
  forgejo-URL block + deploy-flake auto-derivation (incoherent in a
  scaffold that uses explicit per-project urls).
- lib.nix: mkProject + worktreePath/bareRepoPath/projectRemotes,
  generalized to the explicit-url model (origin falls back to upstream).
- config.nix: renders /etc/dev-env/{config.sh,projects.json,
  tmux-sessions.json}, installs helpers via writeShellScriptBin, loads
  shell functions into interactive shells, wires the git pre-commit hook.

Scripts (config-driven, read /etc/dev-env at runtime):
- bootstrap.sh, nav.sh, worktree.sh, pr-helpers.sh, rebase.sh,
  status.sh, deploy.sh, regtest.sh, tmux-launch.sh.
- Stripped aiolabs/forgejo/bitspire/lamassu/webapp hardcoding; the
  github-fork remote is renamed 'fork' to match git.remotes vocabulary.
- Removes the dev.sh stub (the matured impl uses discrete commands +
  shell functions, not a unified 'dev' CLI).

presets/example.nix: a worked, generic project list replacing the
identity-specific aiolabs preset. tests/smoke.nix + flake checks
exercise the schema; 'nix flake check' is green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 21:18:49 +02:00

93 lines
3.1 KiB
Nix

{
description = "lnbits-sensei opinionated NixOS scaffold for an LNbits dev stack";
inputs = {
# Pinned to nixos-unstable for fresh LNbits / Lightning tooling.
# Bump intentionally; this template does not chase HEAD.
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
# Upstream LNbits source. Tracked as a flake input so the lnbits
# module can pin to a specific ref and the dev-env helpers can
# surface upstream-relative diffs without a separate clone step.
#
# Override locally with `--override-input lnbits-src path:/your/fork`
# when iterating on a feature destined for an upstream PR.
lnbits-src = {
url = "github:lnbits/lnbits";
flake = false;
};
# sops-nix — declarative secrets via age-encrypted YAML files.
# Decryption happens at NixOS activation; values are exposed to
# services as files under /run/secrets/<name>. The host's age
# key lives at ~/.config/sops/age/keys.txt by default; recipients
# are declared in .sops.yaml. See modules/secrets.nix for wiring
# and docs/secrets-management.md for a walkthrough.
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
home-manager,
...
}@inputs:
let
system = "x86_64-linux";
settings = import ./settings.nix;
# specialArgs / extraSpecialArgs flow mirrors the omnixy pattern:
# `settings` (single source of truth — user, host, identity,
# remote topology) is threaded into every NixOS module and into
# the home-manager module set, so neither has to re-import it.
# dev-env schema smoke test — a minimal nixosSystem that imports
# only core.nix + the dev-env module and exercises the option
# surface. `nix flake check` builds the rendered config artifacts,
# which forces full module evaluation (catching schema breakage)
# without building a whole system.
smoke = import ./modules/dev-env/tests/smoke.nix {
inherit nixpkgs home-manager;
};
in
{
checks.${system} = {
dev-env-projects-json = smoke.config.environment.etc."dev-env/projects.json".source;
dev-env-config-sh = smoke.config.environment.etc."dev-env/config.sh".source;
dev-env-tmux-sessions = smoke.config.environment.etc."dev-env/tmux-sessions.json".source;
};
nixosConfigurations.${settings.hostName} = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs settings;
};
modules = [
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit inputs settings;
};
users.${settings.user} = import ./home.nix;
};
}
];
};
};
}