ark/users/patriot/default.nix

290 lines
7.7 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-07-01 04:45:26 +03:00
config,
inputs,
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-07-01 04:45:26 +03:00
l = lib // builtins;
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 {
2022-07-12 03:56:08 +03:00
imports = [
inputs.hyprland.nixosModules.default
];
2022-07-01 04:45:26 +03:00
2020-11-21 23:54:07 +03:00
users.users.patriot = {
isNormalUser = true;
createHome = true;
home = "/home/patriot";
2022-07-30 03:04:32 +03:00
extraGroups = l.flatten [
2022-02-18 20:31:01 +03:00
"wheel"
"adbusers"
"dialout"
2022-07-21 01:41:36 +03:00
"video"
2022-07-30 03:04:32 +03:00
(l.optional nixosConfig.virtualisation.docker.enable "docker")
2022-02-18 20:31:01 +03:00
];
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-07-30 03:04:32 +03:00
persistence.${config.system.persistDir}.directories = l.flatten [
(lib.optional nixosConfig.programs.steam.enable "/home/patriot/.local/share/Steam")
"/home/patriot/.cargo"
"/home/patriot/proj"
"/home/patriot/games"
];
2022-07-01 04:45:26 +03:00
systemPackages = [pkgs.qt5.qtwayland];
2022-02-18 20:31:01 +03:00
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-07-01 04:45:26 +03:00
wlr.enable = true;
gtkUsePortal = true;
extraPortals = with pkgs; [xdg-desktop-portal-gtk xdg-desktop-portal-wlr];
2020-11-21 23:54:07 +03:00
};
programs = {
2022-07-01 04:45:26 +03:00
# this is needed for impermanence
2022-06-10 21:36:34 +03:00
fuse.userAllowOther = true;
2020-11-21 23:54:07 +03:00
adb.enable = true;
2022-07-12 03:56:08 +03:00
steam.enable = true;
2022-07-12 01:22:30 +03:00
kdeconnect.enable = true;
2022-07-01 04:45:26 +03:00
# gnome stuffs
2022-05-21 14:17:48 +03:00
seahorse.enable = true;
2022-07-01 04:45:26 +03:00
hyprland.enable = true;
hyprland.extraPackages = [];
2020-11-21 23:54:07 +03:00
};
2022-07-01 04:45:26 +03:00
# gnome keyring better fr fr
security.pam.services.patriot = {
enableGnomeKeyring = true;
enableKwallet = false;
};
systemd = {
2022-04-10 05:48:34 +03:00
targets.network-online.enable = false;
services = {
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;
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-29 03:31:55 +03:00
../modules/helix
2022-07-01 04:45:26 +03:00
../modules/zoxide
../modules/wezterm
../modules/hyprland
../modules/rofi
../modules/mako
../modules/font
../modules/firefox
../../modules/persist
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
2022-07-01 04:45:26 +03:00
system.persistDir = nixosConfig.system.persistDir;
2022-06-30 03:53:13 +03:00
2022-07-01 04:45:26 +03:00
home.persistence."${config.system.persistDir}${config.home.homeDirectory}" = let
2022-06-10 21:36:34 +03:00
mkPaths = prefix: paths:
2022-07-01 04:45:26 +03:00
builtins.map (n: "${prefix}/${n}") (l.flatten paths);
2022-06-10 21:36:34 +03:00
in {
directories =
2022-07-12 03:56:08 +03:00
l.flatten [
2022-06-10 21:36:34 +03:00
"Downloads"
2022-06-16 21:38:12 +03:00
# "smos"
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"
".cache"
]
++ mkPaths ".local/share" [
"direnv"
2022-06-16 21:38:12 +03:00
"zsh"
2022-06-21 23:31:28 +03:00
"keyrings"
"lutris"
2022-06-29 03:31:55 +03:00
"PolyMC"
2022-06-10 21:36:34 +03:00
]
++ mkPaths ".config" [
2022-06-21 23:31:28 +03:00
"lutris"
2022-07-05 15:16:38 +03:00
"discord"
2022-07-12 01:22:30 +03:00
"kdeconnect"
2022-06-10 21:36:34 +03:00
];
2022-07-01 04:45:26 +03:00
files = l.flatten [
".config/wallpaper"
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-07-01 04:45:26 +03:00
fonts.settings = {
enable = true;
name = "Comic Mono";
size = 13;
package = let
ttf = pkgs.fetchurl {
url = "https://dtinth.github.io/comic-mono-font/ComicMono.ttf";
sha256 = "sha256-O8FCXpIqFqvw7HZ+/+TQJoQ5tMDc6YQy4H0V9drVcZY=";
};
in
pkgs.runCommandNoCC "comic-mono" {} ''
mkdir -p $out/share/fonts/truetype
ln -s ${ttf} $out/share/fonts/truetype
'';
};
2022-03-09 23:55:02 +03:00
home = {
2022-06-22 16:49:01 +03:00
stateVersion = nixosConfig.system.stateVersion;
2022-03-09 23:55:02 +03:00
homeDirectory = nixosConfig.users.users.patriot.home;
2022-07-01 04:45:26 +03:00
packages = with pkgs;
l.flatten [
# Font stuff
noto-fonts-cjk
font-awesome
dejavu_fonts
# Programs
bitwarden
cargo-outdated
cargo-release
cargo-udeps
vulkan-tools
krita
cachix
gnupg
imv
mpv
ffmpeg
mupdf
xdg_utils
wl-clipboard
xclip
rust-analyzer
# polymc
cloudflared
lutris
2022-07-18 19:34:54 +03:00
discord-open-asar
2022-07-21 01:41:36 +03:00
gamescope
protontricks
2022-07-30 03:04:32 +03:00
genymotion
2022-07-01 04:45:26 +03:00
];
2022-05-28 14:44:46 +03:00
shellAliases =
nixosConfig.environment.shellAliases
// {
harmony-ssh = ''
${pkgBin "mosh"} root@chat.harmonyapp.io
'';
};
2022-06-30 03:53:13 +03:00
sessionVariables =
nixosConfig.environment.sessionVariables
2022-07-01 04:45:26 +03:00
// l.optionalAttrs config.programs.fzf.enable {
2022-07-01 15:58:41 +03:00
FZF_DEFAULT_OPTS = "--color=spinner:#F8BD96,hl:#F28FAD --color=fg:#D9E0EE,header:#F28FAD,info:#DDB6F2,pointer:#F8BD96 --color=marker:#F8BD96,fg+:#F2CDCD,prompt:#DDB6F2,hl+:#F28FAD";
2022-06-30 03:53:13 +03:00
};
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
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;
2022-07-01 04:45:26 +03:00
plugins = [
{
2022-03-09 23:55:02 +03:00
name = "per-directory-history";
2022-07-01 04:45:26 +03:00
src = pkgs.fetchFromGitHub {
owner = "jimhester";
repo = "per-directory-history";
rev = "d2e291dd6434e340d9be0e15e1f5b94f32771c06";
hash = "sha256-VHRgrVCqzILqOes8VXGjSgLek38BFs9eijmp0JHtD5Q=";
};
}
];
2022-03-09 23:55:02 +03:00
# xdg compliant
dotDir = ".config/zsh";
2022-06-22 16:49:01 +03:00
history.path = "${config.home.homeDirectory}/.local/share/zsh/history";
2022-03-09 23:55:02 +03:00
initExtra = ''
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-07-01 04:45:26 +03:00
# fix some key stuff
2022-03-09 23:55:02 +03:00
bindkey "$terminfo[kRIT5]" forward-word
bindkey "$terminfo[kLFT5]" backward-word
2022-07-01 04:45:26 +03:00
# makes completions pog
2022-03-09 23:55:02 +03:00
zstyle ':completion:*' menu select
2022-07-17 20:31:05 +03:00
${pkgBin "any-nix-shell"} zsh --info-right | source /dev/stdin
2022-07-01 04:45:26 +03:00
'';
loginExtra = ''
if [[ "$(tty)" == "/dev/tty1" ]]; then
exec Hyprland
fi
2022-03-09 23:55:02 +03:00
'';
};
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-07-01 04:45:26 +03:00
pinentryFlavor = "gtk2";
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
}