Files
2026-06-22 16:40:29 -04:00

126 lines
4.7 KiB
Markdown

# Nix
[flake.nix](https://github.com/tale/headplane/blob/main/flake.nix) provided:
```sh
$ nix flake show github:tale/headplane --all-systems
github:tale/headplane/ec6d455461955242393b60d9ce60c5123fa9784f?narHash=sha256-CM/vXzUiOed7i1Pp15KyV4FuIvumRlXnpF33dSWZZH4%3D
├───checks
│ ├───aarch64-darwin
│ │ └───default: derivation 'headplane-with-agent'
│ ├───x86_64-darwin
│ │ └───default: derivation 'headplane-with-agent'
│ └───x86_64-linux
│ └───default: derivation 'headplane-with-agent'
├───devShells
│ ├───aarch64-darwin
│ │ └───default: development environment 'headplane'
│ ├───x86_64-darwin
│ │ └───default: development environment 'headplane'
│ └───x86_64-linux
│ └───default: development environment 'headplane'
├───formatter
│ ├───aarch64-darwin: package 'alejandra-4.0.0'
│ ├───x86_64-darwin: package 'alejandra-4.0.0'
│ └───x86_64-linux: package 'alejandra-4.0.0'
├───nixosModules
│ └───headplane: NixOS module
├───overlays
│ └───default: Nixpkgs overlay
└───packages
├───aarch64-darwin
│ ├───headplane: package 'headplane-0.6.1'
│ ├───headplane-agent: package 'hp_agent-0.6.1'
│ ├───headplane-nixos-docs: package 'headplane-nixos-docs.md'
│ └───headplane-ssh-wasm: package 'headplane-ssh-wasm-0.6.1'
├───x86_64-darwin
│ ├───headplane: package 'headplane-0.6.1'
│ ├───headplane-agent: package 'hp_agent-0.6.1'
│ ├───headplane-nixos-docs: package 'headplane-nixos-docs.md'
│ └───headplane-ssh-wasm: package 'headplane-ssh-wasm-0.6.1'
└───x86_64-linux
├───headplane: package 'headplane-0.6.1'
├───headplane-agent: package 'hp_agent-0.6.1'
├───headplane-nixos-docs: package 'headplane-nixos-docs.md'
└───headplane-ssh-wasm: package 'headplane-ssh-wasm-0.6.1'
```
## NixOS module options
Defined as `services.headplane.*`, check the `./nix/` directory for details.\
The full (generated by `mise run nixos-docs`) list of `services.headplane.settings.*` options: [./NixOS-options.md](./NixOS-options.md)
## Usage
1. Add the `github:tale/headplane` flake input.
2. Import a default overlay to add `pkgs.headplane`.
3. Import NixOS module for `services.headplane.*`.
```nix
# Your flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
headplane = {
url = "github:tale/headplane";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
nixpkgs,
headplane,
...
}: {
nixosConfigurations.MY_MACHINE = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
# provides `services.headplane.*` NixOS options.
headplane.nixosModules.headplane
{
# provides `pkgs.headplane`
nixpkgs.overlays = [ headplane.overlays.default ];
}
{
{config, pkgs, ...}:
let
format = pkgs.formats.yaml {};
headscaleConfig = format.generate "headscale.yml" config.services.headscale.settings;
in {
services.headplane = {
enable = true;
settings = {
server = {
host = "127.0.0.1";
port = 3000;
# Using `sops-nix` as an example, can be a path to any file with a secret.
cookie_secret_path = config.sops.secrets."headplane/serverCookieSecret".path;
};
headscale = {
url = "https://example.com";
config_path = "${headscaleConfig}";
# Using `sops-nix` as an example, can be a path to any file with a secret.
api_key_path = config.sops.secrets."headplane/headscaleApiKey".path;
};
integration.agent = {
enabled = true;
};
oidc = {
issuer = "https://oidc.example.com";
client_id = "headplane";
# Using `sops-nix` as an example, can be a path to any file with a secret.
client_secret_path = config.sops.secrets."headplane/oidcClientSecret".path;
disable_api_key_login = true;
# Might needed when integrating with Authelia.
token_endpoint_auth_method = "client_secret_basic";
};
};
};
}
}
];
};
};
}
```