refactor(users/tazjin): Extract non-home persistence config

This will be reused between machines.

Change-Id: Ice7835ce7e63b00284e046606309e882412cda26
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5547
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
This commit is contained in:
Vincent Ambo 2022-05-09 15:40:15 +02:00 committed by tazjin
parent 09f27d278d
commit 2b75ee689d
3 changed files with 39 additions and 24 deletions

View file

@ -0,0 +1,24 @@
# Configuration for persistent (non-home) data.
{ depot, pkgs, lib, ... }:
{
imports = [
"${depot.third_party.impermanence}/nixos.nix"
];
environment.persistence."/persist" = {
directories = [
"/etc/NetworkManager/system-connections"
"/etc/mullvad-vpn"
"/var/cache/mullvad-vpn"
"/var/lib/bluetooth"
"/var/lib/systemd/coredump"
"/var/lib/tailscale"
"/var/log"
];
files = [
"/etc/machine-id"
];
};
}

View file

@ -0,0 +1,12 @@
# Configuration for my Zerotier network.
{
environment.persistence."/persist".directories = [
"/var/lib/zerotier-one"
];
services.zerotierone.enable = true;
services.zerotierone.joinNetworks = [
"35c192ce9bd4c8c7"
];
}

View file

@ -14,9 +14,10 @@ in
lib.fix (self: { lib.fix (self: {
imports = [ imports = [
(mod "open_eid.nix") (mod "open_eid.nix")
(usermod "physical.nix")
(usermod "fonts.nix") (usermod "fonts.nix")
"${depot.third_party.impermanence}/nixos.nix" (usermod "persistence.nix")
(usermod "physical.nix")
(usermod "zerotier.nix")
"${pkgs.home-manager.src}/nixos" "${pkgs.home-manager.src}/nixos"
] ++ lib.optional (builtins.pathExists ./local-config.nix) ./local-config.nix; ] ++ lib.optional (builtins.pathExists ./local-config.nix) ./local-config.nix;
@ -109,23 +110,6 @@ lib.fix (self: {
]; ];
}; };
environment.persistence."/persist" = {
directories = [
"/etc/NetworkManager/system-connections"
"/etc/mullvad-vpn"
"/var/cache/mullvad-vpn"
"/var/lib/bluetooth"
"/var/lib/systemd/coredump"
"/var/lib/tailscale"
"/var/lib/zerotier-one"
"/var/log"
];
files = [
"/etc/machine-id"
];
};
# from https://github.com/NixOS/nixpkgs/issues/64965 # from https://github.com/NixOS/nixpkgs/issues/64965
environment.etc."ipsec.secrets".text = '' environment.etc."ipsec.secrets".text = ''
include ipsec.d/ipsec.nm-l2tp.secrets include ipsec.d/ipsec.nm-l2tp.secrets
@ -340,10 +324,5 @@ lib.fix (self: {
services.tailscale.enable = true; services.tailscale.enable = true;
services.zerotierone.enable = true;
services.zerotierone.joinNetworks = [
"35c192ce9bd4c8c7"
];
system.stateVersion = "20.09"; system.stateVersion = "20.09";
}) })