Skip to content

Commit 8816c4c

Browse files
committed
refactor: switch to Nix devshell
1 parent 6ab6bfc commit 8816c4c

File tree

6 files changed

+67
-179
lines changed

6 files changed

+67
-179
lines changed

.envrc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
source_url "https://raw.githubusercontent.com/cachix/devenv/82c0147677e510b247d8b9165c54f73d32dfd899/direnvrc" "sha256-7u4iDd1nZpxL4tCzmPG0dQgC5V+/44Ba+tHkPob1v2k="
2-
3-
use devenv
1+
use flake

devenv.lock

Lines changed: 0 additions & 116 deletions
This file was deleted.

devenv.nix

Lines changed: 0 additions & 45 deletions
This file was deleted.

devenv.yaml

Lines changed: 0 additions & 15 deletions
This file was deleted.

flake.lock

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
description = "A Nix-flake-based Go 1.22 development environment";
3+
4+
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
5+
6+
outputs = inputs:
7+
let
8+
goVersion = 24; # Change this to update the whole stack
9+
10+
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
11+
forEachSupportedSystem = f: inputs.nixpkgs.lib.genAttrs supportedSystems (system: f {
12+
pkgs = import inputs.nixpkgs {
13+
inherit system;
14+
overlays = [ inputs.self.overlays.default ];
15+
};
16+
});
17+
in
18+
{
19+
overlays.default = final: prev: {
20+
go = final."go_1_${toString goVersion}";
21+
};
22+
23+
devShells = forEachSupportedSystem ({ pkgs }: {
24+
default = pkgs.mkShell {
25+
packages = with pkgs; [
26+
# go (version is specified by overlay)
27+
go
28+
29+
# goimports, godoc, etc.
30+
gotools
31+
32+
# https://github.com/golangci/golangci-lint
33+
golangci-lint
34+
35+
# https://github.com/mvdan/gofumpt
36+
gofumpt
37+
];
38+
};
39+
});
40+
};
41+
}

0 commit comments

Comments
 (0)