Skip to main content

Nix Integration

Runix provides a Nix flake with package builds, dev shells, a NixOS module, and a Home Manager module.

Flake Outputs​

OutputDescription
packages.<system>.defaultThe runix binary
devShells.<system>.defaultDevelopment shell with Go, gopls, golangci-lint, goreleaser
overlays.defaultOverlay that adds runix to pkgs
nixosModules.defaultNixOS system-level service module
homeManagerModules.defaultHome Manager user-level service module
formatter.<system>nixfmt-tree for Nix file formatting

Supported Systems​

  • x86_64-linux
  • aarch64-linux
  • x86_64-darwin
  • aarch64-darwin

Quick Usage​

Run directly​

nix run github:runixio/runix -- --help

Enter dev shell​

nix develop github:runixio/runix
# Provides: go, gopls, gotools, golangci-lint, goreleaser

Install to a profile​

nix profile install github:runixio/runix

Use in a flake​

{
inputs.runix.url = "github:runixio/runix";

outputs = { runix, ... }: {
# Access the package
packages.x86_64-linux.default = runix.packages.x86_64-linux.default;
};
}

Use the overlay​

{
inputs.runix.url = "github:runixio/runix";

outputs = { runix, nixpkgs, ... }: {
packages.x86_64-linux.default =
(import nixpkgs { overlays = [ runix.overlays.default ]; system = "x86_64-linux"; }).runix;
};
}

NixOS Module​

System-level Runix daemon with a dedicated system user and hardened systemd service.

Basic Setup​

{
inputs.runix.url = "github:runixio/runix";

outputs = { runix, nixpkgs, ... }: {
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
runix.nixosModules.default
{
services.runix.enable = true;
}
];
};
};
}

Configuration Options​

OptionTypeDefaultDescription
services.runix.enableboolfalseEnable the Runix service
services.runix.packagepackageflake packageThe runix package to use
services.runix.configDirstring"/etc/runix"Directory for runix.yaml
services.runix.settingsfreeform YAML{}Runix configuration (generates runix.yaml)
services.runix.settings.daemon.data_dirstring"/var/lib/runix"Data directory
services.runix.settings.daemon.socket_pathstring"/run/runix/runix.sock"Unix socket path
services.runix.settings.daemon.log_levelenum"info"Log level: trace, debug, info, warn, error, fatal, panic

Full Example​

{
services.runix.enable = true;

services.runix.settings = {
daemon.log_level = "debug";

defaults = {
restart_policy = "always";
max_restarts = 20;
};

processes = {
api = {
runtime = "go";
entrypoint = "./cmd/api";
env.PORT = "8080";
};
};
};
}

What the Module Creates​

ResourceDetails
System userrunix (isSystemUser, group runix)
Config file/etc/runix/runix.yaml (generated from settings)
systemd servicerunix.service — daemon start --config /etc/runix/runix.yaml
Runtime directory/run/runix/ (mode 0750)
State directoryManaged by systemd StateDirectory=runix

systemd Security Hardening​

The NixOS module applies these systemd security restrictions:

SettingValue
NoNewPrivilegestrue
ProtectSystemstrict
ProtectHometrue
PrivateTmptrue
LimitNOFILE65536

Home Manager Module​

User-level Runix daemon using systemd user services.

Basic Setup​

{
inputs.runix.url = "github:runixio/runix";

outputs = { runix, home-manager, ... }: {
homeConfigurations.user = home-manager.lib.homeManagerConfiguration {
modules = [
runix.homeManagerModules.default
{
services.runix.enable = true;
}
];
};
};
}

Configuration Options​

OptionTypeDefaultDescription
services.runix.enableboolfalseEnable the Runix service
services.runix.packagepackageflake packageThe runix package to use
services.runix.settingsfreeform YAML{}Runix configuration
services.runix.settings.daemon.data_dirstring"~/.runix"Data directory
services.runix.settings.daemon.socket_pathstring"~/.runix/tmp/runix.sock"Unix socket path
services.runix.settings.daemon.log_levelenum"info"Log level

What the Module Creates​

ResourceDetails
Packagerunix added to home.packages
Config file~/.config/runix/runix.yaml (generated from settings)
systemd user servicerunix.service — starts after default.target

Full Example​

{
services.runix.enable = true;

services.runix.settings = {
daemon.log_level = "info";

processes = {
web = {
runtime = "node";
entrypoint = "server.js";
env.PORT = "3000";
};
};
};
}

Package Build Details​

The package is defined in nix/package.nix:

SettingValue
BuilderbuildGoModule
CGO_ENABLED0 (static binary)
proxyVendortrue
ldflags-s -w (stripped) + version/build-time injection
PlatformsLinux + Darwin
Tests-short flag (E2E tests skipped in Nix build)

Formatting​

Format Nix files using the flake's formatter:

nix fmt

Uses nixfmt-tree (treefmt + nixfmt).

What's Next​