From 6cf1be302f02f913f51654a63c07ac1b5d943c79 Mon Sep 17 00:00:00 2001 From: osbm Date: Wed, 5 Feb 2025 00:41:36 +0300 Subject: [PATCH] seperate out home config --- home/git.nix | 8 ++ home/home.nix | 21 ++++ home/ssh.nix | 36 +++++++ home/tmux/default.nix | 58 ++++++++++++ {modules => home/tmux}/wanikani-tmux.sh | 0 hosts/pochita/configuration.nix | 4 +- hosts/tartarus/configuration.nix | 4 +- hosts/ymir/configuration.nix | 4 +- modules/home.nix | 121 ------------------------ 9 files changed, 129 insertions(+), 127 deletions(-) create mode 100644 home/git.nix create mode 100644 home/home.nix create mode 100644 home/ssh.nix create mode 100644 home/tmux/default.nix rename {modules => home/tmux}/wanikani-tmux.sh (100%) delete mode 100644 modules/home.nix diff --git a/home/git.nix b/home/git.nix new file mode 100644 index 0000000..5fb1f89 --- /dev/null +++ b/home/git.nix @@ -0,0 +1,8 @@ +{pkgs, ...}: { + + programs.git = { + enable = true; + userEmail = "osmanfbayram@gmail.com"; + userName = "osbm"; + }; +} \ No newline at end of file diff --git a/home/home.nix b/home/home.nix new file mode 100644 index 0000000..72f1ca1 --- /dev/null +++ b/home/home.nix @@ -0,0 +1,21 @@ +{ + config, + pkgs, + ... +}: { + + imports = [ + ./tmux + ./git.nix + ./ssh.nix + ]; + + home.username = "osbm"; + home.homeDirectory = "/home/osbm"; + + home.packages = [ + # dont install packages here, just use normal nixpkgs + ]; + + home.stateVersion = config.system.stateVersion; +} diff --git a/home/ssh.nix b/home/ssh.nix new file mode 100644 index 0000000..739ec7e --- /dev/null +++ b/home/ssh.nix @@ -0,0 +1,36 @@ +{pkgs, ...}: { + programs.ssh = { + enable = true; + hashKnownHosts = true; + compression = true; + matchBlocks = { + "tartarus" = { + hostname = "192.168.0.4"; + user = "osbm"; + identityFile = "/home/osbm/.ssh/id_ed25519"; + # setEnv = { + # "TERM" = "xterm-256color"; + # }; + # extraOptions = { # [ERROR] - (starship::print): Under a 'dumb' terminal (TERM=dumb). + # "RemoteCommand" = "fish"; + # }; + }; + "ymir" = { + hostname = "192.168.0.2"; + user = "osbm"; + identityFile = "/home/osbm/.ssh/id_ed25519"; + # setEnv = { + # "TERM" = "xterm-256color"; + # }; + # extraOptions = { # TODO fix the damn starship error + # "RemoteCommand" = "fish"; + # }; + }; + "pochita" = { + hostname = "192.168.0.9"; + user = "osbm"; + identityFile = "/home/osbm/.ssh/id_ed25519"; + }; + }; + }; +} \ No newline at end of file diff --git a/home/tmux/default.nix b/home/tmux/default.nix new file mode 100644 index 0000000..98b11bc --- /dev/null +++ b/home/tmux/default.nix @@ -0,0 +1,58 @@ +{ + config, + pkgs, + ... +}: let + wanikani-script = builtins.path { + path = ./wanikani-tmux.sh; + }; + tmux-dracula = pkgs.tmuxPlugins.mkTmuxPlugin rec { + pluginName = "dracula"; + version = "3.0.0"; + src = pkgs.fetchFromGitHub { + owner = "dracula"; + repo = "tmux"; + rev = "v${version}"; + hash = "sha256-VY4PyaQRwTc6LWhPJg4inrQf5K8+bp0+eqRhR7+Iexk="; + }; + postInstall = '' + # i am adding my custom widget to the plugin here cp the wanikani.sh script to the plugin directory + cp ${wanikani-script} $target/scripts/wanikani.sh + ''; + meta = with pkgs.lib; { + homepage = "https://draculatheme.com/tmux"; + description = "Feature packed Dracula theme for tmux!"; + license = licenses.mit; + platforms = platforms.unix; + maintainers = with maintainers; [ethancedwards8]; + }; + }; +in { + programs.tmux = { + enable = true; + historyLimit = 100000; + baseIndex = 1; + shortcut = "s"; + mouse = true; + shell = "${pkgs.fish}/bin/fish"; + plugins = with pkgs; [ + tmuxPlugins.sensible + tmuxPlugins.better-mouse-mode + { + plugin = tmux-dracula; + extraConfig = '' + set -g @dracula-plugins "custom:wanikani.sh cpu-usage ram-usage gpu-usage battery time" + set -g @dracula-show-left-icon hostname + set -g @dracula-git-show-current-symbol ✓ + set -g @dracula-git-no-repo-message "no-git" + set -g @dracula-show-timezone false + set -g @dracula-ignore-lspci true + ''; + } + ]; + extraConfig = '' + # Automatically renumber windows + set -g renumber-windows on + ''; + }; +} \ No newline at end of file diff --git a/modules/wanikani-tmux.sh b/home/tmux/wanikani-tmux.sh similarity index 100% rename from modules/wanikani-tmux.sh rename to home/tmux/wanikani-tmux.sh diff --git a/hosts/pochita/configuration.nix b/hosts/pochita/configuration.nix index 68e017a..1731f0f 100644 --- a/hosts/pochita/configuration.nix +++ b/hosts/pochita/configuration.nix @@ -35,8 +35,8 @@ home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.osbm = import ../../modules/home.nix { - inherit config pkgs stateVersion; + home-manager.users.osbm = import ../../home/home.nix { + inherit config pkgs; }; environment.systemPackages = with pkgs; [ diff --git a/hosts/tartarus/configuration.nix b/hosts/tartarus/configuration.nix index f494332..ec600a1 100644 --- a/hosts/tartarus/configuration.nix +++ b/hosts/tartarus/configuration.nix @@ -21,8 +21,8 @@ home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.osbm = import ../../modules/home.nix { - inherit config pkgs stateVersion; + home-manager.users.osbm = import ../../home/home.nix { + inherit config pkgs; }; virtualisation.virtualbox.host.enable = true; diff --git a/hosts/ymir/configuration.nix b/hosts/ymir/configuration.nix index d10c3b5..e1ea4ac 100644 --- a/hosts/ymir/configuration.nix +++ b/hosts/ymir/configuration.nix @@ -31,8 +31,8 @@ home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.osbm = import ../../modules/home.nix { - inherit config pkgs stateVersion; + home-manager.users.osbm = import ../../home/home.nix { + inherit config pkgs; }; # Enable networking diff --git a/modules/home.nix b/modules/home.nix deleted file mode 100644 index 2767ee8..0000000 --- a/modules/home.nix +++ /dev/null @@ -1,121 +0,0 @@ -{ - config, - pkgs, - stateVersion, - ... -}: let - wanikani-script = builtins.path { - path = ./wanikani-tmux.sh; - }; - tmux-dracula = pkgs.tmuxPlugins.mkTmuxPlugin rec { - pluginName = "dracula"; - version = "3.0.0"; - src = pkgs.fetchFromGitHub { - owner = "dracula"; - repo = "tmux"; - rev = "v${version}"; - hash = "sha256-VY4PyaQRwTc6LWhPJg4inrQf5K8+bp0+eqRhR7+Iexk="; - }; - postInstall = '' - # i am adding my custom widget to the plugin here cp the wanikani.sh script to the plugin directory - cp ${wanikani-script} $target/scripts/wanikani.sh - ''; - meta = with pkgs.lib; { - homepage = "https://draculatheme.com/tmux"; - description = "Feature packed Dracula theme for tmux!"; - license = licenses.mit; - platforms = platforms.unix; - maintainers = with maintainers; [ethancedwards8]; - }; - }; -in { - # Home Manager needs a bit of information about you and the - # paths it should manage. - home.username = "osbm"; - home.homeDirectory = "/home/osbm"; - - # Packages that should be installed to the user profile. - home.packages = [ - ]; - - programs.git = { - enable = true; - userEmail = "osmanfbayram@gmail.com"; - userName = "osbm"; - }; - - programs.ssh = { - enable = true; - hashKnownHosts = true; - compression = true; - - matchBlocks = { - "tartarus" = { - hostname = "192.168.0.4"; - user = "osbm"; - identityFile = "/home/osbm/.ssh/id_ed25519"; - # setEnv = { - # "TERM" = "xterm-256color"; - # }; - # extraOptions = { # [ERROR] - (starship::print): Under a 'dumb' terminal (TERM=dumb). - # "RemoteCommand" = "fish"; - # }; - }; - "ymir" = { - hostname = "192.168.0.2"; - user = "osbm"; - identityFile = "/home/osbm/.ssh/id_ed25519"; - # setEnv = { - # "TERM" = "xterm-256color"; - # }; - # extraOptions = { # TODO fix the damn starship error - # "RemoteCommand" = "fish"; - # }; - }; - "pochita" = { - hostname = "192.168.0.9"; - user = "osbm"; - identityFile = "/home/osbm/.ssh/id_ed25519"; - }; - }; - }; - programs.tmux = { - enable = true; - historyLimit = 100000; - baseIndex = 1; - shortcut = "s"; - mouse = true; - shell = "${pkgs.fish}/bin/fish"; - plugins = with pkgs; [ - tmuxPlugins.sensible - tmuxPlugins.better-mouse-mode - { - plugin = tmux-dracula; - extraConfig = '' - set -g @dracula-plugins "custom:wanikani.sh cpu-usage ram-usage gpu-usage battery time" - set -g @dracula-show-left-icon hostname - set -g @dracula-git-show-current-symbol ✓ - set -g @dracula-git-no-repo-message "no-git" - set -g @dracula-show-timezone false - set -g @dracula-ignore-lspci true - ''; - } - ]; - extraConfig = '' - # Automatically renumber windows - set -g renumber-windows on - ''; - }; - # 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 - # incompatible changes. - # - # You can update Home Manager without changing this value. See - # the Home Manager release notes for a list of state version - # changes in each release. - home.stateVersion = stateVersion; - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; -}