Skip to content

Commit

Permalink
add default standard packages
Browse files Browse the repository at this point in the history
  • Loading branch information
zuzuleinen committed Apr 21, 2022
1 parent 5f6c2bb commit 4b4769a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bob/nix.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ import (
func NixBuildPackages(packages []string) ([]string, error) {
fmt.Println("Building nix dependencies...")

for _, v := range defaultPackages() {
if !inSlice(v, packages) {
packages = append(packages, v)
}
}

nixExpression := fmt.Sprintf("with import <nixpkgs> { }; [%s]", strings.Join(packages, " "))
cmd := exec.Command("nix-build", "--no-out-link", "-E", nixExpression)
out, err := cmd.CombinedOutput()
Expand All @@ -32,6 +38,15 @@ func NixBuildPackages(packages []string) ([]string, error) {
return storePaths, nil
}

func defaultPackages() []string {
return []string{
"bash",
"coreutils",
"gnused",
"findutils",
}
}

func NixBuildFiles(files []string) ([]string, error) {
fmt.Println("Building .nix files...")

Expand Down

0 comments on commit 4b4769a

Please sign in to comment.