From 90409b441f46fa18529499fcf20631e2979e40ab Mon Sep 17 00:00:00 2001 From: Gabe Venberg Date: Sun, 24 Mar 2024 22:56:01 -0500 Subject: [PATCH] made git profile options. --- hosts/archlaptop/home.nix | 19 ++- hosts/gabe-archlaptop.nix | 23 ++-- hosts/gabe-workstation.nix | 33 +++++ hosts/non-nixos-server.nix | 21 ---- modules/home-manager/terminal/git.nix | 118 +++++++++++------- .../home-manager/terminal/nvim/lsp/clangd.nix | 49 ++++++++ .../home-manager/terminal/nvim/lsp/lsp.nix | 45 +------ modules/home-manager/terminal/voice.nix | 8 +- 8 files changed, 187 insertions(+), 129 deletions(-) create mode 100644 hosts/gabe-workstation.nix delete mode 100644 hosts/non-nixos-server.nix create mode 100644 modules/home-manager/terminal/nvim/lsp/clangd.nix diff --git a/hosts/archlaptop/home.nix b/hosts/archlaptop/home.nix index f1eeda2..e63168b 100644 --- a/hosts/archlaptop/home.nix +++ b/hosts/archlaptop/home.nix @@ -5,12 +5,21 @@ lib, ... }: { - # Home Manager needs a bit of information about you and the paths it should - # manage. # machine specific options - host.enable-speech = true; - host.nvim.enable-lsp = true; - host.nvim.enable-treesitter = true; + host = { + enable-speech = true; + nvim = { + enable-lsp = true; + enable-treesitter = true; + }; + git = { + profile = { + name = "Gabe Venberg"; + email = "gabevenberg@gmail.com"; + }; + workProfile.enable = false; + }; + }; home.username = "gabe"; home.homeDirectory = "/home/gabe"; diff --git a/hosts/gabe-archlaptop.nix b/hosts/gabe-archlaptop.nix index fd02546..7846018 100644 --- a/hosts/gabe-archlaptop.nix +++ b/hosts/gabe-archlaptop.nix @@ -4,18 +4,27 @@ lib, ... }: { - # Home Manager needs a bit of information about you and the paths it should - # manage. # machine specific options - host.enable-speech = true; - host.nvim.enable-lsp = true; - host.nvim.enable-treesitter = true; + host = { + enable-speech = true; + nvim = { + enable-lsp = true; + enable-treesitter = true; + }; + git = { + profile = { + name = "Gabe Venberg"; + email = "gabevenberg@gmail.com"; + }; + workProfile.enable = false; + }; + }; targets.genericLinux.enable = true; home.username = "gabe"; home.homeDirectory = "/home/gabe"; imports = [ - ../terminal/terminal.nix - ../../modules/home-manager/home-manager.nix + ../modules/home-manager/terminal/terminal.nix + ../modules/home-manager/home-manager.nix ]; } diff --git a/hosts/gabe-workstation.nix b/hosts/gabe-workstation.nix new file mode 100644 index 0000000..1f60d05 --- /dev/null +++ b/hosts/gabe-workstation.nix @@ -0,0 +1,33 @@ +{ + config, + pkgs, + lib, + ... +}: { + host = { + # machine specific options + enable-speech = true; + nvim = { + enable-lsp = true; + enable-treesitter = true; + }; + git = { + profile = { + name = "Gabe Venberg"; + email = "gabevenberg@gmail.com"; + }; + workProfile = { + enable = true; + email = "venberggabe@johndeere.com"; + }; + }; + }; + + targets.genericLinux.enable = true; + home.username = "gabe"; + home.homeDirectory = "/home/gabe"; + imports = [ + ../modules/home-manager/terminal/terminal.nix + ../modules/home-manager/home-manager.nix + ]; +} diff --git a/hosts/non-nixos-server.nix b/hosts/non-nixos-server.nix deleted file mode 100644 index 3f563b6..0000000 --- a/hosts/non-nixos-server.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: { - # Home Manager needs a bit of information about you and the paths it should - # manage. - # machine specific options - host.enable-speech = false; - host.nvim.enable-lsp = false; - host.nvim.enable-treesitter = true; - - targets.genericLinux.enable = true; - home.username = "gabe"; - home.homeDirectory = "/home/gabe"; - imports = [ - ../terminal/terminal.nix - ../../modules/home-manager/home-manager.nix - ]; -} diff --git a/modules/home-manager/terminal/git.nix b/modules/home-manager/terminal/git.nix index 62cf1b2..c8b092d 100644 --- a/modules/home-manager/terminal/git.nix +++ b/modules/home-manager/terminal/git.nix @@ -1,57 +1,79 @@ { config, pgks, + lib, ... }: { - programs.git = { - enable = true; - aliases = { - hist = "log --graph --date-order --date=short --pretty=format:'%C(auto)%h%d %C(reset)%s %C(bold blue)%ce %C(reset)%C(green)%cr (%cd)'"; - graph = "log --graph --topo-order --all --pretty=format:'%C(auto)%h %C(cyan)%an %C(blue)%ar %C(auto)%d %s'"; - recent = "branch --sort=-committerdate --format='%(committerdate:relative)%09%(refname:short)'"; - }; - delta.enable = true; - # difftastic.enable=true; - # difftastic.background="dark"; - userEmail = "gabevenberg@gmail.com"; - userName = "Gabe Venberg"; - extraConfig = { - init = { - defaultBranch = "main"; - }; - push = { - autoSetupRemote = true; - default = "current"; - }; - pull = { - ff = true; - }; - merge = { - conflictstyle = "zdiff3"; - }; - rebase = { - autosquash = true; - }; - help = { - autocorrect = "prompt"; - }; - branch = { - sort = "-committerdate"; - }; - status = { - submodulesummary = true; + options = { + host.git.workProfile = { + enable = lib.mkEnableOption "git work profile"; + email = lib.mkOption { + type = lib.types.str; + description = "email for work profile."; + }; + }; + host.git.profile = { + email = lib.mkOption { + type = lib.types.str; + description = "email for main profile"; + }; + name = lib.mkOption { + type = lib.types.str; + description = "name for main profile"; }; }; - includes = [ - { - condition = "gitdir:~/work/"; - contents = { - user = { - email = "venberggabe@johndeere.com"; - }; - }; - } - ]; }; - programs.lazygit.enable = true; + + config = { + programs.git = { + enable = true; + aliases = { + hist = "log --graph --date-order --date=short --pretty=format:'%C(auto)%h%d %C(reset)%s %C(bold blue)%ce %C(reset)%C(green)%cr (%cd)'"; + graph = "log --graph --topo-order --all --pretty=format:'%C(auto)%h %C(cyan)%an %C(blue)%ar %C(auto)%d %s'"; + recent = "branch --sort=-committerdate --format='%(committerdate:relative)%09%(refname:short)'"; + }; + delta.enable = true; + # difftastic.enable=true; + # difftastic.background="dark"; + userEmail = config.host.git.profile.email; + userName = config.host.git.profile.name; + extraConfig = { + init = { + defaultBranch = "main"; + }; + push = { + autoSetupRemote = true; + default = "current"; + }; + pull = { + ff = true; + }; + merge = { + conflictstyle = "zdiff3"; + }; + rebase = { + autosquash = true; + }; + help = { + autocorrect = "prompt"; + }; + branch = { + sort = "-committerdate"; + }; + status = { + submodulesummary = true; + }; + }; + includes = + if config.host.git.workProfile.enable + then [ + { + condition = "gitdir:~/work/"; + contents.user.email = config.host.git.workProfile.email; + } + ] + else []; + }; + programs.lazygit.enable = true; + }; } diff --git a/modules/home-manager/terminal/nvim/lsp/clangd.nix b/modules/home-manager/terminal/nvim/lsp/clangd.nix new file mode 100644 index 0000000..d91195d --- /dev/null +++ b/modules/home-manager/terminal/nvim/lsp/clangd.nix @@ -0,0 +1,49 @@ +{ + config, + pkgs, + lib, + ... +}: { + home.file = { + ".clangd".text = '' + # keeps clangd from choking when it sees a compiler flag for a different + # compiler. (sutch as when acting as an lsp for a project that uses GCC.) + CompileFlags: + Add: -Wno-unknown-warning-option + Remove: [-m*, -f*] + ''; + ".clang-format".text = '' + --- + #this syncronizes with settings used by neovims treesitters so that the lsp formatting and treesitter formatting do not fight eatch other. + PointerAlignment: Left + ColumnLimit: 80 + IndentWidth: 4 + TabWidth: 4 + UseCRLF: false + UseTab: Never + AlignAfterOpenBracket: BlockIndent + AlwaysBreakBeforeMultilineStrings: true + BreakBeforeBraces: Attach + AlignOperands: Align + BreakBeforeBinaryOperators: NonAssignment + ... + ''; + "work/.clang-format" = lib.mkIf config.host.git.workProfile.enable{ + text = '' + --- + #this syncronizes with settings used by neovims treesitters so that the lsp formatting and treesitter formatting do not fight eatch other. + PointerAlignment: Left + ColumnLimit: 80 + IndentWidth: 4 + TabWidth: 4 + UseCRLF: false + UseTab: Never + AlignAfterOpenBracket: BlockIndent + AlwaysBreakBeforeMultilineStrings: true + BreakBeforeBraces: Allman + BreakBeforeBinaryOperators: None + ... + ''; + }; + }; +} diff --git a/modules/home-manager/terminal/nvim/lsp/lsp.nix b/modules/home-manager/terminal/nvim/lsp/lsp.nix index 29e8c0e..8113e14 100644 --- a/modules/home-manager/terminal/nvim/lsp/lsp.nix +++ b/modules/home-manager/terminal/nvim/lsp/lsp.nix @@ -197,49 +197,12 @@ } ]; }; - home.file = { - ".clangd".text = '' - # keeps clangd from choking when it sees a compiler flag for a different - # compiler. (sutch as when acting as an lsp for a project that uses GCC.) - CompileFlags: - Add: -Wno-unknown-warning-option - Remove: [-m*, -f*] - ''; - ".clang-format".text = '' - --- - #this syncronizes with settings used by neovims treesitters so that the lsp formatting and treesitter formatting do not fight eatch other. - PointerAlignment: Left - ColumnLimit: 80 - IndentWidth: 4 - TabWidth: 4 - UseCRLF: false - UseTab: Never - AlignAfterOpenBracket: BlockIndent - AlwaysBreakBeforeMultilineStrings: true - BreakBeforeBraces: Attach - AlignOperands: Align - BreakBeforeBinaryOperators: NonAssignment - ... - ''; - "work/.clang-format".text = '' - --- - #this syncronizes with settings used by neovims treesitters so that the lsp formatting and treesitter formatting do not fight eatch other. - PointerAlignment: Left - ColumnLimit: 80 - IndentWidth: 4 - TabWidth: 4 - UseCRLF: false - UseTab: Never - AlignAfterOpenBracket: BlockIndent - AlwaysBreakBeforeMultilineStrings: true - BreakBeforeBraces: Allman - BreakBeforeBinaryOperators: None - ... - ''; - }; home.packages = with pkgs; [ alejandra ]; }; - imports = [./rust-tools.nix]; + imports = [ + ./rust-tools.nix + ./clangd.nix + ]; } diff --git a/modules/home-manager/terminal/voice.nix b/modules/home-manager/terminal/voice.nix index add8366..4241f0a 100644 --- a/modules/home-manager/terminal/voice.nix +++ b/modules/home-manager/terminal/voice.nix @@ -5,13 +5,7 @@ ... }: { options = { - host.enable-speech = lib.mkOption { - default = false; - type = lib.types.bool; - description = '' - install a text to speech engine - ''; - }; + host.enable-speech = lib.mkEnableOption "espeak"; }; config =