stuebinm
6c72210b0e
Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/5012ef7926747f739c65bd2e1ceff96da30fb3b8' (2024-11-03) → 'github:NixOS/nixpkgs/5354a00f3cdbab47090bdc51aedbe13d1e2aa9b1' (2024-11-10) • Updated input 'nixpkgs-unstable': 'github:NixOS/nixpkgs/b16bcbe0262b6f203c41a4cd162d07576461f267' (2024-11-04) → 'github:NixOS/nixpkgs/3f42f0b61e6c45ca80d87cec5dd11e121d6b9c14' (2024-11-11) • Updated input 'sops-nix': 'github:Mic92/sops-nix/e9b5eef9b51cdf966c76143e13a9476725b2f760' (2024-11-03) → 'github:Mic92/sops-nix/f1675e3b0e1e663a4af49be67ecbc9e749f85eb7' (2024-11-10) |
||
---|---|---|
common | ||
docs | ||
modules | ||
parsons | ||
pkgs | ||
websites | ||
.gitignore | ||
.rgignore | ||
.sops.yaml | ||
flake.lock | ||
flake.nix | ||
LICENSE | ||
README.md | ||
secrets.yaml |
hacc nixfiles
Welcome to the hacc nixfiles (haccfiles). This is how we configure (most of) our infrastructure.
General layout
flake.nix
: Entrypoint & dependenciesmodules/
: home-grown modules for hacc-specific servicespkgs/
: packages we need which aren't in nixpkgswebsites/
: static websites hosted by uscommon/
: meta-level config, reusable across machinesparsons/
: our sole server, its config & the services it runs
Right now, we only have a single host. We might add more again in the future.
Working with this repo
You will need a flake-enabled nix installation, and have your ssh config set up
so that ssh parsons
will connect to parsons.hacc.space
.
Deploying remotely
It's recommended to use deploy_rs:
deploy .#parsons -k [--dry-activate]
Alternatively, using just nixos-rebuild
:
nixos-rebuild --flake .#parsons --target-host parsons \
--use-remote-sudo --use-substitutes [test|switch|dry-activate]
Re-deploying on parsons itself
Simply do:
nixos-rebuild --flake .#parsons [test|switch|dry-activate]
Working on websites
Websites are exposed as flake outputs: if you're working on a website & want to check it in a browser, do e.g.
nix run .#\"muc.hacc.earth\"
to start a local http server (note that some of our websites need a directory
to be built in; these use /tmp/hacc-website
).
To add a new website, add a new subdirectory to websites
; nix will generate a
vhost config based on that directory's name. Add a default.nix
in your directory
describing how to build the website, and give its derivation a watch
attribute
to make the nix run
setup work.
I don't want to build this long dependency / want a cached version!
If it's still available on parsons from a previous deploy, do:
nix copy --from ssh://parsons /nix/store/...
Note: don't just copy the .drv file (which Nix complains about if it can't
build something), that's just the description of how to build it! If you
don't know the actual outpath, look in the .drv file (should start with
Derive([("out","[the path you want]"...
)
committing to haccfiles
- Things on
main
should always reflect the config that's actually deployed on parsons, except during testing / debugging sessions - split up commits, every commit is one atomic change
- follow the commit format: "place: $change"
- place: e.g.
modules/$module
,services/$service
... - change: describe your change. Please wrap your lines sensibly (or configure your editor to do this for you)
- place: e.g.
- Exception: autogenerated messages (merge commits, reverts, etc)
- don't overuse merge commits, try to rebase things if possible with reasonable effort