Please roast my NixOS Config

Hi all,

In a similar vein to a previous post, I would be grateful if you guys would have a look at my NixOS config and let me know if there are improvements needed. I use OpenSUSE Tumbleweed at the moment but love NixOS and use the unstable branch to make it ‘rolling’. I haven’t quite got my config 100% so I keep chickening out when I have a huge breakage and run back to Tumbleweed. Here’s the link
My NixOS Config

Thanks everyone

Well. if the config works for you and you’re happy with it, I’m happy with it. Depends to which standards you hold yourself when it comes to configuring your OS / digital infra. Some low-hanging fruit though:

  • You could use nixfmt to format the config and keep it consistent (or pkgs.nixfmt-tree for a convenient wrapper)
  • You could use nixtamal, npins or flakes to pin your nixpkgs instead of using the dated nix-channel system. This also allows you to commit a lockfile to your repo.
  • home.nix is usually referred to as a home-managerentrypoint, but in your case it’s just another nixos module, which is really confusing.
  • The packages.nix module is a bit all over the place and longwinded. What is used for what? Why are there seemingly duplicate entries (ffmpeg_7-full and ffmpeg_8-full, gimp3 and gimp3-with-plugins). Why are there loose libraries like freetype and SDL2? Not for nix-ld since you’re not using that…
  • Nit: this line could also be using modulesPath
  • this passage in sudo.nix is really impure and insecure (especially wheelNeedsPassword = false, well it depends on who can get a hold on your system and whether it’s exposed to the internet, but you just probably shouldn’t do this)

Thanks for having a go at nixos :slight_smile:

PS: if you’d want to use flakes, you’d have to change your autoUpgrade section to:

{
  system.autoUpgrade = {
    enable = true;
    flake = "path:/etc/nixos";
    dates = "20:00";
    randomizedDelaySec = "45min";
    flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ];
  };
}
1 Like