mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-04-11 11:42:15 +02:00
feat(nix): runtime dependencies
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
5e27651dae
commit
e672699b0a
@ -247,17 +247,25 @@ func preparePkg(
|
||||
folder = "."
|
||||
}
|
||||
|
||||
data := templateData{
|
||||
Name: nix.Name,
|
||||
Version: ctx.Version,
|
||||
Install: installs,
|
||||
PostInstall: postInstall,
|
||||
Archives: map[string]Archive{},
|
||||
SourceRoot: folder,
|
||||
Description: nix.Description,
|
||||
Homepage: nix.Homepage,
|
||||
License: nix.License,
|
||||
inputs := []string{"installShellFiles"}
|
||||
if len(nix.Dependencies) > 0 {
|
||||
inputs = append(inputs, "makeWrapper")
|
||||
}
|
||||
|
||||
data := templateData{
|
||||
Name: nix.Name,
|
||||
Version: ctx.Version,
|
||||
Install: installs,
|
||||
PostInstall: postInstall,
|
||||
Archives: map[string]Archive{},
|
||||
SourceRoot: folder,
|
||||
Description: nix.Description,
|
||||
Homepage: nix.Homepage,
|
||||
License: nix.License,
|
||||
Inputs: inputs,
|
||||
Dependencies: depNames(nix.Dependencies),
|
||||
}
|
||||
|
||||
platforms := map[string]bool{}
|
||||
for _, art := range archives {
|
||||
url, err := tmpl.New(ctx).WithArtifact(art).Apply(nix.URLTemplate)
|
||||
@ -427,14 +435,48 @@ func installs(ctx *context.Context, nix config.Nix, art *artifact.Artifact) ([]s
|
||||
}
|
||||
|
||||
result := []string{"mkdir -p $out/bin"}
|
||||
binInstall := binInstallStr(nix)
|
||||
for _, bin := range artifact.ExtraOr(*art, artifact.ExtraBinaries, []string{}) {
|
||||
result = append(result, fmt.Sprintf("cp -vr ./%s $out/bin/%[1]s", bin))
|
||||
result = append(result, fmt.Sprintf(binInstall, bin))
|
||||
}
|
||||
|
||||
log.WithField("install", result).Warnf("guessing install")
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func binInstallStr(nix config.Nix) string {
|
||||
if len(nix.Dependencies) == 0 {
|
||||
return "cp -vr ./%s $out/bin/%[1]s"
|
||||
}
|
||||
var deps, linuxDeps, darwinDeps []string
|
||||
|
||||
for _, dep := range nix.Dependencies {
|
||||
switch dep.OS {
|
||||
case "darwin":
|
||||
darwinDeps = append(darwinDeps, dep.Name)
|
||||
case "linux":
|
||||
linuxDeps = append(linuxDeps, dep.Name)
|
||||
default:
|
||||
deps = append(deps, dep.Name)
|
||||
}
|
||||
}
|
||||
|
||||
var depStrings []string
|
||||
|
||||
if len(darwinDeps) > 0 {
|
||||
depStrings = append(depStrings, fmt.Sprintf("lib.optionals stdenv.isDarwin [ %s ]", strings.Join(darwinDeps, " ")))
|
||||
}
|
||||
if len(linuxDeps) > 0 {
|
||||
depStrings = append(depStrings, fmt.Sprintf("lib.optionals stdenv.isLinux [ %s ]", strings.Join(linuxDeps, " ")))
|
||||
}
|
||||
if len(deps) > 0 {
|
||||
depStrings = append(depStrings, fmt.Sprintf("[ %s ]", strings.Join(deps, " ")))
|
||||
}
|
||||
|
||||
depString := strings.Join(depStrings, " ++ ")
|
||||
return "wrapProgram $out/bin/%[1]s --prefix PATH : ${lib.makeBinPath (" + depString + ")}"
|
||||
}
|
||||
|
||||
func split(s string) []string {
|
||||
var result []string
|
||||
for _, line := range strings.Split(strings.TrimSpace(s), "\n") {
|
||||
@ -447,6 +489,14 @@ func split(s string) []string {
|
||||
return result
|
||||
}
|
||||
|
||||
func depNames(deps []config.NixDependency) []string {
|
||||
var result []string
|
||||
for _, dep := range deps {
|
||||
result = append(result, dep.Name)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
type shaPrefetcher interface {
|
||||
Prefetch(url string) (string, error)
|
||||
Available() bool
|
||||
|
@ -93,6 +93,21 @@ func TestRunPipe(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "deps",
|
||||
nix: config.Nix{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "foo",
|
||||
Name: "bar",
|
||||
},
|
||||
Dependencies: []config.NixDependency{
|
||||
{Name: "fish"},
|
||||
{Name: "bash"},
|
||||
linuxDep("ttyd"),
|
||||
darwinDep("chromium"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "open-pr",
|
||||
nix: config.Nix{
|
||||
@ -461,6 +476,60 @@ func TestDependencies(t *testing.T) {
|
||||
require.Equal(t, []string{"nix-prefetch-url"}, Pipe{}.Dependencies(nil))
|
||||
}
|
||||
|
||||
func TestBinInstallStr(t *testing.T) {
|
||||
t.Run("no-deps", func(t *testing.T) {
|
||||
golden.RequireEqual(t, []byte(binInstallStr(config.Nix{})))
|
||||
})
|
||||
t.Run("deps", func(t *testing.T) {
|
||||
golden.RequireEqual(t, []byte(binInstallStr(config.Nix{
|
||||
Dependencies: []config.NixDependency{
|
||||
{Name: "fish"},
|
||||
{Name: "bash"},
|
||||
{Name: "zsh"},
|
||||
},
|
||||
})))
|
||||
})
|
||||
t.Run("linux-only-deps", func(t *testing.T) {
|
||||
golden.RequireEqual(t, []byte(binInstallStr(config.Nix{
|
||||
Dependencies: []config.NixDependency{
|
||||
linuxDep("foo"),
|
||||
linuxDep("bar"),
|
||||
},
|
||||
})))
|
||||
})
|
||||
t.Run("darwin-only-deps", func(t *testing.T) {
|
||||
golden.RequireEqual(t, []byte(binInstallStr(config.Nix{
|
||||
Dependencies: []config.NixDependency{
|
||||
darwinDep("foo"),
|
||||
darwinDep("bar"),
|
||||
},
|
||||
})))
|
||||
})
|
||||
t.Run("mixed-deps", func(t *testing.T) {
|
||||
golden.RequireEqual(t, []byte(binInstallStr(config.Nix{
|
||||
Dependencies: []config.NixDependency{
|
||||
{Name: "fish"},
|
||||
linuxDep("foo"),
|
||||
darwinDep("bar"),
|
||||
},
|
||||
})))
|
||||
})
|
||||
}
|
||||
|
||||
func darwinDep(s string) config.NixDependency {
|
||||
return config.NixDependency{
|
||||
Name: s,
|
||||
OS: "darwin",
|
||||
}
|
||||
}
|
||||
|
||||
func linuxDep(s string) config.NixDependency {
|
||||
return config.NixDependency{
|
||||
Name: s,
|
||||
OS: "linux",
|
||||
}
|
||||
}
|
||||
|
||||
type fakeNixShaPrefetcher map[string]string
|
||||
|
||||
func (m fakeNixShaPrefetcher) Prefetch(url string) (string, error) {
|
||||
|
@ -10,14 +10,16 @@ type Archive struct {
|
||||
}
|
||||
|
||||
type templateData struct {
|
||||
Name string
|
||||
Version string
|
||||
Install []string
|
||||
PostInstall []string
|
||||
SourceRoot string
|
||||
Archives map[string]Archive
|
||||
Description string
|
||||
Homepage string
|
||||
License string
|
||||
Platforms []string
|
||||
Name string
|
||||
Version string
|
||||
Install []string
|
||||
PostInstall []string
|
||||
SourceRoot string
|
||||
Archives map[string]Archive
|
||||
Description string
|
||||
Homepage string
|
||||
License string
|
||||
Platforms []string
|
||||
Inputs []string
|
||||
Dependencies []string
|
||||
}
|
||||
|
1
internal/pipe/nix/testdata/TestBinInstallStr/darwin-only-deps.golden
vendored
Normal file
1
internal/pipe/nix/testdata/TestBinInstallStr/darwin-only-deps.golden
vendored
Normal file
@ -0,0 +1 @@
|
||||
wrapProgram $out/bin/%[1]s --prefix PATH : ${lib.makeBinPath (lib.optionals stdenv.isDarwin [ foo bar ])}
|
1
internal/pipe/nix/testdata/TestBinInstallStr/deps.golden
vendored
Normal file
1
internal/pipe/nix/testdata/TestBinInstallStr/deps.golden
vendored
Normal file
@ -0,0 +1 @@
|
||||
wrapProgram $out/bin/%[1]s --prefix PATH : ${lib.makeBinPath ([ fish bash zsh ])}
|
1
internal/pipe/nix/testdata/TestBinInstallStr/linux-only-deps.golden
vendored
Normal file
1
internal/pipe/nix/testdata/TestBinInstallStr/linux-only-deps.golden
vendored
Normal file
@ -0,0 +1 @@
|
||||
wrapProgram $out/bin/%[1]s --prefix PATH : ${lib.makeBinPath (lib.optionals stdenv.isLinux [ foo bar ])}
|
1
internal/pipe/nix/testdata/TestBinInstallStr/mixed-deps.golden
vendored
Normal file
1
internal/pipe/nix/testdata/TestBinInstallStr/mixed-deps.golden
vendored
Normal file
@ -0,0 +1 @@
|
||||
wrapProgram $out/bin/%[1]s --prefix PATH : ${lib.makeBinPath (lib.optionals stdenv.isDarwin [ bar ] ++ lib.optionals stdenv.isLinux [ foo ] ++ [ fish ])}
|
1
internal/pipe/nix/testdata/TestBinInstallStr/no-deps.golden
vendored
Normal file
1
internal/pipe/nix/testdata/TestBinInstallStr/no-deps.golden
vendored
Normal file
@ -0,0 +1 @@
|
||||
cp -vr ./%s $out/bin/%[1]s
|
67
internal/pipe/nix/testdata/TestRunPipe/deps_build.nix.golden
vendored
Normal file
67
internal/pipe/nix/testdata/TestRunPipe/deps_build.nix.golden
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
# This file was generated by GoReleaser. DO NOT EDIT.
|
||||
# vim: set ft=nix ts=2 sw=2 sts=2 et sta
|
||||
{
|
||||
system ? builtins.currentSystem
|
||||
, pkgs
|
||||
, lib
|
||||
, fetchurl
|
||||
, installShellFiles
|
||||
, makeWrapper
|
||||
, stdenv
|
||||
, fish
|
||||
, bash
|
||||
, ttyd
|
||||
, chromium
|
||||
}:
|
||||
let
|
||||
shaMap = {
|
||||
i686-linux = "0000000000000000000000000000000000000000000000000000";
|
||||
x86_64-linux = "0000000000000000000000000000000000000000000000000000";
|
||||
armv6l-linux = "0000000000000000000000000000000000000000000000000000";
|
||||
armv7l-linux = "0000000000000000000000000000000000000000000000000000";
|
||||
aarch64-linux = "0000000000000000000000000000000000000000000000000000";
|
||||
x86_64-darwin = "0000000000000000000000000000000000000000000000000000";
|
||||
aarch64-darwin = "0000000000000000000000000000000000000000000000000000";
|
||||
};
|
||||
|
||||
urlMap = {
|
||||
i686-linux = "https://dummyhost/download/v1.2.1/foo_linux_386.tar.gz";
|
||||
x86_64-linux = "https://dummyhost/download/v1.2.1/foo_linux_amd64v1.tar.gz";
|
||||
armv6l-linux = "https://dummyhost/download/v1.2.1/foo_linux_arm6.tar.gz";
|
||||
armv7l-linux = "https://dummyhost/download/v1.2.1/foo_linux_arm7.tar.gz";
|
||||
aarch64-linux = "https://dummyhost/download/v1.2.1/foo_linux_arm64.tar.gz";
|
||||
x86_64-darwin = "https://dummyhost/download/v1.2.1/foo_darwin_amd64v1.tar.gz";
|
||||
aarch64-darwin = "https://dummyhost/download/v1.2.1/foo_darwin_arm64.tar.gz";
|
||||
};
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
pname = "foo";
|
||||
version = "1.2.1";
|
||||
src = fetchurl {
|
||||
url = urlMap.${system};
|
||||
sha256 = shaMap.${system};
|
||||
};
|
||||
|
||||
sourceRoot = ".";
|
||||
|
||||
nativeBuildInputs = [ installShellFiles makeWrapper ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
wrapProgram $out/bin/foo --prefix PATH : ${lib.makeBinPath (lib.optionals stdenv.isDarwin [ chromium ] ++ lib.optionals stdenv.isLinux [ ttyd ] ++ [ fish bash ])}
|
||||
'';
|
||||
|
||||
system = system;
|
||||
|
||||
meta = with lib; {
|
||||
|
||||
platforms = [
|
||||
"aarch64-darwin"
|
||||
"aarch64-linux"
|
||||
"armv6l-linux"
|
||||
"armv7l-linux"
|
||||
"i686-linux"
|
||||
"x86_64-darwin"
|
||||
"x86_64-linux"
|
||||
];
|
||||
};
|
||||
}
|
66
internal/pipe/nix/testdata/TestRunPipe/deps_publish.nix.golden
vendored
Normal file
66
internal/pipe/nix/testdata/TestRunPipe/deps_publish.nix.golden
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
# This file was generated by GoReleaser. DO NOT EDIT.
|
||||
# vim: set ft=nix ts=2 sw=2 sts=2 et sta
|
||||
{
|
||||
system ? builtins.currentSystem
|
||||
, pkgs
|
||||
, lib
|
||||
, fetchurl
|
||||
, installShellFiles
|
||||
, makeWrapper
|
||||
, stdenv
|
||||
, fish
|
||||
, bash
|
||||
, ttyd
|
||||
, chromium
|
||||
}:
|
||||
let
|
||||
shaMap = {
|
||||
x86_64-linux = "sha1";
|
||||
armv6l-linux = "sha6";
|
||||
armv7l-linux = "sha7";
|
||||
aarch64-linux = "sha2";
|
||||
x86_64-darwin = "sha3";
|
||||
aarch64-darwin = "sha4";
|
||||
};
|
||||
|
||||
urlMap = {
|
||||
i686-linux = "https://dummyhost/download/v1.2.1/foo_linux_386.tar.gz";
|
||||
x86_64-linux = "https://dummyhost/download/v1.2.1/foo_linux_amd64v1.tar.gz";
|
||||
armv6l-linux = "https://dummyhost/download/v1.2.1/foo_linux_arm6.tar.gz";
|
||||
armv7l-linux = "https://dummyhost/download/v1.2.1/foo_linux_arm7.tar.gz";
|
||||
aarch64-linux = "https://dummyhost/download/v1.2.1/foo_linux_arm64.tar.gz";
|
||||
x86_64-darwin = "https://dummyhost/download/v1.2.1/foo_darwin_amd64v1.tar.gz";
|
||||
aarch64-darwin = "https://dummyhost/download/v1.2.1/foo_darwin_arm64.tar.gz";
|
||||
};
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
pname = "foo";
|
||||
version = "1.2.1";
|
||||
src = fetchurl {
|
||||
url = urlMap.${system};
|
||||
sha256 = shaMap.${system};
|
||||
};
|
||||
|
||||
sourceRoot = ".";
|
||||
|
||||
nativeBuildInputs = [ installShellFiles makeWrapper ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
wrapProgram $out/bin/foo --prefix PATH : ${lib.makeBinPath (lib.optionals stdenv.isDarwin [ chromium ] ++ lib.optionals stdenv.isLinux [ ttyd ] ++ [ fish bash ])}
|
||||
'';
|
||||
|
||||
system = system;
|
||||
|
||||
meta = with lib; {
|
||||
|
||||
platforms = [
|
||||
"aarch64-darwin"
|
||||
"aarch64-linux"
|
||||
"armv6l-linux"
|
||||
"armv7l-linux"
|
||||
"i686-linux"
|
||||
"x86_64-darwin"
|
||||
"x86_64-linux"
|
||||
];
|
||||
};
|
||||
}
|
@ -1,6 +1,12 @@
|
||||
# This file was generated by GoReleaser. DO NOT EDIT.
|
||||
# vim: set ft=nix ts=2 sw=2 sts=2 et sta
|
||||
{ system ? builtins.currentSystem, pkgs, lib, fetchurl, installShellFiles }:
|
||||
{
|
||||
system ? builtins.currentSystem
|
||||
, pkgs
|
||||
, lib
|
||||
, fetchurl
|
||||
, installShellFiles
|
||||
}:
|
||||
let
|
||||
shaMap = {
|
||||
i686-linux = "0000000000000000000000000000000000000000000000000000";
|
||||
|
@ -1,6 +1,12 @@
|
||||
# This file was generated by GoReleaser. DO NOT EDIT.
|
||||
# vim: set ft=nix ts=2 sw=2 sts=2 et sta
|
||||
{ system ? builtins.currentSystem, pkgs, lib, fetchurl, installShellFiles }:
|
||||
{
|
||||
system ? builtins.currentSystem
|
||||
, pkgs
|
||||
, lib
|
||||
, fetchurl
|
||||
, installShellFiles
|
||||
}:
|
||||
let
|
||||
shaMap = {
|
||||
x86_64-linux = "sha1";
|
||||
|
@ -1,6 +1,12 @@
|
||||
# This file was generated by GoReleaser. DO NOT EDIT.
|
||||
# vim: set ft=nix ts=2 sw=2 sts=2 et sta
|
||||
{ system ? builtins.currentSystem, pkgs, lib, fetchurl, installShellFiles }:
|
||||
{
|
||||
system ? builtins.currentSystem
|
||||
, pkgs
|
||||
, lib
|
||||
, fetchurl
|
||||
, installShellFiles
|
||||
}:
|
||||
let
|
||||
shaMap = {
|
||||
i686-linux = "0000000000000000000000000000000000000000000000000000";
|
||||
|
@ -1,6 +1,12 @@
|
||||
# This file was generated by GoReleaser. DO NOT EDIT.
|
||||
# vim: set ft=nix ts=2 sw=2 sts=2 et sta
|
||||
{ system ? builtins.currentSystem, pkgs, lib, fetchurl, installShellFiles }:
|
||||
{
|
||||
system ? builtins.currentSystem
|
||||
, pkgs
|
||||
, lib
|
||||
, fetchurl
|
||||
, installShellFiles
|
||||
}:
|
||||
let
|
||||
shaMap = {
|
||||
x86_64-linux = "sha1";
|
||||
|
@ -1,6 +1,12 @@
|
||||
# This file was generated by GoReleaser. DO NOT EDIT.
|
||||
# vim: set ft=nix ts=2 sw=2 sts=2 et sta
|
||||
{ system ? builtins.currentSystem, pkgs, lib, fetchurl, installShellFiles }:
|
||||
{
|
||||
system ? builtins.currentSystem
|
||||
, pkgs
|
||||
, lib
|
||||
, fetchurl
|
||||
, installShellFiles
|
||||
}:
|
||||
let
|
||||
shaMap = {
|
||||
x86_64-linux = "0000000000000000000000000000000000000000000000000000";
|
||||
|
@ -1,6 +1,12 @@
|
||||
# This file was generated by GoReleaser. DO NOT EDIT.
|
||||
# vim: set ft=nix ts=2 sw=2 sts=2 et sta
|
||||
{ system ? builtins.currentSystem, pkgs, lib, fetchurl, installShellFiles }:
|
||||
{
|
||||
system ? builtins.currentSystem
|
||||
, pkgs
|
||||
, lib
|
||||
, fetchurl
|
||||
, installShellFiles
|
||||
}:
|
||||
let
|
||||
shaMap = {
|
||||
x86_64-linux = "sha1";
|
||||
|
@ -1,6 +1,12 @@
|
||||
# This file was generated by GoReleaser. DO NOT EDIT.
|
||||
# vim: set ft=nix ts=2 sw=2 sts=2 et sta
|
||||
{ system ? builtins.currentSystem, pkgs, lib, fetchurl, installShellFiles }:
|
||||
{
|
||||
system ? builtins.currentSystem
|
||||
, pkgs
|
||||
, lib
|
||||
, fetchurl
|
||||
, installShellFiles
|
||||
}:
|
||||
let
|
||||
shaMap = {
|
||||
i686-linux = "0000000000000000000000000000000000000000000000000000";
|
||||
|
@ -1,6 +1,12 @@
|
||||
# This file was generated by GoReleaser. DO NOT EDIT.
|
||||
# vim: set ft=nix ts=2 sw=2 sts=2 et sta
|
||||
{ system ? builtins.currentSystem, pkgs, lib, fetchurl, installShellFiles }:
|
||||
{
|
||||
system ? builtins.currentSystem
|
||||
, pkgs
|
||||
, lib
|
||||
, fetchurl
|
||||
, installShellFiles
|
||||
}:
|
||||
let
|
||||
shaMap = {
|
||||
i686-linux = "0000000000000000000000000000000000000000000000000000";
|
||||
|
@ -1,6 +1,12 @@
|
||||
# This file was generated by GoReleaser. DO NOT EDIT.
|
||||
# vim: set ft=nix ts=2 sw=2 sts=2 et sta
|
||||
{ system ? builtins.currentSystem, pkgs, lib, fetchurl, installShellFiles }:
|
||||
{
|
||||
system ? builtins.currentSystem
|
||||
, pkgs
|
||||
, lib
|
||||
, fetchurl
|
||||
, installShellFiles
|
||||
}:
|
||||
let
|
||||
shaMap = {
|
||||
i686-linux = "0000000000000000000000000000000000000000000000000000";
|
||||
|
@ -1,6 +1,12 @@
|
||||
# This file was generated by GoReleaser. DO NOT EDIT.
|
||||
# vim: set ft=nix ts=2 sw=2 sts=2 et sta
|
||||
{ system ? builtins.currentSystem, pkgs, lib, fetchurl, installShellFiles }:
|
||||
{
|
||||
system ? builtins.currentSystem
|
||||
, pkgs
|
||||
, lib
|
||||
, fetchurl
|
||||
, installShellFiles
|
||||
}:
|
||||
let
|
||||
shaMap = {
|
||||
x86_64-linux = "sha1";
|
||||
|
@ -1,6 +1,12 @@
|
||||
# This file was generated by GoReleaser. DO NOT EDIT.
|
||||
# vim: set ft=nix ts=2 sw=2 sts=2 et sta
|
||||
{ system ? builtins.currentSystem, pkgs, lib, fetchurl, installShellFiles }:
|
||||
{
|
||||
system ? builtins.currentSystem
|
||||
, pkgs
|
||||
, lib
|
||||
, fetchurl
|
||||
, installShellFiles
|
||||
}:
|
||||
let
|
||||
shaMap = {
|
||||
i686-linux = "0000000000000000000000000000000000000000000000000000";
|
||||
|
@ -1,6 +1,12 @@
|
||||
# This file was generated by GoReleaser. DO NOT EDIT.
|
||||
# vim: set ft=nix ts=2 sw=2 sts=2 et sta
|
||||
{ system ? builtins.currentSystem, pkgs, lib, fetchurl, installShellFiles }:
|
||||
{
|
||||
system ? builtins.currentSystem
|
||||
, pkgs
|
||||
, lib
|
||||
, fetchurl
|
||||
, installShellFiles
|
||||
}:
|
||||
let
|
||||
shaMap = {
|
||||
x86_64-linux = "sha1";
|
||||
|
@ -1,6 +1,12 @@
|
||||
# This file was generated by GoReleaser. DO NOT EDIT.
|
||||
# vim: set ft=nix ts=2 sw=2 sts=2 et sta
|
||||
{ system ? builtins.currentSystem, pkgs, lib, fetchurl, installShellFiles }:
|
||||
{
|
||||
system ? builtins.currentSystem
|
||||
, pkgs
|
||||
, lib
|
||||
, fetchurl
|
||||
, installShellFiles
|
||||
}:
|
||||
let
|
||||
shaMap = {
|
||||
i686-linux = "0000000000000000000000000000000000000000000000000000";
|
||||
|
@ -1,6 +1,12 @@
|
||||
# This file was generated by GoReleaser. DO NOT EDIT.
|
||||
# vim: set ft=nix ts=2 sw=2 sts=2 et sta
|
||||
{ system ? builtins.currentSystem, pkgs, lib, fetchurl, installShellFiles }:
|
||||
{
|
||||
system ? builtins.currentSystem
|
||||
, pkgs
|
||||
, lib
|
||||
, fetchurl
|
||||
, installShellFiles
|
||||
}:
|
||||
let
|
||||
shaMap = {
|
||||
x86_64-linux = "sha1";
|
||||
|
@ -1,6 +1,19 @@
|
||||
# This file was generated by GoReleaser. DO NOT EDIT.
|
||||
# vim: set ft=nix ts=2 sw=2 sts=2 et sta
|
||||
{ system ? builtins.currentSystem, pkgs, lib, fetchurl, installShellFiles }:
|
||||
{
|
||||
system ? builtins.currentSystem
|
||||
, pkgs
|
||||
, lib
|
||||
, fetchurl
|
||||
, installShellFiles
|
||||
{{- if .Dependencies }}
|
||||
, makeWrapper
|
||||
, stdenv
|
||||
{{- end -}}
|
||||
{{- range $index, $element := .Dependencies }}
|
||||
, {{ . -}}
|
||||
{{- end }}
|
||||
}:
|
||||
let
|
||||
shaMap = {
|
||||
{{- with .Archives.linux386.Sha }}
|
||||
@ -59,7 +72,7 @@ in pkgs.stdenv.mkDerivation {
|
||||
|
||||
sourceRoot = "{{ .SourceRoot }}";
|
||||
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
nativeBuildInputs = [ {{ range $input, $plat := .Inputs }}{{ . }} {{ end }}];
|
||||
|
||||
installPhase = ''
|
||||
{{- range $index, $element := .Install }}
|
||||
|
@ -259,6 +259,48 @@ type Nix struct {
|
||||
Description string `yaml:"description,omitempty" json:"description,omitempty"`
|
||||
Homepage string `yaml:"homepage,omitempty" json:"homepage,omitempty"`
|
||||
License string `yaml:"license,omitempty" json:"license,omitempty"`
|
||||
|
||||
Dependencies []NixDependency `yaml:"dependencies,omitempty" json:"dependencies,omitempty"`
|
||||
}
|
||||
|
||||
type NixDependency struct {
|
||||
Name string `yaml:"name" json:"name"`
|
||||
OS string `yaml:"os,omitempty" json:"os,omitempty" jsonschema:"enum=linux,enum=darwin"`
|
||||
}
|
||||
|
||||
func (a NixDependency) JSONSchema() *jsonschema.Schema {
|
||||
reflector := jsonschema.Reflector{
|
||||
ExpandedStruct: true,
|
||||
}
|
||||
type t NixDependency
|
||||
schema := reflector.Reflect(&t{})
|
||||
return &jsonschema.Schema{
|
||||
OneOf: []*jsonschema.Schema{
|
||||
{
|
||||
Type: "string",
|
||||
},
|
||||
schema,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (a *NixDependency) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
var str string
|
||||
if err := unmarshal(&str); err == nil {
|
||||
a.Name = str
|
||||
return nil
|
||||
}
|
||||
|
||||
type t NixDependency
|
||||
var dep t
|
||||
if err := unmarshal(&dep); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
a.Name = dep.Name
|
||||
a.OS = dep.OS
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type Winget struct {
|
||||
|
@ -74,6 +74,17 @@ nix:
|
||||
# Templates: allowed
|
||||
skip_upload: true
|
||||
|
||||
# Runtime dependencies of the package.
|
||||
#
|
||||
# Since: v1.20.
|
||||
dependencies:
|
||||
- zsh
|
||||
- chromium
|
||||
- name: bash
|
||||
os: linux
|
||||
- name: fish
|
||||
os: darwin
|
||||
|
||||
# Custom install script.
|
||||
#
|
||||
# Default: 'mkdir -p $out/bin; cp -vr $binary $out/bin/$binary'
|
||||
|
34
www/docs/static/schema.json
generated
vendored
34
www/docs/static/schema.json
generated
vendored
@ -2040,11 +2040,45 @@
|
||||
},
|
||||
"license": {
|
||||
"type": "string"
|
||||
},
|
||||
"dependencies": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/NixDependency"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"NixDependency": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://github.com/goreleaser/goreleaser/pkg/config/t",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"os": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"linux",
|
||||
"darwin"
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"OpenCollective": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user