ess/flake.nix

63 lines
1.6 KiB
Nix
Raw Normal View History

2023-09-02 13:31:35 +00:00
{
2024-01-20 00:23:56 +00:00
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
devenv.url = "github:cachix/devenv/v0.6.3";
2023-09-02 13:31:35 +00:00
2024-01-20 00:23:56 +00:00
gomod2nix = {
url = "github:nix-community/gomod2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
2024-01-20 00:23:56 +00:00
outputs = {
self,
nixpkgs,
devenv,
systems,
gomod2nix,
...
} @ inputs: let
forEachSystem = nixpkgs.lib.genAttrs (import systems);
in {
2024-01-29 19:41:58 +00:00
packages = forEachSystem (system: let
callPackage = nixpkgs.darwin.apple_sdk_11_0.callPackage or nixpkgs.legacyPackages.${system}.callPackage;
in {
default = callPackage ./. {
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
};
});
2024-01-20 00:23:56 +00:00
devShells = forEachSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
{
packages = with pkgs; [
automake
go_1_21
gomod2nix.legacyPackages.${system}.gomod2nix
gotools
golangci-lint
go-tools
gopls
pre-commit
flyctl
];
2023-09-02 13:31:35 +00:00
2024-01-20 00:23:56 +00:00
pre-commit.hooks.gomod2nix = {
enable = true;
pass_filenames = false;
name = "gomod2nix";
description = "Run gomod2nix before commit";
entry = "${gomod2nix.legacyPackages.${system}.gomod2nix}/bin/gomod2nix";
};
}
];
};
});
};
2023-09-02 13:31:35 +00:00
}