Home

tmpls @flake - refs - log -
-
https://git.jolheiser.com/tmpls.git
tmpl templates
tmpls / template / flake.nix
- raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
  description = "{{description}}";

  inputs.nixpkgs.url = "github:nixos/nixpkgs{{if unstable}}/nixpkgs-unstable{{end}}";

  outputs = {
    self,
    nixpkgs,
  }: let
    systems = [
      "x86_64-linux"
      "x86_64-darwin"
      "aarch64-linux"
      "aarch64-darwin"
    ];
  in
    builtins.map (
      system: let
        pkgs = nixpkgs.legacyPackages.${system};
      in {
        {{if pname}}
        packages.${system}.default = pkgs.buildGoModule {
          pname = {{pname}};
          version = {{version}};
          src = ./.;
          vendorHash = "";
          meta = with pkgs.lib; {
            description = "{{description}}";
            homepage = "{{url}}";
            maintainers = with maintainers; [jolheiser];
            mainProgram = "{{pname}}";
          };
        };
        {{end}}
        {{if packages}}
        devShells.${system}.default = pkgs.mkShell {
          nativeBuildInputs = with pkgs; [
            {{- range $pkg := (splitList "\n" packages)}}
            {{trim $pkg}}
            {{- end}}
          ];
        };
        {{end}}
      }
    )
    systems;
}