rest of the split migration
This commit is contained in:
25
modules/dev/go/common.nix
Normal file
25
modules/dev/go/common.nix
Normal file
@@ -0,0 +1,25 @@
|
||||
{ pkgs }:
|
||||
let
|
||||
packages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
go
|
||||
gocode-gomod
|
||||
gotools
|
||||
gore
|
||||
gotests
|
||||
gomodifytags
|
||||
golangci-lint
|
||||
;
|
||||
};
|
||||
GOPATH = "\${XDG_DATA_HOME:-\$HOME/.local/share}/go";
|
||||
in
|
||||
{
|
||||
inherit packages GOPATH;
|
||||
devShell = pkgs.mkShell {
|
||||
inherit packages GOPATH;
|
||||
name = "go-dev-shell";
|
||||
shellHook = ''
|
||||
echo "🐹 Go dev environment"
|
||||
'';
|
||||
};
|
||||
}
|
||||
35
modules/dev/go/home.nix
Normal file
35
modules/dev/go/home.nix
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
osConfig ? null,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hm = inputs.self.lib.hmModule {
|
||||
inherit
|
||||
config
|
||||
inputs
|
||||
osConfig
|
||||
;
|
||||
optionPath = [
|
||||
"dev"
|
||||
"go"
|
||||
];
|
||||
};
|
||||
cfg = config.my.dev.go;
|
||||
feature = import ./common.nix { inherit pkgs; };
|
||||
in
|
||||
{
|
||||
options.my.dev.go.enable = lib.mkEnableOption "Install Go tooling globally";
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
my.dev.go.enable = lib.mkDefault hm.enabledByDefault;
|
||||
}
|
||||
(lib.mkIf cfg.enable {
|
||||
home.packages = feature.packages;
|
||||
home.sessionVariables.GOPATH = "${config.xdg.dataHome}/go";
|
||||
})
|
||||
];
|
||||
}
|
||||
27
modules/dev/go/nixos.nix
Normal file
27
modules/dev/go/nixos.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
feature = import ./common.nix { inherit pkgs; };
|
||||
in
|
||||
{
|
||||
options = {
|
||||
my.dev.go = {
|
||||
enable = lib.mkEnableOption "Install Go tooling globally";
|
||||
users = lib.mkOption {
|
||||
type = inputs.self.lib.usersOptionType lib;
|
||||
default = config.my.toggleUsers.dev;
|
||||
description = "Users to install Go packages for";
|
||||
};
|
||||
};
|
||||
devShells.go = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = feature.devShell;
|
||||
description = "Go development shell with Emacs tooling, REPL, formatter, and linter";
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user