Why don't most distros support listing packages and system settings in text file(s)?
from TheTwelveYearOld@lemmy.world to linux@lemmy.ml on 13 Jun 04:24
https://lemmy.world/post/31286542

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?

#linux

threaded - newest

ohulancutash@feddit.uk on 13 Jun 04:59 next collapse

But they do.

Example.

Crogdor@lemmy.ml on 13 Jun 06:10 next collapse

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 on 13 Jun 12:12 collapse

Can I replace yay with Paru and it still works?

Crogdor@lemmy.ml on 13 Jun 16:00 collapse

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 on 14 Jun 10:09 collapse

Alr thanks

enemenemu@lemm.ee on 13 Jun 08:23 collapse

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 on 13 Jun 17:31 collapse

You can filter for manually installed packages yes.

fhein@lemmy.world on 13 Jun 07:01 next collapse

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 on 14 Jun 09:54 collapse

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

juipeltje@lemmy.world on 13 Jun 07:38 next collapse

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.

2xsaiko@discuss.tchncs.de on 13 Jun 08:14 next collapse

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.

Longpork3@lemmy.nz on 13 Jun 09:08 next collapse

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.

rnd@thebrainbin.org on 13 Jun 10:29 next collapse

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.

bushvin@lemmy.world on 13 Jun 10:50 next collapse

You need some ansible love in your life!

atzanteol@sh.itjust.works on 13 Jun 12:10 collapse

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

gonzo-rand19@moist.catsweat.com on 13 Jun 13:56 next collapse

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.

why0y@lemmy.ml on 13 Jun 16:35 next collapse

apt list --manual-installed > ubuntu_system_pkgs.txt

iopq@lemmy.world on 14 Jun 09:32 collapse

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 on 14 Jun 10:29 collapse

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

iopq@lemmy.world on 15 Jun 04:14 collapse

I’d have to also back up /etc/apt/preferences.d

Much easier to just copy and paste a block of commands when I get a VPS up

[deleted] on 15 Jun 05:21 collapse

.

callcc@lemmy.world on 13 Jun 22:58 next collapse

Maybe try guix

krakenfury@lemmy.sdf.org on 14 Jun 02:59 next collapse

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.

patatahooligan@lemmy.world on 14 Jun 10:01 collapse

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