Fix discovering home-manager paths
This commit is contained in:
@@ -41,6 +41,22 @@ func GetNixFlakeOutput() (*NixFlakeOutput, error) {
|
|||||||
return &flakeOutput, nil
|
return &flakeOutput, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetNixHomeManagerOutput() ([]string, error) {
|
||||||
|
cmd := exec.Command("nix", "eval", ".#homeConfigurations", "--apply", "hconf: builtins.filter (name: hconf.${name}.pkgs.hostPlatform.isLinux) (builtins.attrNames hconf)", "--json")
|
||||||
|
output, err := cmd.Output()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var result []string
|
||||||
|
err = json.Unmarshal(output, &result)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
type GitlabCIJob struct {
|
type GitlabCIJob struct {
|
||||||
Stage string `json:"stage"`
|
Stage string `json:"stage"`
|
||||||
Tags []string `json:"tags"`
|
Tags []string `json:"tags"`
|
||||||
@@ -73,12 +89,16 @@ func main() {
|
|||||||
"nix flake check --no-build",
|
"nix flake check --no-build",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
// Since this is kinda a one-off thing, I can use this directly
|
|
||||||
// homeConfigurations are treated like they are not known as a
|
if flakeOutput.HomeConfigurations != nil {
|
||||||
// flake output type. Therefore, it just informs you that it is
|
homeNames, err := GetNixHomeManagerOutput()
|
||||||
// part of the output, but does not evaluate deeper to tell you
|
if err != nil {
|
||||||
// what the name of it is. I will just do this manually for now.
|
panic(err)
|
||||||
pipeline["Build Home config "] = NewGitlabCIJob("homeConfigurations.\"greg\".activationPackage")
|
}
|
||||||
|
for i := range homeNames {
|
||||||
|
pipeline["Build Home Configuration "+homeNames[i]] = NewGitlabCIJob("homeConfigurations.\"" + homeNames[i] +"\".activationPackage")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if flakeOutput.Apps != nil {
|
if flakeOutput.Apps != nil {
|
||||||
for appName := range flakeOutput.Apps {
|
for appName := range flakeOutput.Apps {
|
||||||
|
|||||||
Reference in New Issue
Block a user