diff --git a/.stylua.toml b/.stylua.toml new file mode 100644 index 0000000..cee468f --- /dev/null +++ b/.stylua.toml @@ -0,0 +1,7 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "Always" +collapse_simple_statement = "Never" diff --git a/flake.lock b/flake.lock index 8c67553..d2414ef 100644 --- a/flake.lock +++ b/flake.lock @@ -2,16 +2,17 @@ "nodes": { "agenix": { "inputs": { + "darwin": "darwin", "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1665870395, - "narHash": "sha256-Tsbqb27LDNxOoPLh0gw2hIb6L/6Ow/6lIBvqcHzEKBI=", + "lastModified": 1677247280, + "narHash": "sha256-sa+8MtoAOSLsWP9vf0qiJUyMovIEYgDzHE8TkoK04Hk=", "owner": "ryantm", "repo": "agenix", - "rev": "a630400067c6d03c9b3e0455347dc8559db14288", + "rev": "833f87c8ff574a29aea3e091045cbaed3cf86bc1", "type": "github" }, "original": { @@ -23,11 +24,11 @@ "arkenfox-userjs": { "flake": false, "locked": { - "lastModified": 1670682948, - "narHash": "sha256-yFg8U4D+qD9UQXhpAXrl9Ksj16zrCLOgahMtT9QS2Y8=", + "lastModified": 1675728165, + "narHash": "sha256-ebSx6DaXoGKcCoK6UcDnWvdAW6J2X6pJRPD1Pw7UNOw=", "owner": "arkenfox", "repo": "user.js", - "rev": "7135907b2fe13fa55eb8ebf162603037f83e353c", + "rev": "73884850632ffe284f76881786f7d5903b917f58", "type": "github" }, "original": { @@ -53,19 +54,120 @@ "type": "github" } }, - "emacs-overlay": { + "attic": { "inputs": { - "flake-utils": "flake-utils", + "crane": "crane", + "flake-compat": "flake-compat", + "flake-utils": [ + "flake-utils" + ], "nixpkgs": [ "nixpkgs" + ], + "nixpkgs-stable": [ + "stable" + ] + }, + "locked": { + "lastModified": 1676581287, + "narHash": "sha256-a/6ClchROZ5PoLz0WK42mkAkUtJlMDbe5QyyZZ7bomc=", + "owner": "zhaofengli", + "repo": "attic", + "rev": "0bb3d001365a5d75947a7a713dfd06307b3934d4", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "repo": "attic", + "type": "github" + } + }, + "crane": { + "inputs": { + "flake-compat": [ + "attic", + "flake-compat" + ], + "flake-utils": [ + "attic", + "flake-utils" + ], + "nixpkgs": [ + "attic", + "nixpkgs" + ], + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1673405853, + "narHash": "sha256-6Nq9DuOo+gE2I8z5UZaKuumykz2xxZ9JGYmUthOuwSA=", + "owner": "ipetkov", + "repo": "crane", + "rev": "b13963c8c18026aa694acd98d14f66d24666f70b", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "rev": "b13963c8c18026aa694acd98d14f66d24666f70b", + "type": "github" + } + }, + "darwin": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" ] }, "locked": { - "lastModified": 1672567750, - "narHash": "sha256-Hz1b1TUJbzuLj0eR+LTSUqoGR2gkQdrm3uxru+0rVuY=", + "lastModified": 1673295039, + "narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "87b9d090ad39b25b2400029c64825fc2a8868943", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "emacs": { + "inputs": { + "emacs-overlay": "emacs-overlay", + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2", + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1676394233, + "narHash": "sha256-RHO/MgRyFqgmIgogrL5LBmBhAt8hTpUJJ6Dww46GyZI=", + "ref": "main", + "rev": "6fb9f917901160b2b212f420a8a8e4995c823626", + "revCount": 98, + "type": "git", + "url": "ssh://git@gitea.moritzboeh.me/moritz/emacs.git" + }, + "original": { + "ref": "main", + "type": "git", + "url": "ssh://git@gitea.moritzboeh.me/moritz/emacs.git" + } + }, + "emacs-overlay": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1676025076, + "narHash": "sha256-sdYhoZsLLwRXZebP6DYfIgQRjFA+itdNXaPuCWfJYkk=", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "524c884484c312b76cb4bc9fbf37eec66e2f8406", + "rev": "581072bb0d49768da9370056f7b6e7b761b5d8be", "type": "github" }, "original": { @@ -77,11 +179,43 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1668681692, - "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "owner": "edolstra", "repo": "flake-compat", - "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "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-compat_3": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "type": "github" }, "original": { @@ -106,6 +240,36 @@ } }, "flake-utils_2": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "locked": { + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -120,7 +284,7 @@ "type": "github" } }, - "flake-utils_3": { + "flake-utils_5": { "locked": { "lastModified": 1667395993, "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", @@ -135,13 +299,13 @@ "type": "github" } }, - "flake-utils_4": { + "flake-utils_6": { "locked": { - "lastModified": 1644229661, - "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "owner": "numtide", "repo": "flake-utils", - "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "type": "github" }, "original": { @@ -153,11 +317,11 @@ "forgit-git": { "flake": false, "locked": { - "lastModified": 1671476278, - "narHash": "sha256-guAjxFhtybbRyRRXDELDHrM2Xzmi96wPxD2nhL9Ifmk=", + "lastModified": 1676021219, + "narHash": "sha256-/cqDhHilbMSrzwip+2CGJ9Il4wsx5skyMbqC98hewdc=", "owner": "wfxr", "repo": "forgit", - "rev": "ffda73bac3a435a9bbc6f29f2fd98517fbe5d9db", + "rev": "065f7841f334b8707a49ac30d19370aa859db2ed", "type": "github" }, "original": { @@ -167,6 +331,28 @@ } }, "gitignore": { + "inputs": { + "nixpkgs": [ + "emacs", + "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" + } + }, + "gitignore_2": { "inputs": { "nixpkgs": [ "pre-commit-hooks", @@ -192,14 +378,16 @@ "nixpkgs": [ "nixpkgs" ], - "utils": "utils" + "utils": [ + "flake-utils" + ] }, "locked": { - "lastModified": 1672349765, - "narHash": "sha256-Ul3lSGglgHXhgU3YNqsNeTlRH1pqxbR64h+2hM+HtnM=", + "lastModified": 1677104801, + "narHash": "sha256-2V5nKOYVFMYlseYdDKiEaww2xqcE0GtS1ax3SoUX99I=", "owner": "nix-community", "repo": "home-manager", - "rev": "dd99675ee81fef051809bc87d67eb07f5ba022e8", + "rev": "4295fdfa6b0005c32f2e1f0b732faf5810c1bc7f", "type": "github" }, "original": { @@ -210,11 +398,11 @@ }, "howdy": { "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils_4", "nixpkgs": [ "nixpkgs" ], - "pre-commit-hooks": "pre-commit-hooks" + "pre-commit-hooks": "pre-commit-hooks_2" }, "locked": { "lastModified": 1665343480, @@ -232,7 +420,7 @@ }, "hypr-contrib": { "inputs": { - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1672071700, @@ -251,16 +439,16 @@ "hyprland": { "inputs": { "hyprland-protocols": "hyprland-protocols", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_4", "wlroots": "wlroots", "xdph": "xdph" }, "locked": { - "lastModified": 1672510982, - "narHash": "sha256-fxpb2GM2Zi4DU119b7c1g8RN/jF7WXD5UcjXN7lxPJ8=", + "lastModified": 1677162463, + "narHash": "sha256-wjZbwJvIagJ0i82LYm3eIHNsqwblOjIzAyegA3z9olA=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "7525818097f92a99b2b8d02ea43bd0f8ccabd51c", + "rev": "60e37d727def25c87a3fd6c47751c05f6082260f", "type": "github" }, "original": { @@ -270,29 +458,18 @@ } }, "hyprland-protocols": { - "flake": false, - "locked": { - "lastModified": 1670703428, - "narHash": "sha256-4KUW5SKR0Y9uaYGcYwy53YJ3B/sgiprCL4fRGO+mpOA=", - "owner": "hyprwm", - "repo": "hyprland-protocols", - "rev": "d0d6db8cb5bef6d93ca3ad8fb2124964173396da", - "type": "github" + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ] }, - "original": { - "owner": "hyprwm", - "repo": "hyprland-protocols", - "type": "github" - } - }, - "hyprland-protocols_2": { - "flake": false, "locked": { - "lastModified": 1670703428, - "narHash": "sha256-4KUW5SKR0Y9uaYGcYwy53YJ3B/sgiprCL4fRGO+mpOA=", + "lastModified": 1671839510, + "narHash": "sha256-+PY1qqJfmZzzROgcIY4I7AkCwpnC+qBIYk2eFoA9RWc=", "owner": "hyprwm", "repo": "hyprland-protocols", - "rev": "d0d6db8cb5bef6d93ca3ad8fb2124964173396da", + "rev": "b8f55e02a328c47ed373133c52483bbfa20a1b75", "type": "github" }, "original": { @@ -303,14 +480,14 @@ }, "hyprpaper": { "inputs": { - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1672266418, - "narHash": "sha256-Xxooxjoymgl65dIMtcBB4/bZx0OcqPZ52G/fw4rozYE=", + "lastModified": 1676681260, + "narHash": "sha256-R2FvbPzgvDSVs0jCUA9CMDIgw4F6exF8cR+y3Yea5jQ=", "owner": "hyprwm", "repo": "hyprpaper", - "rev": "aefd63876d0353e4b25e473708903e6c30054931", + "rev": "2bc88dc8c220db674f458432aec0ac0d9ea6a640", "type": "github" }, "original": { @@ -321,11 +498,11 @@ }, "master": { "locked": { - "lastModified": 1672582743, - "narHash": "sha256-BcHOaoxnUL+DzjGZV+vm8rIDGOFL6DvbPxeCLvzDrN0=", + "lastModified": 1677259386, + "narHash": "sha256-gFXSvo9CuTJa6V0bK0Gm+JwizlJD+YyJ1VAUW2ij1R4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "3d9c0b6bdb5d6ee7126b6362167550c74590d612", + "rev": "e8d97da2540b9de5962849c75c425cc2469d77ad", "type": "github" }, "original": { @@ -334,13 +511,58 @@ "type": "github" } }, + "neovim": { + "inputs": { + "flake-utils": "flake-utils_5", + "nixpkgs": "nixpkgs_6" + }, + "locked": { + "dir": "contrib", + "lastModified": 1677257437, + "narHash": "sha256-fxEb0DrGXv3Q03Gz/oqI8x47WhXLlGtHQFgGIhBl4c0=", + "owner": "neovim", + "repo": "neovim", + "rev": "15cce77b383d0b0bfdaa1415cdde005cc43267d0", + "type": "github" + }, + "original": { + "dir": "contrib", + "owner": "neovim", + "repo": "neovim", + "type": "github" + } + }, + "nil": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ], + "rust-overlay": "rust-overlay_2" + }, + "locked": { + "lastModified": 1676390054, + "narHash": "sha256-w0KvrM+9WIEYr0juDh4Vs39ed2IaT0T696fp9pZ7i1I=", + "owner": "oxalica", + "repo": "nil", + "rev": "944d5c335531778a1d7b54a97bf7fb5ec0c3e976", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "nil", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1658161305, - "narHash": "sha256-X/nhnMCa1Wx4YapsspyAs6QYz6T/85FofrI6NpdPDHg=", + "lastModified": 1673540789, + "narHash": "sha256-xqnxBOK3qctIeUVxecydrEDbEXjsvHCPGPbvsl63M/U=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e4d49de45a3b5dbcb881656b4e3986e666141ea9", + "rev": "0f213d0fee84280d8c3a97f7469b988d6fe5fcdf", "type": "github" }, "original": { @@ -352,43 +574,59 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1671271954, - "narHash": "sha256-cSvu+bnvN08sOlTBWbBrKaBHQZq8mvk8bgpt0ZJ2Snc=", + "lastModified": 1673800717, + "narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d513b448cc2a6da2c8803e3c197c9fc7e67b19e3", + "rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-22.05", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable_2": { + "locked": { + "lastModified": 1673800717, + "narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_2": { "locked": { - "lastModified": 1671722432, - "narHash": "sha256-ojcZUekIQeOZkHHzR81st7qxX99dB1Eaaq6PU5MNeKc=", - "owner": "NixOS", + "lastModified": 1675758091, + "narHash": "sha256-7gFSQbSVAFUHtGCNHPF7mPc5CcqDk9M2+inlVPZSneg=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "652e92b8064949a11bc193b90b74cb727f2a1405", + "rev": "747927516efcb5e31ba03b7ff32f61f6d47e7d87", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixos-unstable", + "owner": "nixos", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_3": { "locked": { - "lastModified": 1658826464, - "narHash": "sha256-94ZTF0uIX/iZdiD4RJ5f933ak/OM4XLl7hF+gCa4Iuk=", + "lastModified": 1677063315, + "narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ce49cb7792a7ffd65ef352dda1110a4e4a204eac", + "rev": "988cc958c57ce4350ec248d2d53087777f9e1949", "type": "github" }, "original": { @@ -400,11 +638,59 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1672428209, - "narHash": "sha256-eejhqkDz2cb2vc5VeaWphJz8UXNuoNoM8/Op8eWv2tQ=", + "lastModified": 1677063315, + "narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "988cc958c57ce4350ec248d2d53087777f9e1949", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1677063315, + "narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "988cc958c57ce4350ec248d2d53087777f9e1949", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { + "locked": { + "lastModified": 1671983799, + "narHash": "sha256-Z2Ro6hFPZHkBqkVXY5/aBUzxi5xizQGvuHQ9+T5B/ks=", "owner": "nixos", "repo": "nixpkgs", - "rev": "293a28df6d7ff3dec1e61e37cc4ee6e6c0fb0847", + "rev": "fad51abd42ca17a60fc1d4cb9382e2d79ae31836", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_7": { + "locked": { + "lastModified": 1677142198, + "narHash": "sha256-Y/uC2ZmkQkyrdRZ5szZilhZ/46786Wio5CGTgL+Vb/c=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "03fb72201639e5274fee6d77b0d9c66e98329aba", "type": "github" }, "original": { @@ -414,7 +700,7 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_8": { "locked": { "lastModified": 1671271357, "narHash": "sha256-xRJdLbWK4v2SewmSStYrcLa0YGJpleufl44A19XSW8k=", @@ -430,7 +716,51 @@ "type": "github" } }, + "nvim-treesitter-textsubjects": { + "flake": false, + "locked": { + "lastModified": 1676144693, + "narHash": "sha256-4jb9v0xpO17wp85dzojKUQ6hUdNBx3T2tB4fSWoANus=", + "owner": "RRethy", + "repo": "nvim-treesitter-textsubjects", + "rev": "b913508f503527ff540f7fe2dcf1bf1d1f259887", + "type": "github" + }, + "original": { + "owner": "RRethy", + "repo": "nvim-treesitter-textsubjects", + "type": "github" + } + }, "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": [ + "emacs", + "flake-utils" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "emacs", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1675688762, + "narHash": "sha256-oit/SxMk0B380ASuztBGQLe8TttO1GJiXF8aZY9AYEc=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "ab608394886fb04b8a5df3cb0bab2598400e3634", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "pre-commit-hooks_2": { "inputs": { "flake-utils": [ "howdy", @@ -455,20 +785,20 @@ "type": "github" } }, - "pre-commit-hooks_2": { + "pre-commit-hooks_3": { "inputs": { - "flake-compat": "flake-compat", - "flake-utils": "flake-utils_3", - "gitignore": "gitignore", - "nixpkgs": "nixpkgs_5", - "nixpkgs-stable": "nixpkgs-stable" + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils_6", + "gitignore": "gitignore_2", + "nixpkgs": "nixpkgs_8", + "nixpkgs-stable": "nixpkgs-stable_2" }, "locked": { - "lastModified": 1672050129, - "narHash": "sha256-GBQMcvJUSwAVOpDjVKzB6D5mmHI7Y4nFw+04bnS9QrM=", + "lastModified": 1677160285, + "narHash": "sha256-tBzpCjMP+P3Y3nKLYvdBkXBg3KvTMo3gvi8tLQaqXVY=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "67d98f02443b9928bc77f1267741dcfdd3d7b65c", + "rev": "2bd861ab81469428d9c823ef72c4bb08372dd2c4", "type": "github" }, "original": { @@ -482,7 +812,9 @@ "agenix": "agenix", "arkenfox-userjs": "arkenfox-userjs", "asus-touchpad-numpad-driver": "asus-touchpad-numpad-driver", - "emacs-overlay": "emacs-overlay", + "attic": "attic", + "emacs": "emacs", + "flake-utils": "flake-utils_3", "forgit-git": "forgit-git", "home-manager": "home-manager", "howdy": "howdy", @@ -490,19 +822,91 @@ "hyprland": "hyprland", "hyprpaper": "hyprpaper", "master": "master", - "nixpkgs": "nixpkgs_4", - "pre-commit-hooks": "pre-commit-hooks_2", + "neovim": "neovim", + "nil": "nil", + "nixpkgs": "nixpkgs_7", + "nvim-treesitter-textsubjects": "nvim-treesitter-textsubjects", + "pre-commit-hooks": "pre-commit-hooks_3", + "smartcolumn-nvim": "smartcolumn-nvim", "stable": "stable", - "utils": "utils_2" + "utils": "utils" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "attic", + "crane", + "flake-utils" + ], + "nixpkgs": [ + "attic", + "crane", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1675391458, + "narHash": "sha256-ukDKZw922BnK5ohL9LhwtaDAdCsJL7L6ScNEyF1lO9w=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "383a4acfd11d778d5c2efcf28376cbd845eeaedf", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_2": { + "inputs": { + "flake-utils": [ + "nil", + "flake-utils" + ], + "nixpkgs": [ + "nil", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1675391458, + "narHash": "sha256-ukDKZw922BnK5ohL9LhwtaDAdCsJL7L6ScNEyF1lO9w=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "383a4acfd11d778d5c2efcf28376cbd845eeaedf", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "smartcolumn-nvim": { + "flake": false, + "locked": { + "lastModified": 1677125264, + "narHash": "sha256-Om0t759e6JYwcg6V+HdJk59h2yVt9kPLwGBMKNnP8AA=", + "owner": "m4xshen", + "repo": "smartcolumn.nvim", + "rev": "1202b0741b87b0815bdc6fc6ebacb2df9e6628ee", + "type": "github" + }, + "original": { + "owner": "m4xshen", + "repo": "smartcolumn.nvim", + "type": "github" } }, "stable": { "locked": { - "lastModified": 1672353432, - "narHash": "sha256-oZfgp/44/o2tWiylV30cR+DLyWTJ+5dhsdWZVpzs3e4=", + "lastModified": 1677075010, + "narHash": "sha256-X+UmR1AkdR//lPVcShmLy8p1n857IGf7y+cyCArp8bU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "913a47cd064cc06440ea84e5e0452039a85781f0", + "rev": "c95bf18beba4290af25c60cbaaceea1110d0f727", "type": "github" }, "original": { @@ -513,23 +917,10 @@ } }, "utils": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "utils_2": { "inputs": { - "flake-utils": "flake-utils_4" + "flake-utils": [ + "flake-utils" + ] }, "locked": { "lastModified": 1657226504, @@ -549,11 +940,11 @@ "flake": false, "locked": { "host": "gitlab.freedesktop.org", - "lastModified": 1671723353, - "narHash": "sha256-G1jiI0SA7eiZusO+iJytErMRNbKbwqJJJGL+sNoBNoQ=", + "lastModified": 1675374853, + "narHash": "sha256-BSrjNcddYWhFUMtjGwxiEXw67MYRaIHGvLn19Mvm1NE=", "owner": "wlroots", "repo": "wlroots", - "rev": "b28a9afd4b0b86e9a66a40f6b44b69f59947b7d6", + "rev": "677a3f2f8847ed2de49dd60868f9d9487a546f58", "type": "gitlab" }, "original": { @@ -565,18 +956,21 @@ }, "xdph": { "inputs": { - "hyprland-protocols": "hyprland-protocols_2", + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], "nixpkgs": [ "hyprland", "nixpkgs" ] }, "locked": { - "lastModified": 1671837878, - "narHash": "sha256-OmFDyktTc/l+3wHboHeFpAQgPt3r7jjqZf8MrwuUGMo=", + "lastModified": 1673116118, + "narHash": "sha256-eR0yDSkR2XYMesfdRWJs25kAdXET2mbNNHu5t+KUcKA=", "owner": "hyprwm", "repo": "xdg-desktop-portal-hyprland", - "rev": "e47f4cec698080768821b271510985ab94a37e91", + "rev": "d479c846531fd0e1d2357c9588b8310a2b859ef2", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index e95fcb4..28c83f1 100644 --- a/flake.nix +++ b/flake.nix @@ -12,21 +12,22 @@ pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; - utils.url = "github:gytis-ivaskevicius/flake-utils-plus"; + flake-utils.url = "github:numtide/flake-utils"; + + utils = { + url = "github:gytis-ivaskevicius/flake-utils-plus"; + inputs.flake-utils.follows = "flake-utils"; + }; agenix = { url = "github:ryantm/agenix"; inputs.nixpkgs.follows = "nixpkgs"; }; - emacs-overlay = { - url = "github:nix-community/emacs-overlay"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; + inputs.utils.follows = "flake-utils"; }; # Zsh specific @@ -51,11 +52,37 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + emacs.url = "git+ssh://git@gitea.moritzboeh.me/moritz/emacs.git?ref=main"; + + neovim.url = "github:neovim/neovim?dir=contrib"; + + nil = { + url = "github:oxalica/nil"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-utils.follows = "flake-utils"; + }; # Hyprland hyprland.url = "github:hyprwm/Hyprland"; hyprpaper.url = "github:hyprwm/hyprpaper"; hypr-contrib.url = "github:hyprwm/contrib"; + + nvim-treesitter-textsubjects = { + url = "github:RRethy/nvim-treesitter-textsubjects"; + flake = false; + }; + + smartcolumn-nvim = { + url = "github:m4xshen/smartcolumn.nvim"; + flake = false; + }; + + attic = { + url = "github:zhaofengli/attic"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixpkgs-stable.follows = "stable"; + inputs.flake-utils.follows = "flake-utils"; + }; }; outputs = @@ -74,12 +101,10 @@ overlay = import ./overlays { inherit inputs; }; channels.nixpkgs.overlaysBuilder = channels: [ - inputs.agenix.overlay - inputs.emacs-overlay.overlay + inputs.emacs.overlays.default inputs.howdy.overlays.default inputs.hypr-contrib.overlays.default inputs.hyprland.overlays.default - inputs.hyprpaper.overlays.default inputs.utils.overlay self.overlay ]; @@ -152,6 +177,7 @@ nixpkgs-fmt.enable = true; statix.enable = true; shellcheck.enable = true; + stylua.enable = true; }; }; diff --git a/hosts/nixos-desktop/default.nix b/hosts/nixos-desktop/default.nix index 377c478..f5a34bf 100644 --- a/hosts/nixos-desktop/default.nix +++ b/hosts/nixos-desktop/default.nix @@ -15,7 +15,7 @@ my.programs.hyprland.nvidiaSupport = true; # KERNEL - boot.kernelPackages = pkgs.linuxPackages_latest; + boot.kernelPackages = pkgs.linuxPackages_6_1; # HACK to get nvidia kernel package to build # BOOT boot = { diff --git a/hosts/nixos-laptop/default.nix b/hosts/nixos-laptop/default.nix index d89009d..3042652 100644 --- a/hosts/nixos-laptop/default.nix +++ b/hosts/nixos-laptop/default.nix @@ -107,22 +107,6 @@ wantedBy = [ "multi-user.target" ]; }; - nix = { - distributedBuilds = true; - buildMachines = [ - { - hostName = "builder"; - system = "x86_64-linux"; - maxJobs = 6; - speedFactor = 2; - supportedFeatures = [ "nixos.test" "benchmark" "big-parallel" "kvm" ]; - } - ]; - extraOptions = '' - builders-use-substitutes = true - ''; - }; - programs.ssh.extraConfig = '' Host builder Hostname 192.168.0.14 diff --git a/modules/config/bin/randomWallpaper.nix b/modules/config/bin/randomWallpaper.nix index 2dc3d87..e9be064 100644 --- a/modules/config/bin/randomWallpaper.nix +++ b/modules/config/bin/randomWallpaper.nix @@ -2,10 +2,16 @@ pkgs.writeShellApplication { name = "randomWallpaper"; - runtimeInputs = with pkgs; [ findutils coreutils feh ]; + runtimeInputs = with pkgs; [ findutils coreutils feh hyprland jq ]; text = '' wallpaper="$(find ~/.config/wallpapers/ -type f,l | shuf -n 1)" - feh --bg-fill "$wallpaper" + if [ -z ''${WAYLAND_DISPLAY+x} ]; then + feh --bg-fill "$wallpaper" + else + hyprctl hyprpaper preload "$wallpaper" + hyprctl monitors -j | jq '.[].name' | xargs -I{} hyprctl hyprpaper wallpaper '{}',"$wallpaper" + hyprctl hyprpaper unload all + fi ''; } diff --git a/modules/config/theming/default.nix b/modules/config/theming/default.nix index deedad2..4feefe9 100644 --- a/modules/config/theming/default.nix +++ b/modules/config/theming/default.nix @@ -21,7 +21,6 @@ in options.my.theming = { enable = mkEnableOption "theming"; scheme = mkOption { - default = "catppuccin-macchiato"; type = types.enum [ "dracula" "catppuccin-latte" diff --git a/modules/config/wallpapers/dracula.png b/modules/config/wallpapers/dracula.png deleted file mode 100644 index c7c1a74..0000000 Binary files a/modules/config/wallpapers/dracula.png and /dev/null differ diff --git a/modules/config/wallpapers/little-ships.jpg b/modules/config/wallpapers/little-ships.jpg deleted file mode 100644 index d18df20..0000000 Binary files a/modules/config/wallpapers/little-ships.jpg and /dev/null differ diff --git a/modules/config/wallpapers/little-ships.png b/modules/config/wallpapers/little-ships.png new file mode 100644 index 0000000..739e71b Binary files /dev/null and b/modules/config/wallpapers/little-ships.png differ diff --git a/modules/profiles/base.nix b/modules/profiles/base.nix index e8b9533..894419a 100644 --- a/modules/profiles/base.nix +++ b/modules/profiles/base.nix @@ -5,6 +5,16 @@ }: with lib; +let + nom-system = pkgs.writeShellApplication { + name = "nom-system"; + runtimeInputs = with pkgs; [ nix-output-monitor ]; + text = '' + nom build --no-link "/home/moritz/.dotfiles#nixosConfigurations.$(hostname).config.system.build.toplevel" + ''; + }; + nom-system-command = command: "${nom-system}/bin/nom-system && ${command}"; +in { users.users.moritz = { isNormalUser = true; @@ -39,8 +49,8 @@ with lib; rm = "rm -i"; mv = "mv -i"; - nixos-switch = "sudo nixos-rebuild switch --flake ~/.dotfiles"; - nixos-boot = "sudo nixos-rebuild boot --flake ~/.dotfiles"; + nixos-switch = nom-system-command "sudo nixos-rebuild switch --flake ~/.dotfiles"; + nixos-boot = nom-system-command "sudo nixos-rebuild boot --flake ~/.dotfiles"; nixos-update = "pushd ~/.dotfiles && nix flake update && popd"; latexwatch = ''find -type f -name "*.tex" | entr -c latexmk -pdf -silent''; @@ -52,8 +62,6 @@ with lib; fish.enable = true; git.enable = true; gpg.enable = true; - helix.enable = true; - kakoune.enable = true; vim.enable = true; }; }; @@ -67,7 +75,6 @@ with lib; zip # file management - ranger trash-cli # monitoring @@ -80,9 +87,10 @@ with lib; nixpkgs-fmt statix manix + nix-output-monitor + attic # other - arduino bat cht-sh du-dust @@ -90,12 +98,9 @@ with lib; entr exa gparted - hut - lazygit neofetch ripgrep tmux - ttyper up viu wget @@ -122,7 +127,7 @@ with lib; }; i18n.extraLocaleSettings = { - LC_NUMERIC = "de_DE.UTF-8"; + # LC_NUMERIC = "de_DE.UTF-8"; LC_PAPER = "de_DE.UTF-8"; LC_TIME = "de_DE.UTF-8"; }; @@ -140,4 +145,10 @@ with lib; }; xdg.userDirs.enable = true; }; + + system.activationScripts.diff = '' + if [ -e /run/current-system ]; then + ${pkgs.nvd}/bin/nvd --nix-bin-dir ${pkgs.nix}/bin diff /run/current-system/ "$systemConfig" + fi + ''; } diff --git a/modules/profiles/desktop.nix b/modules/profiles/desktop.nix index ffdd4e6..10de55c 100644 --- a/modules/profiles/desktop.nix +++ b/modules/profiles/desktop.nix @@ -8,11 +8,10 @@ with lib; { # config yubikey.enable = true; wallpapers.enable = true; - theming.enable = true; - shell.aliases = { - feh = "feh --auto-zoom --scale-down"; + theming = { + enable = true; + scheme = "catppuccin-macchiato"; }; - virtualisation = { podman.enable = true; libvirtd.enable = true; @@ -92,9 +91,9 @@ with lib; { kdeconnect.enable = true; mullvad.enable = true; openconnect.enable = true; - openvpn.enable = true; printing.enable = true; redshift.enable = true; + wireguard.enable = true; }; }; @@ -104,7 +103,7 @@ with lib; { # ripping abcde - handbrake + stable.handbrake # HACK to fix broken ffmpeg on unstable picard # other @@ -123,9 +122,14 @@ with lib; { jetbrains.pycharm-professional synology-drive-client + + texlive.combined.scheme-full ]; - programs.chromium.enable = true; + programs = { + chromium.enable = true; + nix-ld.enable = true; + }; home-manager.users.moritz = { services.nextcloud-client = { diff --git a/modules/programs/default.nix b/modules/programs/default.nix index d7e92ff..9674641 100644 --- a/modules/programs/default.nix +++ b/modules/programs/default.nix @@ -30,7 +30,7 @@ ./ssh.nix ./sway.nix ./thunar.nix - ./vim.nix + ./nvim ./xmonad ./zathura.nix ./zsh.nix diff --git a/modules/programs/emacs.nix b/modules/programs/emacs.nix index c754558..0d7128d 100644 --- a/modules/programs/emacs.nix +++ b/modules/programs/emacs.nix @@ -8,8 +8,7 @@ with lib; let cfg = config.my.programs.emacs; - myEmacs = with pkgs; ((emacsPackagesFor emacsPgtk).emacsWithPackages - (epkgs: [ epkgs.vterm ])); + myEmacs = pkgs.emacsPgtkWithPackages; in { options.my.programs.emacs.enable = mkEnableOption "emacs"; @@ -22,20 +21,7 @@ in emacs-all-the-icons-fonts (iosevka-bin.override { variant = "aile"; }) ]; - users.users.moritz.packages = with pkgs; [ - myEmacs - - (ripgrep.override { withPCRE2 = true; }) - # flyspell - (hunspellWithDicts [ - hunspellDicts.en_GB-ize - hunspellDicts.en_US - hunspellDicts.de_DE - ]) - - # language servers - nil - ]; + users.users.moritz.packages = [ myEmacs ]; home-manager.users.moritz = { home.sessionPath = [ "/home/moritz/.config/emacs/bin/" ]; services.emacs = { diff --git a/modules/programs/git.nix b/modules/programs/git.nix index 42497af..fa4fab0 100644 --- a/modules/programs/git.nix +++ b/modules/programs/git.nix @@ -31,6 +31,9 @@ in config = mkIf cfg.enable { my.shell.abbreviations = { ga = "git add"; + gap = "git add --patch"; + gr = "git restore"; + grp = "git restore --patch"; gb = "git branch"; gc = "git commit"; gco = "git checkout"; @@ -48,7 +51,7 @@ in userEmail = cfg.identity.email; extraConfig = { init.defaultBranch = "main"; - merge.conflictstyle = "diff3"; + merge.conflictstyle = "zdiff3"; }; delta.enable = true; signing = mkIf cfg.signing { diff --git a/modules/programs/hyprland/config.nix b/modules/programs/hyprland/config.nix index 2a0d355..5bfba05 100644 --- a/modules/programs/hyprland/config.nix +++ b/modules/programs/hyprland/config.nix @@ -6,6 +6,10 @@ with lib; let + cfg = config.my.programs.hyprland; + + boolToYesNo = bool: if bool then "yes" else "no"; + mkRule = rule: windowRegexes: "windowrulev2 = ${rule},${concatStringsSep "," windowRegexes}"; mkRules = rules: windowRegexes: concatStringsSep "\n" (map (flip mkRule windowRegexes) rules); in @@ -55,12 +59,12 @@ in # See https://wiki.hyprland.org/Configuring/Variables/ for more rounding = 3 - blur = yes + blur = ${boolToYesNo cfg.blur} blur_size = 3 blur_passes = 3 blur_new_optimizations = on - drop_shadow = yes + drop_shadow = ${boolToYesNo cfg.shadows} shadow_range = 10 shadow_render_power = 2 @@ -72,13 +76,21 @@ in # Some default Lanimations, see https://wiki.hyprland.org/Configuring/Animations/ for more - bezier = myBezier, 0.45, 0, 0.55, 1 + bezier = sine, 0.445, 0.05, 0.55, 0.95 + bezier = quad, 0.455, 0.03, 0.515, 0.955 + bezier = cubic, 0.68, -0.55, 0.265, 1.55 + bezier = quart, 0.77, 0, 0.175, 1 + bezier = quint, 0.86, 0, 0.07, 1 + bezier = expo, 1, 0, 0, 1 + bezier = circ, 0.785, 0.135, 0.15, 0.86 + bezier = back, 0.68, -0.55, 0.265, 1.55 - animation = windows, 1, 3, myBezier - animation = windowsOut, 1, 3, myBezier - animation = border, 1, 3, myBezier - animation = fade, 1, 3, myBezier - animation = workspaces, 1, 3, myBezier + + animation = windows, 1, 3, circ + animation = windowsOut, 1, 2, quint + animation = border, 1, 2, sine + animation = fade, 1, 2, sine + animation = workspaces, 1, 5, circ } dwindle { @@ -109,17 +121,19 @@ in # windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more + ${optionalString cfg.blur '' # Kitty windowrulev2 = opacity 0.95 0.95, class:^kitty$ - windowrulev2 = opacity 0.85 0.85, floating:1 - - # Firefox Sharing Indicator - ${mkRules ["float" "move 49% 40" "noborder"] ["title:^(.*Sharing Indicator)$"]} - # Rofi ${mkRules ["float" "opacity 0.85 0.85" "noborder"] ["class:^([rR]ofi)$"]} + windowrulev2 = opacity 0.85 0.85, floating:1 + ''} + + # Firefox Sharing Indicator + ${mkRules ["float" "move 49% 40" "noborder" "nofullscreenrequest"] ["title:^(.*Sharing Indicator)$"]} + # Emacs windowrulev2 = opaque, class:^emacs$ @@ -134,26 +148,32 @@ in $windowMod = ALT # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more - bind = $mainMod, D, exec, hyprctl keyword general:layout dwindle - bind = $mainMod, E, exec, emacsclient -c -a emacs - bind = $mainMod, F, togglefloating, - bind = $mainMod SHIFT, F, fullscreen, - bind = $mainMod, M, exec, hyprctl keyword general:layout master - bind = $mainMod, P, pseudo, # dwindle - bind = $mainMod, Q, killactive, - bind = $mainMod, R, exec, rofi -x11 -show combi - bind = $mainMod, C, exec, rofi -x11 -show calc -modi calc -no-show-match -no-sort | wl-copy - bind = $mainMod, B, exec, rofi-bluetooth - bind = $mainMod, RETURN, exec, kitty - bind = $mainMod, T, togglesplit, # dwindle - bind = , XF86AudioLowerVolume, exec, pamixer -d 5 - bind = , XF86AudioMute, exec, pamixer -t - bind = , XF86AudioNext, exec, playerctl -p "spotifyd,firefox" next - bind = , XF86AudioPlay, exec, playerctl -p "spotifyd,firefox" play-pause - bind = , XF86AudioPrev, exec, playerctl -p "spotifyd,firefox" previous - bind = , XF86AudioRaiseVolume, exec, pamixer -i 5 - bind = , XF86MonBrightnessDown, exec, brightnessctl s 10%- - bind = , XF86MonBrightnessUp, exec, brightnessctl s 10%+ + + # Window binds + bind = $mainMod , F , togglefloating , + bind = $mainMod , P , pseudo , + bind = $mainMod , Q , killactive , + bind = $mainMod , T , togglesplit , + bind = $mainMod SHIFT , F , fullscreen , + + # Program binds + bind = $mainMod , B , exec , rofi-bluetooth + bind = $mainMod , C , exec , rofi -show calc -modi calc -no-show-match -no-sort | wl-copy + bind = $mainMod , D , exec , hyprctl keyword general:layout dwindle + bind = $mainMod , E , exec , emacsclient -c -a emacs + bind = $mainMod , M , exec , hyprctl keyword general:layout master + bind = $mainMod , R , exec , rofi -show combi + bind = $mainMod , RETURN , exec , kitty + + # XF86 keys + bind = , XF86AudioLowerVolume , exec , pamixer -d 5 + bind = , XF86AudioRaiseVolume , exec , pamixer -i 5 + bind = , XF86AudioMute , exec , pamixer -t + bind = , XF86AudioNext , exec , playerctl -p "spotifyd,firefox" next + bind = , XF86AudioPlay , exec , playerctl -p "spotifyd,firefox" play-pause + bind = , XF86AudioPrev , exec , playerctl -p "spotifyd,firefox" previous + bind = , XF86MonBrightnessDown , exec , brightnessctl s 10%- + bind = , XF86MonBrightnessUp , exec , brightnessctl s 10%+ # Move focus with mainMod + hjkl bind = $mainMod, H, movefocus, l @@ -161,11 +181,17 @@ in bind = $mainMod, K, movefocus, u bind = $mainMod, J, movefocus, d - # Change current active window size with mainMod + hjkl + # Change current active window size with mainMod + SHIFT + hjkl bind = $mainMod SHIFT, H, resizeactive, -10 0 - bind = $mainMod SHIFT, L, resizeactive, 10 0 - bind = $mainMod SHIFT, K, resizeactive, 0 -10 bind = $mainMod SHIFT, J, resizeactive, 0 10 + bind = $mainMod SHIFT, K, resizeactive, 0 -10 + bind = $mainMod SHIFT, L, resizeactive, 10 0 + + # Move current active window with mainMod + ALT + hjkl + bind = $mainMod ALT, H, movewindow, l + bind = $mainMod ALT, J, movewindow, d + bind = $mainMod ALT, K, movewindow, u + bind = $mainMod ALT, L, movewindow, r # Switch workspaces with mainMod + [0-9] bind = $mainMod, 1, workspace, 1 @@ -200,4 +226,5 @@ in bindm = $mainMod, mouse:273, resizewindow exec-once=synology-drive + exec-once=randomWallpaper '' diff --git a/modules/programs/hyprland/default.nix b/modules/programs/hyprland/default.nix index f8c9d8d..c1a7c9b 100644 --- a/modules/programs/hyprland/default.nix +++ b/modules/programs/hyprland/default.nix @@ -15,6 +15,16 @@ in options.my.programs.hyprland = { enable = mkEnableOption "hyprland"; nvidiaSupport = mkEnableOption "enable nvidia Support"; + blur = mkOption { + type = types.bool; + description = "enable window blurring"; + default = true; + }; + shadows = mkOption { + type = types.bool; + description = "enable window shadows"; + default = true; + }; }; config = mkIf cfg.enable { @@ -26,39 +36,59 @@ in services.dunst.enable = true; }; - home-manager.users.moritz = { - imports = [ inputs.hyprland.homeManagerModules.default ]; + # enable nix module + programs.hyprland = { + enable = true; + package = null; # because we use the home-manager module + }; - programs.waybar = { - enable = true; - package = pkgs.waybar-hyprland; - systemd = { - enable = true; - target = "hyprland-session.target"; - }; - settings = { - mainBar = { - layer = "top"; - position = "top"; - height = 30; - modules-left = [ "wlr/workspaces" ]; - modules-center = [ "hyprland/window" ]; - modules-right = [ "network" "memory" "cpu" "battery" "clock" ]; - modules = { - "wlr/workspaces" = { - on-click = "activate"; - }; - }; - }; - }; - }; + + # enable home-manager module + home-manager.users.moritz = { + # import home-manager module + imports = [ inputs.hyprland.homeManagerModules.default ]; wayland.windowManager.hyprland = { enable = true; package = hyprland; extraConfig = import ./config.nix args; }; + }; + + # add waybar as a status bar + home-manager.users.moritz.programs.waybar = { + enable = true; + + # use package with hyprland support for switching workspaces + package = pkgs.waybar-hyprland; + + # start using systemd service + systemd = { + enable = true; + target = "hyprland-session.target"; + }; + + settings = { + mainBar = { + layer = "top"; + position = "top"; + height = 30; + modules-left = [ "wlr/workspaces" ]; + modules-center = [ "hyprland/window" ]; + modules-right = [ "network" "memory" "cpu" "battery" "clock" ]; + modules = { + "wlr/workspaces" = { + on-click = "activate"; + }; + }; + }; + }; + }; + + + # lock screen after timeout + home-manager.users.moritz = { services.swayidle = { enable = true; events = [ @@ -83,49 +113,57 @@ in } ]; }; + # start swayidle as part of hyprland, not sway systemd.user.services.swayidle.Install.WantedBy = lib.mkForce [ "hyprland-session.target" ]; - - xdg.configFile."hypr/hyprpaper.conf" = { - text = - let - setWallpaper = wallpaper: '' - preload = ${wallpaper} - wallpaper = ,${wallpaper} - ''; - in - setWallpaper "/home/moritz/.config/wallpapers/a_short_walk.png"; - onChange = "${pkgs.systemd}/bin/systemctl restart --user hyprpaper.service"; - }; }; + + # adds pam module for swaylock + security.pam.services.swaylock = { }; + + + # start hyprpaper daemon using systemd unit (to set wallpaper) systemd.user.services.hyprpaper = { enable = true; path = [ pkgs.hyprpaper ]; wantedBy = [ "hyprland-session.target" ]; - after = [ "display-manager.service" ]; + after = [ "hyprland-session.target" ]; script = "hyprpaper"; }; - users.users.moritz.packages = with pkgs; [ - swayidle - swaylock-effects - pamixer - playerctl - brightnessctl - grimblast - slurp - grim - wl-clipboard - wdisplays - ]; - - security.pam.services.swaylock = { }; - - programs.hyprland = { - enable = true; - package = null; + # set hyprpaper conf (for setting initial background) + home-manager.users.moritz.xdg.configFile."hypr/hyprpaper.conf" = { + text = + let + setWallpaper = wallpaper: '' + preload = ${wallpaper} + wallpaper = ,${wallpaper} + ''; + in + setWallpaper "/home/moritz/.config/wallpapers/a_short_walk.png"; + onChange = "${pkgs.systemd}/bin/systemctl restart --user hyprpaper.service"; }; + + # only consider graphical-session.target started when hyprland-sesstion.target is reached + systemd.user.targets.hyprland-session = { + wantedBy = [ "graphical-session.target" ]; + before = [ "graphical-session.target" ]; + }; + + + # add user packages for wayland and hyprland in particular + users.users.moritz.packages = with pkgs; [ + pamixer # pulse audio cli + playerctl # control media playback + brightnessctl # control brightness + grimblast # screenshot tool for hyprland + slurp # region select for wayland (for screensharing) + wl-clipboard # clipboard tool for wayland + ]; + + + # additional environment variables environment.sessionVariables = { XDG_CURRENT_DESKTOP = "Hyprland"; @@ -136,18 +174,19 @@ in QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; QT_QPA_PLATFORMTHEME = "qt5ct"; _JAVA_AWT_WM_NONEREPARENTING = "1"; - } // - (if cfg.nvidiaSupport then + } // (optionalAttrs cfg.nvidiaSupport { LIBVA_DRIVER_NAME = "nvidia"; GBM_BACKEND = "nvidia-drm"; __GLX_VENDOR_LIBRARY_NAME = "nvidia"; WLR_NO_HARDWARE_CURSORS = "1"; __GL_VRR_ALLOWED = "0"; - } else { }); + }); + services = { dbus.enable = true; + # use pipewire (needed for screensharing) pipewire = { enable = true; alsa.enable = true; @@ -163,12 +202,14 @@ in user = "moritz"; }; defaultSession = "hyprland"; - sessionPackages = [ hyprland ]; + sessionPackages = [ hyprland ]; # can't set the defaultSession otherwise }; }; }; security.rtkit.enable = true; + + # dekstop portal (for screensharing) xdg.portal = { enable = true; wlr.enable = true; diff --git a/modules/programs/nvim/default.nix b/modules/programs/nvim/default.nix new file mode 100644 index 0000000..1d29b71 --- /dev/null +++ b/modules/programs/nvim/default.nix @@ -0,0 +1,101 @@ +{ config +, lib +, pkgs +, inputs +, ... +}: + +with lib; +let + cfg = config.my.programs.vim; + + mkDate = longDate: (lib.concatStringsSep "-" [ + (builtins.substring 0 4 longDate) + (builtins.substring 4 2 longDate) + (builtins.substring 6 2 longDate) + ]); + + mkVersionInput = input: mkDate (input.lastModifiedDate or "19700101") + "_" + (input.shortRev or "dirty"); + + nvim-treesitter-textsubjects = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "nvim-treesitter-textsubjects"; + version = mkVersionInput inputs.nvim-treesitter-textsubjects; + src = inputs.nvim-treesitter-textsubjects; + }; + + smartcolumn-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "smartcolumn-nvim"; + version = mkVersionInput inputs.smartcolumn-nvim; + src = inputs.smartcolumn-nvim; + }; +in +{ + options.my.programs.vim = { + enable = mkOption { + default = true; + type = types.bool; + example = false; + }; + }; + + config = mkIf cfg.enable { + home-manager.users.moritz.programs.neovim = { + enable = true; + package = pkgs.neovim-nightly; + vimAlias = true; + vimdiffAlias = true; + withNodeJs = true; + withPython3 = true; + extraLuaConfig = builtins.readFile ./init.lua; + extraPackages = with pkgs; [ + alejandra + black + isort + nil + nixpkgs-fmt + rustfmt + shfmt + stylua + sumneko-lua-language-server + taplo + yamlfmt + ]; + plugins = with pkgs.vimPlugins; [ + catppuccin-nvim + cmp-nvim-lsp + cmp_luasnip + comment-nvim + copilot-cmp + copilot-lua + dashboard-nvim + formatter-nvim + gitsigns-nvim + lsp_lines-nvim + lspkind-nvim + lualine-lsp-progress + lualine-nvim + luasnip + neogit + noice-nvim + nui-nvim # for noice-nvim + nvim-autopairs + nvim-cmp + nvim-lastplace + nvim-lspconfig + nvim-surround + nvim-tree-lua + nvim-treesitter-textsubjects + nvim-treesitter.withAllGrammars + nvim-ts-context-commentstring + nvim-web-devicons # for dashboard-nvim + orgmode + plenary-nvim # for telescope, neogit + smartcolumn-nvim + telescope-fzf-native-nvim + telescope-nvim + vim-lion + which-key-nvim + ]; + }; + }; +} diff --git a/modules/programs/nvim/init.lua b/modules/programs/nvim/init.lua new file mode 100644 index 0000000..078cbd2 --- /dev/null +++ b/modules/programs/nvim/init.lua @@ -0,0 +1,481 @@ +vim.g.mapleader = " " +vim.g.maplocalleader = "," + +-- FIX to create spell dir if not existent +local spelldir = vim.fn.stdpath("data") .. "/site/spell" +if not vim.loop.fs_stat(spelldir) then + vim.fn.mkdir(spelldir, "p") +end + +vim.opt.autoindent = true +vim.opt.backupdir = { vim.fn.stdpath("state") .. "/nvim/backup//" } -- don't store backup in files dir +vim.opt.clipboard = "unnamedplus" -- sync with system clipboard +vim.opt.conceallevel = 2 +vim.opt.expandtab = true -- spaces instead of tabs +vim.opt.guifont = "Fira Code Nerd Font:h1" +vim.opt.ignorecase = true +vim.opt.mouse = "a" -- mouse for all modes +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.scrolloff = 4 -- lines of context +vim.opt.shiftround = true -- round indent +vim.opt.shiftwidth = 0 -- use tabstop value +vim.opt.shortmess:append({ c = true }) +vim.opt.signcolumn = "yes" +vim.opt.smartcase = true +vim.opt.splitbelow = true +vim.opt.splitright = true +vim.opt.tabstop = 2 +vim.opt.termguicolors = true +vim.opt.undofile = true +vim.opt.undolevels = 10000 +vim.opt.updatetime = 300 +vim.opt_local.spell = true +vim.opt_local.spelllang = { "en", "de_20" } -- all English regions and new German spelling + +require("catppuccin").setup({ + compile_path = vim.fn.stdpath("cache") .. "/catppuccin", -- fix issue of writing to nix store + integrations = { + which_key = true, + }, +}) +vim.cmd.colorscheme("catppuccin-macchiato") + +vim.o.timeout = true +vim.o.timeoutlen = 500 +local wk = require("which-key") + +require("noice").setup({ + lsp = { + -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, + }, + progress = { + enabled = false, + }, + }, + -- you can enable a preset for easier configuration + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help + }, +}) + +wk.register({ + f = { + name = "find", + f = { "Telescope find_files", "find file" }, + g = { "Telescope live_grep", "live grep" }, + b = { "Telescope buffers", "find buffer" }, + }, +}, { prefix = "" }) +-- To get fzf loaded and working with telescope, you need to call +-- load_extension, somewhere after setup function: +require("telescope").load_extension("fzf") + +require("neogit").setup({ + disable_commit_confirmation = true, +}) +wk.register({ + g = { "Neogit", "git" }, +}, { prefix = "" }) + +require("nvim-treesitter.configs").setup({ + sync_install = false, + auto_install = false, + highlight = { + enable = true, + additional_vim_regex_highlighting = true, + }, +}) + +local lspkind = require("lspkind") + +local cmp = require("cmp") +local luasnip = require("luasnip") +cmp.setup({ + formatting = { + format = lspkind.cmp_format({ + mode = "symbol", -- show only symbol annotations + maxwidth = 50, -- prevent the popup from showing more than provided characters + ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead + symbol_map = { + Copilot = "", + }, + }), + }, + snippet = { + -- REQUIRED - you must specify a snippet engine + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + sources = { + { name = "buffer", priority = 1 }, + { name = "copilot", priority = 8 }, + { name = "luasnip", priority = 7 }, + { name = "nvim_lsp", priority = 9 }, + { name = "orgmode", priority = 9 }, + }, +}) + +---merge tables +---@param ... table[] +---@return table +local function table_merge(...) + local tables_to_merge = { ... } + assert(#tables_to_merge > 1, "There should be at least two tables to merge them") + + for k, t in ipairs(tables_to_merge) do + assert(type(t) == "table", string.format("Expected a table as function parameter %d", k)) + end + + local result = tables_to_merge[1] + + for i = 2, #tables_to_merge do + local from = tables_to_merge[i] + for k, v in pairs(from) do + if type(v) == "table" then + result[k] = result[k] or {} + result[k] = table_merge(result[k], v) + else + result[k] = v + end + end + end + + return result +end + +-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands +require("formatter").setup({ + -- Enable or disable logging + logging = true, + -- Set the log level + log_level = vim.log.levels.WARN, + -- All formatter configurations are opt-in + filetype = { + -- Formatter configurations for filetype "lua" go here + -- and will be executed in order + lua = { + -- "formatter.filetypes.lua" defines default configurations for the + -- "lua" filetype + require("formatter.filetypes.lua").stylua, + }, + nix = { + require("formatter.filetypes.nix").nixpkgs_fmt, + }, + python = { + require("formatter.filetypes.python").black, + }, + rust = { + require("formatter.filetypes.rust").rustfmt, + }, + sh = { + require("formatter.filetypes.sh").shfmt, + }, + toml = { + require("formatter.filetypes.toml").taplo, + }, + yaml = { + require("formatter.filetypes.yaml").yamlfmt, + }, + + -- HACK to use specific formatters only when specified + alejandra = { + require("formatter.filetypes.nix").alejandra, + }, + isort = { + require("formatter.filetypes.python").isort, + }, + + -- Use the special "*" filetype for defining formatter configurations on + -- any filetype + ["*"] = { + -- "formatter.filetypes.any" defines default configurations for any + -- filetype + require("formatter.filetypes.any").remove_trailing_whitespace, + }, + }, +}) +vim.api.nvim_create_user_command("Fmt", function(opts) + local params = vim.split(opts.args, "%s+", { trimempty = true }) + local filetype = vim.bo.filetype + vim.cmd("set filetype=" .. params[1]) -- fake filetype + vim.cmd(":Format") + vim.cmd("set filetype=" .. filetype) -- restore original filetype +end, { + nargs = 1, + complete = function() + local languages = { + nix = { "alejandra" }, + python = { "isort" }, + } + return languages[vim.bo.filetype] or {} + end, +}) +wk.register({ + ["="] = { "Format", "format (formatter)" }, +}, { noremap = true, silent = true }) + +local lsp_lines = require("lsp_lines") +lsp_lines.setup() +-- Disable virtual_text since it's redundant due to lsp_lines. +vim.diagnostic.config({ + virtual_text = false, +}) + +-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers.. +local capabilities = require("cmp_nvim_lsp").default_capabilities() + +local lspconfig = require("lspconfig") +local on_attach_def = function(_, bufnr) + wk.register({ + K = { vim.lsp.buf.hover, "show info" }, + [""] = { + l = { + name = "lsp", + d = { vim.diagnostic.open_float, "open diagnostic window" }, + n = { vim.diagnostic.goto_next, "next error" }, + p = { vim.diagnostic.goto_prev, "prev error" }, + c = { vim.lsp.buf.code_action, "code action" }, + r = { vim.lsp.buf.rename, "rename" }, + f = { + function() + vim.lsp.buf.format({ async = true }) + end, + "format (lsp)", + mode = { "n", "v" }, + }, + }, + w = { + name = "workspace", + a = { vim.lsp.buf.add_workspace_folder, "add workspace folder" }, + r = { vim.lsp.buf.remove_workspace_folder, "remove workspace folder" }, + l = { + function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, + "list workspace folders", + }, + }, + t = { + name = "toggle", + l = { lsp_lines.toggle, "lsp lines" }, + }, + }, + g = { + name = "goto", + r = { vim.lsp.buf.references, "references" }, + d = { vim.lsp.buf.definition, "definition" }, + D = { vim.lsp.buf.declaration, "declaration" }, + i = { vim.lsp.buf.implementation, "implementation" }, + t = { vim.lsp.buf.type_definition, "type defininition" }, + }, + }, { buffer = bufnr, silent = true }) +end + +local lspconfig_default_options = { + on_attach = on_attach_def, + capabilities = capabilities, + flags = { + debounce_text_changes = 100, + }, +} + +---function to add default options to lspconfig +---@param lsp string +---@param options table +---@return nil +local function lspconfig_setup(lsp, options) + local final_options = table_merge(lspconfig_default_options, options) + lspconfig[lsp].setup(final_options) +end + +local servers = { "nil_ls", "pylsp", "rust_analyzer" } +for _, lsp in ipairs(servers) do + lspconfig_setup(lsp, {}) +end + +lspconfig_setup("lua_ls", { + on_attach = on_attach_def, + capabilities = capabilities, + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { "vim" }, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + checkThirdParty = false, + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, + format = { + enable = false, + }, + }, + }, +}) + +require("dashboard").setup({ + theme = "hyper", + config = { + packages = { enable = true }, + week_header = { + enable = true, + }, + }, +}) + +require("lualine").setup({ + options = { + icons_enabled = true, + theme = "auto", + component_separators = "|", + section_separators = { left = "", right = "" }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + }, + }, + sections = { + lualine_a = { + { "mode", separator = { left = "" }, right_padding = 2 }, + }, + lualine_b = { "branch", "diff", "diagnostics" }, + lualine_c = { "filename", "lsp_progress" }, + lualine_x = { "encoding", "fileformat", "filetype" }, + lualine_y = { "progress" }, + lualine_z = { + { "location", separator = { right = "" }, left_padding = 2 }, + }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { "filename" }, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {}, +}) + +require("Comment").setup() + +require("nvim-treesitter.configs").setup({ + context_commentstring = { + enable = true, + }, +}) + +require("nvim-surround").setup({}) + +require("nvim-treesitter.configs").setup({ + textsubjects = { + enable = true, + prev_selection = ",", -- (Optional) keymap to select the previous selection + keymaps = { ["."] = "textsubjects-smart" }, + }, +}) + +require("copilot").setup({ + suggestion = { enabled = false }, + panel = { enabled = false }, +}) +require("copilot_cmp").setup() + +local orgmode = require("orgmode") +-- Load custom treesitter grammar for org filetype +orgmode.setup_ts_grammar() +-- Treesitter configuration +require("nvim-treesitter.configs").setup({ + -- If TS highlights are not enabled at all, or disabled via `disable` prop, + -- highlighting will fallback to default Vim syntax highlighting + highlight = { + enable = true, + -- Required for spellcheck, some LaTex highlights and + -- code block highlights that do not have ts grammar + additional_vim_regex_highlighting = { "org" }, + }, +}) +orgmode.setup({ + org_agenda_files = { "~/Notes/org" }, + org_default_notes_file = "~/Notes/org/refile.org", +}) + +require("gitsigns").setup() + +require("nvim-lastplace").setup({ + lastplace_ignore_buftype = { "quickfix", "nofile", "help" }, + lastplace_ignore_filetype = { "gitcommit", "gitrebase", "svn", "hgcommit" }, + lastplace_open_folds = true, +}) + +require("nvim-autopairs").setup() + +-- disable netrw at the very start of your init.lua (strongly advised) +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 +-- set termguicolors to enable highlight groups +vim.opt.termguicolors = true +-- empty setup using defaults +require("nvim-tree").setup() +wk.register({ + t = { "NvimTreeFindFileToggle", "nvim tree" }, +}, { prefix = "t", silent = true }) + +require("smartcolumn").setup({ + colorcolumn = 120, +}) diff --git a/modules/programs/vim.nix b/modules/programs/vim.nix deleted file mode 100644 index 8e3759b..0000000 --- a/modules/programs/vim.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ config -, lib -, pkgs -, ... -}: - -with lib; -let - cfg = config.my.programs.vim; -in -{ - options.my.programs.vim = { - enable = mkOption { - default = true; - type = types.bool; - example = false; - }; - }; - - config = mkIf cfg.enable { - home-manager.users.moritz.programs.neovim = { - enable = true; - vimAlias = true; - vimdiffAlias = true; - withNodeJs = true; - withPython3 = true; - }; - }; -} diff --git a/modules/security/default.nix b/modules/security/default.nix index 3506583..c3cf86f 100644 --- a/modules/security/default.nix +++ b/modules/security/default.nix @@ -70,9 +70,11 @@ # SSH services.openssh = { - # Disable ssh password login - passwordAuthentication = lib.mkDefault false; - logLevel = "VERBOSE"; + settings = { + # Disable ssh password login + passwordAuthentication = lib.mkDefault false; + logLevel = "VERBOSE"; + }; extraConfig = '' AllowAgentForwarding no AllowTcpForwarding no diff --git a/modules/services/default.nix b/modules/services/default.nix index 4d2b238..d63a582 100644 --- a/modules/services/default.nix +++ b/modules/services/default.nix @@ -8,9 +8,9 @@ ./kdeconnect.nix ./mullvad.nix ./openconnect.nix - ./openvpn.nix ./picom.nix ./printing.nix ./redshift.nix + ./wireguard.nix ]; } diff --git a/modules/services/openvpn.nix b/modules/services/openvpn.nix deleted file mode 100644 index b0b49bc..0000000 --- a/modules/services/openvpn.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ config -, lib -, pkgs -, ... -}: - -with lib; -let - cfg = config.my.services.openvpn; -in -{ - options.my.services.openvpn.enable = mkEnableOption "openvpn"; - - config = lib.mkIf cfg.enable { - age.secrets = { - homeVPN = { - file = ../../secrets/home-vpn.age; - owner = "1000"; - }; - homeVPNPassword = { - file = ../../secrets/home-vpn-password.age; - owner = "1000"; - }; - }; - services.openvpn.servers = { - homeVPN = { - config = "config /run/agenix/homeVPN "; - autoStart = false; - updateResolvConf = true; - }; - }; - systemd.services.openvpn-homeVPN-password = { - description = "Enter homeVPN password"; - script = "cat /run/agenix/homeVPNPassword | systemd-tty-ask-password-agent"; - wantedBy = [ "openvpn-homeVPN.service" ]; - after = [ "openvpn-homeVPN.service" ]; - }; - }; -} diff --git a/modules/services/wireguard.nix b/modules/services/wireguard.nix new file mode 100644 index 0000000..2c81285 --- /dev/null +++ b/modules/services/wireguard.nix @@ -0,0 +1,42 @@ +{ config +, lib +, pkgs +, ... +}: + +with lib; +let + cfg = config.my.services.wireguard; +in +{ + options.my.services.wireguard.enable = mkEnableOption "wireguard"; + + config = lib.mkIf cfg.enable { + age.secrets = { + wireguard-private-key.file = ../../secrets/wireguard-private-key.age; + wireguard-preshared-key.file = ../../secrets/wireguard-preshared-key.age; + }; + networking.firewall = { + allowedUDPPorts = [ 51820 ]; + }; + networking.wg-quick.interfaces = { + wg0 = { + autostart = false; + address = [ "10.8.0.3/24" ]; + listenPort = 51820; + privateKeyFile = "/run/agenix/wireguard-private-key"; + dns = [ "192.168.0.4" "9.9.9.9" ]; + peers = [ + { + publicKey = "bT/U8ko3i//vH8LNn2R56JkGMg+0GLFrZSF81BBax08="; + presharedKeyFile = "/run/agenix/wireguard-preshared-key"; + # Forward all the traffic via VPN. + allowedIPs = [ "0.0.0.0/0" ]; + endpoint = "wg.moritzboeh.me:51820"; + persistentKeepalive = 25; + } + ]; + }; + }; + }; +} diff --git a/overlays/default.nix b/overlays/default.nix index 071a899..ae2256c 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,4 +1,10 @@ { inputs }: final: prev: { + agenix = inputs.agenix.packages.${prev.system}.default; + attic = inputs.attic.packages.${prev.system}.default; + hyprpaper = inputs.hyprpaper.packages.${prev.system}.default; + neovim-nightly = inputs.neovim.packages.${prev.system}.default; + nil = inputs.nil.packages.${prev.system}.default; + logseq-wayland = prev.symlinkJoin { name = "logseq-wayland"; paths = [ prev.logseq ]; diff --git a/secrets/home-vpn-password.age b/secrets/home-vpn-password.age deleted file mode 100644 index ec25887..0000000 Binary files a/secrets/home-vpn-password.age and /dev/null differ diff --git a/secrets/home-vpn.age b/secrets/home-vpn.age deleted file mode 100644 index 6652e7b..0000000 Binary files a/secrets/home-vpn.age and /dev/null differ diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 0862e22..179ef3a 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -12,10 +12,10 @@ let in { "github.age".publicKeys = all; - "home-vpn-password.age".publicKeys = all; - "home-vpn.age".publicKeys = all; "nordvpn.age".publicKeys = all; "spotifyd.age".publicKeys = all; "ssh-home.age".publicKeys = all; "uni-vpn.age".publicKeys = all; + "wireguard-preshared-key.age".publicKeys = all; + "wireguard-private-key.age".publicKeys = all; } diff --git a/secrets/ssh-home.age b/secrets/ssh-home.age index 0922fb5..e7b777b 100644 --- a/secrets/ssh-home.age +++ b/secrets/ssh-home.age @@ -1,18 +1,15 @@ age-encryption.org/v1 --> ssh-ed25519 CjuqfA VN681gpv9+BTd6SAhmBuXZ4dnLocdkw3sdoK4sNeggY -lnTROi2cjMdOS34HrOBjydsV2o2i31SZTFOE0w1Z4wQ --> ssh-ed25519 QRYDmg AEFJbJuGMYRpwFJ0ueCUc+jgU6hgpSqyvEjXnzcCPS4 -It+bPRBNuD6y03HyMkr+u+y1dLKXd/Iv6mpWGTa/ATg --> ssh-ed25519 wG6LYg 9n101tlrOmWcIMQ+Ejw1MauMdXKVPwh0Wpc6Kvys5TY -Mk6Hp8uSpmClPxweTluUnQ7O+PNOyl4aZJJ++2UG/O0 --> ssh-ed25519 ZYd7Zg bXnk/Ih6IWbodj6xFPJOw515+/L21xEaPgTy6wBBxlo -0cPd3Pq99x3qJAafPjYUv7+XwncmMqTYIouqjoAQG+k --> ssh-ed25519 as9VYQ lbIvvkszmYr5ZVqtxR8mCS+bCqskk3+0yf8Mo/RtkX0 -IMY1Gqa7AXyAKCKUW8GTWSWaX3DN4Y5KN5b9JFvMrJI --> M.`tiyM-grease 4bHP!dW -Bt8cOnxP0TP6pMYKg59Z ---- hIrUz6vpXLb1Jhwlc91amUWXEQVM17TQt7zy24nFNeM -Y\)fo`u+u5<;u IJqTS9S"M .[1 ssh-ed25519 CjuqfA dA88zgGLr9EMylHRoamgrDqqjxni4jTZAXQWPQAMTHw +dsYszrArgcNvLxzCSbkCb/4OrWvZZ7/BERm69SZD9II +-> ssh-ed25519 QRYDmg 14j0Wsh5Hb8uWRKc4wCFWeUrIUefaxCT2W4QspILpnQ +Q+q5zY4EZlruiWljyTuOMsvWoYhJ4LVrmdINMrqa9xw +-> ssh-ed25519 wG6LYg aDUeVm/SxILH4BfumqUGjabmjf88+TIgperG5VwMgFg +tC8eV2qaULDDZ9Salf8Srtkzcj+aBAvS3jrsdoZNPzQ +-> ssh-ed25519 ZYd7Zg 4UEmX3MdOc4NnGVFX1Zqh+FFGJxJS4ie8lGg8lvfmQ8 +6jLPInDghRvZjsmjldu+6exhnMfPWpifmduISjhSzXU +-> ssh-ed25519 as9VYQ yY0/1f8IIXu5Zm5kkrgESS/5GxUPA/kzA48eXYNzCz8 +ku7+gyCXWO80SBMQcwO33NPaFmRe9otsZ32IypRemd4 +-> v'jxs-grease -B$97 qqy +/ta/C5FjOBppsamdGDInwnq3Hv4ha+nlzTwIwTIW8/vkC9U3dVqPP9SoknfKYQ +--- G7m5xnL01qkrRPGWra/FhJK9ij8ONfLUVwlOXhc6MYA +TCŁVĬGĮ7Jyܷ>E? |a}%gAk9P˶ {ުEY/9vd.bmjn܍G78 ]5>)pcV ssh-ed25519 CjuqfA HUg3FETh6ezG8DcEaFW/VYrzKoqpGKpWQKk2R+e4zzM +Hnj5vK3gT2+BpGVYfQBPnosUiBgp2shs4g3Va1Z1JzU +-> ssh-ed25519 QRYDmg vc5Qzx8lbFF6BYV/BVNDv7+4tvwdGV8nyUHoVEr1yEA +mp4s4Kg7UcS6HEcaZaFhypPQh6BzeeovpEzxn0Q91Q4 +-> ssh-ed25519 wG6LYg ZDy84tJ1nyrtCdOVlF464rPAmWEQXcP11B30+ccXJ2k +i+efuVas6vT9K55/soO2SOLxo29heQTR12gO5gx5SSI +-> ssh-ed25519 ZYd7Zg jmWJkTLgzrt3nU7KA3xRU37T3EriWngdbCC4GwS/pik +PYtUFRBv8yIuHgDrMJNdrsUsqjjKc/+hmvj1+pY3MpQ +-> ssh-ed25519 as9VYQ qpAgrLdj/1tLgGSH/ixGisVSBAoDB2A/nednmGKqLiM +AD6i7RrNgXcPW6ebr8T1vwsbGDQkWX/zNX7kLZ1bkTI +-> syy03-grease G1Yn Zq| $0 +EmxSuXdlQfAHuTHTAd4nvyFFhfOVswM9F79VwDNuXVkf/SatEO2uhCM4RmInrNhP +a7U1TNxhGd4HuT0k5wqaN2Vr67adR6Hh024vaTxw9OHneQ +--- 7AIOs1wK0DIhK+AVkPDlOZjzFLfhsqZlWXVkLnXNcN8 +!Ȯ^.CJ ]JNĺf0'ajy+ ?;༅w0wE`Sߤ'L#1ET.k= \ No newline at end of file diff --git a/secrets/wireguard-private-key.age b/secrets/wireguard-private-key.age new file mode 100644 index 0000000..7c50bee --- /dev/null +++ b/secrets/wireguard-private-key.age @@ -0,0 +1,15 @@ +age-encryption.org/v1 +-> ssh-ed25519 CjuqfA EQLHOBOVfp+j3x+coXt1isDkG+LvsSYkU8PT1cg97FQ +NJWJKvmN4hUHsC34n1ap4HlipC0rGWlqrbgR4vm91YY +-> ssh-ed25519 QRYDmg LOvHPzC4zfX2rlQBxYwHoHhjftCyWnBRLXZ/aB1ekQM +lVtsflczWZwhBx4FZeJK6jtcUCvwQKIA5Gmbth2to9U +-> ssh-ed25519 wG6LYg nqcLDqaVL7D0seK7kW52vmG/lm0Nd28lBroYrRMVynI +oYA8E4DDR26gpRCdJMWtzoGvUTErI6GMSdF99kTNKtc +-> ssh-ed25519 ZYd7Zg vz3LZxq0+KTx6E4J0X6duivLP0TFtA8WaOQaiSmMcF4 +5g+3H/6J9FjsWifcfmEq8dz0hk4mpZhhJaEndPE3Mpw +-> ssh-ed25519 as9VYQ VIQ18yC/qEiP66hfCwWAbAbNCBypB47gbWkFg/TJmWE +MXK5RnuwAlKt676CPO0N/3BeM9gsgMPZNEG1DXq8uXA +-> 8kx-grease s%obC ~GOw1 C + +--- V8z981BPe2yVOaMCj2np9Vvvy/6zP8xHCFKRFwsceXs ++Xob_)