MCPcopy Create free account
hub / github.com/DBCDK/morph / buildHosts

Function buildHosts

morph.go:645–675  ·  view source on GitHub ↗
(hosts []nix.Host)

Source from the content-addressed store, hash-verified

643}
644
645func buildHosts(hosts []nix.Host) (resultPath string, err error) {
646 if len(hosts) == 0 {
647 err = errors.New("No hosts selected")
648 return
649 }
650
651 deploymentPath, err := filepath.Abs(deployment)
652 if err != nil {
653 return
654 }
655
656 nixBuildTargets := ""
657 if nixBuildTargetFile != "" {
658 if path, err := filepath.Abs(nixBuildTargetFile); err == nil {
659 nixBuildTargets = fmt.Sprintf("import \"%s\"", path)
660 }
661 } else if nixBuildTarget != "" {
662 nixBuildTargets = fmt.Sprintf("{ \"out\" = %s; }", nixBuildTarget)
663 }
664
665 ctx := getNixContext()
666 resultPath, err = ctx.BuildMachines(deploymentPath, hosts, nixBuildArg, nixBuildTargets)
667
668 if err != nil {
669 return
670 }
671
672 fmt.Fprintln(os.Stderr, "nix result path: ")
673 fmt.Println(resultPath)
674 return
675}
676
677func pushPaths(sshContext *ssh.SSHContext, filteredHosts []nix.Host, resultPath string) error {
678 for _, host := range filteredHosts {

Callers 2

execBuildFunction · 0.85
execDeployFunction · 0.85

Calls 2

getNixContextFunction · 0.85
BuildMachinesMethod · 0.80

Tested by

no test coverage detected