manuals:distributions:nixos:impermanence

This is an old revision of the document!


NixOS Impermanence

This is a work in progress

1. Create a NixOS VPS

2. Start the VPS in rescue mode

3. Create VPS subdataset for the Nix store

4. Move the Nix store to the subdataset

mv /mnt/vps/nix/* /nix/

5. Mount root file system to /persistent

6. Restart the VPS

7. Edit your configuration and add the impermanence module

Clone the impermanence module repository into /etc/nixos. This requires git, if you don't have it in your system, you can use nix-shell -p git.

cd /etc/nixos
git clone https://github.com/nix-community/impermanence.git
/etc/nixos/configuration.nix
{ config, ... }:
{
  imports = [
    ./impermanence/nixos.nix
  ];
 
  environment.persistence."/persistent" = {
    hideMounts = true;
    directories = [
      "/etc/nixos"
      "/var/log"
      "/var/lib/nixos"
    ];
    files = [
      "/etc/machine-id"
    ];
  };
}

8. Turn on impermanence feature

manuals/distributions/nixos/impermanence.1729021349.txt.gz · Last modified: 2024/10/15 19:42 by aither