Manage system config using nix on any distro (numtide/system-manager fork)
Find a file
Ramses 7df7c7625a
Merge pull request #252 from numtide/renovate/serde_json-1.x-lockfile
fix(deps): update rust crate serde_json to v1.0.143
2025-08-23 15:28:19 +03:00
.github chore(deps): update actions/checkout action to v5 (#247) 2025-08-12 12:37:42 +02:00
examples Implement the user and group options for etc files 2025-02-04 16:00:54 +01:00
manual doc: Add system-manager manual mdBook (#206) 2025-05-26 09:02:56 +02:00
nix Configure nix settings (#257) 2025-08-21 00:24:02 +02:00
src fix: return an error if the activation of tmp files fails (#255) 2025-08-21 00:23:50 +02:00
test Configure nix settings (#257) 2025-08-21 00:24:02 +02:00
.envrc Add nix shell and some checks 2023-02-02 00:55:37 +01:00
.gitignore feat: nixpkgs-ify and unflake-ify system-manager 2024-10-29 11:25:16 +01:00
.pre-commit-config.yaml feat: nixpkgs-ify and unflake-ify system-manager 2024-10-29 11:25:16 +01:00
.treefmt.toml doc: Add system-manager manual mdBook (#206) 2025-05-26 09:02:56 +02:00
Cargo.lock Merge pull request #252 from numtide/renovate/serde_json-1.x-lockfile 2025-08-23 15:28:19 +03:00
Cargo.toml fix(deps): update rust crate nix to 0.30.0 (#223) 2025-05-26 09:04:30 +02:00
default.nix nix: splice the package properly (#234) 2025-05-22 10:52:50 +02:00
flake.lock Bump flake.lock and Cargo.lock (#193) 2025-05-26 09:04:46 +02:00
flake.nix Update nix-vm-test 2025-08-20 22:30:07 +02:00
LICENSE Initial commit 2023-02-01 18:21:52 +02:00
package.nix chore: update fmt 2025-08-20 22:30:46 +02:00
README.md chore: update fmt 2025-08-20 22:30:46 +02:00
renovate.json Add renovate.json 2024-07-26 09:34:06 +00:00
shell.nix doc: Add system-manager manual mdBook (#206) 2025-05-26 09:02:56 +02:00
system-manager.svg README: add new logo (#162) 2024-11-13 22:31:43 +01:00

system-manager

Manage system config using nix on any distro

A numtide project.

This project provides a basic method to manage system configuration using Nix on any Linux distribution. It builds on the many modules that already exist in NixOS.

Warning: System Manager is a work in progress, you can expect things not to work or to break.

Usage

Install Nix

In order to use System Manager, you will first need to install Nix. You can either use your distro's package manager, or use one of the available options to install Nix.

Note: Be advised that the Determinate Systems installer has the option for the official Nix as well as Determinate's own variant of Nix (Determinate Nix). It will prompt you for which one you want to install. System Manager is not tested against Determinate Nix. It's recommended to use the official Nix if installing via the Determinate Nix Installer.

Usage with flakes

Defining the configuration

A basic Nix flake using System Manager would look something like this:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

    system-manager = {
      url = "github:numtide/system-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, system-manager }: {
    systemConfigs.default = system-manager.lib.makeSystemConfig {
      modules = [
        ./modules
      ];
    };
  };
}

And you would then put your System Manager modules in the modules directory, which should contain a default.nix file which functions as the entrance point.

A simple System Manager module could look something like this:

{ config, lib, pkgs, ... }:

{
  config = {
    nixpkgs.hostPlatform = "x86_64-linux";

    environment = {
      etc = {
        "foo.conf".text = ''
          launch_the_rockets = true
        '';
      };
      systemPackages = [
        pkgs.ripgrep
        pkgs.fd
        pkgs.hello
      ];
    };

    systemd.services = {
      foo = {
        enable = true;
        serviceConfig = {
          Type = "oneshot";
          RemainAfterExit = true;
        };
        wantedBy = [ "system-manager.target" ];
        script = ''
          ${lib.getBin pkgs.hello}/bin/hello
          echo "We launched the rockets!"
        '';
      };
    };
  };
}

Activating the configuration

Once the configuration is defined, you can activate it using the system-manager CLI:

nix run 'github:numtide/system-manager' -- switch --flake '.'

Reproducibility

By design flakes run in pure evaluation mode. In some cases you may not want this. To run an impure evaluation of the flake, add the following option to your command:

--nix-option pure-eval false

Currently supported features

Currently it is possible to configure files under /etc/ and systemd services. More features may follow later.

Supported Systems

System Manager is currently only supported on NixOS and Ubuntu. However, it can be used on other distributions by enabling the following:

{
  config = {
    system-manager.allowAnyDistro = true;
  }
}

Warning

This is unsupported and untested. Use at your own risk.

Commercial support

Looking for help or customization?

Get in touch with Numtide to get a quote. We make it easy for companies to work with Open Source projects: https://numtide.com/contact