From 5ec5b22f68095874f1bf7144b21474f32dea4755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?cel=20=F0=9F=8C=B8?= Date: Sun, 23 Jul 2023 13:24:38 +0100 Subject: [PATCH] configuration --- hua.nix | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 hua.nix diff --git a/hua.nix b/hua.nix new file mode 100644 index 0000000..491f77e --- /dev/null +++ b/hua.nix @@ -0,0 +1,105 @@ +{ config, pkgs, lib, ... }: + +let + release = "nixos-23.05"; +in { + imports = + [ + ./hardware-configuration.nix + (builtins.fetchTarball { + url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/${release}/nixos-mailserver-${release}.tar.gz"; + # This hash needs to be updated + sha256 = "1i56llz037x416bw698v8j6arvv622qc0vsycd20lx3yx8n77n44"; + }) + ]; + + ## grub + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + boot.loader.grub.device = "/dev/vda"; + + ## networking + systemd.network.enable = true; + networking.hostName = "hua"; + + networking.interfaces.ens3.ipv4.addresses = [ { + address = "89.147.110.32"; + prefixLength = 24; + } ]; + + networking.defaultGateway = "89.147.110.1"; + # networking.nameservers = [ "9.9.9.9" "149.112.112.112" ]; + networking.nameservers = [ "93.95.224.28" "93.95.224.29" ]; + + ## time + time.timeZone = "Europe/London"; + + ## users + users.users.emilis = { + isNormalUser = true; + home = "/home/emilis"; + extraGroups = [ "wheel" ]; + # packages = with pkgs; [ + # firefox + # thunderbird + # ]; + openssh.authorizedKeys.keys = [ + "public-key-here" + ]; + }; + users.users.cel = { + isNormalUser = true; + home = "/home/cel"; + extraGroups = [ "wheel" ]; + # packages = with pkgs; [ + # firefox + # thunderbird + # ]; + openssh.authorizedKeys.keys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCz+UymES/Ki9/ugCh8/S9fpD0Gf9oarx0xwVK7JIBWfaoGQt505JLjff2w8yI/uEi4QEaGk70g1Tkx0SX4VVOkTo4PdGdehGhrn1sDm6muo5CHGtH9jjBAMia5fLBtmQgRZsmqYnmm7C02I8JRAqCcwpTSqr1sSfoPXyEzyAdCMpDRGbO5nvK1K1ctOrFQRXu52Tq3gZ4fEwXeZkgV1zGT4t1qAUlfW9B3U++hHGk3XrrPq6n98tntPLI0uqN0K2xStMkymVOzQH2NM+vr2wLRmYtlQuy3IBZv2t6Al14ZvgzmzELgqDDj2FNEIptK4trfQvIKFcGMUj/O3EnZZ5HoBPc8b+5qYYHR+9tm8hJokoU0DlWF6DH9iv1863Mu3EUO79euTPZml1l/P7SdLRhWP4EyUvb5jN9mnKzQnPhz/iQLBxfEaXFxPkM2tUaQafJvPi2hlRqTnofVMgp1ktxd19RY5mB3X5jzZFtOtrDA6sdttFuKo+1L/WHrVq0sGTR5/aJIN5AJL+kDSHuTANY2euNJKKKvElQYyugsNnDzENUK59ictpnmtH+CZITTJxdlJLN43hi+OwXoEznnI6zc4dsc+3SV5K7+KdXqLquxqxmZZGP8JPnxJrspS18ycacIMYRFgLexFIS34qNCerazVX1CwXFXOsYF7V2ZY4SJIw== openpgp:0xDDB3D176" + ]; + }; + + security.sudo.wheelNeedsPassword = false; + + ## autoupgrade + system.autoUpgrade.enable = true; + system.autoUpgrade.allowReboot = true; + + ## packages + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = [ + pkgs.helix + pkgs.wget + pkgs.git + ]; + + # ssh + services.openssh.enable = true; + services.openssh.permitRootLogin = "no"; + services.openssh.passwordAuthentication = false; + + # mail + mailserver = { + enable = true; + fqdn = "mail.jigglypuff.club"; + domains = [ "puff.place" "cum.skin" ]; + + # A list of all login accounts. To create the password hashes, use + # nix-shell -p mkpasswd --run 'mkpasswd -sm bcrypt' + loginAccounts = { + "emilis@puff.place" = { + hashedPasswordFile = "/etc/nixos/mailserver/emilis@puff.place"; + aliases = ["postmaster@puff.place" "postmaster@cum.skin"]; + }; + "touch@cum.skin" = { + hashedPasswordFile = "/etc/nixos/mailserver/touch@cum.skin"; + }; + }; + + # Use Let's Encrypt certificates. Note that this needs to set up a stripped + # down nginx and opens port 80. + certificateScheme = "acme-nginx"; + }; +}