From 4bb597c38a9ec2903cc0b9dcbf25be337b9cc36c Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Sat, 3 Aug 2024 18:40:48 -0700 Subject: [PATCH] refactor: migrate the rest of the configuration out of home-manager --- flake.nix | 4 +- home.nix | 186 ------------------------ modules/home-manager/common/core.nix | 163 +++++++++++++++++++++ modules/home-manager/linux/programs.nix | 26 ++++ 4 files changed, 192 insertions(+), 187 deletions(-) create mode 100644 modules/home-manager/common/core.nix create mode 100644 modules/home-manager/linux/programs.nix diff --git a/flake.nix b/flake.nix index 43dc570..9e02db9 100755 --- a/flake.nix +++ b/flake.nix @@ -48,7 +48,9 @@ imports = [ ./home.nix ./modules/home-manager/linux/desktop.nix - catppuccin.homeManagerModules.catppuccin + ./modules/home-manager/linux/programs.nix + ./modules/home-manager/common/core.nix + inputs.catppuccin.homeManagerModules.catppuccin ]; }; } diff --git a/home.nix b/home.nix index e6c1c54..d320401 100755 --- a/home.nix +++ b/home.nix @@ -81,192 +81,6 @@ libsForQt5.qt5ct ]; - programs.fzf = { - enable = true; - catppuccin.enable = true; - }; - - programs.git = { - enable = true; - userName = "Youwen Wu"; - userEmail = "youwenw@gmail.com"; - delta.enable = true; - extraConfig = { - init.defaultBranch = "main"; - commit.gpgsign = "true"; - user.signingkey = "8F5E6C1AF90976CA7102917A865658ED1FE61EC3"; - }; - }; - - programs.lazygit = { - enable = true; - catppuccin.enable = true; - catppuccin.flavor = "macchiato"; - settings = { - git.paging = { - colorArg = "always"; - pager = "delta --dark --paging=never"; - }; - }; - }; - - programs.bat.enable = true; - programs.bat.catppuccin = { - enable = true; - flavor = "macchiato"; - }; - - programs.ripgrep.enable = true; - - programs.kitty = { - enable = true; - theme = "Tokyo Night"; - font.name = "CaskaydiaCove Nerd Font"; - settings = { - font_size = 12; - window_padding_width = "8 8 0"; - confirm_os_window_close = -1; - shell_integration = "enabled"; - enable_audio_bell = "no"; - background_opacity = "0.8"; - }; - }; - - programs.readline = { - enable = true; - extraConfig = "set editing-mode vi"; - }; - - programs.zoxide = { - enable = true; - # enableZshIntegration = true; - enableFishIntegration = true; - enableNushellIntegration = true; - }; - - programs.gh = { - enable = true; - extensions = [ pkgs.github-copilot-cli ]; - }; - - programs.oh-my-posh = { - enable = true; - # enableZshIntegration = true; - enableFishIntegration = true; - enableBashIntegration = true; - useTheme = "gruvbox"; - }; - - programs.fish = { - enable = true; - catppuccin.enable = true; - catppuccin.flavor = "mocha"; - shellAliases = { - rebuild = "sudo nixos-rebuild switch"; - ls = "eza -l --icons=auto"; - }; - functions = { - update-nixos = { - description = - "Update the system flake and attempt to build and switch to the new configuration."; - body = '' - cd /etc/nixos - nix flake update - sudo nixos-rebuild switch - ''; - }; - }; - interactiveShellInit = '' - fish_vi_key_bindings - set -g fish_greeting - ''; - plugins = [ - { - name = "autopair"; - src = pkgs.fetchFromGitHub { - owner = "jorgebucaran"; - repo = "autopair.fish"; - rev = "4d1752ff5b39819ab58d7337c69220342e9de0e2"; - hash = "sha256-qt3t1iKRRNuiLWiVoiAYOu+9E7jsyECyIqZJ/oRIT1A="; - }; - } - { - name = "fzf"; - src = pkgs.fetchFromGitHub { - owner = "PatrickF1"; - repo = "fzf.fish"; - rev = "8920367cf85eee5218cc25a11e209d46e2591e7a"; - hash = "sha256-T8KYLA/r/gOKvAivKRoeqIwE2pINlxFQtZJHpOy9GMM="; - }; - } - { - name = "sponge"; - src = pkgs.fetchFromGitHub { - owner = "meaningful-ooo"; - repo = "sponge"; - rev = "384299545104d5256648cee9d8b117aaa9a6d7be"; - hash = "sha256-MdcZUDRtNJdiyo2l9o5ma7nAX84xEJbGFhAVhK+Zm1w="; - }; - } - { - name = "done"; - src = pkgs.fetchFromGitHub { - owner = "franciscolourenco"; - repo = "done"; - rev = "eb32ade85c0f2c68cbfcff3036756bbf27a4f366"; - hash = "sha256-DMIRKRAVOn7YEnuAtz4hIxrU93ULxNoQhW6juxCoh4o="; - }; - } - ]; - }; - - programs.nushell = { - enable = true; - configFile.text = '' - $env.config = { - edit_mode: vi, - show_banner: false - } - ''; - }; - - programs.fd.enable = true; - - programs.btop = { - enable = true; - settings = { - color_theme = "tokyo-night"; - vim_keys = true; - theme_background = false; - }; - }; - - programs.eza = { - enable = true; - enableFishIntegration = true; - enableBashIntegration = true; - }; - - programs.bash.enable = true; - - programs.librewolf = { - enable = true; - settings = { - "webgl.disabled" = false; - "privacy.resistFingerprinting" = false; - "privacy.clearOnShutdown.history" = false; - "privacy.clearOnShutdown.cookies" = false; - "network.cookie.lifetimePolicy" = 0; - }; - }; - - programs.neovim = { - enable = true; - defaultEditor = true; - viAlias = true; - vimAlias = true; - }; - # This value determines the home Manager release that your # configuration is compatible with. This helps avoid breakage # when a new home Manager release introduces backwards diff --git a/modules/home-manager/common/core.nix b/modules/home-manager/common/core.nix new file mode 100644 index 0000000..de1a43e --- /dev/null +++ b/modules/home-manager/common/core.nix @@ -0,0 +1,163 @@ +{ pkgs, ... }: +{ + programs.bash.enable = true; + programs.nushell = { + enable = true; + configFile.text = '' + $env.config = { + edit_mode: vi, + show_banner: false + } + ''; + }; + + programs.fzf = { + enable = true; + catppuccin.enable = true; + }; + + programs.git = { + enable = true; + userName = "Youwen Wu"; + userEmail = "youwenw@gmail.com"; + delta.enable = true; + extraConfig = { + init.defaultBranch = "main"; + commit.gpgsign = "true"; + user.signingkey = "8F5E6C1AF90976CA7102917A865658ED1FE61EC3"; + }; + }; + + programs.lazygit = { + enable = true; + catppuccin.enable = true; + catppuccin.flavor = "macchiato"; + settings = { + git.paging = { + colorArg = "always"; + pager = "delta --dark --paging=never"; + }; + }; + }; + + programs.bat.enable = true; + programs.bat.catppuccin = { + enable = true; + flavor = "macchiato"; + }; + + programs.ripgrep.enable = true; + + programs.readline = { + enable = true; + extraConfig = "set editing-mode vi"; + }; + + programs.zoxide = { + enable = true; + # enableZshIntegration = true; + enableFishIntegration = true; + enableNushellIntegration = true; + }; + + programs.gh = { + enable = true; + extensions = [ pkgs.github-copilot-cli ]; + }; + + programs.oh-my-posh = { + enable = true; + # enableZshIntegration = true; + enableFishIntegration = true; + enableBashIntegration = true; + useTheme = "gruvbox"; + }; + + programs.fish = { + enable = true; + catppuccin.enable = true; + catppuccin.flavor = "mocha"; + shellAliases = { + rebuild = "sudo nixos-rebuild switch"; + ls = "eza -l --icons=auto"; + }; + functions = { + update-nixos = { + description = + "Update the system flake and attempt to build and switch to the new configuration."; + body = '' + cd /etc/nixos + nix flake update + sudo nixos-rebuild switch + ''; + }; + }; + interactiveShellInit = '' + fish_vi_key_bindings + set -g fish_greeting + ''; + plugins = [ + { + name = "autopair"; + src = pkgs.fetchFromGitHub { + owner = "jorgebucaran"; + repo = "autopair.fish"; + rev = "4d1752ff5b39819ab58d7337c69220342e9de0e2"; + hash = "sha256-qt3t1iKRRNuiLWiVoiAYOu+9E7jsyECyIqZJ/oRIT1A="; + }; + } + { + name = "fzf"; + src = pkgs.fetchFromGitHub { + owner = "PatrickF1"; + repo = "fzf.fish"; + rev = "8920367cf85eee5218cc25a11e209d46e2591e7a"; + hash = "sha256-T8KYLA/r/gOKvAivKRoeqIwE2pINlxFQtZJHpOy9GMM="; + }; + } + { + name = "sponge"; + src = pkgs.fetchFromGitHub { + owner = "meaningful-ooo"; + repo = "sponge"; + rev = "384299545104d5256648cee9d8b117aaa9a6d7be"; + hash = "sha256-MdcZUDRtNJdiyo2l9o5ma7nAX84xEJbGFhAVhK+Zm1w="; + }; + } + { + name = "done"; + src = pkgs.fetchFromGitHub { + owner = "franciscolourenco"; + repo = "done"; + rev = "eb32ade85c0f2c68cbfcff3036756bbf27a4f366"; + hash = "sha256-DMIRKRAVOn7YEnuAtz4hIxrU93ULxNoQhW6juxCoh4o="; + }; + } + ]; + }; + + + programs.fd.enable = true; + + programs.btop = { + enable = true; + settings = { + color_theme = "tokyo-night"; + vim_keys = true; + theme_background = false; + }; + }; + + programs.eza = { + enable = true; + enableFishIntegration = true; + enableBashIntegration = true; + }; + + programs.neovim = { + enable = true; + defaultEditor = true; + viAlias = true; + vimAlias = true; + }; +} diff --git a/modules/home-manager/linux/programs.nix b/modules/home-manager/linux/programs.nix new file mode 100644 index 0000000..b2c8c9d --- /dev/null +++ b/modules/home-manager/linux/programs.nix @@ -0,0 +1,26 @@ +{ + programs.kitty = { + enable = true; + theme = "Tokyo Night"; + font.name = "CaskaydiaCove Nerd Font"; + settings = { + font_size = 12; + window_padding_width = "8 8 0"; + confirm_os_window_close = -1; + shell_integration = "enabled"; + enable_audio_bell = "no"; + background_opacity = "0.8"; + }; + }; + + programs.librewolf = { + enable = true; + settings = { + "webgl.disabled" = false; + "privacy.resistFingerprinting" = false; + "privacy.clearOnShutdown.history" = false; + "privacy.clearOnShutdown.cookies" = false; + "network.cookie.lifetimePolicy" = 0; + }; + }; +}