diff --git a/domain-proxies.nix b/domain-proxies.nix index d4aa516..a7f3178 100644 --- a/domain-proxies.nix +++ b/domain-proxies.nix @@ -21,14 +21,6 @@ 993 ]; }; - "traque.katvayor.net" = { - ssh = 22001; - ip = "192.168.122.4"; - aliases = [ - "traque.dgnum.eu" - "test.traque.katvayor.net" - ]; - }; "son.katvayor.net" = { ssh = null; ip = "192.168.122.5"; diff --git a/hive.nix b/hive.nix index 698ef7f..b8ade34 100644 --- a/hive.nix +++ b/hive.nix @@ -123,23 +123,6 @@ in users.users.root.openssh.authorizedKeys.keys = [ id_sylvain ]; }; - kat-traque = - { users, ... }: - { - deployment = { - targetHost = "traque.kat"; - tags = [ "kat-vms" ]; - }; - services.qemuGuest.enable = true; - boot.kernelParams = [ "console=ttyS0" ]; - - imports = [ - ./machines/kat-traque - (users.root { ssh = true; }) - ]; - users.users.root.openssh.authorizedKeys.keys = [ id_sylvain ]; - }; - kat-mail-test = { users, ... }: { diff --git a/machines/kat-traque/default.nix b/machines/kat-traque/default.nix deleted file mode 100644 index 52377a0..0000000 --- a/machines/kat-traque/default.nix +++ /dev/null @@ -1,253 +0,0 @@ -# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). - -{ - config, - lib, - pkgs, - ... -}: -let - traque-pkg = pkgs.callPackage ./traque-pkg.nix { }; -in -{ - imports = [ - ./hardware-configuration.nix - ./disks.nix - ]; - - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.supportedFilesystems = [ "bcachefs" ]; - boot.kernelPackages = pkgs.linuxPackages_latest; - - time.timeZone = "Europe/Paris"; - - networking = { - interfaces."enp1s0" = { - useDHCP = false; - ipv4.addresses = [ - { - address = "192.168.122.4"; - prefixLength = 24; - } - ]; - ipv6.addresses = [ - { - address = "fe80::4"; - prefixLength = 64; - } - ]; - }; - defaultGateway = "192.168.122.1"; - defaultGateway6 = { - address = "fe80::1"; - interface = "enp1s0"; - }; - nameservers = [ - "192.168.122.1" - "fe80::1%enp1s0" - ]; - }; - - i18n.defaultLocale = "en_US.UTF-8"; - console = { - font = "Lat2-Terminus16"; - keyMap = "fr"; - }; - - services.dbus.packages = with pkgs; [ dconf ]; - - nixpkgs.config.allowUnfree = true; - - programs.zsh.enable = true; - - environment.systemPackages = with pkgs; [ - wget - nix-search-cli - git - btop - ranger - screen - ]; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - programs.gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; - - services.openssh.enable = true; - - networking.firewall.enable = false; - - security.acme = { - acceptTerms = true; - defaults.email = "root@katvayor.net"; - }; - services.nginx = { - enable = true; - virtualHosts = { - "traque.katvayor.net" = { - enableACME = true; - addSSL = true; - locations."/".extraConfig = '' - return 301 https://traque.dgnum.eu$request_uri; - ''; - }; - "traque.dgnum.eu" = { - enableACME = true; - addSSL = true; - locations = { - "= /" = { - alias = "${traque-pkg}/share/traque-webroot/"; - }; - "/" = { - root = "${traque-pkg}/share/traque-webroot"; - tryFiles = "$uri $uri.html @backend"; - }; - "@backend" = { - recommendedProxySettings = true; - proxyPass = "http://localhost:8080"; - extraConfig = '' - error_page 502 =503 "/errors/503.html"; - proxy_set_header Connection '''; - proxy_http_version 1.1; - chunked_transfer_encoding off; - proxy_buffering off; - proxy_cache off; - ''; - }; - }; - }; - "test.traque.katvayor.net" = { - enableACME = true; - addSSL = true; - locations = { - "= /" = { - alias = "/traque/static/"; - }; - "/" = { - root = "/traque/static"; - tryFiles = "$uri $uri.html @backend"; - }; - "@backend" = { - recommendedProxySettings = true; - proxyPass = "http://localhost:8000"; - extraConfig = '' - error_page 502 =503 "/errors/503.html"; - proxy_set_header Connection '''; - proxy_http_version 1.1; - chunked_transfer_encoding off; - proxy_buffering off; - proxy_cache off; - ''; - }; - }; - }; - }; - }; - systemd.services = { - traque = { - path = [ pkgs.outils ]; - preStart = - let - token-file = "/var/lib/traque/token"; - NPCs = [ - "Foxtrot" - "Filou" - "Flagada" - "Festivité" - "Fruitbat" - "Fissure" - "Luxembourg" - "Italie" - "Contrescarpe" - "Sèvres-babylone" - "Roseraie" - "Observatoire" - "Montparnasse" - ]; - Players = [ - "Alpha" - "Aarakocra" - "Anguille" - "Abricot" - "Antilope" - "Aigle Royal" - "Bravo" - "Béluga" - "Bétléhem" - "Belzébuth" - "Baltimore" - "Basilic" - "Cachalot" - "Colegram" - "Calcutta" - "Capybara" - "Crotale" - "Charlie" - "Delta" - "Delhi" - "Dandélion" - "Drone" - "Doryphore" - "Doliprane" - "Ellipse" - "Echo" - "Elfe" - "Éléphant" - "Epsilon" - "Épine" - ]; - id-gen = name: ''sha1 <<< "$(cat ${token-file})${name}" | cut -c 1-10''; - in - '' - cat < /var/lib/traque/Rocket.toml - [release] - port = 8080 - ident = "Traque backend" - template_dir = "${traque-pkg}/share/traque-templates" - - blurred_move = [0.0005, 0.0005] - bonus_timeout = 120000 - event_timeout = 100 - fairness_timeout = 30000 - admin_token = "$(cat ${token-file})" - serve_static = false - teams = [ - ${ - lib.concatStringsSep ",\n " ( - map (npc: ''{ id = "$(${id-gen npc})", name = "${npc}", vieux = true }'') NPCs - ++ map (player: ''{ id = "$(${id-gen player})", name = "${player}", vieux = false}'') Players - ) - } - ] - EOF - ''; - serviceConfig = { - WorkingDirectory = "/var/lib/traque"; - ExecStart = "${traque-pkg}/bin/traque"; - ExecReload = [ "${pkgs.coreutils}/bin/kill -HUP $MAINPID" ]; - User = "traque"; - Group = "traque"; - DynamicUser = true; - Restart = "on-failure"; - RestartSec = 2; - LogsDirectory = "traque"; - StateDirectory = "traque"; - RuntimeDirectory = "traque"; - }; - }; - }; - users = { - users.traque = { - group = "traque"; - isSystemUser = true; - }; - groups.traque = { }; - }; - - system.stateVersion = "23.11"; # Did you read the comment? -} diff --git a/machines/kat-traque/disks.nix b/machines/kat-traque/disks.nix deleted file mode 100644 index 6c59a85..0000000 --- a/machines/kat-traque/disks.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - disko.devices = { - disk = { - vda = { - device = "/dev/vda"; - type = "disk"; - content = { - type = "gpt"; - partitions = { - ESP = { - type = "EF00"; - size = "100M"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - }; - }; - root = { - size = "100%"; - content = { - type = "filesystem"; - format = "bcachefs"; - mountpoint = "/"; - mountOptions = [ "fsck" "fix_errors" ]; - }; - }; - }; - }; - }; - }; - }; -} diff --git a/machines/kat-traque/hardware-configuration.nix b/machines/kat-traque/hardware-configuration.nix deleted file mode 100644 index e8da702..0000000 --- a/machines/kat-traque/hardware-configuration.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - config, - lib, - pkgs, - modulesPath, - ... -}: - -{ - imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; - - boot.initrd.availableKernelModules = [ - "ahci" - "xhci_pci" - "virtio_pci" - "sr_mod" - "virtio_blk" - ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - networking.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; -} diff --git a/machines/kat-traque/traque-pkg.nix b/machines/kat-traque/traque-pkg.nix deleted file mode 100644 index 8fdaa88..0000000 --- a/machines/kat-traque/traque-pkg.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ lib, rustPlatform }: - -rustPlatform.buildRustPackage rec { - pname = "traque"; - version = "0.2.4"; - - src = fetchTarball "https://git.dgnum.eu/lbailly/traque/archive/master.tar.gz"; - cargoLock = { - lockFile = "${src}/Cargo.lock"; - }; - - postInstall = '' - mkdir -p $out/share - cp -r static $out/share/traque-webroot - cp -r templates $out/share/traque-templates - ''; -}