From e5813bbbd6a64491cd099d97c54f874a07323399 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Mon, 2 Sep 2024 22:26:06 +0200 Subject: [PATCH] os/impermanence: init --- flake.lock | 16 ++++++++++++ flake.nix | 2 ++ modules/system/os/impermanence/module.nix | 30 +++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 modules/system/os/impermanence/module.nix diff --git a/flake.lock b/flake.lock index 38c7d6e..b4134f7 100644 --- a/flake.lock +++ b/flake.lock @@ -605,6 +605,21 @@ "type": "github" } }, + "impermanence": { + "locked": { + "lastModified": 1724489415, + "narHash": "sha256-ey8vhwY/6XCKoh7fyTn3aIQs7WeYSYtLbYEG87VCzX4=", + "owner": "nix-community", + "repo": "impermanence", + "rev": "c7f5b394397398c023000cf843986ee2571a1fd7", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "impermanence", + "type": "github" + } + }, "lix": { "flake": false, "locked": { @@ -2683,6 +2698,7 @@ "home-manager": "home-manager", "hyprland": "hyprland", "hyprland-plugins": "hyprland-plugins", + "impermanence": "impermanence", "lix-module": "lix-module", "neovim-flake": "neovim-flake", "nixpak": "nixpak", diff --git a/flake.nix b/flake.nix index c4e7792..f0f4e03 100644 --- a/flake.nix +++ b/flake.nix @@ -50,6 +50,8 @@ helix.url = "github:helix-editor/helix"; + impermanence.url = "github:nix-community/impermanence"; + neovim-flake = { url = "github:notashelf/nvf"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/modules/system/os/impermanence/module.nix b/modules/system/os/impermanence/module.nix new file mode 100644 index 0000000..12a81e9 --- /dev/null +++ b/modules/system/os/impermanence/module.nix @@ -0,0 +1,30 @@ +{ + inputs, + config, + lib, + ... +}: let + inherit (lib) optionalString mkIf mkForce; + + cfg = config.modules.system.impermanence; +in { + imports = [ + inputs.impermanence.nixosModules.impermanence + ]; + environment.persistence."/persist" = { + directories = [ + "/etc/nixos" + "/etc/nix" + "/etc/NetworkManager/system-connections" + "/var/db/sudo" + "/var/lib/bluetooth" + "/var/lib/nixos" + "/var/lib/pipewire" + "/var/lib/systemd/coredump" + ]; + + files = [ + "/etc/machine-id" + ]; + }; +}