summaryrefslogtreecommitdiff
path: root/installer/default.nix
blob: cd1ee064f5f3f848156f6a42594240344eacd390 (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
{ flake, config, pkgs, lib, ... }:

with lib;

{
  imports = with flake.nixosModules.systemProfiles; [
    default-locale zfs bcachefs networkmanager openssh
  ];

  config = {
    boot.initrd.availableKernelModules = [ "e1000e" ];

    hardware.cpu.amd.updateMicrocode = config.hardware.enableRedistributableFirmware;

    networking = {
      firewall.enable = false;
      nftables = {
        enable = true;
        rulesetFile = ./ruleset.nft;
      };
    };
    users.groups."networkmanager".members = [ "nixos" ];

    services.openssh = {
      enable = true;
      staticHostKeys = false;
    };

    services.qemuGuest.enable = true;

    environment.systemPackages = with pkgs; [
      nvme-cli iotop pciutils bottom

      cudatoolkit
    ];

    zramSwap.enable = true;

    users.defaultUserShell = pkgs.zsh;
    programs = {
      mosh.enable = true;
      tmux.enable = true;
      zsh.enable = true;
    };

    # nvidia
    services.xserver.videoDrivers = [ "nvidia" ];
    systemd.services.nvidia-control-devices = {
      wantedBy = [ "multi-user.target" ];
      serviceConfig.ExecStart = "${pkgs.linuxPackages.nvidia_x11.bin}/bin/nvidia-smi";
    };
    nixpkgs.externalConfig.allowUnfree = true;

    nix.settings.auto-allocate-uids = mkForce false;

    services.getty.autologinUser = lib.mkForce null;

    system.disableInstallerTools = false;

    systemd.sysusers.enable = false;
    system.machine-id.generate.enable = false;
    system.stateVersion = config.system.nixos.release; # No state in installer
  };
}