aboutsummaryrefslogtreecommitdiff
path: root/nix2
diff options
context:
space:
mode:
Diffstat (limited to 'nix2')
-rw-r--r--nix2/driver.go4
-rw-r--r--nix2/nix.go5
2 files changed, 5 insertions, 4 deletions
diff --git a/nix2/driver.go b/nix2/driver.go
index 96bbf42..cba3bee 100644
--- a/nix2/driver.go
+++ b/nix2/driver.go
@@ -510,8 +510,8 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive
}
// Use that repo for all packages not specified from a flake already.
for i := range driverConfig.Packages {
- if !strings.Contains(driverConfig.Packages[i], "#") && !strings.Contains(driverConfig.Packages[i], "/") {
- driverConfig.Packages[i] = nixpkgs + "#" + driverConfig.Packages[i]
+ if strings.HasPrefix(driverConfig.Packages[i], "#") {
+ driverConfig.Packages[i] = nixpkgs + driverConfig.Packages[i]
}
}
diff --git a/nix2/nix.go b/nix2/nix.go
index 5b94065..badf38c 100644
--- a/nix2/nix.go
+++ b/nix2/nix.go
@@ -25,7 +25,7 @@ func prepareNixPackages(taskDir string, packages []string, nixpkgs string) (hclu
mounts := make(hclutils.MapStrStr)
profileLink := filepath.Join(taskDir, "current-profile")
- profile, err := nixBuildProfile(packages, profileLink)
+ profile, err := nixBuildProfile(taskDir, packages, profileLink)
if err != nil {
return nil, fmt.Errorf("Build of the flakes failed: %v", err)
}
@@ -71,7 +71,7 @@ func prepareNixPackages(taskDir string, packages []string, nixpkgs string) (hclu
return mounts, nil
}
-func nixBuildProfile(flakes []string, link string) (string, error) {
+func nixBuildProfile(taskDir string, flakes []string, link string) (string, error) {
cmd := exec.Command("nix", append(
[]string{
"--extra-experimental-features", "nix-command",
@@ -84,6 +84,7 @@ func nixBuildProfile(flakes []string, link string) (string, error) {
flakes...)...)
stderr := &bytes.Buffer{}
cmd.Stderr = stderr
+ cmd.Dir = taskDir
if err := cmd.Run(); err != nil {
return "", fmt.Errorf("%v failed: %s. Err: %v", cmd.Args, stderr.String(), err)