mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-02-07 12:19:31 +00:00
1 line
7.1 KiB
JSON
1 line
7.1 KiB
JSON
{"pageProps":{"metadata":{"date":"\"2021-06-30 13:30:19 +08:00\"","date_modified":"\"2021-12-28 00:17:58 +08:00\"","language":"en","source":""},"title":"Nix language","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":"what-is-it-for"},"children":[{"type":"text","value":"What is it for?"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/lang.nix#what-is-it-for"},"children":[{"type":"text","value":"What is it for?"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"builtins"},"children":[{"type":"text","value":"Builtins"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/lang.nix#builtins"},"children":[{"type":"text","value":"Builtins"}]},{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-2"},"children":[{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h2","properties":{"id":"imports"},"children":[{"type":"text","value":"Imports"}]}]},"properties":{"className":"toc-item toc-item-h2"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h2","href":"/lang.nix#imports"},"children":[{"type":"text","value":"Imports"}]}]}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"standard-library"},"children":[{"type":"element","tagName":"span","properties":{"className":["todo-keyword","TODO"],"id":"standard-library"},"children":[{"type":"text","value":"TODO"}]},{"type":"text","value":" "},{"type":"text","value":"Standard library"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/lang.nix#standard-library"},"children":[{"type":"text","value":"TODO Standard library"}]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Nix can be aptly described as JSON but with functions.\nWhile you can make Nix work with basic configurations, you need to know the details if you're creating packages.\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"You can actively play with the language by running "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"nix repl"}]},{"type":"text","value":".\nThis is just a personal reference note, the recommended resource for learning the language is the beloved "},{"type":"element","tagName":"a","properties":{"href":"https://nixos.org/guides/nix-pills/"},"children":[{"type":"text","value":"Nix pills"}]},{"type":"text","value":".\n"}]},{"type":"element","tagName":"h1","properties":{"id":"what-is-it-for"},"children":[{"type":"text","value":"What is it for?"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"most importantly, writing packages, specifically "},{"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":"mostly used for configuring "},{"type":"element","tagName":"a","properties":{"href":"https://nixos.org/manual/nixos/stable/"},"children":[{"type":"text","value":"operating systems"}]},{"type":"text","value":" and create servers quickly with its variety of services\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"configuring "},{"type":"element","tagName":"a","properties":{"href":"/tools.nix"},"children":[{"type":"text","value":"Nix package manager"}]}]}]}]},{"type":"element","tagName":"h1","properties":{"id":"builtins"},"children":[{"type":"text","value":"Builtins"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"builtins.toString ./."}]},{"type":"text","value":" will print out the current directory.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"builtins.getFlake $PATH"}]}]}]}]},{"type":"element","tagName":"h2","properties":{"id":"imports"},"children":[{"type":"text","value":"Imports"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"the "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"import"}]},{"type":"text","value":" builtin will simply import the Nix expression given a path.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"because of the functional paradigm, you'll often see the builtin used with the parameters in one go — e.g., "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"import <nixpkgs> { }"}]},{"type":"text","value":" which will import nixpkgs from one of the module paths with the default attribute set.\n"}]}]}]},{"type":"element","tagName":"h1","properties":{"id":"standard-library"},"children":[{"type":"element","tagName":"span","properties":{"className":["todo-keyword","TODO"],"id":"standard-library"},"children":[{"type":"text","value":"TODO"}]},{"type":"text","value":" "},{"type":"text","value":"Standard library"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"nixpkgs has a standard library that comes with functions mitigating against the verbosity for packaging or simply convenience\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[]}]}]}]},"backlinks":[{"path":"/editor.neovim.lua-modules","title":"Neovim Lua modules"},{"path":"/packages.nix","title":"Nix packages"},{"path":"/tools.nix.derivations","title":"Nix derivations"},{"path":"/tools.nix","title":"Nix package manager"}]},"__N_SSG":true} |