github.com/goreleaser/goreleaser@v1.25.1/internal/pipe/nix/tmpl.nix (about)

     1  # This file was generated by GoReleaser. DO NOT EDIT.
     2  # vim: set ft=nix ts=2 sw=2 sts=2 et sta
     3  {
     4  system ? builtins.currentSystem
     5  , lib
     6  , fetchurl
     7  , installShellFiles
     8  , stdenvNoCC
     9  {{- range $index, $element := .Dependencies }}
    10  , {{ . -}}
    11  {{- end }}
    12  }:
    13  let
    14    shaMap = {
    15      {{- with  .Archives.linux386.Sha }}
    16      i686-linux = "{{ . }}";
    17      {{- end }}
    18      {{- with  .Archives.linuxamd64.Sha }}
    19      x86_64-linux = "{{ . }}";
    20      {{- end }}
    21      {{- with  .Archives.linuxarm6.Sha }}
    22      armv6l-linux = "{{ . }}";
    23      {{- end }}
    24      {{- with  .Archives.linuxarm7.Sha }}
    25      armv7l-linux = "{{ . }}";
    26      {{- end }}
    27      {{- with  .Archives.linuxarm64.Sha }}
    28      aarch64-linux = "{{ . }}";
    29      {{- end }}
    30      {{- with  .Archives.darwinamd64.Sha }}
    31      x86_64-darwin = "{{ . }}";
    32      {{- end }}
    33      {{- with  .Archives.darwinarm64.Sha }}
    34      aarch64-darwin = "{{ . }}";
    35      {{- end }}
    36    };
    37  
    38    urlMap = {
    39      {{- with  .Archives.linux386.URL }}
    40      i686-linux = "{{ . }}";
    41      {{- end }}
    42      {{- with  .Archives.linuxamd64.URL }}
    43      x86_64-linux = "{{ . }}";
    44      {{- end }}
    45      {{- with  .Archives.linuxarm6.URL }}
    46      armv6l-linux = "{{ . }}";
    47      {{- end }}
    48      {{- with  .Archives.linuxarm7.URL }}
    49      armv7l-linux = "{{ . }}";
    50      {{- end }}
    51      {{- with  .Archives.linuxarm64.URL }}
    52      aarch64-linux = "{{ . }}";
    53      {{- end }}
    54      {{- with  .Archives.darwinamd64.URL }}
    55      x86_64-darwin = "{{ . }}";
    56      {{- end }}
    57      {{- with  .Archives.darwinarm64.URL }}
    58      aarch64-darwin = "{{ . }}";
    59      {{- end }}
    60    };
    61  
    62    {{- if not .SourceRoot }}
    63    sourceRootMap = {
    64      {{- with  .SourceRoots.linux386 }}
    65      i686-linux = "{{ . }}";
    66      {{- end }}
    67      {{- with  .SourceRoots.linuxamd64 }}
    68      x86_64-linux = "{{ . }}";
    69      {{- end }}
    70      {{- with  .SourceRoots.linuxarm6 }}
    71      armv6l-linux = "{{ . }}";
    72      {{- end }}
    73      {{- with  .SourceRoots.linuxarm7 }}
    74      armv7l-linux = "{{ . }}";
    75      {{- end }}
    76      {{- with  .SourceRoots.linuxarm64 }}
    77      aarch64-linux = "{{ . }}";
    78      {{- end }}
    79      {{- with  .SourceRoots.darwinamd64 }}
    80      x86_64-darwin = "{{ . }}";
    81      {{- end }}
    82      {{- with  .SourceRoots.darwinarm64 }}
    83      aarch64-darwin = "{{ . }}";
    84      {{- end }}
    85    };
    86    {{- end }}
    87  in
    88  stdenvNoCC.mkDerivation {
    89    pname = "{{ .Name }}";
    90    version = "{{ .Version }}";
    91    src = fetchurl {
    92      url = urlMap.${system};
    93      sha256 = shaMap.${system};
    94    };
    95  
    96    sourceRoot = {{ with .SourceRoot }}"{{ . }}"{{ else }}sourceRootMap.${system}{{ end }};
    97  
    98    nativeBuildInputs = [ {{ range $input, $plat := .Inputs }}{{ . }} {{ end }}];
    99  
   100    installPhase = ''
   101      {{- range $index, $element := .Install }}
   102      {{ . -}}
   103      {{- end }}
   104    '';
   105  
   106    {{- with .PostInstall }}
   107    postInstall = ''
   108      {{- range $index, $element := . }}
   109      {{ . -}}
   110      {{- end }}
   111    '';
   112    {{- end }}
   113  
   114    system = system;
   115  
   116    meta = {
   117      {{- with .Description }}
   118      description = "{{ . }}";
   119      {{- end }}
   120      {{- with .Homepage }}
   121      homepage = "{{ . }}";
   122      {{- end }}
   123      {{- with .License }}
   124      license = lib.licenses.{{ . }};
   125      {{- end }}
   126  
   127      sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
   128  
   129      platforms = [
   130        {{- range $index, $plat := .Platforms }}
   131        "{{ . }}"
   132        {{- end }}
   133      ];
   134    };
   135  }