All Projects → brainrape → nixos-tutorial

brainrape / nixos-tutorial

Licence: other
one hour, hands-on

Programming Languages

Nix
1067 projects

Projects that are alternatives of or similar to nixos-tutorial

nix-portable
Nix - Static, Permissionless, Installation-free, Pre-configured
Stars: ✭ 356 (+201.69%)
Mutual labels:  nix, nixos, package-management
Workshops
Stars: ✭ 47 (-60.17%)
Mutual labels:  nix, nixos, operating-system
triton
Triton Operating System
Stars: ✭ 56 (-52.54%)
Mutual labels:  nix, nixos, operating-system
digga
A flake utility library to craft shell-, home-, and hosts- environments.
Stars: ✭ 818 (+593.22%)
Mutual labels:  nix, nixos
flake-utils-plus
Use Nix flakes without any fluff.
Stars: ✭ 280 (+137.29%)
Mutual labels:  nix, nixos
nix2container
An archive-less dockerTools.buildImage implementation
Stars: ✭ 133 (+12.71%)
Mutual labels:  nix, nixos
nix-tutorials
Tutorials for Nix and Nixpkgs. Note so far it is a proof of concept.
Stars: ✭ 23 (-80.51%)
Mutual labels:  nix, nixos
nixops-tutorial
Tutorial for practical deployments with NixOps
Stars: ✭ 93 (-21.19%)
Mutual labels:  nix, nixos
dotnix
nix stuff
Stars: ✭ 27 (-77.12%)
Mutual labels:  nix, nixos
nix-rice
A library to functionally define your configuration and theme (rice) with Nix
Stars: ✭ 43 (-63.56%)
Mutual labels:  nix, nixos
myconfig
my Linux Configuration
Stars: ✭ 23 (-80.51%)
Mutual labels:  nix, nixos
system
The system configuration of a professional yak shaver
Stars: ✭ 42 (-64.41%)
Mutual labels:  nix, nixos
base16.nix
Quickly theme programs in your favourite base16 colorscheme
Stars: ✭ 61 (-48.31%)
Mutual labels:  nix, nixos
dotfiles
Dotfiles
Stars: ✭ 25 (-78.81%)
Mutual labels:  nix, nixos
nixdots
I have no idea what the hell I'm doing
Stars: ✭ 46 (-61.02%)
Mutual labels:  nix, nixos
nixpkgs
Nix Packages collection used in Nubank
Stars: ✭ 24 (-79.66%)
Mutual labels:  nix, nixos
nix-config
My personal nix config
Stars: ✭ 32 (-72.88%)
Mutual labels:  nix, nixos
dotfiles
🏠
Stars: ✭ 53 (-55.08%)
Mutual labels:  nix, nixos
emergency-kexec
Kexec into an in-memory emergency system
Stars: ✭ 21 (-82.2%)
Mutual labels:  nix, nixos
nix-home
A Nix Home Manager setup. I've now moved to a new configuration system at hugoreeves/elemental
Stars: ✭ 60 (-49.15%)
Mutual labels:  nix, nixos

check out the cheat sheet

outline

  • setup (5m)
  • nix-env package management (10m)
  • nix-shell isolated environments (10m)
  • NixOS declarative operating system configuration
    • introduction (5m)
    • service (5m)
    • network (5m)
    • user (5m)
  • conclusion (5m)

setup

nix-env package management

  • each user has a nix profile, pointing to the current user environment, that is a set of installed packages, managed via nix-env
  • only trusted channels are used by default, so updating the package lists is the only operation requiring root.
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 environments

  • start a shell in an environment with some packages available, and run some commands in it:
    • nix-shell -p toilet
      • toilet NixOS
      • Ctrl+D to exit nix-shell
      • toilet NixOS fails
  • start a shell with packages and run a command in it:
    • nix-shell -p toilet --run 'toilet --gay hello'
  • try a python example
  • 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.

NixOS declarative operating system configuration

  • edit /etc/nixos/configuration.nix
    • eg. add services.openssh.enable = true; before the last }
  • nixos-rebuild switch to the new configuration
  • nixos-option services.openssh.enable to see the option's current value and documentation
  • find the option on search.nixos.org/options, click the result, click the link after "Declared in:" and see The Source
  • nixos-rebuild switch --rollback to previous configuration

let's try a few configuration options:

service

system

user

network

  • networking.hostName = "darkstar";
  • networking.firewall.allowedTCPPorts = [ 22 80 8000 ];

conclusion

  • declarative - say what you want, not how to get there
  • safe (atomic, rollback, isolated, consistent, hash-checked)
  • reliable (deterministic, reproducible)
  • fast (lazy, hash-based store, binary cache)
  • great for repeatable builds and declarative operating system configuration

learn more

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].