From 0a26d94f77064fa253251daf7c5eb1b884f93b1b Mon Sep 17 00:00:00 2001 From: Uttarayan Date: Wed, 5 Feb 2025 17:09:33 +0530 Subject: [PATCH] feat: restructure and move apps into their own configs (#2) --- common/home.nix | 440 ---------------------- {common => home}/auth.nix | 0 home/default.nix | 79 ++++ home/gui-programs/cursor.nix | 3 + home/gui-programs/default.nix | 16 + {common => home/gui-programs}/firefox.nix | 2 +- {common => home/gui-programs}/ghostty.nix | 0 {common => home/gui-programs}/kitty.nix | 2 +- home/gui-programs/vscodium.nix | 13 + {common => home/gui-programs}/wezterm.nix | 2 +- {linux => home/linux}/anyrun.nix | 0 {linux => home/linux}/default.nix | 14 +- {linux => home/linux}/device.nix | 0 {linux => home/linux}/foot.nix | 0 {linux => home/linux}/gtk.nix | 0 {linux => home/linux}/hyprland.nix | 5 +- {linux => home/linux}/ironbar/default.nix | 0 {linux => home/linux}/ironbar/ironbar.css | 0 {linux => home/linux}/mpd.nix | 0 home/programs/aichat.nix | 62 +++ home/programs/atuin.nix | 17 + home/programs/bat.nix | 19 + home/programs/carapace.nix | 13 + home/programs/default.nix | 94 +++++ home/programs/direnv.nix | 13 + home/programs/eza.nix | 14 + home/programs/fish.nix | 40 ++ home/programs/fzf.nix | 14 + home/programs/gh.nix | 11 + home/programs/git.nix | 33 ++ {common => home/programs}/goread.nix | 0 home/programs/helix.nix | 23 ++ {common => home/programs}/ncmpcpp.nix | 0 {common => home/programs}/neomutt.nix | 0 {common => home/programs}/newsboat.nix | 0 home/programs/nix-index.nix | 14 + home/programs/nushell.nix | 24 ++ {common => home/programs}/sops.nix | 2 +- home/programs/ssh.nix | 40 ++ home/programs/starship.nix | 31 ++ home/programs/template.nix | 9 + {common => home/programs}/tmux.nix | 0 {common => home/programs}/tuifeed.nix | 1 - home/programs/yazi.nix | 14 + {common => home/programs}/zellij.nix | 0 home/programs/zoxide.nix | 12 + home/scripts.nix | 30 ++ common/gui.nix => linux.nix | 22 +- macos/default.nix | 9 - macos/sketchybar.nix | 4 - modules/default.nix | 1 + nixos/default.nix | 2 +- 52 files changed, 662 insertions(+), 482 deletions(-) delete mode 100644 common/home.nix rename {common => home}/auth.nix (100%) create mode 100644 home/default.nix create mode 100644 home/gui-programs/cursor.nix create mode 100644 home/gui-programs/default.nix rename {common => home/gui-programs}/firefox.nix (98%) rename {common => home/gui-programs}/ghostty.nix (100%) rename {common => home/gui-programs}/kitty.nix (95%) create mode 100644 home/gui-programs/vscodium.nix rename {common => home/gui-programs}/wezterm.nix (97%) rename {linux => home/linux}/anyrun.nix (100%) rename {linux => home/linux}/default.nix (67%) rename {linux => home/linux}/device.nix (100%) rename {linux => home/linux}/foot.nix (100%) rename {linux => home/linux}/gtk.nix (100%) rename {linux => home/linux}/hyprland.nix (97%) rename {linux => home/linux}/ironbar/default.nix (100%) rename {linux => home/linux}/ironbar/ironbar.css (100%) rename {linux => home/linux}/mpd.nix (100%) create mode 100644 home/programs/aichat.nix create mode 100644 home/programs/atuin.nix create mode 100644 home/programs/bat.nix create mode 100644 home/programs/carapace.nix create mode 100644 home/programs/default.nix create mode 100644 home/programs/direnv.nix create mode 100644 home/programs/eza.nix create mode 100644 home/programs/fish.nix create mode 100644 home/programs/fzf.nix create mode 100644 home/programs/gh.nix create mode 100644 home/programs/git.nix rename {common => home/programs}/goread.nix (100%) create mode 100644 home/programs/helix.nix rename {common => home/programs}/ncmpcpp.nix (100%) rename {common => home/programs}/neomutt.nix (100%) rename {common => home/programs}/newsboat.nix (100%) create mode 100644 home/programs/nix-index.nix create mode 100644 home/programs/nushell.nix rename {common => home/programs}/sops.nix (85%) create mode 100644 home/programs/ssh.nix create mode 100644 home/programs/starship.nix create mode 100644 home/programs/template.nix rename {common => home/programs}/tmux.nix (100%) rename {common => home/programs}/tuifeed.nix (90%) create mode 100644 home/programs/yazi.nix rename {common => home/programs}/zellij.nix (100%) create mode 100644 home/programs/zoxide.nix create mode 100644 home/scripts.nix rename common/gui.nix => linux.nix (76%) delete mode 100644 macos/default.nix delete mode 100644 macos/sketchybar.nix diff --git a/common/home.nix b/common/home.nix deleted file mode 100644 index ce0ce0de..00000000 --- a/common/home.nix +++ /dev/null @@ -1,440 +0,0 @@ -{ - inputs, - config, - pkgs, - lib, - device, - ... -}: let - hotedit = pkgs.writeShellApplication { - name = "hotedit"; - # description = "Edit files from nix store by replacing them with a local copy"; - text = '' - if [ "$#" -eq 0 ]; then - echo "No arguments provided." - exit 1 - elif [ "$#" -gt 1 ]; then - echo "More than 1 argument provided." - exit 1 - fi - - - if [ -L "$1" ]; then - echo "The file is a symbolic link." - mv "$1" "$1.bak" - cp "$1.bak" "$1" - chmod +rw "$1" - else - echo "The file is not a symbolic link." - exit 1 - fi - exec $EDITOR "$1" - ''; - }; -in { - imports = - [ - inputs.nix-index-database.hmModules.nix-index - # ./wezterm.nix - # ./goread.nix - # ./zellij.nix - ../modules - ./auth.nix - ./gui.nix - ./kitty.nix - ./ncmpcpp.nix - ./sops.nix - ./tmux.nix - # ../neovim - ] - ++ lib.optionals device.isLinux [../linux] - # ++ lib.optionals.device.isMac [../macos] - # ++ lib.optionals device.isServer [../server]; - ; - - home.packages = with pkgs; - [ - (nixvim.makeNixvim (import ../neovim)) - _1password-cli - alejandra - ast-grep - bottom - btop - cachix - deploy-rs - dust - fd - file - fzf - gnupg - gpg-tui - hotedit - jq - just - macchina - p7zip - pandoc - pfetch-rs - pkg-config - ripgrep - sd - tldr - vcpkg-tool - yt-dlp - ] - ++ lib.optionals (!device.isServer) [ - clang - cmake - d2 - devenv - go - hasklig - jujutsu - monaspace - nerd-fonts.fira-code - nerd-fonts.hasklug - nerd-fonts.symbols-only - qmk - ttyper - yarn - zed-editor - ] - ++ lib.optionals device.isLinux [ - dig - gptfdisk - handlr-regex - handlr-xdg - lsof - ncpamixer - rr - sbctl - usbutils - ddcbacklight - ] - ++ lib.optionals device.isMac []; - - xdg.enable = true; - xdg.userDirs = { - enable = device.isLinux; - music = "${config.home.homeDirectory}/Nextcloud/Music"; - }; - - programs = { - ssh = { - enable = true; - matchBlocks = { - github = { - user = "git"; - host = "github.com"; - }; - deoxys = { - user = "servius"; - hostname = "deoxys"; - forwardAgent = true; - }; - mirai = { - user = "fs0c131y"; - hostname = "sh.darksailor.dev"; - forwardAgent = true; - }; - ryu = { - user = "servius"; - hostname = "ryu"; - forwardAgent = false; - }; - }; - serverAliveInterval = 120; - extraConfig = - lib.strings.optionalString pkgs.stdenv.isDarwin - '' - IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock" - '' - + lib.strings.optionalString (pkgs.stdenv.isLinux && !device.isServer) '' - IdentityAgent ~/.1password/agent.sock - ''; - }; - gh.enable = true; - gh-dash.enable = true; - atuin = { - settings = { - auto_sync = true; - sync_frequency = "1m"; - sync_address = "https://atuin.darksailor.dev"; - }; - enable = true; - enableFishIntegration = true; - enableNushellIntegration = true; - }; - direnv = { - enable = true; - # enableFishIntegration = true; // Auto enabled - enableNushellIntegration = true; - nix-direnv.enable = true; - }; - nix-index-database.comma.enable = true; - helix = { - enable = true; - settings = { - theme = "catppuccin_mocha"; - editor = { - line-number = "relative"; - lsp.display-messages = true; - }; - keys.normal = { - space.space = "file_picker"; - space.w = ":w"; - space.q = ":q"; - esc = ["collapse_selection" "keep_primary_selection"]; - }; - }; - }; - git = { - enable = true; - lfs.enable = true; - userName = "uttarayan21"; - userEmail = "email@uttarayan.me"; - extraConfig = { - color.ui = true; - core.editor = "nvim"; - core.pager = "${pkgs.delta}/bin/delta"; - interactive.diffFilter = "${pkgs.delta}/bin/delta --color-only"; - delta.navigate = true; - merge.conflictStyle = "diff3"; - diff.colorMoved = "default"; - push.autoSetupRemote = true; - user.signingkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJfKKrX8yeIHUUury0aPwMY6Ha+BJyUR7P0Gqid90ik/"; - gpg.format = "ssh"; - commit.gpgsign = true; - pull = { - rebase = true; - }; - "gpg \"ssh\"".program = - if pkgs.stdenv.isDarwin - then "/Applications/1Password.app/Contents/MacOS/op-ssh-sign" - else "${pkgs._1password-gui}/share/1password/op-ssh-sign"; - }; - }; - nix-index = { - enable = true; - enableFishIntegration = true; - }; - fish = { - enable = true; - shellAbbrs = { - vim = "nvim"; - vi = "nvim"; - nv = "neovide"; - g = "git"; - yy = "yazi"; - cd = "z"; - ls = "eza"; - cat = "bat"; - j = "just --choose"; - # t = "zellij a -c --index 0"; - t = "tmux"; - }; - shellAliases = - { - g = "git"; - } - // lib.optionalAttrs pkgs.stdenv.isLinux { - kmpv = "mpv --vo-kitty-use-shm=yes --vo=kitty --really-quiet"; - smpv = "mpv --vo-sixel-buffered=yes --vo=sixel --profile=sw-fast"; - }; - shellInit = '' - set fish_greeting - yes | fish_config theme save "Catppuccin Mocha" - ''; - # ${pkgs.spotify-player}/bin/spotify_player generate fish | source - interactiveShellInit = '' - ${pkgs.pfetch-rs}/bin/pfetch - ${lib.optionalString (device.isLinux && !device.isNix) "source /etc/profile.d/nix-daemon.fish"} - ''; - }; - - nushell = { - enable = true; - shellAliases = { - cd = "z"; - yy = "yazi"; - cat = "bat"; - }; - extraConfig = '' - ${pkgs.pfetch-rs}/bin/pfetch - ''; - package = pkgs.nushell; - configFile.text = '' - $env.config = { - show_banner: false, - } - ''; - }; - zoxide = { - enable = true; - enableFishIntegration = true; - enableNushellIntegration = true; - }; - starship = { - enable = true; - enableFishIntegration = true; - enableNushellIntegration = true; - settings = let - flavour = "mocha"; # Replace with your preferred palette - in - { - # Check https://starship.rs/config/#prompt - format = "$all$character"; - palette = "catppuccin_${flavour}"; - character = { - success_symbol = "[[OK](bold green) ❯](maroon)"; - error_symbol = "[❯](red)"; - vimcmd_symbol = "[❮](green)"; - }; - directory = { - truncation_length = 4; - style = "bold lavender"; - }; - } - // builtins.fromTOML (builtins.readFile - (pkgs.catppuccinThemes.starship + /palettes/${flavour}.toml)); - }; - eza = { - enable = true; - # enableAliases = true; - git = true; - icons = "auto"; - }; - # carapace = { - # # enable = true; - # # enableFishIntegration = true; - # enableNushellIntegration = true; - # }; - fzf = { - enable = true; - package = pkgs.fzf; - enableFishIntegration = true; - tmux.enableShellIntegration = true; - }; - yazi = { - enable = true; - enableFishIntegration = true; - enableNushellIntegration = true; - theme = builtins.fromTOML (builtins.readFile "${pkgs.catppuccinThemes.yazi}/themes/mocha.toml"); - }; - bat = { - enable = true; - config = {theme = "catppuccin";}; - themes = { - catppuccin = { - src = "${pkgs.catppuccinThemes.bat}/themes"; - file = "Catppuccin Mocha.tmTheme"; - }; - }; - # extraPackages = with pkgs.bat-extras; [batman batgrep batwatch]; - }; - - home-manager = {enable = true;}; - aichat = { - enable = true; - enableFishIntegration = true; - enableNushellIntegration = false; - settings = { - save_session = true; - model = "openai:gpt-4o"; - rag_embedding_model = "ollama:RobinBially/nomic-embed-text-8k"; - clients = [ - { - type = "openai-compatible"; - name = "llama"; - api_base = "https://llama.darksailor.dev/api/v1"; - api_key_cmd = "cat ${config.sops.secrets."llama/api_key".path}"; - models = [ - { - name = "qwen_2_5_1"; - } - ]; - } - { - type = "openai-compatible"; - name = "ollama"; - api_base = "https://llama.darksailor.dev/api/ollama/v1"; - api_key_cmd = "cat ${config.sops.secrets."llama/api_key".path}"; - models = [ - { - name = "RobinBially/nomic-embed-text-8k"; - type = "embedding"; - default_chunk_size = 8000; - } - { - name = "mistral"; - } - ]; - } - { - type = "openai"; - name = "openai"; - api_base = "https://api.openai.com/v1"; - api_key_cmd = "cat ${config.sops.secrets."openai/api_key".path}"; - models = [ - { - name = "gpt-3.5-turbo"; - } - { - name = "gpt-4o"; - } - ]; - } - ]; - }; - }; - }; - - fonts.fontconfig.enable = true; - - home = { - username = device.user; - homeDirectory = - if device.isMac - then lib.mkForce "/Users/${device.user}" - else lib.mkForce "/home/${device.user}"; - - stateVersion = "23.11"; - - file = { - ".config/fish/themes".source = pkgs.catppuccinThemes.fish + "/themes"; - ".cargo/config.toml".text = - /* - toml - */ - '' - [alias] - lldb = ["with", "rust-lldb", "--"] - t = ["nextest", "run"] - - [net] - git-fetch-with-cli = true - - # [target.aarch64-apple-darwin] - # linker = "clang" - # rustflags = ["-C", "link-arg=-fuse-ld=${pkgs.mold}/bin/mold"] - - [registries.catscii] - index = "https://git.shipyard.rs/catscii/crate-index.git" - - [http] - user-agent = "shipyard J0/QFq2Sa5y6nTxJQAb8t+e/3qLSub1/sa3zn0leZv6LKG/zmQcoikT9U3xPwbzp8hQ=" - ''; - }; - - sessionVariables = { - EDITOR = "nvim"; - SHELL = "${pkgs.fish}/bin/fish"; - CARGO_TARGET_DIR = "${config.xdg.cacheHome}/cargo/target"; - BROWSER = - if device.isMac - then "open" - else "xdg-open"; - }; - sessionPath = ["${config.home.homeDirectory}/.cargo/bin"]; - }; -} diff --git a/common/auth.nix b/home/auth.nix similarity index 100% rename from common/auth.nix rename to home/auth.nix diff --git a/home/default.nix b/home/default.nix new file mode 100644 index 00000000..2988cf71 --- /dev/null +++ b/home/default.nix @@ -0,0 +1,79 @@ +{ + inputs, + config, + pkgs, + lib, + device, + ... +}: { + imports = + [ + inputs.nix-index-database.hmModules.nix-index + ../modules + ./auth.nix + ./gui-programs + ./programs + ./scripts.nix + ] + ++ lib.optionals device.isLinux [./linux]; + # ++ lib.optionals.device.isMac [./macos]; + + xdg.enable = true; + xdg.userDirs = { + enable = device.isLinux; + music = "${config.home.homeDirectory}/Nextcloud/Music"; + }; + + programs = { + home-manager = {enable = true;}; + }; + + fonts.fontconfig.enable = true; + + home = { + username = device.user; + homeDirectory = + if device.isMac + then lib.mkForce "/Users/${device.user}" + else lib.mkForce "/home/${device.user}"; + + file = { + ".config/fish/themes".source = pkgs.catppuccinThemes.fish + "/themes"; + ".cargo/config.toml".text = + /* + toml + */ + '' + [alias] + lldb = ["with", "rust-lldb", "--"] + t = ["nextest", "run"] + + [net] + git-fetch-with-cli = true + + # [target.aarch64-apple-darwin] + # linker = "clang" + # rustflags = ["-C", "link-arg=-fuse-ld=${pkgs.mold}/bin/mold"] + + [registries.catscii] + index = "https://git.shipyard.rs/catscii/crate-index.git" + + [http] + user-agent = "shipyard J0/QFq2Sa5y6nTxJQAb8t+e/3qLSub1/sa3zn0leZv6LKG/zmQcoikT9U3xPwbzp8hQ=" + ''; + }; + + sessionVariables = { + EDITOR = "nvim"; + SHELL = "${pkgs.bash}/bin/bash"; + CARGO_TARGET_DIR = "${config.xdg.cacheHome}/cargo/target"; + BROWSER = + if device.isMac + then "open" + else "xdg-open"; + }; + sessionPath = ["${config.home.homeDirectory}/.cargo/bin"]; + + stateVersion = "23.11"; + }; +} diff --git a/home/gui-programs/cursor.nix b/home/gui-programs/cursor.nix new file mode 100644 index 00000000..1c8b75b7 --- /dev/null +++ b/home/gui-programs/cursor.nix @@ -0,0 +1,3 @@ +{pkgs, ...}: { + home.packages = [pkgs.code-cursor]; +} diff --git a/home/gui-programs/default.nix b/home/gui-programs/default.nix new file mode 100644 index 00000000..e5e43785 --- /dev/null +++ b/home/gui-programs/default.nix @@ -0,0 +1,16 @@ +{ + lib, + device, + ... +}: { + imports = + [] + ++ (lib.optionals device.hasGui [ + ./cursor.nix + ./firefox.nix + ./ghostty.nix + ./kitty.nix + ./vscodium.nix + ./wezterm.nix + ]); +} diff --git a/common/firefox.nix b/home/gui-programs/firefox.nix similarity index 98% rename from common/firefox.nix rename to home/gui-programs/firefox.nix index 33b858bc..5ddf29c7 100644 --- a/common/firefox.nix +++ b/home/gui-programs/firefox.nix @@ -4,7 +4,7 @@ ... }: { programs.firefox = { - enable = device.hasGui; + enable = pkgs.stdenv.isLinux; profiles.default = { # userChrome = # /* diff --git a/common/ghostty.nix b/home/gui-programs/ghostty.nix similarity index 100% rename from common/ghostty.nix rename to home/gui-programs/ghostty.nix diff --git a/common/kitty.nix b/home/gui-programs/kitty.nix similarity index 95% rename from common/kitty.nix rename to home/gui-programs/kitty.nix index 46fb714d..2e3b2dad 100644 --- a/common/kitty.nix +++ b/home/gui-programs/kitty.nix @@ -5,7 +5,7 @@ ... }: { programs.kitty = { - enable = device.hasGui; + enable = true; # enable = false; font = { # name = "FiraCode Nerd Font Mono"; diff --git a/home/gui-programs/vscodium.nix b/home/gui-programs/vscodium.nix new file mode 100644 index 00000000..9ef30655 --- /dev/null +++ b/home/gui-programs/vscodium.nix @@ -0,0 +1,13 @@ +{pkgs, ...}: { + programs = { + # Only for checking markdown previews + vscode = { + enable = true; + package = pkgs.vscodium; + extensions = with pkgs.vscode-extensions; [ + shd101wyy.markdown-preview-enhanced + asvetliakov.vscode-neovim + ]; + }; + }; +} diff --git a/common/wezterm.nix b/home/gui-programs/wezterm.nix similarity index 97% rename from common/wezterm.nix rename to home/gui-programs/wezterm.nix index ad9ff941..c35e5838 100644 --- a/common/wezterm.nix +++ b/home/gui-programs/wezterm.nix @@ -4,7 +4,7 @@ ... }: { programs.wezterm = { - enable = device.hasGui; + enable = true; extraConfig = /* lua diff --git a/linux/anyrun.nix b/home/linux/anyrun.nix similarity index 100% rename from linux/anyrun.nix rename to home/linux/anyrun.nix diff --git a/linux/default.nix b/home/linux/default.nix similarity index 67% rename from linux/default.nix rename to home/linux/default.nix index 8f11e7d1..80022071 100644 --- a/linux/default.nix +++ b/home/linux/default.nix @@ -1,5 +1,4 @@ { - pkgs, lib, device, ... @@ -7,13 +6,12 @@ imports = [] ++ (lib.optionals device.hasGui [ - ../common/firefox.nix - ../linux/hyprland.nix - ../linux/gtk.nix - ../linux/anyrun.nix - ../linux/ironbar - ../linux/foot.nix - ../linux/mpd.nix + ./hyprland.nix + ./gtk.nix + ./anyrun.nix + ./ironbar + ./foot.nix + ./mpd.nix ]); services.kdeconnect.enable = device.hasGui; diff --git a/linux/device.nix b/home/linux/device.nix similarity index 100% rename from linux/device.nix rename to home/linux/device.nix diff --git a/linux/foot.nix b/home/linux/foot.nix similarity index 100% rename from linux/foot.nix rename to home/linux/foot.nix diff --git a/linux/gtk.nix b/home/linux/gtk.nix similarity index 100% rename from linux/gtk.nix rename to home/linux/gtk.nix diff --git a/linux/hyprland.nix b/home/linux/hyprland.nix similarity index 97% rename from linux/hyprland.nix rename to home/linux/hyprland.nix index 87aac652..b6cf2628 100644 --- a/linux/hyprland.nix +++ b/home/linux/hyprland.nix @@ -4,11 +4,11 @@ ... }: { imports = [ - ../modules/hyprpaper.nix + ../../modules/hyprpaper.nix ]; programs.hyprpaper = let - wallpapers = import ../utils/wallhaven.nix {inherit pkgs;}; + wallpapers = import ../../utils/wallhaven.nix {inherit pkgs;}; in { enable = device.hasGui; # enable = true; @@ -157,6 +157,7 @@ "$mainMod, Return, exec, ${pkgs.kitty}/bin/kitty" "$mainModShift, Return, exec, ${pkgs.foot}/bin/foot" "$mainModShift, Q, killactive," + "$mainModShift, s, exec, ${pkgs.hyprshot}/bin/hyprshot -m region" # "$mainMod, M, exit," "$mainMod, t, togglefloating," "$mainMod, f, fullscreen," diff --git a/linux/ironbar/default.nix b/home/linux/ironbar/default.nix similarity index 100% rename from linux/ironbar/default.nix rename to home/linux/ironbar/default.nix diff --git a/linux/ironbar/ironbar.css b/home/linux/ironbar/ironbar.css similarity index 100% rename from linux/ironbar/ironbar.css rename to home/linux/ironbar/ironbar.css diff --git a/linux/mpd.nix b/home/linux/mpd.nix similarity index 100% rename from linux/mpd.nix rename to home/linux/mpd.nix diff --git a/home/programs/aichat.nix b/home/programs/aichat.nix new file mode 100644 index 00000000..9d979351 --- /dev/null +++ b/home/programs/aichat.nix @@ -0,0 +1,62 @@ +{ + pkgs, + lib, + device, + config, + ... +}: { + programs. + aichat = { + enable = true; + enableFishIntegration = true; + enableNushellIntegration = false; + settings = { + save_session = true; + model = "openai:gpt-4o"; + rag_embedding_model = "ollama:RobinBially/nomic-embed-text-8k"; + clients = [ + { + type = "openai-compatible"; + name = "llama"; + api_base = "https://llama.darksailor.dev/api/v1"; + api_key_cmd = "cat ${config.sops.secrets."llama/api_key".path}"; + models = [ + { + name = "qwen_2_5_1"; + } + ]; + } + { + type = "openai-compatible"; + name = "ollama"; + api_base = "https://llama.darksailor.dev/api/ollama/v1"; + api_key_cmd = "cat ${config.sops.secrets."llama/api_key".path}"; + models = [ + { + name = "RobinBially/nomic-embed-text-8k"; + type = "embedding"; + default_chunk_size = 8000; + } + { + name = "mistral"; + } + ]; + } + { + type = "openai"; + name = "openai"; + api_base = "https://api.openai.com/v1"; + api_key_cmd = "cat ${config.sops.secrets."openai/api_key".path}"; + models = [ + { + name = "gpt-3.5-turbo"; + } + { + name = "gpt-4o"; + } + ]; + } + ]; + }; + }; +} diff --git a/home/programs/atuin.nix b/home/programs/atuin.nix new file mode 100644 index 00000000..1194d4df --- /dev/null +++ b/home/programs/atuin.nix @@ -0,0 +1,17 @@ +{ + pkgs, + lib, + device, + ... +}: { + programs.atuin = { + settings = { + auto_sync = true; + sync_frequency = "1m"; + sync_address = "https://atuin.darksailor.dev"; + }; + enable = true; + enableFishIntegration = true; + enableNushellIntegration = true; + }; +} diff --git a/home/programs/bat.nix b/home/programs/bat.nix new file mode 100644 index 00000000..8674df67 --- /dev/null +++ b/home/programs/bat.nix @@ -0,0 +1,19 @@ +{ + pkgs, + lib, + device, + ... +}: { + programs. + bat = { + enable = true; + config = {theme = "catppuccin";}; + themes = { + catppuccin = { + src = "${pkgs.catppuccinThemes.bat}/themes"; + file = "Catppuccin Mocha.tmTheme"; + }; + }; + # extraPackages = with pkgs.bat-extras; [batman batgrep batwatch]; + }; +} diff --git a/home/programs/carapace.nix b/home/programs/carapace.nix new file mode 100644 index 00000000..484207c4 --- /dev/null +++ b/home/programs/carapace.nix @@ -0,0 +1,13 @@ +{ + pkgs, + lib, + device, + ... +}: { + programs. + carapace = { + enable = false; + enableFishIntegration = true; + enableNushellIntegration = true; + }; +} diff --git a/home/programs/default.nix b/home/programs/default.nix new file mode 100644 index 00000000..7aab6a36 --- /dev/null +++ b/home/programs/default.nix @@ -0,0 +1,94 @@ +{ + pkgs, + device, + ... +}: { + imports = [ + ../../modules + ./aichat.nix + ./atuin.nix + ./bat.nix + ./carapace.nix + ./direnv.nix + ./eza.nix + ./fish.nix + ./fzf.nix + ./gh.nix + ./git.nix + ./goread.nix + ./helix.nix + ./ncmpcpp.nix + ./neomutt.nix + ./newsboat.nix + ./nix-index.nix + ./nushell.nix + ./sops.nix + ./ssh.nix + ./starship.nix + ./tmux.nix + ./tuifeed.nix + ./yazi.nix + ./zellij.nix + ./zoxide.nix + #./template.nix + ]; + home.packages = with pkgs; + [ + (nixvim.makeNixvim (import ../../neovim)) + _1password-cli + alejandra + ast-grep + bottom + btop + cachix + deploy-rs + dust + fd + file + fzf + gnupg + gpg-tui + jq + just + macchina + p7zip + pandoc + pfetch-rs + pkg-config + ripgrep + sd + tldr + vcpkg-tool + yt-dlp + ] + ++ lib.optionals (!device.isServer) [ + clang + cmake + d2 + devenv + go + hasklig + jujutsu + monaspace + nerd-fonts.fira-code + nerd-fonts.hasklug + nerd-fonts.symbols-only + qmk + ttyper + yarn + zed-editor + ] + ++ lib.optionals device.isLinux [ + dig + gptfdisk + handlr-regex + handlr-xdg + lsof + ncpamixer + rr + sbctl + usbutils + ddcbacklight + ] + ++ lib.optionals device.isMac []; +} diff --git a/home/programs/direnv.nix b/home/programs/direnv.nix new file mode 100644 index 00000000..94abf2e3 --- /dev/null +++ b/home/programs/direnv.nix @@ -0,0 +1,13 @@ +{ + pkgs, + lib, + device, + ... +}: { + programs.direnv = { + enable = true; + # enableFishIntegration = lib.mkForce true; # Auto enabled + enableNushellIntegration = true; + nix-direnv.enable = true; + }; +} diff --git a/home/programs/eza.nix b/home/programs/eza.nix new file mode 100644 index 00000000..d9e8a02e --- /dev/null +++ b/home/programs/eza.nix @@ -0,0 +1,14 @@ +{ + pkgs, + lib, + device, + ... +}: { + programs. + eza = { + enable = true; + # enableAliases = true; + git = true; + icons = "auto"; + }; +} diff --git a/home/programs/fish.nix b/home/programs/fish.nix new file mode 100644 index 00000000..85b33c9f --- /dev/null +++ b/home/programs/fish.nix @@ -0,0 +1,40 @@ +{ + pkgs, + lib, + device, + ... +}: { + programs.fish = { + enable = true; + shellAbbrs = { + vim = "nvim"; + vi = "nvim"; + nv = "neovide"; + g = "git"; + yy = "yazi"; + cd = "z"; + ls = "eza"; + cat = "bat"; + j = "just --choose"; + # t = "zellij a -c --index 0"; + t = "tmux"; + }; + shellAliases = + { + g = "git"; + } + // lib.optionalAttrs pkgs.stdenv.isLinux { + kmpv = "mpv --vo-kitty-use-shm=yes --vo=kitty --really-quiet"; + smpv = "mpv --vo-sixel-buffered=yes --vo=sixel --profile=sw-fast"; + }; + shellInit = '' + set fish_greeting + yes | fish_config theme save "Catppuccin Mocha" + ''; + # ${pkgs.spotify-player}/bin/spotify_player generate fish | source + interactiveShellInit = '' + ${pkgs.pfetch-rs}/bin/pfetch + ${lib.optionalString (device.isLinux && !device.isNix) "source /etc/profile.d/nix-daemon.fish"} + ''; + }; +} diff --git a/home/programs/fzf.nix b/home/programs/fzf.nix new file mode 100644 index 00000000..5810ae5a --- /dev/null +++ b/home/programs/fzf.nix @@ -0,0 +1,14 @@ +{ + pkgs, + lib, + device, + ... +}: { + programs. + fzf = { + enable = true; + package = pkgs.fzf; + enableFishIntegration = true; + tmux.enableShellIntegration = true; + }; +} diff --git a/home/programs/gh.nix b/home/programs/gh.nix new file mode 100644 index 00000000..fe90b607 --- /dev/null +++ b/home/programs/gh.nix @@ -0,0 +1,11 @@ +{ + pkgs, + lib, + device, + ... +}: { + programs = { + gh.enable = true; + gh-dash.enable = true; + }; +} diff --git a/home/programs/git.nix b/home/programs/git.nix new file mode 100644 index 00000000..697bdf63 --- /dev/null +++ b/home/programs/git.nix @@ -0,0 +1,33 @@ +{ + pkgs, + lib, + device, + ... +}: { + programs.git = { + enable = true; + lfs.enable = true; + userName = "uttarayan21"; + userEmail = "email@uttarayan.me"; + extraConfig = { + color.ui = true; + core.editor = "nvim"; + core.pager = "${pkgs.delta}/bin/delta"; + interactive.diffFilter = "${pkgs.delta}/bin/delta --color-only"; + delta.navigate = true; + merge.conflictStyle = "diff3"; + diff.colorMoved = "default"; + push.autoSetupRemote = true; + user.signingkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJfKKrX8yeIHUUury0aPwMY6Ha+BJyUR7P0Gqid90ik/"; + gpg.format = "ssh"; + commit.gpgsign = true; + pull = { + rebase = true; + }; + "gpg \"ssh\"".program = + if pkgs.stdenv.isDarwin + then "/Applications/1Password.app/Contents/MacOS/op-ssh-sign" + else "${pkgs._1password-gui}/share/1password/op-ssh-sign"; + }; + }; +} diff --git a/common/goread.nix b/home/programs/goread.nix similarity index 100% rename from common/goread.nix rename to home/programs/goread.nix diff --git a/home/programs/helix.nix b/home/programs/helix.nix new file mode 100644 index 00000000..78299d2a --- /dev/null +++ b/home/programs/helix.nix @@ -0,0 +1,23 @@ +{ + pkgs, + lib, + device, + ... +}: { + programs.helix = { + enable = true; + settings = { + theme = "catppuccin_mocha"; + editor = { + line-number = "relative"; + lsp.display-messages = true; + }; + keys.normal = { + space.space = "file_picker"; + space.w = ":w"; + space.q = ":q"; + esc = ["collapse_selection" "keep_primary_selection"]; + }; + }; + }; +} diff --git a/common/ncmpcpp.nix b/home/programs/ncmpcpp.nix similarity index 100% rename from common/ncmpcpp.nix rename to home/programs/ncmpcpp.nix diff --git a/common/neomutt.nix b/home/programs/neomutt.nix similarity index 100% rename from common/neomutt.nix rename to home/programs/neomutt.nix diff --git a/common/newsboat.nix b/home/programs/newsboat.nix similarity index 100% rename from common/newsboat.nix rename to home/programs/newsboat.nix diff --git a/home/programs/nix-index.nix b/home/programs/nix-index.nix new file mode 100644 index 00000000..af51a724 --- /dev/null +++ b/home/programs/nix-index.nix @@ -0,0 +1,14 @@ +{ + pkgs, + lib, + device, + ... +}: { + programs = { + nix-index-database.comma.enable = true; + nix-index = { + enable = true; + enableFishIntegration = true; + }; + }; +} diff --git a/home/programs/nushell.nix b/home/programs/nushell.nix new file mode 100644 index 00000000..bdbcf6f8 --- /dev/null +++ b/home/programs/nushell.nix @@ -0,0 +1,24 @@ +{ + pkgs, + lib, + device, + ... +}: { + programs.nushell = { + enable = true; + shellAliases = { + cd = "z"; + yy = "yazi"; + cat = "bat"; + }; + extraConfig = '' + ${pkgs.pfetch-rs}/bin/pfetch + ''; + package = pkgs.nushell; + configFile.text = '' + $env.config = { + show_banner: false, + } + ''; + }; +} diff --git a/common/sops.nix b/home/programs/sops.nix similarity index 85% rename from common/sops.nix rename to home/programs/sops.nix index 2c4f4fd7..efc8feaa 100644 --- a/common/sops.nix +++ b/home/programs/sops.nix @@ -8,7 +8,7 @@ inputs.sops-nix.homeManagerModules.sops ]; sops = { - defaultSopsFile = ../secrets/secrets.yaml; + defaultSopsFile = ../../secrets/secrets.yaml; defaultSopsFormat = "yaml"; age.keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt"; secrets."llama/api_key" = {}; diff --git a/home/programs/ssh.nix b/home/programs/ssh.nix new file mode 100644 index 00000000..0dfcc9b9 --- /dev/null +++ b/home/programs/ssh.nix @@ -0,0 +1,40 @@ +{ + pkgs, + lib, + device, + ... +}: { + programs.ssh = { + enable = true; + matchBlocks = { + github = { + user = "git"; + host = "github.com"; + }; + deoxys = { + user = "servius"; + hostname = "deoxys"; + forwardAgent = true; + }; + mirai = { + user = "fs0c131y"; + hostname = "sh.darksailor.dev"; + forwardAgent = true; + }; + ryu = { + user = "servius"; + hostname = "ryu"; + forwardAgent = false; + }; + }; + serverAliveInterval = 120; + extraConfig = + lib.strings.optionalString pkgs.stdenv.isDarwin + '' + IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock" + '' + + lib.strings.optionalString (pkgs.stdenv.isLinux && !device.isServer) '' + IdentityAgent ~/.1password/agent.sock + ''; + }; +} diff --git a/home/programs/starship.nix b/home/programs/starship.nix new file mode 100644 index 00000000..bf487ece --- /dev/null +++ b/home/programs/starship.nix @@ -0,0 +1,31 @@ +{ + pkgs, + lib, + device, + ... +}: { + programs.starship = { + enable = true; + enableFishIntegration = true; + enableNushellIntegration = true; + settings = let + flavour = "mocha"; # Replace with your preferred palette + in + { + # Check https://starship.rs/config/#prompt + format = "$all$character"; + palette = "catppuccin_${flavour}"; + character = { + success_symbol = "[[OK](bold green) ❯](maroon)"; + error_symbol = "[❯](red)"; + vimcmd_symbol = "[❮](green)"; + }; + directory = { + truncation_length = 4; + style = "bold lavender"; + }; + } + // builtins.fromTOML (builtins.readFile + (pkgs.catppuccinThemes.starship + /palettes/${flavour}.toml)); + }; +} diff --git a/home/programs/template.nix b/home/programs/template.nix new file mode 100644 index 00000000..1d7de9a1 --- /dev/null +++ b/home/programs/template.nix @@ -0,0 +1,9 @@ +{ + pkgs, + lib, + device, + ... +}: { + programs = { + }; +} diff --git a/common/tmux.nix b/home/programs/tmux.nix similarity index 100% rename from common/tmux.nix rename to home/programs/tmux.nix diff --git a/common/tuifeed.nix b/home/programs/tuifeed.nix similarity index 90% rename from common/tuifeed.nix rename to home/programs/tuifeed.nix index 3e111075..eaec76c9 100644 --- a/common/tuifeed.nix +++ b/home/programs/tuifeed.nix @@ -1,5 +1,4 @@ {...}: { - imports = [../modules/tuifeed.nix]; programs.tuifeed = { enable = false; config = { diff --git a/home/programs/yazi.nix b/home/programs/yazi.nix new file mode 100644 index 00000000..72a56a5c --- /dev/null +++ b/home/programs/yazi.nix @@ -0,0 +1,14 @@ +{ + pkgs, + lib, + device, + ... +}: { + programs. + yazi = { + enable = true; + enableFishIntegration = true; + enableNushellIntegration = true; + theme = builtins.fromTOML (builtins.readFile "${pkgs.catppuccinThemes.yazi}/themes/mocha.toml"); + }; +} diff --git a/common/zellij.nix b/home/programs/zellij.nix similarity index 100% rename from common/zellij.nix rename to home/programs/zellij.nix diff --git a/home/programs/zoxide.nix b/home/programs/zoxide.nix new file mode 100644 index 00000000..37fcb556 --- /dev/null +++ b/home/programs/zoxide.nix @@ -0,0 +1,12 @@ +{ + pkgs, + lib, + device, + ... +}: { + programs.zoxide = { + enable = true; + enableFishIntegration = true; + enableNushellIntegration = true; + }; +} diff --git a/home/scripts.nix b/home/scripts.nix new file mode 100644 index 00000000..12230e9b --- /dev/null +++ b/home/scripts.nix @@ -0,0 +1,30 @@ +{pkgs, ...}: { + home.packages = [ + (pkgs.writeShellApplication + { + name = "hotedit"; + # description = "Edit files from nix store by replacing them with a local copy"; + text = '' + if [ "$#" -eq 0 ]; then + echo "No arguments provided." + exit 1 + elif [ "$#" -gt 1 ]; then + echo "More than 1 argument provided." + exit 1 + fi + + + if [ -L "$1" ]; then + echo "The file is a symbolic link." + mv "$1" "$1.bak" + cp "$1.bak" "$1" + chmod +rw "$1" + else + echo "The file is not a symbolic link." + exit 1 + fi + exec $EDITOR "$1" + ''; + }) + ]; +} diff --git a/common/gui.nix b/linux.nix similarity index 76% rename from common/gui.nix rename to linux.nix index f0883a57..712f93d5 100644 --- a/common/gui.nix +++ b/linux.nix @@ -20,23 +20,18 @@ lib.attrsets.optionalAttrs device.hasGui { WantedBy = ["graphical-session.target"]; }; }; - imports = [./kitty.nix ./ghostty.nix]; + imports = [ + ./kitty.nix + ./firefox.nix + ./ghostty.nix + ./cursor.nix + ./vscodium.nix + ./wezterm.nix + ]; - programs = { - # Only for checking markdown previews - vscode = { - enable = true; - package = pkgs.vscodium; - extensions = with pkgs.vscode-extensions; [ - shd101wyy.markdown-preview-enhanced - asvetliakov.vscode-neovim - ]; - }; - }; home.packages = with pkgs; [] ++ lib.optionals pkgs.stdenv.isLinux [ - ghostty discord (mpv-unwrapped.wrapper {mpv = mpv-unwrapped.override {sixelSupport = true;};}) abaddon @@ -59,6 +54,7 @@ lib.attrsets.optionalAttrs device.hasGui { steam-run via wl-clipboard + zed-editor ] ++ lib.optionals pkgs.stdenv.isDarwin [ ]; diff --git a/macos/default.nix b/macos/default.nix deleted file mode 100644 index 93b953e6..00000000 --- a/macos/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ - pkgs, - device, - ... -}: { - # imports = [ - # # ./sketchybar.nix - # ]; -} diff --git a/macos/sketchybar.nix b/macos/sketchybar.nix deleted file mode 100644 index 61867435..00000000 --- a/macos/sketchybar.nix +++ /dev/null @@ -1,4 +0,0 @@ -{pkgs, ...}: { - programs.sketchybar = { - }; -} diff --git a/modules/default.nix b/modules/default.nix index 3ace540c..a0f894c8 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -7,6 +7,7 @@ ./goread.nix ./hyprpaper.nix ./aichat.nix + ./tuifeed.nix #./ghostty.nix # ./sketchybar.nix ]; diff --git a/nixos/default.nix b/nixos/default.nix index 0e85bd0f..b220502b 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -34,7 +34,7 @@ builtins.listToAttrs (builtins.map (device: { inherit inputs; inherit device; }; - users.${device.user}.imports = [../common/home.nix]; + users.${device.user}.imports = [../home]; }; } ];