summary refs log tree commit diff
path: root/hosts/vps/cfg.nix
blob: a8159eab2481e384e2db00de52d37c5824ba5519 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{config, lib, pkgs, ...}: {
  imports = [
    ../../profiles/core.nix
    ../../profiles/user.nix
    ../../profiles/ssh.nix
    ../../mixins/tailscale.nix
    ../../mixins/cli.nix
    ./website.nix
    ./git.nix
  ];

  config = {
    _module.args.nixinate = {
      host = "vps";
      sshUser = "tzlil";
      buildOn = "remote"; # valid args are "local" or "remote"
      substituteOnTarget = true; # if buildOn is "local" then it will substitute on the target, "-s"
      hermetic = false;
    };

    networking.hostName = "vps";
    
    boot = {
      kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
      kernelParams = [
        "init_on_free=1"
        "page_poison=1"
        "page_alloc.shuffle=1"
        "slab_nomerge"
        "vsyscall=none"
      ];
      cleanTmpDir = true;
      loader.grub.device = "/dev/vda";
      initrd = {
        availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ];
        kernelModules = [];
      };
      kernelModules = [];
      extraModulePackages = [];
    };

    networking.interfaces.ens3.useDHCP = lib.mkDefault true;

    nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
    hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
    virtualisation.hypervGuest.enable = true;

    time.timeZone = lib.mkDefault "Frankfurt";

    fileSystems = {
      "/" = {
        device = "none";
        fsType = "tmpfs";
        options = ["noexec" "defaults" "size=2G" "mode=755"];
      };
      "/nix" = {
        device = "/dev/disk/by-uuid/e4c4735d-bfdd-477f-bc43-d07510cb6a9a";
        fsType = "btrfs";
      };
      "/boot" = {
        device = "/dev/disk/by-uuid/7ea63707-099d-4c21-90eb-a51bfa6d8ba5";
        fsType = "ext4";
      };
    };

    swapDevices = [ { device = "/dev/disk/by-uuid/00eb2d2e-4d7c-4e95-804d-e9ecb22679d4"; } ];

    zramSwap = {
      enable = true;
      algorithm = "zstd";
    };
  };
}