summaryrefslogtreecommitdiff
path: root/hosts/demiurge/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'hosts/demiurge/default.nix')
-rw-r--r--hosts/demiurge/default.nix290
1 files changed, 185 insertions, 105 deletions
diff --git a/hosts/demiurge/default.nix b/hosts/demiurge/default.nix
index 32696c3..50839ae 100644
--- a/hosts/demiurge/default.nix
+++ b/hosts/demiurge/default.nix
@@ -1,28 +1,36 @@
1{ config, home-manager, lib, pkgs, inputs, llama-cpp, ... }: 1{
2 config,
3 home-manager,
4 lib,
5 pkgs,
6 inputs,
7 llama-cpp,
8 ...
9}:
2 10
3{ 11{
4 imports = 12 imports = [
5 [ 13 ./hardware.nix
6 ./hardware.nix 14 home-manager.nixosModules.default
7 home-manager.nixosModules.default 15 ];
8 ];
9 16
10 # nixpkgs stuff 17 # nixpkgs stuff
11 nixpkgs = { 18 nixpkgs = {
12 config = { 19 config = {
13 # selectively allow unfree packages 20 # selectively allow unfree packages
14 allowUnfreePredicate = pkg: 21 allowUnfreePredicate =
22 pkg:
15 builtins.elem (lib.getName pkg) [ 23 builtins.elem (lib.getName pkg) [
16/* 24 /*
17 "cuda_cccl" 25 "cuda_cccl"
18 "cuda_cudart" 26 "cuda_cudart"
19 "cuda_nvcc" 27 "cuda_nvcc"
20 "cudnn" 28 "cudnn"
21 "libcublas" 29 "libcublas"
22 "libcufile" 30 "libcufile"
23 "quartus-prime-lite" 31 "quartus-prime-lite"
24 "quartus-prime-lite-unwrapped" 32 "quartus-prime-lite-unwrapped"
25*/ 33 */
26 "steam" 34 "steam"
27 "steam-unwrapped" 35 "steam-unwrapped"
28 ]; 36 ];
@@ -40,11 +48,13 @@
40 (self: super: { 48 (self: super: {
41 invidious = super.invidious.overrideAttrs (old: { 49 invidious = super.invidious.overrideAttrs (old: {
42 # try removing shorts by ignoring any videos shorter than 65 seconds 50 # try removing shorts by ignoring any videos shorter than 65 seconds
43 postPatch = old.postPatch + '' 51 postPatch =
44 sed -i '/GROUP BY channel/a\ AND length_seconds > 65' src/invidious/database/channels.cr 52 old.postPatch
45 sed -i 's/\({view_name}\) \(ORDER BY published\)/\1 WHERE length_seconds > 65 \2/' src/invidious/users.cr 53 + ''
46 sed -i 's/\({values})\) \(ORDER BY published\)/\1 AND length_seconds > 65 \2/' src/invidious/users.cr 54 sed -i '/GROUP BY channel/a\ AND length_seconds > 65' src/invidious/database/channels.cr
47 ''; 55 sed -i 's/\({view_name}\) \(ORDER BY published\)/\1 WHERE length_seconds > 65 \2/' src/invidious/users.cr
56 sed -i 's/\({values})\) \(ORDER BY published\)/\1 AND length_seconds > 65 \2/' src/invidious/users.cr
57 '';
48 }); 58 });
49 }) 59 })
50 (self: super: { 60 (self: super: {
@@ -61,11 +71,21 @@
61 }) 71 })
62 (self: super: { 72 (self: super: {
63 alvr = super.alvr.overrideAttrs (old: { 73 alvr = super.alvr.overrideAttrs (old: {
64 buildInputs = old.buildInputs ++ [ super.android-tools super.usbutils ]; 74 buildInputs = old.buildInputs ++ [
75 super.android-tools
76 super.usbutils
77 ];
65 nativeBuildInputs = old.nativeBuildInputs ++ [ super.makeWrapper ]; 78 nativeBuildInputs = old.nativeBuildInputs ++ [ super.makeWrapper ];
66 postInstall = (old.postInstall or "") + '' 79 postInstall =
67 wrapProgram $out/bin/alvr_dashboard --prefix PATH : "${super.lib.makeBinPath [ super.android-tools super.usbutils ]}" 80 (old.postInstall or "")
68 ''; 81 + ''
82 wrapProgram $out/bin/alvr_dashboard --prefix PATH : "${
83 super.lib.makeBinPath [
84 super.android-tools
85 super.usbutils
86 ]
87 }"
88 '';
69 }); 89 });
70 }) 90 })
71 ]; 91 ];
@@ -94,7 +114,10 @@
94 efi.canTouchEfiVariables = true; 114 efi.canTouchEfiVariables = true;
95 }; 115 };
96 116
97 zfs.extraPools = [ "data_wd" "nvme_warm" ]; 117 zfs.extraPools = [
118 "data_wd"
119 "nvme_warm"
120 ];
98 }; 121 };
99 122
100 # disable wifi and open some ports 123 # disable wifi and open some ports
@@ -105,7 +128,11 @@
105 wireless.enable = false; 128 wireless.enable = false;
106 129
107 firewall = { 130 firewall = {
108 allowedTCPPorts = [ 22 80 443 ]; 131 allowedTCPPorts = [
132 22
133 80
134 443
135 ];
109 allowedUDPPorts = [ 51413 ]; 136 allowedUDPPorts = [ 51413 ];
110 }; 137 };
111 138
@@ -127,11 +154,16 @@
127 ip route del 100.100.100.100/32 dev tailscale0 154 ip route del 100.100.100.100/32 dev tailscale0
128 ''; 155 '';
129 156
130 peers = [{ 157 peers = [
131 allowedIPs = [ "0.0.0.0/0" "::0/0" ]; 158 {
132 endpoint = "45.134.142.206:51820"; 159 allowedIPs = [
133 publicKey = "H5t7PsMDnUAHrR8D2Jt3Mh6N6w43WmCzrOHShlEU+zw="; 160 "0.0.0.0/0"
134 }]; 161 "::0/0"
162 ];
163 endpoint = "45.134.142.206:51820";
164 publicKey = "H5t7PsMDnUAHrR8D2Jt3Mh6N6w43WmCzrOHShlEU+zw=";
165 }
166 ];
135 }; 167 };
136 }; 168 };
137 169
@@ -145,7 +177,10 @@
145 }; 177 };
146 178
147 # enable flakes and nix cli 179 # enable flakes and nix cli
148 nix.settings.experimental-features = [ "nix-command" "flakes" ]; 180 nix.settings.experimental-features = [
181 "nix-command"
182 "flakes"
183 ];
149 184
150 # Define a user account. 185 # Define a user account.
151 users.users = { 186 users.users = {
@@ -229,36 +264,38 @@
229 # I prefer doas over sudo for simplicity 264 # I prefer doas over sudo for simplicity
230 doas = { 265 doas = {
231 enable = true; 266 enable = true;
232 extraRules = [{ 267 extraRules = [
233 users = ["vin"]; 268 {
234 keepEnv = true; 269 users = [ "vin" ];
235 persist = true; 270 keepEnv = true;
236 }]; 271 persist = true;
272 }
273 ];
237 }; 274 };
238 275
239 pki.certificates = [ 276 pki.certificates = [
240 '' 277 ''
241-----BEGIN CERTIFICATE----- 278 -----BEGIN CERTIFICATE-----
242MIIDMDCCAhigAwIBAgIUcSUafnojcFKod3f436VELfEKoFkwDQYJKoZIhvcNAQEL 279 MIIDMDC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KDTT1+dZnRNcg72bFpIdqHsDrIg/IBjZ0
2593eGfkQ== 296 3eGfkQ==
260-----END CERTIFICATE----- 297 -----END CERTIFICATE-----
261'' 298 ''
262 ]; 299 ];
263 300
264 sudo.enable = false; 301 sudo.enable = false;
@@ -343,7 +380,11 @@ FQsOJMjIvhTm2IiOS8xIaZz7EJORxFjtOkLEIGGZBNK6QcnD714/nYbHSrQx4eNM
343 default_user_preferences = { 380 default_user_preferences = {
344 captions = [ "English" ]; 381 captions = [ "English" ];
345 dark_mode = "dark"; 382 dark_mode = "dark";
346 feed_menu = [ "Popular" "Subscriptions" "Playlists" ]; 383 feed_menu = [
384 "Popular"
385 "Subscriptions"
386 "Playlists"
387 ];
347 max_results = 100; 388 max_results = 100;
348 quality = "dash"; 389 quality = "dash";
349 save_player_pos = true; 390 save_player_pos = true;
@@ -420,9 +461,9 @@ FQsOJMjIvhTm2IiOS8xIaZz7EJORxFjtOkLEIGGZBNK6QcnD714/nYbHSrQx4eNM
420 }; 461 };
421 462
422 "sdui.demiurge.epistemia" = { 463 "sdui.demiurge.epistemia" = {
423# addSSL = true; 464 # addSSL = true;
424# sslCertificate = "/var/demiurge.epistemia.crt"; 465 # sslCertificate = "/var/demiurge.epistemia.crt";
425# sslCertificateKey = "/var/demiurge.epistemia.key"; 466 # sslCertificateKey = "/var/demiurge.epistemia.key";
426 locations."/" = { 467 locations."/" = {
427 proxyPass = "http://127.0.0.1:7860"; 468 proxyPass = "http://127.0.0.1:7860";
428 proxyWebsockets = true; 469 proxyWebsockets = true;
@@ -623,7 +664,10 @@ FQsOJMjIvhTm2IiOS8xIaZz7EJORxFjtOkLEIGGZBNK6QcnD714/nYbHSrQx4eNM
623 name = "free software directory"; 664 name = "free software directory";
624 engine = "mediawiki"; 665 engine = "mediawiki";
625 shortcut = "fsd"; 666 shortcut = "fsd";
626 categories = ["it" "software wikis"]; 667 categories = [
668 "it"
669 "software wikis"
670 ];
627 base_url = "https://directory.fsf.org/"; 671 base_url = "https://directory.fsf.org/";
628 search_type = "title"; 672 search_type = "title";
629 timeout = 5.0; 673 timeout = 5.0;
@@ -637,7 +681,10 @@ FQsOJMjIvhTm2IiOS8xIaZz7EJORxFjtOkLEIGGZBNK6QcnD714/nYbHSrQx4eNM
637 name = "gentoo"; 681 name = "gentoo";
638 engine = "mediawiki"; 682 engine = "mediawiki";
639 shortcut = "ge"; 683 shortcut = "ge";
640 categories = ["it" "software wikis"]; 684 categories = [
685 "it"
686 "software wikis"
687 ];
641 base_url = "https://wiki.gentoo.org/"; 688 base_url = "https://wiki.gentoo.org/";
642 api_path = "api.php"; 689 api_path = "api.php";
643 search_type = "text"; 690 search_type = "text";
@@ -744,7 +791,10 @@ FQsOJMjIvhTm2IiOS8xIaZz7EJORxFjtOkLEIGGZBNK6QcnD714/nYbHSrQx4eNM
744 engine = "stackexchange"; 791 engine = "stackexchange";
745 shortcut = "st"; 792 shortcut = "st";
746 api_site = "stackoverflow"; 793 api_site = "stackoverflow";
747 categories = ["it" "q&a"]; 794 categories = [
795 "it"
796 "q&a"
797 ];
748 } 798 }
749 799
750 { 800 {
@@ -752,7 +802,10 @@ FQsOJMjIvhTm2IiOS8xIaZz7EJORxFjtOkLEIGGZBNK6QcnD714/nYbHSrQx4eNM
752 engine = "stackexchange"; 802 engine = "stackexchange";
753 shortcut = "ubuntu"; 803 shortcut = "ubuntu";
754 api_site = "askubuntu"; 804 api_site = "askubuntu";
755 categories = ["it" "q&a"]; 805 categories = [
806 "it"
807 "q&a"
808 ];
756 } 809 }
757 810
758 { 811 {
@@ -760,15 +813,21 @@ FQsOJMjIvhTm2IiOS8xIaZz7EJORxFjtOkLEIGGZBNK6QcnD714/nYbHSrQx4eNM
760 engine = "stackexchange"; 813 engine = "stackexchange";
761 shortcut = "su"; 814 shortcut = "su";
762 api_site = "superuser"; 815 api_site = "superuser";
763 categories = ["it" "q&a"]; 816 categories = [
817 "it"
818 "q&a"
819 ];
764 } 820 }
765 821
766 { 822 {
767 name = "nixos.discourse"; 823 name = "nixos.discourse";
768 engine = "discourse"; 824 engine = "discourse";
769 shortcut = "dnos"; 825 shortcut = "dnos";
770 base_url = "https://discourse.nixos.org"; 826 base_url = "https://discourse.nixos.org";
771 categories = ["it" "q&a"]; 827 categories = [
828 "it"
829 "q&a"
830 ];
772 } 831 }
773 832
774 { 833 {
@@ -786,7 +845,10 @@ FQsOJMjIvhTm2IiOS8xIaZz7EJORxFjtOkLEIGGZBNK6QcnD714/nYbHSrQx4eNM
786 url_query = "URL"; 845 url_query = "URL";
787 title_query = "Title"; 846 title_query = "Title";
788 content_query = "Snippet"; 847 content_query = "Snippet";
789 categories = ["general" "web"]; 848 categories = [
849 "general"
850 "web"
851 ];
790 shortcut = "wib"; 852 shortcut = "wib";
791 about.website = "https://wiby.me/"; 853 about.website = "https://wiby.me/";
792 } 854 }
@@ -796,7 +858,10 @@ FQsOJMjIvhTm2IiOS8xIaZz7EJORxFjtOkLEIGGZBNK6QcnD714/nYbHSrQx4eNM
796 engine = "mediawiki"; 858 engine = "mediawiki";
797 weight = 0.5; 859 weight = 0.5;
798 shortcut = "wb"; 860 shortcut = "wb";
799 categories = ["general" "wikimedia"]; 861 categories = [
862 "general"
863 "wikimedia"
864 ];
800 base_url = "https://{language}.wikibooks.org/"; 865 base_url = "https://{language}.wikibooks.org/";
801 search_type = "text"; 866 search_type = "text";
802 about = { 867 about = {
@@ -809,7 +874,10 @@ FQsOJMjIvhTm2IiOS8xIaZz7EJORxFjtOkLEIGGZBNK6QcnD714/nYbHSrQx4eNM
809 name = "wiktionary"; 874 name = "wiktionary";
810 engine = "mediawiki"; 875 engine = "mediawiki";
811 shortcut = "wt"; 876 shortcut = "wt";
812 categories = ["dictionaries" "wikimedia"]; 877 categories = [
878 "dictionaries"
879 "wikimedia"
880 ];
813 base_url = "https://{language}.wiktionary.org/"; 881 base_url = "https://{language}.wiktionary.org/";
814 search_type = "text"; 882 search_type = "text";
815 about = { 883 about = {
@@ -823,7 +891,10 @@ FQsOJMjIvhTm2IiOS8xIaZz7EJORxFjtOkLEIGGZBNK6QcnD714/nYbHSrQx4eNM
823 engine = "mediawiki"; 891 engine = "mediawiki";
824 weight = 0.5; 892 weight = 0.5;
825 shortcut = "wv"; 893 shortcut = "wv";
826 categories = ["general" "wikimedia"]; 894 categories = [
895 "general"
896 "wikimedia"
897 ];
827 base_url = "https://{language}.wikiversity.org/"; 898 base_url = "https://{language}.wikiversity.org/";
828 search_type = "text"; 899 search_type = "text";
829 about = { 900 about = {
@@ -849,7 +920,10 @@ FQsOJMjIvhTm2IiOS8xIaZz7EJORxFjtOkLEIGGZBNK6QcnD714/nYbHSrQx4eNM
849 shortcut = "br"; 920 shortcut = "br";
850 time_range_support = true; 921 time_range_support = true;
851 paging = true; 922 paging = true;
852 categories = ["general" "web"]; 923 categories = [
924 "general"
925 "web"
926 ];
853 brave_category = "search"; 927 brave_category = "search";
854 } 928 }
855 929
@@ -858,7 +932,10 @@ FQsOJMjIvhTm2IiOS8xIaZz7EJORxFjtOkLEIGGZBNK6QcnD714/nYbHSrQx4eNM
858 engine = "brave"; 932 engine = "brave";
859 network = "brave"; 933 network = "brave";
860 shortcut = "brimg"; 934 shortcut = "brimg";
861 categories = ["images" "web"]; 935 categories = [
936 "images"
937 "web"
938 ];
862 brave_category = "images"; 939 brave_category = "images";
863 } 940 }
864 941
@@ -873,7 +950,10 @@ FQsOJMjIvhTm2IiOS8xIaZz7EJORxFjtOkLEIGGZBNK6QcnD714/nYbHSrQx4eNM
873 title_xpath = "./h4/a[2]"; 950 title_xpath = "./h4/a[2]";
874 content_xpath = "./p"; 951 content_xpath = "./p";
875 first_page_num = 1; 952 first_page_num = 1;
876 categories = ["it" "repos"]; 953 categories = [
954 "it"
955 "repos"
956 ];
877 about = { 957 about = {
878 website = "https://sr.ht"; 958 website = "https://sr.ht";
879 wikidata_id = "Q78514485"; 959 wikidata_id = "Q78514485";
@@ -914,12 +994,12 @@ FQsOJMjIvhTm2IiOS8xIaZz7EJORxFjtOkLEIGGZBNK6QcnD714/nYbHSrQx4eNM
914 udev = { 994 udev = {
915 enable = true; 995 enable = true;
916 extraRules = '' 996 extraRules = ''
917 # ST-Link v2.1 997 # ST-Link v2.1
918 SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", MODE:="0666" 998 SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", MODE:="0666"
919 999
920 # Oculus Quest 2 1000 # Oculus Quest 2
921 SUBSYSTEM=="usb", ATTR{idVendor}=="2833", ATTR{idProduct}=="0186", MODE="0660", 1001 SUBSYSTEM=="usb", ATTR{idVendor}=="2833", ATTR{idProduct}=="0186", MODE="0660",
922 GROUP="input", SYMLINK+="ocuquest%n" 1002 GROUP="input", SYMLINK+="ocuquest%n"
923 ''; 1003 '';
924 }; 1004 };
925 1005
@@ -928,9 +1008,9 @@ FQsOJMjIvhTm2IiOS8xIaZz7EJORxFjtOkLEIGGZBNK6QcnD714/nYbHSrQx4eNM
928 xserver = { 1008 xserver = {
929 enable = true; 1009 enable = true;
930 autorun = false; 1010 autorun = false;
931 displayManager.startx.enable = true; 1011 displayManager.startx.enable = true;
932 modules = [ pkgs.xf86_input_wacom ]; 1012 modules = [ pkgs.xf86_input_wacom ];
933 videoDrivers = [ "amdgpu" ]; 1013 videoDrivers = [ "amdgpu" ];
934 wacom.enable = true; 1014 wacom.enable = true;
935 }; 1015 };
936 }; 1016 };
@@ -940,26 +1020,26 @@ FQsOJMjIvhTm2IiOS8xIaZz7EJORxFjtOkLEIGGZBNK6QcnD714/nYbHSrQx4eNM
940 services = { 1020 services = {
941 invidious_token = { 1021 invidious_token = {
942 script = '' 1022 script = ''
943set -euo pipefail 1023 set -euo pipefail
944 1024
945a="$(${pkgs.podman}/bin/podman run quay.io/invidious/youtube-trusted-session-generator | sed -n 4,5p)" 1025 a="$(${pkgs.podman}/bin/podman run quay.io/invidious/youtube-trusted-session-generator | sed -n 4,5p)"
946visitor_data=$(echo "$a" | sed -n 1p | cut -d' ' -f2) 1026 visitor_data=$(echo "$a" | sed -n 1p | cut -d' ' -f2)
947po_token=$(echo "$a" | sed -n 2p | cut -d' ' -f2) 1027 po_token=$(echo "$a" | sed -n 2p | cut -d' ' -f2)
948day=$(date +%e | tr -d ' ') 1028 day=$(date +%e | tr -d ' ')
949 1029
950printf '{"visitor_data": "%s",\n"po_token": "%s",\n' \ 1030 printf '{"visitor_data": "%s",\n"po_token": "%s",\n' \
951 "$visitor_data" "$po_token" \ 1031 "$visitor_data" "$po_token" \
952 >/run/invidious_settings 1032 >/run/invidious_settings
953 1033
954if [ $((day % 2)) -eq 0 ]; then 1034 if [ $((day % 2)) -eq 0 ]; then
955 printf '"force_resolve": "ipv6"}\n' >>/run/invidious_settings 1035 printf '"force_resolve": "ipv6"}\n' >>/run/invidious_settings
956else 1036 else
957 printf '"force_resolve": "ipv4"}\n' >>/run/invidious_settings 1037 printf '"force_resolve": "ipv4"}\n' >>/run/invidious_settings
958fi 1038 fi
959 1039
960${pkgs.systemd}/bin/systemctl restart invidious-sig-helper 1040 ${pkgs.systemd}/bin/systemctl restart invidious-sig-helper
961${pkgs.systemd}/bin/systemctl restart invidious 1041 ${pkgs.systemd}/bin/systemctl restart invidious
962 ''; 1042 '';
963 serviceConfig = { 1043 serviceConfig = {
964 Type = "oneshot"; 1044 Type = "oneshot";
965 User = "root"; 1045 User = "root";