Configuration for our Raspberry PI server
See DEPLOYMENT for instructions on how apply this config to a new system.
To add a new service, create a file in the modules directory, for example:
# file: modules/example.nix
{ pkgs, ... }:
{
services.example = {
enable = true;
package = pkgs.example;
};
}
Note
Until NixOS/nix#7107 is fixed, don't forget to stage new files with git!
The module will be automatically enabled. If you want to disable it, you can exclude it when importing all the modules:
# file: hosts/raspi-doboz/configuration.nix
imports =
[ ./hardware-configuration.nix ]
++ modules.allModulesExcept [
"example"
];
If a new service also needs to create an nginx virtual host, backup some data using borgmatic, set up temporary files, open ports, use an agenix secret, etc., then prefer putting those configs in the new module rather than the nginx
, borgmatic
modules.
# file: modules/example.nix
{ pkgs, ... }:
{
services.example = {
enable = true;
package = pkgs.example;
};
services.nginx.virtualHosts."example.ymstnt.com".locations = {
# ...
};
services.borgmatic.configurations.raspi = {
sqlite_databases = [
# ...
];
};
}