2021-04-10 18:05:16 +02:00
|
|
|
{ depot, lib, pkgs, ... }:
|
2021-03-21 00:48:27 +01:00
|
|
|
|
|
|
|
config: let
|
2021-04-10 18:05:16 +02:00
|
|
|
quasselClient = pkgs.quassel.override {
|
2021-03-21 00:48:27 +01:00
|
|
|
client = true;
|
|
|
|
enableDaemon = false;
|
|
|
|
monolithic = false;
|
|
|
|
};
|
2021-03-23 21:08:01 +01:00
|
|
|
|
|
|
|
# Use a screen lock command that resets the keyboard layout
|
|
|
|
# before locking, to avoid locking me out when the layout is
|
|
|
|
# in Russian.
|
2021-04-19 23:58:11 +02:00
|
|
|
screenLock = pkgs.writeShellScriptBin "tazjin-screen-lock" ''
|
|
|
|
${pkgs.xorg.setxkbmap}/bin/setxkbmap us
|
|
|
|
${pkgs.xorg.setxkbmap}/bin/setxkbmap -option caps:super
|
|
|
|
exec ${pkgs.xsecurelock}/bin/xsecurelock
|
2021-03-23 21:08:01 +01:00
|
|
|
'';
|
2021-03-21 00:48:27 +01:00
|
|
|
in lib.fix(self: {
|
2021-03-21 01:36:56 +01:00
|
|
|
imports = [
|
|
|
|
"${depot.third_party.impermanence}/nixos.nix"
|
2021-04-19 23:58:11 +02:00
|
|
|
"${pkgs.home-manager.src}/nixos"
|
2021-03-21 01:36:56 +01:00
|
|
|
];
|
|
|
|
|
2021-12-15 23:44:37 +01:00
|
|
|
tvl.cache.enable = true;
|
2021-03-23 00:14:10 +01:00
|
|
|
|
2021-12-06 11:58:13 +01:00
|
|
|
boot = rec {
|
2021-03-21 00:48:27 +01:00
|
|
|
initrd.availableKernelModules = [ "nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
|
|
|
|
initrd.kernelModules = [ ];
|
2021-03-21 03:21:16 +01:00
|
|
|
|
|
|
|
# Restore /home to the blank snapshot, erasing all ephemeral data.
|
|
|
|
initrd.postDeviceCommands = lib.mkAfter ''
|
|
|
|
zfs rollback -r zpool/ephemeral/home@tazjin-clean
|
|
|
|
'';
|
|
|
|
|
2021-12-06 11:58:13 +01:00
|
|
|
# Install thinkpad modules for TLP
|
|
|
|
extraModulePackages = [ kernelPackages.acpi_call ];
|
|
|
|
|
2021-04-17 15:53:36 +02:00
|
|
|
kernelModules = [ "kvm-amd" "i2c_dev" ];
|
2021-04-19 23:58:11 +02:00
|
|
|
kernelPackages = pkgs.linuxPackages_latest;
|
2021-03-21 00:48:27 +01:00
|
|
|
loader.systemd-boot.enable = true;
|
|
|
|
loader.efi.canTouchEfiVariables = true;
|
2021-06-02 22:32:41 +02:00
|
|
|
zfs.enableUnstable = true;
|
2021-03-21 00:48:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems = {
|
|
|
|
"/" = {
|
|
|
|
device = "tmpfs";
|
|
|
|
fsType = "tmpfs";
|
2021-12-17 11:33:06 +01:00
|
|
|
options = [ "defaults" "size=8G" "mode=755" ];
|
2021-03-21 00:48:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
"/home" = {
|
|
|
|
device = "zpool/ephemeral/home";
|
|
|
|
fsType = "zfs";
|
|
|
|
};
|
|
|
|
|
|
|
|
"/nix" = {
|
|
|
|
device = "zpool/local/nix";
|
|
|
|
fsType = "zfs";
|
|
|
|
};
|
|
|
|
|
|
|
|
"/depot" = {
|
|
|
|
device = "zpool/safe/depot";
|
|
|
|
fsType = "zfs";
|
|
|
|
};
|
|
|
|
|
|
|
|
"/persist" = {
|
|
|
|
device = "zpool/safe/persist";
|
|
|
|
fsType = "zfs";
|
2021-03-21 01:36:56 +01:00
|
|
|
neededForBoot = true;
|
2021-03-21 00:48:27 +01:00
|
|
|
};
|
|
|
|
|
2021-04-04 15:05:56 +02:00
|
|
|
# SD card
|
|
|
|
"/mnt" = {
|
|
|
|
device = "/dev/disk/by-uuid/c602d703-f1b9-4a44-9e45-94dfe24bdaa8";
|
|
|
|
fsType = "ext4";
|
|
|
|
};
|
|
|
|
|
2021-03-21 00:48:27 +01:00
|
|
|
"/boot" = {
|
|
|
|
device = "/dev/disk/by-uuid/BF4F-388B";
|
|
|
|
fsType = "vfat";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
hardware = {
|
|
|
|
cpu.amd.updateMicrocode = true;
|
|
|
|
enableRedistributableFirmware = true;
|
|
|
|
bluetooth.enable = true;
|
2021-10-10 00:51:37 +02:00
|
|
|
|
|
|
|
opengl = {
|
|
|
|
enable = true;
|
|
|
|
extraPackages = with pkgs; [
|
|
|
|
vaapiVdpau
|
|
|
|
libvdpau-va-gl
|
|
|
|
];
|
|
|
|
};
|
2021-03-21 00:48:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
networking = {
|
|
|
|
hostName = "tverskoy";
|
|
|
|
hostId = "3c91827f";
|
2021-04-09 22:45:00 +02:00
|
|
|
domain = "tvl.su";
|
2021-03-21 00:48:27 +01:00
|
|
|
useDHCP = false;
|
|
|
|
networkmanager.enable = true;
|
2021-03-30 00:15:44 +02:00
|
|
|
firewall.enable = false;
|
2021-03-21 00:48:27 +01:00
|
|
|
|
|
|
|
nameservers = [
|
|
|
|
"8.8.8.8"
|
|
|
|
"8.8.4.4"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
fonts = {
|
2021-04-19 23:58:11 +02:00
|
|
|
fonts = with pkgs; [
|
2021-03-21 00:48:27 +01:00
|
|
|
corefonts
|
|
|
|
dejavu_fonts
|
|
|
|
jetbrains-mono
|
|
|
|
noto-fonts-cjk
|
|
|
|
noto-fonts-emoji
|
|
|
|
];
|
|
|
|
|
|
|
|
fontconfig = {
|
|
|
|
hinting.enable = true;
|
|
|
|
subpixel.lcdfilter = "light";
|
|
|
|
|
|
|
|
defaultFonts = {
|
|
|
|
monospace = [ "JetBrains Mono" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-03-21 01:36:56 +01:00
|
|
|
environment.persistence."/persist" = {
|
|
|
|
directories = [
|
2021-03-21 17:17:41 +01:00
|
|
|
"/etc/NetworkManager/system-connections"
|
2021-07-20 09:54:27 +02:00
|
|
|
"/etc/mullvad-vpn"
|
2021-03-21 17:17:41 +01:00
|
|
|
"/var/cache/mullvad-vpn"
|
2021-03-21 01:36:56 +01:00
|
|
|
"/var/lib/bluetooth"
|
|
|
|
"/var/lib/systemd/coredump"
|
2021-03-21 17:17:41 +01:00
|
|
|
"/var/log"
|
2021-03-21 01:36:56 +01:00
|
|
|
];
|
|
|
|
files = [
|
|
|
|
"/etc/machine-id"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2021-03-21 00:48:27 +01:00
|
|
|
security.rtkit.enable = true;
|
2021-03-21 04:27:11 +01:00
|
|
|
|
2021-03-21 00:48:27 +01:00
|
|
|
services = {
|
|
|
|
pipewire = {
|
|
|
|
enable = true;
|
|
|
|
alsa.enable = true;
|
|
|
|
pulse.enable = true;
|
|
|
|
};
|
|
|
|
|
2021-03-21 04:05:27 +01:00
|
|
|
redshift.enable = true;
|
2021-03-21 00:48:27 +01:00
|
|
|
blueman.enable = true;
|
2021-03-21 04:27:11 +01:00
|
|
|
mullvad-vpn.enable = true;
|
2021-06-21 16:42:32 +02:00
|
|
|
fwupd.enable = true;
|
2021-10-08 12:04:16 +02:00
|
|
|
printing.enable = true;
|
2021-03-21 00:48:27 +01:00
|
|
|
|
2021-04-17 15:53:36 +02:00
|
|
|
# expose i2c device as /dev/i2c-amdgpu-dm and make it user-accessible
|
2021-11-27 18:56:05 +01:00
|
|
|
# this is required for sending control commands to the Dasung screen.
|
2021-04-17 15:53:36 +02:00
|
|
|
udev.extraRules = ''
|
|
|
|
SUBSYSTEM=="i2c-dev", ACTION=="add", DEVPATH=="/devices/pci0000:00/0000:00:08.1/0000:06:00.0/i2c-5/i2c-dev/i2c-5", SYMLINK+="i2c-amdgpu-dm", TAG+="uaccess"
|
|
|
|
'';
|
|
|
|
|
2021-12-06 11:58:13 +01:00
|
|
|
# Configure TLP to keep battery charge between 40-70% while
|
|
|
|
# plugged in to the wall (thanks etu for the recommendation).
|
|
|
|
tlp = {
|
|
|
|
enable = true;
|
|
|
|
settings.START_CHARGE_THRESH_BAT0 = 40;
|
|
|
|
settings.STOP_CHARGE_THRESH_BAT0 = 70;
|
|
|
|
};
|
|
|
|
|
2021-03-21 00:48:27 +01:00
|
|
|
xserver = {
|
|
|
|
enable = true;
|
|
|
|
layout = "us";
|
|
|
|
xkbOptions = "caps:super";
|
|
|
|
videoDrivers = [ "amdgpu" ];
|
|
|
|
|
|
|
|
libinput.enable = true;
|
|
|
|
|
|
|
|
displayManager = {
|
|
|
|
# Give EXWM permission to control the session.
|
2021-04-19 23:58:11 +02:00
|
|
|
sessionCommands = "${pkgs.xorg.xhost}/bin/xhost +SI:localuser:$USER";
|
2021-03-21 00:48:27 +01:00
|
|
|
lightdm.enable = true;
|
|
|
|
# lightdm.greeters.gtk.clock-format = "%H:%M"; # TODO(tazjin): TZ?
|
|
|
|
};
|
|
|
|
|
|
|
|
windowManager.session = lib.singleton {
|
|
|
|
name = "exwm";
|
2021-04-14 12:36:05 +02:00
|
|
|
start = "${depot.users.tazjin.emacs}/bin/tazjins-emacs";
|
2021-03-21 00:48:27 +01:00
|
|
|
};
|
|
|
|
};
|
2021-09-10 13:34:10 +02:00
|
|
|
|
|
|
|
# Automatically collect garbage from the Nix store.
|
|
|
|
depot.automatic-gc = {
|
|
|
|
enable = true;
|
|
|
|
interval = "1 hour";
|
2021-11-11 22:25:19 +01:00
|
|
|
diskThreshold = 16; # GiB
|
|
|
|
maxFreed = 10; # GiB
|
2021-09-10 13:34:10 +02:00
|
|
|
preserveGenerations = "14d";
|
|
|
|
};
|
2021-03-21 00:48:27 +01:00
|
|
|
};
|
|
|
|
|
2021-03-21 04:05:27 +01:00
|
|
|
# Automatically detect location to use for redshift
|
|
|
|
location.provider = "geoclue2";
|
|
|
|
|
2021-03-21 00:48:27 +01:00
|
|
|
# Do not restart the display manager automatically
|
|
|
|
systemd.services.display-manager.restartIfChanged = lib.mkForce false;
|
|
|
|
|
2021-11-10 17:25:49 +01:00
|
|
|
time.timeZone = "Europe/Moscow";
|
2021-03-21 00:48:27 +01:00
|
|
|
|
|
|
|
users.users.tazjin = {
|
|
|
|
isNormalUser = true;
|
2021-03-21 03:21:16 +01:00
|
|
|
createHome = true;
|
2021-09-13 14:37:59 +02:00
|
|
|
extraGroups = [ "wheel" "networkmanager" "video" "adbusers" ];
|
2021-03-21 00:48:27 +01:00
|
|
|
uid = 1000;
|
2021-04-19 23:58:11 +02:00
|
|
|
shell = pkgs.fish;
|
2021-03-21 00:48:27 +01:00
|
|
|
initialHashedPassword = "$6$d3FywUNCuZnJ4l.$ZW2ul59MLYon1v1xhC3lTJZfZ91lWW6Tpi13MpME0cJcYZNrsx7ABdgQRn.K05awruG2Y9ARAzURnmiJ31WTS1";
|
|
|
|
};
|
|
|
|
|
|
|
|
programs = {
|
2021-03-21 04:27:11 +01:00
|
|
|
fish.enable = true;
|
2021-03-21 00:48:27 +01:00
|
|
|
light.enable = true;
|
2021-03-21 04:27:11 +01:00
|
|
|
ssh.startAgent = true;
|
2021-03-25 20:13:50 +01:00
|
|
|
mosh.enable = true;
|
2021-07-13 14:42:34 +02:00
|
|
|
steam.enable = true;
|
2021-09-13 14:37:59 +02:00
|
|
|
adb.enable = true;
|
2021-03-21 03:21:16 +01:00
|
|
|
|
|
|
|
# Required by impermanence
|
|
|
|
fuse.userAllowOther = true;
|
2021-03-21 00:48:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
environment.systemPackages =
|
|
|
|
# programs from the depot
|
|
|
|
(with depot; [
|
2021-04-14 12:36:05 +02:00
|
|
|
screenLock
|
2021-03-21 00:48:27 +01:00
|
|
|
tools.nsfv-setup
|
2021-04-14 12:36:05 +02:00
|
|
|
users.tazjin.emacs
|
2021-12-03 14:40:03 +01:00
|
|
|
third_party.agenix.cli
|
2021-10-15 00:08:45 +02:00
|
|
|
third_party.dfmt
|
2021-03-21 00:48:27 +01:00
|
|
|
]) ++
|
|
|
|
|
|
|
|
# programs from nixpkgs
|
2021-04-19 23:58:11 +02:00
|
|
|
(with pkgs; [
|
2021-11-24 08:58:06 +01:00
|
|
|
amber
|
2021-03-21 00:48:27 +01:00
|
|
|
bat
|
|
|
|
chromium
|
|
|
|
curl
|
2021-04-17 15:53:36 +02:00
|
|
|
ddcutil
|
2021-10-10 13:02:56 +02:00
|
|
|
direnv
|
2021-10-10 15:58:43 +02:00
|
|
|
dmd
|
2021-03-22 21:38:28 +01:00
|
|
|
dnsutils
|
2021-03-21 00:48:27 +01:00
|
|
|
emacs27-nox # emacsclient
|
|
|
|
exa
|
|
|
|
fd
|
|
|
|
file
|
2021-03-28 17:33:08 +02:00
|
|
|
firefox
|
2021-03-21 00:48:27 +01:00
|
|
|
gdb
|
2021-11-24 08:58:06 +01:00
|
|
|
gh
|
2021-03-21 00:48:27 +01:00
|
|
|
git
|
|
|
|
gnupg
|
|
|
|
google-chrome
|
2021-08-02 00:21:52 +02:00
|
|
|
gtk3 # for gtk-launch
|
2021-03-21 00:48:27 +01:00
|
|
|
htop
|
|
|
|
hyperfine
|
|
|
|
iftop
|
|
|
|
imagemagick
|
|
|
|
jq
|
2021-05-22 21:38:48 +02:00
|
|
|
lieer
|
2021-03-21 00:48:27 +01:00
|
|
|
manpages
|
2021-03-22 21:38:28 +01:00
|
|
|
mosh
|
2021-03-21 00:48:27 +01:00
|
|
|
msmtp
|
2021-03-21 04:27:11 +01:00
|
|
|
mullvad-vpn
|
2021-03-21 00:48:27 +01:00
|
|
|
networkmanagerapplet
|
|
|
|
nix-prefetch-github
|
2021-11-24 08:58:06 +01:00
|
|
|
nmap
|
2021-03-21 00:48:27 +01:00
|
|
|
notmuch
|
|
|
|
openssh
|
|
|
|
openssl
|
2021-04-17 15:53:36 +02:00
|
|
|
paperlike-go
|
2021-05-22 21:38:48 +02:00
|
|
|
pass
|
2021-03-21 00:48:27 +01:00
|
|
|
pavucontrol
|
|
|
|
pinentry
|
|
|
|
pinentry-emacs
|
2021-03-21 14:50:16 +01:00
|
|
|
pulseaudioLight # for pactl
|
2021-03-21 00:48:27 +01:00
|
|
|
pwgen
|
|
|
|
quasselClient
|
2021-06-23 20:14:24 +02:00
|
|
|
rink
|
2021-03-21 00:48:27 +01:00
|
|
|
ripgrep
|
|
|
|
rustup
|
|
|
|
screen
|
|
|
|
scrot
|
2021-03-21 04:27:11 +01:00
|
|
|
spotify
|
2021-03-28 17:33:08 +02:00
|
|
|
syncthing
|
2021-11-24 08:58:06 +01:00
|
|
|
tig
|
2021-03-21 00:48:27 +01:00
|
|
|
tokei
|
|
|
|
tree
|
2021-10-10 13:02:56 +02:00
|
|
|
unzip
|
2021-03-21 00:48:27 +01:00
|
|
|
vlc
|
2021-11-24 08:58:06 +01:00
|
|
|
whois
|
2021-03-21 00:48:27 +01:00
|
|
|
xsecurelock
|
2021-11-24 08:58:06 +01:00
|
|
|
zoxide
|
2021-03-21 00:48:27 +01:00
|
|
|
]);
|
|
|
|
|
2021-05-22 21:51:59 +02:00
|
|
|
systemd.user.services.lieer-tazjin = {
|
|
|
|
description = "Synchronise mail@tazj.in via lieer";
|
|
|
|
script = "${pkgs.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";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-03-21 03:21:16 +01:00
|
|
|
home-manager.useGlobalPkgs = true;
|
|
|
|
home-manager.users.tazjin = { config, lib, ... }: {
|
|
|
|
imports = [ "${depot.third_party.impermanence}/home-manager.nix" ];
|
|
|
|
|
|
|
|
home.persistence."/persist/tazjin/home" = {
|
|
|
|
allowOther = true;
|
|
|
|
|
|
|
|
directories = [
|
2021-03-28 17:33:08 +02:00
|
|
|
".cargo"
|
2021-03-21 03:21:16 +01:00
|
|
|
".config/google-chrome"
|
|
|
|
".config/quassel-irc.org"
|
|
|
|
".config/spotify"
|
2021-03-28 17:33:08 +02:00
|
|
|
".config/syncthing"
|
2021-09-25 21:25:36 +02:00
|
|
|
".elfeed"
|
2021-03-21 03:21:16 +01:00
|
|
|
".gnupg"
|
2021-07-13 14:42:34 +02:00
|
|
|
".local/share/Steam"
|
2021-03-21 03:21:16 +01:00
|
|
|
".local/share/direnv"
|
2021-04-16 12:38:46 +02:00
|
|
|
".local/share/fish"
|
2021-11-27 15:40:07 +01:00
|
|
|
".local/share/zoxide"
|
2021-04-16 12:38:46 +02:00
|
|
|
".mozilla/firefox"
|
2021-03-21 03:21:16 +01:00
|
|
|
".password-store"
|
2021-03-21 17:17:41 +01:00
|
|
|
".rustup"
|
2021-03-21 03:21:16 +01:00
|
|
|
".ssh"
|
2021-07-13 14:42:34 +02:00
|
|
|
".steam"
|
2021-03-21 03:21:16 +01:00
|
|
|
".telega"
|
2021-03-28 17:33:08 +02:00
|
|
|
"go"
|
2021-03-21 03:21:16 +01:00
|
|
|
"mail"
|
|
|
|
];
|
|
|
|
|
|
|
|
files = [
|
2021-03-21 14:41:02 +01:00
|
|
|
".config/mimeapps.list"
|
2021-03-21 03:21:16 +01:00
|
|
|
".notmuch-config"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2021-12-13 14:24:04 +01:00
|
|
|
home.activation.screenshots = lib.hm.dag.entryAnywhere ''
|
|
|
|
$DRY_RUN_CMD mkdir -p $HOME/screenshots
|
|
|
|
'';
|
|
|
|
|
2021-03-21 03:21:16 +01:00
|
|
|
programs.git = {
|
|
|
|
enable = true;
|
|
|
|
userName = "Vincent Ambo";
|
|
|
|
userEmail = "mail@tazj.in";
|
2021-03-21 05:16:02 +01:00
|
|
|
extraConfig = {
|
|
|
|
pull.rebase = true;
|
2021-03-24 00:41:35 +01:00
|
|
|
init.defaultBranch = "canon";
|
2021-03-21 05:16:02 +01:00
|
|
|
};
|
2021-03-21 03:21:16 +01:00
|
|
|
};
|
2021-03-23 21:08:01 +01:00
|
|
|
|
2021-11-27 15:40:07 +01:00
|
|
|
programs.fish = {
|
|
|
|
enable = true;
|
|
|
|
interactiveShellInit = ''
|
|
|
|
${pkgs.zoxide}/bin/zoxide init fish | source
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-03-23 21:08:01 +01:00
|
|
|
services.screen-locker = {
|
|
|
|
enable = true;
|
|
|
|
enableDetectSleep = true;
|
|
|
|
inactiveInterval = 10; # minutes
|
|
|
|
lockCmd = "${screenLock}/bin/tazjin-screen-lock";
|
|
|
|
};
|
|
|
|
|
2021-11-13 21:18:35 +01:00
|
|
|
services.picom = {
|
|
|
|
enable = true;
|
|
|
|
vSync = true;
|
|
|
|
backend = "glx";
|
|
|
|
};
|
|
|
|
|
2021-11-27 18:56:05 +01:00
|
|
|
# Enable the dunst notification daemon, but force the
|
|
|
|
# configuration file separately instead of going via the strange
|
|
|
|
# Nix->dunstrc encoding route.
|
|
|
|
services.dunst.enable = true;
|
2021-11-02 13:02:56 +01:00
|
|
|
xdg.configFile."dunst/dunstrc" = {
|
|
|
|
source = depot.users.tazjin.dotfiles.dunstrc;
|
|
|
|
onChange = ''
|
|
|
|
${pkgs.procps}/bin/pkill -u "$USER" ''${VERBOSE+-e} dunst || true
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-03-23 21:08:01 +01:00
|
|
|
systemd.user.startServices = true;
|
2021-03-21 03:21:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
system.stateVersion = "20.09";
|
2021-03-21 00:48:27 +01:00
|
|
|
})
|