you are viewing a single comment's thread
view the rest of the comments
[–] 24 points 2 days ago (10 children)

Try NixOS + impermanence, where every reboot is a fresh install!

  • source
  • hideshow 10 child comments
  • [–] 1 point 2 days ago (8 children)

    Is that skmilar to Fedora Silverblue?

  • source
  • parent
  • hideshow 8 child comments
  • [–] 9 points 2 days ago* (last edited 2 days ago) (7 children)

    Eh, kinda but a lot more flexible.

    It basically just gives you a declarative language to build your own distro with, plus a bunch of pre-made packages/modules you can then configure and assemble into what you need. The end result of what you are building will be a script that (re)installs your entire OS (called "activation" in NixOS parlance). That OS will have a lot of immutable parts, similar to Silverblue, but you can easily change anything in your install by modifying the original declarative configuration, rebuilding it, and then re-running the activation script.

    That activation script can configure literally everything on your system, from bootloader to init to networking to services to your WM to app config. Mine even sets up the exact Librewolf UI layout. This means that when I get a new machine, I can just take the same config, add some hardware-specific stuff, and get my full work environment in minutes.

    Impermanence takes it a step further, where your entire root filesystem will be wiped on shutdown to be recreated by that activation script during boot, except for the files and directories you explicitly tell it to keep on disk. This means you can control exactly where your apps keep their state and how much of it is there, which is handy for backups and also keeps your system feeling fresh.

    Basically, here's what my mount looks like:

    none on / type tmpfs (rw,relatime,size=4194304k,mode=755)
    /dev/nvme0n1p2 on /persist type ext4 (rw,relatime)
    /dev/nvme0n1p2 on /var/lib/nixos type ext4 (rw,relatime)
    /dev/nvme0n1p2 on /nix type ext4 (rw,relatime)
    /dev/nvme0n1p2 on /nix/store type ext4 (ro,nosuid,nodev,relatime,x-initrd.mount)
    /dev/nvme0n1p2 on /etc/machine-id type ext4 (rw,relatime)
    /dev/nvme0n1p2 on /home/balsoft/.config/kdeconnect type ext4 (rw,relatime)
    /dev/nvme0n1p2 on /home/balsoft/.config/nheko type ext4 (rw,relatime)
    /dev/nvme0n1p2 on /etc/ssh type ext4 (rw,relatime)
    /dev/nvme0n1p2 on /etc/NetworkManager/system-connections type ext4 (rw,relatime)
    /dev/nvme0n1p2 on /home/balsoft/.config/JOSM type ext4 (rw,relatime)
    /dev/nvme0n1p2 on /home/balsoft/.librewolf/default type ext4 (rw,relatime)
    /dev/nvme0n1p2 on /home/balsoft/.local/share/JOSM type ext4 (rw,relatime)
    /dev/nvme0n1p2 on /home/balsoft/.local/share/cargo type ext4 (rw,relatime)
    <...>
    

    So, I have a list of directories which will be kept on-disk, and the root filesystem (including /home) is just a tmpfs which is destroyed on shutdown.

  • source
  • parent
  • hideshow 7 child comments
  • [–] 1 point 2 days ago (6 children)

    Read-only Nix store? How does that work?

  • source
  • parent
  • hideshow 6 child comments
  • [–] 4 points 2 days ago (5 children)

    It's mounted twice, ro for the world and rw in the daemon mount namespace

  • source
  • parent
  • hideshow 5 child comments
  • [–] 3 points 2 days ago (1 child)

    ah that's cool! When your mount has the same partition for different mountpoints how does that work? Some kind of bind-mount?

  • source
  • parent
  • hideshow 1 child comment
  • [–] 2 points 1 day ago* (last edited 1 day ago)

    Yep, it's all bind mounts from /persist/<path> to /<path> where /persist is the actual root of the storage device.

    While setting this up, I was surprised to learn that you can just bind mount files and it works, in my mind it was only supposed to work on directories.

  • source
  • parent
  • [–] 2 points 2 days ago (2 children)

    And everything in there is referenced by hash, so it's actually a little bit of work to inject something in there without your express written consent :)

  • source
  • parent
  • hideshow 2 child comments