-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Complete rewrite to use golang/dep for source deduction
- Loading branch information
CrushedPixel
committed
Mar 28, 2018
1 parent
027b3cc
commit a19f579
Showing
6 changed files
with
149 additions
and
413 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,52 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
const depNixFormat = ` | ||
{ | ||
goPackagePath = "%s"; | ||
fetch = { | ||
type = "%s"; | ||
url = "%s"; | ||
rev = "%s"; | ||
sha256 = "%s"; | ||
}; | ||
}` | ||
|
||
// Dep represents a project dependency | ||
// to write to deps.nix. | ||
type Dep struct { | ||
PackagePath string | ||
VCS string | ||
URL string | ||
Revision string | ||
SHA256 string | ||
} | ||
|
||
// toNix converts d into a nix set | ||
// for use in the generated deps.nix. | ||
func (d *Dep) toNix() string { | ||
return fmt.Sprintf(depNixFormat, | ||
d.PackagePath, d.VCS, d.URL, | ||
d.Revision, d.SHA256) | ||
} | ||
|
||
const depsFileHeader = `# file generated from Gopkg.lock using dep2nix (https://github.com/nixcloud/dep2nix) | ||
[` | ||
const depsFileFooter = ` | ||
]` | ||
|
||
type Deps []*Dep | ||
|
||
// toNix converts d into a deps.nix file | ||
// for use with pkgs.buildGoPackage. | ||
func (d Deps) toNix() string { | ||
nix := depsFileHeader | ||
for _, dep := range d { | ||
nix += dep.toNix() | ||
} | ||
nix += depsFileFooter | ||
return nix | ||
} |
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
Oops, something went wrong.