···5555several ready-made profiles for discretionary use.
56565757Every package and NixOS profile declared in community is uploaded to
5858-[cachix](./cachix), so everything provided is available without building
5959-anything. This is especially useful for the packages that are
6060-[overridden](./overrides) from master, as without the cache, rebuilds are
6161-quite frequent.
5858+[cachix](./integrations/cachix.md), so everything provided is available
5959+without building anything. This is especially useful for the packages that are
6060+[overridden](./concepts/overrides.md) from master, as without the cache,
6161+rebuilds are quite frequent.
62626363## Inspiration & Art
6464- [hlissner/dotfiles][dotfiles]
···11-# Cachix
22-The cachix directory simple captures the output of `sudo cachix use` for the
33-developers personal cache, as well as the nix-community cache. You can easily
44-add your own cache, assuming the template lives in /etc/nixos, by simply
55-running `sudo cachix use yourcache`.
66-77-These caches are only added to the system after a `nixos-rebuild switch`, so it
88-is recommended to call `cachix use nrdxp` before the initial deployment, as it
99-will save a lot of build time.
1010-1111-In the future, users will be able to skip this step once the ability to define
1212-the nix.conf within the flake is fully fleshed out upstream.
···11+# Key Concepts
22+33+There are few idioms unique to DevOS. This section is dedicated to helping you
44+understand them.
+1-1
doc/flk/home.md
···44synchronized, even when using other systems.
5566## Usage
77-The [users](../../users/index.md#external-usage) page contains a good usage
77+The [users](../concepts/users.md#external-usage) page contains a good usage
88example.
+2-2
doc/flk/update.md
···1111input in the subflake.
12121313For example, you can update any
1414-[package sources](../../pkgs#automatic-source-updates) you may have declared
1515-in _pkgs/flake.nix_:
1414+[package sources](../outputs/pkgs.md#automatic-source-updates) you may have
1515+declared in _pkgs/flake.nix_:
1616```sh
1717flk update pkgs
1818```
+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 your 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.
+1-1
doc/integrations/deploy.md
···44stateful nature of nixops' db. It was also designed from scratch to support
55flake based deployments, and so is an excellent tool for the job.
6677-By default, all the [hosts](../../hosts) are also available as deploy-rs nodes,
77+By default, all the [hosts](../concepts/hosts.md) are also available as deploy-rs nodes,
88configured with the hostname set to `networking.hostName`; overridable via
99the command line.
1010
+1-1
doc/integrations/hercules.md
···1515[binary-caches.json][cache].
16161717## Ready to Use
1818-The repo is already set up with the proper _nix/ci.nix_ file, building all
1818+The repo is already set up with the proper _default.nix_ file, building all
1919declared packages, checks, profiles and shells. So you can see if something
2020breaks, and never build the same package twice!
2121
-4
doc/layout.md
···11-# Layout
22-Each of the following sections is a directory in the root of the project
33-serving a singular purpose. Select a chapter to read more about its purpose
44-and usage.
+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.
+10-10
doc/start/bootstrapping.md
···11# Bootstrapping
2233-This will help you boostrap a bare host with the help of the
44-[bespoke iso](./iso) live installer.
33+This will help you boostrap a bare host with the help of the
44+[bespoke iso](./iso.md) live installer.
5566-_Note: nothing prevents you from remotely executing the boostrapping
66+_Note: nothing prevents you from remotely executing the boostrapping
77process. See below._
8899Once your target host has booted into the live iso, you need to partion
···1414Then properly mount the formatted partitions at `/mnt`, so that you can
1515install your system to those new partitions.
16161717-Mount `nixos` partition to `/mnt` and — for UEFI — `boot`
1717+Mount `nixos` partition to `/mnt` and — for UEFI — `boot`
1818partition to `/mnt/boot`:
19192020```console
···25252626## Install
27272828-Install using the `flk` wrapper baked into the iso off of a copy of devos
2828+Install using the `flk` wrapper baked into the iso off of a copy of devos
2929from the time the iso was built:
30303131```console
···4141### Remote access to the live installer
42424343The iso live installer comes preconfigured with a network configuration
4444-which announces it's hostname via [MulticastDNS][mDNS] as `hostname.local`,
4444+which announces it's hostname via [MulticastDNS][mDNS] as `hostname.local`,
4545that is `NixOS.local` in the [iso example](./iso).
46464747In the rare case that [MulticastDNS][mDNS] is not availabe or turned off
···5050`n=14 i=9 x=24; 47 = n+i+x`).
51515252Provided that you have added your public key to the authorized keys of the
5353-`root` user _(hint: [`deploy-rs`](../integrations/deploy) needs passwordless
5353+`root` user _(hint: [`deploy-rs`](../integrations/deploy.md) needs passwordless
5454sudo access)_:
55555656```nix
···6262}
6363```
64646565-You can then ssh into the live installer through one of the
6565+You can then ssh into the live installer through one of the
6666following options:
67676868```console
···73737474_Note: the [static link-local IPv6 address][staticLLA] and [MulticastDNS][mDNS] is only
7575configured on the live installer. If you wish to enable [MulticastDNS][mDNS]
7676-for your environment, you ought to configure that in a regular [profile](../../profiles)._
7676+for your environment, you ought to configure that in a regular [profile](../concepts/profiles.md)._
77777878### EUI-64 LLA & Host Identity
7979···8888ip -6 neigh show # also shows fe80::47
8989```
90909191-***This LLA is stable for the host, unless you need to swap that particular network card.***
9191+***This LLA is stable for the host, unless you need to swap that particular network card.***
9292Under this reservation, though, you may use this EUI-64 to wire up a specific
9393(cryptographic) host identity.
9494
+2-2
doc/start/from-nixos.md
···1515set to the filename of your hosts file, so `hosts/my-host.nix` will have the
1616hostname `my-host`.
17171818-Now might be a good time to read the docs on [suites](../../suites) and
1919-[profiles](../../profiles) and add or create any that you need.
1818+Now might be a good time to read the docs on [suites](../concepts/suites.md) and
1919+[profiles](../concepts/profiles.md) and add or create any that you need.
20202121> ##### _Note:_
2222> While the `up` sub-command is provided as a convenience to quickly set up and
+1-1
doc/start/index.md
···2222nix-shell that provides all the dependencies, including the unstable nix
2323version required.
24242525-In addition, the [binary cache](../../cachix) is added for faster deployment.
2525+In addition, the [binary cache](../integrations/cachix.md) is added for faster deployment.
26262727> ##### _Notes:_
2828> - You can change `core` to [`community`](../../index.md#community-profiles)
+36
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+## Lib Tests
99+You can easily write tests for your own library functions in the
1010+___tests/lib.nix___ file and they will be run on every `nix flake check` or
1111+during a CI run.
1212+1313+## Unit Tests
1414+Unit tests are can be created from regular derivations, and they can do
1515+almost anything you can imagine. By convention, it is best to test your
1616+packages during their [check phase][check]. All packages and their tests will
1717+be built during CI.
1818+1919+## Integration Tests
2020+You can write integration tests for one or more NixOS VMs that can,
2121+optionally, be networked together, and yes, it's as awesome as it sounds!
2222+2323+Be sure to use the `mkTest` function, in the [___tests/default.nix___][default]
2424+which wraps the official [testing-python][testing-python] function to ensure
2525+that the system is setup exactly as it is for a bare DevOS system. There are
2626+already great resources for learning how to use these tests effectively,
2727+including the official [docs][test-doc], a fantastic [blog post][test-blog],
2828+and the examples in [nixpkgs][nixos-tests].
2929+3030+[test-doc]: https://nixos.org/manual/nixos/stable/index.html#sec-nixos-tests
3131+[test-blog]: https://www.haskellforall.com/2020/11/how-to-use-nixos-for-lightweight.html
3232+[default]: https://github.com/divnix/devos/tree/core/tests/default.nix
3333+[run-test]: https://github.com/NixOS/nixpkgs/blob/6571462647d7316aff8b8597ecdf5922547bf365/lib/debug.nix#L154-L166
3434+[nixos-tests]: https://github.com/NixOS/nixpkgs/tree/master/nixos/tests
3535+[testing-python]: https://github.com/NixOS/nixpkgs/tree/master/nixos/lib/testing-python.nix
3636+[check]: https://nixos.org/manual/nixpkgs/stable/#ssec-check-phase
···17171818It is recommended that the host modules only contain configuration information
1919specific to a particular piece of hardware. Anything reusable across machines
2020-is best saved for [profile modules](../profiles).
2020+is best saved for [profile modules](./profiles.md).
21212222-This is a good place to import sets of profiles, called [suites](../suites),
2222+This is a good place to import sets of profiles, called [suites](./suites.md),
2323that you intend to use on your machine.
24242525Additionally, this is the perfect place to import anything you might need from
2626the [nixos-hardware][nixos-hardware] repository.
27272828> ##### _Note:_
2929-> Set `nixpkgs.system` to the architecture of this host, default is "x86_64-linux".
2929+> Set `nixpkgs.system` to the architecture of this host, default is "x86_64-linux".
3030> Keep in mind that not all packages are available for all architectures.
31313232## Example
···44nixpkgs proper once your module is sufficiently stable.
5566All modules linked in _module-list.nix_ are automatically exported via
77-`nixosModules.<file-basename>`, and imported into all [hosts](../hosts).
77+`nixosModules.<file-basename>`, and imported into all [hosts](../concepts/hosts.md).
88991010> ##### _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](../profiles) instead.
1313+> , use [profiles](../concepts/profiles.md) instead.
14141515## Semantics
1616In case you've never written a module for nixpkgs before, here is a brief
···33we want to keep the process as simple and straightforward as possible.
4455Any _.nix_ files declared in this directory will be assumed to be a valid
66-overlay, and will be automatically imported into all [hosts](../hosts), and
66+overlay, and will be automatically imported into all [hosts](../concepts/hosts.md), and
77exported via `overlays.<file-basename>` _as well as_
88`packages.<system>.<pkgName>` (for valid systems), so all you have to do is
99write it.
+3-2
overrides/README.md
doc/concepts/overrides.md
···11# Overrides
22-By default, the NixOS systems are based on the latest release. While it is
33-trivial to change this to nixos-unstable or any other branch of nixpkgs by
22+By default, the NixOS systems are based on unstable. While it is trivial to
33+change this to a stable release, or any other branch of nixpkgs by
44changing the flake url, sometimes all we want is a single package from another
55branch.
66···88nixpkgs/master, but you can change the `override` flake input url to
99nixos-unstable, or even a specific sha revision.
10101111+They are defined in the `extern/overrides.nix` file.
11121213## Example
1314
overrides/default.nix
extern/overrides.nix
+4-5
pkgs/README.md
doc/outputs/pkgs.md
···11# Packages
22-Similar to [modules](../modules), the pkgs directory mirrors the upstream
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
44your package, it's as simple as dropping it into the nixpkgs/pkgs directory.
55···1212the supported systems listed in the package's `meta.platforms` attribute.
13131414And, as usual, every package in the overlay is also available to any NixOS
1515-[host](../hosts).
1515+[host](../concepts/hosts.md).
16161717## Automatic Source Updates
1818There is the added, but optional, convenience of declaring your sources in
1919_pkgs/flake.nix_ as an input. You can then access them from the `srcs` package.
2020This allows updates to be managed automatically by simply
2121-[updating](../doc/flk/update.md#updating-package-sources) the lock file. No
2121+[updating](../flk/update.md#updating-package-sources) the lock file. No
2222more manually entering sha256 hashes!
23232424As an added bonus, version strings are also generated automatically from either
2525-the flake ref, or the date and git revision of the source. For examples,
2626-definitely checkout the [community branch](../#community-profiles).
2525+the flake ref, or the date and git revision of the source.
27262827## Example
2928pkgs/development/libraries/libinih/default.nix:
+5-5
profiles/README.md
doc/concepts/profiles.md
···1212For the sake of consistency, a profile should always be defined in a
1313___default.nix___ containing a [nixos module config][config].
1414A profile's directory is used for quick modularization of
1515-[interelated bits](./#subprofiles).
1515+[interelated bits](./profiles.md#subprofiles).
16161717> ##### _Notes:_
1818-> * For _declaring_ module options, there's the [modules](../modules) directory.
1818+> * For _declaring_ module options, there's the [modules](../outputs/modules.md) directory.
1919> * This directory takes inspiration from
2020> [upstream](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/profiles)
2121> .
2222> * Sticking to a simple [spec][spec] has refreshing advantages.
2323-> [hercules-ci](../doc/integrations/hercules.md) expects all profiles to be
2323+> [hercules-ci](../integrations/hercules.md) expects all profiles to be
2424> defined in a ___default.nix___, allowing them to be built automatically when
2525-> added. Congruently, [suites](../suites) expect ___default.nix___ to avoid
2525+> added. Congruently, [suites](suites.md) expect ___default.nix___ to avoid
2626> having to manage their paths manually.
27272828## Subprofiles
···5656Profiles are the most important concept in DevOS. They allow us to keep our
5757Nix expressions self contained and modular. This way we can maximize reuse
5858across hosts while minimizing boilerplate. Remember, anything machine
5959-specific belongs in your [host](../hosts) files instead.
5959+specific belongs in your [host](hosts.md) files instead.
60606161[definition]: https://nixos.org/manual/nixos/stable/index.html#sec-option-definitions
6262[declaration]: https://nixos.org/manual/nixos/stable/index.html#sec-option-declarations
···66In the future, we will use suites as a mechanism for deploying various machine
77types which don't depend on hardware, such as vm's and containers.
8899+They are defined in `profiles/suites.nix`.
1010+911## Definition
1012```nix
1113rec {
suites/default.nix
profiles/suites.nix
theme/highlight.js
doc/theme/highlight.js
+6-4
users/README.md
doc/concepts/users.md
···11# Users
2233-Users are a special case of [profiles](../profiles) that define system
33+Users are a special case of [profiles](profiles.md) that define system
44users and [home-manager][home-manager] configurations. For your convenience,
55home manager is wired in by default so all you have to worry about is declaring
66your users. For a fully fleshed out example, check out the developers personal
···24242525## Home Manager
2626Home Manager support follows the same principles as regular nixos configurations.
2727-All modules defined in [user modules](./modules/module-list.nix) will be imported to
2828-Home Manager. All profiles are availabe in [suites](../suites/default.nix) as userProfiles.
2727+All modules defined in [user modules][modules-list] will be imported to
2828+Home Manager. All profiles are availabe in [suites][suites] as userProfiles.
2929The `userSuites` output will be available in your Home Manager Configuration as
3030the special argument, `suites`.
31313232## External Usage
3333You can easily use the defined home-manager configurations outside of NixOS
3434-using the `homeConfigurations` flake output. The [flk](../doc/flk) helper
3434+using the `homeConfigurations` flake output. The [flk](../flk/index.md) helper
3535script makes this even easier.
36363737This is great for keeping your environment consistent across Unix systems,
···5656```
57575858[home-manager]: https://nix-community.github.io/home-manager
5959+[suites]: https://github.com/divnix/devos/tree/core/suites/default.nix
6060+[modules-list]: https://github.com/divnix/devos/tree/core/modules/module-list.nix