Manage system config using nix on any distro (numtide/system-manager fork)
Find a file
2023-03-23 17:07:04 +01:00
nix Allow to easily override the assertion for supported distros. 2023-03-23 14:57:18 +01:00
src Implement deactivate with a target host + documentation 2023-03-23 17:07:04 +01:00
.envrc Add nix shell and some checks 2023-02-02 00:55:37 +01:00
.gitignore Continue implementing basic features. 2023-02-02 17:31:10 +00:00
Cargo.lock cargo update 2023-03-22 15:59:36 +01:00
Cargo.toml Add extra info to cargo. 2023-03-21 17:13:32 +01:00
default.nix Add nix shell and some checks 2023-02-02 00:55:37 +01:00
flake.lock flake.lock: Update 2023-03-22 15:59:07 +01:00
flake.nix Move the systemsConfigs key so that every entry defines its system. Determine flake attrs automatically. 2023-03-14 20:37:35 +01:00
LICENSE Initial commit 2023-02-01 18:21:52 +02:00
README.md Update README. 2023-03-23 16:00:14 +01:00
shell.nix Add nix shell and some checks 2023-02-02 00:55:37 +01:00

System Manager using Nix

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

Getting 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 different options to install Nix, like the official installer or this new installer.

Usage with flakes

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

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

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

  outputs = { self, nixpkgs, system-manager }: {
    systemConfigs.default = self.lib.makeSystemConfig {
      system = flake-utils.lib.system.x86_64-linux;
      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, ... }:
let
  etcFiles = {
    "foo.conf".text = ''
        launch_the_rockets = true
    '';
  };

  services = {
    foo = {
      enable = true;
      serviceConfig = {
        Type = "oneshot";
        RemainAfterExit = true;
      };
      wantedBy = [ "multi-user.target" ];
      script = ''
        echo "We launched the rockets!"
      '';
    };
  };
in
{
  config = {
    system-manager = {
      etcFiles = lib.attrNames etcFiles;
      services = lib.attrNames services;
    };
    environment.etc = etcFiles;
    systemd = { inherit services; };
  };
}

Currently supported features

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