2020-10-29 12:56:41 +00:00
|
|
|
{
|
|
|
|
description = "Convert go.mod/go.sum to Nix packages";
|
|
|
|
|
2022-07-20 03:42:46 +00:00
|
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/master";
|
2023-09-13 06:36:14 +00:00
|
|
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
2020-10-29 12:56:41 +00:00
|
|
|
|
2023-09-13 06:36:14 +00:00
|
|
|
outputs = { self, nixpkgs, flake-utils }:
|
2020-12-03 15:16:08 +00:00
|
|
|
{
|
2022-05-26 10:31:19 +00:00
|
|
|
overlays.default = import ./overlay.nix;
|
2022-05-30 11:09:22 +00:00
|
|
|
|
|
|
|
templates = {
|
|
|
|
app = {
|
|
|
|
path = ./templates/app;
|
|
|
|
description = "Gomod2nix packaged application";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
defaultTemplate = self.templates.app;
|
|
|
|
|
2024-07-25 09:37:11 +00:00
|
|
|
}
|
|
|
|
// (flake-utils.lib.eachSystem
|
|
|
|
[
|
|
|
|
"x86_64-linux"
|
|
|
|
"aarch64-linux"
|
|
|
|
"riscv64-linux"
|
|
|
|
]
|
|
|
|
(
|
|
|
|
system:
|
2021-03-16 23:08:52 +00:00
|
|
|
let
|
2023-09-13 05:43:01 +00:00
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
|
2023-09-13 06:07:32 +00:00
|
|
|
# The current default sdk for macOS fails to compile go projects, so we use a newer one for now.
|
|
|
|
# This has no effect on other platforms.
|
2023-09-13 05:43:01 +00:00
|
|
|
callPackage = pkgs.darwin.apple_sdk_11_0.callPackage or pkgs.callPackage;
|
|
|
|
|
|
|
|
inherit (callPackage ./builder {
|
|
|
|
inherit gomod2nix;
|
|
|
|
}) mkGoEnv buildGoApplication;
|
|
|
|
gomod2nix = callPackage ./default.nix {
|
|
|
|
inherit mkGoEnv buildGoApplication;
|
2021-03-16 23:08:52 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
2023-09-13 05:43:01 +00:00
|
|
|
packages.default = gomod2nix;
|
|
|
|
legacyPackages = {
|
|
|
|
# we cannot put them in packages because they are builder functions
|
|
|
|
inherit mkGoEnv buildGoApplication;
|
|
|
|
# just have this here for convenience
|
|
|
|
inherit gomod2nix;
|
|
|
|
};
|
|
|
|
devShells.default = callPackage ./shell.nix {
|
|
|
|
inherit mkGoEnv gomod2nix;
|
|
|
|
};
|
2024-07-25 09:37:11 +00:00
|
|
|
}
|
|
|
|
)
|
2021-03-16 23:08:52 +00:00
|
|
|
);
|
2020-10-29 12:56:41 +00:00
|
|
|
}
|