Manage system config using nix on any distro (numtide/system-manager fork)
Find a file
2023-03-10 21:18:35 +01:00
nix WIP 2023-03-08 00:24:10 +01:00
src WIP, etc tree implementation. 2023-03-10 21:18:35 +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 Add im crate. 2023-03-10 21:13:25 +01:00
Cargo.toml Add im crate. 2023-03-10 21:13:25 +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-10 21:12:07 +01:00
flake.nix Use latest stable for now. 2023-03-10 21:12:59 +01:00
LICENSE Initial commit 2023-02-01 18:21:52 +02:00
README.md Work on properly implementing the activation of systemd services. 2023-02-09 15:04:27 +00:00
shell.nix Add nix shell and some checks 2023-02-02 00:55:37 +01:00

Profile generation

Activation strategy

The activation script calls system-manager activate, which will perform the following actions.

Systemd services

The info about services (name and store path of the service file) is found in a file called services/services.json in the system-manager configuration directory. The info about the services that were part of the previous generation is stored in a state file at /var/lib/system-manager. We then:

  1. Compare the list of services present in the current configuration with the ones stored in the state file from the previous generation.
  2. For all services in the new generation, create a symlink from /etc/systemd/system/<service name> to the service file in the nix store.
  3. For all services present in the old generation but not in the new one:
    1. Stop the service.
    2. Remove the symlink from /etc/systemd/system.
  4. Perform a systemd daemon-reload
  5. Start the services that are present in this generation and not in the previous one
  6. Restart services that are present in both

This approach basically ignores the wantedBy option. A future version might improve upon this, but one of the complexities is that NixOS does not encode the wantedBy option in the generated unit files, but rather produces <unit name>.wants directories in the directory that /etc/systemd/system gets linked to. Supporting this properly would mean that we need to find a way to register the wantedBy option on a non-NixOS system in a way such that we can use it.

Udev rules

Files under /etc