hp: move persistence

This commit is contained in:
Sean Buckley 2022-07-24 22:11:25 -04:00
parent f658ef1d1a
commit 4cf06fce35
2 changed files with 22 additions and 23 deletions

View file

@ -1,23 +1,5 @@
{ config, lib, pkgs, ... }:
{
services = {
openssh.enable = true;
};
users.mutableUsers = false;
users.users.root.passwordFile = "/nix/persist/shadow_sean";
users.users.sean.passwordFile = "/nix/persist/shadow_sean";
environment.etc =
lib.genAttrs
[
"machine-id"
"NetworkManager/system-connections"
"ssh/ssh_host_ed25519_key"
"ssh/ssh_host_rsa_key"
]
(name: { source = "/nix/persist/etc/${name}"; });
sconfig = {
gnome = true;
profile = "desktop";
@ -25,6 +7,22 @@
wg-home.enable = true;
};
environment.etc.machine-id.source = "/var/lib/nixos/machine-id";
environment.etc."NetworkManager/system-connections".source =
"/var/lib/nixos/nm-connections";
services.openssh = {
enable = true;
hostKeys = [
{ type = "ed25519"; path = "/var/lib/nixos/ssh_host_ed25519_key"; }
];
};
users.mutableUsers = false;
users.users.sean.passwordFile = "/var/lib/nixos/shadow_sean";
users.users.root.passwordFile = "/var/lib/nixos/shadow_sean";
boot = {
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = false;
@ -35,10 +33,11 @@
fileSystems = {
"/" = { device = "tmpfs"; fsType = "tmpfs"; options = [ "mode=755" ]; };
"/nix" = { device = "zroot/locker/nix"; fsType = "zfs"; };
"/home" = { device = "zroot/locker/home"; fsType = "zfs"; };
"/boot" = { device = "/dev/disk/by-partlabel/EFI\\x20system\\x20partition"; fsType = "vfat"; };
"/var/log" = { device = "/nix/persist/var/log"; noCheck = true; options = [ "bind" ]; };
"/home" = { device = "zroot/locker/home"; fsType = "zfs"; };
"/nix" = { device = "zroot/locker/nix"; fsType = "zfs"; };
"/var/lib" = { device = "zroot/locker/lib"; fsType = "zfs"; };
"/var/log" = { device = "zroot/locker/log"; fsType = "zfs"; };
};
system.stateVersion = "21.05";

View file

@ -4,8 +4,8 @@
config = lib.mkIf config.sconfig.wg-home.enable {
systemd.services.wg-home = {
script = "wg-quick up /nix/persist/wireguard_home.conf";
preStop = "wg-quick down /nix/persist/wireguard_home.conf";
script = "wg-quick up /var/lib/nixos/wireguard_home.conf";
preStop = "wg-quick down /var/lib/nixos/wireguard_home.conf";
path = [ pkgs.wireguard-tools ];
serviceConfig = {
type = "oneshot";