2022-05-30 11:09:22 +00:00
|
|
|
{
|
|
|
|
description = "A basic gomod2nix flake";
|
|
|
|
|
|
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
2022-09-02 05:13:35 +00:00
|
|
|
inputs.gomod2nix.url = "github:nix-community/gomod2nix";
|
2023-09-13 06:36:14 +00:00
|
|
|
inputs.gomod2nix.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.gomod2nix.inputs.flake-utils.follows = "flake-utils";
|
2022-05-30 11:09:22 +00:00
|
|
|
|
|
|
|
outputs = { self, nixpkgs, flake-utils, gomod2nix }:
|
|
|
|
(flake-utils.lib.eachDefaultSystem
|
|
|
|
(system:
|
|
|
|
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.
|
|
|
|
callPackage = pkgs.darwin.apple_sdk_11_0.callPackage or pkgs.callPackage;
|
2022-05-30 11:09:22 +00:00
|
|
|
in
|
|
|
|
{
|
2023-09-13 06:07:32 +00:00
|
|
|
packages.default = callPackage ./. {
|
|
|
|
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
|
2023-09-13 05:43:01 +00:00
|
|
|
};
|
2023-09-13 06:07:32 +00:00
|
|
|
devShells.default = callPackage ./shell.nix {
|
2023-09-23 21:13:09 +00:00
|
|
|
inherit (gomod2nix.legacyPackages.${system}) mkGoEnv gomod2nix;
|
2023-09-13 05:43:01 +00:00
|
|
|
};
|
2022-05-30 11:09:22 +00:00
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|