I’m trying to understand the proper way to edit configuration.nix.
Why is firefox outside of either “with pkgs”?
thunderbird is in the user section because that makes sense.
users.users.chris" = {
isNormalUser = true;
description = "Christopher";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
thunderbird
];
};
I put the rest in environment.systemPackages = with pkgs; [ so sudo could use them too.
environment.systemPackages = with pkgs; [
pkgs.libreoffice-qt
hunspell
hunspellDicts.en_CA
];
But firefox was installed by the install program for xfce between those two “with pkgs” blocks as;
#Install firefox.
programs.firefox.enable = true;
Isn’t firefox a package? Why is it like that?
Thanks. just asking.
Programs which ONLY need their binaries to be available can be installed by listing them in environment.systemPackages. All other programs (which fortunately is not that many) - i.e., programs which need other things to be set up before they’ll work well - need to be in programs(or have their own options at the same level as programs, like for example systemd). That way they can use a wrapper script. (You can generally also use them without a wrapper script if you really want to - for example, there is environment.systemPackages.pkgs.firefox-unwrapped. You don’t want to though!)
I’m not the best person to ask about what the wrapper script for firefox does, but I think you were after that general answer which also applies to other programs?
There’s been lots of discussion about how to find out which programs are in which category, but there isn’t a complete solution to that problem yet, so it’s best for any big program to start by seeing whether it has an option under programs and, if it does, use that.
thunderbird is in the user section because that makes sense.
Putting it in the users section sequesters it from other users. That may indeed make sense, but it’s a completely separate issue from the issue about some programs needing to be under programs.
You can check the source code of the Firefox module here. Looks like it’s mostly installing and wrapping with autoconfig (like GitHub - MrOtherGuy/fx-autoconfig: Load custom javascript in browser context · GitHub) and native messaging hosts, and adding system-wide policies to /etc.
nixpkgs/nixos/modules/programs/firefox.nix at a6adde9f45e0ed3717c9c3cc1d1c0a257aee262e · NixOS/nixpkgs · GitHub