diff --git a/hosts/pinwheel/configuration.nix b/hosts/pinwheel/configuration.nix index e9268fd..0ecf2d9 100644 --- a/hosts/pinwheel/configuration.nix +++ b/hosts/pinwheel/configuration.nix @@ -130,6 +130,7 @@ mod = { git.enable = true; openvpn.enable = true; + go.enable = true; }; # This value determines the NixOS release from which the default diff --git a/hosts/pinwheel/modules/go/default.nix b/hosts/pinwheel/modules/go/default.nix index aed43b9..3665dd6 100644 --- a/hosts/pinwheel/modules/go/default.nix +++ b/hosts/pinwheel/modules/go/default.nix @@ -1,25 +1,36 @@ -{ pkgs, ... }: +{ pkgs, lib, config, ... }: +let + enabled = config.mod.go.enable; +in { - home-manager.users.alex = { - programs.go = { - enable = true; - - package = pkgs.go_1_21; - goPath = "code/go"; + options = { + mod.go = { + enable = lib.mkEnableOption "enable openpn module"; }; + }; - home.packages = [ - pkgs.gopls - pkgs.go-tools - pkgs.govulncheck - pkgs.go-licenses - pkgs.gotestsum - ]; + config = lib.mkIf enabled { + home-manager.users.alex = { + programs.go = { + enable = true; - programs.zsh = { - envExtra = '' - PATH=$PATH:/home/alex/code/go/bin - ''; + package = pkgs.go_1_21; + goPath = "code/go"; + }; + + home.packages = [ + pkgs.gopls + pkgs.go-tools + pkgs.govulncheck + pkgs.go-licenses + pkgs.gotestsum + ]; + + programs.zsh = { + envExtra = '' + PATH=$PATH:/home/alex/code/go/bin + ''; + }; }; }; } diff --git a/hosts/pinwheel/modules/work/default.nix b/hosts/pinwheel/modules/work/default.nix index a2acbdd..882fbe9 100644 --- a/hosts/pinwheel/modules/work/default.nix +++ b/hosts/pinwheel/modules/work/default.nix @@ -1,6 +1,7 @@ { pkgs, lib, config, ... }: let gitEnabled = config.mod.git.enable; + goEnabled = config.mod.go.enable; openvpnEnabled = config.mod.openvpn.enable; work-vpn = let @@ -35,7 +36,7 @@ in ]; }; - programs.go = { + programs.go = lib.mkIf goEnabled { goPrivate = [ "gitlab.com/zebware/*" ]; };