From 6453f713a7cefe3f4a92baa4fb66aba408211a0d Mon Sep 17 00:00:00 2001 From: Uttarayan Mondal Date: Sun, 3 Mar 2024 00:57:19 +0530 Subject: [PATCH] [feat] Add stuff --- config/nix/common/firefox.nix | 47 ++++++++++------- config/nix/common/home.nix | 73 +++++++++++++++++--------- config/nix/common/nvim/default.nix | 13 ++--- config/nix/common/nvim/extraConfig.lua | 3 +- config/nix/common/tmux.nix | 9 +++- config/nix/darwin/configuration.nix | 2 +- config/nix/darwin/device.nix | 49 +++++++++-------- config/nix/flake.lock | 60 ++++++++++----------- config/nix/flake.nix | 30 +++++++---- config/nix/nixos/configuration.nix | 3 +- 10 files changed, 165 insertions(+), 124 deletions(-) diff --git a/config/nix/common/firefox.nix b/config/nix/common/firefox.nix index 3b47f9f9..51dc607c 100644 --- a/config/nix/common/firefox.nix +++ b/config/nix/common/firefox.nix @@ -1,22 +1,19 @@ { device, pkgs, ... }: { programs.firefox = { - enable = true; - # enable = device.isLinux; + enable = device.isLinux; profiles.default = { - userChrome = - let - csshacks = pkgs.fetchFromGitHub { - owner = "MrOtherGuy"; - repo = "firefox-csshacks"; - rev = "master"; - sha256 = "sha256-r5CKOOcRWZQzYA9M6j7m2CAulOQItCuWsTSNGOYN87w="; - }; - in - '' - @import url(${csshacks}/chrome/toolbars_below_content.css); - @import url(${csshacks}/chrome/scrollable_menupopups.css); - @import url(${csshacks}/chrome/linux_gtk_window_control_patch.css); - ''; + userChrome = let + csshacks = pkgs.fetchFromGitHub { + owner = "MrOtherGuy"; + repo = "firefox-csshacks"; + rev = "master"; + sha256 = "sha256-r5CKOOcRWZQzYA9M6j7m2CAulOQItCuWsTSNGOYN87w="; + }; + in '' + @import url(${csshacks}/chrome/toolbars_below_content.css); + @import url(${csshacks}/chrome/scrollable_menupopups.css); + @import url(${csshacks}/chrome/linux_gtk_window_control_patch.css); + ''; extensions = with pkgs.nur.repos.rycee.firefox-addons; [ privacy-badger bitwarden @@ -27,7 +24,8 @@ policies = { ExtensionSettings = { "uBlock0@raymondhill.net" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; + install_url = + "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; installation_mode = "force_installed"; }; }; @@ -37,10 +35,19 @@ FeatureRecommendations = false; SkipOnboarding = true; Preferences = { - "toolkit.legacyUserProfileCustomizations.stylesheets" = { Value = true; Status = "default"; }; + "toolkit.legacyUserProfileCustomizations.stylesheets" = { + Value = true; + Status = "default"; + }; # "browser.compactmode.show" = { Value = true; Status = "default"; }; - "browser.urlbar.suggest.calculator" = { Value = true; Status = "default"; }; - "extensions.quarantinedDomains.enabled" = { Value = false; Status = "default"; }; + "browser.urlbar.suggest.calculator" = { + Value = true; + Status = "default"; + }; + "extensions.quarantinedDomains.enabled" = { + Value = false; + Status = "default"; + }; }; FirefoxHome = { "Search" = true; diff --git a/config/nix/common/home.nix b/config/nix/common/home.nix index 06b078d0..afbbe7d4 100644 --- a/config/nix/common/home.nix +++ b/config/nix/common/home.nix @@ -3,13 +3,14 @@ let start-tmux = (import ../scripts/start-tmux.nix) pkgs; # https://mipmip.github.io/home-manager-option-search/ lazy = false; -in { +in +{ imports = [ # Include the results of the hardware scan. ./tmux.nix ./wezterm.nix ] ++ (if device.isLinux then [ ../linux ] else [ ]) - ++ (if !lazy then [ ./nvim ] else [ ]); + ++ (if !lazy then [ ./nvim ] else [ ]); home.packages = with pkgs; [ @@ -79,6 +80,22 @@ in { # xdg.enable = true; programs = { + helix = { + enable = true; + settings = { + theme = "base16"; + 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; userName = "uttarayan21"; @@ -124,17 +141,19 @@ in { enable = true; enableFishIntegration = true; enableNushellIntegration = true; - settings = let flavour = "mocha"; # Replace with your preferred palette - in { - # Other config here - format = "$all"; # Remove this line to disable the default prompt format - palette = "catppuccin_${flavour}"; - } // builtins.fromTOML (builtins.readFile (pkgs.fetchFromGitHub { - owner = "catppuccin"; - repo = "starship"; - rev = "main"; # Replace with the latest commit hash - sha256 = "sha256-nsRuxQFKbQkyEI4TXgvAjcroVdG+heKX5Pauq/4Ota0"; - } + /palettes/${flavour}.toml)); + settings = + let flavour = "mocha"; # Replace with your preferred palette + in { + # Other config here + format = "$all"; # Remove this line to disable the default prompt format + palette = "catppuccin_${flavour}"; + } // builtins.fromTOML (builtins.readFile (pkgs.fetchFromGitHub + { + owner = "catppuccin"; + repo = "starship"; + rev = "main"; # Replace with the latest commit hash + sha256 = "sha256-nsRuxQFKbQkyEI4TXgvAjcroVdG+heKX5Pauq/4Ota0"; + } + /palettes/${flavour}.toml)); }; eza = { enable = true; @@ -162,16 +181,17 @@ in { enable = true; config = { theme = "catppuccin"; }; themes = { - catppuccin = let flavor = "mocha"; - in { - src = pkgs.fetchFromGitHub { - owner = "catppuccin"; - repo = "bat"; - rev = "main"; - sha256 = "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw"; + catppuccin = + let flavor = "mocha"; + in { + src = pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "bat"; + rev = "main"; + sha256 = "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw"; + }; + file = "Catppuccin-${flavor}.tmTheme"; }; - file = "Catppuccin-${flavor}.tmTheme"; - }; }; }; @@ -184,10 +204,11 @@ in { # Home Manager needs a bit of information about you and the paths it should # manage. username = device.user; - homeDirectory = if device.isMac then - lib.mkForce "/Users/${device.user}" - else - lib.mkForce "/home/${device.user}"; + homeDirectory = + if device.isMac then + lib.mkForce "/Users/${device.user}" + else + lib.mkForce "/home/${device.user}"; stateVersion = "23.11"; diff --git a/config/nix/common/nvim/default.nix b/config/nix/common/nvim/default.nix index e99e0a90..7d4e96e1 100644 --- a/config/nix/common/nvim/default.nix +++ b/config/nix/common/nvim/default.nix @@ -103,23 +103,15 @@ }; extraPlugins = - let - comfortable-motion = pkgs.fetchFromGitHub { - owner = "yuttie"; - repo = "comfortable-motion.vim"; - rev = "master"; - sha256 = "sha256-S1LJXmShhpCJIg/FEPx3jFbmPpS/1U4MAQN2RY/nkI0"; - }; - in [ - comfortable-motion + pkgs.vimPlugins.comfortable-motion pkgs.vimPlugins.vim-abolish pkgs.vimPlugins.telescope-nvim pkgs.vimPlugins.telescope-ui-select-nvim pkgs.vimPlugins.telescope-fzf-native-nvim pkgs.vimPlugins.telescope-file-browser-nvim pkgs.vimPlugins.telescope-dap-nvim - pkgs.vimPlugins.rustaceanvim + # pkgs.vimPlugins.rustaceanvim # lsp stuff pkgs.vimPlugins.nvim-cmp @@ -134,6 +126,7 @@ pkgs.vimPlugins.copilot-lua pkgs.vimPlugins.lsp-zero-nvim pkgs.vimPlugins.trouble-nvim + pkgs.vimPlugins.nvim-web-devicons pkgs.vimPlugins.rest-nvim diff --git a/config/nix/common/nvim/extraConfig.lua b/config/nix/common/nvim/extraConfig.lua index d19a1df6..b7bb5fcf 100644 --- a/config/nix/common/nvim/extraConfig.lua +++ b/config/nix/common/nvim/extraConfig.lua @@ -19,6 +19,7 @@ require('telescope').load_extension("file_browser") vim.g.rustaceanvim = { server = { + capabilities = require 'lsp-zero'.get_capabilities(), on_attach = function(client, bufnr) if client.server_capabilities.inlayHintProvider then vim.lsp.inlay_hint.enable(bufnr, true) @@ -102,7 +103,7 @@ cmp.setup.cmdline(':', { }) cmp.setup.filetype('gitcommit', { sources = cmp.config.sources({ - { name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git). + { name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git). }, { { name = 'buffer' }, }) diff --git a/config/nix/common/tmux.nix b/config/nix/common/tmux.nix index 07d96fe9..69e46c7f 100644 --- a/config/nix/common/tmux.nix +++ b/config/nix/common/tmux.nix @@ -19,7 +19,8 @@ let tmux popup -d '#{pane_current_path}' -xC -yC -w$width -h$height -E "tmux attach -t scratch || tmux new -s scratch" fi ''; -in { +in +{ programs.tmux = { enable = true; shell = "${pkgs.nushellFull}/bin/nu"; @@ -37,7 +38,7 @@ in { plugin = tmuxPlugins.catppuccin; extraConfig = '' set -g @catppuccin_flavour 'mocha' - set -g @catppuccin_window_default_text "" + set -g @catppuccin_window_default_text '''''' ''; } { @@ -53,6 +54,10 @@ in { set -g allow-passthrough on set -ga update-environment TERM set -ga update-environment TERM_PROGRAM + set-option -sg escape-time 10 + set-option -sa terminal-features ',xterm-256color:RGB' + + bind h select-pane -L bind j select-pane -D diff --git a/config/nix/darwin/configuration.nix b/config/nix/darwin/configuration.nix index ba103d90..e5e3115e 100644 --- a/config/nix/darwin/configuration.nix +++ b/config/nix/darwin/configuration.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{ pkgs, device, ... }: { imports = [ ./yabai.nix ./skhd.nix ]; environment.systemPackages = with pkgs; [ nix neovim ]; diff --git a/config/nix/darwin/device.nix b/config/nix/darwin/device.nix index fae8be1a..04835f83 100644 --- a/config/nix/darwin/device.nix +++ b/config/nix/darwin/device.nix @@ -1,24 +1,29 @@ { devices, inputs, overlays, home-manager, nix-darwin, ... }: -builtins.listToAttrs (builtins.map (device: { - name = device.name; - value = nix-darwin.lib.darwinSystem { - system = device.system; - modules = [ - { nixpkgs.overlays = overlays; } - ./configuration.nix - home-manager.darwinModules.home-manager - { - nixpkgs.config.allowUnfree = true; - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - extraSpecialArgs = { - inherit inputs; - inherit device; +builtins.listToAttrs (builtins.map + (device: { + name = device.name; + value = nix-darwin.lib.darwinSystem { + system = device.system; + modules = [ + { + nixpkgs.overlays = overlays; + # nixpkgs.hostPlatform.config = device.system; + } + ./configuration.nix + home-manager.darwinModules.home-manager + { + nixpkgs.config.allowUnfree = true; + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { + inherit inputs; + inherit device; + }; + users.${device.user}.imports = [ ../common/home.nix ]; }; - users.${device.user}.imports = [ ../common/home.nix ]; - }; - } - ]; - }; -}) devices) + } + ]; + }; + }) + devices) diff --git a/config/nix/flake.lock b/config/nix/flake.lock index 0246c1d2..1b97c11f 100644 --- a/config/nix/flake.lock +++ b/config/nix/flake.lock @@ -102,11 +102,11 @@ ] }, "locked": { - "lastModified": 1706473964, - "narHash": "sha256-Fq6xleee/TsX6NbtoRuI96bBuDHMU57PrcK9z1QEKbk=", + "lastModified": 1708794349, + "narHash": "sha256-jX+B1VGHT0ruHHL5RwS8L21R6miBn4B6s9iVyUJsJJY=", "owner": "ipetkov", "repo": "crane", - "rev": "c798790eabec3e3da48190ae3698ac227aab770c", + "rev": "2c94ff9a6fbeb9f3ea0107f28688edbe9c81deaa", "type": "github" }, "original": { @@ -527,11 +527,11 @@ "rust-overlay": "rust-overlay_3" }, "locked": { - "lastModified": 1709065223, - "narHash": "sha256-7zuh1ait7C6OAVfhl5fVloxrAc0WJBxEOu1XqPhlwI0=", + "lastModified": 1709290301, + "narHash": "sha256-0dpic4xWnPHqZrsRTVGrjw+5J1XjgHl/+Dw9XjvDC0o=", "owner": "JakeStanger", "repo": "ironbar", - "rev": "149b57a73701af9d430ddf97252c6cc72074b2d2", + "rev": "3df01ea93a27ba80e2be8c3fe832903c3e7871d2", "type": "github" }, "original": { @@ -553,11 +553,11 @@ "rust-overlay": "rust-overlay_4" }, "locked": { - "lastModified": 1709051793, - "narHash": "sha256-4FXFBq5mN1IwN18Fd2OEF1iCZV5PC40gP2L64oyq3xQ=", + "lastModified": 1709332019, + "narHash": "sha256-kJAoPvpVRO3WR1dCZQKJpUMYoyA/6u9iUDX9gGEkjGI=", "owner": "nix-community", "repo": "lanzaboote", - "rev": "e761c7ee47b64debc687d8bff7599d702c893dcc", + "rev": "eeb45682dd4b2a921a3cab286f13101c9750d6bb", "type": "github" }, "original": { @@ -640,11 +640,11 @@ ] }, "locked": { - "lastModified": 1709112925, - "narHash": "sha256-5y8Dhw1HYdc+BWv+qQjJUIwc+ByoudtoGaHEcrXYlXw=", + "lastModified": 1709348262, + "narHash": "sha256-eYTA1uZtYGFKrDOKiAz1wlE6aIC9WSdBNF8bSS818zM=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "283d59778e6b8c41cac4bdeac5b2512d6de51150", + "rev": "8a15cb36fffa0b5fbe31ef16ede0a479bef4b365", "type": "github" }, "original": { @@ -727,11 +727,11 @@ "nmt": "nmt" }, "locked": { - "lastModified": 1709216523, - "narHash": "sha256-8BaqUeMgwDBsXVpyE+AYVW7QBjR0DnsGnY0qZHdi9Ew=", + "lastModified": 1709294841, + "narHash": "sha256-jJTiD0nOk1p+QNJq+v4dUMx3cb/RQ/dm+Q0vNLr8Qvs=", "owner": "nixneovim", "repo": "nixneovim", - "rev": "eebce182253d8c665a8a19e0b056f6cfaf97872c", + "rev": "1f5b2c9613674c8400d764d16823e0add12b6970", "type": "github" }, "original": { @@ -775,11 +775,11 @@ "poetry2nix": "poetry2nix_2" }, "locked": { - "lastModified": 1709216547, - "narHash": "sha256-BZcxoobO6CaJ4Y2CdEiiY1381G/LdUr82mjKXEftGow=", + "lastModified": 1709240484, + "narHash": "sha256-e7Azz4vD3ogyDbpfEbMunYjPOytBxvcwKblwkIu+Q+M=", "owner": "NixNeovim", "repo": "NixNeovimPlugins", - "rev": "acad18539f283314a9c5cd4dee8eb70dd782c663", + "rev": "27a92496c702a58705b02193462811b00793ed3c", "type": "github" }, "original": { @@ -856,11 +856,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1706683685, - "narHash": "sha256-FtPPshEpxH/ewBOsdKBNhlsL2MLEFv1hEnQ19f/bFsQ=", + "lastModified": 1709200309, + "narHash": "sha256-lKdtMbhnBNU1lr978T+wEYet3sfIXXgyiDZNEgx8CV8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5ad9903c16126a7d949101687af0aa589b1d7d3d", + "rev": "ebe6e807793e7c9cc59cf81225fdee1a03413811", "type": "github" }, "original": { @@ -885,11 +885,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1709150264, - "narHash": "sha256-HofykKuisObPUfj0E9CJVfaMhawXkYx3G8UIFR/XQ38=", + "lastModified": 1709237383, + "narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9099616b93301d5cf84274b184a3a5ec69e94e08", + "rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8", "type": "github" }, "original": { @@ -934,11 +934,11 @@ }, "nur": { "locked": { - "lastModified": 1709238329, - "narHash": "sha256-c3GRGuMceCIMt8JiVics4PWzoxnJO1fhThhGBesqRG0=", + "lastModified": 1709366185, + "narHash": "sha256-K8CZc7mWQ2p2UiCzi9WVuzuUgG4nZe+BwTb3S6AYAsg=", "owner": "nix-community", "repo": "nur", - "rev": "04faed2bbb45869890824deb06ab315228ffe7b1", + "rev": "a539b9e38cd2604dae50937d80f181cca533a462", "type": "github" }, "original": { @@ -1097,11 +1097,11 @@ ] }, "locked": { - "lastModified": 1706667075, - "narHash": "sha256-KBI5jcOWh9nsOFWj2SRq7vj+fPDf8Do8ceL582kFA70=", + "lastModified": 1709172595, + "narHash": "sha256-0oYeE5VkhnPA7YBl+0Utq2cYoHcfsEhSGwraCa27Vs8=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "2c993daf3136c6955fd13bfe215d0d4faf6090f1", + "rev": "72fa0217f76020ad3aeb2dd9dd72490905b23b6f", "type": "github" }, "original": { diff --git a/config/nix/flake.nix b/config/nix/flake.nix index eae3860b..4a7f0dae 100644 --- a/config/nix/flake.nix +++ b/config/nix/flake.nix @@ -142,20 +142,28 @@ inputs.anyrun-nixos-options.packages.${prev.system}.default; anyrun-rink = inputs.anyrun-rink.packages.${prev.system}.default; }; - # postman-overlay = final: prev: { - # postman = prev.postman.overrideAttrs (old: rec { - # version = "20230716100528"; - # src = final.fetchurl { - # url = - # "https://dl.pstmn.io/download/latest/osx_arm64"; - # sha256 = "sha256-P7x06KKH0e1Yro93SCEJyiWS/Uv25tWU8A85vxv85hI="; - # name = "${old.pname}-${version}.tar.gz"; - # }; - # }); - # }; + + vimPlugins = final: prev: { + vimPlugins = + prev.vimPlugins + // + { + comfortable-motion = final.pkgs.vimUtils.buildVimPlugin { + name = "comfortable-motion"; + src = final.pkgs.fetchFromGitHub { + owner = "yuttie"; + repo = "comfortable-motion.vim"; + rev = "master"; + sha256 = "sha256-S1LJXmShhpCJIg/FEPx3jFbmPpS/1U4MAQN2RY/nkI0"; + }; + }; + }; + }; + overlays = [ inputs.neovim-nightly-overlay.overlay anyrun-overlay + vimPlugins inputs.nixneovim.overlays.default inputs.nixneovimplugins.overlays.default nur.overlay diff --git a/config/nix/nixos/configuration.nix b/config/nix/nixos/configuration.nix index 1947040c..864cb7b4 100644 --- a/config/nix/nixos/configuration.nix +++ b/config/nix/nixos/configuration.nix @@ -98,7 +98,8 @@ fish nushellFull (pkgs.wrapFirefox - (pkgs.firefox-unwrapped.override { pipewireSupport = true; }) { }) + (pkgs.firefox-unwrapped.override { pipewireSupport = true; }) + { }) gnumake python3 (nerdfonts.override { fonts = [ "FiraCode" "Hasklig" ]; })