config/shared/home/default.nix

256 lines
6.8 KiB
Nix
Raw Normal View History

{
2023-10-09 17:17:24 +03:00
lib,
pkgs,
2023-10-06 11:32:22 +03:00
stateVersion,
2024-05-06 14:42:46 +03:00
email ? null,
2024-02-04 22:05:44 +02:00
devTools,
2023-10-27 10:31:00 +03:00
hmOnly,
username,
...
2024-07-29 15:39:54 +03:00
}:
let
2024-02-02 13:51:43 +02:00
# from https://github.com/Gerg-L/demoninajar/blob/39964f198dbfa34c21f81c35370fab312b476051/homes/veritas_manjaro/nixGL.nix#L42
2024-07-29 15:39:54 +03:00
mkWrapped =
wrap: orig-pkg: execName:
pkgs.makeOverridable (
attrs:
let
2024-02-02 13:51:43 +02:00
pkg = orig-pkg.override attrs;
outs = pkg.meta.outputsToInstall;
paths = pkgs.lib.attrsets.attrVals outs pkg;
nonTrivialOuts = pkgs.lib.lists.remove "out" outs;
2024-07-29 15:39:54 +03:00
metaAttributes = pkgs.lib.attrsets.getAttrs (
[
"name"
"pname"
"version"
"meta"
]
++ nonTrivialOuts
) pkg;
2024-02-02 13:51:43 +02:00
in
2024-07-29 15:39:54 +03:00
pkgs.symlinkJoin (
{
inherit paths;
nativeBuildInputs = [ pkgs.makeWrapper ];
postBuild = ''
mv $out/bin/${execName} $out/bin/.${execName}-mkWrapped-original
makeWrapper \
${wrap}/bin/${wrap.name} $out/bin/${execName} \
--add-flags $out/bin/.${execName}-mkWrapped-original
'';
}
// metaAttributes
)
) { };
2024-02-02 13:51:43 +02:00
glintel = mkWrapped pkgs.nixgl.nixGLIntel;
2024-03-06 09:11:48 +02:00
firefox =
2024-07-29 15:39:54 +03:00
if (pkgs.stdenv.hostPlatform.system == "x86_64-linux") then pkgs.firefox-bin else pkgs.firefox;
2024-03-12 16:50:11 +02:00
homeDirectory = "/home/${username}";
2024-07-29 15:39:54 +03:00
in
{
home = {
2024-03-12 16:50:11 +02:00
inherit stateVersion username homeDirectory;
};
2024-03-13 09:56:08 +02:00
home.file = {
".parallel/will-cite".text = "";
};
2024-03-12 16:50:11 +02:00
2024-07-29 15:39:54 +03:00
home.sessionVariables = lib.mkIf devTools { GOPATH = "${homeDirectory}/.go"; };
2024-03-12 16:50:11 +02:00
2024-07-29 15:39:54 +03:00
home.packages =
with pkgs;
2023-12-12 13:16:02 +02:00
lib.mkMerge [
2024-07-29 15:39:54 +03:00
[ extract_url ]
2024-04-15 14:50:52 +03:00
2024-02-04 22:05:44 +02:00
(lib.mkIf devTools [
2024-09-17 14:26:06 +03:00
pkgs-unstable.delve
2024-08-19 14:59:23 +03:00
pkgs-unstable.go_1_23
pkgs-unstable.go-tools
2024-11-19 22:31:08 +02:00
pkgs.zigpkgs."0.13.0"
2023-12-12 13:16:02 +02:00
])
2024-02-02 11:06:36 +02:00
2023-12-12 13:16:02 +02:00
(lib.mkIf hmOnly [
2024-02-07 11:24:04 +02:00
# pkgs by motiejus
2024-02-05 09:19:16 +02:00
tmuxbash
nicer
2024-02-07 11:24:04 +02:00
2023-10-27 10:31:00 +03:00
ncdu
2024-02-05 13:42:13 +02:00
poop
2023-10-27 10:31:00 +03:00
tokei
2024-02-07 11:24:04 +02:00
bloaty
2023-12-07 10:24:58 +02:00
scrcpy
yt-dlp
2023-10-27 10:31:00 +03:00
vimv-rs
2024-02-05 13:42:13 +02:00
ripgrep
2024-02-07 13:53:02 +02:00
yamllint
2023-12-14 10:10:00 +02:00
bandwhich
2023-10-27 10:31:00 +03:00
hyperfine
2024-02-14 15:54:42 +02:00
nix-output-monitor
2023-12-12 13:16:02 +02:00
])
];
2024-02-04 22:23:56 +02:00
programs = lib.mkMerge [
{
direnv.enable = true;
man = {
enable = true;
generateCaches = true;
};
chromium = lib.mkIf devTools {
2024-03-12 16:14:15 +02:00
enable = true;
extensions = [
2024-07-29 15:39:54 +03:00
{ id = "cjpalhdlnbpafiamejdnhcphjbkeiagm"; } # ublock origin
{ id = "mdjildafknihdffpkfmmpnpoiajfjnjd"; } # consent-o-matic
2024-03-12 16:14:15 +02:00
];
};
2024-02-04 22:23:56 +02:00
firefox = lib.mkIf devTools {
2023-11-27 18:17:27 +02:00
enable = true;
2024-02-04 22:23:56 +02:00
# firefox doesn't need the wrapper on the personal laptop
2024-07-29 15:39:54 +03:00
package = if hmOnly then (glintel firefox "firefox") else firefox;
2024-02-04 22:23:56 +02:00
policies.DisableAppUpdate = true;
profiles = {
xdefault = {
isDefault = true;
settings = {
"app.update.auto" = false;
"browser.aboutConfig.showWarning" = false;
"browser.contentblocking.category" = "strict";
"browser.urlbar.showSearchSuggestionsFirst" = false;
"layout.css.prefers-color-scheme.content-override" = 0;
"signon.management.page.breach-alerts.enabled" = false;
"signon.rememberSignons" = false;
};
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
bitwarden
2024-07-28 20:38:29 +03:00
header-editor
2024-02-04 22:23:56 +02:00
ublock-origin
consent-o-matic
multi-account-containers
];
};
};
2023-11-27 18:17:27 +02:00
};
2024-02-04 22:23:56 +02:00
neovim = lib.mkMerge [
2023-11-27 18:17:27 +02:00
{
2024-02-04 22:23:56 +02:00
enable = true;
vimAlias = true;
vimdiffAlias = true;
defaultEditor = true;
plugins = lib.mkMerge [
2024-07-29 15:39:54 +03:00
[ pkgs.vimPlugins.fugitive ]
(lib.mkIf devTools [
2024-06-14 11:27:05 +03:00
pkgs.vimPlugins.fzf-vim
2024-07-09 07:50:48 +03:00
pkgs.vimPlugins.vim-gh-line
2024-06-11 09:40:29 +03:00
pkgs.vimPlugins.nvim-lspconfig
2024-08-19 14:59:23 +03:00
pkgs.pkgs-unstable.vimPlugins.vim-go
pkgs.pkgs-unstable.vimPlugins.zig-vim
])
];
2024-02-04 22:23:56 +02:00
extraConfig = builtins.readFile ./vimrc;
2023-11-27 18:17:27 +02:00
}
2024-02-04 22:23:56 +02:00
(lib.mkIf devTools {
extraLuaConfig =
builtins.readFile
2024-07-29 15:39:54 +03:00
(pkgs.substituteAll {
src = ./dev.lua;
inherit (pkgs) ripgrep;
}).outPath;
2024-02-04 22:23:56 +02:00
})
2023-11-27 18:17:27 +02:00
];
2024-02-04 22:23:56 +02:00
git = {
enable = true;
userEmail = email;
userName = "Motiejus Jakštys";
aliases.yolo = "commit --amend --no-edit -a";
extraConfig = {
log.date = "iso-strict-local";
2024-02-04 22:23:56 +02:00
pull.ff = "only";
2024-11-12 18:44:14 +02:00
core.abbrev = 12;
pretty.fixes = "Fixes: %h (\"%s\")";
rerere.enabled = true;
2024-02-04 22:23:56 +02:00
init.defaultBranch = "main";
merge.conflictstyle = "zdiff3";
2024-11-12 18:03:36 +02:00
sendemail = {
sendmailcmd = lib.getExe pkgs.msmtp;
smtpserveroption = [
"-a"
"mj"
];
confirm = "always";
suppresscc = "self";
};
2024-02-04 22:23:56 +02:00
};
};
gpg = {
enable = true;
mutableKeys = false;
mutableTrust = false;
publicKeys = [
{
source = ./motiejus-gpg.txt;
trust = "ultimate";
}
];
};
2024-04-26 00:05:29 +03:00
htop = {
enable = true;
settings = {
2024-04-26 11:44:02 +03:00
header_layout = "three_25_50_25";
2024-04-26 11:47:20 +03:00
column_meters_0 = "MemorySwap LoadAverage NetworkIO DiskIO";
column_meter_modes_0 = "1 2 2 2";
2024-04-26 11:44:02 +03:00
column_meters_1 = "AllCPUs4";
2024-04-26 00:05:29 +03:00
column_meter_modes_1 = "1";
2024-04-26 11:47:20 +03:00
column_meters_2 = "PressureStallIOSome PressureStallCPUSome PressureStallMemorySome Uptime";
2024-04-26 11:44:02 +03:00
column_meter_modes_2 = "2 2 2 2";
2024-04-26 08:54:31 +03:00
hide_kernel_threads = "1";
hide_userland_threads = "1";
show_cpu_frequency = "1";
show_cpu_temperature = "0";
2024-04-26 00:05:29 +03:00
};
};
2024-02-04 22:23:56 +02:00
tmux = {
enable = true;
keyMode = "vi";
historyLimit = 1000000;
extraConfig = ''
2024-09-06 09:59:47 +03:00
bind k clear-history
2024-02-04 22:23:56 +02:00
bind c new-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind '"' split-window -v -c "#{pane_current_path}"
2024-04-10 10:13:23 +03:00
# neovim :checkhealth
set-option -sg escape-time 10
set-option -g default-terminal "screen-256color"
2024-04-10 10:16:03 +03:00
set-option -sa terminal-features ',xterm-256color:RGB'
2024-02-04 22:23:56 +02:00
'';
};
}
2024-07-29 15:39:54 +03:00
(lib.mkIf (!hmOnly) {
bash = {
enable = true;
shellAliases = {
"l" = "echo -n ł | xclip -selection clipboard";
"L" = "echo -n Ł | xclip -selection clipboard";
2024-07-29 15:39:54 +03:00
"gp" = "${pkgs.git}/bin/git remote | ${pkgs.parallel}/bin/parallel --verbose git push";
2024-02-04 22:23:56 +02:00
};
2024-07-29 15:39:54 +03:00
initExtra = ''
t() { git rev-parse --show-toplevel; }
d() { date --utc --date=@$(echo "$1" | sed -E 's/^[^1-9]*([0-9]{10}).*/\1/') +"%F %T"; }
source ${./gg.sh}
'';
};
})
2024-02-04 22:23:56 +02:00
];
}