desktop/home/user.nix
2025-12-22 16:46:52 -03:00

355 lines
10 KiB
Nix

{ hostname, lib, ... }:
{
home-manager.users.user =
{
config,
pkgs,
...
}:
{
home.username = "user";
home.homeDirectory = "/home/user";
home.stateVersion = "25.11";
home.enableNixpkgsReleaseCheck = false;
sops.defaultSopsFile = ../secrets/home.yaml;
sops.age.keyFile = "/.persist/${config.home.homeDirectory}/.config/sops/age/keys.txt";
sops.secrets."user/ssh/desktop" = {
path = "${config.home.homeDirectory}/.ssh/desktop";
mode = "0600";
};
home.file."/.ssh/desktop.pub".text =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILABd/iSJ4gn/ystDqNxLJTG0n0z5VIC9YXlmdUfOhHf desktop@icefox.sh";
sops.secrets."user/ssh/legacy_ed25519" = {
path = "${config.home.homeDirectory}/.ssh/legacy_ed25519";
mode = "0600";
};
home.file."/.ssh/legacy_ed25519.pub".text =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILkchxtY21PzSLHJ5SoYPrl03+NRzRqznbdCqNyGuOX/ master@michizure.net";
dconf.settings = {
"org/gnome/desktop/interface" = {
text-scaling-factor = 1.5;
};
};
xresources.properties = {
"Xcursor.size" = 18;
"Xft.dpi" = 144;
"Xft.autohint" = 0;
"Xft.lcdfilter" = "lcddefault";
"Xft.hintstyle" = "hintfull";
"Xft.hinting" = 1;
"Xft.antialias" = 1;
"Xft.rgba" = "rgb";
};
systemd.user.services.xrdb-configure = {
Unit = {
Description = "Load Xresources";
};
Intall = {
WantedBy = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.xorg.xrdb}/bin/xrdb -merge ${config.home.homeDirectory}/.Xresources";
Type = "oneshot";
};
};
sops.secrets."user/gpg/legacy_fnzr" = { };
home.activation.importGpgKey = config.lib.dag.entryAfter [ "writeBoundary" ] ''
if [[ -f "${config.sops.secrets."user/gpg/legacy_fnzr".path}" ]]; then
${pkgs.gnupg}/bin/gpg --batch --import "${
config.sops.secrets."user/gpg/legacy_fnzr".path
}" || true
echo "YOUR_KEY_FINGERPRINT:6:" | ${pkgs.gnupg}/bin/gpg --import-ownertrust || true
fi
'';
xdg.configFile."containers/containers.conf".text = ''
[engine]
compose_warning_logs=false
'';
# xdg.configFile."mimeapps.list".force = true;
xdg.userDirs = {
enable = true;
createDirectories = true;
download = "${config.home.homeDirectory}/downloads";
documents = "${config.home.homeDirectory}/documents";
desktop = "${config.home.homeDirectory}/desktop";
pictures = "${config.home.homeDirectory}/pictures";
music = "${config.home.homeDirectory}/music";
videos = "${config.home.homeDirectory}/videos";
templates = "${config.home.homeDirectory}";
publicShare = "${config.home.homeDirectory}";
extraConfig = {
XDG_SCREENSHOTS_DIR = "${config.home.homeDirectory}/pictures/screenshots";
};
};
programs = {
ssh = {
enable = true;
enableDefaultConfig = false;
matchBlocks = {
"github.com" = {
identityFile = config.sops.secrets."user/ssh/legacy_ed25519".path;
};
"icefox.sh" = {
user = "git";
identityFile = config.sops.secrets."user/ssh/desktop".path;
};
};
};
delta = {
enable = true;
options = {
navigate = true;
line-numbers = true;
side-by-side = true;
};
enableGitIntegration = true;
};
git = {
enable = true;
lfs.enable = true;
settings = {
user = {
email = "felipe@icefox.sh";
name = "icefox";
};
gpg.format = "ssh";
user.signingkey = "${config.home.homeDirectory}/.ssh/desktop.pub";
commit.gpgsign = true;
tag.gpgsign = true;
core = {
editor = "nvim";
whitespace = "fix,only-indent-error,trailing-space,space-before-tab";
quotepath = false;
};
diff = {
algorithm = "histogram";
renames = "copies";
};
merge = {
conflictstyle = "zdiff3";
};
init = {
defaultBranch = "master";
};
push = {
autoSetupRemote = true;
default = "current";
};
pull = {
rebase = true;
};
fetch = {
prune = true;
};
help = {
autocorrect = "prompt";
};
url."git@github.com:".insteadOf = "https://github.com/";
};
};
};
programs.tmux = {
enable = true;
baseIndex = 1;
keyMode = "vi";
mouse = true;
plugins = with pkgs.tmuxPlugins; [
sensible
yank
pain-control
tmux-powerline
tmux-which-key
{
plugin = resurrect;
extraConfig = "set -g @ressurect-strategy-nvim 'session'";
}
{
plugin = continuum;
extraConfig = ''
set -g @continuum-restore 'on'
set -g @continuum-save-interval '60'
'';
}
];
extraConfig = ''
set -g status-position top
set -g focus-events on
set -g allow-passthrough on
bind -n M-n select-window -t 1
bind -n M-e select-window -t 2
bind -n M-i select-window -t 3
bind -n M-a select-window -t 4
bind -n M-, run-shell "tmux neww tmux-sessionizer"
bind -n M-/ run-shell "tmux switch-client -t default"
bind -n M-. run-shell "tmux switchc -l"
'';
};
home.packages = with pkgs; [
xorg.xrdb
(writeShellApplication {
name = "tmux-sessionizer";
runtimeInputs = [
tmux
fzf
];
text = builtins.readFile ./bin/tmux-sessionizer;
})
];
imports = [ ./nvim ];
custom.neovim = {
enable = true;
colorscheme = "tokyonight";
hostname = hostname;
};
programs.fish = {
enable = true;
plugins = [
{
name = "puffer";
src = pkgs.fetchFromGitHub {
owner = "nickeb96";
repo = "puffer-fish";
rev = "83174b0";
sha256 = "sha256-Dhx5+XRxJvlhdnFyimNxFyFiASrGU4ZwyefsDwtKnSg=";
};
}
];
interactiveShellInit = ''
set fish_greeting
'';
};
programs.starship = {
enable = true;
};
programs.zoxide = {
enable = true;
enableFishIntegration = true;
};
programs.chromium = {
enable = true;
package = pkgs.symlinkJoin {
name = "chromium-firejail-hm";
paths = [ pkgs.chromium ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
rm $out/bin/chromium
ln -s /run/current-system/sw/bin/chromium $out/bin/chromium
'';
};
};
programs.ghostty = {
enable = true;
settings = {
font-family = "MonaspiceNe Nerd Font Mono";
"font-family " = "Fire Code Symbol";
font-size = "14";
font-feature = "+calt, +liga, +dlig, +ss01, +ss02, +ss03, +ss04, +ss05, +ss06, +ss07, +ss08, +ss09, +ss10";
};
enableFishIntegration = true;
systemd.enable = true;
};
programs.librewolf = {
enable = true;
package = pkgs.librewolf;
nativeMessagingHosts = [
pkgs.browserpass
pkgs.tridactyl-native
];
profiles.default = {
id = 0;
name = "default";
isDefault = true;
containersForce = true;
containers = {
personal = {
id = 1;
color = "blue";
icon = "fingerprint";
};
google = {
id = 2;
color = "pink";
icon = "briefcase";
};
};
search = {
force = true;
default = "ddg";
order = [
"ddg"
"Kagi"
"NixOS"
];
engines = {
"Kagi" = {
urls = [ { template = "https://kagi.com/search?q={searchTerms}"; } ];
icon = "https://kagi.com/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "kg" ];
};
"nx" = {
urls = [ { template = "https://mynixos.com/search?q={searchTerms}"; } ];
icon = "https://mynixos.com/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "nx" ];
};
"ddg" = {
metaData.alias = "dd";
};
"google".metaData.hidden = true;
"bing".metaData.hidden = true;
"amazondotcom-us".metaData.hidden = true;
"ebay".metaData.hidden = true;
};
};
settings = {
"layout.css.prefers-color-scheme.content-override" = 2;
"privacy.resistFingerprinting" = true;
"privacy.resistFingerprinting.exemptions" = "prefers-color-scheme";
"browser.theme.dark-private-windows" = true;
};
extensions = {
packages = with pkgs.nur.repos.rycee.firefox-addons; [
ublock-origin
tridactyl
gopass-bridge
multi-account-containers
foxyproxy-standard
];
# force = true;
# settings."uBlock0@raymondhill.net".settings = {
# selectedFilterLists = [
# "ublock-filters"
# "ublock-badware"
# "ublock-privacy"
# "ublock-unbreak"
# "ublock-quick-fixes"
# ];
# };
};
};
};
};
}