flake.nix raw

   1  {
   2    description = "Viper";
   3  
   4    inputs = {
   5      nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
   6      flake-parts.url = "github:hercules-ci/flake-parts";
   7      devenv.url = "github:cachix/devenv";
   8    };
   9  
  10    outputs = inputs@{ flake-parts, ... }:
  11      flake-parts.lib.mkFlake { inherit inputs; } {
  12        imports = [
  13          inputs.devenv.flakeModule
  14        ];
  15  
  16        systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
  17  
  18        perSystem = { config, self', inputs', pkgs, system, ... }: rec {
  19          devenv.shells = {
  20            default = {
  21              languages = {
  22                go.enable = true;
  23              };
  24  
  25              pre-commit.hooks = {
  26                nixpkgs-fmt.enable = true;
  27                yamllint.enable = true;
  28              };
  29  
  30              packages = with pkgs; [
  31                gnumake
  32  
  33                golangci-lint
  34                yamllint
  35              ];
  36  
  37              scripts = {
  38                versions.exec = ''
  39                  go version
  40                  golangci-lint version
  41                '';
  42              };
  43  
  44              enterShell = ''
  45                versions
  46              '';
  47  
  48              # https://github.com/cachix/devenv/issues/528#issuecomment-1556108767
  49              containers = pkgs.lib.mkForce { };
  50            };
  51  
  52            ci = devenv.shells.default;
  53          };
  54        };
  55      };
  56  }
  57