You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to be able to use disko to define the partitioning of a system that uses the impermanence modules to run with an ephemeral root filesystem. An example of the sort of thing I would like to be able to do (possibly with additional setup) is shown in the attached flake.nix.
At present, this doesn't work, for two reasons. First, and most important, files that are written to the root filesystem by the installer, before impermanence gets a chance to set itself up, are lost, even if they are in a directory that impermanence tracks. (Most importantly, with the configuration in the attached flake.nix, all of /nix/var/nix is lost, as is everything in persisted subdirectories of /var.) Second, if you follow the advice in the impermanence manual to put all of /nix under persistence, disko's installation script will copy /nix/store into the ephemeral root filesystem before impermanence is up and running, which will almost certainly run the installation VM out of RAM and crash. (The attached flake.nix works around this by creating an independent, directly mounted partition for /nix/store, which I personally think is a better idea anyway, but it'd be nice if the official impermanence recommendations worked.)
To make this work as seamlessly as possible will require changes in both disko and impermanence, but I think the only thing that needs to happen on disko's side is for its installer and VM builder to permit execution of hook scripts, defined by other NixOS modules, at key moments during the process. Impermanence would want to run a hook script right after all the filesystems are created and mounted but before any other work is done (even before copy_after_disko files are copied). I can also imagine uses for a hook that executes between creating partitions and creating filesystems, and a hook that executes after installation is complete.
I have a different use case for a hook script, where I want to run some code before disko formats the disks. In my case I want to configure the hardware RAID controller using a vendor-specific storcli command.
Admittedly I could just run those commands before I run disko, but then it wouldn't be automated with nixos-anywhere. Having this feature either in disko or in nixos-anywhere would be handy.
EDIT: I've since found out there's a config.disko.disk.<name>.preCreateHook already which can be used. An equivalent global option would be good to have as well.
I would like to be able to use disko to define the partitioning of a system that uses the impermanence modules to run with an ephemeral root filesystem. An example of the sort of thing I would like to be able to do (possibly with additional setup) is shown in the attached
flake.nix
.At present, this doesn't work, for two reasons. First, and most important, files that are written to the root filesystem by the installer, before impermanence gets a chance to set itself up, are lost, even if they are in a directory that impermanence tracks. (Most importantly, with the configuration in the attached
flake.nix
, all of/nix/var/nix
is lost, as is everything in persisted subdirectories of/var
.) Second, if you follow the advice in the impermanence manual to put all of/nix
under persistence, disko's installation script will copy/nix/store
into the ephemeral root filesystem before impermanence is up and running, which will almost certainly run the installation VM out of RAM and crash. (The attachedflake.nix
works around this by creating an independent, directly mounted partition for/nix/store
, which I personally think is a better idea anyway, but it'd be nice if the official impermanence recommendations worked.)To make this work as seamlessly as possible will require changes in both disko and impermanence, but I think the only thing that needs to happen on disko's side is for its installer and VM builder to permit execution of hook scripts, defined by other NixOS modules, at key moments during the process. Impermanence would want to run a hook script right after all the filesystems are created and mounted but before any other work is done (even before
copy_after_disko
files are copied). I can also imagine uses for a hook that executes between creating partitions and creating filesystems, and a hook that executes after installation is complete.flake.nix
The text was updated successfully, but these errors were encountered: