jabranham / system-packages

Moved to gitlab
https://gitlab.com/jabranham/system-packages
GNU General Public License v3.0
39 stars 12 forks source link

Commands for declarative package state and configuration #26

Open piotr-yuxuan opened 6 years ago

piotr-yuxuan commented 6 years ago

Hi, thank you for this package, it's rather appealing!

This is more a question than an issue, which you can close if you find it too out of topic. Do you think it would be a good idea to add some commands to dump package system state (installed packages, repositories, versions) to some file? Then we could diff current state and expected state and execute commands to mute the current state and make it equal to expected one.

(well, actually this question is related to stateful package manager, like homebrew for macOS)

References:

jabranham commented 6 years ago

I'm not sure I understand what you mean. Package configuration is outside the scope of system-packages.el. Or do you mean ensuring that certain packages are installed on the system? If so, you might want to take a look at use-package.el, which includes the :ensure-system-package keyword.

Alternatively, you could do something like:

(unless (executable-find "mu") (system-packages-install "mu"))

On Thu 05 Apr 2018 at 06:10, 胡雨軒 Петр notifications@github.com wrote:

Hi, thank you for this package, it's rather appealing!

This is more a question than an issue, which you can close if you find it too out of topic.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

piotr-yuxuan commented 6 years ago

Yeah, sorry I have been unclear. To make it less confusing, let's say I use brew on my macOS to install programs or apps. Is there any way to tell system-packages which programs or apps are to be installed, and install them if they are missing? Just like Nix which allows you to describe which programs and apps you want on your computer, and it takes care of that for you.

jabranham commented 6 years ago

Ah, gotcha. I was responding to the email and didn't see the edits you made to your first comment.

I'd say checking for a particular package version isn't possible. Most ditros don't keep older package versions around on their mirrors, so once they've updated to foo-1.1, if we tried to install foo-1.0, we'd get an error. Nix and Guix are special in that they're specifically designed to be able to functionally describe the state of an entire system. Doing something like that just isn't possible with apt, brew, or pacman.

I think the best we can do is to tell whether or not a particular package is currently installed, and even that is complicated because package names vary across distros (see also #24). I'll add a command soon that will make this a little easier than the unless ... statement I described above.