File tree 4 files changed +19
-11
lines changed
4 files changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -41,9 +41,11 @@ type Config struct {
41
41
} `json:"shell,omitempty"`
42
42
43
43
// Nixpkgs specifies the repository to pull packages from
44
- Nixpkgs struct {
45
- Commit string `json:"commit,omitempty"`
46
- } `json:"nixpkgs,omitempty"`
44
+ Nixpkgs NixpkgsConfig `json:"nixpkgs,omitempty"`
45
+ }
46
+
47
+ type NixpkgsConfig struct {
48
+ Commit string `json:"commit,omitempty"`
47
49
}
48
50
49
51
// This contains a subset of fields from plansdk.Stage
Original file line number Diff line number Diff line change @@ -396,9 +396,7 @@ func TestNixpkgsValidation(t *testing.T) {
396
396
assert := assert .New (t )
397
397
398
398
err := validateNixpkg (& Config {
399
- Nixpkgs : struct {
400
- Commit string `json:"commit,omitempty"`
401
- }{
399
+ Nixpkgs : NixpkgsConfig {
402
400
Commit : testCase .commit ,
403
401
},
404
402
})
Original file line number Diff line number Diff line change @@ -44,7 +44,14 @@ const (
44
44
// exist.
45
45
func InitConfig (dir string ) (created bool , err error ) {
46
46
cfgPath := filepath .Join (dir , configFilename )
47
- return cuecfg .InitFile (cfgPath , & Config {})
47
+
48
+ config := & Config {}
49
+ if featureflag .Get (featureflag .NixpkgVersion ).Enabled () {
50
+ config .Nixpkgs = NixpkgsConfig {
51
+ Commit : plansdk .DefaultNixpkgsCommit ,
52
+ }
53
+ }
54
+ return cuecfg .InitFile (cfgPath , config )
48
55
}
49
56
50
57
// Devbox provides an isolated development environment that contains a set of
Original file line number Diff line number Diff line change @@ -213,18 +213,19 @@ type NixpkgsInfo struct {
213
213
Sha256 string
214
214
}
215
215
216
+ // Commit hash as of 2022-08-16
217
+ // `git ls-remote https://github.com/nixos/nixpkgs nixos-unstable`
218
+ const DefaultNixpkgsCommit = "af9e00071d0971eb292fd5abef334e66eda3cb69"
219
+
216
220
func GetNixpkgsInfo (commitHash string ) (* NixpkgsInfo , error ) {
217
221
218
222
// If the featureflag is OFF, then we fallback to the hardcoded commit
219
223
// and ignore any value set in the devbox.json
220
224
if ! featureflag .Get (featureflag .NixpkgVersion ).Enabled () {
221
- // Commit hash as of 2022-08-16
222
- // `git ls-remote https://github.com/nixos/nixpkgs nixos-unstable`
223
- //
224
225
// sha256 from:
225
226
// nix-prefetch-url --unpack https://github.com/nixos/nixpkgs/archive/<commit-hash>.tar.gz
226
227
return & NixpkgsInfo {
227
- URL : "https://github.com/nixos/nixpkgs/archive/af9e00071d0971eb292fd5abef334e66eda3cb69 .tar.gz" ,
228
+ URL : fmt . Sprintf ( "https://github.com/nixos/nixpkgs/archive/%s .tar.gz" , DefaultNixpkgsCommit ) ,
228
229
Sha256 : "1mdwy0419m5i9ss6s5frbhgzgyccbwycxm5nal40c8486bai0hwy" ,
229
230
}, nil
230
231
}
You can’t perform that action at this time.
0 commit comments