diff --git a/.github/actions/setup-nix/action.yml b/.github/actions/setup-nix/action.yml deleted file mode 100644 index dfd6c22..0000000 --- a/.github/actions/setup-nix/action.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: setup-nix - -inputs: - system: - type: string - required: true - sandbox: - type: string - default: "true" - -runs: - using: composite - steps: - - name: reclaim space (linux) - if: runner.os == 'Linux' - uses: wimpysworld/nothing-but-nix@main - with: - hatchet-protocol: rampage - - - name: reclaim space (darwin) - if: runner.os == 'macOS' - shell: bash - run: | - echo "::group::disk space (before)" - sudo df -h - echo "::endgroup::" - - echo "::group::disable mds" - sudo mdutil -i off -a || echo "mdutil failed" - sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist \ - || echo "launchctl unload failed" - echo "::endgroup::" - - echo "Background space expansion started. /nix will grow as space becomes available." - sudo rm -rf \ - /Applications/Xcode_* \ - /Library/Developer/CoreSimulator \ - /Library/Frameworks \ - /Users/runner/.dotnet \ - /Users/runner/.rustup \ - /Users/runner/Library/Android \ - /Users/runner/Library/Caches \ - /Users/runner/Library/Developer/CoreSimulator \ - /Users/runner/hostedtoolcache & - - - name: install nix - uses: cachix/install-nix-action@v31 - with: - # Putting build-dir in /nix is a workaround for https://github.com/wimpysworld/nothing-but-nix/issues/18 - extra_nix_config: | - build-dir = /nix/build - sandbox = ${{ inputs.sandbox }} - system = ${{ inputs.system }} - - - name: create build-dir - shell: bash - run: sudo mkdir -p /nix/build - - - name: post setup-nix - if: runner.os == 'macOS' - uses: srz-zumix/post-run-action@v2 - with: - shell: bash -e {0} - post-run: | - echo "::group::disk space (after)" - sudo df -h - echo "::endgroup::" \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8e831c..471c361 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,113 +4,46 @@ on: push: workflow_dispatch: -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - jobs: build: - strategy: - fail-fast: false - matrix: - system: - - x86_64-linux - - aarch64-linux - - x86_64-darwin - runs-on: ${{ matrix.system == 'x86_64-linux' && 'ubuntu-24.04' - || matrix.system == 'aarch64-linux' && 'ubuntu-24.04-arm' - || matrix.system == 'x86_64-darwin' && 'macos-latest' }} + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 + - name: Checkout the repository + uses: actions/checkout@v2 - - name: setup nix - uses: ./.github/actions/setup-nix - with: - system: ${{ matrix.system }} + - name: Install nix + uses: cachix/install-nix-action@v16 - - name: Login to tailscale - uses: tailscale/github-action@v3.2.3 - with: - oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} - oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} - hostname: ${{ matrix.system == 'x86_64-linux' && 'github-actions-x86-64-linux' - || matrix.system == 'aarch64-linux' && 'github-actions-aarch64-linux' - || matrix.system == 'x86_64-darwin' && 'github-actions-x86-64-darwin' }} - tags: tag:ci - # - name: Install and start Tailscale - # run: | - # # Start tailscaled daemon in background using nix shell - # nix profile add nixpkgs#tailscale - # sudo tailscaled --state=mem: & - - # # Wait for daemon to be ready - # sleep 10 - - # # Connect using OAuth - # HOSTNAME="${{ matrix.system == 'x86_64-linux' && 'github-actions-x86-64-linux' - # || matrix.system == 'aarch64-linux' && 'github-actions-aarch64-linux' - # || matrix.system == 'x86_64-darwin' && 'github-actions-x86-64-darwin' }}" - - # tailscale up \ - # --authkey="${{ secrets.TS_OAUTH_SECRET }}?preauthorized=true&ephemeral=true" \ - # --hostname="$HOSTNAME" \ - # --advertise-tags="tag:ci" \ - # --accept-routes + # TODO: add a binary cache + # - uses: cachix/cachix-action@v10 + # with: + # name: YOURCACHE + # authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - name: Tailscale status - run: tailscale status || true - - - name: Check if Attic endpoint is reachable - id: check_attic - run: | - if curl --connect-timeout 20 --silent --head http://wallfacer.curl-boga.ts.net:7080 | grep "200 OK"; then - echo "Attic endpoint is reachable" - echo "reachable=true" >> $GITHUB_OUTPUT - else - echo "Attic endpoint is not reachable" - echo "reachable=false" >> $GITHUB_OUTPUT - fi - - - name: Curl the cache - run: | - curl --connect-timeout 20 --silent http://wallfacer.curl-boga.ts.net:7080/main/nix-cache-info || echo "Cache endpoint not reachable" - - - name: Setup Attic cache - if: steps.check_attic.outputs.reachable == 'true' - uses: ryanccn/attic-action@v0.3.1 - with: - endpoint: http://wallfacer.curl-boga.ts.net:7080 - cache: main - token: ${{ secrets.ATTIC_TOKEN }} - name: Check the flake run: nix flake check --accept-flake-config - - name: Build the Neovim Configuration - run: nix build --accept-flake-config . -j3 - timeout-minutes: 300 - continue-on-error: true + - name: Pre-build the system configuration + run: nix build --accept-flake-config . - name: Print out the size of /nix/store run: du -sh /nix/store - name: Get the init.lua path - if: matrix.system == 'x86_64-linux' run: | init_path=$(grep "init=" result/bin/nixvim-print-init | awk -F'=' '{print $2}') cp $init_path init.lua - name: Upload the artifact uses: actions/upload-artifact@v4 - if: matrix.system == 'x86_64-linux' with: name: neovim-configuration path: init.lua - name: Publish the init.lua to an orphan github branch - if: matrix.system == 'x86_64-linux' run: | git config --global user.name github-actions git config --global user.email github-actions@github.com @@ -119,7 +52,6 @@ jobs: git add init.lua git commit -m "Publish init.lua" git push --force origin init-lua - git checkout main # switch back to main branch for graceful job ending check-formatting: runs-on: ubuntu-24.04 diff --git a/config/colorscheme.nix b/config/colorscheme.nix index 9d792c8..18da321 100644 --- a/config/colorscheme.nix +++ b/config/colorscheme.nix @@ -1,6 +1,6 @@ { colorschemes = { - catppuccin = { + catppuccin = { enable = true; settings.flavor = "mocha"; }; diff --git a/config/default.nix b/config/default.nix index c288068..c8b1cd7 100644 --- a/config/default.nix +++ b/config/default.nix @@ -1,64 +1,6 @@ -{pkgs, ...}: { - imports = [ - ./colorscheme.nix - ./options.nix - ./plugins - ]; - - config = { - # Use as leader key - globals.mapleader = " "; - globals.maplocalleader = " "; - - # Set 'vi' and 'vim' aliases to nixvim - viAlias = true; - vimAlias = true; - - # Setup clipboard support - clipboard = { - # Use xsel as clipboard provider - # providers.xsel.enable = true; - - # Sync system clipboard - register = "unnamedplus"; - }; - extraPackages = with pkgs; [ - nix-inspect - nixd - git - git-lfs - cloc - ripgrep - lazygit - black - fd - ripgrep - ]; - - keymaps = [ - { - mode = "n"; - key = "gg"; - action = "LazyGit"; - options = { - desc = "LazyGit (root dir)"; - }; - } - ]; - extraPlugins = with pkgs.vimPlugins; [ - lazygit-nvim - ]; - - extraConfigLua = '' - require("telescope").load_extension("lazygit") - ''; - performance = { - byteCompileLua = { - enable = true; - nvimRuntime = true; - configs = true; - plugins = true; - }; - }; - }; -} +{lib, ...}: let + definitions = lib.attrNames (lib.filterAttrs (filename: kind: + filename != "default.nix" && (kind == "regular" || kind == "directory")) + (builtins.readDir ./.)); +in + lib.mkMerge (map (file: import ./${file}) definitions) diff --git a/config/options.nix b/config/options.nix index fa918f5..1c33d6f 100644 --- a/config/options.nix +++ b/config/options.nix @@ -19,31 +19,5 @@ autoindent = true; # Do clever autoindenting # TODO: i want to see 4 spaces when i press tab in python and 2 spaces in nix using setlocal # is it possible for me to set this per language? - - # folding - foldmethod = "expr"; - foldexpr = "nvim_treesitter#foldexpr()"; - foldlevel = 99; # Folds with a level higher than this number will be closed - foldcolumn = "1"; - foldenable = true; - foldlevelstart = -1; - fillchars = { - horiz = "━"; - horizup = "┻"; - horizdown = "┳"; - vert = "┃"; - vertleft = "┫"; - vertright = "┣"; - verthoriz = "╋"; - - eob = " "; - diff = "╱"; - - fold = " "; - foldopen = ""; - foldclose = ""; - - msgsep = "‾"; - }; }; } diff --git a/config/plugins/avante.nix b/config/plugins/avante.nix deleted file mode 100644 index dbe9ec7..0000000 --- a/config/plugins/avante.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ - plugins.avante = { - lazyLoad.settings.event = ["DeferredUIEnter"]; - settings = { - # provider = "ollama"; - # provider = "claude"; - providers = { - # claude = { - # endpoint = "https://api.anthropic.com"; - # extra_request_body = { - # max_tokens = 4096; - # temperature = 0; - # }; - # model = "claude-3-5-sonnet-20240620"; - # }; - ollama = { - endpoint = "http://localhost:11434"; - model = "qwen2.5-coder:32b"; - }; - }; - }; - }; -} diff --git a/config/plugins/blink-cmp.nix b/config/plugins/blink-cmp.nix deleted file mode 100644 index 73a09b4..0000000 --- a/config/plugins/blink-cmp.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ - plugins.blink-cmp = { - settings = { - # snippets = { - # preset = "luasnip"; - # }; - sources = { - default = [ - "lsp" - "path" - "buffer" - "copilot" - ]; - providers = { - copilot = { - async = true; - module = "blink-copilot"; - name = "copilot"; - score_offset = 100; - # Optional configurations - opts = { - max_completions = 3; - max_attempts = 4; - kind = "Copilot"; - debounce = 750; - auto_refresh = { - backward = true; - forward = true; - }; - }; - }; - }; - }; - }; - }; -} diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..b3b896b --- /dev/null +++ b/default.nix @@ -0,0 +1,60 @@ +{pkgs, ...}: { + imports = [./config ./plugins]; + + config = { + # Use as leader key + globals.mapleader = " "; + globals.maplocalleader = " "; + + # Set 'vi' and 'vim' aliases to nixvim + viAlias = true; + vimAlias = true; + + # Setup clipboard support + clipboard = { + # Use xsel as clipboard provider + # providers.xsel.enable = true; + + # Sync system clipboard + register = "unnamedplus"; + }; + extraPackages = with pkgs; [ + nix-inspect + nixd + git + git-lfs + cloc + ripgrep + lazygit + black + fd + ripgrep + ]; + + keymaps = [ + { + mode = "n"; + key = "gg"; + action = "LazyGit"; + options = { + desc = "LazyGit (root dir)"; + }; + } + ]; +extraPlugins = with pkgs.vimPlugins; [ + lazygit-nvim + ]; + + extraConfigLua = '' + require("telescope").load_extension("lazygit") + ''; + performance = { + byteCompileLua = { + enable = true; + nvimRuntime = true; + configs = true; + plugins = true; + }; + }; + }; +} diff --git a/flake.lock b/flake.lock index a386e99..5ae264e 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ ] }, "locked": { - "lastModified": 1760948891, - "narHash": "sha256-TmWcdiUUaWk8J4lpjzu4gCGxWY6/Ok7mOK4fIFfBuU4=", + "lastModified": 1749398372, + "narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "864599284fc7c0ba6357ed89ed5e2cd5040f0c04", + "rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569", "type": "github" }, "original": { @@ -53,16 +53,16 @@ ] }, "locked": { - "lastModified": 1754860581, - "narHash": "sha256-EM0IE63OHxXCOpDHXaTyHIOk2cNvMCGPqLt/IdtVxgk=", + "lastModified": 1748294338, + "narHash": "sha256-FVO01jdmUNArzBS7NmaktLdGA5qA3lUMJ4B7a05Iynw=", "owner": "NuschtOS", "repo": "ixx", - "rev": "babfe85a876162c4acc9ab6fb4483df88fa1f281", + "rev": "cc5f390f7caf265461d4aab37e98d2292ebbdb85", "type": "github" }, "original": { "owner": "NuschtOS", - "ref": "v0.1.1", + "ref": "v0.0.8", "repo": "ixx", "type": "github" } @@ -76,11 +76,11 @@ "nmt": "nmt" }, "locked": { - "lastModified": 1756744433, - "narHash": "sha256-6BSEvkprwEQDQQgW5UH/1GkBPGM8M9+qX6o9ePslr6E=", + "lastModified": 1742249870, + "narHash": "sha256-U37ECk3zpfp92D3H0gzfWPyb5sf0RdOdublCq1zjq+w=", "owner": "Gerschtli", "repo": "nix-formatter-pack", - "rev": "63b748033a3fa0af80f8ed908521122e48858c30", + "rev": "fe5b4498e3161191bd93fe0683dff347f6f689df", "type": "github" }, "original": { @@ -91,11 +91,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1761373498, - "narHash": "sha256-Q/uhWNvd7V7k1H1ZPMy/vkx3F8C13ZcdrKjO7Jv7v0c=", + "lastModified": 1749285348, + "narHash": "sha256-frdhQvPbmDYaScPFiCnfdh3B/Vh81Uuoo0w5TkWmmjU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "6a08e6bb4e46ff7fcbb53d409b253f6bad8a28ce", + "rev": "3e3afe5174c561dee0df6f2c2b2236990146329f", "type": "github" }, "original": { @@ -107,11 +107,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1761656231, - "narHash": "sha256-EiED5k6gXTWoAIS8yQqi5mAX6ojnzpHwAQTS3ykeYMg=", + "lastModified": 1749523198, + "narHash": "sha256-How2kQw0psKmCdXgojc95Sf3K5maHB3qfINxTZFCAPM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e99366c665bdd53b7b500ccdc5226675cfc51f45", + "rev": "cdc68935eba9f86d155585fdf6f17af6824f38ac", "type": "github" }, "original": { @@ -129,11 +129,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1761744315, - "narHash": "sha256-OknzyEoI+VEYgk/FWMyx3tvjb/MPPyqS+G/aemDz51w=", + "lastModified": 1749761870, + "narHash": "sha256-y+rCuxTylur4k2MbL8cJwOR3pHIamCxp8xG9Vuhwvgw=", "owner": "nix-community", "repo": "nixvim", - "rev": "6233fc6b2c3f203d8a5970f4a2c1df5777902717", + "rev": "18d838e88945b554d059db5f1fff1daed4b7bf8f", "type": "github" }, "original": { @@ -184,11 +184,11 @@ ] }, "locked": { - "lastModified": 1761730856, - "narHash": "sha256-t1i5p/vSWwueZSC0Z2BImxx3BjoUDNKyC2mk24krcMY=", + "lastModified": 1749531675, + "narHash": "sha256-UB8Mc88rW9frjpJ1Fj2ro7f07Gg8dX3uVXvMXnFR4CE=", "owner": "NuschtOS", "repo": "search", - "rev": "e29de6db0cb3182e9aee75a3b1fd1919d995d85b", + "rev": "4029d450d0266909ee52775849b7da54e79b328e", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index ab0b46c..2c0fcc5 100644 --- a/flake.nix +++ b/flake.nix @@ -1,15 +1,6 @@ { description = "My custom neovim configuration that has been mixed and matched from various sources"; - nixConfig = { - extra-substituters = [ - "https://nix-community.cachix.org" - ]; - extra-trusted-public-keys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - }; - inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # https://gerschtli.github.io/nix-formatter-pack/nix-formatter-pack-options.html @@ -50,22 +41,18 @@ mkNixvim = specialArgs: nixvim.legacyPackages.${system}.makeNixvimWithModule { inherit pkgs; - module = ./config; + + module = ./.; + extraSpecialArgs = specialArgs // { inherit pkgs self; }; }; - in rec { + in { default = mkNixvim {}; lite = mkNixvim {withLSP = false;}; - - default-print-init = default.config.build.printInitPackage; - lite-print-init = lite.config.build.printInitPackage; - - default-init = default.config.build.initSource; - lite-init = lite.config.build.initSource; }); }; } diff --git a/plugins/blink-cmp.nix b/plugins/blink-cmp.nix new file mode 100644 index 0000000..cb98844 --- /dev/null +++ b/plugins/blink-cmp.nix @@ -0,0 +1,6 @@ +{ + plugins.blink-cmp = { + settings = { + }; + }; +} diff --git a/config/plugins/cmp.nix b/plugins/cmp.nix similarity index 100% rename from config/plugins/cmp.nix rename to plugins/cmp.nix diff --git a/config/plugins/comment.nix b/plugins/comment.nix similarity index 100% rename from config/plugins/comment.nix rename to plugins/comment.nix diff --git a/config/plugins/default.nix b/plugins/default.nix similarity index 73% rename from config/plugins/default.nix rename to plugins/default.nix index e417720f..0af3fea 100644 --- a/config/plugins/default.nix +++ b/plugins/default.nix @@ -1,9 +1,16 @@ -{lib, ...}: { - imports = - lib.mapAttrsToList (name: _path: ./. + "/${name}") - (lib.filterAttrs (filename: kind: - filename != "default.nix" && (kind == "regular" || kind == "directory")) - (builtins.readDir ./.)); +{ + # settings of these plugins live in their respective files + imports = [ + ./blink-cmp.nix + ./cmp.nix + ./comment.nix + ./gitsigns.nix + ./lsp.nix + ./mini.nix + ./oil.nix + ./treesitter.nix + ./which-key.nix + ]; plugins = { # todo comments highlighter @@ -46,7 +53,7 @@ mini.enable = true; # TODO look more into the mini plugin # cursor animation - smear-cursor.enable = false; + smear-cursor.enable = true; # add buffer tab plugin bufferline.enable = true; @@ -65,17 +72,5 @@ # tip pop-up which-key.enable = true; - - # ai support - avante.enable = true; - - # lazy loading provider - lz-n.enable = true; - - # oil git status shower - oil-git-status.enable = true; - - # blink copilot - blink-copilot.enable = true; }; } diff --git a/config/plugins/gitsigns.nix b/plugins/gitsigns.nix similarity index 100% rename from config/plugins/gitsigns.nix rename to plugins/gitsigns.nix diff --git a/config/plugins/lsp.nix b/plugins/lsp.nix similarity index 100% rename from config/plugins/lsp.nix rename to plugins/lsp.nix diff --git a/config/plugins/mini.nix b/plugins/mini.nix similarity index 100% rename from config/plugins/mini.nix rename to plugins/mini.nix diff --git a/config/plugins/oil.nix b/plugins/oil.nix similarity index 87% rename from config/plugins/oil.nix rename to plugins/oil.nix index 4a6151b..8297a2b 100644 --- a/config/plugins/oil.nix +++ b/plugins/oil.nix @@ -7,9 +7,6 @@ view_options = { show_hidden = true; }; - win_options = { - signcolumn = "yes:2"; - }; }; # add this keymaps only if oil plugin is enabled keymaps = lib.mkIf config.plugins.oil.enable [ diff --git a/config/plugins/treesitter.nix b/plugins/treesitter.nix similarity index 78% rename from config/plugins/treesitter.nix rename to plugins/treesitter.nix index 54cec01..954f711 100644 --- a/config/plugins/treesitter.nix +++ b/plugins/treesitter.nix @@ -1,6 +1,6 @@ { plugins.treesitter = { - folding = true; # i dont like the way it starts neovim with everything folded + # folding = true; # i dont like the way it starts neovim with everything folded settings = { ensure_installed = [ "python" diff --git a/config/plugins/which-key.nix b/plugins/which-key.nix similarity index 100% rename from config/plugins/which-key.nix rename to plugins/which-key.nix