Deployment and lifecycle management for Nix
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

client(services): write a manifest to the profile dir

+15 -3
+15 -3
cmd/client/services.go
··· 3 3 import ( 4 4 "crypto/sha256" 5 5 "encoding/hex" 6 + "encoding/json" 6 7 "fmt" 7 8 "log/slog" 8 9 "os" ··· 16 17 17 18 var nixpkgsref = "refs/heads/nixos-unstable" 18 19 19 - type EnvTemplate struct { 20 - Nixpkgsref string 21 - Paths []client.StorePath 20 + type ServicesManifest struct { 21 + Paths []string `json:"paths"` 22 22 } 23 23 24 24 // https://github.com/NixOS/nixpkgs/archive/refs/heads/master.zip ··· 28 28 } 29 29 30 30 profileDir := filepath.Join(profileParentDir(), "services", servicesHash(paths)) 31 + manifest := &ServicesManifest{} 31 32 slog.Debug("Collecting services units", "profile", profileDir) 32 33 33 34 _, err := os.Stat(profileDir) ··· 50 51 if err != nil { 51 52 return "", fmt.Errorf("failed to copy path %s to profile %s: %v", path.Path, profileDir, err) 52 53 } 54 + 55 + manifest.Paths = append(manifest.Paths, path.Path) 56 + } 57 + 58 + data, err := json.MarshalIndent(manifest, "", " ") 59 + if err != nil { 60 + return "", err 61 + } 62 + err = os.WriteFile(filepath.Join(profileDir, "manifest.json"), data, 0644) 63 + if err != nil { 64 + return "", err 53 65 } 54 66 55 67 slog.Debug("Successfully built services units output", "nixpkgs", nixpkgsref, "path", profileDir)