Skip to content

Commit

Permalink
doc/start: add section for using mkflake
Browse files Browse the repository at this point in the history
  • Loading branch information
Pacman99 committed Mar 27, 2021
1 parent 0a0c6ba commit 95f34a3
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/start/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ In addition, the [binary cache](../../cachix) is added for faster deployment.
- [Make installable ISO](./iso.md)
- [Bootstrap Host](./bootstrapping.md)
- [Already on NixOS](./from-nixos.md)
- [Use Devos as a library!](./mkflake.md)


[install-nix]: https://nixos.org/manual/nix/stable/#sect-multi-user-installation
42 changes: 42 additions & 0 deletions doc/start/mkflake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Use Devos as a library!
You can also add devos as a flake input and use its library function, `mkFlake` to
create your flake. This gives you the advantage of using nix flakes to sync with
upstream changes in devos.

You can either use the default template or use the 'mkflake' template which only
includes the necessary folders for `mkFlake` usage. It can be pulled with:
```sh
nix flake init -t github:divnix/devos#mkflake
```

Once you have a template, you need to add devos as a flake input, which would look
like this:
```nix
inputs = {
...
devos.url = "github:divnix/devos";
};
```
> ##### Note:
> - All devos inputs must still be included in your flake, due to a nix
> [issue](https://github.com/NixOS/nix/pull/4641) with the `follows` attribute.
> - You can append `/community` to access community modules [extern](../../extern).
You can then call `mkFlake` to create your outputs. Here is a simple example:
```nix
outputs = { self, devos, ... }: devos.lib.mkFlake {
inherit self;
hosts = ./hosts;
};
```
`mkFlake` has various arguments to include more devos concepts like suites and profiles.
These options are documented in (mkFlakeOptions)[../mkFlakeOptions.md].

The devos template itself uses mkFlake to export its own outputs, so you can take
a look at this repository's [flake.nix](../../flake.nix) for a more realistic use
of `mkFlake`.

You can now sync with upstream devos changes just like any other flake input. But
you will no longer be able to edit devos's internals, since you are directly following
upstream devos changes.

0 comments on commit 95f34a3

Please sign in to comment.