fix: use absolute path for nixos-version executable
Use /run/current-system/sw/bin/nixos-version instead of relying on PATH, since the systemd service may not have the system binaries in its PATH. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -226,11 +226,13 @@ func fetchFlakeMetadata(flakeURL string) (*flakeMetadata, error) {
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
const nixosVersionPath = "/run/current-system/sw/bin/nixos-version"
|
||||
|
||||
func getNixosVersionInfo() (*nixosVersionInfo, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
cmd := exec.CommandContext(ctx, "nixos-version", "--json")
|
||||
cmd := exec.CommandContext(ctx, nixosVersionPath, "--json")
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
if exitErr, ok := err.(*exec.ExitError); ok {
|
||||
|
||||
Reference in New Issue
Block a user