You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No source tree is uploaded to the build instance. Both the `system-manager` binary and the system configuration are fetched as pre-built artifacts from the `nix-postgres-artifacts` S3 binary cache.
39
+
40
+
## Updating system-manager on a running instance
41
+
42
+
system-manager can be updated on a running instance without rebuilding the AMI. To apply a new configuration:
43
+
44
+
```bash
45
+
# Build the new config (fetched from binary cache)
This pulls the pre-built configuration from the binary cache and activates it. system-manager diffs the old and new state and reconciles — starting, stopping, or restarting services and updating `/etc` entries as needed. No explicit deactivation is required.
55
+
56
+
To also update the `system-manager` binary itself (if the upstream version changed in `flake.lock`):
Changes applied this way include anything modified in `nix/systemModules/` between the old and new SHA: new or removed systemd services, `environment.etc` entries, packages under `/run/system-manager/sw/`, etc.
22
63
23
64
## Nix configuration walkthrough
24
65
25
66
### Flake input
26
67
27
-
The system-manager flake input is declared in `flake.nix` (lines 34-35), pinned to the upstream repository with nixpkgs following the main input:
68
+
The system-manager flake input is declared in `flake.nix`, pinned to the upstream repository with nixpkgs following the main input:
The `system-manager` binary is also re-exported as a package in `nix/packages/default.nix` (Linux only), making it available as `nix profile add .#system-manager` or via the remote flake URL.
76
+
34
77
The flake outputs import both the module registry and the system configurations:
35
78
36
79
```nix
@@ -60,12 +103,12 @@ mkSystemConfig = system: {
60
103
```
61
104
62
105
The `mkModules` function returns the list of modules to enable.
63
-
Currently it enables the nginx service and sets the host platform:
106
+
Currently it includes the genesis placeholder module and sets the host platform:
64
107
65
108
```nix
66
109
mkModules = system: [
110
+
self.systemModules.genesis
67
111
({
68
-
services.nginx.enable = true;
69
112
nixpkgs.hostPlatform = system;
70
113
})
71
114
];
@@ -83,14 +126,21 @@ It is a flake-parts module that exports individual system modules under `flake.s
#the system manager, it will be replaced by real configurations
132
+
environment.etc."system-manager-genesis" = {
133
+
text = "";
134
+
user = "root";
135
+
group = "root";
136
+
mode = "0644";
137
+
};
138
+
};
87
139
};
88
140
};
89
141
}
90
142
```
91
143
92
-
Each module is loaded with `flake-parts-lib.importApply`, which passes `withSystem` and `self` as arguments to the module file.
93
-
94
144
## Adding a new system module
95
145
96
146
To add a new system module:
@@ -134,7 +184,6 @@ To add a new system module:
134
184
mkModules = system: [
135
185
self.systemModules.my-service
136
186
({
137
-
services.nginx.enable = true;
138
187
supabase.services.my-service.enable = true;
139
188
nixpkgs.hostPlatform = system;
140
189
})
@@ -167,13 +216,16 @@ check-system-manager =
167
216
machine.activate()
168
217
machine.wait_for_unit("system-manager.target")
169
218
170
-
with subtest("Verify nginx service"):
171
-
assert machine.service("nginx").is_running, "nginx should be running"
219
+
with subtest("Verify genesis file"):
220
+
assert machine.file("/etc/system-manager-genesis").exists, "/etc/system-manager-genesis should exist"
221
+
assert machine.file("/etc/system-manager-genesis").mode == 0o644, "/etc/system-manager-genesis should have mode 0644"
222
+
assert machine.file("/etc/system-manager-genesis").user == "root", "/etc/system-manager-genesis should be owned by root"
223
+
assert machine.file("/etc/system-manager-genesis").group == "root", "/etc/system-manager-genesis should be owned by root"
172
224
'';
173
225
};
174
226
```
175
227
176
-
The test script starts the container, waits for systemd to reach `multi-user.target`, activates the system-manager configuration, then verifies that managed services are running.
228
+
The test script starts the container, waits for systemd to reach `multi-user.target`, activates the system-manager configuration, then verifies that managed services and files are present.
177
229
When adding a new module, extend the `testScript` with an additional `subtest` block that asserts the new service is running.
178
230
179
231
### Running tests locally
@@ -217,7 +269,7 @@ The `check-system-manager` derivation is part of the flake's `checks` output, so
217
269
218
270
## Runtime effects
219
271
220
-
After `system-manager switch` runs, managed software is available under `/run/system-manager/sw/`.
272
+
After `system-manager activate` runs, managed software is available under `/run/system-manager/sw/`.
221
273
This affects paths throughout the system.
222
274
For example, the audit baseline `audit-specs/baselines/ami-build/user.yml` references these paths for user shells:
0 commit comments