diff --git a/flake.lock b/flake.lock index 3625329..ec4995b 100644 --- a/flake.lock +++ b/flake.lock @@ -41,11 +41,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1742069588, - "narHash": "sha256-C7jVfohcGzdZRF6DO+ybyG/sqpo1h6bZi9T56sxLy+k=", + "lastModified": 1742669843, + "narHash": "sha256-G5n+FOXLXcRx+3hCJ6Rt6ZQyF1zqQ0DL0sWAMn2Nk0w=", "owner": "nixos", "repo": "nixpkgs", - "rev": "c80f6a7e10b39afcc1894e02ef785b1ad0b0d7e5", + "rev": "1e5b653dff12029333a6546c11e108ede13052eb", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index d90fac6..1c28250 100644 --- a/flake.nix +++ b/flake.nix @@ -3,12 +3,12 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + utils.url = "github:numtide/flake-utils"; gomod2nix = { url = "github:tweag/gomod2nix"; inputs.nixpkgs.follows = "nixpkgs"; inputs.utils.follows = "utils"; }; - utils.url = "github:numtide/flake-utils"; }; outputs = { self, nixpkgs, utils, gomod2nix }: @@ -131,21 +131,48 @@ }; in node-modules; }; - devShells.default = pkgs.mkShell { - buildInputs = inputs ++ (with pkgs; [ - mailutils - wireguard-tools - antlr - just - ]) ++ (if pkgs.stdenv.isLinux then with pkgs; [ - postfix - ] else []); - }; + + devShells.default = let + version = "0.16.2"; + ourGopls = pkgs.buildGoModule { + pname = "gopls"; + inherit version; + modRoot = "gopls"; + vendorHash = "sha256-ta94xPboFtSxFeuMtPX76XiC1O7osNl4oLk64wIyyz4="; + + # https://github.com/golang/tools/blob/9ed98faa/gopls/main.go#L27-L30 + ldflags = [ "-X main.version=v${version}" ]; + + doCheck = false; + + # Only build gopls, and not the integration tests or documentation generator. + subPackages = [ "." ]; + + src = pkgs.fetchFromGitHub { + owner = "golang"; + repo = "tools"; + rev = "gopls/v${version}"; + hash = "sha256-amy00VMUcmyjDoZ4d9/+YswfcZ+1/cGvFsA4sAmc1dA="; + }; + }; + in + pkgs.mkShell { + buildInputs = inputs ++ (with pkgs; [ + mailutils + wireguard-tools + antlr + just + ourGopls + ]) ++ (if pkgs.stdenv.isLinux then with pkgs; [ + postfix + ] else []); + }; + devShells."vs-code-extension" = pkgs.mkShell { - buildInputs = [ - pkgs.nodejs - pkgs.vsce - pkgs.yarn2nix + buildInputs = with pkgs; [ + nodejs + vsce + yarn2nix ]; }; }