ark/users/patriot/default.nix

334 lines
8.6 KiB
Nix
Raw Normal View History

2022-02-18 20:31:01 +03:00
{
pkgs,
lib,
2022-04-09 22:01:44 +03:00
tlib,
2022-02-18 20:31:01 +03:00
...
2022-04-09 21:33:13 +03:00
} @ globalAttrs: let
2021-05-03 07:48:31 +03:00
inherit (lib) mapAttrs' nameValuePair;
inherit (builtins) readDir fetchGit;
2022-04-09 21:33:13 +03:00
2022-04-09 22:01:44 +03:00
pkgBin = tlib.pkgBin pkgs;
2022-04-09 21:33:13 +03:00
nixosConfig = globalAttrs.config;
2022-02-18 20:31:01 +03:00
in {
2020-11-21 23:54:07 +03:00
users.users.patriot = {
isNormalUser = true;
createHome = true;
home = "/home/patriot";
2022-02-18 20:31:01 +03:00
extraGroups = [
"wheel"
"adbusers"
"dialout"
];
2020-11-21 23:54:07 +03:00
shell = pkgs.zsh;
2022-03-09 23:55:02 +03:00
hashedPassword = "$6$spzqhAyJfhHy$iHgLBlhjGn1l8PnbjJdWTn1GPvcjMqYNKUzdCe/7IrX6sHNgETSr/Nfpdmq9FCXLhrAfwHOd/q/8SvfeIeNX4/";
2020-11-21 23:54:07 +03:00
};
2021-08-23 21:25:02 +03:00
environment = {
2022-02-18 20:31:01 +03:00
systemPackages = [pkgs.qt5.qtwayland];
shells = with pkgs; [bashInteractive zsh];
2021-08-23 21:25:02 +03:00
};
2020-11-21 23:54:07 +03:00
xdg.portal = {
enable = true;
2022-05-21 14:17:48 +03:00
wlr.enable = true;
gtkUsePortal = false;
extraPortals = with pkgs; [xdg-desktop-portal-wlr];
2020-11-21 23:54:07 +03:00
};
programs = {
2022-06-10 21:36:34 +03:00
fuse.userAllowOther = true;
2020-11-21 23:54:07 +03:00
adb.enable = true;
2022-06-16 21:38:12 +03:00
steam.enable = true;
2022-05-21 14:17:48 +03:00
kdeconnect = {
enable = true;
package = pkgs.gnomeExtensions.gsconnect;
};
2022-06-10 21:36:34 +03:00
gnome-disks.enable = false;
file-roller.enable = false;
2022-05-21 14:17:48 +03:00
seahorse.enable = true;
2020-11-21 23:54:07 +03:00
};
2021-12-25 16:19:03 +03:00
security = {
pam.services.patriot = {
enableGnomeKeyring = true;
enableKwallet = false;
};
};
2021-01-17 18:34:34 +03:00
services = {
2021-05-14 01:35:10 +03:00
gnome = {
2021-01-17 18:34:34 +03:00
gnome-keyring.enable = true;
2022-05-21 14:17:48 +03:00
core-shell.enable = true;
core-os-services.enable = true;
chrome-gnome-shell.enable = true;
at-spi2-core.enable = true;
gnome-online-accounts.enable = false;
gnome-online-miners.enable = lib.mkForce false;
gnome-remote-desktop.enable = false;
2021-12-25 16:19:03 +03:00
core-utilities.enable = false;
tracker-miners.enable = false;
tracker.enable = false;
2022-06-10 21:36:34 +03:00
gnome-settings-daemon.enable = lib.mkForce false;
sushi.enable = false;
2021-01-17 18:34:34 +03:00
};
2021-03-18 17:12:44 +03:00
xserver = {
2021-01-17 17:25:54 +03:00
enable = true;
desktopManager = {
2022-04-22 00:16:12 +03:00
gnome.enable = true;
xterm.enable = false;
};
displayManager = {
autoLogin = {
2022-05-21 14:17:48 +03:00
enable = true;
user = "patriot";
};
gdm = {
2022-04-22 00:16:12 +03:00
enable = true;
wayland = true;
};
2022-04-22 00:16:12 +03:00
startx.enable = false;
};
2021-03-18 17:12:44 +03:00
};
};
systemd = {
2022-04-10 05:48:34 +03:00
targets.network-online.enable = false;
services = {
2022-05-21 14:17:48 +03:00
"getty@tty1".enable = false;
"autovt@tty1".enable = false;
systemd-networkd-wait-online.enable = false;
NetworkManager-wait-online.enable = false;
2021-01-17 17:25:54 +03:00
};
};
2022-03-09 23:55:02 +03:00
home-manager.users.patriot = {
config,
pkgs,
2022-06-10 21:36:34 +03:00
inputs,
2022-03-09 23:55:02 +03:00
...
}: let
personal = import ../../personal.nix;
name = personal.name;
email = personal.emails.primary;
2022-04-22 07:40:28 +03:00
font = {
name = "Comic Mono";
size = 13;
package = let
ttf = pkgs.fetchurl {
url = "https://dtinth.github.io/comic-mono-font/ComicMono.ttf";
sha256 = "sha256-O8FCXpIqFqvw7HZ+/+TQJoQ5tMDc6YQy4H0V9drVcZY=";
2022-03-09 23:55:02 +03:00
};
2022-04-22 07:40:28 +03:00
in
pkgs.runCommand "comic-mono" {} ''
mkdir -p $out/share/fonts/truetype
ln -s ${ttf} $out/share/fonts/truetype
'';
2022-03-09 23:55:02 +03:00
};
in {
2022-04-09 18:01:35 +03:00
imports = [
2022-04-09 21:33:13 +03:00
../modules/direnv
../modules/git
../modules/starship
2022-06-16 21:38:12 +03:00
# ../modules/smos
2022-06-10 21:36:34 +03:00
inputs.nixos-persistence.nixosModules.home-manager.impermanence
2022-04-09 18:01:35 +03:00
];
2022-06-10 21:36:34 +03:00
home.persistence."/persist/home/patriot" = let
mkPaths = prefix: paths:
builtins.map (n: "${prefix}/${n}") paths;
in {
directories =
[
"Downloads"
"proj"
2022-06-16 21:38:12 +03:00
# "smos"
".steam"
2022-06-21 23:31:28 +03:00
".wine"
2022-06-10 21:36:34 +03:00
# ssh / gpg / keys
".ssh"
".gnupg"
"keys"
# caches / history stuff
".directory_history"
".cargo"
".cache"
]
++ mkPaths ".local/share" [
"zoxide"
"direnv"
2022-06-16 21:38:12 +03:00
"zsh"
"Steam"
2022-06-19 21:52:53 +03:00
"backgrounds"
2022-06-21 23:31:28 +03:00
"keyrings"
"lutris"
2022-06-10 21:36:34 +03:00
]
++ mkPaths ".config" [
"dconf"
"chromium"
2022-06-11 18:53:17 +03:00
"gsconnect"
2022-06-21 23:31:28 +03:00
"lutris"
2022-06-10 21:36:34 +03:00
];
files = [
".config/gnome-initial-setup-done"
2022-06-11 18:53:17 +03:00
(lib.removePrefix "~/" config.programs.ssh.userKnownHostsFile)
2022-06-10 21:36:34 +03:00
];
allowOther = true;
};
2022-04-09 22:01:44 +03:00
fonts.fontconfig.enable = lib.mkForce true;
2022-03-09 23:55:02 +03:00
home = {
homeDirectory = nixosConfig.users.users.patriot.home;
packages = with pkgs; [
# Font stuff
2022-04-22 07:40:28 +03:00
font.package
2022-03-09 23:55:02 +03:00
noto-fonts-cjk
font-awesome
dejavu_fonts
# Programs
2022-06-16 21:38:12 +03:00
bitwarden
2022-04-22 07:40:28 +03:00
wezterm
2022-03-09 23:55:02 +03:00
cargo-outdated
cargo-release
cargo-udeps
vulkan-tools
krita
cachix
gnupg
imv
mpv
ffmpeg
mupdf
xdg_utils
wl-clipboard
rust-analyzer
2022-06-21 23:31:28 +03:00
# polymc
2022-05-03 04:31:30 +03:00
cloudflared
2022-06-21 23:31:28 +03:00
lutris
2022-03-09 23:55:02 +03:00
];
2022-05-28 14:44:46 +03:00
shellAliases =
nixosConfig.environment.shellAliases
// {
harmony-ssh = ''
${pkgBin "mosh"} root@chat.harmonyapp.io
'';
};
2022-03-09 23:55:02 +03:00
};
programs = {
2022-06-16 21:38:12 +03:00
command-not-found.enable =
nixosConfig.programs.command-not-found.enable;
2022-03-09 23:55:02 +03:00
chromium = {
enable = true;
package = pkgs.chromium;
extensions = [
# https everywhere
2022-05-28 14:44:46 +03:00
"gcbommkclmclpchllfjekcdonpmejbdp"
2022-03-09 23:55:02 +03:00
# ublock
2022-05-28 14:44:46 +03:00
"cjpalhdlnbpafiamejdnhcphjbkeiagm"
2022-03-09 23:55:02 +03:00
# bitwarden
2022-05-28 14:44:46 +03:00
"nngceckbapebfimnlniiiahkandclblb"
2022-03-09 23:55:02 +03:00
# decentraleyes
2022-05-28 14:44:46 +03:00
"ldpochfccmkkmhdbclfhpagapcfdljkj"
2022-03-09 23:55:02 +03:00
# dark theme
2022-05-28 14:44:46 +03:00
"annfbnbieaamhaimclajlajpijgkdblo"
2022-03-09 23:55:02 +03:00
# dark reader
2022-05-28 14:44:46 +03:00
"eimadpbcbfnmbkopoojfekhnkhdbieeh"
2022-03-09 23:55:02 +03:00
# github refined
2022-05-28 14:44:46 +03:00
"hlepfoohegkhhmjieoechaddaejaokhf"
2022-03-09 23:55:02 +03:00
# privacy redirect
2022-05-28 14:44:46 +03:00
"pmcmeagblkinmogikoikkdjiligflglb"
# pronoundb
"nblkbiljcjfemkfjnhoobnojjgjdmknf"
2022-03-09 23:55:02 +03:00
];
};
git = {
signing = {
key = "E1C119F91F4CAE53E8445CAFBB57FCE7E35984F6";
signByDefault = true;
2021-05-03 07:48:31 +03:00
};
2022-03-09 23:55:02 +03:00
userName = name;
userEmail = email;
};
ssh = {
enable = true;
compression = true;
hashKnownHosts = true;
userKnownHostsFile = "~/.local/share/ssh/known-hosts";
# Only needed for darcs hub
# extraConfig = ''
# Host hub.darcs.net
# ControlMaster no
# ForwardAgent no
# ForwardX11 no
# Ciphers +aes256-cbc
# MACs +hmac-sha1
# '';
};
zsh = {
enable = true;
autocd = true;
enableVteIntegration = true;
enableAutosuggestions = true;
enableCompletion = true;
plugins = let
fast-syntax-highlighting = let
name = "fast-syntax-highlighting";
in {
inherit name;
src = pkgs."zsh-${name}".out;
};
per-directory-history = {
name = "per-directory-history";
src =
pkgs.fetchFromGitHub
{
owner = "jimhester";
repo = "per-directory-history";
rev = "d2e291dd6434e340d9be0e15e1f5b94f32771c06";
hash = "sha256-VHRgrVCqzILqOes8VXGjSgLek38BFs9eijmp0JHtD5Q=";
2021-05-03 07:48:31 +03:00
};
2022-03-09 23:55:02 +03:00
};
in [fast-syntax-highlighting per-directory-history];
# xdg compliant
dotDir = ".config/zsh";
history.path = ".local/share/zsh/history";
initExtra = ''
export TERM=alacritty
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
2021-05-03 07:48:31 +03:00
2022-03-09 23:55:02 +03:00
function tomp4 () {
2022-04-10 05:48:34 +03:00
${pkgBin "ffmpeg"} -i $1 -c:v libx264 -preset slow -crf 30 -c:a aac -b:a 128k "$1.mp4"
2022-03-09 23:55:02 +03:00
}
2021-05-03 07:48:31 +03:00
2022-03-09 23:55:02 +03:00
function topng () {
2022-04-10 05:48:34 +03:00
${pkgBin "ffmpeg"} -i $1 "$1.png"
2022-03-09 23:55:02 +03:00
}
2021-05-03 07:48:31 +03:00
2022-03-09 23:55:02 +03:00
bindkey "$terminfo[kRIT5]" forward-word
bindkey "$terminfo[kLFT5]" backward-word
zstyle ':completion:*' menu select
2021-05-03 07:48:31 +03:00
2022-03-09 23:55:02 +03:00
eval "$(zoxide init zsh)"
'';
};
fzf.enable = true;
};
services = {
gpg-agent = let
defaultCacheTtl = 3600 * 6;
maxCacheTtl = 3600 * 24;
in {
inherit defaultCacheTtl maxCacheTtl;
enable = true;
enableSshSupport = true;
sshKeys = ["8369D9CA26C3EAAAB8302A88CEE6FD14B58AA965"];
defaultCacheTtlSsh = defaultCacheTtl;
maxCacheTtlSsh = maxCacheTtl;
grabKeyboardAndMouse = false;
2022-06-10 21:36:34 +03:00
pinentryFlavor = "gnome3";
2022-03-09 23:55:02 +03:00
};
};
xdg = {
enable = true;
configFile = {
2022-04-22 07:40:28 +03:00
"wezterm/wezterm.lua".text = import ./config/wezterm/cfg.nix {inherit font;};
"helix/themes/mytheme.toml".text = import ./config/helix/mytheme.nix {};
"helix/config.toml".text = import ./config/helix/cfg.nix {};
"helix/languages.toml".text = import ./config/helix/languages.nix {inherit pkgBin;};
2021-07-05 00:01:15 +03:00
};
2021-05-03 07:48:31 +03:00
};
2022-03-09 23:55:02 +03:00
};
2020-11-21 23:54:07 +03:00
}