-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lock: add support for locking stdenv + flakerefs (#2465)
Make the `stdenv` (and other flakerefs) lockable and updateable. This makes it possible to update the stdenv with a regular `devbox update` and simplifies the logic for how the stdenv commit is chosen: 1. If there's no stdenv flakeref in devbox.lock, resolve github:NixOS/nixpkgs/nixpkgs-unstable to a locked ref and store it in the lockfile. 2. Otherwise, use the ref in the lockfile.
- Loading branch information
Showing
20 changed files
with
244 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package nix | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
|
||
"go.jetpack.io/devbox/nix/flake" | ||
) | ||
|
||
type FlakeMetadata struct { | ||
Description string `json:"description"` | ||
Original flake.Ref `json:"original"` | ||
Resolved flake.Ref `json:"resolved"` | ||
Locked flake.Ref `json:"locked"` | ||
Path string `json:"path"` | ||
} | ||
|
||
func ResolveFlake(ctx context.Context, ref flake.Ref) (FlakeMetadata, error) { | ||
cmd := command("flake", "metadata", "--json", ref) | ||
out, err := cmd.Output(ctx) | ||
if err != nil { | ||
return FlakeMetadata{}, err | ||
} | ||
meta := FlakeMetadata{} | ||
err = json.Unmarshal(out, &meta) | ||
if err != nil { | ||
return FlakeMetadata{}, err | ||
} | ||
return meta, nil | ||
} |
Oops, something went wrong.