NixOS: Difference between revisions

From Wiki :-)
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
NixOS is an operating system based on the Linux kernel, on systemd and on the package manager nix.
* Profile (default, user profile)
* Profile (default, user profile)
* root -> default profile <code>/nix/var/nix/profiles/default</code>
* root -> default profile <code>/nix/var/nix/profiles/default</code>
Line 6: Line 8:
*** switch
*** switch
*** stored in the nix-store in xxx-user-env package
*** stored in the nix-store in xxx-user-env package
=== nixos-rebuild ===
{| class="wikitable"
{| class="wikitable"
!
!
Line 48: Line 52:
|No
|No
|Generate a Qemu image
|Generate a Qemu image
|-
|
|
|
|
|
|}
|}
{| class="wikitable"
{| class="wikitable"
Line 59: Line 57:
!
!
!Comment
!Comment
!
|-
|-
|nixos-rebuild switch --upgrade
|nixos-rebuild switch --upgrade
|Update
|Update
|nix-channel --update nixos; nixos-rebuild-switch
|nix-channel --update nixos; nixos-rebuild-switch
|
|-
|
|
|
|
|-
|
|
|
|
|}
|}
=== nix-channel ===
{| class="wikitable"
{| class="wikitable"
!
!
!
!
!
|-
|-
|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 ===
{| class="wikitable"
{| class="wikitable"
!
!
!
!
!
!
Line 110: Line 83:
|nix-env -q
|nix-env -q
|list installed derivations
|list installed derivations
|
|
|-
|-
|nix-env -qa
|nix-env -qa
|view the set of available packages in Nixpkgs
|view the set of available packages in Nixpkgs
|
|
|-
|-
|nix-env -qaf <path/to/nixpkg>
|nix-env -qaf <path/to/nixpkg>
|view the set of available packages from a specific Nixpkgs folder
|view the set of available packages from a specific Nixpkgs folder
|
|
|-
|-
|nix-env -qas
|nix-env -qas
|get the status of the available package
|get the status of the available package
|
|
|-
|-
|nix-env -i <package>
|nix-env -i <package>
|install the given package
|install the given package
|
|
|-
|-
|nix-env -e <package>
|nix-env -e <package>
|uninstall the given package
|uninstall the given package
|
|
|-
|-
|nix-env -u <package>
|nix-env -u <package>
|upgrade the given package
|upgrade the given package
|
|
|-
|-
|nix-env -u
|nix-env -u
|upgrade all the package
|upgrade all the package
|
|
|-
|-
|nix-env -u --dry-run
|nix-env -u --dry-run
|
|
|
|
|-
|-
|nix-env --delete-generation old
|nix-env --delete-generation old
|delete older generations
|delete older generations
|
|
|-
|-
|nix-env --delete-generation 10 11 12
|nix-env --delete-generation 10 11 12
|delete generations 10 11 12
|delete generations 10 11 12
|
|
|-
|-
|nix-env --delete-generation 10d
|nix-env --delete-generation 10d
|delete generations older than 10d
|delete generations older than 10d
|
|
|-
|-
|nix-env -G 3
|nix-env -G 3
|switch to the generation 3
|switch to the generation 3
|
|
|-
|-
|nix-store --gc
|nix-store --gc
|
|
|
|
|-
|-
|nix-store --gc --print-dead
|nix-store --gc --print-dead
|
|
|
|
|-
|-
|nix-store --gc --print-live
|nix-store --gc --print-live
|
|
|
|
|-
|-
|nix-store -q --references `which <binary>`
|nix-store -q --references `which <binary>`
|
|
|
|
|-
|-
|nix-store -q --referrers `which <binary>`
|nix-store -q --referrers `which <binary>`
|
|
|
|
|-
|-
|nix-collect-garbage -d
|nix-collect-garbage -d
|
|
|
|
|-
|-
|nix-env --list-generations
|nix-env --list-generations
|
|
|
|
|-
|-
|nix-env --switch-profile /nix/var/nix/profiles/my-profile
|nix-env --switch-profile /nix/var/nix/profiles/my-profile
|
|
|
|
|-
|-
|nix-env --rollback
|nix-env --rollback
|To switch to the previous generation
|To switch to the previous generation
|
|
|}
|}

Revision as of 04:20, 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

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 Comment
nixos-rebuild switch --upgrade Update nix-channel --update nixos; nixos-rebuild-switch

nix-channel

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

nix-env

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