From 360c8b155e5ae7001486a69c91f73660bbf2c464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 8 Dec 2023 16:06:00 +0100 Subject: [PATCH 01/12] refactor: treesitter config --- .../nvim/plugins/lua/nvim-treesitter.lua | 11 +--- modules/programs/nvim/plugins/treesitter.nix | 58 ++++++++++++++++--- 2 files changed, 50 insertions(+), 19 deletions(-) diff --git a/modules/programs/nvim/plugins/lua/nvim-treesitter.lua b/modules/programs/nvim/plugins/lua/nvim-treesitter.lua index e221fdd..4adea21 100644 --- a/modules/programs/nvim/plugins/lua/nvim-treesitter.lua +++ b/modules/programs/nvim/plugins/lua/nvim-treesitter.lua @@ -1,10 +1 @@ -require("nvim-treesitter.configs").setup({ - sync_install = false, - auto_install = false, - highlight = { - enable = true, - }, - context_commentstring = { - enable = true, - }, -}) +require("nvim-treesitter.configs").setup() diff --git a/modules/programs/nvim/plugins/treesitter.nix b/modules/programs/nvim/plugins/treesitter.nix index b76bcbc..29fd25d 100644 --- a/modules/programs/nvim/plugins/treesitter.nix +++ b/modules/programs/nvim/plugins/treesitter.nix @@ -6,22 +6,62 @@ with builtins; { plugin = nvim-treesitter; event = [ "BufReadPost" "BufNewFile" ]; + opts = { + sync_install = false; + auto_install = false; + highlight = { + enable = true; + }; + context_commentstring = { + enable = true; + }; + textobjects = + { + select = + { + enable = true; + + # Automatically jump forward to textobj, similar to targets.vim + lookahead = false; + + keymaps = { + # You can use the capture groups defined in textobjects.scm + "af" = { + query = "@function.outer"; + desc = "Select outer part of a function region"; + }; + "if" = { + query = "@function.inner"; + desc = "Select inner part of a function region"; + }; + "ac" = { + query = "@class.outer"; + desc = "Select outer part of a class region"; + }; + "ic" = { + query = "@class.inner"; + desc = "Select inner part of a class region"; + }; + }; + }; + }; + }; conf = let - parserDir = pkgs.symlinkJoin { - name = "tresitter-grammars-all"; - paths = lib.attrValues (lib.filterAttrs (_: builtins.isAttrs) nvim-treesitter-parsers); - }; + parserDir = pkgs.symlinkJoin + { + name = "tresitter-grammars-all"; + paths = lib.attrValues (lib.filterAttrs (_: builtins.isAttrs) nvim-treesitter-parsers); + }; in - readFile ./lua/nvim-treesitter.lua + '' + '' vim.opt.runtimepath:append("${parserDir}") - - require'nvim-treesitter.configs'.setup { - parser_install_dir = "${parserDir}", - } + local final_opts = vim.tbl_deep_extend("keep", opts, { parser_install_dir = "${parserDir}" }) + require('nvim-treesitter.configs').setup(final_opts) ''; dependencies = [ { plugin = nvim-ts-context-commentstring; } + { plugin = nvim-treesitter-textobjects; } ]; } { From da6601884ddb02176dc3db904a3c4c2b22c3b5fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 8 Dec 2023 16:06:54 +0100 Subject: [PATCH 02/12] refator: make nix-super rebuild less often --- flake.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/flake.nix b/flake.nix index 49a344b..e77e7d2 100644 --- a/flake.nix +++ b/flake.nix @@ -21,7 +21,6 @@ nix-index-database.inputs.nixpkgs.follows = "nixpkgs"; # Programs - nix-super.inputs.nixpkgs.follows = "stable"; nix-super.url = "github:privatevoid-net/nix-super/ba035e1ea339a97e6ba6a1dd79e0c0e334240234"; rofi-wayland.flake = false; rofi-wayland.url = "github:lbonn/rofi/wayland"; From a02aeede107d319749967c839aca9196620ac002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 8 Dec 2023 16:07:24 +0100 Subject: [PATCH 03/12] feat(nvim)!:remove mini starter and animate --- modules/programs/nvim/plugins/lua/mini-nvim.lua | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/modules/programs/nvim/plugins/lua/mini-nvim.lua b/modules/programs/nvim/plugins/lua/mini-nvim.lua index f2c42d3..2a33821 100644 --- a/modules/programs/nvim/plugins/lua/mini-nvim.lua +++ b/modules/programs/nvim/plugins/lua/mini-nvim.lua @@ -1,6 +1,5 @@ require("mini.align").setup() require("mini.move").setup() -require("mini.starter").setup() require("mini.statusline").setup({ content = { @@ -46,15 +45,3 @@ for _, mode_hl in ipairs(MiniStatuslineModes) do hl_table.bg = fg vim.api.nvim_set_hl(0, mode_hl .. "Inverse", hl_table) end - -local animate = require("mini.animate") -local animation = { - timing = animate.gen_timing.quadratic({ duration = 100, unit = "total" }), -} -animate.setup({ - cursor = animation, - scroll = { enable = false }, - resize = animation, - open = animation, - close = animation, -}) From b880e27deb340382148b6b9b74a0d77ea71a2b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 8 Dec 2023 16:11:37 +0100 Subject: [PATCH 04/12] refactor: remove unused dependency --- modules/programs/nvim/plugins/coding.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/programs/nvim/plugins/coding.nix b/modules/programs/nvim/plugins/coding.nix index 44c2839..a4ace75 100644 --- a/modules/programs/nvim/plugins/coding.nix +++ b/modules/programs/nvim/plugins/coding.nix @@ -55,7 +55,6 @@ with builtins; ]; opts = { }; dependencies = [ - { plugin = which-key-nvim; } { plugin = nvim-web-devicons; } ]; } From 4848428c30323e6b52ce404d47fe4596152afa38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 8 Dec 2023 16:12:15 +0100 Subject: [PATCH 05/12] chore: update inputs --- flake.lock | 218 ++++++++++++++++++++++++++++------------------------- 1 file changed, 116 insertions(+), 102 deletions(-) diff --git a/flake.lock b/flake.lock index ca84631..febfaed 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "actions-preview-nvim": { "flake": false, "locked": { - "lastModified": 1692778077, - "narHash": "sha256-5HzyrYWGTdorG4JXMv0iQNj9EM702+8g7E18Oct1JiY=", + "lastModified": 1701784064, + "narHash": "sha256-3VURlbunovftW2+wqRPGFDVwrx7bErbrc2Zjkd3MOUM=", "owner": "aznhe21", "repo": "actions-preview.nvim", - "rev": "5650c76abfb84d6498330dd045657ba630ecdbba", + "rev": "8f79029a36ab6807478f157538a91ccd4af5858f", "type": "github" }, "original": { @@ -25,11 +25,11 @@ ] }, "locked": { - "lastModified": 1696775529, - "narHash": "sha256-TYlE4B0ktPtlJJF9IFxTWrEeq+XKG8Ny0gc2FGEAdj0=", + "lastModified": 1701216516, + "narHash": "sha256-jKSeJn+7hZ1dZdiH1L+NWUGT2i/BGomKAJ54B9kT06Q=", "owner": "ryantm", "repo": "agenix", - "rev": "daf42cb35b2dc614d1551e37f96406e4c4a2d3e4", + "rev": "13ac9ac6d68b9a0896e3d43a082947233189e247", "type": "github" }, "original": { @@ -41,11 +41,11 @@ "arkenfox-userjs": { "flake": false, "locked": { - "lastModified": 1697641173, - "narHash": "sha256-YuGEgJ4bSwvlfSgsUR2s6r1L3ZCdD8pvyU+pY4q+DMk=", + "lastModified": 1700833105, + "narHash": "sha256-8mxKaA0yGx29X+E0ahCjsGXSc29I1+5timNP6cJHGM0=", "owner": "arkenfox", "repo": "user.js", - "rev": "35e8def0b1e5ecf1198e7efe41cfe6aa0415b320", + "rev": "4a510a4b4ceda8a177831a77309f2faccf7e18d5", "type": "github" }, "original": { @@ -81,11 +81,11 @@ ] }, "locked": { - "lastModified": 1696985954, - "narHash": "sha256-dU1lYBWHqxkvbJV3B9oPeqLL0H8FkSKEqjPie+9xPgQ=", + "lastModified": 1701196468, + "narHash": "sha256-xZ1S+8NgxOurbYqh7n3wR3cw+FTP8DyCdb5lg7X+8kw=", "owner": "jcdickinson", "repo": "codeium.nvim", - "rev": "822e762567a0bf50b1a4e733c8c93691934d7606", + "rev": "fd9c9030d402baf2a01cc9db08c39772c0a60324", "type": "github" }, "original": { @@ -122,11 +122,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1698410321, - "narHash": "sha256-MphuSlgpmKwtJncGMohryHiK55J1n6WzVQ/OAfmfoMc=", + "lastModified": 1701787589, + "narHash": "sha256-ce+oQR4Zq9VOsLoh9bZT8Ip9PaMLcjjBUHVPzW5d7Cw=", "owner": "numtide", "repo": "devshell", - "rev": "1aed986e3c81a4f6698e85a7452cbfcc4b31a36e", + "rev": "44ddedcbcfc2d52a76b64fb6122f209881bd3e1e", "type": "github" }, "original": { @@ -140,11 +140,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1698422527, - "narHash": "sha256-SDu3Xg263t3oXIyTaH0buOvFnKIDeZsvKDBtOz+jRbs=", + "lastModified": 1701905325, + "narHash": "sha256-lda63LmEIlDMeCgWfjr3/wb487XPllBByfrGRieyEk4=", "owner": "nix-community", "repo": "disko", - "rev": "944d338d24a9d043a3f7461c30ee6cfe4f9cca30", + "rev": "1144887c6f4d2dcbb2316a24364ef53e25b0fcfe", "type": "github" }, "original": { @@ -206,11 +206,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1698579227, - "narHash": "sha256-KVWjFZky+gRuWennKsbo6cWyo7c/z/VgCte5pR9pEKg=", + "lastModified": 1701473968, + "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "f76e870d64779109e41370848074ac4eaa1606ec", + "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", "type": "github" }, "original": { @@ -266,11 +266,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", "type": "github" }, "original": { @@ -402,11 +402,11 @@ ] }, "locked": { - "lastModified": 1698795315, - "narHash": "sha256-fF5ScAWLMHXOuqsbLSG137kS1D+gr9JPtm4H2c4yBbU=", + "lastModified": 1701728041, + "narHash": "sha256-x0pyrI1vC8evVDxCxyO6olOyr4wlFg9+VS3C3p4xFYQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "9bc7d84b8213255ecd5eb6299afdb77c36ece71d", + "rev": "ac7216918cd65f3824ba7817dea8f22e61221eaf", "type": "github" }, "original": { @@ -420,11 +420,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1698687579, - "narHash": "sha256-BWqQQLhpuQolMiLMTcsc8cNlNzI9+MG/uc184IlP2nA=", + "lastModified": 1700963402, + "narHash": "sha256-JhkanLmYRLekGOysO6JpCWKPlgRoemHPzUrARCGBqYA=", "owner": "hyprwm", "repo": "contrib", - "rev": "bfd3e0efc1af9654808e644b157eb3c170c26fa1", + "rev": "65e567a81176d39be7ce6513d1af23954f00cbec", "type": "github" }, "original": { @@ -442,11 +442,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1698802123, - "narHash": "sha256-Tpx1U6IlnD+wrSvUrBwEvwvK5D8cifIdppB9CwpVQdo=", + "lastModified": 1701988578, + "narHash": "sha256-44jQ4XMNP5ql3fdXLN+SCEnKfZcK1aY34koIwFLWgYw=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "7b32b4214d028a173c8192bddaa9e43503326080", + "rev": "6fb1b89b982eea26ecae75b93f1742537c4f31ae", "type": "github" }, "original": { @@ -485,11 +485,11 @@ "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1698097178, - "narHash": "sha256-W4W3pAYNpXp0jLZwK0Bxw6R7n2/UYxp+lnT5mD2/xEM=", + "lastModified": 1701083219, + "narHash": "sha256-0j4Poy2OEZ55GWagfj6ookxG6jXdsDHZLh6vU3DBuz4=", "owner": "hyprwm", "repo": "hyprpaper", - "rev": "d6856adaffb77a9cc1aac3d04d98276eaa5602a4", + "rev": "b94f84605d6d6d8d3c17a42a72fc3b01df69ab7f", "type": "github" }, "original": { @@ -531,11 +531,11 @@ }, "master": { "locked": { - "lastModified": 1698838244, - "narHash": "sha256-uOrd51CisNyM0V+Y+c8uXIQSxQYKKBaINsYtd5I9bJU=", + "lastModified": 1702047654, + "narHash": "sha256-GYTb8in0dHg7/iaFmCcle8A+Ab85HpX9L57dIDpZKiw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "4be2d0ba3e43534ad23217d66d3abd60613f08ce", + "rev": "0e342e3226b7f25d82a413b09454e5bff8778e53", "type": "github" }, "original": { @@ -637,11 +637,11 @@ ] }, "locked": { - "lastModified": 1698550809, - "narHash": "sha256-Um8+Wi6EAH5dCgfgl7OqaVd4wFJn6FKLafcP5QPr/98=", + "lastModified": 1701980277, + "narHash": "sha256-qSMnoUIZl3lyaAXgXGQ4qnA5jufnNrBAI0bYw7kJgtE=", "owner": "Mic92", "repo": "nix-index-database", - "rev": "1f0981f5baeb78e3c89a8980ff1a39f06876fa8c", + "rev": "ca1f1798f63ada20dffcb8b23039b00a597dafe9", "type": "github" }, "original": { @@ -669,9 +669,7 @@ "inputs": { "flake-compat": "flake-compat_2", "lowdown-src": "lowdown-src", - "nixpkgs": [ - "stable" - ], + "nixpkgs": "nixpkgs_7", "nixpkgs-regression": "nixpkgs-regression" }, "locked": { @@ -708,11 +706,11 @@ "nixpkgs-lib": { "locked": { "dir": "lib", - "lastModified": 1696019113, - "narHash": "sha256-X3+DKYWJm93DRSdC5M6K5hLqzSya9BjibtBsuARoPco=", + "lastModified": 1701253981, + "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f5892ddac112a1e9b3612c39af1b72987ee5783a", + "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", "type": "github" }, "original": { @@ -755,6 +753,22 @@ "type": "github" } }, + "nixpkgs_10": { + "locked": { + "lastModified": 1692934111, + "narHash": "sha256-9EEE59v/esKNMR5zKbLRV9NoRPYvERw5jHQOnfr47bk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1e44a037bbf4fcaba041436e65e87be88f3f495b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1697915759, @@ -789,11 +803,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1698134075, - "narHash": "sha256-foCD+nuKzfh49bIoiCBur4+Fx1nozo+4C/6k8BYk4sg=", + "lastModified": 1700612854, + "narHash": "sha256-yrQ8osMD+vDLGFX7pcwsY/Qr5PUd6OmDMYJZzZi0+zc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8efd5d1e283604f75a808a20e6cde0ef313d07d4", + "rev": "19cbff58383a4ae384dea4d1d0c823d72b49d614", "type": "github" }, "original": { @@ -837,11 +851,27 @@ }, "nixpkgs_7": { "locked": { - "lastModified": 1698553279, - "narHash": "sha256-T/9P8yBSLcqo/v+FTOBK+0rjzjPMctVymZydbvR/Fak=", + "lastModified": 1695283060, + "narHash": "sha256-CJz71xhCLlRkdFUSQEL0pIAAfcnWFXMzd9vXhPrnrEg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "31ed632c692e6a36cfc18083b88ece892f863ed4", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_8": { + "locked": { + "lastModified": 1701693815, + "narHash": "sha256-7BkrXykVWfkn6+c1EhFA3ko4MLi3gVG0p9G96PNnKTM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "90e85bc7c1a6fc0760a94ace129d3a1c61c3d035", + "rev": "09ec6a0881e1a36c29d67497693a67a16f4da573", "type": "github" }, "original": { @@ -851,7 +881,7 @@ "type": "github" } }, - "nixpkgs_8": { + "nixpkgs_9": { "locked": { "lastModified": 1689261696, "narHash": "sha256-LzfUtFs9MQRvIoQ3MfgSuipBVMXslMPH/vZ+nM40LkA=", @@ -867,30 +897,14 @@ "type": "github" } }, - "nixpkgs_9": { - "locked": { - "lastModified": 1692934111, - "narHash": "sha256-9EEE59v/esKNMR5zKbLRV9NoRPYvERw5jHQOnfr47bk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "1e44a037bbf4fcaba041436e65e87be88f3f495b", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "none-ls-nvim": { "flake": false, "locked": { - "lastModified": 1698458199, - "narHash": "sha256-r8CyCvGVJG7hLAIlonaqzjxAiybRySkRe/Y9c4krQXE=", + "lastModified": 1701961425, + "narHash": "sha256-hLGai3rrA1tVWn4XdLO/z9dNo6X9tyhVbnnDPvJhuzw=", "owner": "nvimtools", "repo": "none-ls.nvim", - "rev": "b8fd44ee1616e6a9c995ed5f94ad9f1721d303ef", + "rev": "45d0e8fa9094dcc3fabad9065a5822af9cf099c7", "type": "github" }, "original": { @@ -901,11 +915,11 @@ }, "nur": { "locked": { - "lastModified": 1698835584, - "narHash": "sha256-2ljVCc2VjvdnRhKRzfZfGwS3mrsHO24Nsr7zf5NxTIg=", + "lastModified": 1702043062, + "narHash": "sha256-Q4iifG2pgHJ09zrxHIeVbSPnhpGsP0ssRbA0x9rVM6s=", "owner": "nix-community", "repo": "NUR", - "rev": "4c248463ef00cf5a5116940f36f8c154b78b4ded", + "rev": "4ca441c58bbfaa1728c4a5b4115f79569f6ff186", "type": "github" }, "original": { @@ -917,11 +931,11 @@ "nvim-lspconfig": { "flake": false, "locked": { - "lastModified": 1698537974, - "narHash": "sha256-8io/dDbFRUyBgzg+oVdpJCGhm59d+AwstyHs9OAWlkY=", + "lastModified": 1702007833, + "narHash": "sha256-4Ogx+58962qoph8iMyHBGEqoRARK5KQAYEaa1wsgdsw=", "owner": "neovim", "repo": "nvim-lspconfig", - "rev": "d0467b9574b48429debf83f8248d8cee79562586", + "rev": "511609ae0311abfcfaed3c398429a147e895ce2c", "type": "github" }, "original": { @@ -933,11 +947,11 @@ "nvim-puppeteer": { "flake": false, "locked": { - "lastModified": 1698399688, - "narHash": "sha256-dXeY7O7Qh+1f5qZuZiCF1/3g2xXsb7sDpWr9IhYaeXw=", + "lastModified": 1702039678, + "narHash": "sha256-gapO2oSprw85a5BKFi+rhB11edGwB1JqATQUBudqKHU=", "owner": "chrisgrieser", "repo": "nvim-puppeteer", - "rev": "f3c06a83d24d2af9809c76dc5ec6e4ee1cfc21b6", + "rev": "486502b9c8207b53459061783310bca5f476c48b", "type": "github" }, "original": { @@ -968,15 +982,15 @@ "flake-compat": "flake-compat_3", "flake-utils": "flake-utils_3", "gitignore": "gitignore", - "nixpkgs": "nixpkgs_8", + "nixpkgs": "nixpkgs_9", "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1698227354, - "narHash": "sha256-Fi5H9jbaQLmLw9qBi/mkR33CoFjNbobo5xWdX4tKz1Q=", + "lastModified": 1700922917, + "narHash": "sha256-ej2fch/T584b5K9sk1UhmZF7W6wEfDHuoUYpFN8dtvM=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "bd38df3d508dfcdff52cd243d297f218ed2257bf", + "rev": "e5ee5c5f3844550c01d2131096c7271cec5e9b78", "type": "github" }, "original": { @@ -988,11 +1002,11 @@ "rofi-wayland": { "flake": false, "locked": { - "lastModified": 1697052256, - "narHash": "sha256-3mTmwoeP7yUg7ldbatvQB+hwHhwuHOoZZb1ozWwSsVw=", + "lastModified": 1701359387, + "narHash": "sha256-AjZMjEKv3Ksp93KMJoPibgb/ibNlgt3WKez8WMsY4a0=", "owner": "lbonn", "repo": "rofi", - "rev": "5cd1e3ca2b6b896b2e591b465cc590479ef07aab", + "rev": "36621af0e49e1272fcafb161e1dbf0c1345b394f", "type": "github" }, "original": { @@ -1025,7 +1039,7 @@ "nix-index-database": "nix-index-database", "nix-lazy-nvim": "nix-lazy-nvim", "nix-super": "nix-super", - "nixpkgs": "nixpkgs_7", + "nixpkgs": "nixpkgs_8", "none-ls-nvim": "none-ls-nvim", "nur": "nur", "nvim-lspconfig": "nvim-lspconfig", @@ -1057,11 +1071,11 @@ }, "stable": { "locked": { - "lastModified": 1698696950, - "narHash": "sha256-FHFL58t6lMumvWqwundC8fDDDLOIvc+JJBNIAlPjrDY=", + "lastModified": 1701615100, + "narHash": "sha256-7VI84NGBvlCTduw2aHLVB62NvCiZUlALLqBe5v684Aw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "017ef2132a5bda50bd713aeabce8f918502d4ec1", + "rev": "e9f06adb793d1cca5384907b3b8a4071d5d7cb19", "type": "github" }, "original": { @@ -1180,7 +1194,7 @@ "timers": { "inputs": { "naersk": "naersk", - "nixpkgs": "nixpkgs_9", + "nixpkgs": "nixpkgs_10", "utils": "utils" }, "locked": { @@ -1219,18 +1233,18 @@ "flake": false, "locked": { "host": "gitlab.freedesktop.org", - "lastModified": 1697909146, - "narHash": "sha256-jU0I6FoCKnj4zIBL4daosFWh81U1fM719Z6cae8PxSY=", + "lastModified": 1701368958, + "narHash": "sha256-7kvyoA91etzVEl9mkA/EJfB6z/PltxX7Xc4gcr7/xlo=", "owner": "wlroots", "repo": "wlroots", - "rev": "47bf87ade2bd32395615a385ebde1fefbcdf79a2", + "rev": "5d639394f3e83b01596dcd166a44a9a1a2583350", "type": "gitlab" }, "original": { "host": "gitlab.freedesktop.org", "owner": "wlroots", "repo": "wlroots", - "rev": "47bf87ade2bd32395615a385ebde1fefbcdf79a2", + "rev": "5d639394f3e83b01596dcd166a44a9a1a2583350", "type": "gitlab" } }, @@ -1250,11 +1264,11 @@ ] }, "locked": { - "lastModified": 1697981233, - "narHash": "sha256-y8q4XUwx+gVK7i2eLjfR32lVo7TYvEslyzrmzYEaPZU=", + "lastModified": 1700508250, + "narHash": "sha256-X4o/mifI7Nhu0UKYlxx53wIC+gYDo3pVM9L2u3PE2bE=", "owner": "hyprwm", "repo": "xdg-desktop-portal-hyprland", - "rev": "22e7a65ff9633e1dedfa5317fdffc49f68de2ff2", + "rev": "eb120ff25265ecacd0fc13d7dab12131b60d0f47", "type": "github" }, "original": { From 6847ada8aec82182e9181d6774ea910f0701ac57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 8 Dec 2023 17:47:13 +0100 Subject: [PATCH 06/12] feat: resize boot partition --- flake.lock | 6 +++--- hosts/nixos-laptop/disko.nix | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index d8f53d5..1831a16 100644 --- a/flake.lock +++ b/flake.lock @@ -883,11 +883,11 @@ }, "nixpkgs_8": { "locked": { - "lastModified": 1701237617, - "narHash": "sha256-Ryd8xpNDY9MJnBFDYhB37XSFIxCPVVVXAbInNPa95vs=", + "lastModified": 1701626906, + "narHash": "sha256-ugr1QyzzwNk505ICE4VMQzonHQ9QS5W33xF2FXzFQ00=", "owner": "nixos", "repo": "nixpkgs", - "rev": "85306ef2470ba705c97ce72741d56e42d0264015", + "rev": "0c6d8c783336a59f4c59d4a6daed6ab269c4b361", "type": "github" }, "original": { diff --git a/hosts/nixos-laptop/disko.nix b/hosts/nixos-laptop/disko.nix index 6540b2b..6efc317 100644 --- a/hosts/nixos-laptop/disko.nix +++ b/hosts/nixos-laptop/disko.nix @@ -12,7 +12,7 @@ type = "gpt"; partitions = { ESP = { - size = "64M"; + size = "512M"; type = "EF00"; content = { type = "filesystem"; From 1b22c1345fae128616e4293f2d389475494d650e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 8 Dec 2023 19:19:56 +0100 Subject: [PATCH 07/12] feat(desktop)!: switch to zfs --- hosts/nixos-desktop/default.nix | 15 +-- hosts/nixos-desktop/disko.nix | 119 ++++++++++++++++++ .../nixos-desktop/hardware-configuration.nix | 38 ------ hosts/nixos-laptop/default.nix | 19 +-- modules/profiles/impermanence.nix | 95 ++++++++++++++ modules/programs/hyprland/default.nix | 2 - 6 files changed, 219 insertions(+), 69 deletions(-) create mode 100644 hosts/nixos-desktop/disko.nix create mode 100644 modules/profiles/impermanence.nix diff --git a/hosts/nixos-desktop/default.nix b/hosts/nixos-desktop/default.nix index 2edef3d..1d29c32 100644 --- a/hosts/nixos-desktop/default.nix +++ b/hosts/nixos-desktop/default.nix @@ -9,6 +9,7 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + ./disko.nix ]; my = { @@ -16,6 +17,7 @@ desktop.enable = true; gaming.enable = true; personal.enable = true; + impermanence.enable = true; }; programs.hyprland = { nvidiaSupport = true; @@ -52,17 +54,8 @@ # BOOT - supportedFilesystems = [ "btrfs" "ntfs" ]; - loader = { - grub = { - enable = true; - device = "nodev"; - efiSupport = true; - useOSProber = true; - }; - efi.canTouchEfiVariables = true; - }; - + supportedFilesystems = [ "zfs" "btrfs" "ntfs" ]; + loader.systemd-boot.enable = true; kernelModules = [ "lm92" "drivetemp" ]; }; diff --git a/hosts/nixos-desktop/disko.nix b/hosts/nixos-desktop/disko.nix new file mode 100644 index 0000000..96d8b60 --- /dev/null +++ b/hosts/nixos-desktop/disko.nix @@ -0,0 +1,119 @@ +{ pkgs, ... }: + +{ + # needed for zfs pool + networking.hostId = "1f8b8073"; + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/disk/by-id/ata-Samsung_SSD_850_EVO_500GB_S2RBNX0J351943M"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + encryptedSwap = { + size = "8G"; + content = { + type = "swap"; + randomEncryption = true; + }; + }; + zfs = { + size = "100%"; + content = { + type = "zfs"; + pool = "zroot"; + }; + }; + }; + }; + }; + }; + zpool = { + zroot = { + type = "zpool"; + rootFsOptions = { + compression = "zstd"; + "com.sun:auto-snapshot" = "false"; + "acltype" = "posixacl"; # NOTE: needed for systemd https://github.com/NixOS/nixpkgs/issues/16954 + }; + mountpoint = null; + + datasets = { + encrypted = { + type = "zfs_fs"; + options = { + mountpoint = "none"; + encryption = "aes-256-gcm"; + keyformat = "passphrase"; + }; + # use this to read the key during boot + postCreateHook = '' + zfs set keylocation="prompt" "zroot/$name"; + ''; + }; + "encrypted/root" = { + type = "zfs_fs"; + options.mountpoint = "legacy"; + mountpoint = "/"; + postCreateHook = "zfs snapshot zroot/encrypted/root@blank"; + }; + "encrypted/nix" = { + type = "zfs_fs"; + options.mountpoint = "legacy"; + mountpoint = "/nix"; + }; + "encrypted/persist" = { + type = "zfs_fs"; + options.mountpoint = "legacy"; + mountpoint = "/persist"; + options."com.sun:auto-snapshot" = "true"; + }; + }; + }; + }; + }; + # rollback to blank + boot.initrd.systemd.services.rollback = { + description = "Rollback ZFS datasets to a pristine state"; + wantedBy = [ + "initrd.target" + ]; + after = [ + "zfs-import-zroot.service" + ]; + before = [ + "sysroot.mount" + ]; + path = with pkgs; [ + zfs + ]; + unitConfig.DefaultDependencies = "no"; + serviceConfig.Type = "oneshot"; + script = '' + zfs rollback -r zroot/encrypted/root@blank && echo "rollback complete" + ''; + }; + fileSystems."/persist".neededForBoot = true; + # HACK: to fix issue of agenix running before impermanence + age.identityPaths = [ + "/etc/ssh/ssh_host_ed25519_key" + "/etc/ssh/ssh_host_rsa_key" + "/persist/etc/ssh/ssh_host_ed25519_key" + "/persist/etc/ssh/ssh_host_rsa_key" + ]; + services.zfs = { + autoScrub.enable = true; + trim.enable = true; + autoSnapshot.enable = true; + }; +} diff --git a/hosts/nixos-desktop/hardware-configuration.nix b/hosts/nixos-desktop/hardware-configuration.nix index 75c7ac5..ce0041c 100644 --- a/hosts/nixos-desktop/hardware-configuration.nix +++ b/hosts/nixos-desktop/hardware-configuration.nix @@ -16,44 +16,6 @@ kernelModules = [ "kvm-amd" ]; extraModulePackages = [ ]; }; - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/668a49b3-d169-461f-861d-0c3e6a1642d1"; - fsType = "btrfs"; - options = [ "subvol=root" "compress=zstd" ]; - }; - - "/home" = { - device = "/dev/disk/by-uuid/668a49b3-d169-461f-861d-0c3e6a1642d1"; - fsType = "btrfs"; - options = [ "subvol=home" "compress=zstd" ]; - }; - - "/nix" = { - device = "/dev/disk/by-uuid/668a49b3-d169-461f-861d-0c3e6a1642d1"; - fsType = "btrfs"; - options = [ "subvol=nix" "compress=zstd" ]; - }; - - "/var/log" = { - device = "/dev/disk/by-uuid/668a49b3-d169-461f-861d-0c3e6a1642d1"; - fsType = "btrfs"; - options = [ "subvol=log" "compress=zstd" ]; - neededForBoot = true; - }; - - "/boot" = { - device = "/dev/disk/by-uuid/297B-C04C"; - fsType = "vfat"; - }; - - "/media/games" = { - device = "/dev/disk/by-uuid/8f92ff36-a685-4a67-a3d4-55136dc5f286"; - fsType = "ext4"; - }; - }; - - swapDevices = [{ device = "/dev/disk/by-uuid/00ad6f74-f23e-4ac0-abfb-89bdfe5ab8ae"; }]; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; diff --git a/hosts/nixos-laptop/default.nix b/hosts/nixos-laptop/default.nix index 2709bcf..953f8cb 100644 --- a/hosts/nixos-laptop/default.nix +++ b/hosts/nixos-laptop/default.nix @@ -3,14 +3,12 @@ # and in the NixOS manual (accessible by running ‘nixos-help’). { pkgs , inputs -, lib , ... }: { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix ./disko.nix - ./impermanence.nix ]; my = { @@ -20,25 +18,10 @@ desktop.enable = true; personal.enable = true; webis.enable = true; + impermanence.enable = true; }; }; - environment.systemPackages = [ - ( - pkgs.writeShellApplication { - name = "zfs-diff"; - runtimeInputs = with pkgs; [ zfs coreutils parallel tree ]; - text = '' - zfs diff -F zroot/encrypted/root@blank | awk '$2 == "F" && system("test -e /persist/"$3) != 0 { print $3 }' 2>/dev/null | tree --fromfile . "$@" - ''; - } - ) - ]; - - home-manager.users.moritz.home.packages = with pkgs; [ - # jetbrains.idea-ultimate - ]; - # BOOT boot = { supportedFilesystems = [ "zfs" ]; diff --git a/modules/profiles/impermanence.nix b/modules/profiles/impermanence.nix new file mode 100644 index 0000000..89bfacd --- /dev/null +++ b/modules/profiles/impermanence.nix @@ -0,0 +1,95 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.my.profiles.impermanence; +in +{ + options.my.profiles.impermanence.enable = mkEnableOption "impermanence"; + + config = mkIf cfg.enable { + age.secrets = { + root-password.file = ../../secrets/root-password.age; + moritz-password.file = ../../secrets/moritz-password.age; + }; + users.users = { + root.hashedPasswordFile = config.age.secrets.root-password.path; + moritz.hashedPasswordFile = config.age.secrets.moritz-password.path; + }; + users.mutableUsers = false; + environment.persistence."/persist" = { + hideMounts = true; + directories = [ + "/etc/NetworkManager/system-connections" + "/var/db/dhcpcd/" + "/var/lib/NetworkManager/" + "/var/lib/bluetooth" + "/var/lib/nixos" + "/var/lib/systemd/coredump" + "/var/log" + ]; + files = [ + "/etc/machine-id" + "/etc/nix/id_rsa" + "/etc/ssh/ssh_host_ed25519_key" + "/etc/ssh/ssh_host_ed25519_key.pub" + "/etc/ssh/ssh_host_rsa_key" + "/etc/ssh/ssh_host_rsa_key.pub" + ]; + users.moritz = { + directories = [ + ".SynologyDrive/data" + ".SynologyDrive/log" + ".cache/keepassxc" + ".cache/nvim/luac" + ".config/Nextcloud" + ".config/keepassxc" + ".local/share/direnv" + ".local/share/nvim" + ".local/share/zoxide" + ".local/share/JetBrains" + ".config/JetBrains" + ".local/state/nvim" + ".config/kdeconnect" + ".cat_installer" # eduroam + ".mozilla" + "Documents" + "Downloads" + "Music" + "Pictures" + "Videos" + { directory = ".gnupg"; mode = "0700"; } + { directory = ".local/share/keyrings"; mode = "0700"; } + { directory = ".ssh"; mode = "0700"; } + ]; + files = [ + ".local/share/fish/fish_history" + ".local/share/nix/trusted-settings.json" + ".parallel/will-cite" + ]; + }; + users.root = { + home = "/root"; + directories = [ + { directory = ".gnupg"; mode = "0700"; } + { directory = ".ssh"; mode = "0700"; } + ]; + files = [ + ".local/share/nix/trusted-settings.json" + ]; + }; + }; + + environment.systemPackages = [ + ( + pkgs.writeShellApplication { + name = "zfs-diff"; + runtimeInputs = with pkgs; [ zfs coreutils parallel tree ]; + text = '' + zfs diff -F zroot/encrypted/root@blank | awk '$2 == "F" && system("test -e /persist/"$3) != 0 { print $3 }' 2>/dev/null | tree --fromfile . "$@" + ''; + } + ) + ]; + }; +} diff --git a/modules/programs/hyprland/default.nix b/modules/programs/hyprland/default.nix index 3a323e4..9deeb57 100644 --- a/modules/programs/hyprland/default.nix +++ b/modules/programs/hyprland/default.nix @@ -60,14 +60,12 @@ in programs.hyprland = { enable = true; - enableNvidiaPatches = cfg.nvidiaSupport; }; home-manager.users.moritz = { # enable home-manager module wayland.windowManager.hyprland = { enable = true; - enableNvidiaPatches = cfg.nvidiaSupport; extraConfig = import ./_config.nix args; systemd.extraCommands = [ "systemctl --user stop hyprland-session.target" From 072d016f46cb1c77b7a10f566dea5913a64ac49c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sun, 10 Dec 2023 17:08:27 +0100 Subject: [PATCH 08/12] fix(desktop): issues --- hosts/nixos-desktop/default.nix | 6 +++-- hosts/nixos-desktop/disko.nix | 25 +++---------------- .../nixos-desktop/hardware-configuration.nix | 1 - modules/profiles/desktop.nix | 2 +- modules/programs/hyprland/_config.nix | 2 +- 5 files changed, 10 insertions(+), 26 deletions(-) diff --git a/hosts/nixos-desktop/default.nix b/hosts/nixos-desktop/default.nix index 1d29c32..6e23ad9 100644 --- a/hosts/nixos-desktop/default.nix +++ b/hosts/nixos-desktop/default.nix @@ -53,9 +53,11 @@ kernelPackages = pkgs.linuxPackages_latest; # BOOT - supportedFilesystems = [ "zfs" "btrfs" "ntfs" ]; - loader.systemd-boot.enable = true; + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; kernelModules = [ "lm92" "drivetemp" ]; }; diff --git a/hosts/nixos-desktop/disko.nix b/hosts/nixos-desktop/disko.nix index 96d8b60..d373c43 100644 --- a/hosts/nixos-desktop/disko.nix +++ b/hosts/nixos-desktop/disko.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ lib, ... }: { # needed for zfs pool @@ -83,26 +83,9 @@ }; }; # rollback to blank - boot.initrd.systemd.services.rollback = { - description = "Rollback ZFS datasets to a pristine state"; - wantedBy = [ - "initrd.target" - ]; - after = [ - "zfs-import-zroot.service" - ]; - before = [ - "sysroot.mount" - ]; - path = with pkgs; [ - zfs - ]; - unitConfig.DefaultDependencies = "no"; - serviceConfig.Type = "oneshot"; - script = '' - zfs rollback -r zroot/encrypted/root@blank && echo "rollback complete" - ''; - }; + boot.initrd.postDeviceCommands = lib.mkAfter '' + zfs rollback -r zroot/encrypted/root@blank && echo "rollback complete" + ''; fileSystems."/persist".neededForBoot = true; # HACK: to fix issue of agenix running before impermanence age.identityPaths = [ diff --git a/hosts/nixos-desktop/hardware-configuration.nix b/hosts/nixos-desktop/hardware-configuration.nix index ce0041c..2b77412 100644 --- a/hosts/nixos-desktop/hardware-configuration.nix +++ b/hosts/nixos-desktop/hardware-configuration.nix @@ -11,7 +11,6 @@ initrd = { availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; kernelModules = [ ]; - luks.devices."enc".device = "/dev/disk/by-uuid/30025a9f-44cf-4074-8ae2-d4925efd67dd"; }; kernelModules = [ "kvm-amd" ]; extraModulePackages = [ ]; diff --git a/modules/profiles/desktop.nix b/modules/profiles/desktop.nix index b5d865a..cce9eae 100644 --- a/modules/profiles/desktop.nix +++ b/modules/profiles/desktop.nix @@ -16,7 +16,7 @@ in yubikey = { enable = mkDefault true; luksSupport = { - enable = mkDefault true; + enable = mkDefault false; devices = mkDefault [ "enc" ]; }; }; diff --git a/modules/programs/hyprland/_config.nix b/modules/programs/hyprland/_config.nix index cbeabbf..4ea8616 100644 --- a/modules/programs/hyprland/_config.nix +++ b/modules/programs/hyprland/_config.nix @@ -111,7 +111,7 @@ in } misc { - vrr = 1 + vrr = 0 mouse_move_enables_dpms = true key_press_enables_dpms = true force_default_wallpaper = 0 From 80443f80ca9d2ed3da6abf62eb424075b2708247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sun, 10 Dec 2023 17:13:08 +0100 Subject: [PATCH 09/12] feat(firefox): better out of the box experience --- modules/profiles/personal.nix | 28 +--------- modules/programs/firefox.nix | 98 ++++++++++++++++++++++++++++++++++- 2 files changed, 99 insertions(+), 27 deletions(-) diff --git a/modules/profiles/personal.nix b/modules/profiles/personal.nix index bfea3e2..58c2485 100644 --- a/modules/profiles/personal.nix +++ b/modules/profiles/personal.nix @@ -30,8 +30,8 @@ in "browser.search.suggest.enabled" = true; "browser.urlbar.suggest.searches" = true; - # startup page - "browser.startup.page" = 0; + # Restore previous session on startup + "browser.startup.page" = 3; # drm "media.eme.enabled" = true; @@ -41,30 +41,6 @@ in # disable letterboxing "privacy.resistFingerprinting.letterboxing" = false; - - ## OTHER - # Dont show warning when accessing about:config - "browser.aboutConfig.showWarning" = false; - - # Hide bookmarks - "browser.toolbars.bookmarks.visibility" = "never"; - - # Smooth scrolling - "general.smoothScroll.lines.durationMaxMS" = 125; - "general.smoothScroll.lines.durationMinMS" = 125; - "general.smoothScroll.mouseWheel.durationMaxMS" = 200; - "general.smoothScroll.mouseWheel.durationMinMS" = 100; - "general.smoothScroll.msdPhysics.enabled" = true; - "general.smoothScroll.other.durationMaxMS" = 125; - "general.smoothScroll.other.durationMinMS" = 125; - "general.smoothScroll.pages.durationMaxMS" = 125; - "general.smoothScroll.pages.durationMinMS" = 125; - "mousewheel.min_line_scroll_amount" = 40; - "mousewheel.system_scroll_override_on_root_content.enabled" = true; - "mousewheel.system_scroll_override_on_root_content.horizontal.factor" = 175; - "mousewheel.system_scroll_override_on_root_content.vertical.factor" = 175; - "toolkit.scrollbox.horizontalScrollDistance" = 6; - "toolkit.scrollbox.verticalScrollDistance" = 2; }; }; }; diff --git a/modules/programs/firefox.nix b/modules/programs/firefox.nix index f1f57e3..bc97d53 100644 --- a/modules/programs/firefox.nix +++ b/modules/programs/firefox.nix @@ -50,10 +50,106 @@ in keepassxc-browser languagetool multi-account-containers + sponsorblock + temporary-containers ublock-origin - wikiwand-wikipedia-modernized vimium ]; + settings = { + # Disable Pocket + "extensions.pocket.enabled" = false; + + # Disable Activity Stream + # https://wiki.mozilla.org/Firefox/Activity_Stream + "browser.newtabpage.activity-stream.enabled" = false; + "browser.newtabpage.activity-stream.telemetry" = false; + "browser.newtabpage.activity-stream.feeds.discoverystreamfeed" = false; + "browser.newtabpage.activity-stream.feeds.section.topstories" = false; + "browser.newtabpage.activity-stream.section.highlights.includePocket" = false; + "browser.newtabpage.activity-stream.showSponsored" = false; + "browser.newtabpage.activity-stream.improvesearch.topSiteSearchShortcuts.havePinned" = ""; + "browser.newtabpage.activity-stream.improvesearch.topSiteSearchShortcuts.searchEngines" = ""; + "browser.newtabpage.pinned" = "[]"; + + # Disable new tab tile ads & preload + # http://www.thewindowsclub.com/disable-remove-ad-tiles-from-firefox + # http://forums.mozillazine.org/viewtopic.php?p=13876331#p13876331 + # https://wiki.mozilla.org/Tiles/Technical_Documentation#Ping + # https://gecko.readthedocs.org/en/latest/browser/browser/DirectoryLinksProvider.html#browser-newtabpage-directory-source + # https://gecko.readthedocs.org/en/latest/browser/browser/DirectoryLinksProvider.html#browser-newtabpage-directory-ping + "browser.newtabpage.enhanced" = false; + "browser.newtabpage.introShown" = true; + "browser.newtab.preload" = false; + "browser.newtabpage.directory.ping" = ""; + "browser.newtabpage.directory.source" = "data:text/plain,{}"; + + # Disable some not so useful functionality. + "browser.disableResetPrompt" = true; # "Looks like you haven't started Firefox in a while." + "browser.onboarding.enabled" = false; # "New to Firefox? Let's get started!" tour + "browser.aboutConfig.showWarning" = false; # Warning when opening about:config + "extensions.shield-recipe-client.enabled" = false; + + # do not offer to save passwords = nor allow the user to enable the feature + "signon.rememberSignons" = false; + "signon.rememberSignons.visibilityToggle" = false; + + # send do not track header + "privacy.donottrackheader.enabled" = true; + + # Hide bookmarks + "browser.toolbars.bookmarks.visibility" = "never"; + + # Smooth scrolling + "general.smoothScroll.lines.durationMaxMS" = 125; + "general.smoothScroll.lines.durationMinMS" = 125; + "general.smoothScroll.mouseWheel.durationMaxMS" = 200; + "general.smoothScroll.mouseWheel.durationMinMS" = 100; + "general.smoothScroll.msdPhysics.enabled" = true; + "general.smoothScroll.other.durationMaxMS" = 125; + "general.smoothScroll.other.durationMinMS" = 125; + "general.smoothScroll.pages.durationMaxMS" = 125; + "general.smoothScroll.pages.durationMinMS" = 125; + "mousewheel.min_line_scroll_amount" = 40; + "mousewheel.system_scroll_override_on_root_content.enabled" = true; + "mousewheel.system_scroll_override_on_root_content.horizontal.factor" = 175; + "mousewheel.system_scroll_override_on_root_content.vertical.factor" = 175; + "toolkit.scrollbox.horizontalScrollDistance" = 6; + "toolkit.scrollbox.verticalScrollDistance" = 2; + + # Do not check if Firefox is the default browser + "browser.shell.checkDefaultBrowser" = false; + + # Reduce search engine noise in the urlbar's completion window. The + # shortcuts and suggestions will still work, but Firefox won't clutter + # its UI with reminders that they exist. + "browser.urlbar.suggest.searches" = false; + "browser.urlbar.shortcuts.bookmarks" = false; + "browser.urlbar.shortcuts.history" = false; + "browser.urlbar.shortcuts.tabs" = false; + "browser.urlbar.showSearchSuggestionsFirst" = false; + "browser.urlbar.speculativeConnect.enabled" = false; + + # https://bugzilla.mozilla.org/1642623 + "browser.urlbar.dnsResolveSingleWordsAfterSearch" = 0; + # https://blog.mozilla.org/data/2021/09/15/data-and-firefox-suggest/ + "browser.urlbar.suggest.quicksuggest.nonsponsored" = false; + "browser.urlbar.suggest.quicksuggest.sponsored" = false; + + # Show whole URL in address bar + "browser.urlbar.trimURLs" = false; + + # auto enable addons + "extensions.autoDisableScopes" = 0; + + # Disable Form autofill + # https://wiki.mozilla.org/Firefox/Features/Form_Autofill + "browser.formfill.enable" = false; + "extensions.formautofill.addresses.enabled" = false; + "extensions.formautofill.available" = "off"; + "extensions.formautofill.creditCards.available" = false; + "extensions.formautofill.creditCards.enabled" = false; + "extensions.formautofill.heuristics.enabled" = false; + }; }; }; }; From ddc29896209ea368bd0966618aa476268e1260bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sun, 10 Dec 2023 17:14:20 +0100 Subject: [PATCH 10/12] fix: remove deprecated option --- modules/programs/nvim/plugins/treesitter.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/programs/nvim/plugins/treesitter.nix b/modules/programs/nvim/plugins/treesitter.nix index 93d89d6..f030944 100644 --- a/modules/programs/nvim/plugins/treesitter.nix +++ b/modules/programs/nvim/plugins/treesitter.nix @@ -12,9 +12,6 @@ with builtins; highlight = { enable = true; }; - context_commentstring = { - enable = true; - }; textobjects = { select = From 82ffbcbde4ee3f8b875556d928419ed9e202a8c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sun, 10 Dec 2023 17:15:00 +0100 Subject: [PATCH 11/12] feat(nvim): add gen.nvim and ollama service --- flake.lock | 17 +++++++++++++++ flake.nix | 2 ++ hosts/nixos-desktop/default.nix | 1 + modules/programs/nvim/plugins/coding.nix | 22 ++++++++++++++++++- modules/services/ollama.nix | 27 ++++++++++++++++++++++++ overlays/vimPlugins.nix | 6 ++++++ 6 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 modules/services/ollama.nix diff --git a/flake.lock b/flake.lock index 8ec369a..912fdce 100644 --- a/flake.lock +++ b/flake.lock @@ -315,6 +315,22 @@ "type": "github" } }, + "gen-nvim": { + "flake": false, + "locked": { + "lastModified": 1702112421, + "narHash": "sha256-oF6LT8Q6Dp4mKDNTcm/hx0F8a6iN/HvpZKgGRkctrI4=", + "owner": "David-Kunz", + "repo": "gen.nvim", + "rev": "1319b03357fd7017bbaf1d45cd6b72bd9e106226", + "type": "github" + }, + "original": { + "owner": "David-Kunz", + "repo": "gen.nvim", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ @@ -1043,6 +1059,7 @@ "disko": "disko", "flake-parts": "flake-parts", "flake-utils": "flake-utils", + "gen-nvim": "gen-nvim", "hmts-nvim": "hmts-nvim", "home-manager": "home-manager_2", "hypr-contrib": "hypr-contrib", diff --git a/flake.nix b/flake.nix index 43692cf..c1ced19 100644 --- a/flake.nix +++ b/flake.nix @@ -54,6 +54,8 @@ neotest-python.url = "github:MoritzBoehme/neotest-python/fix-runtimepath-search"; statuscol-nvim.flake = false; statuscol-nvim.url = "github:luukvbaal/statuscol.nvim/0.10"; # HACK: fix for neovim-nightly + gen-nvim.flake = false; + gen-nvim.url = "github:David-Kunz/gen.nvim"; # Hyprland hypr-contrib.url = "github:hyprwm/contrib"; diff --git a/hosts/nixos-desktop/default.nix b/hosts/nixos-desktop/default.nix index 6e23ad9..60e71f4 100644 --- a/hosts/nixos-desktop/default.nix +++ b/hosts/nixos-desktop/default.nix @@ -26,6 +26,7 @@ keyboardLayouts = [ "us" "de" ]; }; services.wallpaper.enable = true; + services.ollama.enable = true; programs.ledger.enable = true; }; diff --git a/modules/programs/nvim/plugins/coding.nix b/modules/programs/nvim/plugins/coding.nix index 12621d9..4b2526c 100644 --- a/modules/programs/nvim/plugins/coding.nix +++ b/modules/programs/nvim/plugins/coding.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, lib, ... }: with builtins; { @@ -332,5 +332,25 @@ with builtins; }; cmd = [ "Neogen" ]; } + { + plugin = gen-nvim; + init = /* lua */ '' + require("gen").setup({ + model = "zephyr:7b-beta", -- The default model to use. + display_mode = "float", -- The display mode. Can be "float" or "split". + show_prompt = false, -- Shows the Prompt submitted to Ollama. + show_model = false, -- Displays which model you are using at the beginning of your chat session. + no_auto_close = false, -- Never closes the window automatically. + init = function(options) end, + -- Function to initialize Ollama + command = "${lib.getExe pkgs.curl} --silent --no-buffer -X POST http://localhost:11434/api/generate -d $body", + -- The command for the Ollama service. You can use placeholders $prompt, $model and $body (shellescaped). + -- This can also be a lua function returning a command string, with options as the input parameter. + -- The executed command must return a JSON object with { response, context } + -- (context property is optional). + debug = false -- Prints errors and the command which is run. + }) + ''; + } ]; } diff --git a/modules/services/ollama.nix b/modules/services/ollama.nix new file mode 100644 index 0000000..275d2c4 --- /dev/null +++ b/modules/services/ollama.nix @@ -0,0 +1,27 @@ +{ lib, config, pkgs, ... }: + +with lib; +let + cfg = config.my.services.ollama; +in +{ + options.my.services.ollama = { + enable = mkEnableOption "ollama"; + package = mkOption { + type = types.package; + default = pkgs.ollama; + }; + }; + + config = mkIf cfg.enable { + systemd.user.services.ollama = { + after = [ "network.target" ]; + serviceConfig = { + Type = "simple"; + Restart = "on-failure"; + RestartSec = "1s"; + ExecStart = "${getExe cfg.package} serve"; + }; + }; + }; +} diff --git a/overlays/vimPlugins.nix b/overlays/vimPlugins.nix index fc07f32..1a4f6c8 100644 --- a/overlays/vimPlugins.nix +++ b/overlays/vimPlugins.nix @@ -61,5 +61,11 @@ with lib.my; version = mkVersionInput inputs.neotest-python; src = inputs.neotest-python; }); + + gen-nvim = prev.vimUtils.buildVimPlugin { + pname = "gen-nvim"; + version = mkVersionInput inputs.gen-nvim; + src = inputs.gen-nvim; + }; }; } From e7fd307bfb289fbd7f489c9945c6b840c9cc5e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Mon, 11 Dec 2023 16:55:24 +0100 Subject: [PATCH 12/12] feat(firefox): set search engines through policies --- modules/programs/firefox.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/programs/firefox.nix b/modules/programs/firefox.nix index bc97d53..ffdd778 100644 --- a/modules/programs/firefox.nix +++ b/modules/programs/firefox.nix @@ -29,11 +29,21 @@ in ); }; }; + setSearchEngines = mkEnableOption "firefox search engines" // { + default = true; + }; }; config = mkIf cfg.enable { home-manager.users.moritz.programs.firefox = { enable = true; + policies = mkIf cfg.setSearchEngines { + SearchEngines = { + Default = "Kagi"; + Remove = [ "Google" "Amazon.de" "Bing" ]; + }; + }; + package = if cfg.setSearchEngines then pkgs.firefox-esr else pkgs.firefox; profiles."default" = { extraConfig = mkIf cfg.arkenfox.enable '' // Arkenfox user.js