From 99a69bf1e9edfa936a0c0ec3e7deea6d95c32a0f Mon Sep 17 00:00:00 2001 From: ArgentumCation Date: Fri, 16 Aug 2024 16:35:21 -0400 Subject: [PATCH] add keepalived conf? --- galanin/configuration.nix | 117 ++++++++++++++++++++++++-------------- 1 file changed, 73 insertions(+), 44 deletions(-) diff --git a/galanin/configuration.nix b/galanin/configuration.nix index 1321c9d..cd94483 100644 --- a/galanin/configuration.nix +++ b/galanin/configuration.nix @@ -3,16 +3,16 @@ # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). { config, - lib, - pkgs, - ... + lib, + pkgs, + ... }: { imports = [ - # Include the results of the hardware scan. - # ./hardware-configuration.nix +# Include the results of the hardware scan. +# ./hardware-configuration.nix ]; - # Use the systemd-boot EFI boot loader. +# Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; @@ -25,12 +25,12 @@ defaultGateway.address = "192.168.1.1"; }; - # List packages installed in system profile. To search, run: - # $ nix search wget - # environment.systemPackages = with pkgs; [ - # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - # wget - # ]; +# List packages installed in system profile. To search, run: +# $ nix search wget +# environment.systemPackages = with pkgs; [ +# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. +# wget +# ]; users = { users = { @@ -39,24 +39,24 @@ uid = 100000; group = "dockremap"; subUidRanges = [ - { - startUid = 100000; - count = 65536; - } + { + startUid = 100000; + count = 65536; + } ]; subGidRanges = [ - { - startGid = 100000; - count = 65536; - } + { + startGid = 100000; + count = 65536; + } ]; }; }; }; - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs. +# Some programs need SUID wrappers, can be configured further or are +# started in user sessions. +# programs.mtr.enable = true; +# programs. programs = { gnupg.agent = { enable = true; @@ -76,7 +76,7 @@ configure = { customRC = '' set number relativenumber - ''; + ''; }; defaultEditor = true; @@ -90,25 +90,54 @@ extraOptions = "--userns-remap=default"; liveRestore = false; # NOTE: Incompatible with swarm }; - # List services that you want to enable: +# List services that you want to enable: + services.keepalived = { + enable = true; + openFirewall = true; + extraConfig = '' + vrrp_track_process track_traefik { + process traefik + weight 20 + delay 1 + } + ''; + vrrpInstances = { + VI_1 = { + state = "BACKUP"; + interface = "enp0s31f6"; + virtualRouterId = 51; + priority=100; + virtualIps = [ {addr = "192.168.1.64";}]; + extraConfig = '' + authentication { + auth_type PASS + auth_pass 3141 + } + track_process { + track_traefik + } + advert_int 1 + ''; + }; + }; + }; +# Enable the OpenSSH daemon. +# services.openssh.enable = true; - # Enable the OpenSSH daemon. - # services.openssh.enable = true; +# Open ports in the firewall. +# networking.firewall.allowedTCPPorts = [ ... ]; +# networking.firewall.allowedUDPPorts = [ ... ]; +# Or disable the firewall altogether. - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. +# Copy the NixOS configuration file and link it from the resulting system +# (/run/current-system/configuration.nix). This is useful in case you +# accidentally delete configuration.nix. +# system.copySystemConfiguration = true; + services.logind.lidSwitch = "ignore"; + systemd.targets.sleep.enable = false; + systemd.targets.suspend.enable = false; + systemd.targets.hibernate.enable = false; + systemd.targets.hybrid-sleep.enable = false; - # Copy the NixOS configuration file and link it from the resulting system - # (/run/current-system/configuration.nix). This is useful in case you - # accidentally delete configuration.nix. - # system.copySystemConfiguration = true; - services.logind.lidSwitch = "ignore"; - systemd.targets.sleep.enable = false; - systemd.targets.suspend.enable = false; - systemd.targets.hibernate.enable = false; - systemd.targets.hybrid-sleep.enable = false; - - system.stateVersion = "24.05"; # Did you read the comment? -} + system.stateVersion = "24.05"; # Did you read the comment? + }