aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/roots/uwu.nix
blob: 0eab77ff8d3b656e2f1b9eebe19bca24acbf9482 (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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/* TOP LEVEL DEVICE CONFIGURATION FOR
 * 
 *    uwu (Thinkpad X230)
 *
 * This file only contains settings that are specific to this one
 * device (hardware and things outside of nix, like partitions).
 *
 * This file is part of LIBKOOKIE, a collection of nix expressions.
 * LIBKOOKIE is licensed under the GPL-3.0 (or later) -- see LICENSE
 */

{ lib, config, pkgs, ... } @ args:

let klib = (import <modules/harness/lib.nix> args);
in
{

  ###################################################################
  #                    libkookie configuration
  #
  #
  #

  imports = with klib; [
    # Load base modules required to bootstrap libkookie
    <home-manager/nixos> <modules> <configuration/nix>

    
    #################################################################
    # Modules that require NixOS integration
    #
    <configuration/workstation/fonts>
    <configuration/workstation/printing>
    <configuration/workstation/xkblayout>
    
    <configuration/workstation/yubikey>
    <configuration/workstation/gpg>

    # TODO: build a beter loader
    <configuration/workstation/net/uwu.nix>
    <configuration/workstation/time/local.nix>

    
    #################################################################
    # home-manager modules that exist entirely in userspace
    #
    (loadModule <configuration/base> "default")

    # Set of base tools and system settings
    (loadModule <configuration/workstation/i3> "uwu")
    (loadModule <configuration/workstation/audio> "default")
    (loadModule <configuration/workstation/kitty> "uwu")
    (loadModule <configuration/workstation/office> "default")
    (loadModule <configuration/workstation/mail> "default")
    (loadModule <configuration/workstation/firefox> "default")
    (loadModule <configuration/workstation/redshift> "default")
    (loadModule <configuration/workstation/syncthing> "default")

    (loadModule <configuration/workstation/devel> "default")

    # Various other graphical tools
    (loadModule <configuration/workstation/pass> "default")
    (loadModule <configuration/workstation/chat> "default")
    (loadModule <configuration/workstation/music> "default")
    (loadModule <configuration/workstation/games> "default")
    (loadModule <configuration/workstation/creative> "default")
  ];

  # Configure i3 with the amdgpu driver
  libkookie.ui.i3 = { enable = true; videoDrivers = [ "intel" ]; };

  # Configure audio
  libkookie.audio = { enable = true; discovery = true; };
  
  # Enable fish shell handling on the system
  libkookie.base.fish.enable = true;

  # Configure mail handling
  libkookie.workstation.mail = {
    enable = true;
    configPath = ../ext/mail;
    mailArchive = "/home/office/mail";
    access = { user = "spacekookie"; group = "spacekookie"; };
  };
  
  # Enable desired users
  libkookie.activeUsers = [ (klib.load <configuration/users/spacekookie>) ];

  #
  #
  #
  #
  ###################################################################

  ###################################################################
  #                    nixos base system options
  #
  #
  #
  
  boot.kernelModules = [ "kvm-intel" ];
  boot.initrd.availableKernelModules =
    [ "xhci_pci" "ehci_pci" "ahci" "sd_mod" "sdhci_pci" "i915" ];
  hardware.enableRedistributableFirmware = true;
  
  boot.loader.grub = {
    copyKernels = true;
    device = "/dev/disk/by-id/wwn-0x5002538f7080fa2a";
    zfsSupport = true;
    enableCryptodisk = true;
    splashImage = ../configuration/grub-splash.png;
    gfxmodeBios = "1366x768";
    extraConfig = ''
      GRUB_TIMEOUT=10
    '';
  };

  boot.extraModprobeConfig = "options kvm_item nested=1";
  boot.zfs.devNodes = "/dev"; # FIXME: Why do I set this?
  boot.cleanTmpDir = true;
  boot.tmpOnTmpfs = true;
  boot.supportedFilesystems = [ "zfs" "exfat" ];

  services.zfs.autoSnapshot.enable = true;
  
  fileSystems."/" = {
    device = "zroot";
    fsType = "zfs";

    encrypted = {
      enable = true;
      label = "lvm";
      blkDev = "/dev/disk/by-uuid/f1440abd-99e3-46a8-aa36-7824972fee54";
    };
  };

  fileSystems."/boot" = {
    device = "/dev/disk/by-uuid/672c497c-18aa-4b00-ac95-78e810363d81";
    fsType = "ext3";
  };

  swapDevices = [
    { device = "/dev/disk/by-uuid/bd3d5c22-eed0-4371-ae25-456b8dfe9356"; }
  ];

  nix.maxJobs = lib.mkDefault 4;
  powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
  
  # owo
  networking.wireguard.interfaces."intranet" = {
    ips = [ "10.13.12.3" ];
    privateKeyFile = "/var/lib/wg/private";
    peers = [
      { publicKey = "ugHG/NOqM/9hde9EmWpu7XsCpjT3WQbjLK99IGHtdjQ=";
        allowedIPs = [ "10.13.12.0/24" "10.172.171.0/24" ];
        endpoint = "hyperion.kookie.space:51820";
        persistentKeepalive = 25; }
    ];
  };

  system.stateVersion = "19.03";
  users.users.spacekookie.hashedPassword = "$6$rounds=1000000$22ypycQ2AlCCv8iC$RrzyAbCX3D518nCgfR3MTqZhfK.GAclme7EQlKTlqH4oV1YvGd/aHdTfe59iMpf/J18tqEO2aSXsevTVQz2yW.";  
}