summary refs log tree commit diff
path: root/host/Rory-desktop/configuration.nix
blob: dae5f4431afce502aafd53959c0f925e4bf76cdf (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
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
args@{
  config,
  pkgs,
  lib,
  nhekoSrc,
  mtxclientSrc,
  ...
}:

{
  imports = [
    # base imports
    ../../modules/base-client.nix
    # (import ../../modules/base-secrets.nix {  path = "/home/rory/.config/sops/config.yaml"; })
    ../../modules/packages/vim.nix
    #      ../../modules/environments/home.nix
    #    ../../modules/software-templates/profilers.nix
    ./postgres.nix
    ./nginx.nix

    # hardware-specific imports
    ./optional/hardware-specific/amd.nix

    ./optional/gui/x11.nix
    ./optional/gui/wayland.nix

    #./printing.nix
    #./ollama.nix
  ];

  boot = {
    kernelPackages = pkgs.linuxPackages_latest;
    loader = {
      grub = {
        enable = true;
        device = "nodev"; # nodev for EFI only
        # EFI
        efiSupport = true;
        efiInstallAsRemovable = true;
      };
    };
    kernelPatches = [
      {
        # FIXME: https://gitlab.freedesktop.org/drm/amd/-/issues/3437
        name = "drm-amd-3437-hack";
        patch = ./hacks/drm-amd-3437.patch;
      }
    ];

    #readOnlyNixStore = false;
  };
  programs.noisetorch.enable = true;

  environment.sessionVariables = {
    ZSH_DISABLE_COMPFIX = "true";
  };

  services.udev.extraRules = ''
    #SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0664", GROUP="users"
    # SDP protocol
    KERNEL=="hidraw*", ATTRS{idVendor}=="1fc9", MODE="0666"
    ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="1fc9", MODE="0666"
    ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0d28", MODE="0666"
    # Flashloader
    KERNEL=="hidraw*", ATTRS{idVendor}=="15a2", MODE="0666"
    # Controller
    KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="18d1", MODE="0666"
    SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="9400", MODE="0660", TAG+="uaccess"
  '';

  networking = {
    hostName = "Rory-desktop";
    networkmanager.enable = true;
    wireless.enable = false;
    firewall = {
      enable = false;
      # allowedTCPPorts = [ ... ];
      # allowedUDPPorts = [ ... ];
    };

    interfaces.enp34s0.ipv4.addresses = [
      {
        address = "192.168.0.3";
        prefixLength = 24;
      }
    ];

    defaultGateway = "192.168.0.1";
    # useDHCP = true;
  };

  time.timeZone = "Europe/Brussels";
  i18n.defaultLocale = "en_US.UTF-8";

  services = {
    xserver = {
      displayManager.gdm.enable = true;
      displayManager.lightdm.enable = false;
      enable = true;
      updateDbusEnvironment = true;
      xkb.layout = "us";
      wacom.enable = true;
    };
    libinput.enable = true;

    openssh = {
      enable = true;
      extraConfig = ''
        MaxAuthTries 32
      '';
      settings.PermitRootLogin = "yes";
    };
    pipewire = {
      enable = true;
      audio.enable = true;
      pulse.enable = true;
      wireplumber.enable = true;
      jack.enable = true;
      alsa.enable = true;
    };
  };

  environment.systemPackages = with pkgs; [
    libreoffice
    qt6.qtwayland

    gnome-console
    feh
    easyeffects
    kitty
    youtube-music

    # - IDEs
    #jetbrains-toolbox
    jetbrains.rider
    #jetbrains.webstorm
    #jetbrains.clion
    github-copilot-intellij-agent

    dbeaver-bin
    #insomnia
    vscode

    # - Utilities
    inkscape-with-extensions
    gimp

    # - Languages
    dotnet-sdk_8

    #games
    osu-lazer-bin
    #steam
    steam-run
    steam-acf

    # extra packages
    dmenu

    nemo
    file-roller
    firefox-bin
    #ungoogled-chromium #needed for Rider in order to debug WASM

    #yuzu-early-access
    wineWowPackages.unstableFull
    winetricks
    #fragments
    peek

    unrar-wrapper

    #(schildichat-desktop.override { electron = electron; })
    (callPackage ../../modules/packages/nheko-git.nix {
      inherit nhekoSrc;
      inherit mtxclientSrc;
      voipSupport = false;
    })
    #(callPackage ../../modules/packages/mc/server/modpack/curseforge/techopolis-2/5.4.nix { })

    #vesktop
    virt-viewer

    # (dwarf-fortress-packages.dwarf-fortress-full.override { enableStoneSense = true; enableFPS = true; theme = dwarf-fortress-packages.themes.spacefox; })
    mangohud
    prismlauncher
  ];

  programs.steam.enable = true;
  programs.steam.gamescopeSession.enable = true;
  virtualisation.waydroid.enable = true;

  xdg = {
    portal = {

      enable = true;
      extraPortals = with pkgs; [
        #xdg-desktop-portal-gtk
        xdg-desktop-portal-xapp
        (callPackage ../../modules/packages/xdg-desktop-portal-gtk.nix { })
      ];
      config = {
        common = {
          default = [ "gtk" ];
        };
      };
      xdgOpenUsePortal = true;
      #gtkUsePortal = true; # deprecated

    };
    #sounds.enable = true;
    #mime.enable = true;
    #menus.enable = true;
    #icons.enable = true;
    #autostart.enable = true;
  };
  fonts = {
    packages = with pkgs; [
      (nerdfonts.override { fonts = [ "JetBrainsMono" ]; })
      noto-fonts-monochrome-emoji
    ];
    fontconfig.defaultFonts.monospace = with pkgs; [ "JetBrainsMonoNL Nerd Font,JetBrainsMonoNL NF:style=Regular" ];
    fontconfig.defaultFonts.sansSerif = with pkgs; [ "JetBrainsMonoNL Nerd Font,JetBrainsMonoNL NF:style=Regular" ];
    fontconfig.defaultFonts.serif = with pkgs; [ "JetBrainsMonoNL Nerd Font,JetBrainsMonoNL NF:style=Regular" ];
    fontconfig.defaultFonts.emoji = with pkgs; [ "freefont" ];
    enableDefaultPackages = lib.mkForce false;
    enableGhostscriptFonts = lib.mkForce false;
  };

  nixpkgs = {
    config = {
      allowUnfree = true;
      permittedInsecurePackages = [
        "electron-25.9.0"
        "olm-3.2.16"
      ];
    };

  };
  security = {
    polkit.enable = true;
    sudo.wheelNeedsPassword = false;
  };

  hardware = {
    pulseaudio.enable = false;
  };
  programs.dconf.enable = true;
  environment.etc."resolv.conf".text = ''
    nameserver 8.8.8.8
    nameserver 8.4.4.8
    nameserver 1.1.1.1
    nameserver 1.0.0.1
  '';

  #networking.wireguard.interfaces = {
  #  wg-KP-Ran = {

  #};
  # };

  virtualisation.libvirtd.enable = true;
  programs.virt-manager.enable = true;

  monitoring = {
    monitorAll = true;
    localPrometheus = true;
    exposePrometheus = true;
    localGrafana = true;
    exposeGrafana = true;
    nginxHost = "monitoring.localhost";
    nginxSsl = false;
  };
  networking.hosts."127.0.0.1" = builtins.attrNames config.services.nginx.virtualHosts;
  

  system.stateVersion = "22.11"; # DO NOT EDIT!
}