UpFast/flake.nix

32 lines
1.2 KiB
Nix
Raw Permalink Normal View History

2024-03-03 11:02:29 +01:00
{
description = "A basic gomod2nix flake";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.gomod2nix.url = "github:nix-community/gomod2nix";
inputs.gomod2nix.inputs.nixpkgs.follows = "nixpkgs";
inputs.gomod2nix.inputs.flake-utils.follows = "flake-utils";
2024-03-17 15:06:04 +01:00
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
2024-03-03 11:02:29 +01:00
2024-03-17 15:06:04 +01:00
outputs = { self, nixpkgs, flake-utils, gomod2nix, pre-commit-hooks }:
2024-03-03 11:02:29 +01:00
(flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
# 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;
in
{
packages.default = callPackage ./. {
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
};
devShells.default = callPackage ./shell.nix {
inherit (gomod2nix.legacyPackages.${system}) mkGoEnv gomod2nix;
2024-03-17 15:06:04 +01:00
inherit pre-commit-hooks;
2024-03-03 11:02:29 +01:00
};
})
);
}