From e053ec86d6644b16bb6ff707ac633dae766f8b8a Mon Sep 17 00:00:00 2001 From: Rory& Date: Thu, 26 Jun 2025 06:56:31 +0200 Subject: Update desktop config, split up files --- flake.lock | 101 +++++++++------------ flake.nix | 16 ++++ host/Arc/configuration.nix | 2 +- host/Rory-desktop/configuration.nix | 75 ++++++--------- host/Rory-desktop/edu/mongodb.nix | 20 ---- host/Rory-desktop/mariadb.nix | 14 --- host/Rory-desktop/nginx.nix | 43 --------- host/Rory-desktop/nginx/discord.localhost.nix | 36 -------- host/Rory-desktop/nginx/hse.localhost.nix | 75 --------------- .../nginx/matrix.opensuse.localhost.nix | 75 --------------- host/Rory-desktop/nginx/synapse.localhost.nix | 70 -------------- host/Rory-desktop/ollama.nix | 44 --------- host/Rory-desktop/optional/gui/hyprland.nix | 26 ++++++ host/Rory-desktop/optional/gui/i3.nix | 36 ++++++++ host/Rory-desktop/optional/gui/sway.nix | 39 ++++++++ host/Rory-desktop/optional/gui/wayland.nix | 55 ----------- host/Rory-desktop/optional/gui/x11.nix | 36 -------- host/Rory-desktop/postgres.nix | 45 --------- host/Rory-desktop/printing.nix | 54 ----------- host/Rory-desktop/services/edu/mongodb.nix | 20 ++++ host/Rory-desktop/services/libvirt.nix | 8 ++ host/Rory-desktop/services/mariadb.nix | 14 +++ host/Rory-desktop/services/nginx.nix | 43 +++++++++ .../services/nginx/discord.localhost.nix | 36 ++++++++ host/Rory-desktop/services/nginx/hse.localhost.nix | 75 +++++++++++++++ .../services/nginx/matrix.opensuse.localhost.nix | 75 +++++++++++++++ .../services/nginx/synapse.localhost.nix | 70 ++++++++++++++ host/Rory-desktop/services/ollama.nix | 44 +++++++++ host/Rory-desktop/services/postgres.nix | 45 +++++++++ host/Rory-desktop/services/printing.nix | 54 +++++++++++ host/Rory-desktop/services/rabbitmq.nix | 6 ++ host/Rory-desktop/services/steam.nix | 11 +++ host/Rory-desktop/services/waydroid.nix | 4 + host/Rory-laptop/configuration.nix | 15 ++- modules/base.nix | 10 +- modules/software-templates/dotnet.client.nix | 3 +- packages/overlays/jetbrains-plugins.nix | 75 +++++++++++++++ 37 files changed, 788 insertions(+), 682 deletions(-) delete mode 100644 host/Rory-desktop/edu/mongodb.nix delete mode 100644 host/Rory-desktop/mariadb.nix delete mode 100644 host/Rory-desktop/nginx.nix delete mode 100755 host/Rory-desktop/nginx/discord.localhost.nix delete mode 100755 host/Rory-desktop/nginx/hse.localhost.nix delete mode 100644 host/Rory-desktop/nginx/matrix.opensuse.localhost.nix delete mode 100755 host/Rory-desktop/nginx/synapse.localhost.nix delete mode 100755 host/Rory-desktop/ollama.nix create mode 100644 host/Rory-desktop/optional/gui/hyprland.nix create mode 100644 host/Rory-desktop/optional/gui/i3.nix create mode 100644 host/Rory-desktop/optional/gui/sway.nix delete mode 100644 host/Rory-desktop/optional/gui/wayland.nix delete mode 100644 host/Rory-desktop/optional/gui/x11.nix delete mode 100755 host/Rory-desktop/postgres.nix delete mode 100644 host/Rory-desktop/printing.nix create mode 100644 host/Rory-desktop/services/edu/mongodb.nix create mode 100644 host/Rory-desktop/services/libvirt.nix create mode 100644 host/Rory-desktop/services/mariadb.nix create mode 100644 host/Rory-desktop/services/nginx.nix create mode 100755 host/Rory-desktop/services/nginx/discord.localhost.nix create mode 100755 host/Rory-desktop/services/nginx/hse.localhost.nix create mode 100644 host/Rory-desktop/services/nginx/matrix.opensuse.localhost.nix create mode 100755 host/Rory-desktop/services/nginx/synapse.localhost.nix create mode 100755 host/Rory-desktop/services/ollama.nix create mode 100755 host/Rory-desktop/services/postgres.nix create mode 100644 host/Rory-desktop/services/printing.nix create mode 100644 host/Rory-desktop/services/rabbitmq.nix create mode 100644 host/Rory-desktop/services/steam.nix create mode 100644 host/Rory-desktop/services/waydroid.nix create mode 100644 packages/overlays/jetbrains-plugins.nix diff --git a/flake.lock b/flake.lock index f002bfa..0533555 100644 --- a/flake.lock +++ b/flake.lock @@ -132,11 +132,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1749299814, - "narHash": "sha256-JUn5z2+E5e8gOQxY8mryAtZ5aJX9kDh7G9rSEaJAVQM=", + "lastModified": 1750688623, + "narHash": "sha256-GuFMTK2ovfmNT8LM58EupnI5zuK7ldjD9+ta87Ow/Ig=", "owner": "famedly", "repo": "conduit", - "rev": "263bc61ec8dfdd25fa0200462de9d2556be899a7", + "rev": "5c8b030c1e7ec66b1d72b219e62505dd758be2e3", "type": "gitlab" }, "original": { @@ -225,11 +225,11 @@ "draupnirSrc": { "flake": false, "locked": { - "lastModified": 1749465799, - "narHash": "sha256-EWKR0AXrVGDfuGWvTUqpVfzMERZH8+/jw5roT0BwZwg=", + "lastModified": 1750769344, + "narHash": "sha256-1jlqkaJpeOoKty6ONsxdRlAf7A15rcR8q3w/FbMuMpo=", "owner": "the-draupnir-project", "repo": "Draupnir", - "rev": "f46ff4dddd3f9df2d95d69158100c41ec91870e8", + "rev": "5565ef3bc75dc857cda3fd67d2ce45cdceb88263", "type": "github" }, "original": { @@ -569,11 +569,11 @@ "nixpkgs": "nixpkgs_6" }, "locked": { - "lastModified": 1749657191, - "narHash": "sha256-QLilaHuhGxiwhgceDWESj9gFcKIdEp7+9lRqNGpN8S4=", + "lastModified": 1750798083, + "narHash": "sha256-DTCCcp6WCFaYXWKFRA6fiI2zlvOLCf5Vwx8+/0R8Wc4=", "owner": "nix-community", "repo": "home-manager", - "rev": "faeab32528a9360e9577ff4082de2d35c6bbe1ce", + "rev": "ff31a4677c1a8ae506aa7e003a3dba08cb203f82", "type": "github" }, "original": { @@ -904,11 +904,11 @@ "matrixSpecSrc": { "flake": false, "locked": { - "lastModified": 1749631217, - "narHash": "sha256-brTS3ep8hd2ENJc1Gvm3/nIpojumbrvdJeKps+map0o=", + "lastModified": 1750783562, + "narHash": "sha256-xcXuUp4dnZmQjOD1/wBTC6hjQow5MycyDXweH+0aqy8=", "owner": "matrix-org", "repo": "matrix-spec", - "rev": "a2a9a02efa4cc841c2031c6ba789828619bbfae5", + "rev": "0e05e45d846735289c74f595922e59568f80e429", "type": "github" }, "original": { @@ -938,11 +938,11 @@ "nhekoSrc": { "flake": false, "locked": { - "lastModified": 1749161315, - "narHash": "sha256-0KLNpnSHsW1etrRHLJ1YTjbvpKkrytZQwqc1/QG9C2w=", + "lastModified": 1750508442, + "narHash": "sha256-L4HIY2SeknZ0hHpT9ySKKazj5ExXWSNItqE7t+PZnUo=", "owner": "Nheko-reborn", "repo": "nheko", - "rev": "b8107d4a013369262725f338f89cc79f04729b69", + "rev": "72dcd874203c6044f48217e7b33ebc4410e652dd", "type": "github" }, "original": { @@ -1045,11 +1045,11 @@ }, "nixpkgs-DraupnirPkg": { "locked": { - "lastModified": 1749723933, - "narHash": "sha256-zZTbEEY4zGsdMsThFmD5m9n+ZEi6pcI+Fato2R2Fau8=", + "lastModified": 1750898778, + "narHash": "sha256-DXI7+SKDlTyA+C4zp0LoIywQ+BfdH5m4nkuxbWgV4UU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a05e20c8600ad83cb9caacd5822c4d2ad002dee4", + "rev": "322d8a3c6940039f7cff179a8b09c5d7ca06359d", "type": "github" }, "original": { @@ -1061,11 +1061,11 @@ }, "nixpkgs-RoryNix": { "locked": { - "lastModified": 1749723933, - "narHash": "sha256-zZTbEEY4zGsdMsThFmD5m9n+ZEi6pcI+Fato2R2Fau8=", + "lastModified": 1750898778, + "narHash": "sha256-DXI7+SKDlTyA+C4zp0LoIywQ+BfdH5m4nkuxbWgV4UU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a05e20c8600ad83cb9caacd5822c4d2ad002dee4", + "rev": "322d8a3c6940039f7cff179a8b09c5d7ca06359d", "type": "github" }, "original": { @@ -1077,11 +1077,11 @@ }, "nixpkgs-master": { "locked": { - "lastModified": 1749723933, - "narHash": "sha256-zZTbEEY4zGsdMsThFmD5m9n+ZEi6pcI+Fato2R2Fau8=", + "lastModified": 1750898778, + "narHash": "sha256-DXI7+SKDlTyA+C4zp0LoIywQ+BfdH5m4nkuxbWgV4UU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a05e20c8600ad83cb9caacd5822c4d2ad002dee4", + "rev": "322d8a3c6940039f7cff179a8b09c5d7ca06359d", "type": "github" }, "original": { @@ -1123,22 +1123,6 @@ "type": "github" } }, - "nixpkgs-stable_3": { - "locked": { - "lastModified": 1749488106, - "narHash": "sha256-b9GIWdF/8jKpCC5JIMgDLZgwe8cEbty2fyTyo1eDFfI=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "8fe3e32e7f210522377c3bcff80931a3284ace6a", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-24.11", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs_10": { "locked": { "lastModified": 1744868846, @@ -1221,11 +1205,11 @@ }, "nixpkgs_6": { "locked": { - "lastModified": 1749285348, - "narHash": "sha256-frdhQvPbmDYaScPFiCnfdh3B/Vh81Uuoo0w5TkWmmjU=", + "lastModified": 1750365781, + "narHash": "sha256-XE/lFNhz5lsriMm/yjXkvSZz5DfvKJLUjsS6pP8EC50=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3e3afe5174c561dee0df6f2c2b2236990146329f", + "rev": "08f22084e6085d19bcfb4be30d1ca76ecb96fe54", "type": "github" }, "original": { @@ -1253,11 +1237,11 @@ }, "nixpkgs_8": { "locked": { - "lastModified": 1749285348, - "narHash": "sha256-frdhQvPbmDYaScPFiCnfdh3B/Vh81Uuoo0w5TkWmmjU=", + "lastModified": 1750741721, + "narHash": "sha256-Z0djmTa1YmnGMfE9jEe05oO4zggjDmxOGKwt844bUhE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3e3afe5174c561dee0df6f2c2b2236990146329f", + "rev": "4b1164c3215f018c4442463a27689d973cffd750", "type": "github" }, "original": { @@ -1269,15 +1253,15 @@ }, "nixpkgs_9": { "locked": { - "lastModified": 1734119587, - "narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=", - "owner": "nixos", + "lastModified": 1749285348, + "narHash": "sha256-frdhQvPbmDYaScPFiCnfdh3B/Vh81Uuoo0w5TkWmmjU=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5", + "rev": "3e3afe5174c561dee0df6f2c2b2236990146329f", "type": "github" }, "original": { - "owner": "nixos", + "owner": "NixOS", "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" @@ -1288,11 +1272,11 @@ "nixpkgs": "nixpkgs_9" }, "locked": { - "lastModified": 1737779835, - "narHash": "sha256-iZ/kQ/XFqIx053AuSHhCwu3HA8627ognYiJl/LRNpD0=", + "lastModified": 1750514805, + "narHash": "sha256-BcHbwm7cVfxb0ocicnn21PNE7ijyLlUZk1utzrR06Ys=", "ref": "refs/heads/master", - "rev": "11cc65efa2909bdc7e3e978bf1f56f6d141bf82a", - "revCount": 11, + "rev": "1bf1950bdea07f72b699ac105800f5bb437a70fd", + "revCount": 15, "type": "git", "url": "https://cgit.rory.gay/nix/OOYE-module.git" }, @@ -1360,7 +1344,6 @@ "nixpkgs-DraupnirPkg": "nixpkgs-DraupnirPkg", "nixpkgs-RoryNix": "nixpkgs-RoryNix", "nixpkgs-master": "nixpkgs-master", - "nixpkgs-stable": "nixpkgs-stable_3", "ooye": "ooye", "safeNSound": "safeNSound", "sops-nix": "sops-nix", @@ -1429,11 +1412,11 @@ "nixpkgs": "nixpkgs_10" }, "locked": { - "lastModified": 1749592509, - "narHash": "sha256-VunQzfZFA+Y6x3wYi2UE4DEQ8qKoAZZCnZPUlSoqC+A=", + "lastModified": 1750119275, + "narHash": "sha256-Rr7Pooz9zQbhdVxux16h7URa6mA80Pb/G07T4lHvh0M=", "owner": "Mic92", "repo": "sops-nix", - "rev": "50754dfaa0e24e313c626900d44ef431f3210138", + "rev": "77c423a03b9b2b79709ea2cb63336312e78b72e2", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index befed2e..792bec0 100755 --- a/flake.nix +++ b/flake.nix @@ -76,6 +76,7 @@ url = "github:TheArcaneBrony/synapse-http-antispam"; flake = false; }; + nhekoSrc = { url = "github:Nheko-reborn/nheko/master"; flake = false; @@ -229,6 +230,7 @@ modules = [ ./host/Rory-desktop/configuration.nix ./hardware-configuration.nix + ./packages/overlays/jetbrains-plugins.nix home-manager.nixosModules.home-manager lix-module.nixosModules.default sops-nix.nixosModules.sops @@ -241,6 +243,20 @@ }; } ) + #( + # { pkgs, lib, ... }: + # { + # nixpkgs.overlays = [ + # (final: prev: { + # jetbrains = (prev.jetbrains // { + # plugins = (prev.jetbrains.plugins // { + # addPlugins = (pkgs.callPackage "${inputs.nixpkgs-JetbrainsPlugins}/pkgs/applications/editors/jetbrains/plugins/default.nix" { }).addPlugins; + # }); + # }); + # }) + # ]; + # } + #) ]; specialArgs = { inherit home-manager; diff --git a/host/Arc/configuration.nix b/host/Arc/configuration.nix index 9f9b549..b97a8fa 100644 --- a/host/Arc/configuration.nix +++ b/host/Arc/configuration.nix @@ -88,7 +88,7 @@ args@{ desktopManager.plasma6.enable = true; }; - services.xserver.desktopManager.gnome.enable = false; + services.desktopManager.gnome.enable = false; environment.systemPackages = with pkgs; [ eog #mpv diff --git a/host/Rory-desktop/configuration.nix b/host/Rory-desktop/configuration.nix index e16cb7e..d48d10c 100644 --- a/host/Rory-desktop/configuration.nix +++ b/host/Rory-desktop/configuration.nix @@ -16,20 +16,22 @@ args@{ # ../../modules/environments/home.nix ../../modules/software-templates/profilers.nix ../../modules/software-templates/dotnet.client.nix -# ../../modules/hardware/google-stadia-controller.nix + #../../modules/hardware/google-stadia-controller.nix - ./postgres.nix - ./nginx.nix + ./services/nginx.nix + ./services/postgres.nix # hardware-specific imports ./optional/hardware-specific/amd.nix + #./services/edu/mongodb.nix + ./optional/gui/hyprland.nix #./optional/gui/x11.nix - ./optional/gui/wayland.nix - ./edu/mongodb.nix - -# ./printing.nix -# ./ollama.nix + #./services/libvirt.nix + #./services/printing.nix + #./services/rabbitmq.nix + #./services/ollama.nix + #./services/waydroid.nix ]; boot = { @@ -44,17 +46,11 @@ args@{ efiInstallAsRemovable = true; }; }; - #kernelPatches = [ - # { - # # FIXME: https://gitlab.freedesktop.org/drm/amd/-/issues/3437 - # name = "drm-amd-3437-hack"; - # patch = ./hacks/drm-amd-3437.patch; - # } - #]; - - #readOnlyNixStore = false; }; - programs.noisetorch.enable = true; + + # TODO: re-enable when USB is fixed + #programs.noisetorch.enable = true; + programs.gamemode.enable = true; users.users.Rory.extraGroups = [ "gamemode" ]; @@ -117,7 +113,7 @@ args@{ }; }; - services.xserver.desktopManager.gnome.enable = false; + services.desktopManager.gnome.enable = false; environment.systemPackages = with pkgs; [ eog mpv @@ -131,8 +127,16 @@ args@{ # - IDEs #jetbrains-toolbox - (jetbrains.plugins.addPlugins jetbrains.webstorm [ "github-copilot" ]) - (jetbrains.plugins.addPlugins jetbrains.clion [ "github-copilot" "nixidea" "visual-studio-keymap" ]) #"string-manipulation" + (jetbrains.plugins.addPlugins jetbrains.webstorm [ + jetbrains.plugins.github-copilot-fixed + #"github-copilot" + ]) + (jetbrains.plugins.addPlugins jetbrains.clion [ + jetbrains.plugins.github-copilot-fixed + #"github-copilot" + "nixidea" + "visual-studio-keymap" + ]) #"string-manipulation" #jetbrains.rider #jetbrains.clion #github-copilot-intellij-agent @@ -146,14 +150,10 @@ args@{ gimp # - Languages - #dotnet-sdk_8 dotnetCorePackages.sdk_9_0 #games osu-lazer-bin - #steam - #steam-run - #steam-acf # extra packages dmenu @@ -167,7 +167,6 @@ args@{ #wineWowPackages.unstableFull #winetricks #fragments - #peek unrar-wrapper @@ -180,8 +179,8 @@ args@{ #(callPackage ../../packages/mc/server/modpack/curseforge/techopolis-2/5.4.nix { }) #vesktop - discord-development - virt-viewer + #discord-development + # (dwarf-fortress-packages.dwarf-fortress-full.override { enableStoneSense = true; enableFPS = true; theme = dwarf-fortress-packages.themes.spacefox; }) mangohud @@ -199,16 +198,6 @@ args@{ module: ${pkgs.opensc}/lib/opensc-pkcs11.so ''; - programs.steam = { - enable = true; - gamescopeSession.enable = true; - extraCompatPackages = with pkgs; [ - steam-play-none - proton-ge-bin - ]; - }; - virtualisation.waydroid.enable = true; - xdg = { portal = { enable = true; @@ -230,6 +219,7 @@ args@{ #icons.enable = true; #autostart.enable = true; }; + fonts = { packages = with pkgs; [ #(nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) @@ -261,6 +251,7 @@ args@{ ]; }; }; + security = { polkit.enable = true; sudo.wheelNeedsPassword = false; @@ -274,9 +265,6 @@ args@{ #}; # }; - virtualisation.libvirtd.enable = true; - programs.virt-manager.enable = true; - monitoring = { monitorAll = true; localPrometheus = true; @@ -286,6 +274,7 @@ args@{ nginxHost = "monitoring.localhost"; nginxSsl = false; }; + networking.hosts."127.0.0.1" = builtins.attrNames config.services.nginx.virtualHosts; services.gvfs.enable = true; @@ -303,9 +292,5 @@ args@{ networking.interfaces.enp34s0 = lib.mkForce { }; }; - services.rabbitmq = { - enable = true; - }; - system.stateVersion = "22.11"; # DO NOT EDIT! } diff --git a/host/Rory-desktop/edu/mongodb.nix b/host/Rory-desktop/edu/mongodb.nix deleted file mode 100644 index 92ffc6a..0000000 --- a/host/Rory-desktop/edu/mongodb.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: - -{ - services.mongodb = { - enable = true; - package = pkgs.mongodb-ce; - enableAuth = true; - initialRootPasswordFile = "/etc/mongo-pass"; - #bind_ip = "/run/mongodb.sock"; - extraConfig = '' - net.unixDomainSocket.filePermissions: 0777 - ''; - }; - -} diff --git a/host/Rory-desktop/mariadb.nix b/host/Rory-desktop/mariadb.nix deleted file mode 100644 index 758cb3d..0000000 --- a/host/Rory-desktop/mariadb.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: - -{ - services.mysql = { - enable = true; - package = pkgs.mariadb; - }; - -} diff --git a/host/Rory-desktop/nginx.nix b/host/Rory-desktop/nginx.nix deleted file mode 100644 index bd1f364..0000000 --- a/host/Rory-desktop/nginx.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: - -{ - services = { - nginx = { - enable = true; - #package = pkgs.nginxQuic; - recommendedProxySettings = true; - #recommendedTlsSettings = true; - recommendedZstdSettings = true; - # recommendedGzipSettings = true; - recommendedBrotliSettings = true; - recommendedOptimisation = true; - #defaultMimeTypes = ../../../../packages/nginx/mime.types; - appendConfig = '' - worker_processes 16; - ''; - eventsConfig = '' - #use kqueue; - worker_connections 512; - ''; - appendHttpConfig = '' - #sendfile on; - disable_symlinks off; - ''; - additionalModules = with pkgs.nginxModules; [ moreheaders ]; - virtualHosts = { - "discord.localhost" = import ./nginx/discord.localhost.nix { inherit pkgs; }; - "hse.localhost" = import ./nginx/hse.localhost.nix { inherit pkgs; }; - "matrix.opensuse.localhost" = import ./nginx/matrix.opensuse.localhost.nix { inherit pkgs; }; - "synapse.localhost" = import ./nginx/synapse.localhost.nix { inherit pkgs; }; - }; - }; - }; - systemd.services.nginx.serviceConfig = { - LimitNOFILE = 5000000; - }; -} diff --git a/host/Rory-desktop/nginx/discord.localhost.nix b/host/Rory-desktop/nginx/discord.localhost.nix deleted file mode 100755 index b40e13c..0000000 --- a/host/Rory-desktop/nginx/discord.localhost.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ pkgs, ... }: - -{ - root = "/www/discord"; - addSSL = true; - enableACME = false; - - # We don't care about certificates around here... - sslCertificate = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.cert.pem"; - sslCertificateKey = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.key.pem"; - - extraConfig = '' - autoindex on; - more_set_headers 'Access-Control-Allow-Origin: *'; - more_set_headers 'Access-Control-Allow-Methods: GET, POST, OPTIONS'; - more_set_headers 'Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; - more_set_headers 'Access-Control-Expose-Headers: Content-Length,Content-Range'; - more_set_headers 'Access-Control-Allow-Credentials: true'; - ''; - - locations = { - "/" = { - index = "index.html"; - extraConfig = '' - more_set_headers 'Access-Control-Allow-Origin: *'; - more_set_headers 'Access-Control-Allow-Methods: *'; - more_set_headers 'Access-Control-Allow-Headers: *'; - more_set_headers 'Access-Control-Expose-Headers: *'; - more_set_headers 'Access-Control-Max-Age' 1728000; - - # default to /index.html if file not found - try_files $uri $uri/ /index.html; - ''; - }; - }; -} diff --git a/host/Rory-desktop/nginx/hse.localhost.nix b/host/Rory-desktop/nginx/hse.localhost.nix deleted file mode 100755 index 5812b02..0000000 --- a/host/Rory-desktop/nginx/hse.localhost.nix +++ /dev/null @@ -1,75 +0,0 @@ -{pkgs, ...}: -{ - enableACME = false; - addSSL = true; - # We don't care about certificates around here... - sslCertificate = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.cert.pem"; - sslCertificateKey = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.key.pem"; - locations."/" = { - #proxyPass = "http://127.0.0.1:9001"; - proxyPass = "http://localhost:5298"; - extraConfig = '' - if ($request_method = 'OPTIONS') { - more_set_headers 'Access-Control-Allow-Origin: *'; - more_set_headers 'Access-Control-Allow-Methods: *'; - # - # Custom headers and headers various browsers *should* be OK with but aren't - # - more_set_headers 'Access-Control-Allow-Headers: *, Authorization'; - # - # Tell client that this pre-flight info is valid for 20 days - # - more_set_headers 'Access-Control-Max-Age: 1728000'; - more_set_headers 'Content-Type: text/plain; charset=utf-8'; - more_set_headers 'Content-Length: 0'; - return 204; - } - ''; - }; - -# locations."= /.well-known/matrix/server".extraConfig = '' -# more_set_headers 'Content-Type application/json'; -# more_set_headers 'Access-Control-Allow-Origin *'; -# return 200 '${builtins.toJSON { "m.server" = "hse.localhost:5298"; }}'; -# ''; -# locations."= /.well-known/matrix/client".extraConfig = '' -# more_set_headers 'Content-Type application/json'; -# more_set_headers 'Access-Control-Allow-Origin *'; -# return 200 '${ -# builtins.toJSON { -# "m.homeserver".base_url = "http://hse.localhost:5298"; -# "org.matrix.msc3575.proxy".url = "https://matrix.rory.gay"; -# } -# }'; -# ''; - locations."= /.well-known/matrix/support".extraConfig = '' - more_set_headers 'Content-Type application/json'; - more_set_headers 'Access-Control-Allow-Origin *'; - return 200 '${ - builtins.toJSON { - admins = [ - { - matrix_id = "@emma:rory.gay"; - role = "admin"; - } - { - matrix_id = "@alicia:rory.gay"; - role = "admin"; - } - { - matrix_id = "@root:rory.gay"; - role = "admin"; - } - { - matrix_id = "@rory:rory.gay"; - role = "admin"; - } - ]; - } - }'; - ''; - - locations."~ ^/(client/|_matrix/client/unstable/org.matrix.msc3575/sync)" = { - proxyPass = "http://localhost:8100"; - }; -} diff --git a/host/Rory-desktop/nginx/matrix.opensuse.localhost.nix b/host/Rory-desktop/nginx/matrix.opensuse.localhost.nix deleted file mode 100644 index 87287a4..0000000 --- a/host/Rory-desktop/nginx/matrix.opensuse.localhost.nix +++ /dev/null @@ -1,75 +0,0 @@ -{pkgs, ...}: -{ - enableACME = false; - addSSL = true; - # We don't care about certificates around here... - sslCertificate = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.cert.pem"; - sslCertificateKey = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.key.pem"; - locations."/" = { - #proxyPass = "http://127.0.0.1:9001"; - proxyPass = "http://localhost:8008"; - extraConfig = '' - if ($request_method = 'OPTIONS') { - more_set_headers 'Access-Control-Allow-Origin: *'; - more_set_headers 'Access-Control-Allow-Methods: *'; - # - # Custom headers and headers various browsers *should* be OK with but aren't - # - more_set_headers 'Access-Control-Allow-Headers: *, Authorization'; - # - # Tell client that this pre-flight info is valid for 20 days - # - more_set_headers 'Access-Control-Max-Age: 1728000'; - more_set_headers 'Content-Type: text/plain; charset=utf-8'; - more_set_headers 'Content-Length: 0'; - return 204; - } - ''; - }; - -# locations."= /.well-known/matrix/server".extraConfig = '' -# more_set_headers 'Content-Type application/json'; -# more_set_headers 'Access-Control-Allow-Origin *'; -# return 200 '${builtins.toJSON { "m.server" = "hse.localhost:5298"; }}'; -# ''; -# locations."= /.well-known/matrix/client".extraConfig = '' -# more_set_headers 'Content-Type application/json'; -# more_set_headers 'Access-Control-Allow-Origin *'; -# return 200 '${ -# builtins.toJSON { -# "m.homeserver".base_url = "http://hse.localhost:5298"; -# "org.matrix.msc3575.proxy".url = "https://matrix.rory.gay"; -# } -# }'; -# ''; - locations."= /.well-known/matrix/support".extraConfig = '' - more_set_headers 'Content-Type application/json'; - more_set_headers 'Access-Control-Allow-Origin *'; - return 200 '${ - builtins.toJSON { - admins = [ - { - matrix_id = "@emma:rory.gay"; - role = "admin"; - } - { - matrix_id = "@alicia:rory.gay"; - role = "admin"; - } - { - matrix_id = "@root:rory.gay"; - role = "admin"; - } - { - matrix_id = "@rory:rory.gay"; - role = "admin"; - } - ]; - } - }'; - ''; - - locations."~ ^/(client/|_matrix/client/unstable/org.matrix.msc3575/sync)" = { - proxyPass = "http://localhost:8100"; - }; -} diff --git a/host/Rory-desktop/nginx/synapse.localhost.nix b/host/Rory-desktop/nginx/synapse.localhost.nix deleted file mode 100755 index 9f89678..0000000 --- a/host/Rory-desktop/nginx/synapse.localhost.nix +++ /dev/null @@ -1,70 +0,0 @@ -{ pkgs }: -{ - enableACME = false; - addSSL = true; - # We don't care about certificates around here... - sslCertificate = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.cert.pem"; - sslCertificateKey = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.key.pem"; - locations."/" = { - #proxyPass = "http://127.0.0.1:9001"; - proxyPass = "http://localhost:8008"; - extraConfig = '' - if ($request_method = 'OPTIONS') { - more_set_headers 'Access-Control-Allow-Origin: *'; - more_set_headers 'Access-Control-Allow-Methods: *'; - # - # Custom headers and headers various browsers *should* be OK with but aren't - # - more_set_headers 'Access-Control-Allow-Headers: *, Authorization'; - # - # Tell client that this pre-flight info is valid for 20 days - # - more_set_headers 'Access-Control-Max-Age: 1728000'; - more_set_headers 'Content-Type: text/plain; charset=utf-8'; - more_set_headers 'Content-Length: 0'; - return 204; - } - ''; - }; - - locations."= /.well-known/matrix/server".extraConfig = '' - more_set_headers 'Content-Type application/json'; - more_set_headers 'Access-Control-Allow-Origin *'; - return 200 '${builtins.toJSON { "m.server" = "synapse.localhost:443"; }}'; - ''; - locations."= /.well-known/matrix/client".extraConfig = '' - more_set_headers 'Content-Type application/json'; - more_set_headers 'Access-Control-Allow-Origin *'; - return 200 '${ - builtins.toJSON { - "m.homeserver".base_url = "http://synapse.localhost"; - } - }'; - ''; - locations."= /.well-known/matrix/support".extraConfig = '' - more_set_headers 'Content-Type application/json'; - more_set_headers 'Access-Control-Allow-Origin *'; - return 200 '${ - builtins.toJSON { - admins = [ - { - matrix_id = "@emma:rory.gay"; - role = "admin"; - } - { - matrix_id = "@alicia:rory.gay"; - role = "admin"; - } - { - matrix_id = "@root:rory.gay"; - role = "admin"; - } - { - matrix_id = "@rory:rory.gay"; - role = "admin"; - } - ]; - } - }'; - ''; -} diff --git a/host/Rory-desktop/ollama.nix b/host/Rory-desktop/ollama.nix deleted file mode 100755 index b1b0a7a..0000000 --- a/host/Rory-desktop/ollama.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: - -{ - # systemd.tmpfiles.rules = [ "d /data/ollama 0750 ostgres postgres" ]; - - #overlays - #nixpkgs.overlays = [ - # (final: old: { - # rocmPackages = old.rocmPackages // { - # rocblas = (old.rocmPackages.rocblas.overrideAttrs (oldAttrs: { - # gpuTargets = [ "gfx1102" ]; - # })); - # }; - # } - # ) - #]; - - services.ollama = { - enable = true; - home = "/data/ollama/home"; - models = "/data/ollama/home/models"; - environmentVariables = { - OLLAMA_LLM_LIBRARY = "rocm"; - HCC_AMDGPU_TARGET = "gfx1102"; - }; - # writablePaths = [ "/data/ollama/home" ]; - #listenAddress = "0.0.0.0:11434"; - host = "0.0.0.0"; - port = 11434; - user = "ollama"; - group = "ollama"; - acceleration = "rocm"; - rocmOverrideGfx = "11.0.2"; - }; - - #services.nextjs-ollama-llm-ui = { - - #}; -} diff --git a/host/Rory-desktop/optional/gui/hyprland.nix b/host/Rory-desktop/optional/gui/hyprland.nix new file mode 100644 index 0000000..5fcbfb4 --- /dev/null +++ b/host/Rory-desktop/optional/gui/hyprland.nix @@ -0,0 +1,26 @@ +{ + pkgs, + hyprland, + hy3, + ... +}: + +{ + programs.hyprland = { + enable = true; + package = hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; + }; + + programs.hyprlock.enable = true; + environment.systemPackages = with pkgs;[ + wmenu + ]; + + environment.etc."hyprPlugins" = { + text = '' + plugin = ${hy3.packages.${pkgs.stdenv.hostPlatform.system}.hy3}/lib/libhy3.so + ''; + }; + + xdg.portal.wlr.enable = true; +} diff --git a/host/Rory-desktop/optional/gui/i3.nix b/host/Rory-desktop/optional/gui/i3.nix new file mode 100644 index 0000000..9070298 --- /dev/null +++ b/host/Rory-desktop/optional/gui/i3.nix @@ -0,0 +1,36 @@ +{ + config, + pkgs, + lib, + nhekoSrc, + mtxclientSrc, + ... +}: + +{ + imports = [ ]; + + services = { + xserver = { + windowManager.i3.enable = true; + windowManager.i3.extraSessionCommands = '' + # output from arandr: + #xrandr --output DP-1 --mode 1920x1080 --pos 3840x1080 --rotate normal --output HDMI-1 --mode 3840x2160 --pos 0x0 --rotate normal --output HDMI-2 --off --output DP-2 --off + xrandr --output HDMI-1 --mode 3840x2160 --pos 0x0 --rotate normal --primary --output DP-1 --mode 1920x1080 --pos 3840x1080 --rotate normal --output HDMI-2 --off --output DP-2 --off + ${pkgs.polybarFull}/bin/polybar & + ${pkgs.dunst}/bin/dunst & + ${pkgs.picom}/bin/picom --config ~/.config/picom.conf & + ${pkgs.feh}/bin/feh --no-fehbg --bg-fill ${../../../../modules/users/Rory/wallpaper.webp} + ''; + windowManager.i3.extraPackages = with pkgs; [ + easyeffects + keepassxc + ]; + }; + + picom.enable = false; + #picom.vSync = false; + #picom.backend = "glx"; + }; + +} diff --git a/host/Rory-desktop/optional/gui/sway.nix b/host/Rory-desktop/optional/gui/sway.nix new file mode 100644 index 0000000..f19635f --- /dev/null +++ b/host/Rory-desktop/optional/gui/sway.nix @@ -0,0 +1,39 @@ +{ + pkgs, + hyprland, + hy3, + ... +}: + +{ + programs.sway = { + enable = true; + + wrapperFeatures.gtk = true; + extraSessionCommands = '' + # -- Wayland fixes + # SDL: + export SDL_VIDEODRIVER=wayland + # QT (needs qt5.qtwayland in systemPackages): + export QT_QPA_PLATFORM=wayland-egl + export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" + # Fix for some Java AWT applications (e.g. Android Studio), + # use this if they aren't displayed properly: + export _JAVA_AWT_WM_NONREPARENTING=1 + ''; + + extraPackages = with pkgs; [ + swaybg + #swayidle + #swaylock + waybar + wl-clipboard + grim + slurp + easyeffects + keepassxc + ]; + }; + + xdg.portal.wlr.enable = true; +} diff --git a/host/Rory-desktop/optional/gui/wayland.nix b/host/Rory-desktop/optional/gui/wayland.nix deleted file mode 100644 index a8f7db7..0000000 --- a/host/Rory-desktop/optional/gui/wayland.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ - pkgs, - hyprland, - hy3, - ... -}: - -{ - programs.sway = { - enable = true; - - wrapperFeatures.gtk = true; - extraSessionCommands = '' - # -- Wayland fixes - # SDL: - export SDL_VIDEODRIVER=wayland - # QT (needs qt5.qtwayland in systemPackages): - export QT_QPA_PLATFORM=wayland-egl - export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" - # Fix for some Java AWT applications (e.g. Android Studio), - # use this if they aren't displayed properly: - export _JAVA_AWT_WM_NONREPARENTING=1 - ''; - - extraPackages = with pkgs; [ - swaybg - #swayidle - #swaylock - waybar - wl-clipboard - grim - slurp - easyeffects - keepassxc - ]; - }; - - programs.hyprland = { - enable = true; - package = hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; - }; - - programs.hyprlock.enable = true; - environment.systemPackages = with pkgs;[ - wmenu - ]; - - environment.etc."hyprPlugins" = { - text = '' - plugin = ${hy3.packages.${pkgs.stdenv.hostPlatform.system}.hy3}/lib/libhy3.so - ''; - }; - - xdg.portal.wlr.enable = true; -} diff --git a/host/Rory-desktop/optional/gui/x11.nix b/host/Rory-desktop/optional/gui/x11.nix deleted file mode 100644 index 9070298..0000000 --- a/host/Rory-desktop/optional/gui/x11.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ - config, - pkgs, - lib, - nhekoSrc, - mtxclientSrc, - ... -}: - -{ - imports = [ ]; - - services = { - xserver = { - windowManager.i3.enable = true; - windowManager.i3.extraSessionCommands = '' - # output from arandr: - #xrandr --output DP-1 --mode 1920x1080 --pos 3840x1080 --rotate normal --output HDMI-1 --mode 3840x2160 --pos 0x0 --rotate normal --output HDMI-2 --off --output DP-2 --off - xrandr --output HDMI-1 --mode 3840x2160 --pos 0x0 --rotate normal --primary --output DP-1 --mode 1920x1080 --pos 3840x1080 --rotate normal --output HDMI-2 --off --output DP-2 --off - ${pkgs.polybarFull}/bin/polybar & - ${pkgs.dunst}/bin/dunst & - ${pkgs.picom}/bin/picom --config ~/.config/picom.conf & - ${pkgs.feh}/bin/feh --no-fehbg --bg-fill ${../../../../modules/users/Rory/wallpaper.webp} - ''; - windowManager.i3.extraPackages = with pkgs; [ - easyeffects - keepassxc - ]; - }; - - picom.enable = false; - #picom.vSync = false; - #picom.backend = "glx"; - }; - -} diff --git a/host/Rory-desktop/postgres.nix b/host/Rory-desktop/postgres.nix deleted file mode 100755 index c201b04..0000000 --- a/host/Rory-desktop/postgres.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: - -{ - #systemd.tmpfiles.rules = [ "d /mnt/postgres/data 0750 postgres postgres" ]; - - services.postgresql = { - enable = true; - package = pkgs.postgresql_16; - enableTCPIP = true; - authentication = pkgs.lib.mkOverride 10 '' - # TYPE, DATABASE, USER, ADDRESS, METHOD - local all all trust - host all all 127.0.0.1/32 trust - host all all ::1/128 trust - host discordbots discordbots 192.168.1.2/32 trust - host matrix-synapse-rory-gay matrix-synapse-rory-gay 192.168.1.5/32 trust - host all all 0.0.0.0/0 md5 - ''; - # initialScript = pkgs.writeText "backend-initScript" '' - # CREATE ROLE nixcloud WITH LOGIN PASSWORD 'nixcloud' CREATEDB; - # CREATE DATABASE nixcloud; - # GRANT ALL PRIVILEGES ON DATABASE nixcloud TO nixcloud; - # ''; - #dataDir = "/mnt/postgres/data"; - settings = { - "max_connections" = "1000"; - "shared_buffers" = "512MB"; - "max_wal_size" = "1GB"; - "min_wal_size" = "80MB"; - - shared_preload_libraries = "pg_stat_statements"; - track_io_timing = "on"; - track_functions = "pl"; - "pg_stat_statements.max" = "10000"; # additional - "pg_stat_statements.track" = "all"; # additional - - }; - }; - -} diff --git a/host/Rory-desktop/printing.nix b/host/Rory-desktop/printing.nix deleted file mode 100644 index 4f86347..0000000 --- a/host/Rory-desktop/printing.nix +++ /dev/null @@ -1,54 +0,0 @@ -{ pkgs, ... }: - -{ - imports = [ ]; - - users.users = { - Rory = { - extraGroups = [ - "lp" - "scanner" - ]; - }; - }; - - environment.systemPackages = with pkgs; [ - xsane - simple-scan - ]; - - hardware = { - sane.enable = true; - sane.extraBackends = [ - pkgs.hplipWithPlugin - pkgs.sane-airscan - ]; - }; - - programs.system-config-printer.enable = true; - - services = { - gvfs.enable = true; - saned.enable = true; - system-config-printer.enable = true; - ipp-usb.enable = true; - printing = { - enable = true; - browsing = true; - drivers = with pkgs; [ hplip ]; - }; - avahi = { - enable = true; - nssmdns4 = true; - reflector = true; - publish = { - workstation = true; - userServices = true; - hinfo = true; - enable = true; - domain = true; - addresses = true; - }; - }; - }; -} diff --git a/host/Rory-desktop/services/edu/mongodb.nix b/host/Rory-desktop/services/edu/mongodb.nix new file mode 100644 index 0000000..92ffc6a --- /dev/null +++ b/host/Rory-desktop/services/edu/mongodb.nix @@ -0,0 +1,20 @@ +{ + config, + pkgs, + lib, + ... +}: + +{ + services.mongodb = { + enable = true; + package = pkgs.mongodb-ce; + enableAuth = true; + initialRootPasswordFile = "/etc/mongo-pass"; + #bind_ip = "/run/mongodb.sock"; + extraConfig = '' + net.unixDomainSocket.filePermissions: 0777 + ''; + }; + +} diff --git a/host/Rory-desktop/services/libvirt.nix b/host/Rory-desktop/services/libvirt.nix new file mode 100644 index 0000000..405a73d --- /dev/null +++ b/host/Rory-desktop/services/libvirt.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: +{ + virtualisation.libvirtd.enable = true; + programs.virt-manager.enable = true; + environment.systemPackages = with pkgs; [ + virt-viewer + ]; +} \ No newline at end of file diff --git a/host/Rory-desktop/services/mariadb.nix b/host/Rory-desktop/services/mariadb.nix new file mode 100644 index 0000000..758cb3d --- /dev/null +++ b/host/Rory-desktop/services/mariadb.nix @@ -0,0 +1,14 @@ +{ + config, + pkgs, + lib, + ... +}: + +{ + services.mysql = { + enable = true; + package = pkgs.mariadb; + }; + +} diff --git a/host/Rory-desktop/services/nginx.nix b/host/Rory-desktop/services/nginx.nix new file mode 100644 index 0000000..bd1f364 --- /dev/null +++ b/host/Rory-desktop/services/nginx.nix @@ -0,0 +1,43 @@ +{ + config, + pkgs, + lib, + ... +}: + +{ + services = { + nginx = { + enable = true; + #package = pkgs.nginxQuic; + recommendedProxySettings = true; + #recommendedTlsSettings = true; + recommendedZstdSettings = true; + # recommendedGzipSettings = true; + recommendedBrotliSettings = true; + recommendedOptimisation = true; + #defaultMimeTypes = ../../../../packages/nginx/mime.types; + appendConfig = '' + worker_processes 16; + ''; + eventsConfig = '' + #use kqueue; + worker_connections 512; + ''; + appendHttpConfig = '' + #sendfile on; + disable_symlinks off; + ''; + additionalModules = with pkgs.nginxModules; [ moreheaders ]; + virtualHosts = { + "discord.localhost" = import ./nginx/discord.localhost.nix { inherit pkgs; }; + "hse.localhost" = import ./nginx/hse.localhost.nix { inherit pkgs; }; + "matrix.opensuse.localhost" = import ./nginx/matrix.opensuse.localhost.nix { inherit pkgs; }; + "synapse.localhost" = import ./nginx/synapse.localhost.nix { inherit pkgs; }; + }; + }; + }; + systemd.services.nginx.serviceConfig = { + LimitNOFILE = 5000000; + }; +} diff --git a/host/Rory-desktop/services/nginx/discord.localhost.nix b/host/Rory-desktop/services/nginx/discord.localhost.nix new file mode 100755 index 0000000..b40e13c --- /dev/null +++ b/host/Rory-desktop/services/nginx/discord.localhost.nix @@ -0,0 +1,36 @@ +{ pkgs, ... }: + +{ + root = "/www/discord"; + addSSL = true; + enableACME = false; + + # We don't care about certificates around here... + sslCertificate = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.cert.pem"; + sslCertificateKey = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.key.pem"; + + extraConfig = '' + autoindex on; + more_set_headers 'Access-Control-Allow-Origin: *'; + more_set_headers 'Access-Control-Allow-Methods: GET, POST, OPTIONS'; + more_set_headers 'Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; + more_set_headers 'Access-Control-Expose-Headers: Content-Length,Content-Range'; + more_set_headers 'Access-Control-Allow-Credentials: true'; + ''; + + locations = { + "/" = { + index = "index.html"; + extraConfig = '' + more_set_headers 'Access-Control-Allow-Origin: *'; + more_set_headers 'Access-Control-Allow-Methods: *'; + more_set_headers 'Access-Control-Allow-Headers: *'; + more_set_headers 'Access-Control-Expose-Headers: *'; + more_set_headers 'Access-Control-Max-Age' 1728000; + + # default to /index.html if file not found + try_files $uri $uri/ /index.html; + ''; + }; + }; +} diff --git a/host/Rory-desktop/services/nginx/hse.localhost.nix b/host/Rory-desktop/services/nginx/hse.localhost.nix new file mode 100755 index 0000000..5812b02 --- /dev/null +++ b/host/Rory-desktop/services/nginx/hse.localhost.nix @@ -0,0 +1,75 @@ +{pkgs, ...}: +{ + enableACME = false; + addSSL = true; + # We don't care about certificates around here... + sslCertificate = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.cert.pem"; + sslCertificateKey = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.key.pem"; + locations."/" = { + #proxyPass = "http://127.0.0.1:9001"; + proxyPass = "http://localhost:5298"; + extraConfig = '' + if ($request_method = 'OPTIONS') { + more_set_headers 'Access-Control-Allow-Origin: *'; + more_set_headers 'Access-Control-Allow-Methods: *'; + # + # Custom headers and headers various browsers *should* be OK with but aren't + # + more_set_headers 'Access-Control-Allow-Headers: *, Authorization'; + # + # Tell client that this pre-flight info is valid for 20 days + # + more_set_headers 'Access-Control-Max-Age: 1728000'; + more_set_headers 'Content-Type: text/plain; charset=utf-8'; + more_set_headers 'Content-Length: 0'; + return 204; + } + ''; + }; + +# locations."= /.well-known/matrix/server".extraConfig = '' +# more_set_headers 'Content-Type application/json'; +# more_set_headers 'Access-Control-Allow-Origin *'; +# return 200 '${builtins.toJSON { "m.server" = "hse.localhost:5298"; }}'; +# ''; +# locations."= /.well-known/matrix/client".extraConfig = '' +# more_set_headers 'Content-Type application/json'; +# more_set_headers 'Access-Control-Allow-Origin *'; +# return 200 '${ +# builtins.toJSON { +# "m.homeserver".base_url = "http://hse.localhost:5298"; +# "org.matrix.msc3575.proxy".url = "https://matrix.rory.gay"; +# } +# }'; +# ''; + locations."= /.well-known/matrix/support".extraConfig = '' + more_set_headers 'Content-Type application/json'; + more_set_headers 'Access-Control-Allow-Origin *'; + return 200 '${ + builtins.toJSON { + admins = [ + { + matrix_id = "@emma:rory.gay"; + role = "admin"; + } + { + matrix_id = "@alicia:rory.gay"; + role = "admin"; + } + { + matrix_id = "@root:rory.gay"; + role = "admin"; + } + { + matrix_id = "@rory:rory.gay"; + role = "admin"; + } + ]; + } + }'; + ''; + + locations."~ ^/(client/|_matrix/client/unstable/org.matrix.msc3575/sync)" = { + proxyPass = "http://localhost:8100"; + }; +} diff --git a/host/Rory-desktop/services/nginx/matrix.opensuse.localhost.nix b/host/Rory-desktop/services/nginx/matrix.opensuse.localhost.nix new file mode 100644 index 0000000..87287a4 --- /dev/null +++ b/host/Rory-desktop/services/nginx/matrix.opensuse.localhost.nix @@ -0,0 +1,75 @@ +{pkgs, ...}: +{ + enableACME = false; + addSSL = true; + # We don't care about certificates around here... + sslCertificate = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.cert.pem"; + sslCertificateKey = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.key.pem"; + locations."/" = { + #proxyPass = "http://127.0.0.1:9001"; + proxyPass = "http://localhost:8008"; + extraConfig = '' + if ($request_method = 'OPTIONS') { + more_set_headers 'Access-Control-Allow-Origin: *'; + more_set_headers 'Access-Control-Allow-Methods: *'; + # + # Custom headers and headers various browsers *should* be OK with but aren't + # + more_set_headers 'Access-Control-Allow-Headers: *, Authorization'; + # + # Tell client that this pre-flight info is valid for 20 days + # + more_set_headers 'Access-Control-Max-Age: 1728000'; + more_set_headers 'Content-Type: text/plain; charset=utf-8'; + more_set_headers 'Content-Length: 0'; + return 204; + } + ''; + }; + +# locations."= /.well-known/matrix/server".extraConfig = '' +# more_set_headers 'Content-Type application/json'; +# more_set_headers 'Access-Control-Allow-Origin *'; +# return 200 '${builtins.toJSON { "m.server" = "hse.localhost:5298"; }}'; +# ''; +# locations."= /.well-known/matrix/client".extraConfig = '' +# more_set_headers 'Content-Type application/json'; +# more_set_headers 'Access-Control-Allow-Origin *'; +# return 200 '${ +# builtins.toJSON { +# "m.homeserver".base_url = "http://hse.localhost:5298"; +# "org.matrix.msc3575.proxy".url = "https://matrix.rory.gay"; +# } +# }'; +# ''; + locations."= /.well-known/matrix/support".extraConfig = '' + more_set_headers 'Content-Type application/json'; + more_set_headers 'Access-Control-Allow-Origin *'; + return 200 '${ + builtins.toJSON { + admins = [ + { + matrix_id = "@emma:rory.gay"; + role = "admin"; + } + { + matrix_id = "@alicia:rory.gay"; + role = "admin"; + } + { + matrix_id = "@root:rory.gay"; + role = "admin"; + } + { + matrix_id = "@rory:rory.gay"; + role = "admin"; + } + ]; + } + }'; + ''; + + locations."~ ^/(client/|_matrix/client/unstable/org.matrix.msc3575/sync)" = { + proxyPass = "http://localhost:8100"; + }; +} diff --git a/host/Rory-desktop/services/nginx/synapse.localhost.nix b/host/Rory-desktop/services/nginx/synapse.localhost.nix new file mode 100755 index 0000000..9f89678 --- /dev/null +++ b/host/Rory-desktop/services/nginx/synapse.localhost.nix @@ -0,0 +1,70 @@ +{ pkgs }: +{ + enableACME = false; + addSSL = true; + # We don't care about certificates around here... + sslCertificate = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.cert.pem"; + sslCertificateKey = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.key.pem"; + locations."/" = { + #proxyPass = "http://127.0.0.1:9001"; + proxyPass = "http://localhost:8008"; + extraConfig = '' + if ($request_method = 'OPTIONS') { + more_set_headers 'Access-Control-Allow-Origin: *'; + more_set_headers 'Access-Control-Allow-Methods: *'; + # + # Custom headers and headers various browsers *should* be OK with but aren't + # + more_set_headers 'Access-Control-Allow-Headers: *, Authorization'; + # + # Tell client that this pre-flight info is valid for 20 days + # + more_set_headers 'Access-Control-Max-Age: 1728000'; + more_set_headers 'Content-Type: text/plain; charset=utf-8'; + more_set_headers 'Content-Length: 0'; + return 204; + } + ''; + }; + + locations."= /.well-known/matrix/server".extraConfig = '' + more_set_headers 'Content-Type application/json'; + more_set_headers 'Access-Control-Allow-Origin *'; + return 200 '${builtins.toJSON { "m.server" = "synapse.localhost:443"; }}'; + ''; + locations."= /.well-known/matrix/client".extraConfig = '' + more_set_headers 'Content-Type application/json'; + more_set_headers 'Access-Control-Allow-Origin *'; + return 200 '${ + builtins.toJSON { + "m.homeserver".base_url = "http://synapse.localhost"; + } + }'; + ''; + locations."= /.well-known/matrix/support".extraConfig = '' + more_set_headers 'Content-Type application/json'; + more_set_headers 'Access-Control-Allow-Origin *'; + return 200 '${ + builtins.toJSON { + admins = [ + { + matrix_id = "@emma:rory.gay"; + role = "admin"; + } + { + matrix_id = "@alicia:rory.gay"; + role = "admin"; + } + { + matrix_id = "@root:rory.gay"; + role = "admin"; + } + { + matrix_id = "@rory:rory.gay"; + role = "admin"; + } + ]; + } + }'; + ''; +} diff --git a/host/Rory-desktop/services/ollama.nix b/host/Rory-desktop/services/ollama.nix new file mode 100755 index 0000000..b1b0a7a --- /dev/null +++ b/host/Rory-desktop/services/ollama.nix @@ -0,0 +1,44 @@ +{ + config, + pkgs, + lib, + ... +}: + +{ + # systemd.tmpfiles.rules = [ "d /data/ollama 0750 ostgres postgres" ]; + + #overlays + #nixpkgs.overlays = [ + # (final: old: { + # rocmPackages = old.rocmPackages // { + # rocblas = (old.rocmPackages.rocblas.overrideAttrs (oldAttrs: { + # gpuTargets = [ "gfx1102" ]; + # })); + # }; + # } + # ) + #]; + + services.ollama = { + enable = true; + home = "/data/ollama/home"; + models = "/data/ollama/home/models"; + environmentVariables = { + OLLAMA_LLM_LIBRARY = "rocm"; + HCC_AMDGPU_TARGET = "gfx1102"; + }; + # writablePaths = [ "/data/ollama/home" ]; + #listenAddress = "0.0.0.0:11434"; + host = "0.0.0.0"; + port = 11434; + user = "ollama"; + group = "ollama"; + acceleration = "rocm"; + rocmOverrideGfx = "11.0.2"; + }; + + #services.nextjs-ollama-llm-ui = { + + #}; +} diff --git a/host/Rory-desktop/services/postgres.nix b/host/Rory-desktop/services/postgres.nix new file mode 100755 index 0000000..c201b04 --- /dev/null +++ b/host/Rory-desktop/services/postgres.nix @@ -0,0 +1,45 @@ +{ + config, + pkgs, + lib, + ... +}: + +{ + #systemd.tmpfiles.rules = [ "d /mnt/postgres/data 0750 postgres postgres" ]; + + services.postgresql = { + enable = true; + package = pkgs.postgresql_16; + enableTCPIP = true; + authentication = pkgs.lib.mkOverride 10 '' + # TYPE, DATABASE, USER, ADDRESS, METHOD + local all all trust + host all all 127.0.0.1/32 trust + host all all ::1/128 trust + host discordbots discordbots 192.168.1.2/32 trust + host matrix-synapse-rory-gay matrix-synapse-rory-gay 192.168.1.5/32 trust + host all all 0.0.0.0/0 md5 + ''; + # initialScript = pkgs.writeText "backend-initScript" '' + # CREATE ROLE nixcloud WITH LOGIN PASSWORD 'nixcloud' CREATEDB; + # CREATE DATABASE nixcloud; + # GRANT ALL PRIVILEGES ON DATABASE nixcloud TO nixcloud; + # ''; + #dataDir = "/mnt/postgres/data"; + settings = { + "max_connections" = "1000"; + "shared_buffers" = "512MB"; + "max_wal_size" = "1GB"; + "min_wal_size" = "80MB"; + + shared_preload_libraries = "pg_stat_statements"; + track_io_timing = "on"; + track_functions = "pl"; + "pg_stat_statements.max" = "10000"; # additional + "pg_stat_statements.track" = "all"; # additional + + }; + }; + +} diff --git a/host/Rory-desktop/services/printing.nix b/host/Rory-desktop/services/printing.nix new file mode 100644 index 0000000..4f86347 --- /dev/null +++ b/host/Rory-desktop/services/printing.nix @@ -0,0 +1,54 @@ +{ pkgs, ... }: + +{ + imports = [ ]; + + users.users = { + Rory = { + extraGroups = [ + "lp" + "scanner" + ]; + }; + }; + + environment.systemPackages = with pkgs; [ + xsane + simple-scan + ]; + + hardware = { + sane.enable = true; + sane.extraBackends = [ + pkgs.hplipWithPlugin + pkgs.sane-airscan + ]; + }; + + programs.system-config-printer.enable = true; + + services = { + gvfs.enable = true; + saned.enable = true; + system-config-printer.enable = true; + ipp-usb.enable = true; + printing = { + enable = true; + browsing = true; + drivers = with pkgs; [ hplip ]; + }; + avahi = { + enable = true; + nssmdns4 = true; + reflector = true; + publish = { + workstation = true; + userServices = true; + hinfo = true; + enable = true; + domain = true; + addresses = true; + }; + }; + }; +} diff --git a/host/Rory-desktop/services/rabbitmq.nix b/host/Rory-desktop/services/rabbitmq.nix new file mode 100644 index 0000000..f786a70 --- /dev/null +++ b/host/Rory-desktop/services/rabbitmq.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + services.rabbitmq = { + enable = true; + }; +} \ No newline at end of file diff --git a/host/Rory-desktop/services/steam.nix b/host/Rory-desktop/services/steam.nix new file mode 100644 index 0000000..a01b46e --- /dev/null +++ b/host/Rory-desktop/services/steam.nix @@ -0,0 +1,11 @@ +{ ... }: +{ + programs.steam = { + enable = true; + gamescopeSession.enable = true; + extraCompatPackages = with pkgs; [ + steam-play-none + proton-ge-bin + ]; + }; +} \ No newline at end of file diff --git a/host/Rory-desktop/services/waydroid.nix b/host/Rory-desktop/services/waydroid.nix new file mode 100644 index 0000000..45a90ea --- /dev/null +++ b/host/Rory-desktop/services/waydroid.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + virtualisation.waydroid.enable = true; +} \ No newline at end of file diff --git a/host/Rory-laptop/configuration.nix b/host/Rory-laptop/configuration.nix index c4aca15..bb0467b 100644 --- a/host/Rory-laptop/configuration.nix +++ b/host/Rory-laptop/configuration.nix @@ -110,7 +110,7 @@ args@{ }; }; - services.xserver.desktopManager.gnome.enable = false; + services.desktopManager.gnome.enable = false; environment.systemPackages = with pkgs; [ eog mpv @@ -124,10 +124,17 @@ args@{ # - IDEs - (jetbrains.plugins.addPlugins jetbrains.webstorm [ "github-copilot" ]) - (jetbrains.plugins.addPlugins jetbrains.idea-ultimate [ "github-copilot" ]) + (jetbrains.plugins.addPlugins jetbrains.webstorm [ + jetbrains.plugins.github-copilot-fixed + #"github-copilot" + ]) + (jetbrains.plugins.addPlugins jetbrains.idea-ultimate [ + jetbrains.plugins.github-copilot-fixed + #"github-copilot" + ]) (jetbrains.plugins.addPlugins jetbrains.clion [ - "github-copilot" + jetbrains.plugins.github-copilot-fixed + #"github-copilot" "string-manipulation" "nixidea" "visual-studio-keymap" diff --git a/modules/base.nix b/modules/base.nix index 6ae144d..44909aa 100755 --- a/modules/base.nix +++ b/modules/base.nix @@ -112,7 +112,7 @@ }; environment.systemPackages = with pkgs; [ - wget + #wget neofetch lnav pciutils @@ -123,17 +123,17 @@ btop duf kitty.terminfo - tmux + #tmux jq yq pv dig cloud-utils nix-output-monitor - expect + #expect unrar-wrapper - arch-install-scripts - debootstrap + #arch-install-scripts + #debootstrap file unzip brotli diff --git a/modules/software-templates/dotnet.client.nix b/modules/software-templates/dotnet.client.nix index 8b3d13f..f855aa3 100644 --- a/modules/software-templates/dotnet.client.nix +++ b/modules/software-templates/dotnet.client.nix @@ -18,7 +18,8 @@ in environment.systemPackages = with pkgs; [ #`jetbrains.rider (jetbrains.plugins.addPlugins jetbrains.rider [ - "github-copilot" + jetbrains.plugins.github-copilot-fixed + #"github-copilot" "nixidea" ]) ]; diff --git a/packages/overlays/jetbrains-plugins.nix b/packages/overlays/jetbrains-plugins.nix new file mode 100644 index 0000000..50eb061 --- /dev/null +++ b/packages/overlays/jetbrains-plugins.nix @@ -0,0 +1,75 @@ +{ ... }: +{ + nixpkgs.overlays = [ + ( + # https://github.com/NixOS/nixpkgs/issues/400317 + self: super: + let + file = "https://plugins.jetbrains.com/files/17718/743191/github-copilot-intellij-1.5.45-243.zip"; + id = "17718"; + in + { + jetbrains = super.lib.recursiveUpdate super.jetbrains { + plugins.github-copilot-fixed = super.stdenv.mkDerivation { + name = "jetbrains-plugin-${id}"; + installPhase = '' + runHook preInstall + mkdir -p $out && cp -r . $out + runHook postInstall + ''; + src = super.fetchzip { + url = "https://plugins.jetbrains.com/files/17718/743191/github-copilot-intellij-1.5.45-243.zip"; + hash = "sha256-wSIGsDmgZV8o6F9ekf84b06Ul16rw+wXdQx/X4D/rCI="; + executable = false; + }; + + # prelude + # (function(process, require, console, EXECPATH_FD, PAYLOAD_POSITION, PAYLOAD_SIZE) { return (function (REQUIRE_COMMON, VIRTUAL_FILESYSTEM, DEFAULT_ENTRYPOINT, SYMLINKS, DICT, DOCOMPRESS) { + # payload + # grep -aobUam1 $'\x1f\x8b\x08\x00' copilot-language-server + + buildPhase = '' + agent='copilot-agent/native/${super.lib.toLower super.stdenv.hostPlatform.uname.system}${ + { + x86_64 = "-x64"; + aarch64 = "-arm64"; + } + .${super.stdenv.hostPlatform.uname.processor} or "" + }/copilot-language-server' + + # Helper: find the offset of the payload by matching gzip magic bytes + find_payload_offset() { + grep -aobUam1 -f <(printf '\x1f\x8b\x08\x00') "$agent" | cut -d: -f1 + } + + # Helper: find the offset of the prelude by searching for function string start + find_prelude_offset() { + local prelude_string='(function(process, require, console, EXECPATH_FD, PAYLOAD_POSITION, PAYLOAD_SIZE) {' + grep -obUa -- "$prelude_string" "$agent" | cut -d: -f1 + } + + before_payload_position="$(find_payload_offset)" + before_prelude_position="$(find_prelude_offset)" + + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $agent + patchelf --set-rpath ${ + super.lib.makeLibraryPath [ + super.glibc + super.gcc-unwrapped + ] + } $agent + chmod +x $agent + + after_payload_position="$(find_payload_offset)" + after_prelude_position="$(find_prelude_offset)" + + # There are hardcoded positions in the binary, then it replaces the placeholders by himself + sed -i -e "s/$before_payload_position/$after_payload_position/g" "$agent" + sed -i -e "s/$before_prelude_position/$after_prelude_position/g" "$agent" + ''; + }; + }; + } + ) + ]; +} -- cgit 1.5.1