Possible thanks to OCI containers!
Warning I tested this module on my dev host. It may not work on yours. If it doesn't, open an issue!
I recommend you use this in a setup where /
gets wiped every reboot.
/etc/nixos/flake.nix
{
inputs = {
# ...
fhs.url = "github:GermanBread/nixos-fhs/stable";
# ...
};
outputs = { ..., fhs, ... }: {
nixosConfigurations.<host> = nixpkgs.lib.nixosSystem {
# ...
modules = [
# ...
fhs.nixosModules.default
# ...
./configuration.nix
# ...
];
# ...
};
};
}
{
services.fhs-compat = {
enable = true;
# other options here
};
}
Also enable podman:
{
virtualisation.podman.enable = true;
}
default:
"arch"
example:
one of [ "debian", "ubuntu", "alpine", "arch", "manjaro", "gentoo", "void" ]
description:
Which distro to use for bootstrapping the FHS environment.
default:
"5G"
description:
How big the tmpfs mounted on $mountPoint should be.
This also affects the tmpfs size for temporary storage of the container.
Sizes must have a valid suffix.
default:
"/.fhs"
description:
Where the FHS environment will be installed to.
default:
$mountPoint/.state
description:
A directory where the service itself stores data
default:
false
example:
true
description:
Whether or not to put a bind mount over /bin and /usr.
Both will redirect to their counterparts in $mountPoint.
This option does not affect /sbin.
default:
[]
example:
[ "neofetch" "sdl2" ]
description:
Which packages to install. Package names vary from distro to distro.
default:
false
example:
true
description:
Try to persist the FHS environment across reboots.
default:
null
description:
Which command to run on a fresh container.
WARNING:
Multiline strings have to be escaped properly, like so:
foo && \
bar
default:
null
example:
"pacman -R neofetch sdl2";
description:
Which command to run after packages have been installed.
WARNING:
Multiline strings have to be escaped properly, like so:
foo && \
bar
default: 60 * 60 * 24; # 1 day
example: 60 * 35; # 35 mins
description: The maximum age any given FHS environment (in seconds). If the env is older than $maxTimeDelta (in seconds), it will be refreshed.