diff --git a/flake.lock b/flake.lock index 4325655..575c7d1 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1725628988, - "narHash": "sha256-Y6TBMTGu4bddUwszGjlcOuN0soVc1Gv43hp+1sT/GNI=", + "lastModified": 1725694918, + "narHash": "sha256-+HsjshXpqNiJHLaJaK0JnIicJ/a1NquKcfn4YZ3ILgg=", "owner": "nix-community", "repo": "home-manager", - "rev": "127ccc3eb7e36fa75e8c3fbd8a343154f66cc1c6", + "rev": "aaebdea769a5c10f1c6e50ebdf5924c1a13f0cda", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1725432240, - "narHash": "sha256-+yj+xgsfZaErbfYM3T+QvEE2hU7UuE+Jf0fJCJ8uPS0=", + "lastModified": 1725634671, + "narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ad416d066ca1222956472ab7d0555a6946746a80", + "rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c", "type": "github" }, "original": { @@ -62,11 +62,11 @@ ] }, "locked": { - "lastModified": 1725575977, - "narHash": "sha256-1e9zB0dMRwdAbhxVATlL25rExMDh4gZ/3AXdkpU8408=", + "lastModified": 1725727445, + "narHash": "sha256-f5TrY73wfL4kvRmEtZXpzgCuxVFlNqMUNY6QSX16IPA=", "owner": "pjones", "repo": "plasma-manager", - "rev": "b82b9ba85c156a5e7f865cc94ed2a4df20cbbf39", + "rev": "1b9c8200d6438c98c427536abbc5b6fd6a5250c8", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 8b99acb..d4f4998 100644 --- a/flake.nix +++ b/flake.nix @@ -17,6 +17,11 @@ url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; + + nixvim = { + url = "github:nix-community/nixvim/nixos-24.05"; + inputs.nixpkgs.follows = "nixos"; + }; }; outputs = { diff --git a/home-manager/apps.nix b/home-manager/apps.nix index 0939b2f..6e8414d 100644 --- a/home-manager/apps.nix +++ b/home-manager/apps.nix @@ -44,11 +44,13 @@ jetbrains.clion jetbrains.idea-ultimate jetbrains.pycharm-professional + jetbrains.rider inkscape inotify-tools libreoffice mullvad-vpn neofetch + obsidian parsec-bin platformio-core python3 @@ -67,6 +69,7 @@ tmux unzip vlc + wakeonlan whatsapp-for-linux zsh ]; diff --git a/home-manager/neovim.nix b/home-manager/neovim.nix deleted file mode 100644 index b5b1e41..0000000 --- a/home-manager/neovim.nix +++ /dev/null @@ -1,124 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - programs.neovim = { - enable = true; - viAlias = true; - vimAlias = true; - extraPackages = with pkgs; [ - # LazyVim - lua-language-server - stylua - # Telescope - ripgrep - ]; - - plugins = with pkgs.vimPlugins; [ - lazy-nvim - ]; - - extraLuaConfig = - let - plugins = with pkgs.vimPlugins; [ - # LazyVim - LazyVim - bufferline-nvim - cmp-buffer - cmp-nvim-lsp - cmp-path - cmp_luasnip - conform-nvim - dashboard-nvim - dressing-nvim - flash-nvim - friendly-snippets - gitsigns-nvim - indent-blankline-nvim - lualine-nvim - neo-tree-nvim - neoconf-nvim - neodev-nvim - noice-nvim - nui-nvim - nvim-cmp - nvim-lint - nvim-lspconfig - nvim-notify - nvim-spectre - nvim-treesitter - nvim-treesitter-context - nvim-treesitter-textobjects - nvim-ts-autotag - nvim-ts-context-commentstring - nvim-web-devicons - persistence-nvim - plenary-nvim - telescope-fzf-native-nvim - telescope-nvim - todo-comments-nvim - tokyonight-nvim - trouble-nvim - vim-illuminate - vim-startuptime - which-key-nvim - { name = "LuaSnip"; path = luasnip; } - { name = "catppuccin"; path = catppuccin-nvim; } - { name = "mini.ai"; path = mini-nvim; } - { name = "mini.bufremove"; path = mini-nvim; } - { name = "mini.comment"; path = mini-nvim; } - { name = "mini.indentscope"; path = mini-nvim; } - { name = "mini.pairs"; path = mini-nvim; } - { name = "mini.surround"; path = mini-nvim; } - ]; - mkEntryFromDrv = drv: - if lib.isDerivation drv then - { name = "${lib.getName drv}"; path = drv; } - else - drv; - lazyPath = pkgs.linkFarm "lazy-plugins" (builtins.map mkEntryFromDrv plugins); - in - '' - require("lazy").setup({ - defaults = { - lazy = true, - }, - dev = { - -- reuse files from pkgs.vimPlugins.* - path = "${lazyPath}", - patterns = { "." }, - -- fallback to download - fallback = true, - }, - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - -- The following configs are needed for fixing lazyvim on nix - -- force enable telescope-fzf-native.nvim - { "nvim-telescope/telescope-fzf-native.nvim", enabled = true }, - -- disable mason.nvim, use programs.neovim.extraPackages - { "williamboman/mason-lspconfig.nvim", enabled = false }, - { "williamboman/mason.nvim", enabled = false }, - -- import/override with your plugins - { import = "plugins" }, - -- treesitter handled by xdg.configFile."nvim/parser", put this line at the end of spec to clear ensure_installed - { "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = {} } }, - }, - }) - ''; - }; - - # https://github.com/nvim-treesitter/nvim-treesitter#i-get-query-error-invalid-node-type-at-position - xdg.configFile."nvim/parser".source = - let - parsers = pkgs.symlinkJoin { - name = "treesitter-parsers"; - paths = (pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins: with plugins; [ - c - lua - ])).dependencies; - }; - in - "${parsers}/parser"; - - # Normal LazyVim config here, see https://github.com/LazyVim/starter/tree/main/lua - xdg.configFile."nvim/lua".source = ../config/lua; -} diff --git a/home-manager/plasma.nix b/home-manager/plasma.nix index 03f73dc..232380b 100644 --- a/home-manager/plasma.nix +++ b/home-manager/plasma.nix @@ -2,10 +2,10 @@ programs.plasma = { enable = true; shortcuts = { - "ActivityManager"."switch-to-activity-037b4336-809c-4a07-a148-9ef660a5cc9c" = "none"; - "ActivityManager"."switch-to-activity-c82192f5-3d2d-4f8d-9c58-364b4cca1b53" = "none"; - "ActivityManager"."switch-to-activity-d15629d7-eac1-4856-990c-e88d4acd7c5d" = ",none,Switch to activity \"Stay Awake\""; - "ActivityManager"."switch-to-activity-df5108d4-687b-4cd3-835e-318d72116b93" = ",none,Switch to activity \"Default\""; + "ActivityManager"."switch-to-activity-037b4336-809c-4a07-a148-9ef660a5cc9c" = [ ]; + "ActivityManager"."switch-to-activity-c82192f5-3d2d-4f8d-9c58-364b4cca1b53" = [ ]; + "ActivityManager"."switch-to-activity-d15629d7-eac1-4856-990c-e88d4acd7c5d" = [ ]; + "ActivityManager"."switch-to-activity-df5108d4-687b-4cd3-835e-318d72116b93" = "\\, \\, ,none,Switch to activity \"Default\""; "KDE Keyboard Layout Switcher"."Switch to Last-Used Keyboard Layout" = "Meta+Alt+L"; "KDE Keyboard Layout Switcher"."Switch to Next Keyboard Layout" = "Meta+Alt+K"; "kaccess"."Toggle Screen Reader On and Off" = "Meta+Alt+S"; @@ -24,7 +24,7 @@ "ksmserver"."Lock Session" = ["Meta+L" "Screensaver,Meta+L" "Screensaver,Lock Session"]; "ksmserver"."Log Out" = "Ctrl+Alt+Del"; "ksmserver"."Log Out Without Confirmation" = "none,,Log Out Without Confirmation"; - "ksmserver"."LogOut" = [ ]; + "ksmserver"."LogOut" = "none,,Log Out"; "ksmserver"."Reboot" = "none,,Reboot"; "ksmserver"."Reboot Without Confirmation" = "none,,Reboot Without Confirmation"; "ksmserver"."Shut Down" = "none,,Shut Down"; @@ -57,14 +57,14 @@ "kwin"."Show Desktop" = "Meta+D"; "kwin"."Suspend Compositing" = "Alt+Shift+F12,none"; "kwin"."Switch One Desktop Down" = "Meta+Ctrl+Down"; - "kwin"."Switch One Desktop Up" = "Meta+Ctrl+Up"; - "kwin"."Switch One Desktop to the Left" = "Meta+Ctrl+Left"; - "kwin"."Switch One Desktop to the Right" = "Meta+Ctrl+Right"; + "kwin"."Switch One Desktop Up" = ["Meta+Ctrl+Left" "Meta+Ctrl+Up,Meta+Ctrl+Up,Switch One Desktop Up"]; + "kwin"."Switch One Desktop to the Left" = "none,Meta+Ctrl+Left,Switch One Desktop to the Left"; + "kwin"."Switch One Desktop to the Right" = "none,Meta+Ctrl+Right,Switch One Desktop to the Right"; "kwin"."Switch Window Down" = "Meta+Alt+Down"; "kwin"."Switch Window Left" = "Meta+Alt+Left"; "kwin"."Switch Window Right" = "Meta+Alt+Right"; "kwin"."Switch Window Up" = "Meta+Alt+Up"; - "kwin"."Switch to Desktop 1" = "none,Ctrl+F1,Switch to Desktop 1"; + "kwin"."Switch to Desktop 1" = "Ctrl+F1"; "kwin"."Switch to Desktop 10" = "none,,Switch to Desktop 10"; "kwin"."Switch to Desktop 11" = "none,,Switch to Desktop 11"; "kwin"."Switch to Desktop 12" = "none,,Switch to Desktop 12"; @@ -75,10 +75,10 @@ "kwin"."Switch to Desktop 17" = "none,,Switch to Desktop 17"; "kwin"."Switch to Desktop 18" = "none,,Switch to Desktop 18"; "kwin"."Switch to Desktop 19" = "none,,Switch to Desktop 19"; - "kwin"."Switch to Desktop 2" = "none,Ctrl+F2,Switch to Desktop 2"; + "kwin"."Switch to Desktop 2" = "Ctrl+F2"; "kwin"."Switch to Desktop 20" = "none,,Switch to Desktop 20"; - "kwin"."Switch to Desktop 3" = "none,Ctrl+F3,Switch to Desktop 3"; - "kwin"."Switch to Desktop 4" = "none,Ctrl+F4,Switch to Desktop 4"; + "kwin"."Switch to Desktop 3" = "Ctrl+F3"; + "kwin"."Switch to Desktop 4" = "Ctrl+F4"; "kwin"."Switch to Desktop 5" = "none,,Switch to Desktop 5"; "kwin"."Switch to Desktop 6" = "none,,Switch to Desktop 6"; "kwin"."Switch to Desktop 7" = "none,,Switch to Desktop 7"; @@ -208,7 +208,7 @@ "org_kde_powerdevil"."Toggle Keyboard Backlight" = "Keyboard Light On/Off"; "org_kde_powerdevil"."Turn Off Screen" = [ ]; "org_kde_powerdevil"."powerProfile" = ["Battery" "Meta+B,Battery" "Meta+B,Switch Power Profile"]; - "plasmashell"."activate application launcher" = ["Meta" "Alt+F1,Meta" "Alt+F1,Activate Application Launcher"]; + "plasmashell"."activate application launcher" = ["Meta" "" "Alt+F1\\, ,Meta" "Alt+F1,Activate Application Launcher"]; "plasmashell"."activate task manager entry 1" = "Meta+1"; "plasmashell"."activate task manager entry 10" = "none,Meta+0,Activate Task Manager Entry 10"; "plasmashell"."activate task manager entry 2" = "Meta+2"; @@ -273,7 +273,7 @@ "kcminputrc"."Libinput/1267/12432/ELAN1200:00 04F3:3090 Touchpad"."Enabled" = true; "kcminputrc"."Mouse"."X11LibInputXAccelProfileFlat" = true; "kded5rc"."Module-browserintegrationreminder"."autoload" = false; - "kded5rc"."Module-device_automounter"."autoload" = true; + "kded5rc"."Module-device_automounter"."autoload" = false; "kdeglobals"."DirSelect Dialog"."DirSelectDialog Size" = "820,584"; "kdeglobals"."General"."AllowKDEAppsToRememberWindowPositions" = true; "kdeglobals"."KDE"."SingleClick" = true; @@ -317,17 +317,17 @@ "kwinrc"."Desktops"."Id_1" = "e1429fd3-ee1a-43d1-a96c-3e98155ffa70"; "kwinrc"."Desktops"."Id_2" = "91da48f0-dcd0-40fa-937a-9f6a40f98a61"; "kwinrc"."Desktops"."Id_3" = "b421dd32-1365-49d6-97a0-e6a2850c864d"; - "kwinrc"."Desktops"."Id_4" = "e34d7226-f09d-4e9e-9fcc-8145b4a5061d"; - "kwinrc"."Desktops"."Id_5" = "4b93dd07-f6e4-40f0-a377-c4a6d7fa32f2"; - "kwinrc"."Desktops"."Id_6" = "d9733a69-faad-45a2-aa97-b93c591c7bf3"; - "kwinrc"."Desktops"."Name_1" = "Basic"; - "kwinrc"."Desktops"."Name_2" = "Communication"; - "kwinrc"."Desktops"."Name_3" = "Parsec"; - "kwinrc"."Desktops"."Name_4" = "Desktop BL"; - "kwinrc"."Desktops"."Name_5" = "Desktop BM"; - "kwinrc"."Desktops"."Name_6" = "Desktop BR"; - "kwinrc"."Desktops"."Number" = 3; - "kwinrc"."Desktops"."Rows" = 3; + "kwinrc"."Desktops"."Id_4" = "083e63b2-d84c-4100-bd4a-fa4d286f6575"; + "kwinrc"."Desktops"."Id_5" = "2e7db0b3-0c21-41da-a9b1-df9e62d7dba3"; + "kwinrc"."Desktops"."Id_6" = "49fd9f05-4801-4829-bc01-dd8e78ee5ce7"; + "kwinrc"."Desktops"."Name_1" = "UL"; + "kwinrc"."Desktops"."Name_2" = "UM"; + "kwinrc"."Desktops"."Name_3" = "UR"; + "kwinrc"."Desktops"."Name_4" = "BL"; + "kwinrc"."Desktops"."Name_5" = "BM"; + "kwinrc"."Desktops"."Name_6" = "BR"; + "kwinrc"."Desktops"."Number" = 6; + "kwinrc"."Desktops"."Rows" = 2; "kwinrc"."Effect-diminactive"."Strength" = 50; "kwinrc"."Effect-magiclamp"."AnimationDuration" = 4096; "kwinrc"."Effect-slide"."HorizontalGap" = 0; @@ -343,7 +343,11 @@ "kwinrc"."Plugins"."minimizeallEnabled" = true; "kwinrc"."Plugins"."shakecursorEnabled" = true; "kwinrc"."Plugins"."translucencyEnabled" = true; - "kwinrc"."Script-desktopchangeosd"."PopupHideDelay" = 200; + "kwinrc"."Script-desktopchangeosd"."PopupHideDelay" = 600; + "kwinrc"."SubSession: 037b4336-809c-4a07-a148-9ef660a5cc9c"."active" = "-1"; + "kwinrc"."SubSession: 037b4336-809c-4a07-a148-9ef660a5cc9c"."count" = 0; + "kwinrc"."SubSession: c82192f5-3d2d-4f8d-9c58-364b4cca1b53"."active" = "-1"; + "kwinrc"."SubSession: c82192f5-3d2d-4f8d-9c58-364b4cca1b53"."count" = 0; "kwinrc"."Tiling"."padding" = 4; "kwinrc"."Tiling/17eb1f34-04ff-505f-99d3-b39b78e9af59"."tiles" = "{\"layoutDirection\":\"horizontal\",\"tiles\":x5b{\"width\":0.25},{\"width\":0.5},{\"width\":0.25}x5d}"; "kwinrc"."Tiling/5e0aab53-ff8f-58db-aaca-df0f46f273c6"."tiles" = "{\"layoutDirection\":\"horizontal\",\"tiles\":x5b{\"width\":0.25},{\"width\":0.5},{\"width\":0.25}x5d}"; @@ -356,6 +360,7 @@ "kwinrc"."Tiling/d02c035d-eef0-5c68-aa2f-2e83d0ba08b1"."tiles" = "{\"layoutDirection\":\"horizontal\",\"tiles\":x5b{\"width\":0.25},{\"width\":0.5},{\"width\":0.25}x5d}"; "kwinrc"."Tiling/d9f463ae-41ec-5300-8544-c0ee67dc8c63"."tiles" = "{\"layoutDirection\":\"horizontal\",\"tiles\":x5b{\"width\":0.25},{\"width\":0.5},{\"width\":0.25}x5d}"; "kwinrc"."Tiling/df6fc5c4-c5b3-553f-b6b9-51ca75717f6e"."tiles" = "{\"layoutDirection\":\"horizontal\",\"tiles\":x5b{\"width\":0.25},{\"width\":0.5},{\"width\":0.25}x5d}"; + "kwinrc"."Tiling/e25cd7d6-e0d8-55e7-92de-7a085da94915"."tiles" = "{\"layoutDirection\":\"horizontal\",\"tiles\":[{\"width\":0.25},{\"width\":0.5},{\"width\":0.25}]}"; "kwinrc"."Tiling/ece7370d-6d13-5618-ad29-14697e609bd2"."tiles" = "{\"layoutDirection\":\"horizontal\",\"tiles\":x5b{\"width\":0.25},{\"width\":0.5},{\"width\":0.25}x5d}"; "kwinrc"."Tiling/f60e4345-d01f-58c0-a5d7-07b5e48a0bdd"."tiles" = "{\"layoutDirection\":\"horizontal\",\"tiles\":x5b{\"width\":0.25},{\"width\":0.5},{\"width\":0.25}x5d}"; "kwinrc"."Windows"."HideUtilityWindowsForInactive" = false; diff --git a/machines/common/configuration.nix b/machines/common/configuration.nix index 4c9c14b..5ed5aa9 100644 --- a/machines/common/configuration.nix +++ b/machines/common/configuration.nix @@ -23,6 +23,11 @@ nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); + programs.nix-ld.enable = true; + programs.nix-ld.libraries = with pkgs; [ + dotnetCorePackages.sdk_9_0 + ]; + nix.nixPath = ["/etc/nix/path"]; environment.etc = lib.mapAttrs' diff --git a/machines/luna/configuration.nix b/machines/luna/configuration.nix index fae626c..9e1adb8 100644 --- a/machines/luna/configuration.nix +++ b/machines/luna/configuration.nix @@ -31,9 +31,9 @@ boot.loader.systemd-boot.enable = true; boot.kernelModules = [ "snd-seq" "snd-rawmidi" ]; - hardware.pulseaudio.enable = true; + hardware.pulseaudio.enable = false; services.jack = { - jackd.enable = true; + jackd.enable = false; alsa.enable = true; loopback.enable = false; }; diff --git a/pkgs/neovim/default.nix b/pkgs/neovim/default.nix new file mode 100644 index 0000000..aad9509 --- /dev/null +++ b/pkgs/neovim/default.nix @@ -0,0 +1,89 @@ +{ inputs, pkgs, ... }: + +{ + imports = [ + inputs.nixvim.homeManagerModules.nixvim + ./language.nix + ./running.nix + ./shortcuts.nix + ]; + + home.packages = [ + # used by telescope find_files and file_browser + pkgs.fd + ]; + + # adds and configures neovim using + # https://github.com/nix-community/nixvim + # todo: git, zooming in and out, + # better indentation, + # latex, competative programming, ... + + # These are some misc thingies + programs.nixvim = { + enable = true; + + withRuby = false; + + colorschemes.onedark = { + enable = true; + settings.style = "darker"; + }; + + clipboard = { + providers.wl-copy.enable = true; + }; + + opts = { + relativenumber = true; + number = true; # Display the absolute line number of the current line + + expandtab = true; + autoindent = true; + shiftwidth = 4; + tabstop = 4; + }; + + # TODO Should be removed when upgrading from 24.05, + # see ./language.nix, plugins.lsp.inlayHints + package = (import inputs.nixos-unstable { inherit (pkgs) system; }).neovim-unwrapped; + + # TODO enable performance stuff once upgrading 24.05 + + plugins = { + lualine.enable = true; + comment.enable = true; + nvim-autopairs.enable = true; + diffview.enable = true; + neoscroll.enable = true; + gitsigns.enable = true; + hop.enable = true; + + # Does not exist yet? + # guess-indent.enable = true; + + toggleterm = { + enable = true; + settings = { + direction = "horizontal"; + size = 15; + }; + }; + + telescope = { + enable = true; + + extensions = { + # better selection ui, used for code actions + ui-select.enable = true; + fzf-native.enable = true; + file-browser = { + enable = true; + settings.hijack_netrw = true; + }; + }; + }; + + }; + }; +} diff --git a/pkgs/neovim/language.nix b/pkgs/neovim/language.nix new file mode 100644 index 0000000..aad9509 --- /dev/null +++ b/pkgs/neovim/language.nix @@ -0,0 +1,89 @@ +{ inputs, pkgs, ... }: + +{ + imports = [ + inputs.nixvim.homeManagerModules.nixvim + ./language.nix + ./running.nix + ./shortcuts.nix + ]; + + home.packages = [ + # used by telescope find_files and file_browser + pkgs.fd + ]; + + # adds and configures neovim using + # https://github.com/nix-community/nixvim + # todo: git, zooming in and out, + # better indentation, + # latex, competative programming, ... + + # These are some misc thingies + programs.nixvim = { + enable = true; + + withRuby = false; + + colorschemes.onedark = { + enable = true; + settings.style = "darker"; + }; + + clipboard = { + providers.wl-copy.enable = true; + }; + + opts = { + relativenumber = true; + number = true; # Display the absolute line number of the current line + + expandtab = true; + autoindent = true; + shiftwidth = 4; + tabstop = 4; + }; + + # TODO Should be removed when upgrading from 24.05, + # see ./language.nix, plugins.lsp.inlayHints + package = (import inputs.nixos-unstable { inherit (pkgs) system; }).neovim-unwrapped; + + # TODO enable performance stuff once upgrading 24.05 + + plugins = { + lualine.enable = true; + comment.enable = true; + nvim-autopairs.enable = true; + diffview.enable = true; + neoscroll.enable = true; + gitsigns.enable = true; + hop.enable = true; + + # Does not exist yet? + # guess-indent.enable = true; + + toggleterm = { + enable = true; + settings = { + direction = "horizontal"; + size = 15; + }; + }; + + telescope = { + enable = true; + + extensions = { + # better selection ui, used for code actions + ui-select.enable = true; + fzf-native.enable = true; + file-browser = { + enable = true; + settings.hijack_netrw = true; + }; + }; + }; + + }; + }; +} diff --git a/pkgs/neovim/running.nix b/pkgs/neovim/running.nix new file mode 100644 index 0000000..4289f27 --- /dev/null +++ b/pkgs/neovim/running.nix @@ -0,0 +1,130 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + # Automaticly open and close dap-ui + extraConfigLuaPost = '' + local dap, dapui = require("dap"), require("dapui") + dap.listeners.before.attach.dapui_config = dapui.open + dap.listeners.before.launch.dapui_config = dapui.open + dap.listeners.before.event_terminated.dapui_config = dapui.close + dap.listeners.before.event_exited.dapui_config = dapui.close + ''; + + + plugins = { + + competitest = { + enable = true; + settings = { + template_file.cpp = "${./cp-template.cpp}"; + evaluate_template_modifiers = true; + date_format = "%Y-%m-%d %H:%M:%S"; + + testcases_use_single_file = true; + testcases_single_file_format = "./tests/$(FNOEXT).testcases"; + + compile_command.cpp = { + exec = "g++"; + args = [ "-Wall" "$(FNAME)" "-o" "./bin/$(FNOEXT)" ]; + }; + run_command.cpp = { + exec = "./bin/$(FNOEXT)"; + }; + }; + }; + + dap = { + enable = true; + + extensions.dap-ui ={ + enable = true; + + layouts = [ + { + elements = [ + { id = "breakpoints"; size = 0.25; } + { id = "stacks"; size = 0.25; } + { id = "watches"; size = 0.25; } + { id = "scopes"; size = 0.25; } + ]; + position = "left"; + size = 40; + } + { + elements = [ + { id = "repl"; size = 0.7; } + { id = "console"; size = 0.3; } + ]; + position = "bottom"; + size = 10; + } + ]; + }; + + signs = { + dapBreakpoint.text = " "; + dapBreakpointCondition.text = " "; + dapBreakpointRejected.text = " "; + dapLogPoint.text = " "; + dapStopped.text = " "; + }; + + adapters.servers = { + # Used for c++ and rust + codelldb = { + port = "\${port}"; + executable = { + command = "${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb"; + args = [ "--port" "\${port}" ]; + }; + }; + }; + + configurations = let + # For all supported subsitutions see :h dap-configuration + workspace = "\${workspaceFolder}"; + in { + cpp = [ + { + name = "Debug cpp file"; + type = "codelldb"; + request = "launch"; + cwd = workspace; + expressions = "native"; + program = { __raw = '' + function() + local sourceFile = vim.fn.expand("%"); + local resFolder = vim.fn.expand("%:h") .. "/bin/" + local exeFile = resFolder .. vim.fn.expand("%:t:r") .. ".dap"; + + -- The -g flag compiles with debug info + vim.system({"mkdir", resFolder}):wait(); + vim.system({"g++", "-g", sourceFile, "-o", exeFile}):wait(); + + return exeFile; + end + ''; }; + } + ]; + rust = [ + { + # Did not get this working: https://github.com/vadimcn/codelldb/blob/master/MANUAL.md#cargo-support + # So instead this follows: https://alighorab.github.io/neovim/nvim-dap/ + name = "Debug cargo project"; + type = "codelldb"; + request = "launch"; + expressions = "native"; + program = { __raw = '' + function () + os.execute("cargo build &> /dev/null") + return "target/debug/''${workspaceFolderBasename}" + end + ''; }; + } + ]; + }; + }; + + }; + }; +} diff --git a/pkgs/neovim/shortcuts.nix b/pkgs/neovim/shortcuts.nix new file mode 100644 index 0000000..f34222b --- /dev/null +++ b/pkgs/neovim/shortcuts.nix @@ -0,0 +1,89 @@ +{ lib, ... }: + +{ + programs.nixvim = { + globals.mapleader = " "; + + keymaps = + let + normalVisual = + lib.mapAttrsToList + (key: action: { + mode = [ "n" "v" ]; + inherit action key; + }) + { + # show terminal + "" = "ToggleTerm"; + + # hop! + "f" = "HopWord"; + + # Setup for custom keybinds + ";" = ""; + "" = ""; + + # Telescope + "f" = "Telescope find_files"; + "b" = "Telescope buffers"; + "d" = "Telescope lsp_definitions"; + "R" = "Telescope lsp_references"; + "e" = "Telescope file_browser"; + "c" = "Telescope git_bcommits"; + "g" = "Telescope git_status"; + + # Lsp + "a" = "lua vim.lsp.buf.code_action()"; + "D" = "lua vim.lsp.buf.declaration()"; + "h" = "lua vim.lsp.buf.hover()"; + "r" = "lua vim.lsp.buf.rename()"; + "o" = "lua vim.diagnostic.open_float()"; + "l" = "lua require('lsp_lines').toggle()"; + + # Debugger + "" = "lua require('dap').continue()"; + "" = "lua require('dap').terminate()"; + "" = "lua require('dap').step_over()"; + "" = "lua require('dap').step_into()"; + "" = "lua require('dap').step_out()"; + ";d" = "lua require('dap').toggle_breakpoint()"; + ";s" = "lua require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: '))"; + + # Competitest + ";r" = "CompetiTest receive problem"; + ";t" = "CompetiTest run"; + ";a" = "CompetiTest add_testcase"; + ";e" = "CompetiTest edit_testcase"; + ";l" = "CompetiTest delete_testcase"; + ";c" = "CompetiTest convert auto"; + + # resize windows with arrows + "" = "resize -2"; + "" = "resize +2"; + "" = "vertical resize +2"; + "" = "vertical resize -2"; + + + # TODO: make shortcuts for diffview + # or use telescope to view git stuff + }; + vni = + lib.mapAttrsToList + (key: action: { + mode = [ "n" "v" "i" ]; + inherit action key; + }) + { + # copy, cut, paste + # TODO: why does pasting work but not copying in visual mode??? + "" = "\\\"+y"; + "" = "\\\"+c"; + "" = "\\\"+p"; + + # saving + "" = "w"; + }; + in + normalVisual ++ vni; + }; +} diff --git a/pkgs/zsh.nix b/pkgs/zsh.nix index a1a2d73..3e64c09 100644 --- a/pkgs/zsh.nix +++ b/pkgs/zsh.nix @@ -15,7 +15,7 @@ rebuild = "sudo nixos-rebuild switch --flake"; update = "sudo nix flake update && rebuild"; compose = "sudo docker compose"; - wolpc = "wakeonlan D8::5E:D3:A8:B1:0A"; + wolpc = "wakeonlan D8:5E:D3:A8:B1:0A"; capture-config = "nix run github:pjones/plasma-manager > ~/nix-config/home-manager/plasma.nix"; reboot-to-windows = "sudo efibootmgr -n 0000"; mkdir = "mkdir -p";