Skip to content

Commit

Permalink
use nix-build as build command
Browse files Browse the repository at this point in the history
So that users don't have to enable experimental features, and to work
around NixOS/nix#7220, use `nix-build`
instead of `nix build`.
  • Loading branch information
nrdxp committed Oct 26, 2022
1 parent 207d752 commit 78716f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ unnecessary downloads even if no package has been changed.

`nix-build-uncached` is available in nixpkgs.

For nix versions bigger than 2.3.x you need to enable at least
`experimental-features = nix-command` in your `/etc/nix/nix.conf` or
`$HOME/.config/nix/nix.conf` or pass `-build-flags "--experimental-features nix-command"`
to `nix-build-uncached`.

In the following example ci.nix contains all expressions
that should be built. Since only `hello-nur` is not yet in
the binary cache, all other packages are skipped.
Expand Down
5 changes: 2 additions & 3 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ func raiseFdLimit() (uint64, error) {
}

func nixBuild(drvs map[string]bool, buildArgs []string) error {
buildArgs = append([]string{"build"}, buildArgs...)
numBuildChars := len("nix") + 1
for _, arg := range buildArgs {
numBuildChars += len(arg) + 1
Expand All @@ -107,7 +106,7 @@ func nixBuild(drvs map[string]bool, buildArgs []string) error {
for drv := range drvs {
n := len(drv) + 1
if n+numChars > MAX_CHARS || uint64(len(args)-len(buildArgs)) >= maxConcurrentBuilds {
cmd := Command("nix", args...)
cmd := Command("nix-build", args...)
if err := cmd.Run(); err != nil {
return err
}
Expand All @@ -118,7 +117,7 @@ func nixBuild(drvs map[string]bool, buildArgs []string) error {
numChars += n
}
if numChars > numBuildChars {
cmd := Command("nix", args...)
cmd := Command("nix-build", args...)
if err := cmd.Run(); err != nil {
return err
}
Expand Down

0 comments on commit 78716f7

Please sign in to comment.