mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-02-25 15:19:00 +00:00
1 line
7.3 KiB
JSON
1 line
7.3 KiB
JSON
{"pageProps":{"metadata":{"date":"2021-07-18 21:23:26 +08:00","date_modified":"2021-12-12 23:48:08 +08:00","language":"en","source":""},"title":"Nix packages","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":"ecosystems"},"children":[{"type":"text","value":"Ecosystems"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/packages.nix#ecosystems"},"children":[{"type":"text","value":"Ecosystems"}]}]}]}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"the most important component managed with "},{"type":"element","tagName":"a","properties":{"href":"/tools.nix"},"children":[{"type":"text","value":"Nix package manager"}]},{"type":"text","value":" are "},{"type":"element","tagName":"a","properties":{"href":"/tools.nix.derivations"},"children":[{"type":"text","value":"Nix derivations"}]}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"derivations are basically recipes how the Nix build daemon compiles the package\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"most derivations are verbose but we can easily create one with nixpkgs\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"for certain setups such as common conventions for certain programming languages like Rust and Go, nixpkgs has "},{"type":"element","tagName":"a","properties":{"href":"https://nixos.org/manual/nixpkgs/unstable/#chap-language-support"},"children":[{"type":"text","value":"environments created for those"}]},{"type":"text","value":";\n different versions may have changes so be sure to go into the appropriate documentation and create packages for a specific channel;\n this is significantly easier with "},{"type":"element","tagName":"a","properties":{"href":"/tools.nix.flakes"},"children":[{"type":"text","value":"Nix flakes"}]}]}]}]},{"type":"element","tagName":"h1","properties":{"id":"ecosystems"},"children":[{"type":"text","value":"Ecosystems"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"while derivations can be interacted with the builtin function "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"builtins.derivation"}]},{"type":"text","value":", it isn't really recommended since it is very verbose;\n instead, you use "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"stdenv.mkDerivation"}]},{"type":"text","value":" from nixpkgs\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"nixpkgs is the official repository of NixOS containing the standard library extending the "},{"type":"element","tagName":"a","properties":{"href":"/lang.nix"},"children":[{"type":"text","value":"Nix language"}]},{"type":"text","value":", the largest repository of packages (counting up to 80,000 as of 2021-12-12), and various NixOS modules used to build the system itself\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"nixpkgs contains "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"stdenv"}]},{"type":"text","value":" which is a derivation meant to be a base for other packages\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"stdenv contains base packages that virtually all packages have (inside nixpkgs)\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[]}]}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"stdenv.mkDerivation"}]},{"type":"text","value":" is a convenient way of creating derivations;\n however, it is very abstract and a lot of events happening around it\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"this is a function that accepts a large attribute set\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"it will map its arguments corresponding to a parameter in the final derivation made with "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"stdenv"}]},{"type":"text","value":" (which is a shell script)\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"attributes are usually just variables;\n this is especially prevelant if\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"packages can also set setup hooks (i.e., "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"setupHook"}]},{"type":"text","value":") that are essentially shell scripts to be added in the final derivation\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"example: "},{"type":"element","tagName":"a","properties":{"href":"https://github.com/NixOS/nixpkgs/tree/nixos-21.11/pkgs/development/tools/build-managers/cmake"},"children":[{"type":"text","value":"cmake"}]},{"type":"text","value":", "},{"type":"element","tagName":"a","properties":{"href":"https://github.com/NixOS/nixpkgs/tree/nixos-21.11/pkgs/development/libraries/glib"},"children":[{"type":"text","value":"glib"}]},{"type":"text","value":", and "},{"type":"element","tagName":"a","properties":{"href":"https://github.com/NixOS/nixpkgs/tree/nixos-21.11/pkgs/development/tools/build-managers"},"children":[{"type":"text","value":"most of the build systems at nixpkgs"}]}]}]}]}]}]}]}]}]},"backlinks":[{"path":"/packages.flatpak","title":"Flatpak packages"},{"path":"/tools.nix","title":"Nix package manager"}]},"__N_SSG":true} |