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-09-10 13:34:10 +02:00
|
|
|
"${depot.path + "/ops/modules/automatic-gc.nix"}"
|
2021-04-19 23:58:11 +02:00
|
|
|
"${pkgs.home-manager.src}/nixos"
|
2021-03-21 01:36:56 +01:00
|
|
|
];
|
|
|
|
|
2021-04-04 20:39:01 +02:00
|
|
|
nix = {
|
|
|
|
binaryCachePublicKeys = [
|
|
|
|
"cache.tvl.su:kjc6KOMupXc1vHVufJUoDUYeLzbwSr9abcAKdn/U1Jk="
|
|
|
|
];
|
|
|
|
|
|
|
|
binaryCaches = [
|
|
|
|
"https://cache.tvl.su"
|
|
|
|
];
|
|
|
|
};
|
2021-03-23 00:14:10 +01:00
|
|
|
|
2021-03-21 00:48:27 +01:00
|
|
|
boot = {
|
|
|
|
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-04-17 15:53:36 +02:00
|
|
|
kernelModules = [ "kvm-amd" "i2c_dev" ];
|
2021-03-21 00:48:27 +01:00
|
|
|
extraModulePackages = [ ];
|
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";
|
|
|
|
options = [ "defaults" "size=4G" "mode=755" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
"/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;
|
|
|
|
};
|
|
|
|
|
|
|
|
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-04-16 12:48:31 +02:00
|
|
|
tlp.enable = true;
|
2021-06-21 16:42:32 +02:00
|
|
|
fwupd.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
|
|
|
|
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-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";
|
|
|
|
diskThreshold = 42; # GiB
|
|
|
|
maxFreed = 100; # GiB
|
|
|
|
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-08-01 23:43:15 +02: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-03-21 00:48:27 +01:00
|
|
|
]) ++
|
|
|
|
|
|
|
|
# programs from nixpkgs
|
2021-04-19 23:58:11 +02:00
|
|
|
(with pkgs; [
|
2021-03-21 00:48:27 +01:00
|
|
|
bat
|
|
|
|
chromium
|
|
|
|
curl
|
|
|
|
direnv
|
2021-04-17 15:53:36 +02:00
|
|
|
ddcutil
|
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
|
|
|
|
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
|
|
|
|
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
|
2021-08-04 16:43:54 +02:00
|
|
|
picom
|
2021-03-21 00:48:27 +01:00
|
|
|
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-03-21 00:48:27 +01:00
|
|
|
tokei
|
|
|
|
tree
|
|
|
|
vlc
|
|
|
|
xsecurelock
|
|
|
|
]);
|
|
|
|
|
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"
|
|
|
|
".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"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
services.screen-locker = {
|
|
|
|
enable = true;
|
|
|
|
enableDetectSleep = true;
|
|
|
|
inactiveInterval = 10; # minutes
|
|
|
|
lockCmd = "${screenLock}/bin/tazjin-screen-lock";
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.user.startServices = true;
|
2021-03-21 03:21:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
system.stateVersion = "20.09";
|
2021-03-21 00:48:27 +01:00
|
|
|
})
|