NixOS stuff
Uprading and cleaning up
To upgrade nixos, run nixos-rebuild as normal, but with the --upgrade switch
Running nixos-rebuild switch
causes system generations start to build up.
This increases the length of the grub menu and these generations will cause the nix
store to hang on to a bunch of older versions
of packages. To list these generations, use nix-env with the profile switch
To remove generations, use the nix-collect-garbage command as root, something like this
which will delete all generations older that 14 days. You can then use the nix-env command from above to see the shortened list.
Deploying Printers in CUPS
It's really easy to deploy printers on nixos. I make a printers.nix
file specifically with printers settings and then include it in the main
configuration.nix
file. This way you can just not include the printers
in configurations that don't need them, like servers.
{ config, lib, pkgs, modulesPath, ... }:
{
environment.systemPackages = with pkgs; [
hplip
];
services.printing.enable = true;
services.printing.drivers = [ pkgs.hplip ];
hardware.printers = {
ensurePrinters = [
{
name = "Home80-LaserJet";
description = "HP Color LaserJet M254dw";
deviceUri = "ipp://192.168.0.122/";
#model = "drv:///sample.drv/generpcl.ppd";
#model = "drv:///sample.drv/laserjet.ppd";
model = "HP/hp-color_laserjet_pro_m252-ps.ppd.gz";
}
];
};
}
sudo with no password for wheel group
Disabling the password requirement for sudo is easy. This example shows
how to do it for the wheel group. This can be pasted directly into
configuration.nix
. It's probably not a good idea.
security.sudo.extraRules= [
{ groups = [ "wheel" ];
commands = [
{ command = "ALL" ;
options= [ "NOPASSWD" ]; # "SETENV" # Adding the following could be a good idea
}
];
}
];
Great video explaining NixOS and more
Ampersand on youtube make a greate video explaining all aspects of nix.