2021-04-29 12:16:49 +00:00
|
|
|
# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2022-01-23 16:57:20 +00:00
|
|
|
{ depot, lib, pkgs, config, ... }:
|
2021-04-29 12:16:49 +00:00
|
|
|
let
|
|
|
|
inherit (depot.ops) secrets;
|
|
|
|
in {
|
|
|
|
imports = [
|
|
|
|
../lib/zfs.nix
|
2021-05-05 21:13:27 +00:00
|
|
|
../lib/graphical-client-wayland.nix
|
2021-04-29 12:16:49 +00:00
|
|
|
../lib/whitby-distributed.nix
|
|
|
|
];
|
|
|
|
|
|
|
|
boot.initrd.availableKernelModules = [
|
|
|
|
"xhci_pci"
|
|
|
|
"ahci"
|
|
|
|
"nvme"
|
|
|
|
"usbhid"
|
|
|
|
"usb_storage"
|
|
|
|
"sd_mod"
|
|
|
|
"rtsx_pci_sdmmc"
|
|
|
|
];
|
|
|
|
boot.kernelModules = [ "kvm-intel" ];
|
2021-05-05 20:48:17 +00:00
|
|
|
boot.kernelParams = [ "button.lid_init_state=open" ];
|
2021-04-29 12:16:49 +00:00
|
|
|
boot.supportedFilesystems = [ "ntfs" ];
|
|
|
|
boot.kernel.sysctl = {
|
|
|
|
"abi.vsyscall32" = "0";
|
|
|
|
};
|
|
|
|
|
2021-05-05 00:01:34 +00:00
|
|
|
my.ip.tailscale = "100.84.64.91";
|
2021-04-29 12:16:49 +00:00
|
|
|
my.rundeck.expectedOnline = false;
|
|
|
|
|
|
|
|
fileSystems = let
|
|
|
|
zfs = device: {
|
|
|
|
device = device;
|
|
|
|
fsType = "zfs";
|
|
|
|
};
|
|
|
|
in {
|
|
|
|
"/" = zfs "zpool/local/root";
|
|
|
|
"/nix" = zfs "zpool/local/nix";
|
|
|
|
"/tmp" = zfs "zpool/local/tmp";
|
|
|
|
|
|
|
|
"/var" = zfs "zpool/safe/var";
|
|
|
|
"/home" = zfs "zpool/safe/home";
|
|
|
|
"/persist" = zfs "zpool/safe/persist";
|
|
|
|
|
|
|
|
"/boot" = {
|
|
|
|
device = "/dev/disk/by-label/NIXBOOT";
|
|
|
|
fsType = "vfat";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-01-30 20:30:20 +00:00
|
|
|
nix.settings.max-jobs = lib.mkDefault 12;
|
2021-04-29 12:16:49 +00:00
|
|
|
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
|
|
|
hardware.enableRedistributableFirmware = true;
|
|
|
|
|
|
|
|
# Laptop, don't autodeploy.
|
|
|
|
my.deploy.enable = false;
|
|
|
|
|
|
|
|
# Use the systemd-boot EFI boot loader.
|
|
|
|
boot.loader.systemd-boot.enable = true;
|
|
|
|
boot.loader.efi.canTouchEfiVariables = true;
|
|
|
|
|
|
|
|
# ZFS!
|
|
|
|
services.zfs.rollbackOnBoot.enable = true;
|
|
|
|
|
|
|
|
# Enable libvirtd.
|
2022-08-14 20:01:26 +00:00
|
|
|
virtualisation.libvirtd.enable = true;
|
|
|
|
security.polkit.enable = true;
|
2021-04-29 12:16:49 +00:00
|
|
|
|
|
|
|
networking.hostName = "howl";
|
2024-01-27 22:57:47 +00:00
|
|
|
networking.domain = "int.as205479.net";
|
2021-04-29 12:16:49 +00:00
|
|
|
networking.hostId = "cdd51451";
|
|
|
|
|
|
|
|
# Boot faster.
|
|
|
|
systemd.services.systemd-udev-settle.enable = false;
|
|
|
|
systemd.services.NetworkManager-wait-online.enable = false;
|
|
|
|
|
2021-05-05 00:04:30 +00:00
|
|
|
networking.dhcpcd.enable = false;
|
2021-04-29 12:16:49 +00:00
|
|
|
networking.networkmanager.enable = true;
|
|
|
|
|
|
|
|
# Set your time zone.
|
|
|
|
time.timeZone = "Europe/London";
|
|
|
|
|
|
|
|
# List packages installed in system profile. To search, run:
|
|
|
|
# $ nix search wget
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
pciutils
|
|
|
|
deluge
|
|
|
|
];
|
|
|
|
|
|
|
|
# Enable the X11 windowing system.
|
2021-05-05 21:13:27 +00:00
|
|
|
programs.sway = {
|
2021-04-29 12:16:49 +00:00
|
|
|
enable = true;
|
2021-05-05 21:13:27 +00:00
|
|
|
wrapperFeatures.gtk = true;
|
2021-04-29 12:16:49 +00:00
|
|
|
};
|
2021-05-05 21:13:27 +00:00
|
|
|
services.xserver.enable = true;
|
|
|
|
services.xserver.displayManager.gdm.enable = true;
|
2021-04-29 12:16:49 +00:00
|
|
|
|
2024-07-03 19:32:37 +00:00
|
|
|
hardware.graphics.enable32Bit = true;
|
|
|
|
hardware.graphics.extraPackages = with pkgs; [
|
2021-04-29 12:16:49 +00:00
|
|
|
intel-media-driver vaapiVdpau libvdpau-va-gl libva
|
|
|
|
];
|
2024-07-03 19:32:37 +00:00
|
|
|
hardware.graphics.extraPackages32 = with pkgs.pkgsi686Linux; [ libva ];
|
2021-04-29 12:16:49 +00:00
|
|
|
hardware.acpilight.enable = true;
|
|
|
|
|
|
|
|
# Define a user account.
|
|
|
|
users.users.lukegb = {
|
|
|
|
extraGroups = [ "wheel" "networkmanager" "libvirtd" "video" ];
|
|
|
|
};
|
|
|
|
my.home-manager.system = {...}: {
|
|
|
|
home.packages = lib.mkAfter (with pkgs; [
|
|
|
|
steam
|
|
|
|
(writeScriptBin "javaws" ''
|
|
|
|
#!/bin/sh
|
|
|
|
exec ${depot.nix.pkgs.javaws-env}/bin/javaws-env "$@"
|
|
|
|
'')
|
|
|
|
factorio-experimental
|
|
|
|
(depot.nix.pkgs.secretsync.configure {
|
|
|
|
workingDir = "/home/lukegb/depot";
|
|
|
|
gitlabAccessToken = secrets.deployer.gitlabAccessToken;
|
|
|
|
manifestVariable = "SECRETS_MANIFEST";
|
|
|
|
variablesToFile = {
|
|
|
|
"OPS_SECRETS_DEFAULT_NIX" = "ops/secrets/default.nix";
|
|
|
|
};
|
|
|
|
})
|
|
|
|
efibootmgr
|
|
|
|
iw
|
|
|
|
obs-studio
|
|
|
|
vulkan-tools
|
|
|
|
]);
|
|
|
|
};
|
|
|
|
|
|
|
|
# Things to persist.
|
|
|
|
services.openssh.hostKeys = [
|
|
|
|
{
|
|
|
|
path = "/persist/etc/ssh/ssh_host_ed25519_key";
|
|
|
|
type = "ed25519";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
path = "/persist/etc/ssh/ssh_host_rsa_key";
|
|
|
|
type = "rsa";
|
|
|
|
bits = 4096;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
systemd.tmpfiles.rules = [
|
|
|
|
"d /var/lib/libvirt 0755 root - - -"
|
|
|
|
];
|
|
|
|
systemd.mounts = let
|
|
|
|
bindMount' = dir: {
|
|
|
|
unitConfig.RequiresMountsFor = dir;
|
|
|
|
options = "bind";
|
|
|
|
what = "/persist${dir}";
|
|
|
|
where = dir;
|
|
|
|
};
|
|
|
|
bindMountSvc = dir: svc: (bindMount' dir) // {
|
2022-11-13 19:37:02 +00:00
|
|
|
requiredBy = [svc];
|
2021-04-29 12:16:49 +00:00
|
|
|
};
|
|
|
|
bindMount = dir: (bindMount' dir) // {
|
|
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
};
|
|
|
|
in [
|
|
|
|
(bindMountSvc "/var/lib/libvirt" "libvirtd.service")
|
2022-09-18 16:53:02 +00:00
|
|
|
(bindMountSvc "/etc/NetworkManager/system-connections" "NetworkManager.service")
|
2021-04-29 12:16:49 +00:00
|
|
|
(bindMount "/root")
|
|
|
|
];
|
|
|
|
|
|
|
|
# Enable Thunderbolt device management.
|
|
|
|
services.hardware.bolt.enable = true;
|
|
|
|
|
2021-12-31 04:47:53 +00:00
|
|
|
hardware.bluetooth = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
|
2021-04-29 12:16:49 +00:00
|
|
|
nix.buildMachines = [ {
|
|
|
|
hostName = "totoro";
|
|
|
|
system = "x86_64-linux";
|
|
|
|
maxJobs = 4;
|
|
|
|
speedFactor = 2;
|
|
|
|
supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
|
|
|
|
mandatoryFeatures = [ ];
|
|
|
|
}];
|
|
|
|
|
2022-01-01 15:08:52 +00:00
|
|
|
my.scrapeJournal.enable = false; # Laptop, don't pull too much.
|
|
|
|
|
2023-01-08 05:44:13 +00:00
|
|
|
services.redis.servers."".enable = true;
|
|
|
|
systemd.services.redis.wantedBy = lib.mkForce [];
|
|
|
|
services.postgresql.enable = true;
|
|
|
|
systemd.services.postgresql.wantedBy = lib.mkForce [];
|
|
|
|
services.postgresql.ensureDatabases = [ "lukegb" ];
|
|
|
|
services.postgresql.ensureUsers = [{
|
|
|
|
name = "lukegb";
|
|
|
|
}];
|
|
|
|
services.postgresql.authentication = ''
|
|
|
|
local all all trust
|
|
|
|
host all all 127.0.0.1/32 trust
|
|
|
|
host all all ::1/128 trust
|
|
|
|
'';
|
|
|
|
|
2021-04-29 12:16:49 +00:00
|
|
|
# This value determines the NixOS release with which your system is to be
|
|
|
|
# compatible, in order to avoid breaking some software such as database
|
|
|
|
# servers. You should change this only after NixOS release notes say you
|
|
|
|
# should.
|
2024-01-01 17:13:44 +00:00
|
|
|
system.stateVersion = "23.11"; # Did you read the comment?
|
2021-04-29 12:16:49 +00:00
|
|
|
}
|