WIP: rewrite config #618

Draft
darkkirb wants to merge 408 commits from rewrite into main
2 changed files with 35 additions and 21 deletions
Showing only changes of commit a87baa94a0 - Show all commits

View file

@ -4,4 +4,5 @@
"${nixos-config}/services/tailscale.nix" "${nixos-config}/services/tailscale.nix"
./systemd-boot.nix ./systemd-boot.nix
]; ];
boot.initrd.systemd.enable = true;
} }

View file

@ -17,7 +17,19 @@ with lib; {
environment.impermanence = mkDefault (!config.boot.isContainer && !inTester); environment.impermanence = mkDefault (!config.boot.isContainer && !inTester);
} }
(mkIf config.environment.impermanence { (mkIf config.environment.impermanence {
boot.initrd.postDeviceCommands = mkAfter '' boot.initrd.systemd.services.rootfs-cleanup = {
wantedBy = [
"initrd.target"
];
after = [
"initrd-root-device.target"
];
before = [
"sysroot.mount"
];
unitConfig.DefaultDependencies = "no";
serviceConfig.Type = "oneshot";
script = ''
mkdir /btrfs_tmp mkdir /btrfs_tmp
mount ${config.fileSystems."/".device} -t btrfs /btrfs_tmp mount ${config.fileSystems."/".device} -t btrfs /btrfs_tmp
if [[ -e /btrfs_tmp/root ]]; then if [[ -e /btrfs_tmp/root ]]; then
@ -41,6 +53,7 @@ with lib; {
btrfs subvolume create /btrfs_tmp/root btrfs subvolume create /btrfs_tmp/root
umount /btrfs_tmp umount /btrfs_tmp
''; '';
};
assertions = [ assertions = [
{ {
assertion = hasAttr "/" config.fileSystems; assertion = hasAttr "/" config.fileSystems;