this post was submitted on 07 Jul 2023
336 points (96.2% liked)
linuxmemes
21448 readers
746 users here now
Hint: :q!
Sister communities:
Community rules (click to expand)
1. Follow the site-wide rules
- Instance-wide TOS: https://legal.lemmy.world/tos/
- Lemmy code of conduct: https://join-lemmy.org/docs/code_of_conduct.html
2. Be civil
- Understand the difference between a joke and an insult.
- Do not harrass or attack members of the community for any reason.
- Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
- Bigotry will not be tolerated.
- These rules are somewhat loosened when the subject is a public figure. Still, do not attack their person or incite harrassment.
3. Post Linux-related content
- Including Unix and BSD.
- Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of
sudo
in Windows. - No porn. Even if you watch it on a Linux machine.
4. No recent reposts
- Everybody uses Arch btw, can't quit Vim, and wants to interject for a moment. You can stop now.
Please report posts and comments that break these rules!
Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't fork-bomb your computer.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
No,
nix-env
installs to your user environment, which thenixos-rebuild
command barely touches. It doesn't touch the global configuration file. In fact you can even manage user accounts imperatively.My approach is the following: try a program using
nix run
(ornix-shell
, depending on the case) and if it does what I want, add it to my configuration andnixos-rebuild test
. It will then be available permanently on next update.What I also do is keep all nix-related files in a git repository under main user control and have the
flake.nix
(if using flakes, otherwiseconfiguration.nix
) soft linked into/etc/nixos
. This also enables rollback on your configuration, not only on the actual system state.I agree that each package takes more time, but OTOH, you save a lot of time and effort in the longer run. Also I don't really have that high fluctuation of packages that it actually matters.
home-manager
is a bit in a weird spot in my opinion as in it's not very clear how it should be installed. If it's a NixOS module, your changes will only be applied during rebuild - which only root can trigger. But if you're already triggering those as root, you might as well as the packages globally. I generally install globally and configure the options usinghome-manager
.Sounds great, but I don't like editing a config file every time I want to install an app,.
Alright, if that's too much of a hassle you shouldn't switch. I'm unaware how to do all of that in one step on the command line. All I can say is that the last time I added programs to the array was two weeks ago. So the workload is negligible… on the other hand, on Arch, when installing something new that you then decide not to keep, you need to track the dependencies that you no longer need (
pacman -Rs $(pacman -Qqdt)
) if I'm not mistaken.Also, the amount of work saved depends on what you're installing: let's say you install OpenSSH on your machine. On NixOS, that's editing about six lines in my configuration and then rebuilding. On Arch, that's
So you have double the configuration files to be edited and triple the commands to be ran, while during all of this, nix actually does the thinking for you (e.g. you change a port in your OpenSSH config -> the firewall configuration is updated automatically).
Sounds neat. I am really considering NixOS, that's why I'm asking for advice here. It really sounds like a nice and more convenient distro. Sadly, I still haven't figured out how to make my own builders, even after Nix Pills. Thankfully, programs like crate2nix exist.
Do you want to create your own builder or create derivations?
create derivations