mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-01-31 04:58:21 +00:00
37 lines
18 KiB
HTML
37 lines
18 KiB
HTML
|
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width"/><meta charSet="utf-8"/><title>Nix package manager</title><script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script><script id="MathJax-script" async="" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script><script type="text/x-mathjax-config">
|
||
|
MathJax = {
|
||
|
tex: {
|
||
|
inlineMath: [ ['$','$'], ['\(','\)'] ],
|
||
|
displayMath: [ ['$$','$$'], ['[',']'] ]
|
||
|
},
|
||
|
options = {
|
||
|
processHtmlClass = "math"
|
||
|
}
|
||
|
}
|
||
|
</script><meta name="next-head-count" content="6"/><link rel="preload" href="/wiki/_next/static/css/52fc2ba29703df73922c.css" as="style"/><link rel="stylesheet" href="/wiki/_next/static/css/52fc2ba29703df73922c.css" data-n-g=""/><noscript data-n-css=""></noscript><link rel="preload" href="/wiki/_next/static/chunks/main-ae4733327bd95c4ac325.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/webpack-50bee04d1dc61f8adf5b.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/framework.9d524150d48315f49e80.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/commons.0e1c3f9aa780c2dfe9f0.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/pages/_app-8e3d0c58a60ec788aa69.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/940643274e605e7596ecea1f2ff8d83317a3fb76.4841a16762f602a59f00.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/pages/%5B%5B...slug%5D%5D-1aa198f87ede1cd0e1dc.js" as="script"/></head><body><div id="__next"><main><h1>Nix package manager</h1><section class="post-metadata"><span>Date: <!-- -->2021-06-05 12:34:49 +08:00</span><span>Date modified: <!-- -->2021-07-28 16:31:56 +08:00</span></section><nav class="toc"><ol class="toc-level toc-level-1"><li class="toc-item toc-item-h1"><a href="/wiki/tools.nix#ecosystem" class="toc-link toc-link-h1">Ecosystem</a></li><li class="toc-item toc-item-h1"><a href="/wiki/tools.nix#components-of-the-package-manager" class="toc-link toc-link-h1">Components of the package manager</a></li></ol></nav><p><a href="https://nixos.org/">Nix</a> is a package manager that pioneered <a href="/wiki/2020-09-19-08-31-48">Functional package management</a> which addresses the criticisms of traditional Unix systems while making it as a specialized tool for <a href="/wiki/2020-09-14-10-46-15">Reproducible builds</a>.
|
||
|
It features a handrolled configuration language (also called Nix) that leans into functional paradigm, making it easier if you have experience on it.
|
||
|
A popular tool mostly featured in Haskell programming projects.
|
||
|
</p><p>Eventually inspired GNU to create a fork, <a href="/wiki/2020-08-19-08-21-44">Guix package manager</a>, that takes it to another direction with more focus on reproducibility and its extensions such as bootstrapping.
|
||
|
</p><p>Among other things, Nix also has the following features to look out for.
|
||
|
</p><ul><li><p>Creating <a href="/wiki/tools.nix.reproducible-executables">Reproducible executables with Nix</a> enabling to execute with one script only requiring the package manager.
|
||
|
</p></li><li><p>How the build process works along with <a href="/wiki/tools.nix.derivations">Nix derivations</a>.
|
||
|
</p></li><li><p>With <a href="/wiki/tools.nix.overrides-and-overlays">Nix overrides and overlays</a>, you can change parts of a system and/or packages.
|
||
|
</p></li><li><p>The new way to manage channels with <a href="/wiki/tools.nix.flakes">Nix flakes</a>.
|
||
|
</p></li><li><p>How <a href="/wiki/packages.nix">Nix packages</a> are built and eventually created an extensive package ecosystem with the <a href="/wiki/lang.nix">Nix language</a>.
|
||
|
</p></li></ul><h1 id="ecosystem">Ecosystem</h1><p>The basic ropes into getting started with Nix.
|
||
|
</p><ul><li><p><a href="https://github.com/NixOS/nixpkgs">nixpkgs</a> is the official package set similar to Flathub for Flatpak.
|
||
|
In terms of size, nixpkgs is comparable to AUR.
|
||
|
</p></li><li><p><a href="https://github.com/nix-community/NUR">NUR</a> is the user-contributed Nix packages curated by the community.
|
||
|
While most of the packages can be passed into nixpkgs, most of them are niche packages (or the package author are not interested in maintaining it).
|
||
|
</p></li><li><p><a href="https://direnv.net/">direnv</a> has <a href="https://github.com/direnv/direnv/wiki/Nix">integration with Nix</a> as well as a lot of editors.
|
||
|
</p></li><li><p><a href="https://github.com/nix-community/lorri">lorri</a> replaces nix-shell integrating with direnv.
|
||
|
</p></li><li><p><a href="https://github.com/nmattia/niv">niv</a> provides a easier way to manage dependencies though it will be easier with Nix flakes.
|
||
|
</p></li><li><p><a href="/wiki/tools.nix.flakes">Nix flakes</a> is an upcoming feature for Nix, replacing the traditional Nix channels into a decentralized set of derivations that can be retrieved from anywhere similar to Go modules <!-- -->.
|
||
|
</p></li><li><p><a href="https://cachix.org/">Cachix</a> is a cache service enabling to easily distribute binaries built with Nix.
|
||
|
</p></li><li><p><a href="https://github.com/divnix/devos">DevOS</a> is a configuration framework for deploying NixOS-based systems.
|
||
|
</p></li></ul><h1 id="components-of-the-package-manager">Components of the package manager</h1><p>Holistically, Nix is made up of at least four components: the store, the language, the derivations, and the sandbox.
|
||
|
</p><ul><li><p>The store is a immutable centralized location where all of the outputs are placed.
|
||
|
</p></li><li><p>The derivations are essentially build instructions.
|
||
|
</p></li><li><p><a href="/wiki/lang.nix">Nix language</a> is a domain-specific language for creating derivations.
|
||
|
</p></li><li><p>The build process can be locked in a sandbox, improving the reproducibility of a setup and lowering the attack surface for a malicious package.
|
||
|
</p></li></ul><section><h2>Backlinks</h2><ul><li><a href="/wiki/2020-08-19-08-21-44">Guix package manager</a></li><li><a href="/wiki/2020-09-13-19-42-06">Common problems with software packaging</a></li><li><a href="/wiki/2020-09-19-08-31-48">Functional package management</a></li><li><a href="/wiki/2021-08-28-23-55-24">Openness makes diversity</a></li><li><a href="/wiki/cloud.github-actions">GitHub Actions</a></li><li><a href="/wiki/data.archives.software-heritage">Software Heritage</a></li><li><a href="/wiki/data.software-archives">Software archives</a></li><li><a href="/wiki/lang.nix">Nix language</a></li><li><a href="/wiki/linux.distros.nixos">NixOS</a></li><li><a href="/wiki/literature.courtesPackagingGrail2021">The Packaging Grail</a></li><li><a href="/wiki/packages.nix">Nix packages</a></li></ul></section></main></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"metadata":{"date":"\"2021-06-05 12:34:49 +08:00\"","date_modified":"\"2021-07-28 16:31:56 +08:00\"","language":"en","source":""},"title":"Nix package manager","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"ecosystem"},"children":[{"type":"text","value":"Ecosystem"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/tools.nix#ecosystem"},"children":[{"type":"text","value":"Ecosystem"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"components-of-the-package-manager"},"children":[{"type":"text","value":"Components of the package manager"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/tools.nix#components-of-the-package-manager"},"children":[{"type":"text","value":"Components of the package manager"}]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"a","properties":{"href":"https://nixos.org/"},"children":[{"type":"text","value":"Nix"}]},{"type":"text","value":" is a package manager that pioneered "},{"type":"element","tagName":"a","properties":{"href":"/2020-09-19-08-31-48"},"children":[{"type":"text","value":"Functional package management"}]},{"type":"text","value":" which addresses the criticisms of traditional Unix systems while making it as a specialized tool for "},{"type":"element","tagName":"a","properties":{"href":"/2020-09-14-10-46-15"},"children":[{"type":"text","value":"Reproducible builds"}]},{"type":"text","value":".\nIt features a handrolled configuration language (also called Nix) that leans into functional paradigm, making it easier if you have experience on it.\nA popular tool mostly featured in Haskell programming projects.\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Eventually inspired GNU to create a fork, "},{"type":"element","tagName":"a","properties":{"href":"/2020-08-19-08-21-44"},"children":[{"type":"text","value":"Guix package manager"}]},{"type":"text","value":", that takes it to another direction with more focus on reproducibility and its extensions such as bootstrapping.\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Among other things, Nix also has the following features to look out for.\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Creating "},{"type":"element","tagName":"a","properties":{"href":"/tools.nix.reproducible-executables"},"children":[{"type":"text","value":"Reproducible executables with Nix"}]},{"type":"text","value":" enabling to execute with one script on
|