diff options
Diffstat (limited to 'hosts')
-rw-r--r-- | hosts/disko.nix | 17 | ||||
-rw-r--r-- | hosts/pc/cfg.nix | 62 | ||||
-rw-r--r-- | hosts/vm/cfg.nix | 14 | ||||
-rw-r--r-- | hosts/vps/cfg.nix | 15 | ||||
-rw-r--r-- | hosts/vps/git.nix | 62 | ||||
-rw-r--r-- | hosts/vps/matrix.nix | 37 | ||||
-rw-r--r-- | hosts/vps/website.nix | 8 |
7 files changed, 126 insertions, 89 deletions
diff --git a/hosts/disko.nix b/hosts/disko.nix index 4808edd..26d1849 100644 --- a/hosts/disko.nix +++ b/hosts/disko.nix @@ -1,5 +1,9 @@ # Example to create a bios compatible gpt partition -{ lib, disks, ... }: { +{ + lib, + disks, + ... +}: { disk = lib.genAttrs disks (dev: { device = dev; type = "disk"; @@ -29,7 +33,7 @@ extraArgs = "-f"; # Override existing partition subvolumes = { "/" = { - mountOptions = ["noatime" "compress=zstd"]; + mountOptions = ["noatime" "compress=zstd"]; }; }; }; @@ -37,13 +41,16 @@ ]; }; }); - + nodev = { "/" = { fsType = "tmpfs"; mountOptions = [ - "noexec" "defaults" "size=2G" "mode=755" + "noexec" + "defaults" + "size=2G" + "mode=755" ]; }; }; -} \ No newline at end of file +} diff --git a/hosts/pc/cfg.nix b/hosts/pc/cfg.nix index 10267b5..aaf624c 100644 --- a/hosts/pc/cfg.nix +++ b/hosts/pc/cfg.nix @@ -1,4 +1,9 @@ -{config, lib, pkgs, ...}: { +{ + config, + lib, + pkgs, + ... +}: { imports = [ ../../profiles/core.nix ../../profiles/user.nix @@ -21,13 +26,12 @@ }; networking.hostName = "pc"; - boot = { initrd = { supportedFilesystems = ["btrfs"]; - availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" ]; + availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid"]; }; - kernelModules = [ "kvm-amd" ]; + kernelModules = ["kvm-amd"]; kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; kernelParams = [ "console=ttyS0" @@ -52,33 +56,33 @@ time.timeZone = lib.mkDefault "Israel"; fileSystems = { - "/" = - { device = "/dev/disk/by-uuid/3fe7d38b-bb95-41ca-afce-1b0b89cbcd8b"; - fsType = "btrfs"; - options = [ "subvol=root" ]; - }; + "/" = { + device = "/dev/disk/by-uuid/3fe7d38b-bb95-41ca-afce-1b0b89cbcd8b"; + fsType = "btrfs"; + options = ["subvol=root"]; + }; - "/nix" = - { device = "/dev/disk/by-uuid/3fe7d38b-bb95-41ca-afce-1b0b89cbcd8b"; - fsType = "btrfs"; - options = [ "subvol=nix" ]; - }; + "/nix" = { + device = "/dev/disk/by-uuid/3fe7d38b-bb95-41ca-afce-1b0b89cbcd8b"; + fsType = "btrfs"; + options = ["subvol=nix"]; + }; - "/home" = - { device = "/dev/disk/by-uuid/3fe7d38b-bb95-41ca-afce-1b0b89cbcd8b"; - fsType = "btrfs"; - options = [ "subvol=home" ]; - }; + "/home" = { + device = "/dev/disk/by-uuid/3fe7d38b-bb95-41ca-afce-1b0b89cbcd8b"; + fsType = "btrfs"; + options = ["subvol=home"]; + }; - "/swap" = - { device = "/dev/disk/by-uuid/3fe7d38b-bb95-41ca-afce-1b0b89cbcd8b"; - fsType = "btrfs"; - options = [ "subvol=swap" ]; - }; - "/boot" = - { device = "/dev/disk/by-uuid/D999-2D99"; - fsType = "vfat"; - }; + "/swap" = { + device = "/dev/disk/by-uuid/3fe7d38b-bb95-41ca-afce-1b0b89cbcd8b"; + fsType = "btrfs"; + options = ["subvol=swap"]; + }; + "/boot" = { + device = "/dev/disk/by-uuid/D999-2D99"; + fsType = "vfat"; + }; }; zramSwap = { @@ -90,4 +94,4 @@ hardware.video.hidpi.enable = lib.mkDefault true; # greeter.initialSession = "sh -c hyprland"; }; -} \ No newline at end of file +} diff --git a/hosts/vm/cfg.nix b/hosts/vm/cfg.nix index f9907e4..9fb84ee 100644 --- a/hosts/vm/cfg.nix +++ b/hosts/vm/cfg.nix @@ -1,4 +1,10 @@ -{config, lib, pkgs, modulesPath, ...}: { +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { imports = [ ../../profiles/core.nix ../../profiles/user.nix @@ -24,12 +30,12 @@ # dont do this users.users.root.initialPassword = "hunter2"; - + boot.supportedFilesystems = ["9p"]; boot = { initrd = { supportedFilesystems = ["btrfs"]; - availableKernelModules = [ "ata_piix" "uhci_hcd" "floppy" "sd_mod" "sr_mod" ]; + availableKernelModules = ["ata_piix" "uhci_hcd" "floppy" "sd_mod" "sr_mod"]; }; kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; kernelParams = [ @@ -76,4 +82,4 @@ greeter.initialSession = "env WLR_RENDERER=pixman sh -c ${pkgs.sway}/bin/sway"; }; -} \ No newline at end of file +} diff --git a/hosts/vps/cfg.nix b/hosts/vps/cfg.nix index a8159ea..3c7787b 100644 --- a/hosts/vps/cfg.nix +++ b/hosts/vps/cfg.nix @@ -1,4 +1,9 @@ -{config, lib, pkgs, ...}: { +{ + config, + lib, + pkgs, + ... +}: { imports = [ ../../profiles/core.nix ../../profiles/user.nix @@ -19,7 +24,7 @@ }; networking.hostName = "vps"; - + boot = { kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; kernelParams = [ @@ -32,7 +37,7 @@ cleanTmpDir = true; loader.grub.device = "/dev/vda"; initrd = { - availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ]; + availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk"]; kernelModules = []; }; kernelModules = []; @@ -63,11 +68,11 @@ }; }; - swapDevices = [ { device = "/dev/disk/by-uuid/00eb2d2e-4d7c-4e95-804d-e9ecb22679d4"; } ]; + swapDevices = [{device = "/dev/disk/by-uuid/00eb2d2e-4d7c-4e95-804d-e9ecb22679d4";}]; zramSwap = { enable = true; algorithm = "zstd"; }; }; -} \ No newline at end of file +} diff --git a/hosts/vps/git.nix b/hosts/vps/git.nix index fcf8cfb..9d50865 100644 --- a/hosts/vps/git.nix +++ b/hosts/vps/git.nix @@ -1,6 +1,8 @@ -{ pkgs, config, ... }: - { + pkgs, + config, + ... +}: { config = { users.groups.git = {}; users.users.git = { @@ -19,46 +21,52 @@ caddy = { virtualHosts."http://100.67.217.90".extraConfig = '' bind 100.67.217.90 - handle /cgit.png { + handle /cgit.png { root * ${pkgs.cgit}/cgit file_server } - handle /cgit.css { + handle /cgit.css { root * ${pkgs.cgit}/cgit file_server } - handle /favicon.ico { + handle /favicon.ico { root * ${pkgs.cgit}/cgit file_server } handle { - reverse_proxy unix//run/fcgiwrap.sock { + reverse_proxy unix//run/fcgiwrap.sock { transport fastcgi { env SCRIPT_FILENAME ${pkgs.cgit}/cgit/cgit.cgi - env CGIT_CONFIG ${pkgs.writeText "cgitrc" (pkgs.lib.generators.toKeyValue { } { - css = "/cgit.css"; - logo = "/cgit.png"; - favicon = "/favicon.ico"; - clone-url = (pkgs.lib.concatStringsSep " " [ - "http://$HTTP_HOST$SCRIPT_NAME/$CGIT_REPO_URL" - "ssh://git@git.example.com:$CGIT_REPO_URL" - ]); - enable-log-filecount = 1; - enable-log-linecount = 1; - enable-git-config = 1; - root-title = "git.example.com"; - root-desc = "Tzlil's Git Repositories"; - scan-path = "/home/git"; - about-filter = "${pkgs.cgit}/lib/cgit/filters/about-formatting.sh"; - source-filter = "${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py"; - logo-link = "/"; - })} - } + env CGIT_CONFIG ${pkgs.writeText "cgitrc" (pkgs.lib.generators.toKeyValue {} { + css = "/cgit.css"; + logo = "/cgit.png"; + favicon = "/favicon.ico"; + clone-url = pkgs.lib.concatStringsSep " " [ + "http://$HTTP_HOST$SCRIPT_NAME/$CGIT_REPO_URL" + "ssh://git@git.example.com:$CGIT_REPO_URL" + ]; + enable-log-filecount = 1; + enable-log-linecount = 1; + enable-git-config = 1; + root-title = "git.example.com"; + root-desc = "Tzlil's Git Repositories"; + scan-path = "/home/git"; + about-filter = "${pkgs.cgit}/lib/cgit/filters/about-formatting.sh"; + source-filter = "${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py"; + logo-link = "/"; + })} + } } } ''; }; }; - environment.persistence."/nix/persist".directories = [ { directory = "/home/git"; user = "git"; group = "git"; } ]; + environment.persistence."/nix/persist".directories = [ + { + directory = "/home/git"; + user = "git"; + group = "git"; + } + ]; }; -} \ No newline at end of file +} diff --git a/hosts/vps/matrix.nix b/hosts/vps/matrix.nix index cb13326..2d606b0 100644 --- a/hosts/vps/matrix.nix +++ b/hosts/vps/matrix.nix @@ -1,23 +1,28 @@ -{ pkgs, config, ... }: - { + pkgs, + config, + ... +}: { config = { services.matrix-synapse = { - enable = true; - settings.server_name = config.networking.domain; - settings.listeners = [ - { port = 8008; - bind_addresses = [ "::1" ]; - type = "http"; - tls = false; - x_forwarded = true; - resources = [ { - names = [ "client" "federation" ]; + enable = true; + settings.server_name = config.networking.domain; + settings.listeners = [ + { + port = 8008; + bind_addresses = ["::1"]; + type = "http"; + tls = false; + x_forwarded = true; + resources = [ + { + names = ["client" "federation"]; compress = true; - } ]; - } - ]; + } + ]; + } + ]; }; networking.firewall.allowedTCPPorts = [80 443]; }; -} \ No newline at end of file +} diff --git a/hosts/vps/website.nix b/hosts/vps/website.nix index 9dc9fc7..fd7f71c 100644 --- a/hosts/vps/website.nix +++ b/hosts/vps/website.nix @@ -1,6 +1,8 @@ -{ pkgs, config, ... }: - { + pkgs, + config, + ... +}: { config = { services.caddy = { enable = true; @@ -14,4 +16,4 @@ }; networking.firewall.allowedTCPPorts = [80 443]; }; -} \ No newline at end of file +} |