config/shared/home/default.nix

201 lines
4.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,
2023-10-06 14:32:52 +03:00
email,
2023-12-11 20:05:32 +02:00
fullDesktop,
2023-10-27 10:31:00 +03:00
hmOnly,
2024-02-04 16:18:47 +02:00
username ? "motiejus",
...
2024-02-02 11:06:36 +02:00
}: let
pkgNicer = pkgs.writeShellApplication {
name = "nicer";
text = ''
f=$(${pkgs.coreutils}/bin/mktemp)
trap '${pkgs.coreutils}/bin/rm -f "$f"' EXIT
${pkgs.coreutils}/bin/env > "$f"
systemd-run \
--user \
--same-dir \
--slice nicer \
--nice=19 \
--property CPUSchedulingPolicy=idle \
--property IOSchedulingClass=idle \
--property IOSchedulingPriority=7 \
--pty \
--pipe \
--wait \
--collect \
--quiet \
--property EnvironmentFile="$f" \
--service-type=exec \
-- "$@"
'';
};
2024-02-02 13:51:43 +02:00
# from https://github.com/Gerg-L/demoninajar/blob/39964f198dbfa34c21f81c35370fab312b476051/homes/veritas_manjaro/nixGL.nix#L42
mkWrapped = wrap: orig-pkg: execName:
pkgs.makeOverridable
(
attrs: let
pkg = orig-pkg.override attrs;
outs = pkg.meta.outputsToInstall;
paths = pkgs.lib.attrsets.attrVals outs pkg;
nonTrivialOuts = pkgs.lib.lists.remove "out" outs;
metaAttributes =
pkgs.lib.attrsets.getAttrs
(
[
"name"
"pname"
"version"
"meta"
]
++ nonTrivialOuts
)
pkg;
in
pkgs.symlinkJoin (
{
inherit paths;
2024-02-02 13:54:06 +02:00
nativeBuildInputs = [pkgs.makeWrapper];
2024-02-02 13:51:43 +02:00
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
)
)
{};
glintel = mkWrapped pkgs.nixgl.nixGLIntel;
2024-02-02 11:06:36 +02:00
in {
home = {
2024-02-04 16:18:47 +02:00
inherit stateVersion username;
homeDirectory = "/home/${username}";
};
2023-10-23 09:48:14 +03:00
home.packages = with pkgs;
2023-12-12 13:16:02 +02:00
lib.mkMerge [
2024-02-02 11:06:36 +02:00
[pkgNicer]
2023-12-12 13:16:02 +02:00
(lib.mkIf fullDesktop [
2023-10-27 10:31:00 +03:00
go
2023-12-18 22:57:09 +02:00
zig
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 [
2023-10-27 10:31:00 +03:00
ncdu
tokei
2023-12-07 10:24:58 +02:00
scrcpy
yt-dlp
2024-01-03 09:39:40 +02:00
kubectl
2023-10-27 10:31:00 +03:00
vimv-rs
2023-12-14 10:10:00 +02:00
bandwhich
2023-10-27 10:31:00 +03:00
hyperfine
2023-12-12 13:16:02 +02:00
])
];
2023-11-27 18:17:27 +02:00
programs = {
direnv.enable = true;
2024-02-02 14:18:04 +02:00
man = {
enable = true;
generateCaches = true;
};
2023-12-11 20:05:32 +02:00
firefox = lib.mkIf fullDesktop {
enable = true;
# firefox doesn't need the wrapper on the personal laptop
package =
if hmOnly
then (glintel pkgs.firefox-bin "firefox")
else pkgs.firefox-bin;
policies.DisableAppUpdate = true;
profiles = {
xdefault = {
isDefault = true;
settings = {
2024-01-28 14:53:40 +02:00
"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
ublock-origin
consent-o-matic
joplin-web-clipper
multi-account-containers
];
};
};
};
2023-11-27 18:17:27 +02:00
neovim = lib.mkMerge [
{
enable = true;
vimAlias = true;
vimdiffAlias = true;
defaultEditor = true;
plugins = with pkgs.vimPlugins;
2023-12-12 13:16:02 +02:00
lib.mkMerge [
[fugitive]
(lib.mkIf fullDesktop [
2023-11-27 18:17:27 +02:00
vim-go
zig-vim
2023-12-12 13:16:02 +02:00
])
];
2023-11-27 18:17:27 +02:00
extraConfig = builtins.readFile ./vimrc;
}
2023-12-11 20:05:32 +02:00
(lib.mkIf fullDesktop {
2023-11-27 18:17:27 +02:00
extraLuaConfig =
builtins.readFile
(pkgs.substituteAll {
src = ./dev.lua;
2024-02-02 14:07:01 +02:00
inherit (pkgs) gotools ripgrep;
2023-11-27 18:17:27 +02:00
})
.outPath;
})
];
2023-10-06 14:52:44 +03:00
2023-11-27 18:17:27 +02:00
git = {
enable = true;
userEmail = email;
userName = "Motiejus Jakštys";
aliases.yolo = "commit --amend --no-edit -a";
extraConfig = {
rerere.enabled = true;
pull.ff = "only";
merge.conflictstyle = "diff3";
init.defaultBranch = "main";
};
};
gpg = {
enable = true;
mutableKeys = false;
mutableTrust = false;
publicKeys = [
{
source = ./motiejus-gpg.txt;
trust = "ultimate";
}
];
};
tmux = {
enable = true;
keyMode = "vi";
historyLimit = 1000000;
extraConfig = ''
bind c new-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind '"' split-window -v -c "#{pane_current_path}"
'';
};
2023-10-06 14:52:44 +03:00
};
}