]> gitweb.ps.run Git - flake_server/blobdiff - configuration.nix
update config
[flake_server] / configuration.nix
index 9bfd10cb1f7c97a86ada6c08054e7f0fffd8e79c..01186454723e1c4a1c378933f45ac2c95ec98ff0 100644 (file)
@@ -2,7 +2,7 @@
 # your system. Help is available in the configuration.nix(5) man page, on
 # https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
 
-{ config, lib, pkgs, ... } @ args:
+{ config, lib, pkgs, inputs, ... } @ args:
 
 {
   imports =
@@ -19,7 +19,7 @@
   # boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
 
   nix.settings.experimental-features = [ "nix-command" "flakes" ];
-  nix.package = pkgs.nixVersions.nix_2_28;
+  nix.settings.download-buffer-size = 500000000;
 
   nix.gc = {
     automatic = true;
     sudo.wheelNeedsPassword = false;
   };
 
-  # nixpkgs.config.allowUnfree = true;
+  nixpkgs.config.allowUnfree = true;
+
+  nixpkgs.overlays = [
+    (inputs.psch-flakes.overlays.cgit)
+  ];
 
   # List packages installed in system profile. To search, run:
   # $ nix search wget
     senc = "sudo ${pkgs.helix}/bin/hx /etc/nixos/configuration.nix";
   };
 
+  # git-hooks
+  system.activationScripts.githook =
+    let
+      githooksRepo = pkgs.fetchgit {
+        url = "git://psch.dev/git-hooks";
+        rev = "1a40e097c8854d5a0e65c070addaa7e3337635c0";
+        hash = "sha256-KNKnP/3hhQQlildzRF+skYHtV+7Xg1MQMPi2DDEHGAI=";
+      };
+    in
+    {
+    text = ''
+      PATH=$PATH:${lib.makeBinPath [ pkgs.git pkgs.sudo pkgs.python3 ]} sudo -u git ${githooksRepo}/git-hooks/post-receive
+    '';
+  };
+
   # git
   users.users.git = {
     isSystemUser = true;
   # virtualisation.qemu.guestAgent.enable = true;
   programs.mosh.enable = true;
 
-
   services.caddy = {
     enable = true;
+
+    virtualHosts."tnx.sh".extraConfig = ''
+      respond "The Website is under Construction."
+    '';
     virtualHosts."psch.dev".extraConfig = ''
       basic_auth /julius_cam/* { test $2a$14$iKv0GlwavCunG0zQbaf2fOl4r4/8k8gDKUVUouu9Q3o.MfSDkp6Te }
       root * /srv/www
         request_buffers 8192
       }
     '';
+    virtualHosts."mail.psch.dev".extraConfig = ''
+      respond mail
+    '';
   };
   services.caddy.virtualHosts."git.psch.dev".extraConfig = ''
     encode gzip zstd
             snapshots=tar tar.gz zip
             enable-git-config=1
             enable-index-owner=0
+            enable-log-filecount=1
+            enable-log-linecount=1
             section-from-path=1
             virtual-root=/
             module-link=/%s/commit/?id=%s
             clone-url=https://git.psch.dev/$CGIT_REPO_URL git://psch.dev/$CGIT_REPO_URL ssh://git@psch.dev/~/$CGIT_REPO_URL
             noplainemail=1
             side-by-side-diffs=1
+            repository-sort=age
             about-filter=${pkgs.writeShellScript "markdown-filter" ''
               echo '<div class="markdown-body">'
               ${pkgs.md4c}/bin/md2html --github --ftables
     };
   };
 
+  # Mail Server
+  mailserver = {
+    enable = true;
+    # stateVersion = 1;
+    fqdn = "mail.psch.dev";
+    domains = [ "psch.dev" ];
+
+    # A list of all login accounts. To create the password hashes, use
+    # nix-shell -p mkpasswd --run 'mkpasswd -sm bcrypt'
+    loginAccounts = {
+      "ps@psch.dev" = {
+        hashedPassword = "$2b$05$dd65mMjWxZNc.MK4YUwLgeRMInJHvwNTazptImrw4paRqyX/p4TQG";
+        aliases = ["p@psch.dev" "patrick@psch.dev"];
+      };
+    };
+
+    certificateScheme = "manual";
+    certificateFile = "/var/lib/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/mail.psch.dev/mail.psch.dev.crt";
+    keyFile = "/var/lib/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/mail.psch.dev/mail.psch.dev.key";
+  };
+  # security.acme.acceptTerms = true;
+  # security.acme.defaults.email = "patrick.schoenberger@posteo.de";
+
   # 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.