Put impermanence behind an option to make kopia work.

This commit is contained in:
2024-09-25 10:33:27 +01:00
parent 92a59e004a
commit c565aba76c
2 changed files with 74 additions and 59 deletions

View File

@@ -1,9 +1,11 @@
{ lib, ... }:
{
imports = [
./impermanence.nix # TODO: find a way to avoid needing this here
];
boot.isContainer = true;
custom.impermanence.enable = false;
custom.tailscale.enable = false;
networking.useDHCP = lib.mkForce false;
}

View File

@@ -1,5 +1,17 @@
{ pkgs, inputs, ... }:
{ pkgs, inputs, lib, config, ... }:
let
cfg = config.custom.impermanence;
in
{
options.custom.impermanence = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable impermanent root fs";
};
};
config = lib.mkIf cfg.enable {
environment.persistence = {
"/persist" = {
directories = [ "/var/lib/nixos" ];
@@ -68,4 +80,5 @@
btrfs subvolume create /mnt/root
umount /mnt
'';
};
}