Initial commit
This commit is contained in:
commit
55a1efa08f
60 changed files with 5485 additions and 0 deletions
30
lang/go/src/package.sld
Normal file
30
lang/go/src/package.sld
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
(define-library (zilch lang go package)
|
||||
(import
|
||||
(scheme base)
|
||||
(zilch file) (zilch magic)
|
||||
(zilch nixpkgs) (zilch zexpr)
|
||||
json
|
||||
(chicken foreign)
|
||||
(zilch lang go core) (zilch lang go) (zilch lang go vfs) (zilch lang go stdlib))
|
||||
|
||||
(export find-packages-inside-vfs)
|
||||
|
||||
(begin
|
||||
(foreign-declare "#include \"parser_source.h\"")
|
||||
(define go-import-parser
|
||||
(go-package-link
|
||||
(go-package-compile "main"
|
||||
(map go-stdlib-ref '("encoding/json" "fmt" "go/build" "io" "io/fs" "os" "path" "path/filepath" "sort" "strings" "time"))
|
||||
(list (cons "main.go" (zfile (foreign-value "parser_source" nonnull-c-string)))))))
|
||||
|
||||
(define (find-packages-inside-vfs vfs)
|
||||
(define input
|
||||
#~,(call-with-port
|
||||
(open-output-bytevector)
|
||||
(lambda (bv)
|
||||
(json-write (vector (cons "GOARCH" (%goarch)) (cons "GOOS" "linux") (cons "files" #$(filter-vfs-for-package-reading vfs))) bv)
|
||||
(get-output-bytevector bv))))
|
||||
(define input-file (zfile input))
|
||||
(define store-path (cdar (store-path-for-ca-drv* "find-packages" "x86_64-linux" #~(#$go-import-parser #$input-file) '() '("out"))))
|
||||
(call-with-port (store-path-open store-path)
|
||||
(lambda (p) (json-read p))))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue