Required tree-wide re-wiring of the host option. Now, rather than each host having a monolithic restic.nix file, the hosts restic.nix file just specifies the password and url of the restic repository. Eatch module then definies specific paths to backup and any pre and post commands that need to be performed. Each backed up service gets an independent systemd backup service and timer.
73 lines
1.9 KiB
Nix
73 lines
1.9 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
inputs,
|
|
lib,
|
|
...
|
|
}: let
|
|
# hash for "nixos"
|
|
defaultPasswordHash = "$y$j9T$u0O3PELyRv3GOemCReQhA0$Qb4Sl6dXnafYwZeDYrJGwS4xp3v6vGriWFMYomHH2w3";
|
|
in {
|
|
nix = {
|
|
package = pkgs.nixVersions.stable;
|
|
extraOptions = ''
|
|
experimental-features = nix-command flakes
|
|
'';
|
|
optimise.automatic = true;
|
|
settings = {
|
|
auto-optimise-store = true;
|
|
trusted-users = ["root" "gabe"];
|
|
};
|
|
gc = {
|
|
automatic = true;
|
|
dates = "weekly";
|
|
options = "--delete-older-than 30d";
|
|
};
|
|
};
|
|
|
|
# Allow unfree packages
|
|
nixpkgs.config.allowUnfree = true;
|
|
|
|
time.timeZone = lib.mkDefault "Europe/Berlin";
|
|
# Select internationalisation properties.
|
|
i18n.defaultLocale = lib.mkDefault "en_US.UTF-8";
|
|
|
|
# Configure keymap in X11
|
|
services.xserver = {
|
|
xkb.layout = lib.mkDefault "us";
|
|
xkb.variant = lib.mkDefault "";
|
|
};
|
|
|
|
# packages that should be on every system.
|
|
environment.systemPackages = with pkgs; [
|
|
neovim
|
|
rsync
|
|
];
|
|
|
|
programs.zsh.enable = lib.mkDefault true;
|
|
environment.shells = lib.mkDefault [pkgs.zsh];
|
|
# if we arent setting our password from nix secrets, we need to allow changing it.
|
|
users.mutableUsers = !inputs ? nix-secrets;
|
|
users.users.${config.host.details.user} = {
|
|
isNormalUser = true;
|
|
hashedPassword =
|
|
if inputs ? nix-secrets
|
|
then (lib.removeSuffix "\n" (builtins.readFile "${inputs.nix-secrets}/password-hash"))
|
|
else defaultPasswordHash;
|
|
description = config.host.details.fullName;
|
|
shell = pkgs.zsh;
|
|
extraGroups = ["wheel"];
|
|
};
|
|
users.users.root.password =
|
|
if inputs ? nix-secrets
|
|
then (lib.removeSuffix "\n" (builtins.readFile "${inputs.nix-secrets}/password-hash"))
|
|
else defaultPasswordHash;
|
|
|
|
imports = [
|
|
../../modules/nixos
|
|
];
|
|
|
|
home-manager.useGlobalPkgs = true;
|
|
home-manager.useUserPackages = true;
|
|
home-manager.extraSpecialArgs = {inherit inputs;};
|
|
}
|