one hour, hands-on
check out the cheat sheet
demo
/demo
commands
belownix-env
package managementnix-env
update package list | sudo nix-channel --update |
|
search | nix search hello |
also try search.nixos.org/packages |
install | nix-env -iA nixos.hello |
run it with hello |
uninstall | nix-env -e hello |
running hello fails |
rollback | nix-env --rollback |
hello is back |
nix-shell
isolated environmentsnix-shell -p toilet
toilet NixOS
Ctrl+D
to exit nix-shelltoilet NixOS
failsnix-shell -p toilet --run 'toilet --gay hello'
nix-shell
on its own will load default.nix
or shell.nix
from the current directory, where you can define an environment for a project./etc/nixos/configuration.nix
services.openssh.enable = true;
before the last }
nixos-rebuild switch
to the new configurationnixos-option services.openssh.enable
to see the option's current value and documentationnixos-rebuild switch --rollback
to previous configurationlet's try a few configuration options:
services.openssh.enable = true;
ssh demo@localhost
on the vm and log in with demo
/ demo
admin
/ monit
system.autoUpgrade.enable = true;
environment.systemPackages = [ pkgs.vim pkgs.cmatrix ];
cmatrix
networking.hostName = "darkstar";
networking.firewall.allowedTCPPorts = [ 22 80 8000 ];