diff --git a/flake.lock b/flake.lock index 4694edbf..d52b663e 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1736099359, - "narHash": "sha256-cGQB3WkgB0izThndWHmW07kJt0I0G2cGwhSETVNrjl0=", + "lastModified": 1738017347, + "narHash": "sha256-qvpmVnA8wHlPrEdXIA1tyu6sJxgDMEOwPDG4IkX4sZ8=", "owner": "arcnmx", "repo": "nixexprs", - "rev": "8cce84df087eb40f6c0681575f2551ffcb0e3ca8", + "rev": "b8dc621ea27c622703fbe96fb79eb092450f32b2", "type": "github" }, "original": { @@ -70,14 +70,32 @@ "type": "github" } }, + "catppuccin": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1739934729, + "narHash": "sha256-PcrLk10meIJICzUJqtCMOJxoITzbH52fZg2XAB7SSsM=", + "owner": "catppuccin", + "repo": "nix", + "rev": "b1ff2a638afa827f1473498190a2c1cae1cf41cf", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "nix", + "type": "github" + } + }, "ci": { "flake": false, "locked": { - "lastModified": 1733469829, - "narHash": "sha256-eFiBQgPQ5xQLlLruYw0l8hO+SZuKtSWyxCz8HnlLHOA=", + "lastModified": 1738017179, + "narHash": "sha256-c+yh6vfsrSUHOWd0w596NHe0Kav4tG1ZUkPAbX4CEUo=", "owner": "arcnmx", "repo": "ci", - "rev": "0f95b2c2573c592cdc0cb3b4d42e30a1be7f9141", + "rev": "643c8b90bbe2b3a1e9900b6dd6f96ee8e73ff7f3", "type": "github" }, "original": { @@ -115,11 +133,11 @@ ] }, "locked": { - "lastModified": 1736370755, - "narHash": "sha256-iWcjToBpx4PUd74uqvIGAfqqVfyrvRLRauC/SxEKIF0=", + "lastModified": 1739933872, + "narHash": "sha256-UhuvTR4OrWR+WBaRCZm4YMkvjJhZ1KZo/jRjE41m+Ek=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "57733bd1dc81900e13438e5b4439239f1b29db0e", + "rev": "6ab392f626a19f1122d1955c401286e1b7cf6b53", "type": "github" }, "original": { @@ -204,6 +222,38 @@ } }, "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1641205782, + "narHash": "sha256-4jY7RCWUoZ9cKD8co0/4tFARpWB+57+r1bLLvXNJliY=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b7547d3eed6f32d06102ead8991ec52ab0a4f1a7", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1641205782, + "narHash": "sha256-4jY7RCWUoZ9cKD8co0/4tFARpWB+57+r1bLLvXNJliY=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b7547d3eed6f32d06102ead8991ec52ab0a4f1a7", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_4": { "flake": false, "locked": { "lastModified": 1733328505, @@ -219,7 +269,7 @@ "type": "github" } }, - "flake-compat_3": { + "flake-compat_5": { "flake": false, "locked": { "lastModified": 1650374568, @@ -282,11 +332,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -297,7 +347,7 @@ }, "flake-utils-plus": { "inputs": { - "flake-utils": "flake-utils" + "flake-utils": "flake-utils_4" }, "locked": { "lastModified": 1715533576, @@ -314,6 +364,54 @@ "type": "github" } }, + "flake-utils_2": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "flakelib": { "inputs": { "fl-config": "fl-config", @@ -418,11 +516,11 @@ ] }, "locked": { - "lastModified": 1736421950, - "narHash": "sha256-RyrX0WFXxFrYvzHNLTIyuk3NcNl3UBykuYru/P0zW5E=", + "lastModified": 1740265252, + "narHash": "sha256-+LFsCsIUF/pJWL9S21m5NLcK5bgwRB4MwfV0Iu7tggY=", "owner": "nix-community", "repo": "home-manager", - "rev": "d4aebb947a301b8da8654a804979a738c5c5da50", + "rev": "fb568d75cf6c81f30d49eeb73787e9b56454ba16", "type": "github" }, "original": { @@ -442,11 +540,11 @@ ] }, "locked": { - "lastModified": 1739756331, - "narHash": "sha256-nGyLe6tRiqs10mi2XwNjX7Wbn4gYhMYOZaYULPKuQgo=", + "lastModified": 1740617792, + "narHash": "sha256-abLwwwbgWxqCMpwa8oM7e4J12Q/BG7V86SqhMFnwWOk=", "owner": "kittywitch", "repo": "konawall-py", - "rev": "c3ff5ef5e4e0b45b670614b09eb7e6bccae800ac", + "rev": "a3beecbfaaebf786051ff5c23c4cdecc267f8d20", "type": "github" }, "original": { @@ -516,11 +614,11 @@ ] }, "locked": { - "lastModified": 1736473741, - "narHash": "sha256-mt/uzoQ9J7o4lEP1mBJSArE6jsXKhpbnBWFfeOu0CUc=", + "lastModified": 1740188624, + "narHash": "sha256-z5G/JoTGICMdhxkN+sztsrcCD7vRFHIJiw/fchHX580=", "owner": "Infinidoge", "repo": "nix-minecraft", - "rev": "39e804edbf69b926d25db2bb43b80995911d5776", + "rev": "8c0d05c3ce359b0d08226298ff7e4200486cbed3", "type": "github" }, "original": { @@ -529,6 +627,61 @@ "type": "github" } }, + "neorg": { + "flake": false, + "locked": { + "lastModified": 1740095503, + "narHash": "sha256-YhAsGFAe/Qf/quc4banoV7FjMCJ0xxUY8QUzd59RGpg=", + "owner": "nvim-neorg", + "repo": "neorg", + "rev": "e726cbb3103bc7c2a86e7e341188600b7a3a6d7d", + "type": "github" + }, + "original": { + "owner": "nvim-neorg", + "repo": "neorg", + "type": "github" + } + }, + "neorg-overlay": { + "inputs": { + "flake-utils": "flake-utils", + "neorg": "neorg", + "neorg-telescope": "neorg-telescope", + "nixpkgs": "nixpkgs_3", + "norg": "norg", + "norg-meta": "norg-meta" + }, + "locked": { + "lastModified": 1740100467, + "narHash": "sha256-0nQHelWbhQqsv/844mNSzH9ue+oQC7f4ZDhRP5HSvzQ=", + "owner": "nvim-neorg", + "repo": "nixpkgs-neorg-overlay", + "rev": "f967b1ff98b6a065b7b1b92c34e89f044a7cde23", + "type": "github" + }, + "original": { + "owner": "nvim-neorg", + "repo": "nixpkgs-neorg-overlay", + "type": "github" + } + }, + "neorg-telescope": { + "flake": false, + "locked": { + "lastModified": 1722358034, + "narHash": "sha256-ei4uUqpIQjGKzu5ryu0Hlmis9TS9FJsYnjt4J4QdWlw=", + "owner": "nvim-neorg", + "repo": "neorg-telescope", + "rev": "ddb2556644cae922699a239bbb0fe16e25b084b7", + "type": "github" + }, + "original": { + "owner": "nvim-neorg", + "repo": "neorg-telescope", + "type": "github" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -536,11 +689,11 @@ ] }, "locked": { - "lastModified": 1736440205, - "narHash": "sha256-QJgTI//KEGuEJC6FDxuI9Dq8PewIpnxD2NVx2/OHbfc=", + "lastModified": 1739676768, + "narHash": "sha256-U1HQ7nzhJyVVXUgjU028UCkbLQLEIkg42+G7iIiBmlU=", "owner": "Mic92", "repo": "nix-index-database", - "rev": "a2200b499efa01ca8646173e94cdfcc93188f2b8", + "rev": "ae15068e79e22b76c344f0d7f8aed1bb1c5b0b63", "type": "github" }, "original": { @@ -551,11 +704,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1736441705, - "narHash": "sha256-OL7leZ6KBhcDF3nEKe4aZVfIm6xQpb1Kb+mxySIP93o=", + "lastModified": 1740089251, + "narHash": "sha256-Y78mDBWoO8CLLTjQfPfII+KXFb6lAmF9GrLbyVBsIMM=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "8870dcaff63dfc6647fb10648b827e9d40b0a337", + "rev": "18e9f9753e9ae261bcc7d3abe15745686991fd30", "type": "github" }, "original": { @@ -578,22 +731,6 @@ "type": "indirect" } }, - "nixpkgs-current": { - "locked": { - "lastModified": 1739736696, - "narHash": "sha256-zON2GNBkzsIyALlOCFiEBcIjI4w38GYOb+P+R4S8Jsw=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "d74a2335ac9c133d6bbec9fc98d91a77f1604c1f", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs-stable": { "locked": { "lastModified": 1710695816, @@ -612,15 +749,15 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1736344531, - "narHash": "sha256-8YVQ9ZbSfuUk2bUf2KRj60NRraLPKPS0Q4QFTbc+c2c=", - "owner": "nixos", + "lastModified": 1736012469, + "narHash": "sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs+rI=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "bffc22eb12172e6db3c5dde9e3e5628f8e3e7912", + "rev": "8f3e1f807051e32d8c95cd12b9b421623850a34d", "type": "github" }, "original": { - "owner": "nixos", + "owner": "NixOS", "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" @@ -628,11 +765,59 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1736344531, - "narHash": "sha256-8YVQ9ZbSfuUk2bUf2KRj60NRraLPKPS0Q4QFTbc+c2c=", + "lastModified": 1740019556, + "narHash": "sha256-vn285HxnnlHLWnv59Og7muqECNMS33mWLM14soFIv2g=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "dad564433178067be1fbdfcce23b546254b6d641", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1644486793, + "narHash": "sha256-EeijR4guVHgVv+JpOX3cQO+1XdrkJfGmiJ9XVsVU530=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1882c6b7368fd284ad01b0a5b5601ef136321292", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1644486793, + "narHash": "sha256-EeijR4guVHgVv+JpOX3cQO+1XdrkJfGmiJ9XVsVU530=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1882c6b7368fd284ad01b0a5b5601ef136321292", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { + "locked": { + "lastModified": 1739866667, + "narHash": "sha256-EO1ygNKZlsAC9avfcwHkKGMsmipUk1Uc0TbrEZpkn64=", "owner": "nixos", "repo": "nixpkgs", - "rev": "bffc22eb12172e6db3c5dde9e3e5628f8e3e7912", + "rev": "73cf49b8ad837ade2de76f87eb53fc85ed5d4680", "type": "github" }, "original": { @@ -642,18 +827,75 @@ "type": "github" } }, + "nixpkgs_7": { + "locked": { + "lastModified": 1739866667, + "narHash": "sha256-EO1ygNKZlsAC9avfcwHkKGMsmipUk1Uc0TbrEZpkn64=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "73cf49b8ad837ade2de76f87eb53fc85ed5d4680", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "norg": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_4" + }, + "locked": { + "lastModified": 1672582520, + "narHash": "sha256-kv3UiJUqMSF1qd3r4OCWomVTHTYjwX/EBRWm8mOSdwg=", + "owner": "nvim-neorg", + "repo": "tree-sitter-norg", + "rev": "d7a466e182a532065a559dbfc7a847271d5e9c29", + "type": "github" + }, + "original": { + "owner": "nvim-neorg", + "ref": "dev", + "repo": "tree-sitter-norg", + "type": "github" + } + }, + "norg-meta": { + "inputs": { + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_5" + }, + "locked": { + "lastModified": 1713028366, + "narHash": "sha256-8qSdwHlfnjFuQF4zNdLtU2/tzDRhDZbo9K54Xxgn5+8=", + "owner": "nvim-neorg", + "repo": "tree-sitter-norg-meta", + "rev": "6f0510cc516a3af3396a682fbd6655486c2c9d2d", + "type": "github" + }, + "original": { + "owner": "nvim-neorg", + "repo": "tree-sitter-norg-meta", + "type": "github" + } + }, "nur": { "inputs": { "flake-parts": "flake-parts_2", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_7", "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1736478119, - "narHash": "sha256-E06gp8mRYBMkS9ePNATbd2YToKOiD+F3Xrcb1rpC/6c=", + "lastModified": 1740255824, + "narHash": "sha256-2JqThJ+VgT2xPhVKCsIuWMEAEskXDZc++JQqiR6Pfk4=", "owner": "nix-community", "repo": "NUR", - "rev": "659c5904ac04aac2684c7dc802d4172549936e04", + "rev": "bca836cda440d41eb616125da37d881f1e4d94e8", "type": "github" }, "original": { @@ -672,11 +914,11 @@ ] }, "locked": { - "lastModified": 1735049224, - "narHash": "sha256-fWUd9kyXdepphJ7cCzOsuSo7l0kbFCkUqfgKqZyFZzE=", + "lastModified": 1739557722, + "narHash": "sha256-XikzLpPUDYiNyJ4w2SfRShdbSkIgE3btYdxCGInmtc4=", "owner": "pjones", "repo": "plasma-manager", - "rev": "d16bbded0ae452bc088489e7dca3ef58d8d1830b", + "rev": "1f3e1f38dedbbb8aad77e184fb54ec518e2d9522", "type": "github" }, "original": { @@ -717,6 +959,7 @@ "arcexprs": "arcexprs", "base16": "base16", "base16-data": "base16-data", + "catppuccin": "catppuccin", "ci": "ci", "darwin": "darwin", "deploy-rs": "deploy-rs", @@ -728,10 +971,10 @@ "konawall-py": "konawall-py", "lanzaboote": "lanzaboote", "minecraft": "minecraft", + "neorg-overlay": "neorg-overlay", "nix-index-database": "nix-index-database", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_2", - "nixpkgs-current": "nixpkgs-current", + "nixpkgs": "nixpkgs_6", "nur": "nur", "plasma-manager": "plasma-manager", "scalpel": "scalpel", @@ -739,7 +982,7 @@ "sops-nix": "sops-nix", "spacebar": "spacebar", "std": "std", - "systems": "systems_2", + "systems": "systems_3", "tree": "tree", "utils": "utils", "wezterm": "wezterm", @@ -820,7 +1063,7 @@ }, "snowfall-lib": { "inputs": { - "flake-compat": "flake-compat_3", + "flake-compat": "flake-compat_5", "flake-utils-plus": "flake-utils-plus", "nixpkgs": [ "solaar", @@ -844,7 +1087,7 @@ }, "solaar": { "inputs": { - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat_4", "nixpkgs": [ "nixpkgs" ], @@ -870,11 +1113,11 @@ ] }, "locked": { - "lastModified": 1736203741, - "narHash": "sha256-eSjkBwBdQk+TZWFlLbclF2rAh4JxbGg8az4w/Lfe7f4=", + "lastModified": 1739262228, + "narHash": "sha256-7JAGezJ0Dn5qIyA2+T4Dt/xQgAbhCglh6lzCekTVMeU=", "owner": "Mic92", "repo": "sops-nix", - "rev": "c9c88f08e3ee495e888b8d7c8624a0b2519cb773", + "rev": "07af005bb7d60c7f118d9d9f5530485da5d1e975", "type": "github" }, "original": { @@ -952,6 +1195,21 @@ "type": "github" } }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "tree": { "inputs": { "nixpkgs": [ @@ -1032,11 +1290,11 @@ }, "locked": { "dir": "nix", - "lastModified": 1735931735, - "narHash": "sha256-4wzEN5IPYmqLP8TAdFatoRhCZ7W9y65AWoYN0Qgvbg8=", + "lastModified": 1740259252, + "narHash": "sha256-Aoqs7WupQProspwQFLQ4ZfweGgCAA+kBiwy2F9yhkNI=", "owner": "wez", "repo": "wezterm", - "rev": "8e9cf912e66f704f300fac6107206a75036de1e7", + "rev": "f7db9554f532e12d3cb68b6877d1323e9a3fd6ca", "type": "github" }, "original": { @@ -1057,11 +1315,11 @@ ] }, "locked": { - "lastModified": 1736095716, - "narHash": "sha256-csysw/Szu98QDiA2lhWk9seYOyCebeVEWL89zh1cduM=", + "lastModified": 1740046902, + "narHash": "sha256-Xbhz8eEqBmNpvqaGFbF5JopmfNJccWUr8eExtU/iGX4=", "owner": "nix-community", "repo": "NixOS-WSL", - "rev": "63c3b4ed1712a3a0621002cd59bfdc80875ecbb0", + "rev": "c4f6ae89468939d9fcf1a317c062cf5dd02004ea", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 51ba195e..5b77c284 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "Kat's Infrastructure"; inputs = { systems.url = "github:nix-systems/default"; - + catppuccin.url = "github:catppuccin/nix"; # to allow non-nix 2.4 evaluation flake-compat = { url = "github:edolstra/flake-compat"; @@ -18,9 +18,6 @@ nixpkgs = { url = "github:nixos/nixpkgs/nixos-unstable"; }; - nixpkgs-current = { - url = "github:nixos/nixpkgs/nixos-unstable"; - }; solaar = { # ewww flakehub ;; url = "https://flakehub.com/f/Svenum/Solaar-flake/*.tar.gz"; @@ -97,6 +94,7 @@ url = "github:numtide/flake-utils"; inputs.systems.follows = "systems"; }; + neorg-overlay.url = "github:nvim-neorg/nixpkgs-neorg-overlay"; # file structure -> attrset tree = { url = "github:kittywitch/tree"; diff --git a/home/environments/i3/catppuccin.nix b/home/environments/i3/catppuccin.nix new file mode 100644 index 00000000..eb16d8b9 --- /dev/null +++ b/home/environments/i3/catppuccin.nix @@ -0,0 +1,10 @@ +{ config, lib, ... }: let + inherit (config.catppuccin) sources; + inherit (lib) mkBefore; + cfg = config.catppuccin.sway; + theme = "${sources.sway}/catppuccin-${cfg.flavor}"; +in { + xsession.windowManager.i3.extraConfigEarly = '' + ${builtins.readFile theme} + ''; +} diff --git a/home/environments/i3/dunst.nix b/home/environments/i3/dunst.nix new file mode 100644 index 00000000..aab21265 --- /dev/null +++ b/home/environments/i3/dunst.nix @@ -0,0 +1,5 @@ +_: { + services.dunst = { + enable = true; + }; +} diff --git a/home/environments/i3/i3.nix b/home/environments/i3/i3.nix new file mode 100644 index 00000000..b1e83079 --- /dev/null +++ b/home/environments/i3/i3.nix @@ -0,0 +1,157 @@ +{ + pkgs, + lib, +std, + config, + ... +}: +let + inherit (std) list; + inherit (lib.modules) mkMerge; + inherit (lib) mkOptionDefault mkDefault mapAttrs; +in { + home.packages = with pkgs; [ + maim + pcmanfm + pavucontrol + xclip + ]; + services.i3gopher.enable = true; + xsession.windowManager.i3 = { + enable = true; + package = pkgs.i3-gaps; + extraConfig = '' + workspace 1 output DP-2 + workspace 11 output HDMI-0 + ''; + config = let + modifier = "Mod4"; + other_modifier = "Mod1"; + mod = modifier; + mod2 = other_modifier; + in { + inherit modifier; + fonts = [ + "Monaspace Krypton" + "FontAwesome 6" + ]; + startup = [ + { command = "~/.screenlayout/main.sh"; } + { command = "blueman-applet"; } + ]; + keybindings = let + bindWorkspace = key: workspace: { + "${mod}+${key}" = "workspace number ${workspace}"; + "${mod}+shift+${key}" = "move container to workspace number ${workspace}"; + }; + mapDefaultAttrs = e: mapAttrs (_: mkDefault) e; + workspaceBindings = + list.map (v: bindWorkspace v "${v}") (list.map builtins.toString (list.range 1 9)) + ++ [ + ( + bindWorkspace "0" "10" + ) + ] + ++ list.imap (i: v: bindWorkspace v "${toString (11 + i)}") (list.map (n: "F${builtins.toString n}") (std.list.range 1 12)); + normalBindings = { + "Print" = "exec --no-startup-id maim \"/home/$USER/Pictures/$(date)\""; + "${mod2}+Print" = "exec --no-startup-id maim --window $(xdotool getactivewindow) \"/home/$USER/Pictures/$(date)\""; + "Shift+Print" = "exec --no-startup-id maim --select \"/home/$USER/Pictures/$(date)\""; + + "Ctrl+Print" = "exec --no-startup-id maim | xclip -selection clipboard -t image/png"; + "Ctrl+${mod2}+Print" = "exec --no-startup-id maim --window $(xdotool getactivewindow) | xclip -selection clipboard -t image/png"; + "Ctrl+Shift+Print" = "exec --no-startup-id maim --select | xclip -selection clipboard -t image/png"; + "${mod}+p" = "exec ${pkgs.dmenu}/bin/dmenu_run"; + "${mod}+x" = "exec sh -c '${pkgs.maim}/bin/maim -s | xclip -selection clipboard -t image/png'"; + "${mod}+Shift+x" = "exec sh -c '${pkgs.i3lock}/bin/i3lock -c 222222 & sleep 5 && xset dpms force of'"; + "${mod}+Return" = "exec ${config.programs.wezterm.package}/bin/wezterm"; + "${mod}+Tab" = "workspace back_and_forth"; + "${mod}+Shift+Tab" = "exec ${config.services.i3gopher.focus-last}"; + }; + in mkMerge (map mapDefaultAttrs ([ normalBindings ] ++ workspaceBindings)); + workspaceAutoBackAndForth = true; + colors = { + focused = { + border = "$lavender"; + background = "$base"; + text = "$text"; + indicator = "$rosewater"; + childBorder = "$lavender"; + }; + focusedInactive = { + border = "$overlay0"; + background = "$base"; + text = "$text"; + indicator = "$rosewater"; + childBorder = "$overlay0"; + }; + unfocused = { + border = "$overlay0"; + background = "$base"; + text = "$text"; + indicator = "$rosewater"; + childBorder = "$overlay0"; + }; + urgent = { + border = "$peach"; + background = "$base"; + text = "$peach"; + indicator = "$overlay0"; + childBorder = "$peach"; + }; + placeholder = { + border = "$overlay0"; + background = "$base"; + text = "$text"; + indicator = "$overlay0"; + childBorder = "$overlay0"; + }; + background = "$base"; + }; + bars = [ + { + # as if anyone was questioning that, + position = "bottom"; + fonts = { + names = [ + "Monaspace Krypton" + "FontAwesome 6 Free" + "FontAwesome 6 Brands" + ]; + size = "8"; + }; + colors = { + background = "$base"; + statusline = "$text"; + separator = "$text"; + focusedBackground = "$base"; + focusedStatusline = "$text"; + focusedSeparator = "$base"; + focusedWorkspace = { + border ="$base"; + background = "$mauve"; + text = "$crust"; + }; + activeWorkspace = { + border = "$base"; + background = "$surface2"; + text = "$text"; + }; + inactiveWorkspace = { + border = "$base"; + background = "$base"; + text = "$text"; + }; + urgentWorkspace = { + border = "$base"; + background = "$red"; + text = "$crust"; + }; + }; + trayOutput = "primary"; + statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${config.xdg.configHome}/i3status-rust/config-gaybar.toml"; + } + ]; + }; + }; +} diff --git a/home/environments/i3/i3status-rust.nix b/home/environments/i3/i3status-rust.nix new file mode 100644 index 00000000..7dfab5bd --- /dev/null +++ b/home/environments/i3/i3status-rust.nix @@ -0,0 +1,55 @@ +_: { + programs.i3status-rust = { + enable = true; + bars = { + # YOU! I WANNA TAKE YOU TO A + gaybar = { + blocks = [ + { + block = "cpu"; + interval = 1; + } + { + block = "load"; + interval = 1; + format = " $icon $1m "; + } + { + block = "memory"; + format = " $icon $mem_total_used_percents.eng(w:2) "; + } + { + block = "memory"; + format = " $icon_swap $swap_used_percents.eng(w:2) "; + } + { + block = "nvidia_gpu"; + format = " $icon $utilization $memory $temperature "; + } + { + block = "hueshift"; + } + { + block = "music"; + format = " $icon {$combo.str(max_w:60) $play |}"; + } + { + block = "sound"; + format = " $icon {$volume.eng(w:2) |}"; + } + { + block = "notify"; + format = " $icon {($notification_count.eng(w:1)) |}"; + } + { + block = "time"; + interval = 1; + format = " $icon $timestamp.datetime(f:'%F %T %Z') "; + } + ]; + theme = "ctp-latte"; + icons = "awesome6"; + }; + }; + }; +} diff --git a/home/environments/i3/konawall.nix b/home/environments/i3/konawall.nix new file mode 100644 index 00000000..26d2418a --- /dev/null +++ b/home/environments/i3/konawall.nix @@ -0,0 +1,42 @@ +{ + inputs, + pkgs, + config, + ... +}: let + konawallConfig = { + interval = 30 * 60; + rotate = true; + source = "konachan"; + tags = [ + #"rating:s" + "touhou" + "score:>=50" + "width:>=1500" + ]; + logging = { + file = "INFO"; + console = "DEBUG"; + }; + }; +in { + home.packages = [ + inputs.konawall-py.packages.${pkgs.system}.konawall-py + ]; + xdg.configFile = { + "konawall/config.toml".source = (pkgs.formats.toml {}).generate "konawall-config" konawallConfig; + }; + systemd.user.services.konawall-py-gnome = { + Unit = { + Description = "konawall-py"; + X-Restart-Triggers = [(toString config.xdg.configFile."konawall/config.toml".source)]; + After = ["graphical-session.target" "network-online.target"]; + }; + Service = { + ExecStart = "${inputs.konawall-py.packages.${pkgs.system}.konawall-py}/bin/konawall"; + Restart = "on-failure"; + RestartSec = "1s"; + }; + Install = {WantedBy = ["graphical-session.target"];}; + }; +} diff --git a/home/environments/i3/picom.nix b/home/environments/i3/picom.nix new file mode 100644 index 00000000..595e54a9 --- /dev/null +++ b/home/environments/i3/picom.nix @@ -0,0 +1,5 @@ +_: { + services.picom = { + enable = true; + }; +} diff --git a/home/environments/i3/redshift.nix b/home/environments/i3/redshift.nix new file mode 100644 index 00000000..cfc0b61a --- /dev/null +++ b/home/environments/i3/redshift.nix @@ -0,0 +1,6 @@ +_: { + services.gammastep = { + enable = true; + provider = "geoclue2"; + }; +} diff --git a/home/environments/kde/kde.nix b/home/environments/kde/kde.nix index 21ccc2a9..e1838730 100644 --- a/home/environments/kde/kde.nix +++ b/home/environments/kde/kde.nix @@ -1,6 +1,9 @@ {pkgs, ...}: { home.sessionVariables = { - QT_QPA_PLATFORMTHEME = "qt5ct"; + QT_QPA_PLATFORMTHEME = "qt6ct"; + #XDG_BACKEND = "x11"; + XDG_CURRENT_DESKTOP = "kde"; + #GDK_BACKEND = "x11"; }; home.packages = with pkgs.kdePackages; [ kscreen @@ -54,14 +57,9 @@ systemsettings kcmutils ]; - xdg.configFile."Kvantum/kvantum.kvconfig".source = (pkgs.formats.ini {}).generate "kvantum.kvconfig" { - General.theme = "commonalitysol"; - }; programs.plasma = { enable = true; workspace = { - colorScheme = "CommonalitySol"; - theme = "CommonalitySol"; }; fonts = let katFont = { @@ -80,7 +78,7 @@ "kdeglobals"."General"."BrowserApplication" = "firefox.desktop"; "kdeglobals"."General"."TerminalApplication" = "konsole"; "kxkbrc"."Layout"."ResetOldOptions" = true; - "kxkbrc"."Layout"."Options" = "terminate:ctrl_alt_bksp,ctrl:hyper_capscontrol"; + "kxkbrc"."Layout"."Options" = "terminate:ctrl_alt_bksp,ctrl:capscontrol"; }; }; } diff --git a/home/environments/kde/konawall.nix b/home/environments/kde/konawall.nix index e2702c62..8c71d557 100644 --- a/home/environments/kde/konawall.nix +++ b/home/environments/kde/konawall.nix @@ -3,12 +3,12 @@ pkgs, ... }: let - konawallWithDelay = pkgs.writeShellScriptBin "konawall" '' - sleep 5 && ${inputs.konawall-py.packages.${pkgs.system}.konawall-py}/bin/konawall + konawallWithDelay = pkgs.writeShellScriptBin "konawally" '' + sleep 5 && XDG_BACKEND=x11 GDK_BACKEND=x11 ${inputs.konawall-py.packages.${pkgs.system}.konawall-py}/bin/konawall ''; desktop_entry = '' [Desktop Entry] - Exec=${konawallWithDelay}/bin/konawall + Exec=${konawallWithDelay}/bin/konawally Icon= Name=konawall Path= @@ -31,6 +31,10 @@ }; }; in { + home.packages = [ + konawallWithDelay + inputs.konawall-py.packages.${pkgs.system}.konawall-py + ]; xdg.configFile = { "konawall/config.toml".source = (pkgs.formats.toml {}).generate "konawall-config" konawallConfig; "autostart/konawall.desktop".text = desktop_entry; diff --git a/home/profiles/common/base16.nix b/home/profiles/common/base16.nix index 2bcec819..68aa8136 100644 --- a/home/profiles/common/base16.nix +++ b/home/profiles/common/base16.nix @@ -14,14 +14,14 @@ in { shell.enable = true; schemes = { light = { - schemeData = schemeSources.atelier.schemes.atelier-heath-light; + schemeData = schemeSources.tinted.schemes.catppuccin-latte; ansi.palette.background.alpha = "d000"; }; dark = { - schemeData = schemeSources.outrun.schemes.outrun-dark; + schemeData = schemeSources.tinted.schemes.catppuccin-mocha; ansi.palette.background.alpha = "ee00"; }; }; - defaultSchemeName = "dark"; + defaultSchemeName = "light"; }; } diff --git a/home/profiles/common/catppuccin.nix b/home/profiles/common/catppuccin.nix new file mode 100644 index 00000000..5591ab37 --- /dev/null +++ b/home/profiles/common/catppuccin.nix @@ -0,0 +1,7 @@ +_: { + catppuccin = { + enable = true; + flavor = "latte"; + gtk.enable = true; + }; +} diff --git a/home/profiles/common/modules.nix b/home/profiles/common/modules.nix new file mode 100644 index 00000000..ec22edfd --- /dev/null +++ b/home/profiles/common/modules.nix @@ -0,0 +1,5 @@ +_: { + disabledModules = [ + "services/window-managers/i3-sway/i3.nix" + ]; +} diff --git a/home/profiles/graphical/firefox.nix b/home/profiles/graphical/firefox.nix index f0adce65..3f985f26 100644 --- a/home/profiles/graphical/firefox.nix +++ b/home/profiles/graphical/firefox.nix @@ -9,7 +9,7 @@ main = { id = 0; isDefault = true; - extensions = with nur.repos.rycee.firefox-addons; [ + extensions.packages = with nur.repos.rycee.firefox-addons; [ sponsorblock link-cleaner canvasblocker diff --git a/home/profiles/graphical/media.nix b/home/profiles/graphical/media.nix index ea803107..d4e3f573 100644 --- a/home/profiles/graphical/media.nix +++ b/home/profiles/graphical/media.nix @@ -5,9 +5,7 @@ ... }: let inherit (lib.attrsets) mapAttrsToList; - ytdlp = inputs.nixpkgs-current.legacyPackages.x86_64-linux.yt-dlp; in { - # TODO: remove the libs programs.mpv = { enable = true; scripts = with pkgs.mpvScripts; [ @@ -23,7 +21,7 @@ in { script-opts = builtins.concatStringsSep "," (mapAttrsToList (k: v: "${k}=${builtins.toString v}") { - ytdl_hook-ytdl_path = "${ytdlp}/bin/yt-dlp"; + ytdl_hook-ytdl_path = "${pkgs.yt-dlp}/bin/yt-dlp"; osc-layout = "slimbox"; osc-vidscale = "no"; osc-deadzonesize = 0.75; @@ -42,7 +40,7 @@ in { yt = "mpv --ytdl-format='bestvideo[height<=?720][fps<=?30][vcodec!=?vp9]+bestaudio/best[height<=720]'"; # Laptop doesn't like above 720p :c }; home.packages = with pkgs; [ - ytdlp # Watch videos from multiple sources without having to use a browser for it + yt-dlp # Watch videos from multiple sources without having to use a browser for it ytcc # Subscriptions manager and RSS feed exporter for YouTube ]; } diff --git a/home/profiles/graphical/packages.nix b/home/profiles/graphical/packages.nix index 6c6f1007..bca8087c 100644 --- a/home/profiles/graphical/packages.nix +++ b/home/profiles/graphical/packages.nix @@ -21,7 +21,7 @@ dino # XMPP signal-desktop mumble - + keymapp # Archivery unzip zip diff --git a/home/profiles/graphical/syncplay.nix b/home/profiles/graphical/syncplay.nix new file mode 100644 index 00000000..fe0b1888 --- /dev/null +++ b/home/profiles/graphical/syncplay.nix @@ -0,0 +1,30 @@ +_: { + programs.syncplay = { + enable = true; + username = "kat"; + defaultRoom = "lounge"; + server = { + host = "syncplay.local.gensokyo.zone"; + }; + playerArgs = [ + "--ytdl-format=bestvideo[height<=1080]+bestaudio/best[height<=1080]/bestvideo+bestaudio/best" + ]; + # gui = false; + config = { + client_settings = { + onlyswitchtotrusteddomains = false; + autoplayrequiresamefiles = false; + readyatstart = true; + pauseonleave = false; + rewindondesync = false; + rewindthreshold = 6.0; + fastforwardthreshold = 6.0; + unpauseaction = "Always"; + }; + gui = { + #autosavejoinstolist = false; + showdurationnotification = false; + }; + }; + }; +} diff --git a/home/profiles/graphical/wezterm.nix b/home/profiles/graphical/wezterm.nix index e920ff3e..9c6b9a37 100644 --- a/home/profiles/graphical/wezterm.nix +++ b/home/profiles/graphical/wezterm.nix @@ -26,7 +26,7 @@ window_decorations = "TITLE | RESIZE", enable_wayland = true, warn_about_missing_glyphs = false, - font_size = 10.0, + font_size = 12.0, check_for_updates = false, enable_tab_bar = false } diff --git a/home/profiles/neovim/default.nix b/home/profiles/neovim/default.nix index 58a67fe4..3db08f48 100644 --- a/home/profiles/neovim/default.nix +++ b/home/profiles/neovim/default.nix @@ -43,7 +43,7 @@ in { # EasyMotion Equivalent hop-nvim # org-mode for vim - # neorg + neorg # base16 config.base16.vim.plugin # Fonts diff --git a/home/profiles/neovim/init.lua b/home/profiles/neovim/init.lua index 7bb61d29..de35b140 100644 --- a/home/profiles/neovim/init.lua +++ b/home/profiles/neovim/init.lua @@ -9,30 +9,30 @@ local api = vim.api -- Lua API ----------------------------------------------------------- -- Base16 ----------------------------------------------------------- -vim.g.base16colorspace = 256 -vim.g.base16background = "@defaultSchemeName@" -g.base16_shell_path = "@base16ShellPath@" -vim.cmd("colorscheme base16-@defaultSchemeSlug@") -g.colors_name = "@defaultSchemeSlug@" +--vim.g.base16colorspace = 256 +--vim.g.base16background = "@defaultSchemeName@" +--g.base16_shell_path = "@base16ShellPath@" +--vim.cmd("colorscheme base16-@defaultSchemeSlug@") +--g.colors_name = "@defaultSchemeSlug@" -local base16 = { - base00 = "@base00@", - base01 = "@base01@", - base02 = "@base02@", - base03 = "@base03@", - base04 = "@base04@", - base05 = "@base05@", - base06 = "@base06@", - base07 = "@base07@", - base08 = "@base08@", - base09 = "@base09@", - base0A = "@base0A@", - base0B = "@base0B@", - base0C = "@base0C@", - base0D = "@base0D@", - base0E = "@base0E@", - base0F = "@base0F@" -} +--local base16 = { +-- base00 = "@base00@", +-- base01 = "@base01@", +-- base02 = "@base02@", +-- base03 = "@base03@", +-- base04 = "@base04@", +-- base05 = "@base05@", +-- base06 = "@base06@", +-- base07 = "@base07@", +-- base08 = "@base08@", +-- base09 = "@base09@", +-- base0A = "@base0A@", +-- base0B = "@base0B@", +-- base0C = "@base0C@", +-- base0D = "@base0D@", +-- base0E = "@base0E@", +-- base0F = "@base0F@" +--} api.nvim_create_autocmd("vimenter", { command = "highlight Normal guibg=NONE ctermbg=NONE" @@ -74,6 +74,8 @@ opt.laststatus = 3 -- Set global statusline opt.cursorline = true -- Highlight cursor screenline opt.cmdheight = 1 -- Command entry line height opt.hlsearch = true -- Highlight matches with last search pattern +vim.g.mapleader = " " +vim.g.maplocalleader = "," ----------------------------------------------------------- -- Tabs, indent @@ -184,23 +186,22 @@ api.nvim_create_autocmd('BufWritePre', { command = 'lua vim.lsp.buf.formatting_sync()' }) ---[[ -- neorg require('neorg').setup { -- Tell Neorg what modules to load load = { ['core.defaults'] = {}, -- Load all the default modules - ['core.norg.concealer'] = {}, -- Allows for use of icons - ['core.norg.dirman'] = { -- Manage your directories with Neorg + ['core.concealer'] = {}, -- Allows for use of icons + ['core.dirman'] = { -- Manage your directories with Neorg config = { - engine = 'nvim-cmp', workspaces = { - home = '~/neorg' - } + notes = '~/Notes', + }, + default_workspace = "notes", } } }, -}]]-- +} -- telescope local telescope = require('telescope.builtin') @@ -298,7 +299,7 @@ require('bufferline').setup { } } -local barColor = base16.base00; +--local barColor = base16.base00; local highlightItems = { BufferLineFill = "bg", @@ -310,13 +311,13 @@ local highlightItems = { local commandString = "" -for item, ground in pairs(highlightItems) do - commandString = "highlight " .. item .. " cterm" .. ground .. "=" .. barColor .. " | " .. commandString -end +--for item, ground in pairs(highlightItems) do +-- commandString = "highlight " .. item .. " cterm" .. ground .. "=" .. barColor .. " | " .. commandString +--end -api.nvim_create_autocmd("ColorScheme", { - command = commandString; -}) +--api.nvim_create_autocmd("ColorScheme", { +-- command = commandString; +--}) -- hop local hop = require('hop') @@ -338,3 +339,5 @@ end, {remap=true}) vim.keymap.set("", "F", function() hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true }) end, {remap=true}) + +vim.cmd("colorscheme catppuccin-latte") diff --git a/modules/home/i3.nix b/modules/home/i3.nix new file mode 100644 index 00000000..c3f9b72f --- /dev/null +++ b/modules/home/i3.nix @@ -0,0 +1,245 @@ + +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.xsession.windowManager.i3; + + commonOptions = import ./i3/options.nix { + inherit config lib cfg pkgs; + moduleName = "i3"; + }; + + configModule = types.submodule { + options = { + inherit (commonOptions) + fonts window floating focus assigns modifier workspaceLayout + workspaceAutoBackAndForth keycodebindings colors bars startup gaps menu + terminal defaultWorkspace workspaceOutputAssign; + + keybindings = mkOption { + type = types.attrsOf (types.nullOr types.str); + defaultText = "Default i3 keybindings."; + description = '' + An attribute set that assigns a key press to an action using a key symbol. + See . + + Consider to use `lib.mkOptionDefault` function to extend or override + default keybindings instead of specifying all of them from scratch. + ''; + example = literalExpression '' + let + modifier = config.xsession.windowManager.i3.config.modifier; + in lib.mkOptionDefault { + "''${modifier}+Return" = "exec i3-sensible-terminal"; + "''${modifier}+Shift+q" = "kill"; + "''${modifier}+d" = "exec ''${pkgs.dmenu}/bin/dmenu_run"; + } + ''; + }; + + modes = mkOption { + type = types.attrsOf (types.attrsOf types.str); + default = { + resize = { + "Left" = "resize shrink width 10 px or 10 ppt"; + "Down" = "resize grow height 10 px or 10 ppt"; + "Up" = "resize shrink height 10 px or 10 ppt"; + "Right" = "resize grow width 10 px or 10 ppt"; + "Escape" = "mode default"; + "Return" = "mode default"; + }; + }; + description = '' + An attribute set that defines binding modes and keybindings + inside them + + Only basic keybinding is supported (bindsym keycomb action), + for more advanced setup use 'i3.extraConfig'. + ''; + }; + }; + }; + + commonFunctions = import ./i3/functions.nix { + inherit config cfg lib; + moduleName = "i3"; + }; + + inherit (commonFunctions) + keybindingsStr keycodebindingsStr modeStr assignStr barStr gapsStr + floatingCriteriaStr windowCommandsStr colorSetStr windowBorderString + fontConfigStr keybindingDefaultWorkspace keybindingsRest workspaceOutputStr; + + startupEntryStr = { command, always, notification, workspace, ... }: + concatStringsSep " " [ + (if always then "exec_always" else "exec") + (if (notification && workspace == null) then "" else "--no-startup-id") + (if (workspace == null) then + command + else + "i3-msg 'workspace ${workspace}; exec ${command}'") + ]; + + configFile = pkgs.writeText "i3.conf" (concatStringsSep "\n" + ((if cfg.config != null then + with cfg.config; + ([ cfg.extraConfigEarly] ++ [ + (fontConfigStr fonts) + "floating_modifier ${floating.modifier}" + (windowBorderString window floating) + "hide_edge_borders ${window.hideEdgeBorders}" + "focus_wrapping ${focus.wrapping}" + "focus_follows_mouse ${lib.hm.booleans.yesNo focus.followMouse}" + "focus_on_window_activation ${focus.newWindow}" + "mouse_warping ${if focus.mouseWarping then "output" else "none"}" + "workspace_layout ${workspaceLayout}" + "workspace_auto_back_and_forth ${ + lib.hm.booleans.yesNo workspaceAutoBackAndForth + }" + "client.focused ${colorSetStr colors.focused}" + "client.focused_inactive ${colorSetStr colors.focusedInactive}" + "client.unfocused ${colorSetStr colors.unfocused}" + "client.urgent ${colorSetStr colors.urgent}" + "client.placeholder ${colorSetStr colors.placeholder}" + "client.background ${colors.background}" + (keybindingsStr { keybindings = keybindingDefaultWorkspace; }) + (keybindingsStr { keybindings = keybindingsRest; }) + (keycodebindingsStr keycodebindings) + ] ++ mapAttrsToList (modeStr false) modes + ++ mapAttrsToList assignStr assigns ++ map barStr bars + ++ optional (gaps != null) gapsStr + ++ map floatingCriteriaStr floating.criteria + ++ map windowCommandsStr window.commands ++ map startupEntryStr startup + ++ map workspaceOutputStr workspaceOutputAssign) + else + [ ]) ++ [ cfg.extraConfig ])); + + # Validates the i3 configuration + checkI3Config = + pkgs.runCommandLocal "i3-config" { buildInputs = [ cfg.package ]; } '' + # We have to make sure the wrapper does not start a dbus session + export DBUS_SESSION_BUS_ADDRESS=1 + + # A zero exit code means i3 successfully validated the configuration + i3 -c ${configFile} -C -d all || { + echo "i3 configuration validation failed" + echo "For a verbose log of the failure, run 'i3 -c ${configFile} -C -d all'" + exit 1 + }; + cp ${configFile} $out + ''; + +in { + meta.maintainers = with maintainers; [ sumnerevans ]; + + options = { + xsession.windowManager.i3 = { + enable = mkEnableOption "i3 window manager"; + + package = mkPackageOption pkgs "i3" { }; + + config = mkOption { + type = types.nullOr configModule; + default = { }; + description = "i3 configuration options."; + }; + + extraConfigEarly = mkOption { + type = types.lines; + default = ""; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = + "Extra configuration lines to add to ~/.config/i3/config."; + }; + }; + }; + + config = mkMerge [ (mkIf cfg.enable (mkMerge [ + { + assertions = [ + (hm.assertions.assertPlatform "xsession.windowManager.i3" pkgs + platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + xsession.windowManager.command = "${cfg.package}/bin/i3"; + + xdg.configFile."i3/config" = { + source = checkI3Config; + onChange = '' + # There may be several sockets after log out/log in, but the old ones + # will fail with "Connection refused". + for i3Socket in ''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*; do + if [[ -S $i3Socket ]]; then + ${cfg.package}/bin/i3-msg -s $i3Socket reload >/dev/null |& grep -v "Connection refused" || true + fi + done + ''; + }; + } + (mkIf (cfg.config != null) { + warnings = (optional (isList cfg.config.fonts) + "Specifying i3.config.fonts as a list is deprecated. Use the attrset version instead.") + ++ flatten (map (b: + optional (isList b.fonts) + "Specifying i3.config.bars[].fonts as a list is deprecated. Use the attrset version instead.") + cfg.config.bars) ++ [ + (mkIf (any (s: s.workspace != null) cfg.config.startup) + ("'xsession.windowManager.i3.config.startup.*.workspace' is deprecated, " + + "use 'xsession.windowManager.i3.config.assigns' instead." + + "See https://github.com/nix-community/home-manager/issues/265.")) + (mkIf cfg.config.focus.forceWrapping + ("'xsession.windowManager.i3.config.focus.forceWrapping' is deprecated, " + + "use 'xsession.windowManager.i3.config.focus.wrapping' instead.")) + ]; + }) + ])) + {xsession.windowManager.i3.config.keybindings = mapAttrs (n: mkOptionDefault) { + "${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}"; + "${cfg.config.modifier}+Shift+q" = "kill"; + "${cfg.config.modifier}+d" = "exec ${cfg.config.menu}"; + + "${cfg.config.modifier}+Left" = "focus left"; + "${cfg.config.modifier}+Down" = "focus down"; + "${cfg.config.modifier}+Up" = "focus up"; + "${cfg.config.modifier}+Right" = "focus right"; + + "${cfg.config.modifier}+Shift+Left" = "move left"; + "${cfg.config.modifier}+Shift+Down" = "move down"; + "${cfg.config.modifier}+Shift+Up" = "move up"; + "${cfg.config.modifier}+Shift+Right" = "move right"; + + "${cfg.config.modifier}+h" = "split h"; + "${cfg.config.modifier}+v" = "split v"; + "${cfg.config.modifier}+f" = "fullscreen toggle"; + + "${cfg.config.modifier}+s" = "layout stacking"; + "${cfg.config.modifier}+w" = "layout tabbed"; + "${cfg.config.modifier}+e" = "layout toggle split"; + + "${cfg.config.modifier}+Shift+space" = "floating toggle"; + "${cfg.config.modifier}+space" = "focus mode_toggle"; + + "${cfg.config.modifier}+a" = "focus parent"; + + "${cfg.config.modifier}+Shift+minus" = "move scratchpad"; + "${cfg.config.modifier}+minus" = "scratchpad show"; + + "${cfg.config.modifier}+Shift+c" = "reload"; + "${cfg.config.modifier}+Shift+r" = "restart"; + "${cfg.config.modifier}+Shift+e" = + "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'"; + + "${cfg.config.modifier}+r" = "mode resize"; + }; + } + ]; +} diff --git a/modules/home/i3/functions.nix b/modules/home/i3/functions.nix new file mode 100644 index 00000000..a5e0a662 --- /dev/null +++ b/modules/home/i3/functions.nix @@ -0,0 +1,166 @@ + +{ cfg, config, lib, moduleName }: + +with lib; + +rec { + criteriaStr = criteria: + let + toCriteria = k: v: + if builtins.isBool v then + (if v then "${k}" else "") + else + ''${k}="${v}"''; + in "[${concatStringsSep " " (mapAttrsToList toCriteria criteria)}]"; + + keybindingDefaultWorkspace = filterAttrs (n: v: + cfg.config.defaultWorkspace != null && v == cfg.config.defaultWorkspace) + cfg.config.keybindings; + + keybindingsRest = filterAttrs (n: v: + cfg.config.defaultWorkspace == null || v != cfg.config.defaultWorkspace) + cfg.config.keybindings; + + keybindingsStr = { keybindings, bindsymArgs ? "", indent ? "" }: + concatStringsSep "\n" (mapAttrsToList (keycomb: action: + optionalString (action != null) "${indent}bindsym ${ + lib.optionalString (bindsymArgs != "") "${bindsymArgs} " + }${keycomb} ${action}") keybindings); + + keycodebindingsStr = keycodebindings: + concatStringsSep "\n" (mapAttrsToList (keycomb: action: + optionalString (action != null) "bindcode ${keycomb} ${action}") + keycodebindings); + + colorSetStr = c: + concatStringsSep " " [ + c.border + c.background + c.text + c.indicator + c.childBorder + ]; + barColorSetStr = c: concatStringsSep " " [ c.border c.background c.text ]; + + modeStr = bindkeysToCode: name: keybindings: '' + mode "${name}" { + ${keybindingsStr { + inherit keybindings; + bindsymArgs = lib.optionalString bindkeysToCode "--to-code"; + indent = " "; + }} + } + ''; + + assignStr = workspace: criteria: + concatStringsSep "\n" + (map (c: "assign ${criteriaStr c} ${workspace}") criteria); + + fontConfigStr = let + toFontStr = { names, style ? "", size ? "" }: + optionalString (names != [ ]) concatStringsSep " " + (remove "" [ "font" "pango:${concatStringsSep ", " names}" style size ]); + in fontCfg: + if isList fontCfg then + toFontStr { names = fontCfg; } + else + toFontStr { + inherit (fontCfg) names style; + size = toString fontCfg.size; + }; + + barStr = { id, fonts, mode, hiddenState, position, workspaceButtons + , workspaceNumbers, command, statusCommand, colors, trayOutput, trayPadding + , extraConfig, ... }: + let colorsNotNull = lib.filterAttrs (n: v: v != null) colors != { }; + in concatMapStrings (x: x + "\n") (indent (lists.subtractLists [ "" null ] + (flatten [ + "bar {" + (optionalString (id != null) "id ${id}") + (fontConfigStr fonts) + (optionalString (mode != null) "mode ${mode}") + (optionalString (hiddenState != null) "hidden_state ${hiddenState}") + (optionalString (position != null) "position ${position}") + (optionalString (statusCommand != null) + "status_command ${statusCommand}") + "${moduleName}bar_command ${command}" + (optionalString (workspaceButtons != null) + "workspace_buttons ${lib.hm.booleans.yesNo workspaceButtons}") + (optionalString (workspaceNumbers != null) "strip_workspace_numbers ${ + lib.hm.booleans.yesNo (!workspaceNumbers) + }") + (optionalString (trayOutput != null) "tray_output ${trayOutput}") + (optionalString (trayPadding != null) + "tray_padding ${toString trayPadding}") + (optionals colorsNotNull (indent (lists.subtractLists [ "" null ] [ + "colors {" + (optionalString (colors.background != null) + "background ${colors.background}") + (optionalString (colors.statusline != null) + "statusline ${colors.statusline}") + (optionalString (colors.separator != null) + "separator ${colors.separator}") + (optionalString (colors.focusedBackground != null) + "focused_background ${colors.focusedBackground}") + (optionalString (colors.focusedStatusline != null) + "focused_statusline ${colors.focusedStatusline}") + (optionalString (colors.focusedSeparator != null) + "focused_separator ${colors.focusedSeparator}") + (optionalString (colors.focusedWorkspace != null) + "focused_workspace ${barColorSetStr colors.focusedWorkspace}") + (optionalString (colors.activeWorkspace != null) + "active_workspace ${barColorSetStr colors.activeWorkspace}") + (optionalString (colors.inactiveWorkspace != null) + "inactive_workspace ${barColorSetStr colors.inactiveWorkspace}") + (optionalString (colors.urgentWorkspace != null) + "urgent_workspace ${barColorSetStr colors.urgentWorkspace}") + (optionalString (colors.bindingMode != null) + "binding_mode ${barColorSetStr colors.bindingMode}") + "}" + ]) { })) + extraConfig + "}" + ])) { }); + + gapsStr = with cfg.config.gaps; + concatStringsSep "\n" (lists.subtractLists [ "" null ] [ + (optionalString (inner != null) "gaps inner ${toString inner}") + (optionalString (outer != null) "gaps outer ${toString outer}") + (optionalString (horizontal != null) + "gaps horizontal ${toString horizontal}") + (optionalString (vertical != null) "gaps vertical ${toString vertical}") + (optionalString (top != null) "gaps top ${toString top}") + (optionalString (bottom != null) "gaps bottom ${toString bottom}") + (optionalString (left != null) "gaps left ${toString left}") + (optionalString (right != null) "gaps right ${toString right}") + (optionalString smartGaps "smart_gaps on") + (optionalString (smartBorders != "off") "smart_borders ${smartBorders}") + ]); + + windowBorderString = window: floating: + let + titlebarString = { titlebar, border, ... }: + "${if titlebar then "normal" else "pixel"} ${toString border}"; + in concatStringsSep "\n" [ + "default_border ${titlebarString window}" + "default_floating_border ${titlebarString floating}" + ]; + + floatingCriteriaStr = criteria: + "for_window ${criteriaStr criteria} floating enable"; + windowCommandsStr = { command, criteria, ... }: + "for_window ${criteriaStr criteria} ${command}"; + workspaceOutputStr = item: + let outputs = concatMapStringsSep " " strings.escapeNixString item.output; + in ''workspace "${item.workspace}" output ${outputs}''; + + indent = list: + { includesWrapper ? true, level ? 1 }: + let prefix = concatStringsSep "" (lib.genList (x: " ") (level * 2)); + + in (lib.imap1 (i: v: + "${if includesWrapper && (i == 1 || i == (lib.length list)) then + v + else + "${prefix}${v}"}") list); +} diff --git a/modules/home/i3/options.nix b/modules/home/i3/options.nix new file mode 100644 index 00000000..38edaae8 --- /dev/null +++ b/modules/home/i3/options.nix @@ -0,0 +1,938 @@ +{ config, lib, moduleName, cfg, pkgs, capitalModuleName ? moduleName }: + +with lib; + +let + isI3 = moduleName == "i3"; + isSway = !isI3; + + inherit (config.home) stateVersion; + + fontOptions = types.submodule { + options = { + names = mkOption { + type = types.listOf types.str; + default = [ "monospace" ]; + defaultText = literalExpression ''[ "monospace" ]''; + description = '' + List of font names list used for window titles. Only FreeType fonts are supported. + The order here is important (e.g. icons font should go before the one used for text). + ''; + example = literalExpression ''[ "FontAwesome" "Terminus" ]''; + }; + + style = mkOption { + type = types.str; + default = ""; + description = '' + The font style to use for window titles. + ''; + example = "Bold Semi-Condensed"; + }; + + size = mkOption { + type = types.either types.float types.str; + default = 8.0; + description = '' + The font size to use for window titles. + ''; + example = 11.5; + }; + }; + }; + + startupModule = types.submodule { + options = { + command = mkOption { + type = types.str; + description = "Command that will be executed on startup."; + }; + + always = mkOption { + type = types.bool; + default = false; + description = "Whether to run command on each ${moduleName} restart."; + }; + } // optionalAttrs isI3 { + notification = mkOption { + type = types.bool; + default = true; + description = '' + Whether to enable startup-notification support for the command. + See {option}`--no-startup-id` option description in the i3 user guide. + ''; + }; + + workspace = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + Launch application on a particular workspace. DEPRECATED: + Use [](#opt-xsession.windowManager.i3.config.assigns) + instead. See . + ''; + }; + }; + + }; + + barModule = types.submodule { + options = let + versionAtLeast2009 = versionAtLeast stateVersion "20.09"; + mkNullableOption = { type, default, ... }@args: + mkOption (args // { + type = types.nullOr type; + default = if versionAtLeast2009 then null else default; + defaultText = literalExpression '' + null for state version ≥ 20.09, as example otherwise + ''; + example = default; + }); + in { + fonts = mkOption { + type = with types; either (listOf str) fontOptions; + default = { }; + example = literalExpression '' + { + names = [ "DejaVu Sans Mono" "FontAwesome5Free" ]; + style = "Bold Semi-Condensed"; + size = 11.0; + } + ''; + description = "Font configuration for this bar."; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = "Extra configuration lines for this bar."; + }; + + id = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + Specifies the bar ID for the configured bar instance. + If this option is missing, the ID is set to bar-x, where x corresponds + to the position of the embedding bar block in the config file. + ''; + }; + + mode = mkNullableOption { + type = types.enum [ "dock" "hide" "invisible" ]; + default = "dock"; + description = "Bar visibility mode."; + }; + + hiddenState = mkNullableOption { + type = types.enum [ "hide" "show" ]; + default = "hide"; + description = "The default bar mode when 'bar.mode' == 'hide'."; + }; + + position = mkNullableOption { + type = types.enum [ "top" "bottom" ]; + default = "bottom"; + description = "The edge of the screen ${moduleName}bar should show up."; + }; + + workspaceButtons = mkNullableOption { + type = types.bool; + default = true; + description = "Whether workspace buttons should be shown or not."; + }; + + workspaceNumbers = mkNullableOption { + type = types.bool; + default = true; + description = + "Whether workspace numbers should be displayed within the workspace buttons."; + }; + + command = mkOption { + type = types.str; + default = let + # If the user uses the "system" Sway (i.e. cfg.package == null) then the bar has + # to come from a different package + pkg = if isSway && isNull cfg.package then pkgs.sway else cfg.package; + in "${pkg}/bin/${moduleName}bar"; + defaultText = "i3bar"; + description = "Command that will be used to start a bar."; + example = if isI3 then + "\${pkgs.i3}/bin/i3bar -t" + else + "\${pkgs.waybar}/bin/waybar"; + }; + + statusCommand = mkNullableOption { + type = types.str; + default = "${pkgs.i3status}/bin/i3status"; + description = "Command that will be used to get status lines."; + }; + + colors = mkOption { + type = types.submodule { + options = { + background = mkNullableOption { + type = types.str; + default = "#000000"; + description = "Background color of the bar."; + }; + + statusline = mkNullableOption { + type = types.str; + default = "#ffffff"; + description = "Text color to be used for the statusline."; + }; + + separator = mkNullableOption { + type = types.str; + default = "#666666"; + description = "Text color to be used for the separator."; + }; + + focusedBackground = mkOption { + type = types.nullOr types.str; + default = null; + description = + "Background color of the bar on the currently focused monitor output."; + example = "#000000"; + }; + + focusedStatusline = mkOption { + type = types.nullOr types.str; + default = null; + description = + "Text color to be used for the statusline on the currently focused monitor output."; + example = "#ffffff"; + }; + + focusedSeparator = mkOption { + type = types.nullOr types.str; + default = null; + description = + "Text color to be used for the separator on the currently focused monitor output."; + example = "#666666"; + }; + + focusedWorkspace = mkNullableOption { + type = barColorSetModule; + default = { + border = "#4c7899"; + background = "#285577"; + text = "#ffffff"; + }; + description = '' + Border, background and text color for a workspace button when the workspace has focus. + ''; + }; + + activeWorkspace = mkNullableOption { + type = barColorSetModule; + default = { + border = "#333333"; + background = "#5f676a"; + text = "#ffffff"; + }; + description = '' + Border, background and text color for a workspace button when the workspace is active. + ''; + }; + + inactiveWorkspace = mkNullableOption { + type = barColorSetModule; + default = { + border = "#333333"; + background = "#222222"; + text = "#888888"; + }; + description = '' + Border, background and text color for a workspace button when the workspace does not + have focus and is not active. + ''; + }; + + urgentWorkspace = mkNullableOption { + type = barColorSetModule; + default = { + border = "#2f343a"; + background = "#900000"; + text = "#ffffff"; + }; + description = '' + Border, background and text color for a workspace button when the workspace contains + a window with the urgency hint set. + ''; + }; + + bindingMode = mkNullableOption { + type = barColorSetModule; + default = { + border = "#2f343a"; + background = "#900000"; + text = "#ffffff"; + }; + description = + "Border, background and text color for the binding mode indicator"; + }; + }; + }; + default = { }; + description = '' + Bar color settings. All color classes can be specified using submodules + with 'border', 'background', 'text', fields and RGB color hex-codes as values. + See default values for the reference. + Note that 'background', 'status', and 'separator' parameters take a single RGB value. + + See . + ''; + }; + + trayOutput = mkNullableOption { + type = types.str; + # Sway/Wayland doesn't have the concept of a primary output. The default for sway is to show it on all outputs + default = if isI3 then "primary" else "*"; + description = "Where to output tray."; + }; + + trayPadding = mkNullableOption { + type = types.int; + default = null; + description = '' + Sets the pixel padding of the system tray. + This padding will surround the tray on all sides and between each item. + ''; + }; + }; + }; + + barColorSetModule = types.submodule { + options = { + border = mkOption { + type = types.str; + visible = false; + }; + + background = mkOption { + type = types.str; + visible = false; + }; + + text = mkOption { + type = types.str; + visible = false; + }; + }; + }; + + colorSetModule = types.submodule { + options = { + border = mkOption { + type = types.str; + visible = false; + }; + + childBorder = mkOption { + type = types.str; + visible = false; + }; + + background = mkOption { + type = types.str; + visible = false; + }; + + text = mkOption { + type = types.str; + visible = false; + }; + + indicator = mkOption { + type = types.str; + visible = false; + }; + }; + }; + + windowCommandModule = types.submodule { + options = { + command = mkOption { + type = types.str; + description = "${capitalModuleName}wm command to execute."; + example = "border pixel 1"; + }; + + criteria = mkOption { + type = criteriaModule; + description = '' + Criteria of the windows on which command should be executed. + + A value of `true` is equivalent to using an empty + criteria (which is different from an empty string criteria). + ''; + example = literalExpression '' + { + title = "x200: ~/work"; + floating = true; + }; + ''; + }; + }; + }; + + criteriaModule = types.attrsOf (types.either types.str types.bool); +in { + fonts = mkOption { + type = with types; either (listOf str) fontOptions; + default = { }; + example = literalExpression '' + { + names = [ "DejaVu Sans Mono" "FontAwesome5Free" ]; + style = "Bold Semi-Condensed"; + size = 11.0; + } + ''; + description = "Font configuration for window titles, nagbar..."; + }; + + window = mkOption { + type = types.submodule { + options = { + titlebar = mkOption { + type = types.bool; + default = if versionOlder stateVersion "23.05" then + (isI3 && (cfg.config.gaps == null)) + else + true; + defaultText = if isI3 then '' + true for state version ≥ 23.05 + config.gaps == null for state version < 23.05 + '' else '' + true for state version ≥ 23.05 + false for state version < 23.05 + ''; + description = "Whether to show window titlebars."; + }; + + border = mkOption { + type = types.int; + default = 2; + description = "Window border width."; + }; + + hideEdgeBorders = mkOption { + type = let + i3Options = [ "none" "vertical" "horizontal" "both" "smart" ]; + swayOptions = i3Options ++ [ "smart_no_gaps" ]; + in if isI3 then + types.enum i3Options + else + types.enum (swayOptions ++ (map (e: "--i3 ${e}") swayOptions)); + default = "none"; + description = "Hide window borders adjacent to the screen edges."; + }; + + commands = mkOption { + type = types.listOf windowCommandModule; + default = [ ]; + description = '' + List of commands that should be executed on specific windows. + See {option}`for_window` ${moduleName}wm option documentation. + ''; + example = [{ + command = "border pixel 1"; + criteria = { class = "XTerm"; }; + }]; + }; + }; + }; + default = { }; + description = "Window titlebar and border settings."; + }; + + floating = mkOption { + type = types.submodule { + options = { + titlebar = mkOption { + type = types.bool; + default = if versionOlder stateVersion "23.05" then + (isI3 && (cfg.config.gaps == null)) + else + true; + defaultText = if isI3 then '' + true for state version ≥ 23.05 + config.gaps == null for state version < 23.05 + '' else '' + true for state version ≥ 23.05 + false for state version < 23.05 + ''; + description = "Whether to show floating window titlebars."; + }; + + border = mkOption { + type = types.int; + default = 2; + description = "Floating windows border width."; + }; + + modifier = mkOption { + type = types.str; + default = cfg.config.modifier; + defaultText = "${moduleName}.config.modifier"; + description = + "Modifier key or keys that can be used to drag floating windows."; + example = "Mod4"; + }; + + criteria = mkOption { + type = types.listOf criteriaModule; + default = [ ]; + description = + "List of criteria for windows that should be opened in a floating mode."; + example = [ + { "title" = "Steam - Update News"; } + { "class" = "Pavucontrol"; } + ]; + }; + }; + }; + default = { }; + description = "Floating window settings."; + }; + + focus = mkOption { + type = types.submodule { + options = { + newWindow = mkOption { + type = types.enum [ "smart" "urgent" "focus" "none" ]; + default = "smart"; + description = '' + This option modifies focus behavior on new window activation. + + See + ''; + example = "none"; + }; + + followMouse = mkOption { + type = if isSway then + types.either (types.enum [ "yes" "no" "always" ]) types.bool + else + types.bool; + default = if isSway then "yes" else true; + description = "Whether focus should follow the mouse."; + apply = val: + if (isSway && isBool val) then (lib.hm.booleans.yesNo val) else val; + }; + + wrapping = mkOption { + type = types.enum [ "yes" "no" "force" "workspace" ]; + default = { + i3 = if cfg.config.focus.forceWrapping then "force" else "yes"; + # the sway module's logic was inverted and incorrect, + # so preserve it for backwards compatibility purposes + sway = if cfg.config.focus.forceWrapping then "yes" else "no"; + }.${moduleName}; + description = '' + Whether the window focus commands automatically wrap around the edge of containers. + + See + ''; + }; + + forceWrapping = mkOption { + type = types.bool; + default = false; + description = '' + Whether to force focus wrapping in tabbed or stacked containers. + + This option is deprecated, use {option}`focus.wrapping` instead. + ''; + }; + + mouseWarping = mkOption { + type = if isSway then + types.oneOf [ types.bool (types.enum [ "container" "output" ]) ] + else + types.bool; + default = true; + description = '' + Whether mouse cursor should be warped to the center of the window when switching focus + to a window on a different output. + ''; + }; + }; + }; + default = { }; + description = "Focus related settings."; + }; + + assigns = mkOption { + type = types.attrsOf (types.listOf criteriaModule); + default = { }; + description = '' + An attribute set that assigns applications to workspaces based + on criteria. + ''; + example = literalExpression '' + { + "1: web" = [{ class = "^Firefox$"; }]; + "0: extra" = [{ class = "^Firefox$"; window_role = "About"; }]; + } + ''; + }; + + modifier = mkOption { + type = types.enum [ "Shift" "Control" "Mod1" "Mod2" "Mod3" "Mod4" "Mod5" ]; + default = "Mod1"; + description = "Modifier key that is used for all default keybindings."; + example = "Mod4"; + }; + + workspaceLayout = mkOption { + type = types.enum [ "default" "stacking" "tabbed" ]; + default = "default"; + example = "tabbed"; + description = '' + The mode in which new containers on workspace level will + start. + ''; + }; + + workspaceAutoBackAndForth = mkOption { + type = types.bool; + default = false; + example = true; + description = '' + Assume you are on workspace "1: www" and switch to "2: IM" using + mod+2 because somebody sent you a message. You don’t need to remember + where you came from now, you can just press $mod+2 again to switch + back to "1: www". + ''; + }; + + keycodebindings = mkOption { + type = types.attrsOf (types.nullOr types.str); + default = { }; + description = '' + An attribute set that assigns keypress to an action using key code. + See . + ''; + example = { "214" = "exec /bin/script.sh"; }; + }; + + colors = mkOption { + type = types.submodule { + options = { + background = mkOption { + type = types.str; + default = "#ffffff"; + description = '' + Background color of the window. Only applications which do not cover + the whole area expose the color. + ''; + }; + + focused = mkOption { + type = colorSetModule; + default = { + border = "#4c7899"; + background = "#285577"; + text = "#ffffff"; + indicator = "#2e9ef4"; + childBorder = "#285577"; + }; + description = "A window which currently has the focus."; + }; + + focusedInactive = mkOption { + type = colorSetModule; + default = { + border = "#333333"; + background = "#5f676a"; + text = "#ffffff"; + indicator = "#484e50"; + childBorder = "#5f676a"; + }; + description = '' + A window which is the focused one of its container, + but it does not have the focus at the moment. + ''; + }; + + unfocused = mkOption { + type = colorSetModule; + default = { + border = "#333333"; + background = "#222222"; + text = "#888888"; + indicator = "#292d2e"; + childBorder = "#222222"; + }; + description = "A window which is not focused."; + }; + + urgent = mkOption { + type = colorSetModule; + default = { + border = "#2f343a"; + background = "#900000"; + text = "#ffffff"; + indicator = "#900000"; + childBorder = "#900000"; + }; + description = "A window which has its urgency hint activated."; + }; + + placeholder = mkOption { + type = colorSetModule; + default = { + border = "#000000"; + background = "#0c0c0c"; + text = "#ffffff"; + indicator = "#000000"; + childBorder = "#0c0c0c"; + }; + description = '' + Background and text color are used to draw placeholder window + contents (when restoring layouts). Border and indicator are ignored. + ''; + }; + }; + }; + default = { }; + description = '' + Color settings. All color classes can be specified using submodules + with 'border', 'background', 'text', 'indicator' and 'childBorder' fields + and RGB color hex-codes as values. See default values for the reference. + Note that '${moduleName}.config.colors.background' parameter takes a single RGB value. + + See . + ''; + }; + + bars = mkOption { + type = types.listOf barModule; + default = if versionAtLeast stateVersion "20.09" then [{ + mode = "dock"; + hiddenState = "hide"; + position = "bottom"; + workspaceButtons = true; + workspaceNumbers = true; + statusCommand = "${pkgs.i3status}/bin/i3status"; + fonts = { + names = [ "monospace" ]; + size = 8.0; + }; + trayOutput = "primary"; + colors = { + background = "#000000"; + statusline = "#ffffff"; + separator = "#666666"; + focusedWorkspace = { + border = "#4c7899"; + background = "#285577"; + text = "#ffffff"; + }; + activeWorkspace = { + border = "#333333"; + background = "#5f676a"; + text = "#ffffff"; + }; + inactiveWorkspace = { + border = "#333333"; + background = "#222222"; + text = "#888888"; + }; + urgentWorkspace = { + border = "#2f343a"; + background = "#900000"; + text = "#ffffff"; + }; + bindingMode = { + border = "#2f343a"; + background = "#900000"; + text = "#ffffff"; + }; + }; + }] else + [ { } ]; + defaultText = literalExpression "see code"; + description = '' + ${capitalModuleName} bars settings blocks. Set to empty list to remove bars completely. + ''; + }; + + startup = mkOption { + type = types.listOf startupModule; + default = [ ]; + description = '' + Commands that should be executed at startup. + + See . + ''; + example = if isI3 then + literalExpression '' + [ + { command = "systemctl --user restart polybar"; always = true; notification = false; } + { command = "dropbox start"; notification = false; } + { command = "firefox"; } + ]; + '' + else + literalExpression '' + [ + { command = "systemctl --user restart waybar"; always = true; } + { command = "dropbox start"; } + { command = "firefox"; } + ] + ''; + }; + + gaps = mkOption { + type = types.nullOr (types.submodule { + options = { + inner = mkOption { + type = types.nullOr types.int; + default = null; + description = "Inner gaps value."; + example = 12; + }; + + outer = mkOption { + type = types.nullOr types.int; + default = null; + description = "Outer gaps value."; + example = 5; + }; + + horizontal = mkOption { + type = types.nullOr types.int; + default = null; + description = "Horizontal gaps value."; + example = 5; + }; + + vertical = mkOption { + type = types.nullOr types.int; + default = null; + description = "Vertical gaps value."; + example = 5; + }; + + top = mkOption { + type = types.nullOr types.int; + default = null; + description = "Top gaps value."; + example = 5; + }; + + left = mkOption { + type = types.nullOr types.int; + default = null; + description = "Left gaps value."; + example = 5; + }; + + bottom = mkOption { + type = types.nullOr types.int; + default = null; + description = "Bottom gaps value."; + example = 5; + }; + + right = mkOption { + type = types.nullOr types.int; + default = null; + description = "Right gaps value."; + example = 5; + }; + + smartGaps = mkOption { + type = types.bool; + default = false; + description = '' + This option controls whether to disable all gaps (outer and inner) + on workspace with a single container. + ''; + example = true; + }; + + smartBorders = mkOption { + type = types.enum [ "on" "off" "no_gaps" ]; + default = "off"; + description = '' + This option controls whether to disable container borders on + workspace with a single container. + ''; + }; + }; + }); + default = null; + description = '' + Gaps related settings. + ''; + }; + + terminal = mkOption { + type = types.str; + default = if isI3 then "i3-sensible-terminal" else "${pkgs.foot}/bin/foot"; + description = "Default terminal to run."; + example = "alacritty"; + }; + + menu = mkOption { + type = types.str; + default = if isSway then + "${pkgs.dmenu}/bin/dmenu_path | ${pkgs.dmenu}/bin/dmenu | ${pkgs.findutils}/bin/xargs swaymsg exec --" + else + "${pkgs.dmenu}/bin/dmenu_run"; + description = "Default launcher to use."; + example = "bemenu-run"; + }; + + defaultWorkspace = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + The default workspace to show when ${ + if isSway then "sway" else "i3" + } is launched. + This must to correspond to the value of the keybinding of the default workspace. + ''; + example = "workspace number 9"; + }; + + workspaceOutputAssign = mkOption { + type = with types; + let + workspaceOutputOpts = submodule { + options = { + workspace = mkOption { + type = str; + default = ""; + example = "Web"; + description = '' + Name of the workspace to assign. + ''; + }; + + output = mkOption { + type = with types; either str (listOf str); + default = ""; + apply = lists.toList; + example = "eDP"; + description = '' + Name(s) of the output(s) from {command}` + ${if isSway then "swaymsg" else "i3-msg"} -t get_outputs + `. + ''; + }; + }; + }; + in listOf workspaceOutputOpts; + default = [ ]; + description = "Assign workspaces to outputs."; + }; +} + diff --git a/nixos/common/base16.nix b/nixos/common/base16.nix index 77baab66..60218ff1 100644 --- a/nixos/common/base16.nix +++ b/nixos/common/base16.nix @@ -2,8 +2,8 @@ base16 = { inherit (config.home-manager.users.kat.base16) defaultSchemeName defaultScheme schemes; console = { - enable = true; - getty.enable = true; + enable = false; + getty.enable = false; }; }; } diff --git a/nixos/common/catppuccin.nix b/nixos/common/catppuccin.nix new file mode 100644 index 00000000..464cad60 --- /dev/null +++ b/nixos/common/catppuccin.nix @@ -0,0 +1,6 @@ +_: { + catppuccin = { + enable = true; + flavor = "latte"; + }; +} diff --git a/nixos/environments/i3/xserver.nix b/nixos/environments/i3/xserver.nix new file mode 100644 index 00000000..7e464bb3 --- /dev/null +++ b/nixos/environments/i3/xserver.nix @@ -0,0 +1,17 @@ +{pkgs, ...}: { + services.xserver = { + enable = true; + displayManager = { + defaultSession = "none+i3"; + }; + windowManager.i3 = { + enable = true; + extraPackages = with pkgs; [ + dmenu + i3status + i3lock + i3blocks + ]; + }; + }; +} diff --git a/nixos/environments/kde/xserver.nix b/nixos/environments/kde/xserver.nix index 01ea0156..dfeb7d29 100644 --- a/nixos/environments/kde/xserver.nix +++ b/nixos/environments/kde/xserver.nix @@ -2,16 +2,13 @@ environment.systemPackages = with pkgs; [ xclip wl-clipboard - libsForQt5.qtstyleplugin-kvantum - qt6Packages.qtstyleplugin-kvantum - commonalitysol + kwin-blishhud-shader ]; environment.plasma6.excludePackages = with pkgs; [konsole]; services = { displayManager.sddm = { enable = true; wayland.enable = true; - theme = "CommonalitySol"; }; xserver = { enable = true; diff --git a/nixos/profiles/gaming/lutris.nix b/nixos/profiles/gaming/lutris.nix index 7b53423e..913e7267 100644 --- a/nixos/profiles/gaming/lutris.nix +++ b/nixos/profiles/gaming/lutris.nix @@ -1,4 +1,8 @@ -{pkgs, ...}: { +{ + pkgs, + inputs, + ... +}: { hardware.graphics = { enable32Bit = true; extraPackages32 = with pkgs; [ diff --git a/nixos/profiles/graphical/packages.nix b/nixos/profiles/graphical/packages.nix index 6290dc1d..db59a439 100644 --- a/nixos/profiles/graphical/packages.nix +++ b/nixos/profiles/graphical/packages.nix @@ -8,13 +8,12 @@ dnsutils usbutils plexamp - prusa-slicer super-slicer-beta - inputs.konawall-py.packages.${pkgs.system}.konawall-py barrier ]; services.udev.packages = [ pkgs.android-udev-rules + pkgs.zsa-udev-rules pkgs.via ]; } diff --git a/overlays.nix b/overlays.nix index 5c0d4767..a798707c 100644 --- a/overlays.nix +++ b/overlays.nix @@ -6,5 +6,6 @@ inputs.arcexprs.overlays.default inputs.darwin.overlays.default inputs.deploy-rs.overlay + inputs.neorg-overlay.overlays.default (import tree.packages.default {inherit inputs tree;}) ] diff --git a/packages/kwin-blishhud-shader.nix b/packages/kwin-blishhud-shader.nix new file mode 100644 index 00000000..465a7193 --- /dev/null +++ b/packages/kwin-blishhud-shader.nix @@ -0,0 +1,28 @@ +{ + lib, + stdenv, + fetchFromGitHub, + extra-cmake-modules, + qt6, + libepoxy, + kwin, +}: +stdenv.mkDerivation rec { + pname = "kwin-blishhud-shader"; + version = "1.0.0"; + + dontWrapQtApps = true; + src = fetchFromGitHub { + owner = "FloFri"; + repo = pname; + rev = "a7e4439a6450dc796bbfb99b64db788c592183eb"; + hash = "sha256-yCm57OCYTJpPY+OYpL/MlChhddccml3tH2jv/hgEAbo="; + }; + + nativeBuildInputs = [ + kwin + qt6.full + libepoxy + extra-cmake-modules + ]; +} diff --git a/systems/goliath.nix b/systems/goliath.nix index 9214f236..609ed02d 100644 --- a/systems/goliath.nix +++ b/systems/goliath.nix @@ -38,7 +38,7 @@ _: let gaming ]) ++ (with tree.nixos.environments; [ - kde + i3 ]); zramSwap.enable = true; @@ -48,7 +48,7 @@ _: let devops ]) ++ (with tree.home.environments; [ - kde + i3 ]); services.xserver.videoDrivers = ["nvidia"]; @@ -58,6 +58,7 @@ _: let nvidiaSettings = true; modesetting.enable = true; open = true; + powerManagement.enable = true; }; boot = { @@ -77,7 +78,13 @@ _: let "/boot" = drives.boot.result; }; - swapDevices = singleton drives.swap.result; + swapDevices = [ + drives.swap.result + { + device = "/swapfile"; + size = 16 * 1024; # 16GB + } + ]; system.stateVersion = "21.11"; }; diff --git a/systems/koishi.nix b/systems/koishi.nix index 1807ea37..c8bdaab3 100644 --- a/systems/koishi.nix +++ b/systems/koishi.nix @@ -19,11 +19,12 @@ _: let secureboot ]) ++ (with tree.nixos.environments; [ - #sway + i3 + #sway #xfce - #openbox - kde - #gnome + #openbox + #kde + #gnome ]); config = { home-manager.users.kat.imports = @@ -32,10 +33,11 @@ _: let devops ]) ++ (with tree.home.environments; [ - #xfce - #sway - kde - #gnome + i3 + #xfce + #sway + #kde + #gnome ]); fileSystems."/" = { diff --git a/tree.nix b/tree.nix index a357f8f7..74431145 100644 --- a/tree.nix +++ b/tree.nix @@ -80,6 +80,7 @@ base16.nixosModules.base16 lanzaboote.nixosModules.lanzaboote solaar.nixosModules.default + catppuccin.nixosModules.catppuccin ]; }; }; @@ -99,11 +100,13 @@ nix-index-database.hmModules.nix-index plasma-manager.homeManagerModules.plasma-manager base16.homeModules.base16 + catppuccin.homeManagerModules.catppuccin inputs.sops-nix.homeManagerModules.sops ] ++ (with (import (inputs.arcexprs + "/modules")).home-manager; [ i3gopher weechat + syncplay ]); }; };