• 0 Posts
  • 6 Comments
Joined 2 years ago
cake
Cake day: May 10th, 2023

help-circle
  • what keeps you using Nix or NixOS?

    a sort of one-man network effect?

    i wanted to load books onto my e-reader (runs NixOS) wirelessly: i already have a media server which i use for TV (Jellyfin). the e-reader speaks NFS, so i enabled NFS on my media server, added the auth to the e-reader’s Nix config, and since all my NixOS devices use the same repo for their config, my laptop and PC both get that NFS setup “for free”. incrementally, that makes everything else easier: i have a MAME arcade cabinet in the other room running Arch. if it had been running NixOS instead, suddenly that task of “load books onto my e-reader wirelessly” would have also solved the issue of “load games onto my MAME cabinet wirelessly”.

    once you get going it’s just so easy to keep building incrementally. “tech debt” is a bit less of a thing than with other distros (still a thing, just smaller) because of determinism and nix flake check and so on. honestly once i care enough about not being able to load games onto that MAME cabinet easily, i’ll solve that by flashing it with Nix, and so grows my network effect.



  • i use NixOS on my Pinephone daily, more as a PDA. it’s my primary device for music, audiobooks, podcasts, ebooks, RSS feeds and manga reading. i’m 50/50 for using it vs my iphone when it comes to IM (mostly Matrix), Lemmy, and maps.

    there’s decently mature software for all of those applications (with a big asterisk for maps); i’m surprised that bluetooth is actually super usable (with Megi’s kernel, at least). but anything touching the modem is where the dragons lie. i’m trying to get GPS working, but having to actually read the Qualcomm manuals to get the details right. ModemManager is smart enough to initialize most of the modem — so that you can use the earpiece from any userspace application — but even if you plan to use it without a cell plan you still need a SIM card for it to not fail during initialization… it doesn’t have to be activated, but still a bizarre quirk.

    anyways, NixOS will get you a working PDA if you’re a fluent user. to use it as a proper cellphone, that’s within sight if you’re dedicated but not something that you should expect to get working “in an afternoon”. btw postmarketOS is fantastic to use as a reference for how to wire all the parts together. the Nix User Repository has a few actively-deployed mobile configurations in there if you grep through it too.



  • I’m assuming by “working offline” you mean booting into a live USB

    yeah, that’s one way. more generally, “offline” = any setup where the filesystem(s) you’re modifying to be impermanent isn’t critical to running whatever shell/session you’re using to do the work. that lets you do things in any order so long as the end state’s bootable, whereas moving /nix/store on a live system can totally just crash it and leave it unbootable if you’re not careful.

    Also, is that what the Impermanence repository does on the nix-community?

    default behavior for that impermanence repo is that persisted directories are mounted as bind mounts and persisted files are symlinks. that was chosen mostly to maximize out-of-the-box compatibility with most software out there, i believe. most people mount some fs to /nix during early boot, and place their persisted data in the persist/ subdirectory of that mount. but there’s a hundred different ways to do it: the other most common way is to use subvolumes and snapshots (btrfs, but maybe zfs can do it too?): / is one subvolume, and you take a snapshot where it’s empty; /nix is a subvolume where everything gets persisted. the Impermanence config that mounts stuff from /nix/persist into where you want it looks the same as it does with a tmpfs-on-root setup, and you get impermanence by just reverting / to that original snapshot on every boot.


  • i migrated from a stock nixos deployment to an amnesiac one, without creating a totally new filesystem/install (i.e. without “deleting my entire root”). right now you have a fs mounted to /. after impermanence, you’ll mount that fs to /nix and bind-mount things from /nix/persist back to parts of the rootfs. if you can access the fs offline, then you can move /nix/* up to the root of that fs, mount it at /nix instead of / during boot, and now your system’s amnesiac. all your old state will be in /nix/… instead of where anything might expect it. move that to /nix/persist, and then start adding impermanence entries for the state you want to persist.

    you can actually do this online if you’re careful (cp /nix/* up to /, then edit the fileSystems entry so that your media is mounted at /nix, nixos-rebuild switch, cp again to make sure the new generation is in both places, reboot, delete the old store which should be visible at /nix/nix/store, then organize the persisted data as above).

    safety tips are:

    • don’t delete any files until you’re sure they’re not needed.
    • if you’re okay working offline, then prefer mving stuff into where it’s supposed to be and just undoing that if it doesn’t boot.
    • if you have to work online, then don’t move anything but copy it instead, and you’ll always be able to reboot into older, known-good generations (assuming /boot is on its own fs).
    • take notes about where you mv stuff so that you know how to undo things if you go wrong.
    • join us in the #impermanence:nixos.org Matrix channel if you’re not already there :)