Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/nix/nix.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func savePrintDevEnvCache(path string, out PrintDevEnvOut) error {
func FlakeNixpkgs(commit string) string {
// Using nixpkgs/<commit> means:
// The nixpkgs entry in the flake registry, with its Git revision overridden to a specific value.
return "nixpkgs/" + commit
return "github:NixOS/nixpkgs/" + commit
}

func ExperimentalFlags() []string {
Expand Down
18 changes: 18 additions & 0 deletions internal/nix/nix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,21 @@ func TestParseInsecurePackagesFromExitError(t *testing.T) {
t.Errorf("Expected package 'python-2.7.18.7', got %s", packages[0])
}
}

func TestFlakeNixpkgs(t *testing.T) {
// Test that FlakeNixpkgs returns the expected string given a commit hash.
commit := "123456abcdef"
expected := "github:NixOS/nixpkgs/123456abcdef"
result := FlakeNixpkgs(commit)
if result != expected {
t.Errorf("FlakeNixpkgs(%q) = %q, want %q", commit, result, expected)
}

// Test with an empty string
commit = ""
expected = "github:NixOS/nixpkgs/"
result = FlakeNixpkgs(commit)
if result != expected {
t.Errorf("FlakeNixpkgs(empty string) = %q, want %q", result, expected)
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the test isn't doing much, not sure its worth adding

Loading