Compare commits
	
		
			1 Commits
		
	
	
		
			backup-dat
			...
			systemd-jo
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						112a95c050
	
				 | 
					
					
						
							
								
								
									
										200
									
								
								base.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										200
									
								
								base.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,200 @@
 | 
				
			|||||||
 | 
					{ config, lib, pkgs, inputs, values, ... }:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  imports = [
 | 
				
			||||||
 | 
					    ./users
 | 
				
			||||||
 | 
					    ./modules/snakeoil-certs.nix
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  networking.domain = "pvv.ntnu.no";
 | 
				
			||||||
 | 
					  networking.useDHCP = false;
 | 
				
			||||||
 | 
					  # networking.search = [ "pvv.ntnu.no" "pvv.org" ];
 | 
				
			||||||
 | 
					  # networking.nameservers = lib.mkDefault [ "129.241.0.200" "129.241.0.201" ];
 | 
				
			||||||
 | 
					  # networking.tempAddresses = lib.mkDefault "disabled";
 | 
				
			||||||
 | 
					  # networking.defaultGateway = values.hosts.gateway;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  systemd.network.enable = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  services.resolved = {
 | 
				
			||||||
 | 
					    enable = lib.mkDefault true;
 | 
				
			||||||
 | 
					    dnssec = "false"; # Supposdly this keeps breaking and the default is to allow downgrades anyways...
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  time.timeZone = "Europe/Oslo";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  i18n.defaultLocale = "en_US.UTF-8";
 | 
				
			||||||
 | 
					  console = {
 | 
				
			||||||
 | 
					    font = "Lat2-Terminus16";
 | 
				
			||||||
 | 
					    keyMap = "no";
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  system.autoUpgrade = {
 | 
				
			||||||
 | 
					    enable = true;
 | 
				
			||||||
 | 
					    flake = "git+https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git";
 | 
				
			||||||
 | 
					    flags = [
 | 
				
			||||||
 | 
					      "--update-input" "nixpkgs"
 | 
				
			||||||
 | 
					      "--update-input" "nixpkgs-unstable"
 | 
				
			||||||
 | 
					      "--no-write-lock-file"
 | 
				
			||||||
 | 
					    ];
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					  nix.gc.automatic = true;
 | 
				
			||||||
 | 
					  nix.gc.options = "--delete-older-than 2d";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  nix.settings.experimental-features = [ "nix-command" "flakes" ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /* This makes commandline tools like
 | 
				
			||||||
 | 
					  ** nix run nixpkgs#hello
 | 
				
			||||||
 | 
					  ** and nix-shell -p hello
 | 
				
			||||||
 | 
					  ** use the same channel the system
 | 
				
			||||||
 | 
					  ** was built with
 | 
				
			||||||
 | 
					  */
 | 
				
			||||||
 | 
					  nix.registry = {
 | 
				
			||||||
 | 
					    nixpkgs.flake = inputs.nixpkgs;
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					  nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  environment.systemPackages = with pkgs; [
 | 
				
			||||||
 | 
					    file
 | 
				
			||||||
 | 
					    git
 | 
				
			||||||
 | 
					    gnupg
 | 
				
			||||||
 | 
					    htop
 | 
				
			||||||
 | 
					    nano
 | 
				
			||||||
 | 
					    ripgrep
 | 
				
			||||||
 | 
					    rsync
 | 
				
			||||||
 | 
					    screen
 | 
				
			||||||
 | 
					    tmux
 | 
				
			||||||
 | 
					    vim
 | 
				
			||||||
 | 
					    wget
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    kitty.terminfo
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  programs.zsh.enable = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  users.groups."drift".name = "drift";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Trusted users on the nix builder machines
 | 
				
			||||||
 | 
					  users.groups."nix-builder-users".name = "nix-builder-users";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Let's not thermal throttle
 | 
				
			||||||
 | 
					  services.thermald.enable = lib.mkIf (lib.all (x: x) [
 | 
				
			||||||
 | 
					      (config.nixpkgs.system == "x86_64-linux")
 | 
				
			||||||
 | 
					      (!config.boot.isContainer or false)
 | 
				
			||||||
 | 
					    ]) true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  services.openssh = {
 | 
				
			||||||
 | 
					    enable = true;
 | 
				
			||||||
 | 
					    extraConfig = ''
 | 
				
			||||||
 | 
					      PubkeyAcceptedAlgorithms=+ssh-rsa
 | 
				
			||||||
 | 
					      Match Group wheel
 | 
				
			||||||
 | 
					        PasswordAuthentication no
 | 
				
			||||||
 | 
					      Match All
 | 
				
			||||||
 | 
					    '';
 | 
				
			||||||
 | 
					    settings.PermitRootLogin = "yes";
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # nginx return 444 for all nonexistent virtualhosts
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  systemd.services.nginx.after = [ "generate-snakeoil-certs.service" ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  environment.snakeoil-certs = lib.mkIf config.services.nginx.enable {
 | 
				
			||||||
 | 
					    "/etc/certs/nginx" = {
 | 
				
			||||||
 | 
					      owner = "nginx";
 | 
				
			||||||
 | 
					      group = "nginx";
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  services.nginx = {
 | 
				
			||||||
 | 
					    recommendedTlsSettings = true;
 | 
				
			||||||
 | 
					    recommendedProxySettings = true;
 | 
				
			||||||
 | 
					    recommendedOptimisation = true;
 | 
				
			||||||
 | 
					    recommendedGzipSettings = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    appendConfig = ''
 | 
				
			||||||
 | 
					      pcre_jit on;
 | 
				
			||||||
 | 
					      worker_processes auto;
 | 
				
			||||||
 | 
					      worker_rlimit_nofile 100000;
 | 
				
			||||||
 | 
					    '';
 | 
				
			||||||
 | 
					    eventsConfig = ''
 | 
				
			||||||
 | 
					      worker_connections 2048;
 | 
				
			||||||
 | 
					      use epoll;
 | 
				
			||||||
 | 
					      multi_accept on;
 | 
				
			||||||
 | 
					    '';
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  systemd.services.nginx.serviceConfig = lib.mkIf config.services.nginx.enable {
 | 
				
			||||||
 | 
					    LimitNOFILE = 65536;
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  services.nginx.virtualHosts."_" = lib.mkIf config.services.nginx.enable {
 | 
				
			||||||
 | 
					    sslCertificate = "/etc/certs/nginx.crt";
 | 
				
			||||||
 | 
					    sslCertificateKey = "/etc/certs/nginx.key";
 | 
				
			||||||
 | 
					    addSSL = true;
 | 
				
			||||||
 | 
					    extraConfig = "return 444;";
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # source: https://github.com/logrotate/logrotate/blob/main/examples/logrotate.service
 | 
				
			||||||
 | 
					  systemd.services.logrotate = {
 | 
				
			||||||
 | 
					    documentation = [ "man:logrotate(8)" "man:logrotate.conf(5)" ];
 | 
				
			||||||
 | 
					    unitConfig.RequiresMountsFor = "/var/log";
 | 
				
			||||||
 | 
					    serviceConfig = {
 | 
				
			||||||
 | 
					      Nice = 19;
 | 
				
			||||||
 | 
					      IOSchedulingClass = "best-effort";
 | 
				
			||||||
 | 
					      IOSchedulingPriority = 7;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      ReadWritePaths = [ "/var/log" ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      AmbientCapabilities = [ "" ];
 | 
				
			||||||
 | 
					      CapabilityBoundingSet = [ "" ];
 | 
				
			||||||
 | 
					      DeviceAllow = [ "" ];
 | 
				
			||||||
 | 
					      LockPersonality = true;
 | 
				
			||||||
 | 
					      MemoryDenyWriteExecute = true;
 | 
				
			||||||
 | 
					      NoNewPrivileges = true; # disable for third party rotate scripts
 | 
				
			||||||
 | 
					      PrivateDevices = true;
 | 
				
			||||||
 | 
					      PrivateNetwork = true; # disable for mail delivery
 | 
				
			||||||
 | 
					      PrivateTmp = true;
 | 
				
			||||||
 | 
					      ProtectClock = true;
 | 
				
			||||||
 | 
					      ProtectControlGroups = true;
 | 
				
			||||||
 | 
					      ProtectHome = true; # disable for userdir logs
 | 
				
			||||||
 | 
					      ProtectHostname = true;
 | 
				
			||||||
 | 
					      ProtectKernelLogs = true;
 | 
				
			||||||
 | 
					      ProtectKernelModules = true;
 | 
				
			||||||
 | 
					      ProtectKernelTunables = true;
 | 
				
			||||||
 | 
					      ProtectProc = "invisible";
 | 
				
			||||||
 | 
					      ProtectSystem = "full";
 | 
				
			||||||
 | 
					      RestrictNamespaces = true;
 | 
				
			||||||
 | 
					      RestrictRealtime = true;
 | 
				
			||||||
 | 
					      RestrictSUIDSGID = true; # disable for creating setgid directories
 | 
				
			||||||
 | 
					      SocketBindDeny = [ "any" ];
 | 
				
			||||||
 | 
					      SystemCallArchitectures = "native";
 | 
				
			||||||
 | 
					      SystemCallFilter = [
 | 
				
			||||||
 | 
					        "@system-service"
 | 
				
			||||||
 | 
					      ];
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  services.journald.upload = {
 | 
				
			||||||
 | 
					    enable =  values.services.logcollector.ipv4;
 | 
				
			||||||
 | 
					    settings.Upload = {
 | 
				
			||||||
 | 
					      URL = "https://logcollector.pvv.ntnu.no:19532";
 | 
				
			||||||
 | 
					      ServerKeyFile = "-";
 | 
				
			||||||
 | 
					      ServerCertificateFile = "-";
 | 
				
			||||||
 | 
					      TrustedCertificateFile = "-";
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  networking.firewall.allowedTCPPorts = lib.mkIf config.services.nginx.enable [ 80 443 ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  security.acme = {
 | 
				
			||||||
 | 
					    acceptTerms = true;
 | 
				
			||||||
 | 
					    defaults.email = "drift@pvv.ntnu.no";
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					  # Let's not spam LetsEncrypt in `nixos-rebuild build-vm` mode:
 | 
				
			||||||
 | 
					  virtualisation.vmVariant = {
 | 
				
			||||||
 | 
					    security.acme.defaults.server = "https://127.0.0.1";
 | 
				
			||||||
 | 
					    security.acme.preliminarySelfsigned = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    users.users.root.initialPassword = "root";
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,60 +0,0 @@
 | 
				
			|||||||
{ pkgs, lib, ... }:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  imports = [
 | 
					 | 
				
			||||||
    ../users
 | 
					 | 
				
			||||||
    ../modules/snakeoil-certs.nix
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ./networking.nix
 | 
					 | 
				
			||||||
    ./nix.nix
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ./services/acme.nix
 | 
					 | 
				
			||||||
    ./services/auto-upgrade.nix
 | 
					 | 
				
			||||||
    ./services/irqbalance.nix
 | 
					 | 
				
			||||||
    ./services/logrotate.nix
 | 
					 | 
				
			||||||
    ./services/nginx.nix
 | 
					 | 
				
			||||||
    ./services/openssh.nix
 | 
					 | 
				
			||||||
    ./services/postfix.nix
 | 
					 | 
				
			||||||
    ./services/smartd.nix
 | 
					 | 
				
			||||||
    ./services/thermald.nix
 | 
					 | 
				
			||||||
  ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  boot.tmp.cleanOnBoot = lib.mkDefault true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  time.timeZone = "Europe/Oslo";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  i18n.defaultLocale = "en_US.UTF-8";
 | 
					 | 
				
			||||||
  console = {
 | 
					 | 
				
			||||||
    font = "Lat2-Terminus16";
 | 
					 | 
				
			||||||
    keyMap = "no";
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  environment.systemPackages = with pkgs; [
 | 
					 | 
				
			||||||
    file
 | 
					 | 
				
			||||||
    git
 | 
					 | 
				
			||||||
    gnupg
 | 
					 | 
				
			||||||
    htop
 | 
					 | 
				
			||||||
    nano
 | 
					 | 
				
			||||||
    ripgrep
 | 
					 | 
				
			||||||
    rsync
 | 
					 | 
				
			||||||
    screen
 | 
					 | 
				
			||||||
    tmux
 | 
					 | 
				
			||||||
    vim
 | 
					 | 
				
			||||||
    wget
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    kitty.terminfo
 | 
					 | 
				
			||||||
  ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  programs.zsh.enable = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  security.sudo.execWheelOnly = true;
 | 
					 | 
				
			||||||
  security.sudo.extraConfig = ''
 | 
					 | 
				
			||||||
    Defaults lecture = never
 | 
					 | 
				
			||||||
  '';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  users.groups."drift".name = "drift";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  # Trusted users on the nix builder machines
 | 
					 | 
				
			||||||
  users.groups."nix-builder-users".name = "nix-builder-users";
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -1,16 +0,0 @@
 | 
				
			|||||||
{ lib, values, ... }:
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  networking.domain = "pvv.ntnu.no";
 | 
					 | 
				
			||||||
  networking.useDHCP = false;
 | 
					 | 
				
			||||||
  # networking.search = [ "pvv.ntnu.no" "pvv.org" ];
 | 
					 | 
				
			||||||
  # networking.nameservers = lib.mkDefault [ "129.241.0.200" "129.241.0.201" ];
 | 
					 | 
				
			||||||
  # networking.tempAddresses = lib.mkDefault "disabled";
 | 
					 | 
				
			||||||
  # networking.defaultGateway = values.hosts.gateway;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  systemd.network.enable = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  services.resolved = {
 | 
					 | 
				
			||||||
    enable = lib.mkDefault true;
 | 
					 | 
				
			||||||
    dnssec = "false"; # Supposdly this keeps breaking and the default is to allow downgrades anyways...
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										30
									
								
								base/nix.nix
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								base/nix.nix
									
									
									
									
									
								
							@@ -1,30 +0,0 @@
 | 
				
			|||||||
{ inputs, ... }:
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  nix = {
 | 
					 | 
				
			||||||
    gc = {
 | 
					 | 
				
			||||||
      automatic = true;
 | 
					 | 
				
			||||||
      options = "--delete-older-than 2d";
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    settings = {
 | 
					 | 
				
			||||||
      allow-dirty = true;
 | 
					 | 
				
			||||||
      auto-optimise-store = true;
 | 
					 | 
				
			||||||
      builders-use-substitutes = true;
 | 
					 | 
				
			||||||
      experimental-features = [ "nix-command" "flakes" ];
 | 
					 | 
				
			||||||
      log-lines = 50;
 | 
					 | 
				
			||||||
      use-xdg-base-directories = true;
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /* This makes commandline tools like
 | 
					 | 
				
			||||||
    ** nix run nixpkgs#hello
 | 
					 | 
				
			||||||
    ** and nix-shell -p hello
 | 
					 | 
				
			||||||
    ** use the same channel the system
 | 
					 | 
				
			||||||
    ** was built with
 | 
					 | 
				
			||||||
    */
 | 
					 | 
				
			||||||
    registry = {
 | 
					 | 
				
			||||||
      "nixpkgs".flake = inputs.nixpkgs;
 | 
					 | 
				
			||||||
      "pvv-nix".flake = inputs.self;
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,15 +0,0 @@
 | 
				
			|||||||
{ ... }:
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  security.acme = {
 | 
					 | 
				
			||||||
    acceptTerms = true;
 | 
					 | 
				
			||||||
    defaults.email = "drift@pvv.ntnu.no";
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  # Let's not spam LetsEncrypt in `nixos-rebuild build-vm` mode:
 | 
					 | 
				
			||||||
  virtualisation.vmVariant = {
 | 
					 | 
				
			||||||
    security.acme.defaults.server = "https://127.0.0.1";
 | 
					 | 
				
			||||||
    security.acme.preliminarySelfsigned = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    users.users.root.initialPassword = "root";
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,12 +0,0 @@
 | 
				
			|||||||
{ ... }:
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  system.autoUpgrade = {
 | 
					 | 
				
			||||||
    enable = true;
 | 
					 | 
				
			||||||
    flake = "git+https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git";
 | 
					 | 
				
			||||||
    flags = [
 | 
					 | 
				
			||||||
      "--update-input" "nixpkgs"
 | 
					 | 
				
			||||||
      "--update-input" "nixpkgs-unstable"
 | 
					 | 
				
			||||||
      "--no-write-lock-file"
 | 
					 | 
				
			||||||
    ];
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,4 +0,0 @@
 | 
				
			|||||||
{ ... }:
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  services.irqbalance.enable = true;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,42 +0,0 @@
 | 
				
			|||||||
{ ... }:
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  # source: https://github.com/logrotate/logrotate/blob/main/examples/logrotate.service
 | 
					 | 
				
			||||||
  systemd.services.logrotate = {
 | 
					 | 
				
			||||||
    documentation = [ "man:logrotate(8)" "man:logrotate.conf(5)" ];
 | 
					 | 
				
			||||||
    unitConfig.RequiresMountsFor = "/var/log";
 | 
					 | 
				
			||||||
    serviceConfig = {
 | 
					 | 
				
			||||||
      Nice = 19;
 | 
					 | 
				
			||||||
      IOSchedulingClass = "best-effort";
 | 
					 | 
				
			||||||
      IOSchedulingPriority = 7;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      ReadWritePaths = [ "/var/log" ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      AmbientCapabilities = [ "" ];
 | 
					 | 
				
			||||||
      CapabilityBoundingSet = [ "" ];
 | 
					 | 
				
			||||||
      DeviceAllow = [ "" ];
 | 
					 | 
				
			||||||
      LockPersonality = true;
 | 
					 | 
				
			||||||
      MemoryDenyWriteExecute = true;
 | 
					 | 
				
			||||||
      NoNewPrivileges = true; # disable for third party rotate scripts
 | 
					 | 
				
			||||||
      PrivateDevices = true;
 | 
					 | 
				
			||||||
      PrivateNetwork = true; # disable for mail delivery
 | 
					 | 
				
			||||||
      PrivateTmp = true;
 | 
					 | 
				
			||||||
      ProtectClock = true;
 | 
					 | 
				
			||||||
      ProtectControlGroups = true;
 | 
					 | 
				
			||||||
      ProtectHome = true; # disable for userdir logs
 | 
					 | 
				
			||||||
      ProtectHostname = true;
 | 
					 | 
				
			||||||
      ProtectKernelLogs = true;
 | 
					 | 
				
			||||||
      ProtectKernelModules = true;
 | 
					 | 
				
			||||||
      ProtectKernelTunables = true;
 | 
					 | 
				
			||||||
      ProtectProc = "invisible";
 | 
					 | 
				
			||||||
      ProtectSystem = "full";
 | 
					 | 
				
			||||||
      RestrictNamespaces = true;
 | 
					 | 
				
			||||||
      RestrictRealtime = true;
 | 
					 | 
				
			||||||
      RestrictSUIDSGID = true; # disable for creating setgid directories
 | 
					 | 
				
			||||||
      SocketBindDeny = [ "any" ];
 | 
					 | 
				
			||||||
      SystemCallArchitectures = "native";
 | 
					 | 
				
			||||||
      SystemCallFilter = [
 | 
					 | 
				
			||||||
        "@system-service"
 | 
					 | 
				
			||||||
      ];
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,44 +0,0 @@
 | 
				
			|||||||
{ config, lib, ... }:
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  # nginx return 444 for all nonexistent virtualhosts
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  systemd.services.nginx.after = [ "generate-snakeoil-certs.service" ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  environment.snakeoil-certs = lib.mkIf config.services.nginx.enable {
 | 
					 | 
				
			||||||
    "/etc/certs/nginx" = {
 | 
					 | 
				
			||||||
      owner = "nginx";
 | 
					 | 
				
			||||||
      group = "nginx";
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  networking.firewall.allowedTCPPorts = lib.mkIf config.services.nginx.enable [ 80 443 ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  services.nginx = {
 | 
					 | 
				
			||||||
    recommendedTlsSettings = true;
 | 
					 | 
				
			||||||
    recommendedProxySettings = true;
 | 
					 | 
				
			||||||
    recommendedOptimisation = true;
 | 
					 | 
				
			||||||
    recommendedGzipSettings = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    appendConfig = ''
 | 
					 | 
				
			||||||
      pcre_jit on;
 | 
					 | 
				
			||||||
      worker_processes auto;
 | 
					 | 
				
			||||||
      worker_rlimit_nofile 100000;
 | 
					 | 
				
			||||||
    '';
 | 
					 | 
				
			||||||
    eventsConfig = ''
 | 
					 | 
				
			||||||
      worker_connections 2048;
 | 
					 | 
				
			||||||
      use epoll;
 | 
					 | 
				
			||||||
      multi_accept on;
 | 
					 | 
				
			||||||
    '';
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  systemd.services.nginx.serviceConfig = lib.mkIf config.services.nginx.enable {
 | 
					 | 
				
			||||||
    LimitNOFILE = 65536;
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  services.nginx.virtualHosts."_" = lib.mkIf config.services.nginx.enable {
 | 
					 | 
				
			||||||
    sslCertificate = "/etc/certs/nginx.crt";
 | 
					 | 
				
			||||||
    sslCertificateKey = "/etc/certs/nginx.key";
 | 
					 | 
				
			||||||
    addSSL = true;
 | 
					 | 
				
			||||||
    extraConfig = "return 444;";
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,14 +0,0 @@
 | 
				
			|||||||
{ ... }:
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  services.openssh = {
 | 
					 | 
				
			||||||
    enable = true;
 | 
					 | 
				
			||||||
    startWhenNeeded = true;
 | 
					 | 
				
			||||||
    extraConfig = ''
 | 
					 | 
				
			||||||
      PubkeyAcceptedAlgorithms=+ssh-rsa
 | 
					 | 
				
			||||||
      Match Group wheel
 | 
					 | 
				
			||||||
        PasswordAuthentication no
 | 
					 | 
				
			||||||
      Match All
 | 
					 | 
				
			||||||
    '';
 | 
					 | 
				
			||||||
    settings.PermitRootLogin = "yes";
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,23 +0,0 @@
 | 
				
			|||||||
{ config, pkgs, lib, ... }:
 | 
					 | 
				
			||||||
let
 | 
					 | 
				
			||||||
  cfg = config.services.postfix;
 | 
					 | 
				
			||||||
in
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  services.postfix = {
 | 
					 | 
				
			||||||
    enable = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    hostname = "${config.networking.hostName}.pvv.ntnu.no";
 | 
					 | 
				
			||||||
    domain = "pvv.ntnu.no";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    relayHost = "smtp.pvv.ntnu.no";
 | 
					 | 
				
			||||||
    relayPort = 465;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    config = {
 | 
					 | 
				
			||||||
      smtp_tls_wrappermode = "yes";
 | 
					 | 
				
			||||||
      smtp_tls_security_level = "encrypt";
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Nothing should be delivered to this machine
 | 
					 | 
				
			||||||
    destination = [ ];
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,8 +0,0 @@
 | 
				
			|||||||
{ config, pkgs, lib, ... }:
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  services.smartd.enable = lib.mkDefault true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  environment.systemPackages = lib.optionals config.services.smartd.enable (with pkgs; [
 | 
					 | 
				
			||||||
    smartmontools
 | 
					 | 
				
			||||||
  ]);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,8 +0,0 @@
 | 
				
			|||||||
{ config, lib, ... }:
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  # Let's not thermal throttle
 | 
					 | 
				
			||||||
  services.thermald.enable = lib.mkIf (lib.all (x: x) [
 | 
					 | 
				
			||||||
      (config.nixpkgs.system == "x86_64-linux")
 | 
					 | 
				
			||||||
      (!config.boot.isContainer or false)
 | 
					 | 
				
			||||||
    ]) true;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -3,7 +3,7 @@
 | 
				
			|||||||
  imports = [
 | 
					  imports = [
 | 
				
			||||||
    ./hardware-configuration.nix
 | 
					    ./hardware-configuration.nix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ../../base
 | 
					    ../../base.nix
 | 
				
			||||||
    ../../misc/metrics-exporters.nix
 | 
					    ../../misc/metrics-exporters.nix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ./services/gitea/default.nix
 | 
					    ./services/gitea/default.nix
 | 
				
			||||||
@@ -32,8 +32,6 @@
 | 
				
			|||||||
    address = with values.hosts.bekkalokk; [ (ipv4 + "/25") (ipv6 + "/64") ];
 | 
					    address = with values.hosts.bekkalokk; [ (ipv4 + "/25") (ipv6 + "/64") ];
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  services.btrfs.autoScrub.enable = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  # Do not change, even during upgrades.
 | 
					  # Do not change, even during upgrades.
 | 
				
			||||||
  # See https://search.nixos.org/options?show=system.stateVersion
 | 
					  # See https://search.nixos.org/options?show=system.stateVersion
 | 
				
			||||||
  system.stateVersion = "22.11";
 | 
					  system.stateVersion = "22.11";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@
 | 
				
			|||||||
  imports = [
 | 
					  imports = [
 | 
				
			||||||
    ./hardware-configuration.nix
 | 
					    ./hardware-configuration.nix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ../../base
 | 
					    ../../base.nix
 | 
				
			||||||
    ../../misc/metrics-exporters.nix
 | 
					    ../../misc/metrics-exporters.nix
 | 
				
			||||||
    ./services/nginx
 | 
					    ./services/nginx
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@
 | 
				
			|||||||
  services.mjolnir = {
 | 
					  services.mjolnir = {
 | 
				
			||||||
    enable = true;
 | 
					    enable = true;
 | 
				
			||||||
    pantalaimon.enable = false;
 | 
					    pantalaimon.enable = false;
 | 
				
			||||||
    homeserverUrl = "https://matrix.pvv.ntnu.no";
 | 
					    homeserverUrl = "http://127.0.0.1:8008";
 | 
				
			||||||
    accessTokenFile = config.sops.secrets."matrix/mjolnir/access_token".path;
 | 
					    accessTokenFile = config.sops.secrets."matrix/mjolnir/access_token".path;
 | 
				
			||||||
    managementRoom = "!gsdeCoWjvYRBrzuiRq:pvv.ntnu.no";
 | 
					    managementRoom = "!gsdeCoWjvYRBrzuiRq:pvv.ntnu.no";
 | 
				
			||||||
    protectedRooms = map (a: "https://matrix.to/#/${a}") [
 | 
					    protectedRooms = map (a: "https://matrix.to/#/${a}") [
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -157,18 +157,6 @@ in {
 | 
				
			|||||||
      '';
 | 
					      '';
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    locations."/_synapse/admin" = {
 | 
					 | 
				
			||||||
      proxyPass = "http://$synapse_backend";
 | 
					 | 
				
			||||||
      extraConfig = ''
 | 
					 | 
				
			||||||
        allow 127.0.0.1;
 | 
					 | 
				
			||||||
        allow ::1;
 | 
					 | 
				
			||||||
        allow ${values.hosts.bicep.ipv4};
 | 
					 | 
				
			||||||
        allow ${values.hosts.bicep.ipv6};
 | 
					 | 
				
			||||||
        deny all;
 | 
					 | 
				
			||||||
      '';
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    locations = let
 | 
					    locations = let
 | 
				
			||||||
      connectionInfo = w: matrix-lib.workerConnectionResource "metrics" w;
 | 
					      connectionInfo = w: matrix-lib.workerConnectionResource "metrics" w;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,4 @@
 | 
				
			|||||||
{ pkgs, lib, config, values, ... }:
 | 
					{ pkgs, lib, config, values, ... }:
 | 
				
			||||||
let
 | 
					 | 
				
			||||||
  backupDir = "/var/lib/mysql/backups";
 | 
					 | 
				
			||||||
in
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  sops.secrets."mysql/password" = {
 | 
					  sops.secrets."mysql/password" = {
 | 
				
			||||||
    owner = "mysql";
 | 
					    owner = "mysql";
 | 
				
			||||||
@@ -39,6 +36,11 @@ in
 | 
				
			|||||||
    }];
 | 
					    }];
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  services.mysqlBackup = {
 | 
				
			||||||
 | 
					    enable = true;
 | 
				
			||||||
 | 
					    location = "/var/lib/mysql/backups";
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  networking.firewall.allowedTCPPorts = [ 3306 ];
 | 
					  networking.firewall.allowedTCPPorts = [ 3306 ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  systemd.services.mysql.serviceConfig = {
 | 
					  systemd.services.mysql.serviceConfig = {
 | 
				
			||||||
@@ -48,58 +50,4 @@ in
 | 
				
			|||||||
      values.ipv6-space
 | 
					      values.ipv6-space
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					 | 
				
			||||||
  # NOTE: instead of having the upstream nixpkgs postgres backup unit trigger
 | 
					 | 
				
			||||||
  #       another unit, it was easier to just make one ourselves
 | 
					 | 
				
			||||||
  systemd.services."backup-mysql" = {
 | 
					 | 
				
			||||||
    description = "Backup MySQL data";
 | 
					 | 
				
			||||||
    requires = [ "mysql.service" ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    path = [
 | 
					 | 
				
			||||||
      pkgs.coreutils
 | 
					 | 
				
			||||||
      pkgs.rsync
 | 
					 | 
				
			||||||
      pkgs.gzip
 | 
					 | 
				
			||||||
      config.services.mysql.package
 | 
					 | 
				
			||||||
    ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    script = let
 | 
					 | 
				
			||||||
      rotations = 10;
 | 
					 | 
				
			||||||
      # rsyncTarget = "root@isvegg.pvv.ntnu.no:/mnt/backup1/bicep/mysql";
 | 
					 | 
				
			||||||
      rsyncTarget = "/data/backup/mysql";
 | 
					 | 
				
			||||||
    in ''
 | 
					 | 
				
			||||||
      set -eo pipefail
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      mysqldump --all-databases | gzip -c -9 --rsyncable > "${backupDir}/$(date --iso-8601)-dump.sql.gz"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      while [ $(ls -1 "${backupDir}" | wc -l) -gt ${toString rotations} ]; do
 | 
					 | 
				
			||||||
        rm $(find "${backupDir}" -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d' ' -f2)
 | 
					 | 
				
			||||||
      done
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      rsync -avz --delete "${backupDir}" '${rsyncTarget}'
 | 
					 | 
				
			||||||
    '';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    serviceConfig = {
 | 
					 | 
				
			||||||
      Type = "oneshot";
 | 
					 | 
				
			||||||
      User = "mysql";
 | 
					 | 
				
			||||||
      Group = "mysql";
 | 
					 | 
				
			||||||
      UMask = "0077";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      Nice = 19;
 | 
					 | 
				
			||||||
      IOSchedulingClass = "best-effort";
 | 
					 | 
				
			||||||
      IOSchedulingPriority = 7;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      ReadWritePaths = [
 | 
					 | 
				
			||||||
        backupDir
 | 
					 | 
				
			||||||
        "/data/backup/mysql" # NOTE: should not be part of this option once rsyncTarget is remote
 | 
					 | 
				
			||||||
      ];
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    startAt = "*-*-* 02:15:00";
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  systemd.tmpfiles.settings."10-mysql-backup".${backupDir}.d = {
 | 
					 | 
				
			||||||
    user = "mysql";
 | 
					 | 
				
			||||||
    group = "mysql";
 | 
					 | 
				
			||||||
    mode = "700";
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,4 @@
 | 
				
			|||||||
{ config, pkgs, lib, ... }:
 | 
					{ config, pkgs, ... }:
 | 
				
			||||||
let
 | 
					 | 
				
			||||||
  backupDir = "/var/lib/postgresql/backups";
 | 
					 | 
				
			||||||
in
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  services.postgresql = {
 | 
					  services.postgresql = {
 | 
				
			||||||
    enable = true;
 | 
					    enable = true;
 | 
				
			||||||
@@ -93,57 +90,9 @@ in
 | 
				
			|||||||
  networking.firewall.allowedTCPPorts = [ 5432 ];
 | 
					  networking.firewall.allowedTCPPorts = [ 5432 ];
 | 
				
			||||||
  networking.firewall.allowedUDPPorts = [ 5432 ];
 | 
					  networking.firewall.allowedUDPPorts = [ 5432 ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # NOTE: instead of having the upstream nixpkgs postgres backup unit trigger
 | 
					  services.postgresqlBackup = {
 | 
				
			||||||
  #       another unit, it was easier to just make one ourselves
 | 
					    enable = true;
 | 
				
			||||||
  systemd.services."backup-postgresql" = {
 | 
					    location = "/var/lib/postgres/backups";
 | 
				
			||||||
    description = "Backup PostgreSQL data";
 | 
					    backupAll = true;
 | 
				
			||||||
    requires = [ "postgresql.service" ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    path = [
 | 
					 | 
				
			||||||
      pkgs.coreutils
 | 
					 | 
				
			||||||
      pkgs.rsync
 | 
					 | 
				
			||||||
      pkgs.gzip
 | 
					 | 
				
			||||||
      config.services.postgresql.package
 | 
					 | 
				
			||||||
    ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    script = let
 | 
					 | 
				
			||||||
      rotations = 10;
 | 
					 | 
				
			||||||
      # rsyncTarget = "root@isvegg.pvv.ntnu.no:/mnt/backup1/bicep/postgresql";
 | 
					 | 
				
			||||||
      rsyncTarget = "/data/backup/postgresql";
 | 
					 | 
				
			||||||
    in ''
 | 
					 | 
				
			||||||
      set -eo pipefail
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      pg_dumpall -U postgres | gzip -c -9 --rsyncable > "${backupDir}/$(date --iso-8601)-dump.sql.gz"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      while [ $(ls -1 "${backupDir}" | wc -l) -gt ${toString rotations} ]; do
 | 
					 | 
				
			||||||
        rm $(find "${backupDir}" -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d' ' -f2)
 | 
					 | 
				
			||||||
      done
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      rsync -avz --delete "${backupDir}" '${rsyncTarget}'
 | 
					 | 
				
			||||||
    '';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    serviceConfig = {
 | 
					 | 
				
			||||||
      Type = "oneshot";
 | 
					 | 
				
			||||||
      User = "postgres";
 | 
					 | 
				
			||||||
      Group = "postgres";
 | 
					 | 
				
			||||||
      UMask = "0077";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      Nice = 19;
 | 
					 | 
				
			||||||
      IOSchedulingClass = "best-effort";
 | 
					 | 
				
			||||||
      IOSchedulingPriority = 7;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      ReadWritePaths = [
 | 
					 | 
				
			||||||
        backupDir
 | 
					 | 
				
			||||||
        "/data/backup/postgresql" # NOTE: should not be part of this option once rsyncTarget is remote
 | 
					 | 
				
			||||||
      ];
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    startAt = "*-*-* 01:15:00";
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  systemd.tmpfiles.settings."10-postgresql-backup".${backupDir}.d = {
 | 
					 | 
				
			||||||
    user = "postgres";
 | 
					 | 
				
			||||||
    group = "postgres";
 | 
					 | 
				
			||||||
    mode = "700";
 | 
					 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@
 | 
				
			|||||||
  imports = [
 | 
					  imports = [
 | 
				
			||||||
      # Include the results of the hardware scan.
 | 
					      # Include the results of the hardware scan.
 | 
				
			||||||
      ./hardware-configuration.nix
 | 
					      ./hardware-configuration.nix
 | 
				
			||||||
      ../../base
 | 
					      ../../base.nix
 | 
				
			||||||
      ../../misc/metrics-exporters.nix
 | 
					      ../../misc/metrics-exporters.nix
 | 
				
			||||||
      ./disks.nix
 | 
					      ./disks.nix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@
 | 
				
			|||||||
  imports = [
 | 
					  imports = [
 | 
				
			||||||
      # Include the results of the hardware scan.
 | 
					      # Include the results of the hardware scan.
 | 
				
			||||||
      ./hardware-configuration.nix
 | 
					      ./hardware-configuration.nix
 | 
				
			||||||
      ../../base
 | 
					      ../../base.nix
 | 
				
			||||||
      ../../misc/metrics-exporters.nix
 | 
					      ../../misc/metrics-exporters.nix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      ./services/grzegorz.nix
 | 
					      ./services/grzegorz.nix
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  imports = [
 | 
					  imports = [
 | 
				
			||||||
    ./hardware-configuration.nix
 | 
					    ./hardware-configuration.nix
 | 
				
			||||||
    ../../base
 | 
					    ../../base.nix
 | 
				
			||||||
    ../../misc/metrics-exporters.nix
 | 
					    ../../misc/metrics-exporters.nix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ./services/libvirt.nix
 | 
					    ./services/libvirt.nix
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@
 | 
				
			|||||||
  imports = [
 | 
					  imports = [
 | 
				
			||||||
      # Include the results of the hardware scan.
 | 
					      # Include the results of the hardware scan.
 | 
				
			||||||
      ./hardware-configuration.nix
 | 
					      ./hardware-configuration.nix
 | 
				
			||||||
      ../../base
 | 
					      ../../base.nix
 | 
				
			||||||
      ../../misc/metrics-exporters.nix
 | 
					      ../../misc/metrics-exporters.nix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      ../../modules/grzegorz.nix
 | 
					      ../../modules/grzegorz.nix
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@
 | 
				
			|||||||
  imports = [
 | 
					  imports = [
 | 
				
			||||||
      # Include the results of the hardware scan.
 | 
					      # Include the results of the hardware scan.
 | 
				
			||||||
      ./hardware-configuration.nix
 | 
					      ./hardware-configuration.nix
 | 
				
			||||||
      ../../base
 | 
					      ../../base.nix
 | 
				
			||||||
      ../../misc/metrics-exporters.nix
 | 
					      ../../misc/metrics-exporters.nix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      ./services/monitoring
 | 
					      ./services/monitoring
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										18
									
								
								hosts/ildkule/services/journald-remote.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								hosts/ildkule/services/journald-remote.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					{ ... }:
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  services.journald.remote = {
 | 
				
			||||||
 | 
					    enable = true;
 | 
				
			||||||
 | 
					    settings.Remote = {
 | 
				
			||||||
 | 
					      # ServerKeyFile = "/run/credentials/systemd-journald-remote.service/key.pem";
 | 
				
			||||||
 | 
					      # ServerCertificateFile = "/run/credentials/systemd-journald-remote.service/.pem";
 | 
				
			||||||
 | 
					      ServerKeyFile = "/etc/journald-remote-certs/key.pem";
 | 
				
			||||||
 | 
					      ServerCertificateFile = "/etc/journald-remote-certs/cert.pem";
 | 
				
			||||||
 | 
					      TrustedCertificateFile = "-";
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # systemd.services.systemd-journal-remote.serviceConfig.LoadCredential = [
 | 
				
			||||||
 | 
					  #   "key.pem:/etc/journald-remote-certs/key.pem"
 | 
				
			||||||
 | 
					  #   "cert.pem:/etc/journald-remote-certs/cert.pem"
 | 
				
			||||||
 | 
					  # ];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -3,7 +3,7 @@
 | 
				
			|||||||
  imports = [
 | 
					  imports = [
 | 
				
			||||||
      # Include the results of the hardware scan.
 | 
					      # Include the results of the hardware scan.
 | 
				
			||||||
      ./hardware-configuration.nix
 | 
					      ./hardware-configuration.nix
 | 
				
			||||||
      ../../base
 | 
					      ../../base.nix
 | 
				
			||||||
      ../../misc/metrics-exporters.nix
 | 
					      ../../misc/metrics-exporters.nix
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,6 +21,9 @@ in rec {
 | 
				
			|||||||
      ipv4 = pvv-ipv4 213;
 | 
					      ipv4 = pvv-ipv4 213;
 | 
				
			||||||
      ipv6 = pvv-ipv6 213;
 | 
					      ipv6 = pvv-ipv6 213;
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					    log-collector = {
 | 
				
			||||||
 | 
					      inherit (hosts.ildkule) ipv4 ipv6;
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  hosts = {
 | 
					  hosts = {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user