summaryrefslogtreecommitdiff
path: root/nixos/lindy.nix
blob: 760b656437f43af1550fe60e6cbe2bb631650324 (plain) (blame)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
{ config, lib, pkgs, modulesPath, ... }:

{
  imports = [
    (modulesPath + "/installer/scan/not-detected.nix")
    ./common.nix
    ./kde.nix
    #./95theme.nix
    #./gnome.nix
    #./fdn-vpn.nix
  ];

  networking.hostName = "lindy";
  networking.hostId = "00000000";

  # ZFS config
  boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
  boot.supportedFilesystems = [ "zfs" ];
  boot.zfs.devNodes = "/dev/mapper";
  boot.zfs.extraPools = [ "Zonz" ];
  services.zfs.autoScrub.enable = true;
  services.zfs.autoScrub.pools = [ "Zonz" ];
  services.zfs.autoScrub.interval = "quarterly";

  # Use Grub
  boot.loader.grub.enable = true;
  boot.loader.grub.device = "nodev";
  boot.loader.grub.extraGrubInstallArgs = [ "--bootloader-id=NixOS" ];
  boot.loader.efi.efiSysMountPoint = "/boot/efi";
  boot.loader.efi.canTouchEfiVariables = true;

  boot.initrd.availableKernelModules =
    [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" ];
  boot.initrd.kernelModules = [ "dm-snapshot" ];
  boot.kernelModules = [ "kvm-intel" "wl" ];
  boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];

  boot.initrd.luks.devices = {
    cryptssd = {
      device = "/dev/disk/by-uuid/1b074a78-9116-420e-b872-7bf49ca10ce1";
      allowDiscards = true;
    };
  };

  environment.etc.crypttab = {
    enable = true;
    text = ''
Kurisu UUID=f593d307-66cc-4586-a899-f1ca20d74430 /root/kurisu_key
Kogami UUID=61534c91-df18-4c71-9244-54e677f5d4fa /root/kogami_key
    '';
  };

  fileSystems."/" = {
    device = "/dev/disk/by-uuid/2e64e6fc-ab7c-4620-b56b-faee641bd2a6";
    fsType = "ext4";
    options = [ "discard" ];
  };

  fileSystems."/home" = {
    device = "/dev/disk/by-uuid/1ef4b6f4-975d-4e04-9d88-0640e83ed0b4";
    fsType = "ext4";
    options = [ "discard" ];
  };

  fileSystems."/boot" = {
    device = "/dev/disk/by-uuid/0728e7e5-8e21-44bd-9287-eb066d489a0e";
    fsType = "ext4";
    options = [ "discard" ];
  };

  fileSystems."/boot/efi" = {
    device = "/dev/disk/by-uuid/02D0-F1C6";
    fsType = "vfat";
  };

  swapDevices =
    [{ device = "/dev/disk/by-uuid/5950785a-9793-4d04-b791-8f4dbc497ec3"; }];

  users.users.lx.home = "/home/lx.nix";

  # Backup
  services.cron.enable = true;
  services.cron.systemCronJobs = [ "0 20 * * * root /media/Zonz/lindy/do-backup.sh" ];

  # Nvidia graphics
  boot.kernelParams = [ "i915.modeset=0" ];
  hardware.nvidia.modesetting.enable = true;
  services.xserver.videoDrivers = [ "nvidia" ];
  hardware.opengl.enable = true;

  # Docker, VirtualBox
  virtualisation.docker.enable = true;
  virtualisation.virtualbox.host.enable = true;
  users.users.lx.extraGroups = [ "docker" "vboxusers" ];

  # Making dev work available outside
  networking.firewall.allowedTCPPorts = [
    8910
    8920
  ];

  # GnuPG agent at system level, if at home level conflicts with arch
  programs.gnupg.agent = {
    enable = true;
    enableSSHSupport = false;
  };

  environment.systemPackages = with pkgs; [ zfs docker-compose ];

  nix.gc.automatic = false;

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
  hardware.cpu.intel.updateMicrocode =
    lib.mkDefault config.hardware.enableRedistributableFirmware;
}