di-tui/flake.nix

64 lines
1.6 KiB
Nix
Raw Normal View History

2023-08-24 06:56:25 +00:00
{
2024-02-25 16:09:40 +00:00
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
devenv.url = "github:cachix/devenv";
2023-08-24 06:56:25 +00:00
2024-02-25 16:09:40 +00:00
gomod2nix = {
url = "github:nix-community/gomod2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
2024-01-15 22:54:23 +00:00
2024-02-11 18:22:36 +00:00
outputs = {
self,
nixpkgs,
2024-02-25 16:09:40 +00:00
devenv,
systems,
2024-02-11 18:22:36 +00:00
gomod2nix,
2024-02-25 16:09:40 +00:00
...
} @ inputs: let
forEachSystem = nixpkgs.lib.genAttrs (import systems);
in {
2024-05-05 19:41:18 +00:00
packages = forEachSystem (system: let
callPackage = nixpkgs.darwin.apple_sdk_11_0.callPackage or nixpkgs.legacyPackages.${system}.callPackage;
2024-02-11 18:22:36 +00:00
in {
2024-05-05 19:41:18 +00:00
default = callPackage ./. {
2024-02-11 18:22:36 +00:00
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
};
2024-05-05 19:41:18 +00:00
});
2024-02-25 16:09:40 +00:00
2024-05-05 19:41:18 +00:00
devShells = forEachSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
2024-02-25 16:09:40 +00:00
default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
{
languages.go = {
enable = true;
package = pkgs.go_1_22;
};
packages = with pkgs; [
gomod2nix.legacyPackages.${system}.gomod2nix
golangci-lint
pre-commit
svu
2024-02-25 16:09:40 +00:00
];
pre-commit.hooks.gomod2nix = {
enable = true;
always_run = true;
name = "gomod2nix";
description = "Run gomod2nix before commit";
pass_filenames = false;
entry = "${gomod2nix.legacyPackages.${system}.gomod2nix}/bin/gomod2nix";
};
}
];
2024-02-11 18:22:36 +00:00
};
2024-02-25 16:09:40 +00:00
});
};
2023-08-24 06:56:25 +00:00
}