diff --git a/dotconfig/ghostty/config b/dotconfig/ghostty/config index 61dbd84..f64d11a 100644 --- a/dotconfig/ghostty/config +++ b/dotconfig/ghostty/config @@ -1 +1,3 @@ theme = catppuccin-mocha +command = zsh +font-family = "JetBrainsMono Nerd Font Mono" diff --git a/flake.lock b/flake.lock index 6d1f8cb..9c3221b 100644 --- a/flake.lock +++ b/flake.lock @@ -32,6 +32,43 @@ "type": "github" } }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1704982712, + "narHash": "sha256-2Ptt+9h8dczgle2Oo6z5ni5rt/uLMG47UFTR1ry/wgg=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "07f6395285469419cf9d078f59b5b49993198c00", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1659877975, @@ -80,6 +117,24 @@ "type": "github" } }, + "flake-utils_4": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "ghostty": { "inputs": { "nixpkgs-stable": "nixpkgs-stable", @@ -124,6 +179,28 @@ "type": "github" } }, + "gitignore_2": { + "inputs": { + "nixpkgs": [ + "nixvim", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -144,6 +221,27 @@ "type": "github" } }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1705104164, + "narHash": "sha256-pllCu3Hcm1wP/B0SUxgUXvHeEd4w8s2aVrEQRdIL1yo=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "0912d26b30332ae6a90e1b321ff88e80492127dd", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "langref": { "flake": false, "locked": { @@ -156,6 +254,27 @@ "url": "https://raw.githubusercontent.com/ziglang/zig/63bd2bff12992aef0ce23ae4b344e9cb5d65f05d/doc/langref.html.in" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1704277720, + "narHash": "sha256-meAKNgmh3goankLGWqqpw73pm9IvXjEENJloF0coskE=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "0dd382b70c351f528561f71a0a7df82c9d2be9a4", + "type": "github" + }, + "original": { + "owner": "lnl7", + "repo": "nix-darwin", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1705303754, @@ -220,11 +339,81 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1698318101, + "narHash": "sha256-gUihHt3yPD7bVqg+k/UVHgngyaJ3DMEBchbymBMvK1E=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "63678e9f3d3afecfeafa0acead6239cdb447574c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "flake-parts": "flake-parts", + "home-manager": "home-manager_2", + "nix-darwin": "nix-darwin", + "nixpkgs": [ + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1705420484, + "narHash": "sha256-UBkOJuvOKVlUvJdslMCm7kL165JGHShyUVuZCguuPxs=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "c5f43a8a37263d3aab94a7b7831a2f46006b8680", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils_4", + "gitignore": "gitignore_2", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1705072518, + "narHash": "sha256-90dERRuG781f0EWjn2AOtScZqsTcpIFLpY8TN2VbkL8=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "274ae3979a0eacae422e1bbcf63b8b7a335e1114", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "ghostty": "ghostty", "home-manager": "home-manager", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "nixvim": "nixvim", + "thorium": "thorium" } }, "systems": { @@ -242,6 +431,39 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "thorium": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1702727908, + "narHash": "sha256-wf7RJNnns1N1sk3KtrBsWAWGFVBp6snVqjTu/sFc7hM=", + "owner": "almahdi", + "repo": "nix-thorium", + "rev": "84146ce3f78cf580d6e40f0a71c183c319314b06", + "type": "github" + }, + "original": { + "owner": "almahdi", + "repo": "nix-thorium", + "type": "github" + } + }, "zig": { "inputs": { "flake-compat": "flake-compat", diff --git a/flake.nix b/flake.nix index e5514f6..011d676 100644 --- a/flake.nix +++ b/flake.nix @@ -3,14 +3,22 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + + nixvim = { + url = "github:nix-community/nixvim"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + ghostty.url = "git+ssh://git@github.com/mitchellh/ghostty"; + thorium.url = "github:almahdi/nix-thorium"; }; - outputs = { nixpkgs, home-manager, ghostty, ... }: { + outputs = { nixpkgs, home-manager, ghostty, nixvim, thorium, ... }: { # For `nix run .` later defaultPackage.x86_64-linux = home-manager.defaultPackage.x86_64-linux; @@ -23,8 +31,10 @@ ({ pkgs, ... }: { home.packages = with pkgs; [ ghostty.packages.x86_64-linux.default + thorium.packages.x86_64-linux.default ]; }) + nixvim.homeManagerModules.nixvim ./home-manager/default.nix ]; }; diff --git a/home-manager/default.nix b/home-manager/default.nix index 7b50900..7f9ba1b 100644 --- a/home-manager/default.nix +++ b/home-manager/default.nix @@ -1,4 +1,4 @@ -{ config, pkgs, username, ... }: +{ config, pkgs, lib, username, ... }: { imports = [ @@ -8,6 +8,7 @@ ./vscode.nix ./git.nix ./fonts.nix + ./nvim.nix ]; home.username = "watzon"; diff --git a/home-manager/nvim.nix b/home-manager/nvim.nix index 3a12951..1def1b3 100644 --- a/home-manager/nvim.nix +++ b/home-manager/nvim.nix @@ -1,14 +1,73 @@ -{ config, lib, pkgs, ... }: - +{ pkgs, lib, nixvim, ... }: { - programs.neovim = { + programs.nixvim = { enable = true; - withRuby = true; - withPython3 = true; - withNodeJs = true; - viAlias = true; - vimAlias = true; - plugins = []; + editorconfig.enable = true; + clipboard.register = "unnamedplus"; + globals.mapleader = " "; + + colorschemes.catppuccin = { + enable = true; + flavour = "mocha"; + }; + + plugins.alpha = { + enable = true; + theme = "theta"; + }; + + plugins.which-key = { + enable = true; + triggers = "auto"; + }; + + plugins.nix.enable = true; + plugins.lightline.enable = true; + plugins.lsp.enable = true; + plugins.nvim-cmp.enable = true; + plugins.nvim-tree.enable = true; + plugins.telescope.enable = true; + + keymaps = [ + # file operations + { + options.desc = "Toggle NvimTree"; + action = "NvimTreeToggle"; + key = "ft"; + } + { + options.desc = "Find file with Telescope"; + action = "Telescope find_files"; + key = "ff"; + } + { + options.desc = "Find word with Telescope"; + action = "Telescope live_grep"; + key = "fw"; + } + + # windows + { + options.desc = "Switch to window on left"; + action = "wincmd h"; + key = ""; + } + { + options.desc = "Switch to window on right"; + action = "wincmd j"; + key = ""; + } + { + options.desc = "Split window vertically"; + action = "split"; + key = "v"; + } + { + options.desc = "Split window horizontally"; + action = "vsplit"; + key = "h"; + } + ]; }; -} \ No newline at end of file +} diff --git a/home-manager/packages.nix b/home-manager/packages.nix index d9a90f4..3d4a215 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, host, ... }: { nixpkgs.config.allowUnfree = true; @@ -24,7 +24,6 @@ neofetch rnix-lsp direnv - neovim bat eza lazygit @@ -34,11 +33,13 @@ ripgrep fzf httpie + xclip + distrobox # languages nodejs yarn crystal shards - pyenv poetry + python3 pyenv poetry nim zig bun @@ -50,5 +51,5 @@ # xpipe (import ./packages/xpipe.nix { inherit pkgs; }) - ]; + ] ++ (import ../scripts { inherit pkgs host; }); } diff --git a/home-manager/sh.nix b/home-manager/sh.nix index da8d55b..5e17620 100644 --- a/home-manager/sh.nix +++ b/home-manager/sh.nix @@ -2,9 +2,10 @@ let aliases = { cls = "printf '\\033c'; clear"; - # vim = "nvim"; - hm = "home-manager"; - # ls = "eza -la --icons"; + vim = "nvim"; + hm = "home-manager --flake ~/dotfiles"; + hms = "home-manager switch"; + lsa = "eza -la --icons"; lg = "lazygit"; }; in diff --git a/scripts/default.nix b/scripts/default.nix new file mode 100644 index 0000000..e0a5bde --- /dev/null +++ b/scripts/default.nix @@ -0,0 +1,10 @@ +{ pkgs, host, ... }: + +let + + # nvidia offload + nvidia-offload = import ./nvidia-offload.nix pkgs; + +in [ + nvidia-offload +] diff --git a/scripts/nvidia-offload.nix b/scripts/nvidia-offload.nix new file mode 100644 index 0000000..9c00505 --- /dev/null +++ b/scripts/nvidia-offload.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: + +pkgs.writeShellScriptBin "nvidia-offload" + '' + export __NV_PRIME_RENDER_OFFLOAD=1 + export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 + export __GLX_VENDOR_LIBRARY_NAME=nvidia + export __VK_LAYER_NV_optimus=NVIDIA_only + exec -a "$0" "$@" + ''