···11-# Pull Requests
22-33-## TL;DR;
44-- **Target Branch**: `main`
55-- **Merge Policy**: [`bors`][bors] is always right (→ `bors try`)
66-- **Docs**: every changeset is expected to contain doc updates
77-- **Commit Msg**: be a poet! Comprehensive and explanatory commit messages
88- should cover the motivation and use case in an easily understandable manner
99- even when read after a few months.
1010-- **Test Driven Development**: please default to test driven development where possible.
1111-1212-### Within the Devshell (`nix develop`)
1313-- **Hooks**: please `git commit` within the devshell
1414-- **Fail Early**: please run from within the devshell on your local machine:
1515- - `nix flake check`
1616-1717-[bors]: https://bors.tech
1818-
···11-# get
22-The `get` subcommand is useful for getting a bare copy of devos without the
33-git history.
44-55-## Usage
66-```sh
77-bud get DEST-DIR
88-```
99-1010-If DEST-DIR is ommitted, it defaults to _./devos_.
-24
doc/bud/index.md
···11-# [`bud`][bud] command
22-The template incudes a convenient script for managing your system called [`bud`][bud].
33-44-It is a portable and highly composable system control tool that work anywhere on your host
55-or in the flake's devshell.
66-77-Although it comes with some predefined standard helpers,
88-it is very extensible and you are encouraged to write your own script snippets
99-to ease your workflows. An example is the bud module for a `get` command that
1010-comes included with `devos`.
1111-1212-While writing scripts you can convenientely access smart environment variables
1313-that can tell the current architecture, user or host name, among others, regardless
1414-wether you invoke `bud` within the devshell or as the system-wide installed `bud`.
1515-1616-For details, please review the [bud repo][bud].
1717-1818-## Usage
1919-```sh
2020-bud help
2121-```
2222-2323-2424-[bud]: https://github.com/divnix/bud
-62
doc/concepts/hosts.md
···11-# Hosts
22-33-Nix flakes contain an output called `nixosConfigurations` declaring an
44-attribute set of valid NixOS systems. To simplify the management and creation
55-of these hosts, devos automatically imports every _.nix_ file inside this
66-directory to the mentioned attribute set, applying the projects defaults to
77-each. The only hard requirement is that the file contain a valid NixOS module.
88-99-As an example, a file `hosts/system.nix` or `hosts/system/default.nix` will
1010-be available via the flake output `nixosConfigurations.system`. You can have
1111-as many hosts as you want and all of them will be automatically imported based
1212-on their name.
1313-1414-For each host, the configuration automatically sets the `networking.hostName`
1515-attribute to the folder name or name of the file minus the _.nix_ extension. This
1616-is for convenience, since `nixos-rebuild` automatically searches for a configuration
1717-matching the current systems hostname if one is not specified explicitly.
1818-1919-You can set channels, systems, and add extra modules to each host by editing the
2020-`nixos.hosts` argument in flake.nix. This is the perfect place to import
2121-host specific modules from external sources, such as the
2222-[nixos-hardware][nixos-hardware] repository.
2323-2424-It is recommended that the host modules only contain configuration information
2525-specific to a particular piece of hardware. Anything reusable across machines
2626-is best saved for [profile modules](./profiles.md).
2727-2828-This is a good place to import sets of profiles, called [suites](./suites.md),
2929-that you intend to use on your machine.
3030-3131-3232-## Example
3333-3434-flake.nix:
3535-```nix
3636-{
3737- nixos = {
3838- imports = [ (devos.lib.importHosts ./hosts) ];
3939- hosts = {
4040- librem = {
4141- channelName = "latest";
4242- modules = [ nixos-hardware.nixosModules.purism-librem-13v3 ];
4343- };
4444- };
4545- };
4646-}
4747-```
4848-4949-hosts/librem.nix:
5050-```nix
5151-{ suites, ... }:
5252-{
5353- imports = suites.laptop;
5454-5555- boot.loader.systemd-boot.enable = true;
5656- boot.loader.efi.canTouchEfiVariables = true;
5757-5858- fileSystems."/" = { device = "/dev/disk/by-label/nixos"; };
5959-}
6060-```
6161-6262-[nixos-hardware]: https://github.com/NixOS/nixos-hardware
-10
doc/concepts/index.md
···11-# Key Concepts
22-33-Key concepts are derived from [digga][digga]. Please refer to its
44-[docs][digga-docs] for more details.
55-66-This section is dedicated to helping you develop a more hands on
77-understanding of them them.
88-99-[digga-docs]: https://digga.divnix.com
1010-[digga]: https://github.com/divnix/digga
-42
doc/concepts/overrides.md
···11-# Overrides
22-Each NixOS host follows one channel. But many times it is useful to get packages
33-or modules from different channels.
44-55-## Packages
66-You can make use of `overlays/overrides.nix` to override specific packages in the
77-default channel to be pulled from other channels. That file is simply an example
88-of how any overlay can get `channels` as their first argument.
99-1010-You can add overlays to any channel to override packages from other channels.
1111-1212-Pulling the manix package from the `latest` channel:
1313-```nix
1414-channels: final: prev: {
1515- __dontExport = true;
1616- inherit (pkgs.latest) manix;
1717-}
1818-```
1919-2020-It is recommended to set the `__dontExport` property for override specific
2121-overlays. `overlays/overrides.nix` is the best place to consolidate all package
2222-overrides and the property is already set for you.
2323-2424-## Modules
2525-2626-You can also pull modules from other channels. All modules have access to the
2727-`modulesPath` for each channel as `<channelName>ModulesPath`. And you can use
2828-`disabledModules` to remove modules from the current channel.
2929-3030-To pull zsh module from the `latest` channel this code can be placed in any module, whether its your host file, a profile, or a module in ./modules etc:
3131-```nix
3232-{ latestModulesPath }:
3333-{
3434- imports = [ "${latestModulesPath}/programs/zsh/zsh.nix" ];
3535- disabledModules = [ "programs/zsh/zsh.nix" ];
3636-}
3737-```
3838-3939-> ##### _Note:_
4040-> Sometimes a modules name will change from one branch to another.
4141-4242-[nixpkgs-modules]: https://github.com/NixOS/nixpkgs/tree/master/nixos/modules
-67
doc/concepts/profiles.md
···11-# Profiles
22-33-Profiles are a convenient shorthand for the [_definition_][definition] of
44-[options][options] in contrast to their [_declaration_][declaration]. They're
55-built into the NixOS module system for a reason: to elegantly provide a clear
66-separation of concerns.
77-88-## Creation
99-Profiles are created with the `rakeLeaves` function which recursively collects
1010-`.nix` files from within a folder. The recursion stops at folders with a `default.nix`
1111-in them. You end up with an attribute set with leaves(paths to profiles) or
1212-nodes(attrsets leading to more nodes or leaves).
1313-1414-A profile is used for quick modularization of [interelated bits](./profiles.md#subprofiles).
1515-1616-> ##### _Notes:_
1717-> * For _declaring_ module options, there's the [modules](../outputs/modules.md) directory.
1818-> * This directory takes inspiration from
1919-> [upstream](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/profiles)
2020-> .
2121-2222-### Nested profiles
2323-Profiles can be nested in attribute sets due to the recursive nature of `rakeLeaves`.
2424-This can be useful to have a set of profiles created for a specific purpose. It is
2525-sometimes useful to have a `common` profile that has high level concerns related
2626-to all its sister profiles.
2727-2828-### Example
2929-3030-profiles/develop/common.nix:
3131-```nix
3232-{
3333- imports = [ ./zsh ];
3434- # some generic development concerns ...
3535-}
3636-```
3737-3838-profiles/develop/zsh.nix:
3939-```nix
4040-{ ... }:
4141-{
4242- programs.zsh.enable = true;
4343- # zsh specific options ...
4444-}
4545-```
4646-4747-The examples above will end up with a profiles set like this:
4848-```nix
4949-{
5050- develop = {
5151- common = ./profiles/develop/common.nix;
5252- zsh = ./profiles/develop/zsh.nix;
5353- };
5454-}
5555-```
5656-5757-## Conclusion
5858-Profiles are the most important concept in DevOS. They allow us to keep our
5959-Nix expressions self contained and modular. This way we can maximize reuse
6060-across hosts while minimizing boilerplate. Remember, anything machine
6161-specific belongs in your [host](hosts.md) files instead.
6262-6363-[definition]: https://nixos.org/manual/nixos/stable/index.html#sec-option-definitions
6464-[declaration]: https://nixos.org/manual/nixos/stable/index.html#sec-option-declarations
6565-[options]: https://nixos.org/manual/nixos/stable/index.html#sec-writing-modules
6666-[spec]: https://github.com/divnix/devos/tree/main/lib/devos/mkProfileAttrs.nix
6767-[config]: https://nixos.wiki/wiki/Module#structure
-25
doc/concepts/suites.md
···11-# Suites
22-Suites provide a mechanism for users to easily combine and name collections of
33-profiles.
44-55-`suites` are defined in the `importables` argument in either the `home` or `nixos`
66-namespace. They are a special case of an `importable` which is passed as a special
77-argument (one that can be use in an `imports` line) to your hosts. All lists defined
88-in `suites` are flattened and type-checked as paths.
99-1010-## Definition
1111-```nix
1212-rec {
1313- workstation = [ profiles.develop profiles.graphical users.nixos ];
1414- mobileWS = workstation ++ [ profiles.laptop ];
1515-}
1616-```
1717-1818-## Usage
1919-`hosts/my-laptop.nix`:
2020-```nix
2121-{ suites, ... }:
2222-{
2323- imports = suites.mobileWS;
2424-}
2525-```
-77
doc/concepts/users.md
···11-> ##### _Note:_
22-> This section and its semantics need a conceptiual rework.
33-> Since recently [portable home configurations][portableuser]
44-> that are not bound to any specific host are a thing.
55-66-# Users
77-88-Users are a special case of [profiles](profiles.md) that define system
99-users and [home-manager][home-manager] configurations. For your convenience,
1010-home manager is wired in by default so all you have to worry about is declaring
1111-your users. For a fully fleshed out example, check out the developers personal
1212-[branch](https://github.com/divnix/devos/tree/nrd/users/nrd/default.nix).
1313-1414-## Basic Usage
1515-`users/myuser/default.nix`:
1616-```nix
1717-{ ... }:
1818-{
1919- users.users.myuser = {
2020- isNormalUser = true;
2121- };
2222-2323- home-manager.users.myuser = {
2424- programs.mpv.enable = true;
2525- };
2626-}
2727-2828-```
2929-3030-## Home Manager
3131-Home Manager support follows the same principles as regular nixos configurations,
3232-it even gets its own namespace in your `flake.nix` as `home`.
3333-3434-All modules defined in [user modules][modules-list] will be imported to
3535-Home Manager.
3636-User profiles can be collected in a similar fashion as system ones into a `suites`
3737-argument that gets passed to your home-manager users.
3838-3939-### Example
4040-```nix
4141-{
4242- home-manager.users.nixos = { suites, ... }: {
4343- imports = suites.base;
4444- };
4545-}
4646-```
4747-4848-4949-## External Usage
5050-You can easily use the defined home-manager configurations outside of NixOS
5151-using the `homeConfigurations` flake output. The [bud](../bud/index.md) helper
5252-script makes this even easier.
5353-5454-This is great for keeping your environment consistent across Unix systems,
5555-including OSX.
5656-5757-### From within the projects devshell:
5858-```sh
5959-# builds the nixos user defined in the NixOS host
6060-bud home NixOS nixos
6161-6262-# build and activate
6363-bud home NixOS nixos switch
6464-```
6565-6666-### Manually from outside the project:
6767-```sh
6868-# build
6969-nix build "github:divnix/devos#homeConfigurations.nixos@NixOS.home.activationPackage"
7070-7171-# activate
7272-./result/activate && unlink result
7373-```
7474-7575-[home-manager]: https://nix-community.github.io/home-manager
7676-[modules-list]: https://github.com/divnix/devos/tree/main/users/modules/module-list.nix
7777-[portableuser]: https://digga.divnix.com/api-reference-home.html#homeusers
-17
doc/integrations/cachix.md
···11-# Cachix
22-The system will automatically pull a cachix.nix at the root if one exists.
33-This is usually created automatically by a `sudo cachix use`. If you're more
44-inclined to keep the root clean, you can drop any generated files in the
55-`cachix` directory into the `profiles/cachix` directory without further
66-modification.
77-88-For example, to add your own cache, assuming the template lives in /etc/nixos,
99-by simply running `sudo cachix use yourcache`. Then, optionally, move
1010-`cachix/yourcache.nix` to `profiles/cachix/yourcache.nix`
1111-1212-These caches are only added to the system after a `nixos-rebuild switch`, so it
1313-is recommended to call `cachix use nrdxp` before the initial deployment, as it
1414-will save a lot of build time.
1515-1616-In the future, users will be able to skip this step once the ability to define
1717-the nix.conf within the flake is fully fleshed out upstream.
-49
doc/integrations/deploy.md
···11-# deploy-rs
22-[Deploy-rs][d-rs] is a tool for managing NixOS remote machines. It was
33-chosen for devos after the author experienced some frustrations with the
44-stateful nature of nixops' db. It was also designed from scratch to support
55-flake based deployments, and so is an excellent tool for the job.
66-77-By default, all the [hosts](../concepts/hosts.md) are also available as deploy-rs nodes,
88-configured with the hostname set to `networking.hostName`; overridable via
99-the command line.
1010-1111-## Usage
1212-1313-Just add your ssh key to the host:
1414-```nix
1515-{ ... }:
1616-{
1717- users.users.${sshUser}.openssh.authorizedKeys.keyFiles = [
1818- ../secrets/path/to/key.pub
1919- ];
2020-}
2121-```
2222-2323-And the private key to your user:
2424-```nix
2525-{ ... }:
2626-{
2727- home-manager.users.${sshUser}.programs.ssh = {
2828- enable = true;
2929-3030- matchBlocks = {
3131- ${host} = {
3232- host = hostName;
3333- identityFile = ../secrets/path/to/key;
3434- extraOptions = { AddKeysToAgent = "yes"; };
3535- };
3636- };
3737- }
3838-}
3939-```
4040-4141-And run the deployment:
4242-```sh
4343-deploy '.#hostName' --hostname host.example.com
4444-```
4545-4646-> ##### _Note:_
4747-> Your user will need **passwordless** sudo access
4848-4949-[d-rs]: https://github.com/serokell/deploy-rs
-36
doc/integrations/hercules.md
···11-# Hercules CI
22-If you start adding your own packages and configurations, you'll probably have
33-at least a few binary artifacts. With hercules we can build every package in
44-our configuration automatically, on every commit. Additionally, we can have it
55-upload all our build artifacts to a binary cache like [cachix][cachix].
66-77-This will work whether your copy is a fork, or a bare template, as long as your
88-repo is hosted on GitHub.
99-1010-## Setup
1111-Just head over to [hercules-ci.com](https://hercules-ci.com) to make an account.
1212-1313-Then follow the docs to set up an [agent][agent], if you want to deploy to a
1414-binary cache (and of course you do), be sure _not_ to skip the
1515-[binary-caches.json][cache].
1616-1717-## Ready to Use
1818-The repo is already set up with the proper _default.nix_ file, building all
1919-declared packages, checks, profiles and shells. So you can see if something
2020-breaks, and never build the same package twice!
2121-2222-If you want to get fancy, you could even have hercules
2323-[deploy your configuration](https://docs.hercules-ci.com/hercules-ci-effects/guide/deploy-a-nixos-machine/)!
2424-2525-> ##### _Note:_
2626-> Hercules doesn't have access to anything encrypted in the
2727-> [secrets folder](../../secrets), so none of your secrets will accidentally get
2828-> pushed to a cache by mistake.
2929->
3030-> You could pull all your secrets via your user, and then exclude it from
3131-> [allUsers](https://github.com/nrdxp/devos/blob/nrd/suites/default.nix#L17)
3232-> to keep checks passing.
3333-3434-[agent]: https://docs.hercules-ci.com/hercules-ci/getting-started/#github
3535-[cache]: https://docs.hercules-ci.com/hercules-ci/getting-started/deploy/nixos/#_3_configure_a_binary_cache
3636-[cachix]: https://cachix.org
-5
doc/integrations/index.md
···11-# Integrations
22-This section explores some of the optional tools included with devos to provide
33-a solution to common concerns such as ci and remote deployment. An effort is
44-made to choose tools that treat nix, and where possible flakes, as first class
55-citizens.
-43
doc/integrations/nvfetcher.md
···11-# nvfetcher
22-[NvFetcher][nvf] is a workflow companion for updating nix sources.
33-44-You can specify an origin source and an update configuration, and
55-nvfetcher can for example track updates to a specific branch and
66-automatically update your nix sources configuration on each run
77-to the tip of that branch.
88-99-All package source declaration is done in [sources.toml][sources.toml].
1010-1111-From within the devshell of this repo, run `nvfetcher`, a wrapped
1212-version of `nvfetcher` that knows where to find and place its files
1313-and commit the results.
1414-1515-## Usage
1616-1717-Statically fetching (not tracking) a particular tag from a github repo:
1818-```toml
1919-[manix]
2020-src.manual = "v0.6.3"
2121-fetch.github = "mlvzk/manix"
2222-```
2323-2424-Tracking the latest github _release_ from a github repo:
2525-```toml
2626-[manix]
2727-src.github = "mlvzk/manix" # responsible for tracking
2828-fetch.github = "mlvzk/manix" # responsible for fetching
2929-```
3030-3131-Tracking the latest commit of a git repository and fetch from a git repo:
3232-```toml
3333-[manix]
3434-src.git = "https://github.com/mlvzk/manix.git" # responsible for tracking
3535-fetch.git = "https://github.com/mlvzk/manix.git" # responsible for fetching
3636-```
3737-3838-> ##### _Note:_
3939-> Please refer to the [NvFetcher Readme][nvf-readme] for more options.
4040-4141-[nvf]: https://github.com/berberman/nvfetcher
4242-[nvf-readme]: https://github.com/berberman/nvfetcher#readme
4343-[sources.toml]: https://github.com/divnix/devos/tree/main/pkgs/sources.toml
-3
doc/outputs/index.md
···11-# Layout
22-Each of the following sections is a directory whose contents are output to the
33-outside world via the flake's outputs. Check each chapter for details.
-79
doc/outputs/modules.md
···11-# Modules
22-The modules directory is a replica of nixpkg's NixOS [modules][nixpkgs-modules]
33-, and follows the same semantics. This allows for trivial upstreaming into
44-nixpkgs proper once your module is sufficiently stable.
55-66-All modules linked in _module-list.nix_ are automatically exported via
77-`nixosModules.<file-basename>`, and imported into all [hosts](../concepts/hosts.md).
88-99-1010-> ##### _Note:_
1111-> This is reserved for declaring brand new module options. If you just want to
1212-> declare a coherent configuration of already existing and related NixOS options
1313-> , use [profiles](../concepts/profiles.md) instead.
1414-1515-## Semantics
1616-In case you've never written a module for nixpkgs before, here is a brief
1717-outline of the process.
1818-1919-### Declaration
2020-modules/services/service-category/my-service.nix:
2121-```nix
2222-{ config, lib, ... }:
2323-let
2424- cfg = config.services.myService;
2525-in
2626-{
2727- options.services.myService = {
2828- enable = lib.mkEnableOption "Description of my new service.";
2929-3030- # additional options ...
3131- };
3232-3333- config = lib.mkIf cfg.enable {
3434- # implementation ...
3535- };
3636-}
3737-```
3838-3939-### Import
4040-modules/module-list.nix:
4141-```nix
4242-[
4343- ./services/service-category/my-service.nix
4444-]
4545-```
4646-4747-## Usage
4848-4949-### Internal
5050-profiles/profile-category/my-profile.nix:
5151-```nix
5252-{ ... }:
5353-{
5454- services.MyService.enable = true;
5555-}
5656-```
5757-5858-### External
5959-flake.nix:
6060-```nix
6161-{
6262- # inputs omitted
6363-6464- outputs = { self, devos, nixpkgs, ... }: {
6565- nixosConfigurations.myConfig = nixpkgs.lib.nixosSystem {
6666- system = "...";
6767-6868- modules = [
6969- devos.nixosModules.my-service
7070- ({ ... }: {
7171- services.MyService.enable = true;
7272- })
7373- ];
7474- };
7575- };
7676-}
7777-```
7878-7979-[nixpkgs-modules]: https://github.com/NixOS/nixpkgs/tree/master/nixos/modules
-25
doc/outputs/overlays.md
···11-# Overlays
22-Writing overlays is a common occurence when using a NixOS system. Therefore,
33-we want to keep the process as simple and straightforward as possible.
44-55-Any _.nix_ files declared in this directory will be assumed to be a valid
66-overlay, and will be automatically imported into all [hosts](../concepts/hosts.md), and
77-exported via `overlays.<channel>/<pkgName>` _as well as_
88-`packages.<system>.<pkgName>` (for valid systems), so all you have to do is
99-write it.
1010-1111-## Example
1212-overlays/kakoune.nix:
1313-```nix
1414-final: prev: {
1515- kakoune = prev.kakoune.override {
1616- configure.plugins = with final.kakounePlugins; [
1717- (kak-fzf.override { fzf = final.skim; })
1818- kak-auto-pairs
1919- kak-buffers
2020- kak-powerline
2121- kak-vertical-selection
2222- ];
2323- };
2424-}
2525-```
-109
doc/outputs/pkgs.md
···11-# Packages
22-Similar to [modules](./modules.md), the pkgs directory mirrors the upstream
33-[nixpkgs/pkgs][pkgs], and for the same reason; if you ever want to upstream
44-your package, it's as simple as dropping it into the nixpkgs/pkgs directory.
55-66-The only minor difference is that, instead of adding the `callPackage` call to
77-`all-packages.nix`, you just add it the the _default.nix_ in this directory,
88-which is defined as a simple overlay.
99-1010-All the packages are exported via `packages.<system>.<pkg-name>`, for all
1111-the supported systems listed in the package's `meta.platforms` attribute.
1212-1313-And, as usual, every package in the overlay is also available to any NixOS
1414-[host](../concepts/hosts.md).
1515-1616-Another convenient difference is that it is possible to use
1717-[nvfetcher](https://github.com/berberman/nvfetcher) to keep packages up to
1818-date.
1919-This is best understood by the simple example below.
2020-2121-## Example
2222-It is possible to specify sources separately to keep them up to date semi
2323-automatically.
2424-The basic rules are specified in pkgs/sources.toml:
2525-```toml
2626-# nvfetcher.toml
2727-[libinih]
2828-src.github = "benhoyt/inih"
2929-fetch.github = "benhoyt/inih"
3030-```
3131-After changes to this file as well as to update the packages specified in there run
3232-nvfetcher (for more details see [nvfetcher](https://github.com/berberman/nvfetcher)).
3333-3434-The pkgs overlay is managed in
3535-pkgs/default.nix:
3636-```nix
3737-final: prev: {
3838- # keep sources first, this makes sources available to the pkgs
3939- sources = prev.callPackage (import ./_sources/generated.nix) { };
4040-4141- # then, call packages with `final.callPackage`
4242- libinih = prev.callPackage ./development/libraries/libinih { };
4343-}
4444-```
4545-4646-Lastly the example package is in
4747-pkgs/development/libraries/libinih/default.nix:
4848-```nix
4949-{ stdenv, meson, ninja, lib, sources, ... }:
5050-stdenv.mkDerivation {
5151- pname = "libinih";
5252-5353- # version will resolve to the latest available on gitub
5454- inherit (sources.libinih) version src;
5555-5656- buildInputs = [ meson ninja ];
5757-5858- # ...
5959-}
6060-```
6161-6262-6363-## Migration from flake based approach
6464-Previous to nvfetcher it was possible to manage sources via a pkgs/flake.nix, the main changes from there are that sources where in the attribute "srcs" (now "sources") and the contents of the sources where slightly different.
6565-In order to switch to the new system, rewrite pkgs/flake.nix to a pkgs/sources.toml file using the documentation of nvfetcher,
6666-add the line that calls the sources at the beginning of pkgs/default.nix, and
6767-accomodate the small changes in the packages as can be seen from the example.
6868-6969-The example package looked like:
7070-7171-pkgs/flake.nix:
7272-```nix
7373-{
7474- description = "Package sources";
7575-7676- inputs = {
7777- libinih.url = "github:benhoyt/inih/r53";
7878- libinih.flake = false;
7979- };
8080-}
8181-```
8282-8383-pkgs/default.nix:
8484-```nix
8585-final: prev: {
8686- # then, call packages with `final.callPackage`
8787- libinih = prev.callPackage ./development/libraries/libinih { };
8888-}
8989-```
9090-9191-pkgs/development/libraries/libinih/default.nix:
9292-```nix
9393-{ stdenv, meson, ninja, lib, srcs, ... }:
9494-let inherit (srcs) libinih; in
9595-stdenv.mkDerivation {
9696- pname = "libinih";
9797-9898- # version will resolve to 53, as specified in the flake.nix file
9999- inherit (libinih) version;
100100-101101- src = libinih;
102102-103103- buildInputs = [ meson ninja ];
104104-105105- # ...
106106-}
107107-```
108108-109109-[pkgs]: https://github.com/NixOS/nixpkgs/tree/master/pkgs
-110
doc/secrets.md
···11-# Secrets
22-Secrets are managed using [git-crypt][git-crypt] and [agenix][agenix]
33-so you can keep your flake in a public repository like GitHub without
44-exposing your password or other sensitive data.
55-66-By default, everything in the secrets folder is automatically encrypted. Just
77-be sure to run `git-crypt init` before putting anything in here.
88-99-## Agenix
1010-Currently, there is [no mechanism][secrets-issue] in nix itself to deploy secrets
1111-within the nix store because it is world-readable.
1212-1313-Most NixOS modules have the ability to set options to files in the system, outside
1414-the nix store, that contain sensitive information. You can use [agenix][agenix]
1515-to easily setup those secret files declaratively.
1616-1717-[agenix][agenix] encrypts secrets and stores them as .age files in your repository.
1818-Age files are encrypted with multiple ssh public keys, so any host or user with a
1919-matching ssh private key can read the data. The [age module][age module] will add those
2020-encrypted files to the nix store and decrypt them on activation to `/run/secrets`.
2121-2222-### Setup
2323-All hosts must have openssh enabled, this is done by default in the core profile.
2424-2525-You need to populate your `secrets/secrets.nix` with the proper ssh public keys.
2626-Be extra careful to make sure you only add public keys, you should never share a
2727-private key!!
2828-2929-secrets/secrets.nix:
3030-```nix
3131-let
3232- system = "<system ssh key>";
3333- user = "<user ssh key>";
3434- allKeys = [ system user ];
3535-in
3636-```
3737-3838-On most systems, you can get your systems ssh public key from `/etc/ssh/ssh_host_ed25519_key.pub`. If
3939-this file doesn't exist you likely need to enable openssh and rebuild your system.
4040-4141-Your users ssh public key is probably stored in `~/.ssh/id_ed25519.pub` or
4242-`~/.ssh/id_rsa.pub`. If you haven't generated a ssh key yet, be sure do so:
4343-```sh
4444-ssh-keygen -t ed25519
4545-```
4646-4747-> ##### _Note:_
4848-> The underlying tool used by agenix, rage, doesn't work well with password protected
4949-> ssh keys. So if you have lots of secrets you might have to type in your password many
5050-> times.
5151-5252-5353-### Secrets
5454-You will need the `agenix` command to create secrets. DevOS conveniently provides that
5555-in the devShell, so just run `nix develop` whenever you want to edit secrets. Make sure
5656-to always run `agenix` while in the `secrets/` folder, so it can pick up your `secrets.nix`.
5757-5858-To create secrets, simply add lines to your `secrets/secrets.nix`:
5959-```
6060-let
6161- ...
6262- allKeys = [ system user ];
6363-in
6464-{
6565- "secret.age".publicKeys = allKeys;
6666-}
6767-```
6868-That would tell agenix to create a `secret.age` file that is encrypted with the `system`
6969-and `user` ssh public key.
7070-7171-Then go into the `secrets` folder and run:
7272-```sh
7373-agenix -e secret.age
7474-```
7575-This will create the `secret.age`, if it doesn't already exist, and allow you to edit it.
7676-7777-If you ever change the `publicKeys` entry of any secret make sure to rekey the secrets:
7878-```sh
7979-agenix --rekey
8080-```
8181-8282-### Usage
8383-Once you have your secret file encrypted and ready to use, you can utilize the [age module][age module]
8484-to ensure that your secrets end up in `/run/secrets`.
8585-8686-In any profile that uses a NixOS module that requires a secret you can enable a particular secret like so:
8787-8888-```nix
8989-{ self, ... }:
9090-{
9191- age.secrets.mysecret.file = "${self}/secrets/mysecret.age";
9292-}
9393-```
9494-9595-9696-Then you can just pass the path `/run/secrets/mysecret` to the module.
9797-9898-You can make use of the many options provided by the age module to customize where and how
9999-secrets get decrypted. You can learn about them by looking at the
100100-[age module][age module].
101101-102102-103103-> ##### _Note:_
104104-> You can take a look at the [agenix repository][agenix] for more information
105105-> about the tool.
106106-107107-[git-crypt]: https://github.com/AGWA/git-crypt
108108-[agenix]: https://github.com/ryantm/agenix
109109-[age module]: https://github.com/ryantm/agenix/blob/master/modules/age.nix
110110-[secrets-issue]: https://github.com/NixOS/nix/issues/8
-102
doc/start/bootstrapping.md
···11-# Bootstrapping
22-33-This will help you boostrap a bare host with the help of the
44-[bespoke iso](./iso.md) live installer.
55-66-_Note: nothing prevents you from remotely executing the boostrapping
77-process. See below._
88-99-Once your target host has booted into the live iso, you need to partion
1010-and format your disk according to the [official manual][manual].
1111-1212-## Mount partitions
1313-1414-Then properly mount the formatted partitions at `/mnt`, so that you can
1515-install your system to those new partitions.
1616-1717-Mount `nixos` partition to `/mnt` and — for UEFI — `boot`
1818-partition to `/mnt/boot`:
1919-2020-```console
2121-$ mount /dev/disk/by-label/nixos /mnt
2222-$ mkdir -p /mnt/boot && mount /dev/disk/by-label/boot /mnt/boot # UEFI only
2323-$ swapon /dev/disk/by-label/swap
2424-```
2525-2626-Add some extra space to the store. In the iso, it's running on a tmpfs
2727-off your RAM:
2828-```console
2929-$ mkdir -p /mnt/tmpstore/{work,store}
3030-$ mount -t overlay overlay -olowerdir=/nix/store,upperdir=/mnt/tmpstore/store,workdir=/mnt/tmpstore/work /nix/store
3131-```
3232-3333-## Install
3434-3535-Install off of a copy of devos from the time the iso was built:
3636-3737-```console
3838-$ cd /iso/devos
3939-$ nixos-install --flake .#NixOS
4040-```
4141-4242-## Notes of interest
4343-4444-### Remote access to the live installer
4545-4646-The iso live installer comes preconfigured with a network configuration
4747-which announces it's hostname via [MulticastDNS][mDNS] as `hostname.local`,
4848-that is `bootstrap.local` in the [iso example](./iso).
4949-5050-In the rare case that [MulticastDNS][mDNS] is not availabe or turned off
5151-in your network, there is a static link-local IPv6 address configured to
5252-`fe80::47`(mnemonic from the letter's position in the english alphabet:
5353-`n=14 i=9 x=24; 47 = n+i+x`).
5454-5555-Provided that you have added your public key to the authorized keys of the
5656-`root` user _(hint: [`deploy-rs`](../integrations/deploy.md) needs passwordless
5757-sudo access)_:
5858-5959-```nix
6060-{ ... }:
6161-{
6262- users.users.root.openssh.authorizedKeys.keyFiles = [
6363- ../secrets/path/to/key.pub
6464- ];
6565-}
6666-```
6767-6868-You can then ssh into the live installer through one of the
6969-following options:
7070-7171-```console
7272-ssh root@bootstrap.local
7373-7474-ssh root@fe80::47%eno1 # where eno1 is your network interface on which you are linked to the target
7575-```
7676-7777-_Note: the [static link-local IPv6 address][staticLLA] and [MulticastDNS][mDNS] is only
7878-configured on the live installer. If you wish to enable [MulticastDNS][mDNS]
7979-for your environment, you ought to configure that in a regular [profile](../concepts/profiles.md)._
8080-8181-### EUI-64 LLA & Host Identity
8282-8383-The iso's IPv6 Link Local Address (LLA) is configured with a static 64-bit Extended
8484-Unique Identifiers (EUI-64) that is derived from the host interface's Message
8585-Authentication Code (MAC) address.
8686-8787-After a little while (a few seconds), you can remotely discover this unique and host
8888-specific address over [NDP][NDP] for example with:
8989-9090-```console
9191-ip -6 neigh show # also shows fe80::47
9292-```
9393-9494-***This LLA is stable for the host, unless you need to swap that particular network card.***
9595-Under this reservation, though, you may use this EUI-64 to wire up a specific
9696-(cryptographic) host identity.
9797-9898-9999-[manual]: https://nixos.org/manual/nixos/stable/index.html#sec-installation-partitioning
100100-[mDNS]: https://en.wikipedia.org/wiki/Multicast_DNS
101101-[NDP]: https://en.wikipedia.org/wiki/Neighbor_Discovery_Protocol
102102-[staticLLA]: https://tools.ietf.org/html/rfc7404
-54
doc/start/from-nixos.md
···11-# From NixOS
22-33-## Generate Configuration
44-Assuming you're happy with your existing partition layout, you can generate a
55-basic NixOS configuration for your system using:
66-```sh
77-bud up
88-```
99-1010-This will make a new file `hosts/up-$(hostname).nix`, which you can edit to
1111-your liking.
1212-1313-You must then add a host to `nixos.hosts` in flake.nix:
1414-```nix
1515-{
1616- nixos.hosts = {
1717- modules = hosts/NixOS.nix;
1818- };
1919-}
2020-```
2121-2222-Make sure your `i18n.defaultLocale` and `time.timeZone` are set properly for
2323-your region. Keep in mind that `networking.hostName` will be automatically
2424-set to the name of your host;
2525-2626-Now might be a good time to read the docs on [suites](../concepts/suites.md) and
2727-[profiles](../concepts/profiles.md) and add or create any that you need.
2828-2929-> ##### _Note:_
3030-> While the `up` sub-command is provided as a convenience to quickly set up and
3131-> install a "fresh" NixOS system on current hardware, committing these files is
3232-> discouraged.
3333->
3434-> They are placed in the git staging area automatically because they would be
3535-> invisible to the flake otherwise, but it is best to move what you need from
3636-> them directly into a host module of your own making, and commit that instead.
3737-# Installation
3838-3939-Once you're ready to deploy `hosts/my-host.nix`:
4040-```sh
4141-bud my-host switch
4242-```
4343-4444-4545-This calls `nixos-rebuild` with sudo to build and install your configuration.
4646-4747-> ##### _Notes:_
4848-> - Instead of `switch`, you can pass `build`, `test`, `boot`, etc just as with
4949-> `nixos-rebuild`.
5050->
5151-> - It is convenient to have the template living at `/etc/nixos` so you can
5252-> simply `sudo nixos-rebuild switch` from anywhere on the system, but it is
5353-> not required.
5454-
-41
doc/start/index.md
···11-# Quick Start
22-The only dependency is nix, so make sure you have it [installed][install-nix].
33-44-## Get the Template
55-Here is a snippet that will get you the template without the git history:
66-```sh
77-nix-shell -p cachix --run "cachix use nrdxp"
88-99-nix-shell https://github.com/divnix/devos/archive/main.tar.gz -A shell \
1010- --run "bud get main"
1111-1212-cd devos
1313-1414-nix-shell
1515-1616-git init
1717-git add .
1818-git commit -m init
1919-```
2020-2121-This will place you in a new folder named `devos` with git initialized, and a
2222-nix-shell that provides all the dependencies, including the unstable nix
2323-version required.
2424-2525-In addition, the [binary cache](../integrations/cachix.md) is added for faster deployment.
2626-2727-> ##### _Notes:_
2828-> - Flakes ignore files that have not been added to git, so be sure to stage new
2929-> files before building the system.
3030-> - You can choose to simply clone the repo with git if you want to follow
3131-> upstream changes.
3232-> - If the `nix-shell -p cachix --run "cachix use nrdxp"` line doesn't work
3333-> you can try with sudo: `sudo nix-shell -p cachix --run "cachix use nrdxp"`
3434-3535-## Next Steps:
3636-- [Make installable ISO](./iso.md)
3737-- [Bootstrap Host](./bootstrapping.md)
3838-- [Already on NixOS](./from-nixos.md)
3939-4040-4141-[install-nix]: https://nixos.org/manual/nix/stable/#sect-multi-user-installation
-22
doc/start/iso.md
···11-# ISO
22-33-Making and writing an installable iso for `hosts/bootstrap.nix` is as simple as:
44-```sh
55-bud build bootstrap bootstrapIso
66-sudo -E $(which bud) burn
77-```
88-99-This works for any host.
1010-1111-## ISO image nix store & cache
1212-1313-The iso image holds the store to the live environment and _also_ acts as a binary cache
1414-to the installer. To considerably speed up things, the image already includes all flake
1515-`inputs` as well as the `devshell` closures.
1616-1717-While you _could_ provision any machine with a single stick, a custom-made iso for
1818-the host you want to install DevOS to, maximises those local cache hits.
1919-2020-For hosts that don't differ too much, a single usb stick might be ok, whereas when
2121-there are bigger differences, a custom-made usb stick will be considerably faster.
2222-
-33
doc/tests.md
···11-# Testing
22-33-Testing is always an important aspect of any software development project, and
44-NixOS offers some incredibly powerful tools to write tests for your
55-configuration, and, optionally, run them in
66-[CI](./integrations/hercules.md).
77-88-## Unit Tests
99-Unit tests can be created from regular derivations, and they can do
1010-almost anything you can imagine. By convention, it is best to test your
1111-packages during their [check phase][check]. All packages and their tests will
1212-be built during CI.
1313-1414-## Integration Tests
1515-All your profiles defined in suites will be tested in a NixOS VM.
1616-1717-You can write integration tests for one or more NixOS VMs that can,
1818-optionally, be networked together, and yes, it's as awesome as it sounds!
1919-2020-Be sure to use the `mkTest` function from digga, `digga.lib.pkgs-lib.mkTest`
2121-which wraps the official [testing-python][testing-python] function to ensure
2222-that the system is setup exactly as it is for a bare DevOS system. There are
2323-already great resources for learning how to use these tests effectively,
2424-including the official [docs][test-doc], a fantastic [blog post][test-blog],
2525-and the examples in [nixpkgs][nixos-tests].
2626-2727-[test-doc]: https://nixos.org/manual/nixos/stable/index.html#sec-nixos-tests
2828-[test-blog]: https://www.haskellforall.com/2020/11/how-to-use-nixos-for-lightweight.html
2929-[default]: https://github.com/divnix/devos/tree/main/tests/default.nix
3030-[run-test]: https://github.com/NixOS/nixpkgs/blob/6571462647d7316aff8b8597ecdf5922547bf365/lib/debug.nix#L154-L166
3131-[nixos-tests]: https://github.com/NixOS/nixpkgs/tree/master/nixos/tests
3232-[testing-python]: https://github.com/NixOS/nixpkgs/tree/master/nixos/lib/testing-python.nix
3333-[check]: https://nixos.org/manual/nixpkgs/stable/#ssec-check-phase
-6
doc/theme/highlight.js
···11-/*
22- Highlight.js 10.1.2 (edd73d24)
33- License: BSD-3-Clause
44- Copyright (c) 2006-2020, Ivan Sagalaev
55-*/
66-var hljs=function(){"use strict";function e(n){Object.freeze(n);var t="function"==typeof n;return Object.getOwnPropertyNames(n).forEach((function(r){!Object.hasOwnProperty.call(n,r)||null===n[r]||"object"!=typeof n[r]&&"function"!=typeof n[r]||t&&("caller"===r||"callee"===r||"arguments"===r)||Object.isFrozen(n[r])||e(n[r])})),n}class n{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data}ignoreMatch(){this.ignore=!0}}function t(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r(e,...n){var t={};for(const n in e)t[n]=e[n];return n.forEach((function(e){for(const n in e)t[n]=e[n]})),t}function a(e){return e.nodeName.toLowerCase()}var i=Object.freeze({__proto__:null,escapeHTML:t,inherit:r,nodeStream:function(e){var n=[];return function e(t,r){for(var i=t.firstChild;i;i=i.nextSibling)3===i.nodeType?r+=i.nodeValue.length:1===i.nodeType&&(n.push({event:"start",offset:r,node:i}),r=e(i,r),a(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:r,node:i}));return r}(e,0),n},mergeStreams:function(e,n,r){var i=0,s="",o=[];function l(){return e.length&&n.length?e[0].offset!==n[0].offset?e[0].offset<n[0].offset?e:n:"start"===n[0].event?e:n:e.length?e:n}function c(e){s+="<"+a(e)+[].map.call(e.attributes,(function(e){return" "+e.nodeName+'="'+t(e.value)+'"'})).join("")+">"}function u(e){s+="</"+a(e)+">"}function d(e){("start"===e.event?c:u)(e.node)}for(;e.length||n.length;){var g=l();if(s+=t(r.substring(i,g[0].offset)),i=g[0].offset,g===e){o.reverse().forEach(u);do{d(g.splice(0,1)[0]),g=l()}while(g===e&&g.length&&g[0].offset===i);o.reverse().forEach(c)}else"start"===g[0].event?o.push(g[0].node):o.pop(),d(g.splice(0,1)[0])}return s+t(r.substr(i))}});const s="</span>",o=e=>!!e.kind;class l{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=t(e)}openNode(e){if(!o(e))return;let n=e.kind;e.sublanguage||(n=`${this.classPrefix}${n}`),this.span(n)}closeNode(e){o(e)&&(this.buffer+=s)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}class c{constructor(){this.rootNode={children:[]},this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const n={kind:e,children:[]};this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return"string"==typeof n?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(n=>this._walk(e,n)),e.closeNode(n)),e}static _collapse(e){"string"!=typeof e&&e.children&&(e.children.every(e=>"string"==typeof e)?e.children=[e.children.join("")]:e.children.forEach(e=>{c._collapse(e)}))}}class u extends c{constructor(e){super(),this.options=e}addKeyword(e,n){""!==e&&(this.openNode(n),this.addText(e),this.closeNode())}addText(e){""!==e&&this.add(e)}addSublanguage(e,n){const t=e.root;t.kind=n,t.sublanguage=!0,this.add(t)}toHTML(){return new l(this,this.options).value()}finalize(){return!0}}function d(e){return e?"string"==typeof e?e:e.source:null}const g="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",h={begin:"\\\\[\\s\\S]",relevance:0},f={className:"string",begin:"'",end:"'",illegal:"\\n",contains:[h]},p={className:"string",begin:'"',end:'"',illegal:"\\n",contains:[h]},b={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},m=function(e,n,t={}){var a=r({className:"comment",begin:e,end:n,contains:[]},t);return a.contains.push(b),a.contains.push({className:"doctag",begin:"(?:TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):",relevance:0}),a},v=m("//","$"),x=m("/\\*","\\*/"),E=m("#","$");var _=Object.freeze({__proto__:null,IDENT_RE:"[a-zA-Z]\\w*",UNDERSCORE_IDENT_RE:"[a-zA-Z_]\\w*",NUMBER_RE:"\\b\\d+(\\.\\d+)?",C_NUMBER_RE:g,BINARY_NUMBER_RE:"\\b(0b[01]+)",RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{const n=/^#![ ]*\//;return e.binary&&(e.begin=function(...e){return e.map(e=>d(e)).join("")}(n,/.*\b/,e.binary,/\b.*/)),r({className:"meta",begin:n,end:/$/,relevance:0,"on:begin":(e,n)=>{0!==e.index&&n.ignoreMatch()}},e)},BACKSLASH_ESCAPE:h,APOS_STRING_MODE:f,QUOTE_STRING_MODE:p,PHRASAL_WORDS_MODE:b,COMMENT:m,C_LINE_COMMENT_MODE:v,C_BLOCK_COMMENT_MODE:x,HASH_COMMENT_MODE:E,NUMBER_MODE:{className:"number",begin:"\\b\\d+(\\.\\d+)?",relevance:0},C_NUMBER_MODE:{className:"number",begin:g,relevance:0},BINARY_NUMBER_MODE:{className:"number",begin:"\\b(0b[01]+)",relevance:0},CSS_NUMBER_MODE:{className:"number",begin:"\\b\\d+(\\.\\d+)?(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},REGEXP_MODE:{begin:/(?=\/[^/\n]*\/)/,contains:[{className:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[h,{begin:/\[/,end:/\]/,relevance:0,contains:[h]}]}]},TITLE_MODE:{className:"title",begin:"[a-zA-Z]\\w*",relevance:0},UNDERSCORE_TITLE_MODE:{className:"title",begin:"[a-zA-Z_]\\w*",relevance:0},METHOD_GUARD:{begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0},END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})}}),N="of and for in not or if then".split(" ");function w(e,n){return n?+n:function(e){return N.includes(e.toLowerCase())}(e)?0:1}const R=t,y=r,{nodeStream:O,mergeStreams:k}=i,M=Symbol("nomatch");return function(t){var a=[],i=Object.create(null),s=Object.create(null),o=[],l=!0,c=/(^(<[^>]+>|\t|)+|\n)/gm,g="Could not find the language '{}', did you forget to load/include a language module?";const h={disableAutodetect:!0,name:"Plain text",contains:[]};var f={noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:null,__emitter:u};function p(e){return f.noHighlightRe.test(e)}function b(e,n,t,r){var a={code:n,language:e};S("before:highlight",a);var i=a.result?a.result:m(a.language,a.code,t,r);return i.code=a.code,S("after:highlight",i),i}function m(e,t,a,s){var o=t;function c(e,n){var t=E.case_insensitive?n[0].toLowerCase():n[0];return Object.prototype.hasOwnProperty.call(e.keywords,t)&&e.keywords[t]}function u(){null!=y.subLanguage?function(){if(""!==A){var e=null;if("string"==typeof y.subLanguage){if(!i[y.subLanguage])return void k.addText(A);e=m(y.subLanguage,A,!0,O[y.subLanguage]),O[y.subLanguage]=e.top}else e=v(A,y.subLanguage.length?y.subLanguage:null);y.relevance>0&&(I+=e.relevance),k.addSublanguage(e.emitter,e.language)}}():function(){if(!y.keywords)return void k.addText(A);let e=0;y.keywordPatternRe.lastIndex=0;let n=y.keywordPatternRe.exec(A),t="";for(;n;){t+=A.substring(e,n.index);const r=c(y,n);if(r){const[e,a]=r;k.addText(t),t="",I+=a,k.addKeyword(n[0],e)}else t+=n[0];e=y.keywordPatternRe.lastIndex,n=y.keywordPatternRe.exec(A)}t+=A.substr(e),k.addText(t)}(),A=""}function h(e){return e.className&&k.openNode(e.className),y=Object.create(e,{parent:{value:y}})}function p(e){return 0===y.matcher.regexIndex?(A+=e[0],1):(L=!0,0)}var b={};function x(t,r){var i=r&&r[0];if(A+=t,null==i)return u(),0;if("begin"===b.type&&"end"===r.type&&b.index===r.index&&""===i){if(A+=o.slice(r.index,r.index+1),!l){const n=Error("0 width match regex");throw n.languageName=e,n.badRule=b.rule,n}return 1}if(b=r,"begin"===r.type)return function(e){var t=e[0],r=e.rule;const a=new n(r),i=[r.__beforeBegin,r["on:begin"]];for(const n of i)if(n&&(n(e,a),a.ignore))return p(t);return r&&r.endSameAsBegin&&(r.endRe=RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"m")),r.skip?A+=t:(r.excludeBegin&&(A+=t),u(),r.returnBegin||r.excludeBegin||(A=t)),h(r),r.returnBegin?0:t.length}(r);if("illegal"===r.type&&!a){const e=Error('Illegal lexeme "'+i+'" for mode "'+(y.className||"<unnamed>")+'"');throw e.mode=y,e}if("end"===r.type){var s=function(e){var t=e[0],r=o.substr(e.index),a=function e(t,r,a){let i=function(e,n){var t=e&&e.exec(n);return t&&0===t.index}(t.endRe,a);if(i){if(t["on:end"]){const e=new n(t);t["on:end"](r,e),e.ignore&&(i=!1)}if(i){for(;t.endsParent&&t.parent;)t=t.parent;return t}}if(t.endsWithParent)return e(t.parent,r,a)}(y,e,r);if(!a)return M;var i=y;i.skip?A+=t:(i.returnEnd||i.excludeEnd||(A+=t),u(),i.excludeEnd&&(A=t));do{y.className&&k.closeNode(),y.skip||y.subLanguage||(I+=y.relevance),y=y.parent}while(y!==a.parent);return a.starts&&(a.endSameAsBegin&&(a.starts.endRe=a.endRe),h(a.starts)),i.returnEnd?0:t.length}(r);if(s!==M)return s}if("illegal"===r.type&&""===i)return 1;if(B>1e5&&B>3*r.index)throw Error("potential infinite loop, way more iterations than matches");return A+=i,i.length}var E=T(e);if(!E)throw console.error(g.replace("{}",e)),Error('Unknown language: "'+e+'"');var _=function(e){function n(n,t){return RegExp(d(n),"m"+(e.case_insensitive?"i":"")+(t?"g":""))}class t{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,n){n.position=this.position++,this.matchIndexes[this.matchAt]=n,this.regexes.push([n,e]),this.matchAt+=function(e){return RegExp(e.toString()+"|").exec("").length-1}(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const e=this.regexes.map(e=>e[1]);this.matcherRe=n(function(e,n="|"){for(var t=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./,r=0,a="",i=0;i<e.length;i++){var s=r+=1,o=d(e[i]);for(i>0&&(a+=n),a+="(";o.length>0;){var l=t.exec(o);if(null==l){a+=o;break}a+=o.substring(0,l.index),o=o.substring(l.index+l[0].length),"\\"===l[0][0]&&l[1]?a+="\\"+(+l[1]+s):(a+=l[0],"("===l[0]&&r++)}a+=")"}return a}(e),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const n=this.matcherRe.exec(e);if(!n)return null;const t=n.findIndex((e,n)=>n>0&&void 0!==e),r=this.matchIndexes[t];return n.splice(0,t),Object.assign(n,r)}}class a{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const n=new t;return this.rules.slice(e).forEach(([e,t])=>n.addRule(e,t)),n.compile(),this.multiRegexes[e]=n,n}considerAll(){this.regexIndex=0}addRule(e,n){this.rules.push([e,n]),"begin"===n.type&&this.count++}exec(e){const n=this.getMatcher(this.regexIndex);n.lastIndex=this.lastIndex;const t=n.exec(e);return t&&(this.regexIndex+=t.position+1,this.regexIndex===this.count&&(this.regexIndex=0)),t}}function i(e,n){const t=e.input[e.index-1],r=e.input[e.index+e[0].length];"."!==t&&"."!==r||n.ignoreMatch()}if(e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return function t(s,o){const l=s;if(s.compiled)return l;s.compiled=!0,s.__beforeBegin=null,s.keywords=s.keywords||s.beginKeywords;let c=null;if("object"==typeof s.keywords&&(c=s.keywords.$pattern,delete s.keywords.$pattern),s.keywords&&(s.keywords=function(e,n){var t={};return"string"==typeof e?r("keyword",e):Object.keys(e).forEach((function(n){r(n,e[n])})),t;function r(e,r){n&&(r=r.toLowerCase()),r.split(" ").forEach((function(n){var r=n.split("|");t[r[0]]=[e,w(r[0],r[1])]}))}}(s.keywords,e.case_insensitive)),s.lexemes&&c)throw Error("ERR: Prefer `keywords.$pattern` to `mode.lexemes`, BOTH are not allowed. (see mode reference) ");return l.keywordPatternRe=n(s.lexemes||c||/\w+/,!0),o&&(s.beginKeywords&&(s.begin="\\b("+s.beginKeywords.split(" ").join("|")+")(?=\\b|\\s)",s.__beforeBegin=i),s.begin||(s.begin=/\B|\b/),l.beginRe=n(s.begin),s.endSameAsBegin&&(s.end=s.begin),s.end||s.endsWithParent||(s.end=/\B|\b/),s.end&&(l.endRe=n(s.end)),l.terminator_end=d(s.end)||"",s.endsWithParent&&o.terminator_end&&(l.terminator_end+=(s.end?"|":"")+o.terminator_end)),s.illegal&&(l.illegalRe=n(s.illegal)),void 0===s.relevance&&(s.relevance=1),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map((function(e){return function(e){return e.variants&&!e.cached_variants&&(e.cached_variants=e.variants.map((function(n){return r(e,{variants:null},n)}))),e.cached_variants?e.cached_variants:function e(n){return!!n&&(n.endsWithParent||e(n.starts))}(e)?r(e,{starts:e.starts?r(e.starts):null}):Object.isFrozen(e)?r(e):e}("self"===e?s:e)}))),s.contains.forEach((function(e){t(e,l)})),s.starts&&t(s.starts,o),l.matcher=function(e){const n=new a;return e.contains.forEach(e=>n.addRule(e.begin,{rule:e,type:"begin"})),e.terminator_end&&n.addRule(e.terminator_end,{type:"end"}),e.illegal&&n.addRule(e.illegal,{type:"illegal"}),n}(l),l}(e)}(E),N="",y=s||_,O={},k=new f.__emitter(f);!function(){for(var e=[],n=y;n!==E;n=n.parent)n.className&&e.unshift(n.className);e.forEach(e=>k.openNode(e))}();var A="",I=0,S=0,B=0,L=!1;try{for(y.matcher.considerAll();;){B++,L?L=!1:(y.matcher.lastIndex=S,y.matcher.considerAll());const e=y.matcher.exec(o);if(!e)break;const n=x(o.substring(S,e.index),e);S=e.index+n}return x(o.substr(S)),k.closeAllNodes(),k.finalize(),N=k.toHTML(),{relevance:I,value:N,language:e,illegal:!1,emitter:k,top:y}}catch(n){if(n.message&&n.message.includes("Illegal"))return{illegal:!0,illegalBy:{msg:n.message,context:o.slice(S-100,S+100),mode:n.mode},sofar:N,relevance:0,value:R(o),emitter:k};if(l)return{illegal:!1,relevance:0,value:R(o),emitter:k,language:e,top:y,errorRaised:n};throw n}}function v(e,n){n=n||f.languages||Object.keys(i);var t=function(e){const n={relevance:0,emitter:new f.__emitter(f),value:R(e),illegal:!1,top:h};return n.emitter.addText(e),n}(e),r=t;return n.filter(T).filter(I).forEach((function(n){var a=m(n,e,!1);a.language=n,a.relevance>r.relevance&&(r=a),a.relevance>t.relevance&&(r=t,t=a)})),r.language&&(t.second_best=r),t}function x(e){return f.tabReplace||f.useBR?e.replace(c,e=>"\n"===e?f.useBR?"<br>":e:f.tabReplace?e.replace(/\t/g,f.tabReplace):e):e}function E(e){let n=null;const t=function(e){var n=e.className+" ";n+=e.parentNode?e.parentNode.className:"";const t=f.languageDetectRe.exec(n);if(t){var r=T(t[1]);return r||(console.warn(g.replace("{}",t[1])),console.warn("Falling back to no-highlight mode for this block.",e)),r?t[1]:"no-highlight"}return n.split(/\s+/).find(e=>p(e)||T(e))}(e);if(p(t))return;S("before:highlightBlock",{block:e,language:t}),f.useBR?(n=document.createElement("div")).innerHTML=e.innerHTML.replace(/\n/g,"").replace(/<br[ /]*>/g,"\n"):n=e;const r=n.textContent,a=t?b(t,r,!0):v(r),i=O(n);if(i.length){const e=document.createElement("div");e.innerHTML=a.value,a.value=k(i,O(e),r)}a.value=x(a.value),S("after:highlightBlock",{block:e,result:a}),e.innerHTML=a.value,e.className=function(e,n,t){var r=n?s[n]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),e.includes(r)||a.push(r),a.join(" ").trim()}(e.className,t,a.language),e.result={language:a.language,re:a.relevance,relavance:a.relevance},a.second_best&&(e.second_best={language:a.second_best.language,re:a.second_best.relevance,relavance:a.second_best.relevance})}const N=()=>{if(!N.called){N.called=!0;var e=document.querySelectorAll("pre code");a.forEach.call(e,E)}};function T(e){return e=(e||"").toLowerCase(),i[e]||i[s[e]]}function A(e,{languageName:n}){"string"==typeof e&&(e=[e]),e.forEach(e=>{s[e]=n})}function I(e){var n=T(e);return n&&!n.disableAutodetect}function S(e,n){var t=e;o.forEach((function(e){e[t]&&e[t](n)}))}Object.assign(t,{highlight:b,highlightAuto:v,fixMarkup:x,highlightBlock:E,configure:function(e){f=y(f,e)},initHighlighting:N,initHighlightingOnLoad:function(){window.addEventListener("DOMContentLoaded",N,!1)},registerLanguage:function(e,n){var r=null;try{r=n(t)}catch(n){if(console.error("Language definition for '{}' could not be registered.".replace("{}",e)),!l)throw n;console.error(n),r=h}r.name||(r.name=e),i[e]=r,r.rawDefinition=n.bind(null,t),r.aliases&&A(r.aliases,{languageName:e})},listLanguages:function(){return Object.keys(i)},getLanguage:T,registerAliases:A,requireLanguage:function(e){var n=T(e);if(n)return n;throw Error("The '{}' language is required, but not loaded.".replace("{}",e))},autoDetection:I,inherit:y,addPlugin:function(e){o.push(e)}}),t.debugMode=function(){l=!1},t.safeMode=function(){l=!0},t.versionString="10.1.2";for(const n in _)"object"==typeof _[n]&&e(_[n]);return Object.assign(t,_),t}({})}();"object"==typeof exports&&"undefined"!=typeof module&&(module.exports=hljs);hljs.registerLanguage("xml",function(){"use strict";return function(e){var n={className:"symbol",begin:"&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;"},a={begin:"\\s",contains:[{className:"meta-keyword",begin:"#?[a-z_][a-z1-9_-]+",illegal:"\\n"}]},s=e.inherit(a,{begin:"\\(",end:"\\)"}),t=e.inherit(e.APOS_STRING_MODE,{className:"meta-string"}),i=e.inherit(e.QUOTE_STRING_MODE,{className:"meta-string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:"[A-Za-z0-9\\._:-]+",relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[n]},{begin:/'/,end:/'/,contains:[n]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,contains:[{className:"meta",begin:"<![a-z]",end:">",relevance:10,contains:[a,i,t,s,{begin:"\\[",end:"\\]",contains:[{className:"meta",begin:"<![a-z]",end:">",contains:[a,s,i,t]}]}]},e.COMMENT("\x3c!--","--\x3e",{relevance:10}),{begin:"<\\!\\[CDATA\\[",end:"\\]\\]>",relevance:10},n,{className:"meta",begin:/<\?xml/,end:/\?>/,relevance:10},{className:"tag",begin:"<style(?=\\s|>)",end:">",keywords:{name:"style"},contains:[c],starts:{end:"</style>",returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:"<script(?=\\s|>)",end:">",keywords:{name:"script"},contains:[c],starts:{end:"<\/script>",returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:"</?",end:"/?>",contains:[{className:"name",begin:/[^\/><\s]+/,relevance:0},c]}]}}}());hljs.registerLanguage("markdown",function(){"use strict";return function(n){const e={begin:"<",end:">",subLanguage:"xml",relevance:0},a={begin:"\\[.+?\\][\\(\\[].*?[\\)\\]]",returnBegin:!0,contains:[{className:"string",begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0,relevance:0},{className:"link",begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}],relevance:10},i={className:"strong",contains:[],variants:[{begin:/_{2}/,end:/_{2}/},{begin:/\*{2}/,end:/\*{2}/}]},s={className:"emphasis",contains:[],variants:[{begin:/\*(?!\*)/,end:/\*/},{begin:/_(?!_)/,end:/_/,relevance:0}]};i.contains.push(s),s.contains.push(i);var c=[e,a];return i.contains=i.contains.concat(c),s.contains=s.contains.concat(c),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:c=c.concat(i,s)},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:c}]}]},e,{className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},i,s,{className:"quote",begin:"^>\\s+",contains:c,end:"$"},{className:"code",variants:[{begin:"(`{3,})(.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})(.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},{begin:"^[-\\*]{3,}",end:"$"},a,{begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]}]}}}());hljs.registerLanguage("perl",function(){"use strict";return function(e){var n={$pattern:/[\w.]+/,keyword:"getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qq fileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmget sub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedir ioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when"},t={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:n},s={begin:"->{",end:"}"},r={variants:[{begin:/\$\d/},{begin:/[\$%@](\^\w\b|#\w+(::\w+)*|{\w+}|\w+(::\w*)*)/},{begin:/[\$%@][^\s\w{]/,relevance:0}]},i=[e.BACKSLASH_ESCAPE,t,r],a=[r,e.HASH_COMMENT_MODE,e.COMMENT("^\\=\\w","\\=cut",{endsWithParent:!0}),s,{className:"string",contains:i,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*\\<",end:"\\>",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:"{\\w+}",contains:[],relevance:0},{begin:"-?\\w+\\s*\\=\\>",contains:[],relevance:0}]},{className:"number",begin:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",relevance:0},{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",begin:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",relevance:10},{className:"regexp",begin:"(m|qr)?/",end:"/[a-z]*",contains:[e.BACKSLASH_ESCAPE],relevance:0}]},{className:"function",beginKeywords:"sub",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return t.contains=a,s.contains=a,{name:"Perl",aliases:["pl","pm"],keywords:n,contains:a}}}());hljs.registerLanguage("plaintext",function(){"use strict";return function(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}}());hljs.registerLanguage("ini",function(){"use strict";function e(e){return e?"string"==typeof e?e:e.source:null}function n(...n){return n.map(n=>e(n)).join("")}return function(a){var s={className:"number",relevance:0,variants:[{begin:/([\+\-]+)?[\d]+_[\d_]+/},{begin:a.NUMBER_RE}]},i=a.COMMENT();i.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];var t={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)}/}]},r={className:"literal",begin:/\bon|off|true|false|yes|no\b/},l={className:"string",contains:[a.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},c={begin:/\[/,end:/\]/,contains:[i,r,t,l,s,"self"],relevance:0},g="("+[/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/].map(n=>e(n)).join("|")+")";return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[i,{className:"section",begin:/\[+/,end:/\]+/},{begin:n(g,"(\\s*\\.\\s*",g,")*",n("(?=",/\s*=\s*[^#\s]/,")")),className:"attr",starts:{end:/$/,contains:[i,c,r,t,l,s]}}]}}}());hljs.registerLanguage("json",function(){"use strict";return function(n){var e={literal:"true false null"},i=[n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE],t=[n.QUOTE_STRING_MODE,n.C_NUMBER_MODE],a={end:",",endsWithParent:!0,excludeEnd:!0,contains:t,keywords:e},l={begin:"{",end:"}",contains:[{className:"attr",begin:/"/,end:/"/,contains:[n.BACKSLASH_ESCAPE],illegal:"\\n"},n.inherit(a,{begin:/:/})].concat(i),illegal:"\\S"},s={begin:"\\[",end:"\\]",contains:[n.inherit(a)],illegal:"\\S"};return t.push(l,s),i.forEach((function(n){t.push(n)})),{name:"JSON",contains:t,keywords:e,illegal:"\\S"}}}());hljs.registerLanguage("ruby",function(){"use strict";return function(e){var n="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",a={keyword:"and then defined module in return redo if BEGIN retry end for self when next until do begin unless END rescue else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor",literal:"true false nil"},s={className:"doctag",begin:"@[A-Za-z]+"},i={begin:"#<",end:">"},r=[e.COMMENT("#","$",{contains:[s]}),e.COMMENT("^\\=begin","^\\=end",{contains:[s],relevance:10}),e.COMMENT("^__END__","\\n$")],c={className:"subst",begin:"#\\{",end:"}",keywords:a},t={className:"string",contains:[e.BACKSLASH_ESCAPE,c],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:"%[qQwWx]?\\(",end:"\\)"},{begin:"%[qQwWx]?\\[",end:"\\]"},{begin:"%[qQwWx]?{",end:"}"},{begin:"%[qQwWx]?<",end:">"},{begin:"%[qQwWx]?/",end:"/"},{begin:"%[qQwWx]?%",end:"%"},{begin:"%[qQwWx]?-",end:"-"},{begin:"%[qQwWx]?\\|",end:"\\|"},{begin:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/},{begin:/<<[-~]?'?(\w+)(?:.|\n)*?\n\s*\1\b/,returnBegin:!0,contains:[{begin:/<<[-~]?'?/},e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,c]})]}]},b={className:"params",begin:"\\(",end:"\\)",endsParent:!0,keywords:a},d=[t,i,{className:"class",beginKeywords:"class module",end:"$|;",illegal:/=/,contains:[e.inherit(e.TITLE_MODE,{begin:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{begin:"<\\s*",contains:[{begin:"("+e.IDENT_RE+"::)?"+e.IDENT_RE}]}].concat(r)},{className:"function",beginKeywords:"def",end:"$|;",contains:[e.inherit(e.TITLE_MODE,{begin:n}),b].concat(r)},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(\\!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[t,{begin:n}],relevance:0},{className:"number",begin:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",relevance:0},{begin:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{className:"params",begin:/\|/,end:/\|/,keywords:a},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[i,{className:"regexp",contains:[e.BACKSLASH_ESCAPE,c],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:"%r{",end:"}[a-z]*"},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(r),relevance:0}].concat(r);c.contains=d,b.contains=d;var g=[{begin:/^\s*=>/,starts:{end:"$",contains:d}},{className:"meta",begin:"^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+>|(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>)",starts:{end:"$",contains:d}}];return{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:a,illegal:/\/\*/,contains:r.concat(g).concat(d)}}}());hljs.registerLanguage("yaml",function(){"use strict";return function(e){var n="true false yes no null",a="[\\w#;/?:@&=+$,.~*\\'()[\\]]+",s={className:"string",relevance:0,variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,{className:"template-variable",variants:[{begin:"{{",end:"}}"},{begin:"%{",end:"}"}]}]},i=e.inherit(s,{variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),l={end:",",endsWithParent:!0,excludeEnd:!0,contains:[],keywords:n,relevance:0},t={begin:"{",end:"}",contains:[l],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]",contains:[l],illegal:"\\n",relevance:0},b=[{className:"attr",variants:[{begin:"\\w[\\w :\\/.-]*:(?=[ \t]|$)"},{begin:'"\\w[\\w :\\/.-]*":(?=[ \t]|$)'},{begin:"'\\w[\\w :\\/.-]*':(?=[ \t]|$)"}]},{className:"meta",begin:"^---s*$",relevance:10},{className:"string",begin:"[\\|>]([0-9]?[+-])?[ ]*\\n( *)[\\S ]+\\n(\\2[\\S ]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+a},{className:"type",begin:"!<"+a+">"},{className:"type",begin:"!"+a},{className:"type",begin:"!!"+a},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"\\-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:n,keywords:{literal:n}},{className:"number",begin:"\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b"},{className:"number",begin:e.C_NUMBER_RE+"\\b"},t,g,s],c=[...b];return c.pop(),c.push(i),l.contains=c,{name:"YAML",case_insensitive:!0,aliases:["yml","YAML"],contains:b}}}());hljs.registerLanguage("haskell",function(){"use strict";return function(e){var n={variants:[e.COMMENT("--","$"),e.COMMENT("{-","-}",{contains:["self"]})]},i={className:"meta",begin:"{-#",end:"#-}"},a={className:"meta",begin:"^#",end:"$"},s={className:"type",begin:"\\b[A-Z][\\w']*",relevance:0},l={begin:"\\(",end:"\\)",illegal:'"',contains:[i,a,{className:"type",begin:"\\b[A-Z][\\w]*(\\((\\.\\.|,|\\w+)\\))?"},e.inherit(e.TITLE_MODE,{begin:"[_a-z][\\w']*"}),n]};return{name:"Haskell",aliases:["hs"],keywords:"let in if then else case of where do module import hiding qualified type data newtype deriving class instance as default infix infixl infixr foreign export ccall stdcall cplusplus jvm dotnet safe unsafe family forall mdo proc rec",contains:[{beginKeywords:"module",end:"where",keywords:"module where",contains:[l,n],illegal:"\\W\\.|;"},{begin:"\\bimport\\b",end:"$",keywords:"import qualified as hiding",contains:[l,n],illegal:"\\W\\.|;"},{className:"class",begin:"^(\\s*)?(class|instance)\\b",end:"where",keywords:"class family instance where",contains:[s,l,n]},{className:"class",begin:"\\b(data|(new)?type)\\b",end:"$",keywords:"data family type newtype deriving",contains:[i,s,l,{begin:"{",end:"}",contains:l.contains},n]},{beginKeywords:"default",end:"$",contains:[s,l,n]},{beginKeywords:"infix infixl infixr",end:"$",contains:[e.C_NUMBER_MODE,n]},{begin:"\\bforeign\\b",end:"$",keywords:"foreign import export ccall stdcall cplusplus jvm dotnet safe unsafe",contains:[s,e.QUOTE_STRING_MODE,n]},{className:"meta",begin:"#!\\/usr\\/bin\\/env runhaskell",end:"$"},i,a,e.QUOTE_STRING_MODE,e.C_NUMBER_MODE,s,e.inherit(e.TITLE_MODE,{begin:"^[_a-z][\\w']*"}),n,{begin:"->|<-"}]}}}());hljs.registerLanguage("nix",function(){"use strict";return function(e){var n={keyword:"rec with let in inherit assert if else then",literal:"true false or and null",built_in:"import abort baseNameOf dirOf isNull builtins map removeAttrs throw toString derivation"},i={className:"subst",begin:/\$\{/,end:/}/,keywords:n},t={className:"string",contains:[i],variants:[{begin:"''",end:"''"},{begin:'"',end:'"'}]},s=[e.NUMBER_MODE,e.HASH_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t,{begin:/[a-zA-Z0-9-_]+(\s*=)/,returnBegin:!0,relevance:0,contains:[{className:"attr",begin:/\S+/}]}];return i.contains=s,{name:"Nix",aliases:["nixos"],keywords:n,contains:s}}}());hljs.registerLanguage("bash",function(){"use strict";return function(e){const s={};Object.assign(s,{className:"variable",variants:[{begin:/\$[\w\d#@][\w\d_]*/},{begin:/\$\{/,end:/\}/,contains:[{begin:/:-/,contains:[s]}]}]});const t={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},n={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,t]};t.contains.push(n);const a={begin:/\$\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,s]},i=e.SHEBANG({binary:"(fish|bash|zsh|sh|csh|ksh|tcsh|dash|scsh)",relevance:10}),c={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b-?[a-z\._]+\b/,keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},contains:[i,e.SHEBANG(),c,a,e.HASH_COMMENT_MODE,n,{className:"",begin:/\\"/},{className:"string",begin:/'/,end:/'/},s]}}}());hljs.registerLanguage("shell",function(){"use strict";return function(s){return{name:"Shell Session",aliases:["console"],contains:[{className:"meta",begin:"^\\s{0,3}[/\\w\\d\\[\\]()@-]*[>%$#]",starts:{end:"$",subLanguage:"bash"}}]}}}());hljs.registerLanguage("python",function(){"use strict";return function(e){var n={keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda async await nonlocal|10",built_in:"Ellipsis NotImplemented",literal:"False None True"},a={className:"meta",begin:/^(>>>|\.\.\.) /},i={className:"subst",begin:/\{/,end:/\}/,keywords:n,illegal:/#/},s={begin:/\{\{/,relevance:0},r={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/(u|b)?r?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/(u|b)?r?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/(fr|rf|f)'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a,s,i]},{begin:/(fr|rf|f)"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,s,i]},{begin:/(u|r|ur)'/,end:/'/,relevance:10},{begin:/(u|r|ur)"/,end:/"/,relevance:10},{begin:/(b|br)'/,end:/'/},{begin:/(b|br)"/,end:/"/},{begin:/(fr|rf|f)'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,s,i]},{begin:/(fr|rf|f)"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,i]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},l={className:"number",relevance:0,variants:[{begin:e.BINARY_NUMBER_RE+"[lLjJ]?"},{begin:"\\b(0o[0-7]+)[lLjJ]?"},{begin:e.C_NUMBER_RE+"[lLjJ]?"}]},t={className:"params",variants:[{begin:/\(\s*\)/,skip:!0,className:null},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,contains:["self",a,l,r,e.HASH_COMMENT_MODE]}]};return i.contains=[r,l,a],{name:"Python",aliases:["py","gyp","ipython"],keywords:n,illegal:/(<\/|->|\?)|=>/,contains:[a,l,{beginKeywords:"if",relevance:0},r,e.HASH_COMMENT_MODE,{variants:[{className:"function",beginKeywords:"def"},{className:"class",beginKeywords:"class"}],end:/:/,illegal:/[${=;\n,]/,contains:[e.UNDERSCORE_TITLE_MODE,t,{begin:/->/,endsWithParent:!0,keywords:"None"}]},{className:"meta",begin:/^[\t ]*@/,end:/$/},{begin:/\b(print|exec)\(/}]}}}());
···11-{profiles, ...}: {
22- # build with: `bud build bootstrap bootstrapIso`
33- # reachable on the local link via ssh root@fe80::47%eno1
44- # where 'eno1' is replaced by your own machine's network
55- # interface that has the local link to the target machine
66- imports = [
77- # profiles.networking
88- profiles.core
99- profiles.users.root
1010- # make sure to configure ssh keys
1111- profiles.users.nixos
1212- ];
1313- boot.loader.systemd-boot.enable = true;
1414- # will be overridden by the bootstrapIso instrumentation
1515- fileSystems."/" = {device = "/dev/disk/by-label/nixos";};
1616-}