From 9eb783a3e83c031c0adcd2ebc12705e7bbdc4ad3 Mon Sep 17 00:00:00 2001 From: Gabe Venberg Date: Tue, 23 Apr 2024 16:56:34 -0500 Subject: [PATCH] moved home-manager options to the "home" namespace this frees up the "host" namespace for host-wide options. --- hosts/archlaptop-vm/default.nix | 7 ++-- hosts/gabe-archlaptop.nix | 2 +- hosts/gabe-gv-workstation.nix | 2 +- hosts/workstation-vm/default.nix | 7 ++-- modules/both/i3/default.nix | 24 +++++------ modules/home-manager/default.nix | 3 ++ modules/home-manager/nvim/cmp/default.nix | 6 +-- modules/home-manager/nvim/lsp/clangd.nix | 2 +- modules/home-manager/nvim/lsp/default.nix | 6 +-- modules/home-manager/nvim/lsp/rust-tools.nix | 2 +- .../home-manager/nvim/treesitter/arial.nix | 2 +- .../home-manager/nvim/treesitter/default.nix | 6 +-- .../nvim/treesitter/rainbow-delimiters.nix | 2 +- .../nvim/treesitter/tree-sitter-nu.nix | 2 +- modules/home-manager/terminal/git.nix | 42 ++++++++++--------- modules/home-manager/terminal/voice.nix | 4 +- modules/{commonopts.nix => hostopts.nix} | 0 17 files changed, 64 insertions(+), 55 deletions(-) rename modules/{commonopts.nix => hostopts.nix} (100%) diff --git a/hosts/archlaptop-vm/default.nix b/hosts/archlaptop-vm/default.nix index 1cada34..d711855 100644 --- a/hosts/archlaptop-vm/default.nix +++ b/hosts/archlaptop-vm/default.nix @@ -13,7 +13,7 @@ inputs.nixpkgs.lib.nixosSystem { modules = [ inputs.home-manager.nixosModules.home-manager ./hardware-configuration.nix - ../../modules/commonopts.nix + ../../modules/hostopts.nix ../../modules/nixos/common.nix ../../modules/nixos/printing.nix ../../modules/both/sound.nix @@ -66,8 +66,9 @@ inputs.nixpkgs.lib.nixosSystem { ]; }; - home-manager.users.${config.host.user} = {inputs, ...}: { - host = { + home-manager.users.${config.host.user} = {inputs, osConfig, ...}: { + host=osConfig.host; + home = { enable-speech = true; nvim = { enable-lsp = true; diff --git a/hosts/gabe-archlaptop.nix b/hosts/gabe-archlaptop.nix index 85f241a..8f87b71 100644 --- a/hosts/gabe-archlaptop.nix +++ b/hosts/gabe-archlaptop.nix @@ -5,7 +5,7 @@ ... }: { # machine specific options - host = { + home= { enable-speech = true; nvim = { enable-lsp = true; diff --git a/hosts/gabe-gv-workstation.nix b/hosts/gabe-gv-workstation.nix index 87ce76c..6e91e11 100644 --- a/hosts/gabe-gv-workstation.nix +++ b/hosts/gabe-gv-workstation.nix @@ -5,7 +5,7 @@ ... }: { # machine specific options - host = { + home = { enable-speech = true; nvim = { enable-lsp = true; diff --git a/hosts/workstation-vm/default.nix b/hosts/workstation-vm/default.nix index 9524cd2..762ac02 100644 --- a/hosts/workstation-vm/default.nix +++ b/hosts/workstation-vm/default.nix @@ -13,7 +13,7 @@ inputs.nixpkgs.lib.nixosSystem { modules = [ inputs.home-manager.nixosModules.home-manager ./hardware-configuration.nix - ../../modules/commonopts.nix + ../../modules/hostopts.nix ../../modules/nixos/common.nix ../../modules/nixos/printing.nix ../../modules/both/sound.nix @@ -67,8 +67,9 @@ inputs.nixpkgs.lib.nixosSystem { ]; }; - home-manager.users.${config.host.user} = {inputs, ...}: { - host = { + home-manager.users.${config.host.user} = {inputs, osConfig, ...}: { + host=osConfig.host; + home = { enable-speech = true; nvim = { enable-lsp = true; diff --git a/modules/both/i3/default.nix b/modules/both/i3/default.nix index 30cca2f..447c519 100644 --- a/modules/both/i3/default.nix +++ b/modules/both/i3/default.nix @@ -5,21 +5,21 @@ ... }: { services.accounts-daemon.enable = true; + services.displayManager = { + defaultSession = "none+i3"; + autoLogin = { + user = config.host.user; + enable = true; + }; + }; services.xserver = { enable = true; - displayManager = { - defaultSession = "none+i3"; - autoLogin = { - user = config.host.user; - enable = true; - }; - lightdm = { - enable = true; - greeters.gtk.enable = false; - greeter.enable = false; - }; - }; windowManager.i3.enable = true; + displayManager.lightdm = { + enable = true; + greeters.gtk.enable = false; + greeter.enable = false; + }; }; home-manager.users.${config.host.user} = {config, ...}: { home.packages = with pkgs; [ diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 2f03127..c1fe84a 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -18,4 +18,7 @@ settings.max-jobs = "auto"; gc.automatic = true; }; + imports = [ + ../hostopts.nix + ]; } diff --git a/modules/home-manager/nvim/cmp/default.nix b/modules/home-manager/nvim/cmp/default.nix index 8b25060..f2ddce5 100644 --- a/modules/home-manager/nvim/cmp/default.nix +++ b/modules/home-manager/nvim/cmp/default.nix @@ -5,14 +5,14 @@ ... }: { options = { - host.nvim.enable-completions = + home.nvim.enable-completions = (lib.mkEnableOption "basic completion in nvim") // { - default = config.host.nvim.enable-treesitter || config.host.nvim.enable-lsp; + default = false; }; }; config = - lib.mkIf config.host.nvim.enable-completions + lib.mkIf config.home.nvim.enable-completions { programs.nixvim = { plugins.luasnip.enable = true; diff --git a/modules/home-manager/nvim/lsp/clangd.nix b/modules/home-manager/nvim/lsp/clangd.nix index 1f70a4b..9e9daff 100644 --- a/modules/home-manager/nvim/lsp/clangd.nix +++ b/modules/home-manager/nvim/lsp/clangd.nix @@ -28,7 +28,7 @@ BreakBeforeBinaryOperators: NonAssignment ... ''; - "work/.clang-format" = lib.mkIf config.host.git.workProfile.enable { + "work/.clang-format" = lib.mkIf config.home.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. diff --git a/modules/home-manager/nvim/lsp/default.nix b/modules/home-manager/nvim/lsp/default.nix index 8113e14..86cb15b 100644 --- a/modules/home-manager/nvim/lsp/default.nix +++ b/modules/home-manager/nvim/lsp/default.nix @@ -5,13 +5,13 @@ ... }: { options = { - host.nvim.enable-lsp = lib.mkEnableOption "nvim lsp"; + home.nvim.enable-lsp = lib.mkEnableOption "nvim lsp"; }; config = - lib.mkIf config.host.nvim.enable-lsp + lib.mkIf config.home.nvim.enable-lsp { - host.nvim.enable-completions = true; + home.nvim.enable-completions = true; programs.nixvim = { plugins.lsp = { enable = true; diff --git a/modules/home-manager/nvim/lsp/rust-tools.nix b/modules/home-manager/nvim/lsp/rust-tools.nix index ed00790..72cb8e6 100644 --- a/modules/home-manager/nvim/lsp/rust-tools.nix +++ b/modules/home-manager/nvim/lsp/rust-tools.nix @@ -5,7 +5,7 @@ ... }: { config = - lib.mkIf config.host.nvim.enable-lsp + lib.mkIf config.home.nvim.enable-lsp { programs.nixvim = { plugins.rust-tools = { diff --git a/modules/home-manager/nvim/treesitter/arial.nix b/modules/home-manager/nvim/treesitter/arial.nix index 3f7cc00..ffea439 100644 --- a/modules/home-manager/nvim/treesitter/arial.nix +++ b/modules/home-manager/nvim/treesitter/arial.nix @@ -5,7 +5,7 @@ ... }: { config = - lib.mkIf config.host.nvim.enable-treesitter + lib.mkIf config.home.nvim.enable-treesitter { programs.nixvim = { keymaps = [ diff --git a/modules/home-manager/nvim/treesitter/default.nix b/modules/home-manager/nvim/treesitter/default.nix index e0153ab..16655c0 100644 --- a/modules/home-manager/nvim/treesitter/default.nix +++ b/modules/home-manager/nvim/treesitter/default.nix @@ -5,7 +5,7 @@ ... }: { options = { - host.nvim.enable-treesitter = lib.mkOption { + home.nvim.enable-treesitter = lib.mkOption { default = false; type = lib.types.bool; description = '' @@ -14,9 +14,9 @@ }; }; config = - lib.mkIf config.host.nvim.enable-treesitter + lib.mkIf config.home.nvim.enable-treesitter { - host.nvim.enable-completions = true; + home.nvim.enable-completions = true; programs.nixvim = { plugins.treesitter = { enable = true; diff --git a/modules/home-manager/nvim/treesitter/rainbow-delimiters.nix b/modules/home-manager/nvim/treesitter/rainbow-delimiters.nix index 3b1ec38..e120237 100644 --- a/modules/home-manager/nvim/treesitter/rainbow-delimiters.nix +++ b/modules/home-manager/nvim/treesitter/rainbow-delimiters.nix @@ -5,7 +5,7 @@ ... }: { config = - lib.mkIf config.host.nvim.enable-treesitter + lib.mkIf config.home.nvim.enable-treesitter { programs.nixvim = { plugins.rainbow-delimiters = { diff --git a/modules/home-manager/nvim/treesitter/tree-sitter-nu.nix b/modules/home-manager/nvim/treesitter/tree-sitter-nu.nix index f1ee3a0..f10e68e 100644 --- a/modules/home-manager/nvim/treesitter/tree-sitter-nu.nix +++ b/modules/home-manager/nvim/treesitter/tree-sitter-nu.nix @@ -5,7 +5,7 @@ ... }: { config = - lib.mkIf config.host.nvim.enable-treesitter + lib.mkIf config.home.nvim.enable-treesitter { programs.nixvim = let nu-grammar = pkgs.tree-sitter.buildGrammar { diff --git a/modules/home-manager/terminal/git.nix b/modules/home-manager/terminal/git.nix index 76aba82..748972d 100644 --- a/modules/home-manager/terminal/git.nix +++ b/modules/home-manager/terminal/git.nix @@ -5,21 +5,25 @@ ... }: { 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"; + home = { + git = { + workProfile = { + enable = lib.mkEnableOption "git work profile"; + email = lib.mkOption { + type = lib.types.str; + description = "email for work profile."; + }; + }; + 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"; + }; + }; }; }; }; @@ -43,8 +47,8 @@ }; # difftastic.enable=true; # difftastic.background="dark"; - userEmail = config.host.git.profile.email; - userName = config.host.git.profile.name; + userEmail = config.home.git.profile.email; + userName = config.home.git.profile.name; extraConfig = { init = { defaultBranch = "main"; @@ -73,11 +77,11 @@ }; }; includes = - if config.host.git.workProfile.enable + if config.home.git.workProfile.enable then [ { condition = "gitdir:~/work/**"; - contents.user.email = config.host.git.workProfile.email; + contents.user.email = config.home.git.workProfile.email; } ] else []; diff --git a/modules/home-manager/terminal/voice.nix b/modules/home-manager/terminal/voice.nix index 4241f0a..741cbf4 100644 --- a/modules/home-manager/terminal/voice.nix +++ b/modules/home-manager/terminal/voice.nix @@ -5,11 +5,11 @@ ... }: { options = { - host.enable-speech = lib.mkEnableOption "espeak"; + home.enable-speech = lib.mkEnableOption "espeak"; }; config = - lib.mkIf config.host.enable-speech + lib.mkIf config.home.enable-speech { home.shellAliases = { say = "espeak -p 10 -s 150 -a 200"; diff --git a/modules/commonopts.nix b/modules/hostopts.nix similarity index 100% rename from modules/commonopts.nix rename to modules/hostopts.nix