From fbcb58a26bd52d891cf91f5f5eceb97559701326 Mon Sep 17 00:00:00 2001 From: Tristan Date: Tue, 1 Oct 2024 16:45:08 +0100 Subject: [PATCH 1/4] nixbook: remove decryption script, quiet boot --- hardware/fcs-tristan-nixbook.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hardware/fcs-tristan-nixbook.nix b/hardware/fcs-tristan-nixbook.nix index 2d6d179..17d970e 100644 --- a/hardware/fcs-tristan-nixbook.nix +++ b/hardware/fcs-tristan-nixbook.nix @@ -23,14 +23,17 @@ in { options = ["subvol=@" "compress=zstd" "autodefrag"]; }; - boot.initrd.postDeviceCommands = pkgs.lib.mkBefore (decrypt { - keydevice = "/dev/disk/by-id/usb-Generic_Flash_Disk_BCC97785-0:0"; - keypartname = "usbkey"; - }); + boot.initrd.luks.devices."usbkey" = { + device = "/dev/disk/by-id/usb-Generic_Flash_Disk_BCC97785-0:0"; + }; boot.initrd.luks.devices."cryptroot" = { device = "/dev/disk/by-uuid/570cc51f-bd5c-4bee-a18f-f6aabaf60881"; keyFileSize = 4096; + preOpenCommands = '' + mkdir -m 0755 -p /key + mount -n -t vfat -o ro /dev/mapper/usbkey /key + ''; keyFile = "/key/keyfile"; preLVM = false; }; @@ -54,6 +57,11 @@ in { swapDevices = [{device = "/swap/swapfile";}]; + boot.plymouth.enable = true; + boot.initrd.verbose = false; + boot.consoleLogLevel = 1; + boot.kernelParams = [ "quiet" "udev.log_level=3" ]; + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's # still possible to use this option, but it's recommended to use it in conjunction From ea689504976381a4de4781a35556b8523b7070f5 Mon Sep 17 00:00:00 2001 From: Tristan Date: Tue, 1 Oct 2024 22:25:12 +0100 Subject: [PATCH 2/4] nixvim: treesitter, oil and adjust keys --- .rgignore | 2 + lib/nixvim.nix | 131 ++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 110 insertions(+), 23 deletions(-) create mode 100644 .rgignore diff --git a/.rgignore b/.rgignore new file mode 100644 index 0000000..13ba0e2 --- /dev/null +++ b/.rgignore @@ -0,0 +1,2 @@ +lib/words.txt +flake.lock diff --git a/lib/nixvim.nix b/lib/nixvim.nix index aa0f2c2..3091902 100644 --- a/lib/nixvim.nix +++ b/lib/nixvim.nix @@ -5,17 +5,26 @@ opts = { number = true; relativenumber = true; - tabstop = 2; + tabstop = 4; shiftwidth = 2; expandtab = true; smartindent = true; scrolloff = 4; undofile = true; + undodir.__raw = ''vim.fn.expand("$HOME/.local/share/nvim/undo")''; + + list = true; + listchars = builtins.concatStringsSep "," [ + "tab: >" + "leadmultispace: |" + "trail:." + "extends:>" + "precedes:<" + ]; }; extraPlugins = [(pkgs.vimPlugins.actions-preview-nvim)]; extraConfigLua = '' - vim.o.undodir = vim.fn.expand("$HOME/.local/share/nvim/undo") require("actions-preview").setup { highlight_command = { require("actions-preview.highlight").delta("${pkgs.delta}/bin/delta --no-gitconfig --side-by-side"), @@ -49,6 +58,14 @@ require("actions-preview").code_actions ''; } + { + key = ""; + action = "tabnext"; + } + { + key = ""; + action = "tabprev"; + } { key = "gl"; action = "g$"; @@ -57,30 +74,84 @@ key = "gh"; action = "g0"; } + { + mode = "v"; + key = ">"; + action = ">gv"; + options.desc = "indent"; + options.silent = true; + } + { + mode = "v"; + key = "<"; + action = "fg" = "live_grep"; "/" = "live_grep"; @@ -101,6 +177,9 @@ "fb" = "buffers"; "fh" = "help_tags"; ":" = "commands"; + "ft" = "treesitter"; + "fr" = "lsp_references"; + "cr" = "lsp_definition"; }; }; @@ -114,17 +193,6 @@ lspBuf = { "ck" = "hover"; "K" = "hover"; - - # using actions-preview instead - # "ca" = "code_action"; - # "" = "code_action"; - - "cd" = "definition"; - "gd" = "definition"; - - "cf" = "references"; - "gr" = "references"; - "cr" = "rename"; "" = "rename"; }; @@ -148,10 +216,6 @@ lazygit.enable = true; which-key.enable = true; - dap = { - enable = true; - extensions.dap-ui.enable = true; - }; harpoon = { enable = true; keymaps = { @@ -162,6 +226,27 @@ }; vim-css-color.enable = true; + + treesitter = { + enable = true; + folding = true; + }; + treesitter-textobjects = { + enable = true; + select = { + enable = true; + lookahead = true; + keymaps = { + "af" = { query = "@function.outer"; desc = "Function Outer"; }; + "ac" = { query = "@comment.outer"; desc = "Comment Outer"; }; + "if" = { query = "@function.inner"; desc = "Function Inner"; }; + }; + }; + }; + + oil.enable = true; + autoclose.enable = true; + guess-indent.enable = true; }; } From 29bd3b69f800668f741f5f3e9efa372069ef782a Mon Sep 17 00:00:00 2001 From: Tristan Date: Wed, 2 Oct 2024 00:37:09 +0100 Subject: [PATCH 3/4] nixbook: gruvbox theme and fix nixvim cmp --- home/programs/graphical.nix | 9 --------- lib/nixvim.nix | 27 +++++++++++++++++++++++---- nixos/workstation.nix | 16 +++++++++++++++- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/home/programs/graphical.nix b/home/programs/graphical.nix index 628070d..468dd24 100644 --- a/home/programs/graphical.nix +++ b/home/programs/graphical.nix @@ -44,15 +44,6 @@ gtk = { enable = true; - iconTheme = { - name = "Vimix-Doder"; - package = pkgs.vimix-icon-theme; - }; - cursorTheme = { - name = "Vanilla-DMZ"; - package = pkgs.vanilla-dmz; - size = 24; - }; gtk3.bookmarks = [ "file:///home/tristan/Documents" "file:///home/tristan/Pictures/Screenshots" diff --git a/lib/nixvim.nix b/lib/nixvim.nix index 3091902..2d44525 100644 --- a/lib/nixvim.nix +++ b/lib/nixvim.nix @@ -59,11 +59,11 @@ ''; } { - key = ""; + key = ""; action = "tabnext"; } { - key = ""; + key = ""; action = "tabprev"; } { @@ -201,11 +201,29 @@ cmp = { enable = true; - autoEnableSources = true; + settings = { + mapping = { + "" = "cmp.mapping.complete()"; + "" = "cmp.mapping.scroll_docs(4)"; + "" = "cmp.mapping.scroll_docs(-4)"; + "" = "cmp.mapping.close()"; + "" = "cmp.mapping.confirm({ select = true })"; + "" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})"; + "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; + }; + sources = [ + { name = "nvim_lsp"; } + { name = "path"; } + { name = "buffer"; } + ]; + }; }; - cmp-nvim-lsp.enable = true; + cmp-nvim-lsp-signature-help.enable = true; cmp-path.enable = true; + cmp-buffer.enable = true; + + trouble.enable = true; gitsigns.enable = true; git-worktree = { @@ -246,6 +264,7 @@ oil.enable = true; autoclose.enable = true; + ts-autotag.enable = true; guess-indent.enable = true; }; diff --git a/nixos/workstation.nix b/nixos/workstation.nix index 1ab3a81..ebb0c3a 100644 --- a/nixos/workstation.nix +++ b/nixos/workstation.nix @@ -52,13 +52,27 @@ stylix = { enable = true; image = ../images/nix-soft.png; - base16Scheme = "${pkgs.base16-schemes}/share/themes/onedark.yaml"; + base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml"; opacity = { terminal = 0.9; applications = 0.9; desktop = 0.9; popups = 0.9; }; + cursor = { + name = "Vanilla-DMZ"; + package = pkgs.vanilla-dmz; + size = 24; + }; + targets = { + gtk.enable = false; # fails to switch with cosmic overriding it (grr) + grub = { + useImage = true; + }; + nixvim = { + transparentBackground.main = true; + }; + }; }; nixpkgs.overlays = [ From 8874e920d25bcc54c0ab78ad69944ff1986ebc02 Mon Sep 17 00:00:00 2001 From: tristan Date: Thu, 24 Oct 2024 10:45:09 +0100 Subject: [PATCH 4/4] nixbook: element-desktop-wayland --- home/programs/graphical.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/programs/graphical.nix b/home/programs/graphical.nix index 468dd24..6d8b720 100644 --- a/home/programs/graphical.nix +++ b/home/programs/graphical.nix @@ -29,7 +29,7 @@ shortwave # other - element-desktop + element-desktop-wayland brave bitwarden ];