From b0b87e67f84012623c57246b6884b39233b3685f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Sun, 4 Feb 2024 22:23:56 +0200 Subject: [PATCH] hm: clean up --- flake.nix | 1 + hosts/vm/configuration.nix | 29 ++--- modules/base/users/default.nix | 27 ++--- shared/home/default.nix | 198 ++++++++++++++++++--------------- 4 files changed, 124 insertions(+), 131 deletions(-) diff --git a/flake.nix b/flake.nix index 5320611..7b12d63 100644 --- a/flake.nix +++ b/flake.nix @@ -309,6 +309,7 @@ ]; extraSpecialArgs = { stateVersion = "23.05"; + username = "motiejus"; email = "motiejusja@wix.com"; devTools = true; hmOnly = true; diff --git a/hosts/vm/configuration.nix b/hosts/vm/configuration.nix index ba102cc..b2ce45a 100644 --- a/hosts/vm/configuration.nix +++ b/hosts/vm/configuration.nix @@ -14,26 +14,15 @@ home-manager.useGlobalPkgs = true; home-manager.users.nixos = {pkgs, ...}: - lib.mkMerge [ - (import ../../shared/home/default.nix { - inherit lib; - inherit pkgs; - inherit (config.mj) stateVersion; - username = "nixos"; - devTools = true; - hmOnly = false; - email = "motiejus@jakstys.lt"; - }) - { - programs.bash = { - enable = true; - shellAliases = { - "l" = "echo -n ł | xclip -selection clipboard"; - "gp" = "${pkgs.git}/bin/git remote | ${pkgs.parallel}/bin/parallel --verbose git push"; - }; - }; - } - ]; + import ../../shared/home/default.nix { + inherit lib; + inherit pkgs; + inherit (config.mj) stateVersion; + username = "nixos"; + devTools = true; + hmOnly = false; + email = "motiejus@jakstys.lt"; + }; mj = { stateVersion = "23.11"; diff --git a/modules/base/users/default.nix b/modules/base/users/default.nix index e22aee7..0913553 100644 --- a/modules/base/users/default.nix +++ b/modules/base/users/default.nix @@ -61,24 +61,13 @@ in { home-manager.useGlobalPkgs = true; home-manager.users.motiejus = {pkgs, ...}: - lib.mkMerge [ - (import ../../../shared/home/default.nix { - inherit lib; - inherit pkgs; - inherit (config.mj) stateVersion; - inherit (config.mj.base.users) devTools; - hmOnly = false; - email = "motiejus@jakstys.lt"; - }) - { - programs.bash = { - enable = true; - shellAliases = { - "l" = "echo -n ł | xclip -selection clipboard"; - "gp" = "${pkgs.git}/bin/git remote | ${pkgs.parallel}/bin/parallel --verbose git push"; - }; - }; - } - ]; + import ../../../shared/home/default.nix { + inherit lib; + inherit pkgs; + inherit (config.mj) stateVersion; + inherit (cfg) devTools; + hmOnly = false; + email = "motiejus@jakstys.lt"; + }; }; } diff --git a/shared/home/default.nix b/shared/home/default.nix index e3dc73d..e792411 100644 --- a/shared/home/default.nix +++ b/shared/home/default.nix @@ -98,105 +98,119 @@ in { ]) ]; - programs = { - direnv.enable = true; - man = { - enable = true; - generateCaches = true; - }; + programs = lib.mkMerge [ + { + direnv.enable = true; + man = { + enable = true; + generateCaches = true; + }; - firefox = lib.mkIf devTools { - enable = true; - # firefox doesn't need the wrapper on the personal laptop - package = - if hmOnly - then (glintel pkgs.firefox-bin "firefox") - else pkgs.firefox-bin; - policies.DisableAppUpdate = true; - profiles = { - xdefault = { - isDefault = true; - settings = { - "app.update.auto" = false; - "browser.aboutConfig.showWarning" = false; - "browser.contentblocking.category" = "strict"; - "browser.urlbar.showSearchSuggestionsFirst" = false; - "layout.css.prefers-color-scheme.content-override" = 0; - "signon.management.page.breach-alerts.enabled" = false; - "signon.rememberSignons" = false; + firefox = lib.mkIf devTools { + enable = true; + # firefox doesn't need the wrapper on the personal laptop + package = + if hmOnly + then (glintel pkgs.firefox-bin "firefox") + else pkgs.firefox-bin; + policies.DisableAppUpdate = true; + profiles = { + xdefault = { + isDefault = true; + settings = { + "app.update.auto" = false; + "browser.aboutConfig.showWarning" = false; + "browser.contentblocking.category" = "strict"; + "browser.urlbar.showSearchSuggestionsFirst" = false; + "layout.css.prefers-color-scheme.content-override" = 0; + "signon.management.page.breach-alerts.enabled" = false; + "signon.rememberSignons" = false; + }; + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + bitwarden + ublock-origin + consent-o-matic + joplin-web-clipper + multi-account-containers + ]; }; - extensions = with pkgs.nur.repos.rycee.firefox-addons; [ - bitwarden - ublock-origin - consent-o-matic - joplin-web-clipper - multi-account-containers - ]; }; }; - }; - neovim = lib.mkMerge [ - { - enable = true; - vimAlias = true; - vimdiffAlias = true; - defaultEditor = true; - plugins = with pkgs.vimPlugins; - lib.mkMerge [ - [fugitive] - (lib.mkIf devTools [ - vim-go - zig-vim - ]) - ]; - extraConfig = builtins.readFile ./vimrc; - } - (lib.mkIf devTools { - extraLuaConfig = - builtins.readFile - (pkgs.substituteAll { - src = ./dev.lua; - inherit (pkgs) gotools ripgrep; - }) - .outPath; - }) - ]; - - git = { - enable = true; - userEmail = email; - userName = "Motiejus Jakštys"; - aliases.yolo = "commit --amend --no-edit -a"; - extraConfig = { - rerere.enabled = true; - pull.ff = "only"; - merge.conflictstyle = "diff3"; - init.defaultBranch = "main"; - }; - }; - - gpg = { - enable = true; - mutableKeys = false; - mutableTrust = false; - publicKeys = [ + neovim = lib.mkMerge [ { - source = ./motiejus-gpg.txt; - trust = "ultimate"; + enable = true; + vimAlias = true; + vimdiffAlias = true; + defaultEditor = true; + plugins = with pkgs.vimPlugins; + lib.mkMerge [ + [fugitive] + (lib.mkIf devTools [ + vim-go + zig-vim + ]) + ]; + extraConfig = builtins.readFile ./vimrc; } + (lib.mkIf devTools { + extraLuaConfig = + builtins.readFile + (pkgs.substituteAll { + src = ./dev.lua; + inherit (pkgs) gotools ripgrep; + }) + .outPath; + }) ]; - }; - tmux = { - enable = true; - keyMode = "vi"; - historyLimit = 1000000; - extraConfig = '' - bind c new-window -c "#{pane_current_path}" - bind % split-window -h -c "#{pane_current_path}" - bind '"' split-window -v -c "#{pane_current_path}" - ''; - }; - }; + git = { + enable = true; + userEmail = email; + userName = "Motiejus Jakštys"; + aliases.yolo = "commit --amend --no-edit -a"; + extraConfig = { + rerere.enabled = true; + pull.ff = "only"; + merge.conflictstyle = "diff3"; + init.defaultBranch = "main"; + }; + }; + + gpg = { + enable = true; + mutableKeys = false; + mutableTrust = false; + publicKeys = [ + { + source = ./motiejus-gpg.txt; + trust = "ultimate"; + } + ]; + }; + + tmux = { + enable = true; + keyMode = "vi"; + historyLimit = 1000000; + extraConfig = '' + bind c new-window -c "#{pane_current_path}" + bind % split-window -h -c "#{pane_current_path}" + bind '"' split-window -v -c "#{pane_current_path}" + ''; + }; + } + ( + lib.mkIf (!hmOnly) + { + bash = { + enable = true; + shellAliases = { + "l" = "echo -n ł | xclip -selection clipboard"; + "gp" = "${pkgs.git}/bin/git remote | ${pkgs.parallel}/bin/parallel --verbose git push"; + }; + }; + } + ) + ]; }