NixOS: Difference between revisions

From Wiki :-)
Jump to navigation Jump to search
No edit summary
No edit summary
Line 11: Line 11:
=== nixos-rebuild ===
=== nixos-rebuild ===
{| class="wikitable"
{| class="wikitable"
!
!Command
!Build the configuration
!Build the configuration
!Make the default boot
!Make the default boot
Line 55: Line 55:
{| class="wikitable"
{| class="wikitable"
!Command
!Command
!
!Comments
!Comment
|-
|-
|nixos-rebuild switch --upgrade
|nixos-rebuild switch --upgrade
|Update
|Update
|nix-channel --update nixos; nixos-rebuild-switch
Equivalent to: nix-channel --update nixos; nixos-rebuild-switch
|}
|}


=== nix-channel ===
=== nix-channel ===
{| class="wikitable"
{| class="wikitable"
!
!Command
!Comments
|-
|-
|nix-channel --list
|nix-channel --list
|
|-
|-
|nix-channel --add <URL> <NAME>
|nix-channel --add <URL> <NAME>
|
|-
|-
|nix-channel --remove <NAME>
|nix-channel --remove <NAME>
|
|-
|-
|nix-channel --update <NAME>
|nix-channel --update <NAME>
|
|}
|}


=== nix-env ===
=== nix-env ===
{| class="wikitable"
{| class="wikitable"
!
!Command
!
!Comments
|-
|-
|nix-env -q
|nix-env -q

Revision as of 04:21, 14 December 2017

NixOS is an operating system based on the Linux kernel, on systemd and on the package manager nix.

  • Profile (default, user profile)
  • root -> default profile /nix/var/nix/profiles/default
    • Each Profile has a Generation (change each time the environment change with nix-env)
      • list
      • delete
      • switch
      • stored in the nix-store in xxx-user-env package

nixos-rebuild

Command Build the configuration Make the default boot Switch the running system to it Comments
nixos-rebuild switch Yes Yes Yes
nixos-rebuild test Yes No Yes
nixos-rebuild boot Yes Yes No (next reboot)
nixos-rebuild switch -p test Yes ? ? Show up in a different Grub sub-menu
nixos-rebuild build Yes No No
nixos-rebuild build-vm Yes No No Generate a Qemu image
Command Comments
nixos-rebuild switch --upgrade Update

Equivalent to: nix-channel --update nixos; nixos-rebuild-switch

nix-channel

Command Comments
nix-channel --list
nix-channel --add <URL> <NAME>
nix-channel --remove <NAME>
nix-channel --update <NAME>

nix-env

Command Comments
nix-env -q list installed derivations
nix-env -qa view the set of available packages in Nixpkgs
nix-env -qaf <path/to/nixpkg> view the set of available packages from a specific Nixpkgs folder
nix-env -qas get the status of the available package
nix-env -i <package> install the given package
nix-env -e <package> uninstall the given package
nix-env -u <package> upgrade the given package
nix-env -u upgrade all the package
nix-env -u --dry-run
nix-env --delete-generation old delete older generations
nix-env --delete-generation 10 11 12 delete generations 10 11 12
nix-env --delete-generation 10d delete generations older than 10d
nix-env -G 3 switch to the generation 3
nix-store --gc
nix-store --gc --print-dead
nix-store --gc --print-live
nix-store -q --references `which <binary>`
nix-store -q --referrers `which <binary>`
nix-collect-garbage -d
nix-env --list-generations
nix-env --switch-profile /nix/var/nix/profiles/my-profile
nix-env --rollback To switch to the previous generation