* NixOS Server

 Configuration files for my personal server, powered by [[https://nixos.org/][NixOS]].

** Modules

 The configuration is sliced into different files, per category:

 - ZFS pool configuration: hardware-configuration.nix
 - Network configuration: networking.nix
 - Synchronization and backup services: datasync.nix
 - Web services and reverse proxy: webstack.nix
 - Development tools: devops.nix
 - Smartd: monitoring.nix
 - Systemd services and timers: periodic.nix
 - Curated articles: information.nix

 All the modules are imported in *configuration.nix*

** Installation

1. Download the sdcard image
2. Use initial config file

#+begin_src shell
cp install.nix configuration.nix
#+end_src

3. Move the repo to the server and the agenix key

#+begin_src shell
scp -r Projects/zion zion:/home/nixos/system
scp .ssh/zion root@zion:/etc/ssh/id_ed25519
#+end_src

4. Mount the firmware partition

#+begin_src shell
mount /dev/mmcblk1p1 /boot
#+end_src

5. Rebuild the system using Flakes

#+begin_src shell
nix-shell -p git
sudo nixos-rebuild switch --flake /home/nixos/system#zion
#+end_src

6. Restore the SQL databases

#+begin_src shell
gunzip -c /vault/backups/zion/databases/all.sql.gz | psql -U postgres
#+end_src