use nix-community/impermanence module

This commit is contained in:
Sean Buckley 2022-10-25 23:39:52 -04:00
parent 485c286984
commit f25b5e4312
3 changed files with 29 additions and 9 deletions

View file

@ -1,5 +1,20 @@
{
"nodes": {
"impermanence": {
"locked": {
"lastModified": 1661933071,
"narHash": "sha256-RFgfzldpbCvS+H2qwH+EvNejvqs+NhPVD5j1I7HQQPY=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "def994adbdfc28974e87b0e4c949e776207d5557",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "impermanence",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1666401273,
@ -17,6 +32,7 @@
},
"root": {
"inputs": {
"impermanence": "impermanence",
"nixpkgs": "nixpkgs"
}
}

View file

@ -1,7 +1,8 @@
{
inputs.nixpkgs.url = "nixpkgs/nixos-22.05";
inputs.impermanence.url = "github:nix-community/impermanence";
outputs = { self, nixpkgs, ... }:
outputs = { self, nixpkgs, impermanence, ... }:
let
mypkgs = pkgs:
@ -20,7 +21,7 @@
(builtins.readDir ./pkgs));
forAllSystems = f: nixpkgs.lib.genAttrs
[ "x86_64-linux" "aarch64-linux" ]
[ "x86_64-linux" ]
(system: f system);
pins = {
@ -40,6 +41,7 @@
mods =
{
inherit pins;
inherit (impermanence.nixosModules) impermanence;
pkgs.nixpkgs.overlays = [ (_: mypkgs) ];
} //
nixpkgs.lib.mapAttrs'

View file

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
let
persist = "/var/lib/persist-${config.networking.hostName}";
persist = "/nix/persist";
in
{
imports = [
@ -9,12 +9,8 @@ in
environment.etc = {
"machine-id".source = "${persist}/machine-id";
"NetworkManager/system-connections".source =
"${persist}/network-connections";
};
systemd.tmpfiles.rules = [ "d ${persist}/network-connections 0700" ];
services.openssh.hostKeys = [
{ type = "ed25519"; path = "${persist}/ssh_host_ed25519_key"; }
];
@ -40,6 +36,14 @@ in
wg-home = { enable = true; path = "${persist}/wireguard_home.conf"; };
};
environment.persistence."${persist}/system".directories = [
"/etc/NetworkManager/system-connections"
"/var/lib/nixos"
"/var/lib/systemd"
"/var/lib/upower"
"/var/log"
];
boot = {
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;
@ -51,8 +55,6 @@ in
"/boot" = { fsType = "vfat"; device = "/dev/nvme0n1p1"; };
"/nix" = { device = "levi/nix"; fsType = "zfs"; };
"/home" = { device = "levi/home"; fsType = "zfs"; };
"/var/lib" = { device = "levi/lib"; fsType = "zfs"; };
"/var/log" = { device = "levi/log"; fsType = "zfs"; };
};
users.mutableUsers = false;