pinwheel: Add enable option to git module

And use it to check when to add work `gitconfig`
This commit is contained in:
Alexander Heldt
2023-10-01 22:54:00 +02:00
parent 4fc4726f22
commit 408751cce5
3 changed files with 25 additions and 9 deletions

View File

@@ -126,7 +126,11 @@
}; };
config-manager.flakePath = "/home/alex/config"; config-manager.flakePath = "/home/alex/config";
mod.openvpn.enable = true;
mod = {
git.enable = true;
openvpn.enable = true;
};
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions

View File

@@ -1,5 +1,15 @@
{ ... }: { lib, config, ... }:
let
enabled = config.mod.git.enable;
in
{ {
options = {
mod.git = {
enable = lib.mkEnableOption "enable git module";
};
};
config = lib.mkIf enabled {
home-manager.users.alex = { home-manager.users.alex = {
programs.git = { programs.git = {
enable = true; enable = true;
@@ -9,4 +19,5 @@
]; ];
}; };
}; };
};
} }

View File

@@ -1,5 +1,6 @@
{ pkgs, lib, config, ... }: { pkgs, lib, config, ... }:
let let
gitEnabled = config.mod.git.enable;
openvpnEnabled = config.mod.openvpn.enable; openvpnEnabled = config.mod.openvpn.enable;
work-vpn = let work-vpn = let
@@ -25,7 +26,7 @@ let
in in
{ {
home-manager.users.alex = { home-manager.users.alex = {
programs.git = { programs.git = lib.mkIf gitEnabled {
includes = [ includes = [
{ {
path = ./work-gitconfig; path = ./work-gitconfig;