29

I think the least that distros can do, is allow listing all packages and system settings in config files like .toml rather than having to type in every single package to install, or click through system setting GUIs to setup. Would that require using a whole programming language or system like NIx?

While NixOS works much differently from most distros, that's the only reason I use it: package and system settings in text files. If I fix something, it's fixed permanently, I don't need to hunt down files in random directories if I want to change a setting. If I ever need to reinstall the OS I don't have to write dnf install every single damn package and manually setup all that up all over again. Having daily-drove Windows macOS & Fedora as throughout the years, my setups have felt hacky as well as houses of cards as I've wanted or had to set them up again (I don't mean Fedora specifically, but distros in general).

Basically it feels insane that it's the way most linux users and servers in the world operate. If I, a humble computer hobbyist can figure out Nix, why don't more users do so, and why is Nix so niche?

top 22 comments
sorted by: hot top controversial new old
[-] patatahooligan@lemmy.world 4 points 5 hours ago

I'm sure many people don't even think about that. Having to reinstall all your packages from scratch is not something they do frequently.

And for the people who are looking to optimize the initial setup, there are many ways to do it without a declarative package manager. You can:

  • Write a script for your initial setup that includes installing packages
  • Use a tool like ansible
  • Use meta-packages
  • Export your currently installed packages to a file and pass that to the package manager on the new installation
[-] krakenfury@lemmy.sdf.org 5 points 12 hours ago

Package metadata isn't stored in text files because there's an amazing technology called the database.

All you have to do is learn how to use your package manager. Spend time reading the man pages and learn the options, and you can query everything you need.

[-] callcc@lemmy.world 3 points 16 hours ago

Maybe try guix

[-] gonzo-rand19@moist.catsweat.com 12 points 1 day ago

You can backup your list of packages to .txt and install from .txt using apt so I don't really know what more you would need. I literally just did it last week to install a new distro.

[-] iopq@lemmy.world 1 points 5 hours ago

But then you need the pins and repositories you had before. I end up pasting a long ass chain of commands every time I get a VPS up just to set it up.

[-] gonzo-rand19@moist.catsweat.com 1 points 5 hours ago

You don't backup /etc/apt/sources.list.d?

[-] why0y@lemmy.ml 9 points 22 hours ago

apt list --manual-installed > ubuntu_system_pkgs.txt

[-] rnd@thebrainbin.org 6 points 1 day ago

There are some package managers that do that.

Alpine Linux's apk stores a list of required packages for the current system in a single file, /etc/apk/world. using apk add or apk del adds or removes a package from this list, then calculates how to get to that stage (adding all the dependencies, resolving conflicts...) and then installs the needed stuff (and removes the unneeded) to make it match.

The file can be edited or replaced using any other tools, then apk fix will do the same recalculation and installation/removal steps.

[-] ohulancutash@feddit.uk 13 points 1 day ago
[-] Crogdor@lemmy.ml 18 points 1 day ago

Yeah and on Arch-based systems:

Backup Packages

Back up explicitly installed package list:

pacman -Qqe > ~/packages.txt

Back up explicitly installed foreign packages list (i.e. the AUR):

pacman -Qqm > ~/foreign_packages.txt

Backup the pacman config/mirrors:

cp /etc/pacman.conf ~/pacman.conf.backup
cp -r /etc/pacman.d/ ~/pacman.d.backup

Restore Packages

Restore the pacman config/mirrors:

sudo cp ~/pacman.conf.backup /etc/pacman.conf
sudo cp -r ~/pacman.d.backup/* /etc/pacman.d/

Sync the system and update packages:

sudo pacman -Syu

Reinstall packages:

sudo pacman -S --needed - < ~/packages.txt

Reinstall foreign packages:

yay -S --needed - < ~/foreign_packages.txt
[-] Mwa@thelemmy.club 1 points 1 day ago

Can I replace yay with Paru and it still works?

[-] Crogdor@lemmy.ml 3 points 23 hours ago

Sure can! Paru is a drop-in replacement, so you can just replace yay with paru and the rest of the command remains the same.

[-] Mwa@thelemmy.club 2 points 5 hours ago
[-] enemenemu@lemm.ee 3 points 1 day ago

Sounds like it also lists all dependencies. I would only want a list of those packages that I asked for. Package manager should handle dependencies, not me.

[-] ohulancutash@feddit.uk 0 points 22 hours ago

You can filter for manually installed packages yes.

[-] juipeltje@lemmy.world 5 points 1 day ago

If i remember correctly you can pass a txt file to pacman when installing packages, but i could be wrong. There is also BlendOS, which from what i can tell has an immutable base, with a toml config on top of it to install the additional packages you want. Never tried it myself though. I also use NixOS because i wanted to be able to reproduce my riced out system more easily if i have to reinstall. I do wish this space had some more competition, because it might make this way of running a distro more approachable. The closest thing i've seen aside from guix is probably those ublue customized images that you can build, but i'm not sure how comparable that is.

[-] bushvin@lemmy.world 3 points 1 day ago

You need some ansible love in your life!

[-] atzanteol@sh.itjust.works 3 points 1 day ago

This is the way. Ansible is underrated by the self hosting community.

[-] 2xsaiko@discuss.tchncs.de 3 points 1 day ago

Gentoo can do this with Portage sets. They’re essentially a more simple way of creating a meta package which just installs other packages. And you can also write config packages which installs configuration for other packages.

[-] fhein@lemmy.world 3 points 1 day ago

If I, a humble computer hobbyist can figure out Nix, why don’t more users do so, and why is Nix so niche?

My guess as to why this isn't a more central feature of Linux distros is that this is not something most users need. If you need to reinstall the OS because you broke it, then a full system backup is probably more convenient, even if it's less than optimal to back up packages which you could download. If you need to reinstall the OS because you want a clean slate when upgrading to a new version, then your package list for the old version could cause a lot of conflicts as maintainers regularly remove and add new packages.

I have backed up my zsh, vim, tmux, etc. configs and written a few shell scripts which install them and download vim plugins etc. If I ever need to reinstall the OS I would use these. However, in the last 20 years since I ditched Windows I have reinstalled Linux exactly two times: Once because I was an idiot and didn't have a proper backup when I accidentally formatted the wrong HDD, and once when I switched from Xubuntu to Fedora in which case a package list wouldn't have been usable.

[-] iopq@lemmy.world 2 points 5 hours ago

I want to conveniently share setups between my desktop and laptop. If you do this manually you will find out one both have small differences

At the same time, I may document that this computer works better with pipewire (or with pulse, depends on which one has issues) and commit to the repository

[-] Longpork3@lemmy.nz 1 points 1 day ago

Unless I'm missing something, you can do this fairly simply already. I have a post-install script I run on all of my machines which sets up all network shares and runs 'apt install whole bunch of packages' to get things into a ready-to-roll state.

this post was submitted on 13 Jun 2025
29 points (77.4% liked)

Linux

55235 readers
1390 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 6 years ago
MODERATORS