2020-02-11 16:41:00 +01:00
|
|
|
# This file configures nugget, my home desktop machine.
|
2020-02-21 13:47:29 +01:00
|
|
|
{ depot, lib, ... }:
|
2020-01-04 23:32:41 +01:00
|
|
|
|
|
|
|
config: let
|
2020-05-22 21:46:38 +02:00
|
|
|
nixpkgs = import depot.third_party.stableNixpkgsSrc {
|
2020-01-04 23:32:41 +01:00
|
|
|
config.allowUnfree = true;
|
|
|
|
};
|
2020-01-05 17:40:24 +01:00
|
|
|
|
2020-05-31 20:08:22 +02:00
|
|
|
unstable = import depot.third_party.nixpkgsSrc {};
|
2020-02-21 13:47:29 +01:00
|
|
|
lieer = (depot.third_party.lieer {});
|
2020-03-13 00:49:39 +01:00
|
|
|
|
|
|
|
# google-c-style is installed only on nugget because other
|
|
|
|
# machines get it from, eh, elsewhere.
|
|
|
|
nuggetEmacs = (depot.tools.emacs.overrideEmacs(epkgs: epkgs ++ [
|
|
|
|
depot.third_party.emacsPackages.google-c-style
|
|
|
|
]));
|
2020-02-21 13:47:29 +01:00
|
|
|
in depot.lib.fix(self: {
|
2020-02-11 01:55:46 +01:00
|
|
|
imports = [
|
2020-04-04 03:31:00 +02:00
|
|
|
../modules/v4l2loopback.nix
|
2020-02-11 01:55:46 +01:00
|
|
|
];
|
|
|
|
|
2020-01-04 23:32:41 +01:00
|
|
|
hardware = {
|
|
|
|
pulseaudio.enable = true;
|
|
|
|
cpu.intel.updateMicrocode = true;
|
2020-02-05 00:41:33 +01:00
|
|
|
u2f.enable = true;
|
2020-01-04 23:32:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
boot = {
|
|
|
|
cleanTmpDir = true;
|
|
|
|
kernelModules = [ "kvm-intel" ];
|
|
|
|
|
|
|
|
loader = {
|
|
|
|
timeout = 3;
|
|
|
|
systemd-boot.enable = true;
|
|
|
|
efi.canTouchEfiVariables = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
initrd = {
|
|
|
|
luks.devices.nugget-crypt.device = "/dev/disk/by-label/nugget-crypt";
|
|
|
|
availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
|
|
|
|
kernelModules = [ "dm-snapshot" ];
|
|
|
|
};
|
2020-05-24 18:32:48 +02:00
|
|
|
|
|
|
|
kernel.sysctl = {
|
|
|
|
"kernel.perf_event_paranoid" = 1;
|
|
|
|
};
|
2020-01-04 23:32:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nix = {
|
2020-05-17 21:49:44 +02:00
|
|
|
package = depot.third_party.nix;
|
2020-01-04 23:32:41 +01:00
|
|
|
nixPath = [
|
|
|
|
"depot=/home/tazjin/depot"
|
2020-02-21 13:47:29 +01:00
|
|
|
"nixpkgs=${depot.third_party.nixpkgsSrc}"
|
2020-01-04 23:32:41 +01:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
nixpkgs.pkgs = nixpkgs;
|
|
|
|
|
|
|
|
networking = {
|
|
|
|
hostName = "nugget";
|
|
|
|
useDHCP = false;
|
|
|
|
interfaces.eno1.useDHCP = true;
|
|
|
|
interfaces.wlp7s0.useDHCP = true;
|
|
|
|
|
|
|
|
# Don't use ISP's DNS servers:
|
|
|
|
nameservers = [
|
|
|
|
"8.8.8.8"
|
|
|
|
"8.8.4.4"
|
|
|
|
];
|
|
|
|
|
|
|
|
# Open Chromecast-related ports & servedir
|
2020-01-19 02:44:40 +01:00
|
|
|
firewall.enable = false;
|
2020-01-04 23:32:41 +01:00
|
|
|
firewall.allowedTCPPorts = [ 4242 5556 5558 ];
|
2020-01-19 02:44:40 +01:00
|
|
|
|
|
|
|
# Connect to the WiFi to let the Chromecast work.
|
|
|
|
wireless.enable = true;
|
|
|
|
wireless.networks = {
|
|
|
|
"How do I computer?" = {
|
|
|
|
psk = "washyourface";
|
|
|
|
};
|
|
|
|
};
|
2020-01-04 23:32:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
# Generate an immutable /etc/resolv.conf from the nameserver settings
|
|
|
|
# above (otherwise DHCP overwrites it):
|
2020-02-21 13:47:29 +01:00
|
|
|
environment.etc."resolv.conf" = with lib; {
|
|
|
|
source = depot.third_party.writeText "resolv.conf" ''
|
2020-01-04 23:32:41 +01:00
|
|
|
${concatStringsSep "\n" (map (ns: "nameserver ${ns}") self.networking.nameservers)}
|
|
|
|
options edns0
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
time.timeZone = "Europe/London";
|
|
|
|
|
|
|
|
environment.systemPackages =
|
|
|
|
# programs from the depot
|
2020-02-21 13:47:29 +01:00
|
|
|
(with depot; [
|
2020-04-26 16:52:23 +02:00
|
|
|
fun.idual.script
|
2020-01-05 17:40:24 +01:00
|
|
|
lieer
|
2020-03-13 00:49:39 +01:00
|
|
|
nuggetEmacs
|
2020-01-04 23:32:41 +01:00
|
|
|
ops.kontemplate
|
2020-04-04 03:32:32 +02:00
|
|
|
third_party.ffmpeg
|
2020-04-17 13:43:25 +02:00
|
|
|
third_party.git
|
2020-01-04 23:32:41 +01:00
|
|
|
]) ++
|
|
|
|
|
|
|
|
# programs from nixpkgs
|
|
|
|
(with nixpkgs; [
|
|
|
|
age
|
|
|
|
bat
|
2020-01-18 12:29:18 +01:00
|
|
|
cachix
|
2020-05-22 18:44:16 +02:00
|
|
|
chromium
|
2020-03-13 00:51:59 +01:00
|
|
|
clang-manpages
|
|
|
|
clang-tools
|
2020-05-22 19:29:47 +02:00
|
|
|
clang_10
|
2020-01-04 23:32:41 +01:00
|
|
|
curl
|
|
|
|
direnv
|
|
|
|
dnsutils
|
|
|
|
exa
|
|
|
|
fd
|
|
|
|
gnupg
|
|
|
|
go
|
2020-01-19 02:44:40 +01:00
|
|
|
google-chrome
|
2020-01-05 02:32:15 +01:00
|
|
|
google-cloud-sdk
|
2020-03-01 02:07:48 +01:00
|
|
|
guile
|
2020-01-04 23:32:41 +01:00
|
|
|
htop
|
2020-05-23 21:37:26 +02:00
|
|
|
hyperfine
|
2020-02-08 14:32:25 +01:00
|
|
|
i3lock
|
2020-01-05 02:32:15 +01:00
|
|
|
imagemagick
|
2020-01-04 23:32:41 +01:00
|
|
|
jq
|
2020-01-20 23:31:03 +01:00
|
|
|
keybase-gui
|
2020-01-05 02:32:15 +01:00
|
|
|
kubectl
|
2020-05-31 20:08:22 +02:00
|
|
|
linuxPackages.perf
|
2020-05-17 03:42:51 +02:00
|
|
|
meson
|
2020-01-19 19:56:44 +01:00
|
|
|
miller
|
2020-01-05 17:40:24 +01:00
|
|
|
msmtp
|
2020-01-07 23:26:01 +01:00
|
|
|
nix-prefetch-github
|
2020-01-04 23:32:41 +01:00
|
|
|
notmuch
|
|
|
|
openssh
|
|
|
|
openssl
|
|
|
|
pass
|
|
|
|
pavucontrol
|
|
|
|
pinentry
|
|
|
|
pinentry-emacs
|
|
|
|
pwgen
|
|
|
|
ripgrep
|
2020-05-23 21:37:26 +02:00
|
|
|
rr
|
2020-01-04 23:32:41 +01:00
|
|
|
rustup
|
2020-01-07 23:26:01 +01:00
|
|
|
sbcl
|
2020-01-05 02:32:15 +01:00
|
|
|
scrot
|
2020-01-04 23:32:41 +01:00
|
|
|
spotify
|
2020-04-11 14:31:06 +02:00
|
|
|
steam
|
2020-01-04 23:32:41 +01:00
|
|
|
tokei
|
|
|
|
tree
|
2020-01-25 21:39:54 +01:00
|
|
|
unzip
|
2020-01-04 23:32:41 +01:00
|
|
|
vlc
|
|
|
|
xclip
|
2020-02-06 00:03:47 +01:00
|
|
|
yubico-piv-tool
|
|
|
|
yubikey-personalization
|
2020-05-31 20:08:22 +02:00
|
|
|
]) ++
|
|
|
|
|
|
|
|
# programs from unstable nixpkgs
|
|
|
|
(with unstable; [
|
|
|
|
zoxide
|
2020-01-04 23:32:41 +01:00
|
|
|
]);
|
|
|
|
|
|
|
|
fileSystems = {
|
|
|
|
"/".device = "/dev/disk/by-label/nugget-root";
|
|
|
|
"/boot".device = "/dev/disk/by-label/EFI";
|
|
|
|
"/home".device = "/dev/disk/by-label/nugget-home";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Configure user account
|
|
|
|
users.extraUsers.tazjin = {
|
|
|
|
extraGroups = [ "wheel" "audio" ];
|
|
|
|
isNormalUser = true;
|
|
|
|
uid = 1000;
|
|
|
|
shell = nixpkgs.fish;
|
|
|
|
};
|
|
|
|
|
|
|
|
security.sudo = {
|
|
|
|
enable = true;
|
|
|
|
extraConfig = "wheel ALL=(ALL:ALL) SETENV: ALL";
|
|
|
|
};
|
|
|
|
|
|
|
|
fonts = {
|
|
|
|
fonts = with nixpkgs; [
|
|
|
|
corefonts
|
2020-01-19 17:38:32 +01:00
|
|
|
dejavu_fonts
|
|
|
|
jetbrains-mono
|
2020-01-04 23:32:41 +01:00
|
|
|
noto-fonts-cjk
|
|
|
|
noto-fonts-emoji
|
|
|
|
];
|
2020-01-19 17:38:32 +01:00
|
|
|
|
|
|
|
fontconfig = {
|
|
|
|
hinting.enable = true;
|
|
|
|
subpixel.lcdfilter = "light";
|
|
|
|
|
|
|
|
defaultFonts = {
|
|
|
|
monospace = [ "JetBrains Mono" ];
|
|
|
|
};
|
|
|
|
};
|
2020-01-04 23:32:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
# Configure location (Vauxhall, London) for services that need it.
|
|
|
|
location = {
|
|
|
|
latitude = 51.4819109;
|
|
|
|
longitude = -0.1252998;
|
|
|
|
};
|
|
|
|
|
|
|
|
programs.fish.enable = true;
|
2020-04-26 19:40:16 +02:00
|
|
|
programs.ssh.startAgent = true;
|
2020-01-04 23:32:41 +01:00
|
|
|
|
|
|
|
services.redshift.enable = true;
|
|
|
|
services.openssh.enable = true;
|
2020-01-20 23:31:03 +01:00
|
|
|
services.keybase.enable = true;
|
2020-01-04 23:32:41 +01:00
|
|
|
|
2020-02-06 00:03:47 +01:00
|
|
|
# Required for Yubikey usage as smartcard
|
|
|
|
services.pcscd.enable = true;
|
|
|
|
services.udev.packages = [
|
|
|
|
nixpkgs.yubikey-personalization
|
|
|
|
];
|
|
|
|
|
2020-01-04 23:32:41 +01:00
|
|
|
services.xserver = {
|
|
|
|
enable = true;
|
|
|
|
layout = "us";
|
|
|
|
xkbOptions = "caps:super";
|
|
|
|
exportConfiguration = true;
|
|
|
|
videoDrivers = [ "nvidia" ];
|
|
|
|
|
|
|
|
displayManager = {
|
|
|
|
# Give EXWM permission to control the session.
|
|
|
|
sessionCommands = "${nixpkgs.xorg.xhost}/bin/xhost +SI:localuser:$USER";
|
|
|
|
|
|
|
|
lightdm.enable = true;
|
|
|
|
lightdm.greeters.gtk.clock-format = "%H·%M";
|
|
|
|
};
|
|
|
|
|
2020-02-21 13:47:29 +01:00
|
|
|
windowManager.session = lib.singleton {
|
2020-01-04 23:32:41 +01:00
|
|
|
name = "exwm";
|
2020-03-13 00:49:39 +01:00
|
|
|
start = "${nuggetEmacs}/bin/tazjins-emacs";
|
2020-01-04 23:32:41 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Do not restart the display manager automatically
|
|
|
|
systemd.services.display-manager.restartIfChanged = lib.mkForce false;
|
|
|
|
|
2020-01-05 17:40:24 +01:00
|
|
|
# Configure email setup
|
|
|
|
systemd.user.services.lieer-tazjin = {
|
|
|
|
description = "Synchronise mail@tazj.in via lieer";
|
|
|
|
script = "${lieer}/bin/gmi sync";
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
WorkingDirectory = "%h/mail/account.tazjin";
|
|
|
|
Type = "oneshot";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.user.timers.lieer-tazjin = {
|
|
|
|
wantedBy = [ "timers.target" ];
|
|
|
|
|
|
|
|
timerConfig = {
|
|
|
|
OnActiveSec = "1";
|
|
|
|
OnUnitActiveSec = "180";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-02-11 01:55:46 +01:00
|
|
|
# Use Tailscale \o/
|
2020-04-04 14:16:39 +02:00
|
|
|
services.tailscale.enable = true;
|
2020-02-11 01:55:46 +01:00
|
|
|
|
2020-05-21 17:56:18 +02:00
|
|
|
# nugget has an SSD
|
|
|
|
services.fstrim.enable = true;
|
|
|
|
|
2020-05-22 19:06:14 +02:00
|
|
|
# clangd needs more than ~2GB in the runtime directory to start up
|
|
|
|
services.logind.extraConfig = ''
|
|
|
|
RuntimeDirectorySize=4G
|
|
|
|
'';
|
|
|
|
|
2020-01-04 23:32:41 +01:00
|
|
|
# ... and other nonsense.
|
|
|
|
system.stateVersion = "19.09";
|
|
|
|
})
|