diff options
author | azahi <azat@bahawi.net> | 2024-11-10 01:08:38 +0300 |
---|---|---|
committer | azahi <azat@bahawi.net> | 2024-11-10 01:08:38 +0300 |
commit | 693768ee37098dbebb38c86e27044f2faa38348d (patch) | |
tree | 37c92a1c83cf22fa5e5a570baa8598ba6063c795 | |
parent | 2024-10-29 (diff) |
40 files changed, 1038 insertions, 516 deletions
diff --git a/configurations/eonwe/default.nix b/configurations/eonwe/default.nix index c33c21d..3928e84 100644 --- a/configurations/eonwe/default.nix +++ b/configurations/eonwe/default.nix @@ -27,6 +27,8 @@ with lib; libvirtd.enable = true; mpd.enable = true; qutebrowser.enable = true; + + hyprland.enable = true; }; hm = { diff --git a/configurations/eonwe/vidya.nix b/configurations/eonwe/vidya.nix index 7e10175..bf9ffb4 100644 --- a/configurations/eonwe/vidya.nix +++ b/configurations/eonwe/vidya.nix @@ -3,7 +3,7 @@ nixfiles.modules = { common.nix.allowedUnfreePackages = [ "cla-theme" # source-available - "dwarf-fortress" + "dwarf-fortress" # proprietary "fallout-ce" # source-available "fallout2-ce" # source-available ]; @@ -12,7 +12,11 @@ lutris.enable = true; steam.enable = true; - steam-run.quirks.blackIsleStudios = true; + steam-run.quirks = { + blackIsleStudios = true; + cryptOfTheNecrodancer = true; + mountAndBladeWarband = false; + }; minecraft.client.enable = true; }; diff --git a/configurations/varda/default.nix b/configurations/varda/default.nix index 908a3ec..a63db61 100644 --- a/configurations/varda/default.nix +++ b/configurations/varda/default.nix @@ -7,6 +7,8 @@ with lib; wireguard.client.enable = true; sing-box.enable = true; + + games.minecraft.server.enable = true; }; boot = { diff --git a/flake.lock b/flake.lock index 8e8b256..b46ec93 100644 --- a/flake.lock +++ b/flake.lock @@ -51,6 +51,39 @@ "type": "github" } }, + "aquamarine": { + "inputs": { + "hyprutils": [ + "hyprland", + "hyprutils" + ], + "hyprwayland-scanner": [ + "hyprland", + "hyprwayland-scanner" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1730968822, + "narHash": "sha256-NocDjINsh6ismkhb0Xr6xPRksmhuB2WGf8ZmXMhxu7Y=", + "owner": "hyprwm", + "repo": "aquamarine", + "rev": "a49bc3583ff223f426cb3526fdaa4bcaa247ec14", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "aquamarine", + "type": "github" + } + }, "arkenfox": { "inputs": { "flake-compat": [ @@ -203,18 +236,17 @@ }, "devshell": { "inputs": { - "flake-utils": "flake-utils_2", "nixpkgs": [ "nix-topology", "nixpkgs" ] }, "locked": { - "lastModified": 1713532798, - "narHash": "sha256-wtBhsdMJA3Wa32Wtm1eeo84GejtI43pMrFrmwLXrsEc=", + "lastModified": 1728330715, + "narHash": "sha256-xRJ2nPOXb//u1jaBnDP56M7v5ldavjbtR6lfGqSvcKg=", "owner": "numtide", "repo": "devshell", - "rev": "12e914740a25ea1891ec619bb53cf5e6ca922e40", + "rev": "dd6b80932022cea34a019e2bb32f6fa9e494dfef", "type": "github" }, "original": { @@ -230,11 +262,11 @@ ] }, "locked": { - "lastModified": 1730045523, - "narHash": "sha256-W5Avk1THhZALXITHGazKfZbIZ5+Bc4nSYvAYHUn96EU=", + "lastModified": 1730751873, + "narHash": "sha256-sdY29RWz0S7VbaoTwSy6RummdHKf0wUTaBlqPxrtvmQ=", "owner": "nix-community", "repo": "disko", - "rev": "89e458a3bb3693e769bfb2b2447c3fe72092d498", + "rev": "856a2902156ba304efebd4c1096dbf7465569454", "type": "github" }, "original": { @@ -286,11 +318,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1727826117, - "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", + "lastModified": 1730504689, + "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", + "rev": "506278e768c2a08bec68eb62932193e341f55c90", "type": "github" }, "original": { @@ -319,24 +351,6 @@ }, "flake-utils_2": { "inputs": { - "systems": "systems_3" - }, - "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_3": { - "inputs": { "systems": [ "stylix", "systems" @@ -386,11 +400,11 @@ ] }, "locked": { - "lastModified": 1729104314, - "narHash": "sha256-pZRZsq5oCdJt3upZIU4aslS9XwFJ+/nVtALHIciX/BI=", + "lastModified": 1730814269, + "narHash": "sha256-fWPHyhYE6xvMI1eGY3pwBTq85wcy1YXqdzTZF+06nOg=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "3c3e88f0f544d6bb54329832616af7eb971b6be6", + "rev": "d70155fdc00df4628446352fc58adc640cd705c2", "type": "github" }, "original": { @@ -444,11 +458,11 @@ ] }, "locked": { - "lastModified": 1730016908, - "narHash": "sha256-bFCxJco7d8IgmjfNExNz9knP8wvwbXU4s/d53KOK6U0=", + "lastModified": 1730633670, + "narHash": "sha256-ZFJqIXpvVKvzOVFKWNRDyIyAo+GYdmEPaYi1bZB6uf0=", "owner": "nix-community", "repo": "home-manager", - "rev": "e83414058edd339148dc142a8437edb9450574c8", + "rev": "8f6ca7855d409aeebe2a582c6fd6b6a8d0bf5661", "type": "github" }, "original": { @@ -473,13 +487,175 @@ "type": "github" } }, + "hyprcursor": { + "inputs": { + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1728669738, + "narHash": "sha256-EDNAU9AYcx8OupUzbTbWE1d3HYdeG0wO6Msg3iL1muk=", + "owner": "hyprwm", + "repo": "hyprcursor", + "rev": "0264e698149fcb857a66a53018157b41f8d97bb0", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprcursor", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "aquamarine": "aquamarine", + "hyprcursor": "hyprcursor", + "hyprland-protocols": "hyprland-protocols", + "hyprlang": "hyprlang", + "hyprutils": "hyprutils", + "hyprwayland-scanner": "hyprwayland-scanner", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": [ + "git-hooks" + ], + "systems": "systems_3", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1731119644, + "narHash": "sha256-tQytm74mti64PmF0BbLdFUip9OD/nJwSiGuwAGlSAZY=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "cca227a53e10b9101d2fbcfb99e6360b416d7168", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1728345020, + "narHash": "sha256-xGbkc7U/Roe0/Cv3iKlzijIaFBNguasI31ynL2IlEoM=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "a7c183800e74f337753de186522b9017a07a8cee", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprlang": { + "inputs": { + "hyprutils": [ + "hyprland", + "hyprutils" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1728168612, + "narHash": "sha256-AnB1KfiXINmuiW7BALYrKqcjCnsLZPifhb/7BsfPbns=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "f054f2e44d6a0b74607a6bc0f52dba337a3db38e", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprutils": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1730968903, + "narHash": "sha256-zFvzLXcSm0Ia4XI1SE4FQ9KE63hlGrRWhLtwMolWuR8=", + "owner": "hyprwm", + "repo": "hyprutils", + "rev": "3ce0cde8709cdacbfba471f8e828433b58a561e9", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprutils", + "type": "github" + } + }, + "hyprwayland-scanner": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1726874836, + "narHash": "sha256-VKR0sf0PSNCB0wPHVKSAn41mCNVCnegWmgkrneKDhHM=", + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "rev": "500c81a9e1a76760371049a8d99e008ea77aa59e", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "type": "github" + } + }, "impermanence": { "locked": { - "lastModified": 1729068498, - "narHash": "sha256-C2sGRJl1EmBq0nO98TNd4cbUy20ABSgnHWXLIJQWRFA=", + "lastModified": 1730403150, + "narHash": "sha256-W1FH5aJ/GpRCOA7DXT/sJHFpa5r8sq2qAUncWwRZ3Gg=", "owner": "nix-community", "repo": "impermanence", - "rev": "e337457502571b23e449bf42153d7faa10c0a562", + "rev": "0d09341beeaa2367bac5d718df1404bf2ce45e6f", "type": "github" }, "original": { @@ -542,11 +718,11 @@ ] }, "locked": { - "lastModified": 1729993975, - "narHash": "sha256-Z5DQ48PdCo3IyfKbngL62Q/HuA/fsn22bMyPbTQGSKQ=", + "lastModified": 1730771089, + "narHash": "sha256-TRt7P8pIcKlrz1gVqtibcq2ZGu/EHep1I0n2Chklta4=", "owner": "Infinidoge", "repo": "nix-minecraft", - "rev": "4753ea1f1285e944839cb2ab0b4373eb4e00c12a", + "rev": "84d4f0e13ff27a31d6b73d0ec4ab151755f9f1cb", "type": "github" }, "original": { @@ -562,11 +738,11 @@ ] }, "locked": { - "lastModified": 1729999765, - "narHash": "sha256-LYsavZXitFjjyETZoij8usXjTa7fa9AIF3Sk3MJSX+Y=", + "lastModified": 1730604744, + "narHash": "sha256-/MK6QU4iOozJ4oHTfZipGtOgaT/uy/Jm4foCqHQeYR4=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "0e3a8778c2ee218eff8de6aacf3d2fa6c33b2d4f", + "rev": "cc2ddbf2df8ef7cc933543b1b42b845ee4772318", "type": "github" }, "original": { @@ -589,11 +765,11 @@ ] }, "locked": { - "lastModified": 1725483443, - "narHash": "sha256-WzOlGMKV/51Fccn/OMHcm5yrqgbOJZrJIy1ya4pW0u8=", + "lastModified": 1730803396, + "narHash": "sha256-5ycWNOxmR/wPftlSWLQEZ3odOIE3rPvSd2qjd5+nLAE=", "owner": "oddlama", "repo": "nix-topology", - "rev": "8738d94670265beb166954c4e3a26e432f79f68c", + "rev": "82dbbdc3c4f8f86fefdee8d8875fd4fd9276881a", "type": "github" }, "original": { @@ -604,11 +780,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1729742320, - "narHash": "sha256-u3Of8xRkN//me8PU+RucKA59/6RNy4B2jcGAF36P4jI=", + "lastModified": 1730797322, + "narHash": "sha256-cH9emjYIbDYTde/CKOmU97rh7sKuyfedzPcTz4OTJkE=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "e8a2f6d5513fe7b7d15701b2d05404ffdc3b6dda", + "rev": "1b0b927860d7eb367ee6a3123ddeb7a8e24bd836", "type": "github" }, "original": { @@ -619,16 +795,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1729980323, - "narHash": "sha256-eWPRZAlhf446bKSmzw6x7RWEE4IuZgAp8NW3eXZwRAY=", + "lastModified": 1730785428, + "narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "86e78d3d2084ff87688da662cf78c2af085d8e73", + "rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-unstable", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -666,23 +842,23 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1727825735, - "narHash": "sha256-0xHYkMkeLVQAMa7gvkddbPqpxph+hDzdu1XdGPJR+Os=", + "lastModified": 1730504152, + "narHash": "sha256-lXvH/vOfb4aGYyvFmZK/HlsNsr/0CVWlwYvo2rxJk3s=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" } }, "nixpkgs-master": { "locked": { - "lastModified": 1730047773, - "narHash": "sha256-oNzx2k7lmdRO9WAY176pTo76kN1PtT02QyTz1N/tpWE=", + "lastModified": 1730825790, + "narHash": "sha256-3mg9ETbJWsXrF4iMaIACVfiiZe8I/+E9Wxet7C78d1I=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2ba15d4f55c092002f792a8e7af585bbf3277e63", + "rev": "ec3d46cd68eff268ed54793ab909d700117f6a66", "type": "github" }, "original": { @@ -694,11 +870,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1730039714, - "narHash": "sha256-T/UCiOaxNBvqeQMOkQq89Ni7W0XTvDxCe+7TFpQ2QE0=", + "lastModified": 1730806663, + "narHash": "sha256-yFmtgfZnzcoJy+z26+ilRq0oxZHCwifsUMjO6pa7hIc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5e34aff468a6cfd6c2b02cbb4a8d2d8643feaade", + "rev": "a417c003326c9a0cdebb62157466603313ffd47e", "type": "github" }, "original": { @@ -708,6 +884,22 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1730768919, + "narHash": "sha256-8AKquNnnSaJRXZxc5YmF/WfmxiHX6MMZZasRP6RRQkE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a04d33c0c3f1a59a2c1cb0c6e34cd24500e5a1dc", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nmap-vulners": { "flake": false, "locked": { @@ -754,6 +946,7 @@ "git-hooks": "git-hooks", "home-manager": "home-manager", "homelab-svg-assets": "homelab-svg-assets", + "hyprland": "hyprland", "impermanence": "impermanence", "infuse": "infuse", "mailserver": "mailserver", @@ -761,7 +954,7 @@ "nix-index-database": "nix-index-database", "nix-topology": "nix-topology", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nixpkgs-amneziawg": "nixpkgs-amneziawg", "nixpkgs-master": "nixpkgs-master", "nixpkgs-stable": "nixpkgs-stable", @@ -779,11 +972,11 @@ ] }, "locked": { - "lastModified": 1729731316, - "narHash": "sha256-InsUCPq86xyvJ9U+pVijYNBCep/dYACyJblG6fgkkWA=", + "lastModified": 1730682372, + "narHash": "sha256-GU8ghhVS7ctcV4Cy1W3X/N6KtmJNVptirIzkA7NMxp8=", "owner": "nix-community", "repo": "srvos", - "rev": "0e447b6d3f16d6a305ca99ac89686d51042f516a", + "rev": "a9f2ae9fb213b6175c71cd6aecfdb366979d2e0c", "type": "github" }, "original": { @@ -801,7 +994,7 @@ "flake-compat": [ "flake-compat" ], - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_2", "gnome-shell": "gnome-shell", "home-manager": [ "home-manager" @@ -860,16 +1053,16 @@ }, "systems_3": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", "type": "github" }, "original": { "owner": "nix-systems", - "repo": "default", + "repo": "default-linux", "type": "github" } }, @@ -950,11 +1143,11 @@ ] }, "locked": { - "lastModified": 1729994042, - "narHash": "sha256-raAG3cW29BRYmu3Pxej65QgnNi88bGUqlqMkuaJRF8s=", + "lastModified": 1730771180, + "narHash": "sha256-VSPWndy0ChZobMOS283g1KItO+jLfzTLNaFSN+Lixlw=", "owner": "nix-community", "repo": "nix-vscode-extensions", - "rev": "88bf73817636e232513bff1f3a071b3ae2bcfd14", + "rev": "77da8f3bed69932db301f372119ed71c439193b7", "type": "github" }, "original": { @@ -962,6 +1155,47 @@ "repo": "nix-vscode-extensions", "type": "github" } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "hyprutils": [ + "hyprland", + "hyprutils" + ], + "hyprwayland-scanner": [ + "hyprland", + "hyprwayland-scanner" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1730743262, + "narHash": "sha256-iTLqj3lU8kFehPm5tXpctzkD274t/k1nwSSq3qCWXeg=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "09b23cef06fe248e61cec8862c04b9bcb62f4b6d", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index c621f04..87ab0d0 100644 --- a/flake.nix +++ b/flake.nix @@ -32,6 +32,14 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + hyprland = { + url = "github:hyprwm/Hyprland"; + inputs = { + # nixpkgs.follows = "nixpkgs"; # Disabled in favor of cache. + pre-commit-hooks.follows = "git-hooks"; + }; + }; + stylix = { url = "github:danth/stylix"; inputs = { @@ -193,6 +201,7 @@ topology = self.topology.config.output; iso = self.nixosConfigurations.iso.config.system.build.isoImage; + test-headless = self.nixosConfigurations.test-headless.config.system.build.vm; test-headful = self.nixosConfigurations.test-headful.config.system.build.vm; }; diff --git a/lib/default.nix b/lib/default.nix index 3a67063..e06b7ec 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -11,9 +11,7 @@ rec { packages = import ./packages.nix { inherit lib inputs system; }; - infuse = import inputs.infuse { - inherit lib; - }; + inherit ((import inputs.infuse { inherit lib; }).v1) infuse; isEven = number: diff --git a/modules/android.nix b/modules/android.nix index 363bd6c..65710ca 100644 --- a/modules/android.nix +++ b/modules/android.nix @@ -1,12 +1,11 @@ { config, lib, ... }: -with lib; let cfg = config.nixfiles.modules.android; in { - options.nixfiles.modules.android.enable = mkEnableOption "support for Android devices"; + options.nixfiles.modules.android.enable = lib.mkEnableOption "support for Android devices"; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { programs.adb.enable = true; my.extraGroups = [ "adbusers" ]; diff --git a/modules/common/ark.nix b/modules/common/ark.nix index 1e43ef8..ba3056b 100644 --- a/modules/common/ark.nix +++ b/modules/common/ark.nix @@ -4,14 +4,13 @@ lib, ... }: -with lib; let cfg = config.nixfiles.modules.ark; in { imports = [ inputs.impermanence.nixosModules.impermanence - (mkAliasOptionModule [ "ark" ] [ + (lib.mkAliasOptionModule [ "ark" ] [ "nixfiles" "modules" "ark" @@ -20,16 +19,16 @@ in options.nixfiles.modules.ark = let - mkListOfAnythingOption = mkOption { - type = with types; listOf anything; # Assumed to be matching with the upstream type. + mkListOfAnythingOption = lib.mkOption { + type = with lib.types; listOf anything; # Assumed to be matching with the upstream type. default = [ ]; }; in { - enable = mkEnableOption "persistent storage support via impermanence"; + enable = lib.mkEnableOption "persistent storage support via impermanence"; - path = mkOption { - type = types.str; + path = lib.mkOption { + type = lib.types.str; default = "/ark"; }; @@ -41,7 +40,7 @@ in # }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { environment.persistence.${cfg.path} = { hideMounts = true; enableDebugging = false; diff --git a/modules/common/default.nix b/modules/common/default.nix index ef9fb18..38094e7 100644 --- a/modules/common/default.nix +++ b/modules/common/default.nix @@ -1 +1,4 @@ -{ lib, ... }: with lib; { imports = attrValues (modulesIn ./.); } +{ lib, ... }: +{ + imports = lib.attrValues (lib.modulesIn ./.); +} diff --git a/modules/common/documentation.nix b/modules/common/documentation.nix index 33e767c..f9e0fcb 100644 --- a/modules/common/documentation.nix +++ b/modules/common/documentation.nix @@ -5,7 +5,6 @@ this, ... }: -with lib; { config = { hm.manual = { @@ -34,7 +33,7 @@ with lib; environment.variables = { MANOPT = "--no-hyphenation"; - MANPAGER = "${getExe pkgs.less} -+F"; + MANPAGER = "${lib.getExe pkgs.less} -+F"; }; }; } diff --git a/modules/common/home-manager.nix b/modules/common/home-manager.nix index f2fc8a8..f3e8143 100644 --- a/modules/common/home-manager.nix +++ b/modules/common/home-manager.nix @@ -4,14 +4,13 @@ lib, ... }: -with lib; { imports = [ inputs.home-manager.nixosModule - (mkAliasOptionModule [ "hm" ] [ + (lib.mkAliasOptionModule [ "hm" ] [ "home-manager" "users" - my.username + lib.my.username ]) ]; diff --git a/modules/common/kernel.nix b/modules/common/kernel.nix index ddc4f62..f7e520a 100644 --- a/modules/common/kernel.nix +++ b/modules/common/kernel.nix @@ -1,29 +1,28 @@ { lib, ... }: -with lib; { boot.kernel.sysctl = { - "fs.file-max" = pow 2 17; - "fs.inotify.max_user_watches" = pow 2 19; + "fs.file-max" = lib.pow 2 17; + "fs.inotify.max_user_watches" = lib.pow 2 19; "fs.suid_dumpable" = 0; "kernel.core_uses_pid" = 1; "kernel.exec-shield" = 1; "kernel.kptr_restrict" = 1; "kernel.maps_protect" = 1; - "kernel.msgmax" = pow 2 16; - "kernel.msgmnb" = pow 2 16; - "kernel.pid_max" = pow 2 16; + "kernel.msgmax" = lib.pow 2 16; + "kernel.msgmnb" = lib.pow 2 16; + "kernel.pid_max" = lib.pow 2 16; "kernel.randomize_va_space" = 2; - "kernel.shmall" = pow 2 28; - "kernel.shmmax" = pow 2 28; + "kernel.shmall" = lib.pow 2 28; + "kernel.shmmax" = lib.pow 2 28; "kernel.sysrq" = 0; - "vm.dirty_background_bytes" = pow 2 22; + "vm.dirty_background_bytes" = lib.pow 2 22; "vm.dirty_background_ratio" = 5; - "vm.dirty_bytes" = pow 2 22; + "vm.dirty_bytes" = lib.pow 2 22; "vm.dirty_ratio" = 30; - "vm.min_free_kbytes" = pow 2 16; - "vm.mmap_min_addr" = pow 2 12; - "vm.overcommit_memory" = mkDefault 0; - "vm.overcommit_ratio" = mkDefault 50; + "vm.min_free_kbytes" = lib.pow 2 16; + "vm.mmap_min_addr" = lib.pow 2 12; + "vm.overcommit_memory" = lib.mkDefault 0; + "vm.overcommit_ratio" = lib.mkDefault 50; "vm.vfs_cache_pressure" = 50; }; diff --git a/modules/common/locale.nix b/modules/common/locale.nix index 372b69b..acd1ecd 100644 --- a/modules/common/locale.nix +++ b/modules/common/locale.nix @@ -51,7 +51,6 @@ with lib; "caps:escape" "compose:menu" "grp:win_space_toggle" - "terminate:ctrl_alt_bksp" ]; }; } diff --git a/modules/common/networking.nix b/modules/common/networking.nix index f681deb..71df24a 100644 --- a/modules/common/networking.nix +++ b/modules/common/networking.nix @@ -5,31 +5,30 @@ this, ... }: -with lib; let cfg = config.nixfiles.modules.common.networking; in { - options.nixfiles.modules.common.networking.onlyDefault = mkEnableOption "custom networking settings"; + options.nixfiles.modules.common.networking.onlyDefault = lib.mkEnableOption "custom networking settings"; - config = mkIf (!cfg.onlyDefault) { + config = lib.mkIf (!cfg.onlyDefault) { ark.directories = with config.networking; - optional networkmanager.enable "/etc/NetworkManager/system-connections" - ++ optional wireless.iwd.enable "/var/lib/iwd"; + lib.optional networkmanager.enable "/etc/NetworkManager/system-connections" + ++ lib.optional wireless.iwd.enable "/var/lib/iwd"; - networking = mkMerge [ + networking = lib.mkMerge [ { - domain = my.domain.shire; + domain = lib.my.domain.shire; hostName = this.hostname; - hostId = substring 0 8 (builtins.hashString "md5" this.hostname); + hostId = lib.substring 0 8 (builtins.hashString "md5" this.hostname); # Remove default hostname mappings. This is required at least by the # current implementation of the monitoring module. hosts = { - "127.0.0.2" = mkForce [ ]; - "::1" = mkForce [ ]; + "127.0.0.2" = lib.mkForce [ ]; + "::1" = lib.mkForce [ ]; }; # There's no way[1] to configure DNS server priority in @@ -41,7 +40,7 @@ in # # [1]: https://askubuntu.com/questions/1116732/how-do-i-list-dns-server-order-in-systemd-resolve # [2]: https://github.com/systemd/systemd/issues/6076 - nameservers = with my.configurations.manwe.wireguard; [ + nameservers = with lib.my.configurations.manwe.wireguard; [ ipv6.address ipv4.address ]; @@ -68,49 +67,53 @@ in let interface = "eth0"; # This assumes `usePredictableInterfaceNames` is false. in - mkIf (hasAttr "ipv4" this && hasAttr "ipv6" this) { + lib.mkIf (lib.hasAttr "ipv4" this && lib.hasAttr "ipv6" this) { usePredictableInterfaceNames = false; # NOTE This can break something! interfaces.${interface} = { ipv4.addresses = with this.ipv4; - optional (isString address && isInt prefixLength) { inherit address prefixLength; }; + lib.optional (lib.isString address && lib.isInt prefixLength) { + inherit address prefixLength; + }; ipv6.addresses = with this.ipv6; - optional (isString address && isInt prefixLength) { inherit address prefixLength; }; + lib.optional (lib.isString address && lib.isInt prefixLength) { + inherit address prefixLength; + }; }; defaultGateway = with this.ipv4; - mkIf (isString gatewayAddress) { + lib.mkIf (lib.isString gatewayAddress) { inherit interface; address = gatewayAddress; }; defaultGateway6 = with this.ipv6; - mkIf (isString gatewayAddress) { + lib.mkIf (lib.isString gatewayAddress) { inherit interface; address = gatewayAddress; }; } ) - (mkIf this.isHeadful { - interfaces.eth0.useDHCP = mkDefault true; + (lib.mkIf this.isHeadful { + interfaces.eth0.useDHCP = lib.mkDefault true; networkmanager = { - enable = mkDefault true; + enable = lib.mkDefault true; unmanaged = [ "bridge" "ethernet" "loopback" "wireguard" ]; - plugins = mkForce [ ]; + plugins = lib.mkForce [ ]; wifi.backend = "iwd"; }; wireless = { enable = false; - iwd.enable = mkDefault true; + iwd.enable = lib.mkDefault true; userControlled.enable = true; allowAuxiliaryImperativeNetworks = true; }; @@ -121,12 +124,12 @@ in llmnr = "false"; dnsovertls = "opportunistic"; dnssec = "allow-downgrade"; - fallbackDns = dns.mkDoT dns.const.quad9.ecs; + fallbackDns = lib.dns.mkDoT lib.dns.const.quad9.ecs; }; environment = { - shellAliases = listToAttrs ( - map ({ name, value }: nameValuePair name "${pkgs.iproute2}/bin/${value}") [ + shellAliases = lib.listToAttrs ( + map ({ name, value }: lib.nameValuePair name "${pkgs.iproute2}/bin/${value}") [ { name = "bridge"; value = "bridge -color=always"; diff --git a/modules/common/nix.nix b/modules/common/nix.nix index 58d572f..6a75e85 100644 --- a/modules/common/nix.nix +++ b/modules/common/nix.nix @@ -95,6 +95,8 @@ in overlays = [ inputs.self.overlays.default ]; }; + programs.nh.enable = this.isHeadful; + environment = { defaultPackages = [ ]; systemPackages = diff --git a/modules/common/shell/default.nix b/modules/common/shell/default.nix index 4ae41d8..cacb411 100644 --- a/modules/common/shell/default.nix +++ b/modules/common/shell/default.nix @@ -5,14 +5,13 @@ this, ... }: -with lib; let cfg = config.nixfiles.modules.common.shell; in { - options.nixfiles.modules.common.shell.aliases = mkOption { + options.nixfiles.modules.common.shell.aliases = lib.mkOption { description = "An attribute set of shell aliases."; - type = with types; attrsOf str; + type = with lib.types; attrsOf str; default = { }; }; @@ -24,8 +23,8 @@ in initExtra = let - aliasCompletions = concatStringsSep "\n" ( - mapAttrsToList (name: _: "complete -F _complete_alias ${name}") cfg.aliases + aliasCompletions = lib.concatStringsSep "\n" ( + lib.mapAttrsToList (name: _: "complete -F _complete_alias ${name}") cfg.aliases ); in '' @@ -45,7 +44,7 @@ in source "${./functions.bash}" - source "${getExe' pkgs.complete-alias "complete_alias"}" + source "${lib.getExe' pkgs.complete-alias "complete_alias"}" ${aliasCompletions} # https://github.com/garabik/grc?tab=readme-ov-file#bash @@ -73,19 +72,18 @@ in ]; shellAliases = - listToAttrs ( + lib.listToAttrs ( map ( { name, value }: - nameValuePair name ( - with pkgs; + lib.nameValuePair name ( let pkg = if this.isHeadful then (pkgs.coreutils.overrideAttrs ( _: super: { patches = (super.patches or [ ]) ++ [ - (fetchpatch { + (pkgs.fetchpatch { url = "https://raw.githubusercontent.com/jarun/advcpmv/1e2b1c6b74fa0974896bf94604279a3f74b37a63/advcpmv-0.9-9.5.patch"; hash = "sha256-LRfb4heZlAUKiXl/hC/HgoqeGMxCt8ruBYZUrbzSH+Y="; }) @@ -93,24 +91,24 @@ in } )) else - coreutils; + pkgs.coreutils; in - "${getExe' pkg "coreutils"} --coreutils-prog=${value}" + "${lib.getExe' pkg "coreutils"} --coreutils-prog=${value}" ) ) ( let mkAlias = { - name ? head command, + name ? lib.head command, command, }: { inherit name; - value = concatStringsSep " " command; + value = lib.concatStringsSep " " command; }; - progressBar = optionalString this.isHeadful "--progress-bar"; + progressBar = lib.optionalString this.isHeadful "--progress-bar"; in [ (mkAlias { @@ -171,7 +169,7 @@ in ] ) ) - // (genAttrs [ + // (lib.genAttrs [ "grep" "egrep" "fgrep" diff --git a/modules/common/systemd.nix b/modules/common/systemd.nix index f832518..996096e 100644 --- a/modules/common/systemd.nix +++ b/modules/common/systemd.nix @@ -1,5 +1,6 @@ { config, + lib, ... }: { @@ -35,8 +36,16 @@ user = { inherit extraConfig; }; + + suppressedSystemUnits = lib.optionals config.nixfiles.modules.ark.enable [ + "systemd-machine-id-commit.service" + ]; }; + boot.initrd.systemd.suppressedUnits = lib.optionals config.nixfiles.modules.ark.enable [ + "systemd-machine-id-commit.service" + ]; + environment.variables = { SYSTEMD_PAGERSECURE = "1"; SYSTEMD_PAGER = "less"; diff --git a/modules/common/xdg.nix b/modules/common/xdg.nix index 0b807b7..df7d624 100644 --- a/modules/common/xdg.nix +++ b/modules/common/xdg.nix @@ -4,7 +4,6 @@ this, ... }: -with lib; let cfg = config.nixfiles.modules.common.xdg; in @@ -20,44 +19,44 @@ in ]; in [ - (mkAliasOptionModule [ + (lib.mkAliasOptionModule [ "dirs" "cache" ] (withBase "cacheHome")) - (mkAliasOptionModule [ + (lib.mkAliasOptionModule [ "dirs" "config" ] (withBase "configHome")) - (mkAliasOptionModule [ + (lib.mkAliasOptionModule [ "dirs" "data" ] (withBase "dataHome")) - (mkAliasOptionModule [ + (lib.mkAliasOptionModule [ "dirs" "state" ] (withBase "stateHome")) - (mkAliasOptionModule [ "userDirs" ] (withBase "userDirs")) + (lib.mkAliasOptionModule [ "userDirs" ] (withBase "userDirs")) ]; options.nixfiles.modules.common.xdg = { - cacheHome = mkOption { - type = types.str; + cacheHome = lib.mkOption { + type = lib.types.str; default = "${config.hm.home.homeDirectory}/.cache"; }; - configHome = mkOption { - type = types.str; + configHome = lib.mkOption { + type = lib.types.str; default = "${config.hm.home.homeDirectory}/.config"; }; - dataHome = mkOption { - type = types.str; + dataHome = lib.mkOption { + type = lib.types.str; default = "${config.hm.home.homeDirectory}/.local/share"; }; - stateHome = mkOption { - type = types.str; + stateHome = lib.mkOption { + type = lib.types.str; default = "${config.hm.home.homeDirectory}/.local/state"; }; - userDirs = mkOption { - type = types.attrs; + userDirs = lib.mkOption { + type = lib.types.attrs; default = let inherit (config.my) home; @@ -76,9 +75,9 @@ in videos = tmp; }; }; - defaultApplications = mkOption { + defaultApplications = lib.mkOption { description = "Default applications."; - type = with types; attrsOf (listOf str); + type = with lib.types; attrsOf (listOf str); default = { }; }; }; @@ -89,7 +88,7 @@ in sounds.enable = this.isHeadful; }; - hm.xdg = mkMerge [ + hm.xdg = lib.mkMerge [ (with cfg; { enable = true; @@ -99,11 +98,11 @@ in inherit stateHome; inherit userDirs; }) - (mkIf this.isHeadful { + (lib.mkIf this.isHeadful { mimeApps = { enable = true; - defaultApplications = mkMerge ( - mapAttrsToList (n: v: genAttrs v (_: [ "${n}.desktop" ])) cfg.defaultApplications + defaultApplications = lib.mkMerge ( + lib.mapAttrsToList (n: v: lib.genAttrs v (_: [ "${n}.desktop" ])) cfg.defaultApplications ); }; }) diff --git a/modules/curl.nix b/modules/curl.nix index 6895262..3c318fc 100644 --- a/modules/curl.nix +++ b/modules/curl.nix @@ -20,7 +20,7 @@ in ''; environment.systemPackages = with pkgs; [ - curl + curlHTTP3 (writeShellScriptBin "0x0" '' url="https://0x0.st" form="file=@" diff --git a/modules/emacs/doom/config.el b/modules/emacs/doom/config.el index 85fe4a9..464a8b2 100644 --- a/modules/emacs/doom/config.el +++ b/modules/emacs/doom/config.el @@ -260,3 +260,105 @@ (setq-local company-idle-delay 0.1)))) :init (setq! hledger-input-buffer-height 20)) + +;; +;;; LLM +;; + +(use-package! gptel + :config + (setq! gptel-model 'codegemma:7b + gptel-backend (gptel-make-ollama "ollama" + :host "eonwe.shire.net:11434" + :stream t + :models '(mistral:7b + codegemma:7b + codellama:7b + deepseek-coder-v2:16b + llama3.2:3b)))) + +(use-package! ellama + :init + (setq! ellama-naming-scheme 'ellama-generate-name-by-time) + :config + (require 'llm-ollama) + (setq! ellama-provider (make-llm-ollama + :scheme "http" + :host "eonwe.shire.net" + :port 11434 + :chat-model "llama3.2:3b" + :embedding-model "nomic-embed-text:latest") + ellama-providers '(("llama" . (make-llm-ollama + :scheme "http" + :host "eonwe.shire.net" + :port 11434 + :chat-model "llama3.2:3b" + :embedding-model "nomic-embed-text:latest")) + ("codellama" . (make-llm-ollama + :scheme "http" + :host "eonwe.shire.net" + :port 11434 + :chat-model "codellama:7b" + :embedding-model "nomic-embed-text:latest")) + ("qwen" . (make-llm-ollama + :scheme "http" + :host "eonwe.shire.net" + :port 11434 + :chat-model "qwen2.5:7b" + :embedding-model "nomic-embed-text:latest")) + ("gemma" . (make-llm-ollama + :scheme "http" + :host "eonwe.shire.net" + :port 11434 + :chat-model "gemma2:9b" + :embedding-model "nomic-embed-text:latest")) + ("codegemma" . (make-llm-ollama + :scheme "http" + :host "eonwe.shire.net" + :port 11434 + :chat-model "codegemma:7b" + :embedding-model "nomic-embed-text:latest")) + ("mistral" . (make-llm-ollama + :scheme "http" + :host "eonwe.shire.net" + :port 11434 + :chat-model "mistral:7b" + :embedding-model "nomic-embed-text:latest")) + ("hermes" . (make-llm-ollama + :scheme "http" + :host "eonwe.shire.net" + :port 11434 + :chat-model "hermes3:8b" + :embedding-model "nomic-embed-text:latest")) + ("deepseek" . (make-llm-ollama + :scheme "http" + :host "eonwe.shire.net" + :port 11434 + :chat-model "deepseek-coder-v2:16b" + :embedding-model "nomic-embed-text:latest"))) + ellama-translation-provider (make-llm-ollama + :scheme "http" + :host "eonwe.shire.net" + :port 11434 + :chat-model "qwen2.5:7b" + :embedding-model "nomic-embed-text:latest") + ellama-summarization-provider (make-llm-ollama + :scheme "http" + :host "eonwe.shire.net" + :port 11434 + :chat-model "mistral:7b" + :embedding-model "nomic-embed-text:latest"))) + +(use-package! magit-gptcommit + :after magit + :config + (require 'llm-ollama) + (setq! magit-gptcommit-llm-provider (make-llm-ollama + :scheme "http" + :host "eonwe.shire.net" + :port 11434 + :chat-model "llama3.2:3b" + :embedding-model "nomic-embed-text:latest")) + + + (magit-gptcommit-status-buffer-setup)) diff --git a/modules/emacs/doom/init.el b/modules/emacs/doom/init.el index 8575c3f..3845fd6 100644 --- a/modules/emacs/doom/init.el +++ b/modules/emacs/doom/init.el @@ -48,7 +48,7 @@ :checkers syntax - (spell +everywhere +icons) + (spell +flyspell +everywhere +icons) grammar :tools diff --git a/modules/emacs/doom/packages.el b/modules/emacs/doom/packages.el index fb521bc..8fb24f4 100644 --- a/modules/emacs/doom/packages.el +++ b/modules/emacs/doom/packages.el @@ -21,6 +21,10 @@ :recipe (:host gitlab :repo "emacs-ansible/emacs-ansible")) +(package! gptel) +(package! ellama) +(package! magit-gptcommit) + ;; (package! tvl ;; :recipe (:host nil ;; :repo "https://code.tvl.fyi/depot.git:/tools/emacs-pkgs/tvl.git" diff --git a/modules/firefox/addons.json b/modules/firefox/addons.json index 5c6a090..2a217c2 100644 --- a/modules/firefox/addons.json +++ b/modules/firefox/addons.json @@ -19,6 +19,10 @@ "slug": "languagetool" }, { + "pname": "metamask", + "slug": "ether-metamask" + }, + { "slug": "no-pdf-download" }, { @@ -32,6 +36,9 @@ "slug": "skip-redirect" }, { + "slug": "switchyomega" + }, + { "slug": "ublock-origin" }, { @@ -40,8 +47,5 @@ }, { "slug": "violentmonkey" - }, - { - "slug": "switchyomega" } ] diff --git a/modules/firefox/addons.nix b/modules/firefox/addons.nix index e416a3f..ebe834a 100644 --- a/modules/firefox/addons.nix +++ b/modules/firefox/addons.nix @@ -5,10 +5,10 @@ { "bitwarden" = buildFirefoxXpiAddon { pname = "bitwarden"; - version = "2024.10.0"; + version = "2024.10.1"; addonId = "{446900e4-71c2-419f-a6a7-df9c091e268b}"; - url = "https://addons.mozilla.org/firefox/downloads/file/4363548/bitwarden_password_manager-2024.10.0.xpi"; - sha256 = "9ea9428444870a74ae1999d77eb12d97a45275c85e83d6afdcbc4597fa3eccfb"; + url = "https://addons.mozilla.org/firefox/downloads/file/4371752/bitwarden_password_manager-2024.10.1.xpi"; + sha256 = "7b7357ddce2756dc536b86b5c14139ec09731c1c114ac82807c60fba3ced12a5"; meta = with lib; { homepage = "https://bitwarden.com"; description = "At home, at work, or on the go, Bitwarden easily secures all your passwords, passkeys, and sensitive information."; @@ -144,6 +144,36 @@ platforms = platforms.all; }; }; + "metamask" = buildFirefoxXpiAddon { + pname = "metamask"; + version = "12.0.6"; + addonId = "webextension@metamask.io"; + url = "https://addons.mozilla.org/firefox/downloads/file/4342782/ether_metamask-12.0.6.xpi"; + sha256 = "a66e20bbe5ded1b9408420e4c2ffc82369cc3bfd27350afe25f2c0ef6b26ff3b"; + meta = with lib; { + description = "Ethereum Browser Extension"; + mozPermissions = [ + "storage" + "unlimitedStorage" + "clipboardWrite" + "http://localhost:8545/" + "https://*.infura.io/" + "https://*.codefi.network/" + "https://*.cx.metamask.io/" + "https://chainid.network/chains.json" + "https://lattice.gridplus.io/*" + "activeTab" + "webRequest" + "*://*.eth/" + "notifications" + "file://*/*" + "http://*/*" + "https://*/*" + "*://connect.trezor.io/*/popup.html" + ]; + platforms = platforms.all; + }; + }; "no-pdf-download" = buildFirefoxXpiAddon { pname = "no-pdf-download"; version = "1.0.6"; @@ -187,10 +217,10 @@ }; "rikaichamp" = buildFirefoxXpiAddon { pname = "rikaichamp"; - version = "1.21.1"; + version = "1.22.0"; addonId = "{59812185-ea92-4cca-8ab7-cfcacee81281}"; - url = "https://addons.mozilla.org/firefox/downloads/file/4355635/10ten_ja_reader-1.21.1.xpi"; - sha256 = "81d85cfdc03cb0c921cac84547e7a7a539af11ff9a81dd901b3f3bfa67ba45f1"; + url = "https://addons.mozilla.org/firefox/downloads/file/4371439/10ten_ja_reader-1.22.0.xpi"; + sha256 = "d6f3197b7e3383f2723b9376d93e03fe515e5c610f9c0723d9618b10d3cc4bf1"; meta = with lib; { homepage = "https://github.com/birchill/10ten-ja-reader/"; description = "Quickly translate Japanese by hovering over words. Formerly released as Rikaichamp."; diff --git a/modules/firefox/default.nix b/modules/firefox/default.nix index b7e47b6..51e464f 100644 --- a/modules/firefox/default.nix +++ b/modules/firefox/default.nix @@ -127,6 +127,7 @@ in darkreader furiganaize languagetool + metamask no-pdf-download redirector rikaichamp diff --git a/modules/games/gamemode.nix b/modules/games/gamemode.nix index eb485f8..4e57a8b 100644 --- a/modules/games/gamemode.nix +++ b/modules/games/gamemode.nix @@ -1,13 +1,12 @@ { config, lib, ... }: -with lib; let cfg = config.nixfiles.modules.games.gamemode; in { - options.nixfiles.modules.games.gamemode.enable = mkEnableOption "Feral GameMode"; + options.nixfiles.modules.games.gamemode.enable = lib.mkEnableOption "Feral GameMode"; - config = mkIf cfg.enable { - hm.xdg.configFile."gamemode.ini".text = generators.toINI { } { general.softrealtime = "auto"; }; + config = lib.mkIf cfg.enable { + hm.xdg.configFile."gamemode.ini".text = lib.generators.toINI { } { general.softrealtime = "auto"; }; programs.gamemode.enable = true; }; diff --git a/modules/games/minecraft.nix b/modules/games/minecraft.nix index f93a139..f849360 100644 --- a/modules/games/minecraft.nix +++ b/modules/games/minecraft.nix @@ -5,7 +5,6 @@ pkgs, ... }: -with lib; let cfg = config.nixfiles.modules.games.minecraft; in @@ -13,28 +12,30 @@ in imports = [ inputs.minecraft.nixosModules.minecraft-servers ]; options.nixfiles.modules.games.minecraft = { - client.enable = mkEnableOption "Minecraft client"; + client.enable = lib.mkEnableOption "Minecraft client"; server = { - enable = mkEnableOption "Minecraft server"; + enable = lib.mkEnableOption "Minecraft server"; - port = mkOption { + port = lib.mkOption { description = "Server port."; - type = types.port; + type = lib.types.port; default = 25565; }; - memory = mkOption { + memory = lib.mkOption { description = "Amount of RAM to allocate."; - type = types.str; + type = lib.types.str; default = "2G"; }; }; }; - config = mkMerge [ - (mkIf cfg.client.enable { hm.home.packages = [ pkgs.prismlauncher ]; }) - (mkIf cfg.server.enable { - nixfiles.modules.common.nix.allowedUnfreePackages = [ "minecraft-server" ]; + config = lib.mkMerge [ + (lib.mkIf cfg.client.enable { hm.home.packages = [ pkgs.prismlauncher ]; }) + (lib.mkIf cfg.server.enable { + nixfiles.modules.common.nix.allowedUnfreePackages = [ + "minecraft-server" # proprietary + ]; ark.directories = [ config.services.minecraft-servers.dataDir ]; @@ -50,7 +51,7 @@ in # https://api.papermc.io/v2/projects/paper # https://github.com/Infinidoge/nix-minecraft/blob/master/pkgs/paper-servers/lock.json - package = pkgs.paperServers.paper-1_21_47; + package = pkgs.minecraftServers.paper-1_21_3; serverProperties = { # motd = ""; @@ -71,7 +72,7 @@ in }; jvmOpts = - (concatStringsSep " " [ + (lib.concatStringsSep " " [ "-Xms${cfg.server.memory}" "-Xmx${cfg.server.memory}" "--add-modules=jdk.incubator.vector" # Required by some plugins. diff --git a/modules/games/steam-run.nix b/modules/games/steam-run.nix index be06c78..9e3c962 100644 --- a/modules/games/steam-run.nix +++ b/modules/games/steam-run.nix @@ -2,72 +2,49 @@ config, lib, pkgs, - pkgsRev, ... }: -with lib; let cfg = config.nixfiles.modules.games.steam-run; in { options.nixfiles.modules.games.steam-run = { - enable = mkEnableOption "native Steam runtime"; + enable = lib.mkEnableOption "native Steam runtime"; quirks = { - blackIsleStudios = mkEnableOption "fixes for games from Black Isle Studios"; - cryptOfTheNecrodancer = mkEnableOption ''fixes for "Crypt of the NecroDancer" issues''; - mountAndBladeWarband = mkEnableOption ''fixes for "Mount & Blade: Warband" issues''; + blackIsleStudios = lib.mkEnableOption "fixes for games from Black Isle Studios"; + cryptOfTheNecrodancer = lib.mkEnableOption ''fixes for "Crypt of the NecroDancer" issues''; + mountAndBladeWarband = lib.mkEnableOption ''fixes for "Mount & Blade: Warband" issues''; }; }; - config = mkIf cfg.enable { - nixfiles.modules.games.steam.enable = true; + config = lib.mkIf cfg.enable { + nixfiles.modules = { + games.steam.enable = true; - hm.home.packages = with pkgs; [ - (steam.override { + common.nix.allowedUnfreePackages = lib.optionals cfg.quirks.mountAndBladeWarband [ + "fmod" # proprietary + ]; + }; + + hm.home.packages = [ + (pkgs.steam.override { + extraEnv.MANGOHUD = 1; extraLibraries = _: - with cfg.quirks; - optional blackIsleStudios openssl_1_0_0 - ++ optional cryptOfTheNecrodancer (pkgsRev "d1c3fea7ecbed758168787fe4e4a3157e52bc808" "sha256-3muuhz3fjtF1bz32UXOYCho51E8JSeEwo2iDZFQJdXo=") - .flac - ++ optionals mountAndBladeWarband [ - (glew.overrideAttrs ( - _: super: - let - opname = super.pname; - in - rec { - pname = "${opname}-steam-run-fix"; - inherit (super) version; - src = fetchurl { - url = "mirror://sourceforge/${opname}/${opname}-${version}.tgz"; - hash = "sha256-BN6R5+Z2MDm8EZQAlc2cf4gLq6ghlqd2X3J6wFqZPJU="; - }; - } - )) - (fmodex.overrideAttrs ( - _: super: - let - opname = super.pname; - in - rec { - pname = "${opname}-steam-run-fix"; - inherit (super) version; - installPhase = - let - libPath = makeLibraryPath [ - alsa-lib - libpulseaudio - stdenv.cc.cc - ]; - in - '' - install -Dm755 api/lib/libfmodex64-${version}.so $out/lib/libfmodex64.so - patchelf --set-rpath ${libPath} $out/lib/libfmodex64.so - ''; - } - )) + lib.optionals cfg.quirks.blackIsleStudios [ + pkgs.openssl_1_0_0 + ] + ++ lib.optionals cfg.quirks.cryptOfTheNecrodancer [ + (lib.packages.fromRev "d1c3fea7ecbed758168787fe4e4a3157e52bc808" "sha256-3muuhz3fjtF1bz32UXOYCho51E8JSeEwo2iDZFQJdXo=") + .flac + ] + ++ lib.optionals cfg.quirks.mountAndBladeWarband [ + (pkgs.fmodex.overrideAttrs (oldAttrs: { + postInstall = '' + ln -s $out/lib/libfmodex64.so $out/lib/libfmodex-${oldAttrs.version}.so + ''; + })) ]; }).run ]; diff --git a/modules/git/default.nix b/modules/git/default.nix index b618a57..f370ae6 100644 --- a/modules/git/default.nix +++ b/modules/git/default.nix @@ -8,38 +8,37 @@ this, ... }: -with lib; let cfg = config.nixfiles.modules.git; in { options.nixfiles.modules.git = { - client.enable = mkEnableOption "Git client"; + client.enable = lib.mkEnableOption "Git client"; server = { - enable = mkEnableOption "Git server"; + enable = lib.mkEnableOption "Git server"; - domain = mkOption { + domain = lib.mkOption { description = "Domain name sans protocol scheme."; - type = with types; nullOr str; + type = with lib.types; nullOr str; default = "git.${config.networking.domain}"; }; - package = mkOption { + package = lib.mkOption { description = "Package."; - type = types.package; + type = lib.types.package; default = pkgs.cgit; }; }; }; - config = mkMerge [ - (mkIf cfg.client.enable { + config = lib.mkMerge [ + (lib.mkIf cfg.client.enable { secrets = { glab-cli-config = { file = "${inputs.self}/secrets/glab-cli-config"; path = "${config.dirs.config}/glab-cli/config.yml"; - owner = my.username; + owner = lib.my.username; }; # NOTE SSO requires relogin every day, so keeping persistent auth tokens # doesn't work. @@ -51,7 +50,7 @@ in hut = { file = "${inputs.self}/secrets/hut"; path = "${config.dirs.config}/hut/config"; - owner = my.username; + owner = lib.my.username; }; }; @@ -73,10 +72,10 @@ in package = if this.isHeadful then pkgs.gitFull else pkgs.gitMinimal; - userName = my.username; - userEmail = my.email; + userName = lib.my.username; + userEmail = lib.my.email; signing = { - inherit (my.pgp) key; + inherit (lib.my.pgp) key; signByDefault = true; }; @@ -102,48 +101,46 @@ in }; submodule.recurse = true; sendemail = rec { - smtpServer = my.domain.shire; - smtpUser = "${my.username}@${smtpServer}"; + smtpServer = lib.my.domain.shire; + smtpUser = "${lib.my.username}@${smtpServer}"; smtpEncryption = "ssl"; smtpServerPort = 465; annotate = true; confirm = "always"; }; column.ui = "auto"; - github.user = my.username; - gitlab.user = my.username; + github.user = lib.my.username; + gitlab.user = lib.my.username; } - // mapAttrs' (name: value: nameValuePair ''url "git@${value}:"'' { insteadOf = "${name}:"; }) { + // lib.mapAttrs' (n: v: lib.nameValuePair ''url "git@${v}:"'' { insteadOf = "${n}:"; }) { "bitbucket" = "bitbucket.com"; "codeberg" = "codeberg.org"; "github" = "github.com"; "gitlab" = "gitlab.com"; "sourcehut" = "git.sr.ht"; } - // - mapAttrs' (name: values: nameValuePair ''url "https://${values}/"'' { insteadOf = "${name}:"; }) - { - "alpine" = "gitlab.alpinelinux.org"; - "clan" = "git.clan.lol"; - "debian" = "salsa.debian.org"; - "freedesktop" = "gitlab.freedesktop.org"; - "gnome" = "gitlab.gnome.org"; - "haskell" = "gitlab.haskell.org"; - "homotopic" = "gitlab.homotopic.tech"; - "horizon" = "gitlab.horizon-haskell.net"; - "kde" = "invent.kde.org"; - "nixca" = "gitlab.nixca.dev"; - "notabug" = "notabug.org"; - "opencode" = "opencode.net"; - "syndicate" = "git.syndicate-lang.org"; - "torproject" = "gitlab.torproject.org"; - "videolan" = "code.videolan.org"; - }; + // lib.mapAttrs' (n: v: lib.nameValuePair ''url "https://${v}/"'' { insteadOf = "${n}:"; }) { + "alpine" = "gitlab.alpinelinux.org"; + "clan" = "git.clan.lol"; + "debian" = "salsa.debian.org"; + "freedesktop" = "gitlab.freedesktop.org"; + "gnome" = "gitlab.gnome.org"; + "haskell" = "gitlab.haskell.org"; + "homotopic" = "gitlab.homotopic.tech"; + "horizon" = "gitlab.horizon-haskell.net"; + "kde" = "invent.kde.org"; + "nixca" = "gitlab.nixca.dev"; + "notabug" = "notabug.org"; + "opencode" = "opencode.net"; + "syndicate" = "git.syndicate-lang.org"; + "torproject" = "gitlab.torproject.org"; + "videolan" = "code.videolan.org"; + }; aliases = let - git = getExe config.hm.programs.git.package; - curl = getExe pkgs.curl; + git = lib.getExe config.hm.programs.git.package; + curl = lib.getExe pkgs.curl; in { amend = "commit --amend"; @@ -189,181 +186,178 @@ in }; }; }) - (mkIf cfg.server.enable ( - with cfg.server; - { - ark.directories = [ config.services.gitolite.dataDir ]; + (lib.mkIf cfg.server.enable { + ark.directories = [ config.services.gitolite.dataDir ]; - nixfiles.modules.nginx = { - enable = true; - virtualHosts.${domain}.locations = { }; - }; + nixfiles.modules.nginx = { + enable = true; + virtualHosts.${cfg.server.domain}.locations = { }; + }; - services = { - cgit.${domain} = { - enable = true; + services = { + cgit.${cfg.server.domain} = { + enable = true; - package = pkgs.cgit-pink; + package = pkgs.cgit-pink; - # We make gitolite repos readable by the common group. - user = "git"; - group = "git"; + # We make gitolite repos readable by the common group. + user = "git"; + group = "git"; - scanPath = "${config.services.gitolite.dataDir}/repositories"; + scanPath = "${config.services.gitolite.dataDir}/repositories"; - settings = { - root-title = "git.azahi.cc"; - root-desc = "British scientists have discovered that using GitHub frequently is harmful to one's mental health, especially GitHub Actions..."; + settings = { + root-title = "git.azahi.cc"; + root-desc = "British scientists have discovered that using GitHub frequently is harmful to one's mental health, especially GitHub Actions..."; - footer = "${pkgs.writeText "cgit-footer" '' - <p style="text-align: center;">Consider giving <a href="https://nixos.org">Nix/NixOS</a> a try! <3</p> - ''}"; + footer = "${pkgs.writeText "cgit-footer" '' + <p style="text-align: center;">Consider giving <a href="https://nixos.org">Nix/NixOS</a> a try! <3</p> + ''}"; - about-filter = "${pkgs.writeScript "cgit-about-filter.sh" '' - #!${pkgs.bash}/bin/sh - filename=$1 - case "$filename" in - *.md) - exec ${pkgs.pandoc}/bin/pandoc -f markdown -t html - ;; - *.org) - exec ${pkgs.pandoc}/bin/pandoc -f org -t html - ;; - *) - echo "<pre>" - ${pkgs.coreutils}/bin/cat - echo "</pre>" - ;; - esac - ''}"; - source-filter = "${package}/lib/cgit/filters/syntax-highlighting.py"; - commit-filter = "${package}/lib/cgit/filters/commit-links.sh"; + about-filter = "${pkgs.writeScript "cgit-about-filter.sh" '' + #!${pkgs.bash}/bin/sh + filename=$1 + case "$filename" in + *.md) + exec ${pkgs.pandoc}/bin/pandoc -f markdown -t html + ;; + *.org) + exec ${pkgs.pandoc}/bin/pandoc -f org -t html + ;; + *) + echo "<pre>" + ${pkgs.coreutils}/bin/cat + echo "</pre>" + ;; + esac + ''}"; + source-filter = "${cfg.server.package}/lib/cgit/filters/syntax-highlighting.py"; + commit-filter = "${cfg.server.package}/lib/cgit/filters/commit-links.sh"; - readme = [ - ":README" - ":readme.md" - ":readme.org" - ]; + readme = [ + ":README" + ":readme.md" + ":readme.org" + ]; - clone-url = "https://$HTTP_HOST/$CGIT_REPO_URL"; + clone-url = "https://$HTTP_HOST/$CGIT_REPO_URL"; - enable-blame = true; - enable-commit-graph = true; - enable-follow-links = true; - enable-git-config = true; - enable-gitweb-owner = true; - enable-html-serving = true; - enable-http-clone = true; - enable-index-links = false; - enable-index-owner = false; - enable-log-filecount = true; - enable-log-linecount = true; - enable-subject-links = true; - enable-tree-linenumbers = true; + enable-blame = true; + enable-commit-graph = true; + enable-follow-links = true; + enable-git-config = true; + enable-gitweb-owner = true; + enable-html-serving = true; + enable-http-clone = true; + enable-index-links = false; + enable-index-owner = false; + enable-log-filecount = true; + enable-log-linecount = true; + enable-subject-links = true; + enable-tree-linenumbers = true; - branch-sort = "age"; - repository-sort = "age"; + branch-sort = "age"; + repository-sort = "age"; - remove-suffix = true; + remove-suffix = true; - logo = "/logo.gif"; - logo-link = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"; - }; + logo = "/logo.gif"; + logo-link = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"; }; + }; - gitolite = { - enable = true; - user = "git"; - group = "git"; - adminPubkey = my.ssh.key; - extraGitoliteRc = '' - # This allows cgit to scan repositories while running under a - # different user. - $RC{UMASK} = 0027; + gitolite = { + enable = true; + user = "git"; + group = "git"; + adminPubkey = lib.my.ssh.key; + extraGitoliteRc = '' + # This allows cgit to scan repositories while running under a + # different user. + $RC{UMASK} = 0027; - # This allows hiding repositories via "cgit.ignore"[1]. - # - # [1]: https://www.omarpolo.com/post/cgit-gitolite.html - $RC{GIT_CONFIG_KEYS} = '.*'; - ''; - }; + # This allows hiding repositories via "cgit.ignore"[1]. + # + # [1]: https://www.omarpolo.com/post/cgit-gitolite.html + $RC{GIT_CONFIG_KEYS} = '.*'; + ''; + }; - nginx.virtualHosts.${domain}.locations = - let - extraHead = '' - ${libNginx.config.appendHead [ - ''<meta name="go-import" content="$host$uri git https://$host$uri">'' - (libPlausible.htmlPlausibleScript { inherit (cfg.server) domain; }) - ]} + nginx.virtualHosts.${cfg.server.domain}.locations = + let + extraHead = '' + ${libNginx.config.appendHead [ + ''<meta name="go-import" content="$host$uri git https://$host$uri">'' + (libPlausible.htmlPlausibleScript { inherit (cfg.server) domain; }) + ]} + ''; + in + { + "/" = { + extraConfig = lib.mkBefore extraHead; + fastcgiParams.HTTP_ACCEPT_ENCODING = ""; + }; + "~ /.+/(info/refs|git-upload-pack)" = { + extraConfig = lib.mkBefore extraHead; + fastcgiParams.HTTP_ACCEPT_ENCODING = ""; + }; + "= /logo.gif".alias = "${./logo.gif}"; + "= /favicon.ico" = { + alias = "${./favicon.ico}"; + extraConfig = lib.mkForce ""; + }; + "= /cgit.css" = { + alias = pkgs.writeText "cgit.css" '' + ${builtins.readFile "${cfg.server.package}/cgit/cgit.css"} + * { + line-height: 1.25em; + } + div#cgit { + font-family: ${ + lib.concatMapStringsSep ", " (f: ''"${f}"'') config.fonts.fontconfig.defaultFonts.monospace + }, monospace; + -moz-tab-size: 2; + tab-size: 2; + max-width: 117ch; + margin: auto; + } + div#cgit table#header td.sub { + border-top: none; + } + div#cgit table#header td.sub.right { + padding-right: 1em; + } + div#cgit table.tabs { + border-bottom: none; + } + div#cgit div.content { + border-bottom: none; + } + div#cgit table.list th a { + color: inherit; + } + div#cgit table.list tr:nth-child(even) { + background: inherit; + } + div#cgit table.list tr:hover { + background: inherit; + } + div#cgit table.list tr.nohover-highlight:hover:nth-child(even) { + background: inherit; + } + div#cgit table.blob td.linenumbers a:target { + color: goldenrod; + text-decoration: underline; + outline: none; + } + div#cgit div#summary { + max-width: 80ch; + } ''; - in - { - "/" = { - extraConfig = mkBefore extraHead; - fastcgiParams.HTTP_ACCEPT_ENCODING = ""; - }; - "~ /.+/(info/refs|git-upload-pack)" = { - extraConfig = mkBefore extraHead; - fastcgiParams.HTTP_ACCEPT_ENCODING = ""; - }; - "= /logo.gif".alias = "${./logo.gif}"; - "= /favicon.ico" = { - alias = "${./favicon.ico}"; - extraConfig = mkForce ""; - }; - "= /cgit.css" = { - alias = pkgs.writeText "cgit.css" '' - ${readFile "${package}/cgit/cgit.css"} - * { - line-height: 1.25em; - } - div#cgit { - font-family: ${ - concatMapStringsSep ", " (f: ''"${f}"'') config.fonts.fontconfig.defaultFonts.monospace - }, monospace; - -moz-tab-size: 2; - tab-size: 2; - max-width: 117ch; - margin: auto; - } - div#cgit table#header td.sub { - border-top: none; - } - div#cgit table#header td.sub.right { - padding-right: 1em; - } - div#cgit table.tabs { - border-bottom: none; - } - div#cgit div.content { - border-bottom: none; - } - div#cgit table.list th a { - color: inherit; - } - div#cgit table.list tr:nth-child(even) { - background: inherit; - } - div#cgit table.list tr:hover { - background: inherit; - } - div#cgit table.list tr.nohover-highlight:hover:nth-child(even) { - background: inherit; - } - div#cgit table.blob td.linenumbers a:target { - color: goldenrod; - text-decoration: underline; - outline: none; - } - div#cgit div#summary { - max-width: 80ch; - } - ''; - extraConfig = mkForce ""; - }; + extraConfig = lib.mkForce ""; }; - }; - } - )) + }; + }; + }) ]; } diff --git a/modules/hyprland.nix b/modules/hyprland.nix new file mode 100644 index 0000000..cab01b6 --- /dev/null +++ b/modules/hyprland.nix @@ -0,0 +1,143 @@ +{ + config, + inputs, + lib, + ... +}: +let + cfg = config.nixfiles.modules.hyprland; +in +{ + options.nixfiles.modules.hyprland.enable = lib.mkEnableOption "Hyprland"; + + config = lib.mkIf cfg.enable { + nixfiles.modules.wayland.enable = true; + + hm = { + stylix.targets.hyprland.enable = false; + + wayland.windowManager.hyprland = { + enable = true; + + systemd = { + enable = true; + variables = [ "--all" ]; + }; + + settings = { + misc = { + disable_hyprland_logo = true; + disable_splash_rendering = true; + }; + + general = { + gaps_in = 0; + gaps_out = 0; + }; + + decoration = { + blur.enabled = false; + }; + + animations.enabled = false; + + debug.disable_logs = false; + + input = with config.services.xserver.xkb; { + kb_layout = layout; + kb_variant = variant; + kb_options = options; + + repeat_delay = config.services.xserver.autoRepeatDelay; + repeat_rate = config.services.xserver.autoRepeatInterval; + }; + + bindm = [ + "SUPER, mouse:272, movewindow" + "SUPER, mouse:273, resizewindow" + "SUPER ALT, mouse:272, resizewindow" + ]; + + bind = + [ + "SUPER SHIFT, E, exec, pkill Hyprland" + + "SUPER, D, killactive," + "SUPER, F, fullscreen," + + "SUPER, G, togglegroup," + "SUPER SHIFT, N, changegroupactive, f" + "SUPER SHIFT, P, changegroupactive, b" + + "SUPER, R, togglesplit," + "SUPER, T, togglefloating," + "SUPER, P, pseudo," + "SUPER ALT, ,resizeactive," + + "SUPER, Return, exec, foot" + "SUPER, L, exec, pgrep hyprlock || hyprlock" + + "SUPER, H, movefocus, l" + "SUPER, J, movefocus, d" + "SUPER, K, movefocus, u" + "SUPER, L, movefocus, r" + + "SUPER SHIFT, H, movewindow, l" + "SUPER SHIFT, J, movewindow, d" + "SUPER SHIFT, K, movewindow, u" + "SUPER SHIFT, L, movewindow, r" + + "SUPER ALT, H, resizeactive, 10 0" + "SUPER ALT, J, resizeactive, 0 10" + "SUPER ALT, K, resizeactive, 0 -10" + "SUPER ALT, L, resizeactive, -10 0" + + ", XF86AudioPlay, exec, mpc play" + ", XF86AudioPrev, exec, mpc prev" + ", XF86AudioNext, exec, mpc next" + + ", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ .1+" + ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ .1-" + + ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + ", XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" + + ", XF86MonBrightnessUp, exec, brightnessctl set +5%" + ", XF86MonBrightnessDown, exec, brightnessctl set 5%-" + ] + ++ (builtins.concatLists ( + builtins.genList ( + x: + let + ws = + let + c = (x + 1) / 10; + in + toString (x + 1 - (c * 10)); + in + [ + "SUPER, ${ws}, workspace, ${toString (x + 1)}" + "SUPER SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" + ] + ) 10 + )); + }; + }; + + programs.hyprlock.enable = true; + }; + + programs.hyprland.enable = true; + + nixpkgs.overlays = [ inputs.hyprland.overlays.default ]; + + nix.settings = { + substituters = [ + "https://hyprland.cachix.org" + ]; + trusted-public-keys = [ + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + ]; + }; + }; +} diff --git a/modules/jackett.nix b/modules/jackett.nix index 07a5b16..5b0b2c0 100644 --- a/modules/jackett.nix +++ b/modules/jackett.nix @@ -6,22 +6,21 @@ this, ... }: -with lib; let cfg = config.nixfiles.modules.jackett; in { options.nixfiles.modules.jackett = { - enable = mkEnableOption "Jackett"; + enable = lib.mkEnableOption "Jackett"; - domain = mkOption { + domain = lib.mkOption { description = "Domain name sans protocol scheme."; - type = with types; str; + type = lib.types.str; default = "jackett.${config.networking.domain}"; }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { ark.directories = [ "/var/lib/jackett" ]; nixfiles.modules.nginx = { diff --git a/modules/openssh.nix b/modules/openssh.nix index 470b6c9..a41f0d6 100644 --- a/modules/openssh.nix +++ b/modules/openssh.nix @@ -4,26 +4,25 @@ pkgs, ... }: -with lib; let cfg = config.nixfiles.modules.openssh; in { options.nixfiles.modules.openssh = { - client.enable = mkEnableOption "OpenSSH client"; + client.enable = lib.mkEnableOption "OpenSSH client"; server = { - enable = mkEnableOption "OpenSSH server"; + enable = lib.mkEnableOption "OpenSSH server"; - port = mkOption { + port = lib.mkOption { description = "OpenSSH server port."; - type = types.port; + type = lib.types.port; default = 22022; # Port 22 should be occupied by a tarpit. }; }; }; - config = mkMerge [ - (mkIf cfg.client.enable { + config = lib.mkMerge [ + (lib.mkIf cfg.client.enable { hm = { home.packages = with pkgs; [ mosh @@ -49,11 +48,11 @@ in { hostname ? name, port ? 22022, # NOTE This is not the default OpenSSH port. - user ? my.username, - identityFile ? "${config.my.home}/.ssh/${my.username}_${my.ssh.type}", + user ? lib.my.username, + identityFile ? "${config.my.home}/.ssh/${lib.my.username}_${lib.my.ssh.type}", extraAttrs ? { }, }: - nameValuePair name ( + lib.nameValuePair name ( { inherit hostname @@ -65,23 +64,23 @@ in // extraAttrs ); - internalServers = mapAttrs' mkBlock ( - mapAttrs (name: _: { hostname = "${name}.${my.domain.shire}"; }) ( - filterAttrs (_: attr: hasAttr "wireguard" attr && attr.isHeadless) my.configurations + internalServers = lib.mapAttrs' mkBlock ( + lib.mapAttrs (name: _: { hostname = "${name}.${lib.my.domain.shire}"; }) ( + lib.filterAttrs (_: attr: lib.hasAttr "wireguard" attr && attr.isHeadless) lib.my.configurations ) ); in internalServers - // (mapAttrs' mkBlock { + // (lib.mapAttrs' mkBlock { gitolite = { user = "git"; - hostname = "git.${my.domain.shire}"; + hostname = "git.${lib.my.domain.shire}"; }; }); }; }; }) - (mkIf cfg.server.enable { + (lib.mkIf cfg.server.enable { ark.files = [ "/etc/ssh/ssh_host_ed25519_key" "/etc/ssh/ssh_host_ed25519_key.pub" @@ -101,7 +100,7 @@ in KbdInteractiveAuthentication = false; MaxAuthTries = 3; PasswordAuthentication = false; - PermitRootLogin = mkForce "no"; + PermitRootLogin = lib.mkForce "no"; }; }; diff --git a/modules/profiles/default.nix b/modules/profiles/default.nix index 8824dfd..ae03bcc 100644 --- a/modules/profiles/default.nix +++ b/modules/profiles/default.nix @@ -54,6 +54,7 @@ in dnsutils file inetutils + iotop ldns lshw lsof diff --git a/modules/profiles/dev/default.nix b/modules/profiles/dev/default.nix index 61de848..b0755d2 100644 --- a/modules/profiles/dev/default.nix +++ b/modules/profiles/dev/default.nix @@ -22,6 +22,7 @@ in git.client.enable = true; nmap.enable = true; wget.enable = true; + podman.enable = true; }; hm = { @@ -58,6 +59,7 @@ in packages = with pkgs; [ age + distrobox google-cloud-sdk htmlq httpie diff --git a/modules/profiles/headful.nix b/modules/profiles/headful.nix index 256ec25..3a795f1 100644 --- a/modules/profiles/headful.nix +++ b/modules/profiles/headful.nix @@ -130,8 +130,10 @@ in time.timeZone = "Europe/Moscow"; environment.systemPackages = with pkgs; [ + brightnessctl lm_sensors usbutils + wirelesstools ]; my.extraGroups = [ diff --git a/modules/profiles/headless.nix b/modules/profiles/headless.nix index 5d42df0..bf0d23a 100644 --- a/modules/profiles/headless.nix +++ b/modules/profiles/headless.nix @@ -5,16 +5,15 @@ this, ... }: -with lib; let cfg = config.nixfiles.modules.profiles.headless; in { - options.nixfiles.modules.profiles.headless.enable = mkEnableOption "headless profile" // { + options.nixfiles.modules.profiles.headless.enable = lib.mkEnableOption "headless profile" // { default = this.isHeadless; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { nixfiles.modules = { openssh.server.enable = true; endlessh-go.enable = true; diff --git a/modules/searx.nix b/modules/searx.nix index de51a20..ab186af 100644 --- a/modules/searx.nix +++ b/modules/searx.nix @@ -5,28 +5,27 @@ libNginx, ... }: -with lib; let cfg = config.nixfiles.modules.searx; in { options.nixfiles.modules.searx = { - enable = mkEnableOption "SearX"; + enable = lib.mkEnableOption "SearX"; - port = mkOption { + port = lib.mkOption { description = "Port."; - type = with types; port; + type = with lib.types; port; default = 61001; }; - domain = mkOption { + domain = lib.mkOption { description = "Domain name sans protocol scheme."; - type = with types; nullOr str; + type = with lib.types; nullOr str; default = "searx.${config.networking.domain}"; }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { secrets.searx-environment = { file = "${inputs.self}/secrets/searx-environment"; owner = "searx"; diff --git a/modules/vaultwarden.nix b/modules/vaultwarden.nix index edce8e5..124ff78 100644 --- a/modules/vaultwarden.nix +++ b/modules/vaultwarden.nix @@ -5,17 +5,16 @@ this, ... }: -with lib; let cfg = config.nixfiles.modules.vaultwarden; in { options.nixfiles.modules.vaultwarden = { - enable = mkEnableOption "Vaultwarden"; + enable = lib.mkEnableOption "Vaultwarden"; - domain = mkOption { + domain = lib.mkOption { description = "Domain name sans protocol scheme."; - type = with types; str; + type = lib.types.str; default = "vaultwarden.${config.networking.domain}"; }; }; @@ -24,7 +23,7 @@ in let db = "vaultwarden"; in - mkIf cfg.enable { + lib.mkIf cfg.enable { ark.directories = [ "/var/lib/bitwarden_rs" ]; secrets.vaultwarden-environment = { @@ -73,7 +72,7 @@ in WEB_VAULT_ENABLED = true; - DOMAIN = optionalString (cfg.domain != null) "http://${cfg.domain}"; + DOMAIN = lib.optionalString (cfg.domain != null) "http://${cfg.domain}"; SIGNUPS_ALLOWED = false; INVITATIONS_ALLOWED = false; @@ -127,14 +126,14 @@ in }; environment.etc = { - "fail2ban/filter.d/vaultwarden.conf".text = generators.toINI { } { + "fail2ban/filter.d/vaultwarden.conf".text = lib.generators.toINI { } { Definition = { failregex = "^.*Username or password is incorrect\. Try again\. IP: <ADDR>\. Username:.*$"; ignoreregex = ""; journalmatch = "_SYSTEMD_UNIT=vaultwarden.service"; }; }; - "fail2ban/filter.d/vaultwarden-admin.conf".text = generators.toINI { } { + "fail2ban/filter.d/vaultwarden-admin.conf".text = lib.generators.toINI { } { Definition = { failregex = "^.*Invalid admin token\. IP: <ADDR>.*$"; ignoreregex = ""; @@ -143,9 +142,9 @@ in }; }; - topology = with cfg; { + topology = { nodes.${this.hostname}.services.vaultwarden = { - info = mkForce domain; + info = lib.mkForce cfg.domain; }; }; }; diff --git a/modules/wayland.nix b/modules/wayland.nix index 7a9820d..1ad4fe3 100644 --- a/modules/wayland.nix +++ b/modules/wayland.nix @@ -15,9 +15,19 @@ in nixfiles.modules.foot.enable = true; hm.home = { - packages = with pkgs; [ wl-clipboard ]; + packages = with pkgs; [ + grim + slurp + wl-clipboard + wlr-randr + ]; - sessionVariables.NIXOS_OZONE_WL = 1; + sessionVariables = { + NIXOS_OZONE_WL = 1; + QT_QPA_PLATFORM = "wayland"; + SDL_VIDEODRIVER = "wayland"; + XDG_SESSION_TYPE = "wayland"; + }; }; }; } diff --git a/overlays.nix b/overlays.nix index 18fe174..da6161a 100644 --- a/overlays.nix +++ b/overlays.nix @@ -6,7 +6,7 @@ { default = final: prev: - lib.infuse.v1.infuse prev { + lib.infuse prev { bruh = _: prev.callPackage ./packages/bruh.nix { }; emacsql-sqlite = _: prev.callPackage ./packages/emacsql-sqlite.nix { }; @@ -63,27 +63,27 @@ openssl_1_0_0 = _: prev.callPackage ./packages/openssl_1_0_0.nix { }; - telegram-desktop = { - __input.stdenv = stdenv: final.useMoldLinker stdenv; - __output.patches.__append = - let - patches = "https://raw.githubusercontent.com/msva/mva-overlay/4c89938831bcce03fae22081809e53a47bdee31b/net-im/telegram-desktop/files/patches/0/conditional"; - in - [ - (prev.fetchpatch { - url = "${patches}/tdesktop_patches_hide-sponsored-messages/0000-data_data_sponsored_messages.cpp.patch"; - hash = "sha256-vVucKG0YNY41MVdqibhKfxL/2/nNPPtYw+otwat971U="; - }) - (prev.fetchpatch { - url = "${patches}/tdesktop_patches_allow-disable-stories/option-to-disable-stories.patch"; - hash = "sha256-ctL9wIn3cLtqgCcQFNnx7WQuBw+9IjDlMJUicmVt8no="; - }) - (prev.fetchpatch { - url = "${patches}/tdesktop_patches_hide-banned/0000_hide-messages-from-blocked-users.patch"; - hash = "sha256-61U3wQsUdLvB4ymHPjVecw9WvhW8W/V0Jf1cnvYUkHk="; - }) - ]; - }; + # telegram-desktop = { + # __input.stdenv = stdenv: final.useMoldLinker stdenv; + # __output.patches.__append = + # let + # patches = "https://raw.githubusercontent.com/msva/mva-overlay/4c89938831bcce03fae22081809e53a47bdee31b/net-im/telegram-desktop/files/patches/0/conditional"; + # in + # [ + # (prev.fetchpatch { + # url = "${patches}/tdesktop_patches_hide-sponsored-messages/0000-data_data_sponsored_messages.cpp.patch"; + # hash = "sha256-vVucKG0YNY41MVdqibhKfxL/2/nNPPtYw+otwat971U="; + # }) + # (prev.fetchpatch { + # url = "${patches}/tdesktop_patches_allow-disable-stories/option-to-disable-stories.patch"; + # hash = "sha256-ctL9wIn3cLtqgCcQFNnx7WQuBw+9IjDlMJUicmVt8no="; + # }) + # (prev.fetchpatch { + # url = "${patches}/tdesktop_patches_hide-banned/0000_hide-messages-from-blocked-users.patch"; + # hash = "sha256-61U3wQsUdLvB4ymHPjVecw9WvhW8W/V0Jf1cnvYUkHk="; + # }) + # ]; + # }; vesktop = { __input = { |