Skip to content

Commit

Permalink
docs: NixOS module examples
Browse files Browse the repository at this point in the history
  • Loading branch information
cottand committed Dec 17, 2023
1 parent 55dcd81 commit dbb17ef
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 5 deletions.
52 changes: 48 additions & 4 deletions doc/src/Nix.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,66 @@ Leng is also packaged as [a Nix flake](../../flake.nix).

You can simply run `nix run github:cottand/leng` to run latest `master`.

## Installing
## Installing in NixOS via a Module

The leng flake also exports a NixOS module for easy deployment on NixOS machines.

### In your flake

```nix
{
# pinned version for safety
inputs.grimn.url = "github:cottand/leng/v1.3.1";
inputs = {
# pinned version for safety
leng.url = "github:cottand/leng/v1.4.0";
leng.nixpkgs.follows = "nixpkgs";
};
outputs = { self, leng }: {
outputs = { self, leng, ... }: {
# Use in your outputs
nixosConfigurations."this-is-a-server-innit" = nixpkgs.lib.nixosSystem {
modules = [
./configuration.nix
leng.nixosModules.default # <- import leng module
{
services.leng = { # <-- now you can use services.leng!
enable = true;
configuration = {
api = "127.0.0.1:8080";
metrics.enabled = true;
blocking.sourcesStore = "/var/lib/leng-sources";
};
};
}
];
};
};
}
```


### Legacy Nix

Add the following inside your configuration.nix:
```nix
{pkgs, lib, ... }: {
imports = [
# import leng module
(builtins.getFlake "github:cottand/leng/1.4.0").nixosModules.default
];
# now you can use services.leng!
services.leng = {
enable = true;
configuration = {
api = "127.0.0.1:8080";
metrics.enabled = true;
blocking.sourcesStore = "/var/lib/leng-sources";
};
};
}
```

## Developing

The flake's development shell simply includes Go 1.21+ and a [fish](https://fishshell.com/) shell. You can enter it with `nix develop`.
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
{
api = "127.0.0.1:8080";
metrics.enabled = true;
blocking.sourcesStore = "/var/leng-sources";
blocking.sourcesStore = "/var/lib/leng-sources";
}
'';
};
Expand Down

0 comments on commit dbb17ef

Please sign in to comment.