Advertisement

nix-on-leap-osc22.pdf

Jun. 2, 2022
Advertisement

More Related Content

Advertisement

nix-on-leap-osc22.pdf

  1. Nix: Bleeding-edge Packages on a Stable Base System Peter Simons <psimons@suse.com> openSUSE Conference 2022
  2. What is Nix? ▶ Distribution-agnostic Package Manager ▶ Nixpkgs Collection offers over 60,000 packages ▶ Builds are highly reproducible ▶ Builds are declarative ▶ NixOS exists of you want to go all in
  3. How to install Nix? ▶ Details are at https://nixos.org/download.html. ▶ Multi-user: sh <(curl -L https://nixos.org/nix/install) --daemon ▶ Single-user: sh <(curl -L https://nixos.org/nix/install) --no-daemon
  4. Install a Package ▶ nix-env -iA nixpkgs.rsync ▶ nix-shell --run zsh -p rsync ▶ nix-collect-garbage --delete-old
  5. All Files Live Under /nix /nix +-- store | +-- 49rdlgcawlf8xcp4g1n3phkbl31l4zfg-xz-5.2.5-bin | | +-- bin | | +-- xz | +-- 5b0k0zxvbhrybg2ynqk26cpzwb1xqa7i-xz-5.2.5-dev | | +-- include | | | +-- lzma | | | | +-- base.h | | +-- lib | | | +-- pkgconfig | | | +-- liblzma.pc
  6. All Files Live Under /nix /nix +-- store | +-- 46yqxs10fc5jbc7srkjxmahibd4313qp-xz-5.2.5-man | | +-- share | | +-- man | | +-- man1 | | +-- xz.1.gz | +-- 4fxqh6ggs5kwjr5fyg10k4yv6861p5hv-xz-5.2.5-doc | | +-- share | | +-- doc | | +-- xz | | +-- xz-file-format.txt
  7. All Files Live Under /nix /nix +-- var +-- nix +-- db | +-- db.sqlite +-- gcroots | +-- auto | +-- per-user | | +-- simons | +-- profiles -> /nix/var/nix/profiles +-- profiles | +-- per-user | +-- simons | +-- profile -> profile-2-link | +-- profile-1-link | +-- profile-2-link
  8. Store Paths Are Symlinked into a Profile $ nix-env -iA nixpkgs.xz.{bin,dev,man,doc} -p foo $ ls -l foo* lrwxrwxrwx simons foo -> foo-2-link lrwxrwxrwx simons foo-1-link -> /nix/store/gvydyd...-user-environment lrwxrwxrwx simons foo-2-link -> /nix/store/zxqcr3...-user-environment
  9. Garbage Collection Prunes Unreferenced Store Paths $ rm foo* $ nix-collect-garbage removing stale link ’/nix/var/nix/gcroots/auto/5jfkq... to ’foo-1-link’ removing stale link ’/nix/var/nix/gcroots/auto/pxah0... to ’foo-2-link’ deleting garbage... deleting ’/nix/store/zxqcr3igbnhpii1vn5g0hhjp0h1c8wq9-user-environment’ deleting ’/nix/store/gvydydb5qgsbj9gccdcxpacr0y0cwyyq-user-environment’ deleting ’/nix/store/mznyq8xfs3p0m0zhm4i9yd98qbyfvq6w-xz-5.2.5-man’ deleting ’/nix/store/9rncbp7097hd9paj7ziq42zbdf166ncm-xz-5.2.5-doc’ deleting ’/nix/store/15c2r210g2qvhsr1sm24axh5iif0jhgv-xz-5.2.5-dev’ 9 store paths deleted, 0.39 MiB freed
  10. Query the Nix Packages Collection $ nix-env -qaP "coreuti.*" nixpkgs.coreutils coreutils-9.0 nixpkgs.coreutils-prefixed coreutils-9.0 nixpkgs.coreutils-full coreutils-full-9.0 $ nix-env -qaP -A nixpkgs.haskell.compiler nixpkgs.haskell.compiler.ghc884 ghc-8.8.4 nixpkgs.haskell.compiler.ghc8107 ghc-8.10.7 nixpkgs.haskell.compiler.ghc902 ghc-9.0.2 nixpkgs.haskell.compiler.ghc922 ghc-9.2.2 nixpkgs.haskell.compiler.ghcHEAD ghc-9.3.20220406
  11. Resources ▶ Homepage: https://nixos.org/ ▶ Nix Package Manager Manual: https://nixos.org/manual/nix/stable/ ▶ Code of the Nix Packages Collection: https://github.com/NixOS/nixpkgs ▶ Using the Nix Packages Collection: https://nixos.org/manual/nixpkgs/stable/
Advertisement