Skip to content

Commit

Permalink
nixos/bpfman: init module
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzapim committed Dec 29, 2024
1 parent a30de30 commit 65144fb
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2505.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@

- [nvidia-gpu](https://github.com/utkuozdemir/nvidia_gpu_exporter), a Prometheus exporter that scrapes `nvidia-smi` for GPU metrics. Available as [services.prometheus.exporters.nvidia-gpu](#opt-services.prometheus.exporters.nvidia-gpu.enable).

- [bpfman](https://bpfman.io), an eBPF Manager for Linux and Kubernetes. Availalbe as [services.bpfman](#opt-services.bpfman.enable).

- [InputPlumber](https://github.com/ShadowBlip/InputPlumber/), an open source input router and remapper daemon for Linux. Available as [services.inputplumber](#opt-services.inputplumber.enable).

- [Buffyboard](https://gitlab.postmarketos.org/postmarketOS/buffybox/-/tree/master/buffyboard), a framebuffer on-screen keyboard. Available as [services.buffyboard](option.html#opt-services.buffyboard).
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1380,6 +1380,7 @@
./services/security/vaultwarden/default.nix
./services/security/yubikey-agent.nix
./services/system/automatic-timezoned.nix
./services/system/bpfman.nix
./services/system/bpftune.nix
./services/system/cachix-agent/default.nix
./services/system/cachix-watch-store.nix
Expand Down
55 changes: 55 additions & 0 deletions nixos/modules/services/system/bpfman.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.bpfman;
settingsFormat = pkgs.formats.toml { };

inherit (lib)
literalExpression
mkIf
mkOption
mkEnableOption
mkPackageOption
;

inherit (lib.types) submodule;
in
{
options.services.bpfman = {
enable = mkEnableOption "bpfman";
package = mkPackageOption pkgs "bpfman" { };

settings = mkOption {
type = submodule {
freeformType = settingsFormat.type;
};

default = { };

example = literalExpression ''
{
signing.allow_unsigned = true;
database.max_retries = 10;
}
'';

description = ''
Configuration for bpfman.
Supported options can be found at the [docs](https://bpfman.io/v0.5.4/developer-guide/configuration).
'';
};
};

config = mkIf cfg.enable {
environment = {
systemPackages = [ pkgs.bpfman ];
etc."bpfman/bpfman.toml".source = settingsFormat.generate "bpfman.toml" cfg.settings;
};

systemd.packages = [ pkgs.bpfman ];
};
}
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ in {
borgmatic = handleTest ./borgmatic.nix {};
botamusique = handleTest ./botamusique.nix {};
bpf = handleTestOn ["x86_64-linux" "aarch64-linux"] ./bpf.nix {};
bpfman = runTest ./bpfman.nix;
bpftune = handleTest ./bpftune.nix {};
breitbandmessung = handleTest ./breitbandmessung.nix {};
brscan5 = handleTest ./brscan5.nix {};
Expand Down
15 changes: 15 additions & 0 deletions nixos/tests/bpfman.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{ pkgs, ... }:
{
name = "bpfman";
meta.maintainers = with pkgs.lib.maintainers; [ pizzapim ];

nodes.machine =
{ ... }:
{
services.bpfman.enable = true;
};

testScript = ''
machine.succeed("bpfman list | grep Program")
'';
}

0 comments on commit 65144fb

Please sign in to comment.