feat(flake): Add gopls

This commit is contained in:
Myzel394 2025-03-24 10:45:45 +01:00
parent db4e1bae4c
commit ef625f9bf6
No known key found for this signature in database
GPG Key ID: B603E877F73D4ABB
2 changed files with 45 additions and 18 deletions

6
flake.lock generated
View File

@ -41,11 +41,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1742069588, "lastModified": 1742669843,
"narHash": "sha256-C7jVfohcGzdZRF6DO+ybyG/sqpo1h6bZi9T56sxLy+k=", "narHash": "sha256-G5n+FOXLXcRx+3hCJ6Rt6ZQyF1zqQ0DL0sWAMn2Nk0w=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c80f6a7e10b39afcc1894e02ef785b1ad0b0d7e5", "rev": "1e5b653dff12029333a6546c11e108ede13052eb",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -3,12 +3,12 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
utils.url = "github:numtide/flake-utils";
gomod2nix = { gomod2nix = {
url = "github:tweag/gomod2nix"; url = "github:tweag/gomod2nix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
inputs.utils.follows = "utils"; inputs.utils.follows = "utils";
}; };
utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, utils, gomod2nix }: outputs = { self, nixpkgs, utils, gomod2nix }:
@ -131,21 +131,48 @@
}; };
in node-modules; in node-modules;
}; };
devShells.default = pkgs.mkShell {
buildInputs = inputs ++ (with pkgs; [ devShells.default = let
mailutils version = "0.16.2";
wireguard-tools ourGopls = pkgs.buildGoModule {
antlr pname = "gopls";
just inherit version;
]) ++ (if pkgs.stdenv.isLinux then with pkgs; [ modRoot = "gopls";
postfix vendorHash = "sha256-ta94xPboFtSxFeuMtPX76XiC1O7osNl4oLk64wIyyz4=";
] else []);
}; # 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 { devShells."vs-code-extension" = pkgs.mkShell {
buildInputs = [ buildInputs = with pkgs; [
pkgs.nodejs nodejs
pkgs.vsce vsce
pkgs.yarn2nix yarn2nix
]; ];
}; };
} }