diff options
| author | vin <vin@vineetk.net> | 2025-03-02 00:22:49 -0500 |
|---|---|---|
| committer | vin <vin@vineetk.net> | 2025-03-02 00:28:07 -0500 |
| commit | 8e9f0c9b1128dada690f8abfc757e40bbeca600c (patch) | |
| tree | 70b3fa2c8c1f47bc2a27babd20ddc2b6a76665a5 | |
| parent | b72feb8761088dc48b690ad704a3714f30084d81 (diff) | |
add saklas host, mail/webserver vps
| -rw-r--r-- | flake.nix | 8 | ||||
| -rw-r--r-- | hosts/saklas/default.nix | 144 | ||||
| -rw-r--r-- | hosts/saklas/hardware.nix | 12 |
3 files changed, 164 insertions, 0 deletions
| @@ -54,6 +54,14 @@ | |||
| 54 | } | 54 | } |
| 55 | ]; | 55 | ]; |
| 56 | }; | 56 | }; |
| 57 | |||
| 58 | saklas = nixpkgs.lib.nixosSystem { | ||
| 59 | system = "x86_64-linux"; | ||
| 60 | specialArgs = inputs; | ||
| 61 | modules = [ | ||
| 62 | ./hosts/saklas | ||
| 63 | ]; | ||
| 64 | }; | ||
| 57 | }; | 65 | }; |
| 58 | }; | 66 | }; |
| 59 | } | 67 | } |
diff --git a/hosts/saklas/default.nix b/hosts/saklas/default.nix new file mode 100644 index 0000000..0c50167 --- /dev/null +++ b/hosts/saklas/default.nix | |||
| @@ -0,0 +1,144 @@ | |||
| 1 | { config, lib, pkgs, inputs, ... }: | ||
| 2 | |||
| 3 | { | ||
| 4 | imports = [ | ||
| 5 | ./hardware.nix | ||
| 6 | ]; | ||
| 7 | |||
| 8 | # disable wifi and open some ports | ||
| 9 | networking = { | ||
| 10 | hostName = "saklas"; | ||
| 11 | hostId = "b0bababe"; | ||
| 12 | |||
| 13 | wireless.enable = false; | ||
| 14 | |||
| 15 | firewall = { | ||
| 16 | allowedTCPPorts = [ 22 80 443 ]; | ||
| 17 | allowedUDPPorts = [ 51413 ]; | ||
| 18 | }; | ||
| 19 | }; | ||
| 20 | |||
| 21 | # Set your time zone. | ||
| 22 | time.timeZone = "America/Toronto"; | ||
| 23 | |||
| 24 | # Select internationalisation properties. | ||
| 25 | i18n.defaultLocale = "en_US.UTF-8"; | ||
| 26 | console = { | ||
| 27 | font = "Lat2-Terminus16"; | ||
| 28 | }; | ||
| 29 | |||
| 30 | # enable flakes and nix cli | ||
| 31 | nix.settings.experimental-features = [ "nix-command" "flakes" ]; | ||
| 32 | |||
| 33 | # Define a user account. | ||
| 34 | users.users.vin = { | ||
| 35 | isNormalUser = true; | ||
| 36 | |||
| 37 | extraGroups = [ | ||
| 38 | "wheel" | ||
| 39 | ]; | ||
| 40 | |||
| 41 | shell = pkgs.zsh; | ||
| 42 | |||
| 43 | openssh.authorizedKeys.keys = [ | ||
| 44 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEvM0xCLziR+ZT/SYE1aZM6dklbw4fEC17TWqbADIZRH kou@demiurge" | ||
| 45 | ]; | ||
| 46 | }; | ||
| 47 | |||
| 48 | # default packages for both me and root | ||
| 49 | environment = { | ||
| 50 | systemPackages = with pkgs; [ | ||
| 51 | doas-sudo-shim | ||
| 52 | emacs | ||
| 53 | git | ||
| 54 | wget | ||
| 55 | ]; | ||
| 56 | |||
| 57 | pathsToLink = [ "/share/zsh" ]; | ||
| 58 | }; | ||
| 59 | |||
| 60 | programs = { | ||
| 61 | # disable nano. I don't like nano. | ||
| 62 | nano.enable = false; | ||
| 63 | |||
| 64 | # configuration in home-manager | ||
| 65 | zsh.enable = true; | ||
| 66 | zsh.promptInit = "PS1='$ '"; | ||
| 67 | }; | ||
| 68 | |||
| 69 | security = { | ||
| 70 | acme = { | ||
| 71 | acceptTerms = true; | ||
| 72 | defaults.email = "me@vineetk.net"; | ||
| 73 | defaults.server = "https://acme-v02.api.letsencrypt.org/directory"; | ||
| 74 | }; | ||
| 75 | |||
| 76 | # I prefer doas over sudo for simplicity | ||
| 77 | doas = { | ||
| 78 | enable = true; | ||
| 79 | extraRules = [{ | ||
| 80 | users = [ "vin" ]; | ||
| 81 | keepEnv = true; | ||
| 82 | persist = true; | ||
| 83 | }]; | ||
| 84 | }; | ||
| 85 | |||
| 86 | sudo.enable = false; | ||
| 87 | }; | ||
| 88 | |||
| 89 | services = { | ||
| 90 | # reverse proxy | ||
| 91 | nginx = { | ||
| 92 | enable = true; | ||
| 93 | |||
| 94 | recommendedGzipSettings = true; | ||
| 95 | recommendedOptimisation = true; | ||
| 96 | recommendedProxySettings = true; | ||
| 97 | recommendedTlsSettings = true; | ||
| 98 | |||
| 99 | /* | ||
| 100 | virtualHosts = { | ||
| 101 | "vineetk.net" = { | ||
| 102 | enableACME = true; | ||
| 103 | forceSSL = true; | ||
| 104 | locations."/".proxyPass = "http://127.0.0.1:8081"; | ||
| 105 | }; | ||
| 106 | |||
| 107 | "vinbiz.ca" = { | ||
| 108 | enableACME = true; | ||
| 109 | forceSSL = true; | ||
| 110 | locations."/".proxyPass = "http://127.0.0.1:8082"; | ||
| 111 | }; | ||
| 112 | |||
| 113 | "13f0.net" = { | ||
| 114 | enableACME = true; | ||
| 115 | forceSSL = true; | ||
| 116 | locations."/".proxyPass = "http://127.0.0.1:4533"; | ||
| 117 | }; | ||
| 118 | }; | ||
| 119 | */ | ||
| 120 | }; | ||
| 121 | |||
| 122 | # ssh | ||
| 123 | openssh = { | ||
| 124 | enable = true; | ||
| 125 | |||
| 126 | settings = { | ||
| 127 | KbdInteractiveAuthentication = false; | ||
| 128 | PasswordAuthentication = false; | ||
| 129 | PermitRootLogin = "no"; | ||
| 130 | X11Forwarding = true; | ||
| 131 | }; | ||
| 132 | }; | ||
| 133 | }; | ||
| 134 | |||
| 135 | # create caches and use mandoc | ||
| 136 | documentation.man = { | ||
| 137 | enable = true; | ||
| 138 | generateCaches = true; | ||
| 139 | man-db.enable = false; | ||
| 140 | mandoc.enable = true; | ||
| 141 | }; | ||
| 142 | |||
| 143 | system.stateVersion = "24.11"; | ||
| 144 | } | ||
diff --git a/hosts/saklas/hardware.nix b/hosts/saklas/hardware.nix new file mode 100644 index 0000000..e8b9e8e --- /dev/null +++ b/hosts/saklas/hardware.nix | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | { modulesPath, ... }: | ||
| 2 | |||
| 3 | { | ||
| 4 | imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; | ||
| 5 | |||
| 6 | boot.loader.grub.device = "/dev/sda"; | ||
| 7 | |||
| 8 | fileSystems."/" = { | ||
| 9 | device = "/dev/sda1"; | ||
| 10 | fsType = "ext4"; | ||
| 11 | }; | ||
| 12 | } | ||
