home: add minimal config

This commit is contained in:
chayleaf 2024-07-13 05:33:43 +07:00
parent 543611983c
commit c85b92b4cb
Signed by: chayleaf
GPG key ID: 78171AD46227E68E
6 changed files with 70 additions and 29 deletions

View file

@ -231,7 +231,20 @@
# for each hostname, for each user, generate an attribute "${user}@${hostname}" # for each hostname, for each user, generate an attribute "${user}@${hostname}"
homeConfigurations = homeConfigurations =
builtins.listToAttrs (builtins.concatLists {
"chayleaf@hysteria" = inputs.home-manager.lib.homeManagerConfiguration {
pkgs = mkPkgs {
system = "x86_64-linux";
overlays = [ overlay ];
};
extraSpecialArgs = { inherit inputs; };
modules = [
./home/hosts/remote.nix
({ pkgs, ... }: { home.file.hysteria.source = pkgs.hysteria; })
];
};
}
// builtins.listToAttrs (builtins.concatLists
(lib.flip lib.mapAttrsToList config (lib.flip lib.mapAttrsToList config
(hostname: { system, home ? {}, ... }: (hostname: { system, home ? {}, ... }:
let let

15
home/hosts/remote.nix Normal file
View file

@ -0,0 +1,15 @@
{ inputs
, ...
}:
{
imports = [
../modules/general.nix
inputs.nur.nixosModules.nur
];
home.stateVersion = "24.05";
home.username = "chayleaf";
home.homeDirectory = "/home/chayleaf";
minimal = true;
}

View file

@ -99,10 +99,10 @@
# the following 4 values are special in some way # the following 4 values are special in some way
# (e.g. even if you use -gx to set them, it won't work) # (e.g. even if you use -gx to set them, it won't work)
set -U _tide_left_items pwd git vi_mode set -U _tide_left_items context pwd git vi_mode
set -U _tide_prompt_69105 \x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b34m\x1b\x5b44m\x20\x40PWD\x40\x20\x1b\x5b34m\x1b\x5b40m\ue0b0\x1b\x5b32m\x1b\x5b40m\x20\u276f\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b30m\ue0b0 \x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b30m\ue0b2\x1b\x5b32m\x1b\x5b40m\x20\uf00c\x20\x1b\x5b33m\x1b\x5b40m\ue0b2\x1b\x5b30m\x1b\x5b43m\x2021m\x2023s\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b33m set -U _tide_prompt_69105 \x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b34m\x1b\x5b44m\x20\x40PWD\x40\x20\x1b\x5b34m\x1b\x5b40m\ue0b0\x1b\x5b32m\x1b\x5b40m\x20\u276f\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b30m\ue0b0 \x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b30m\ue0b2\x1b\x5b32m\x1b\x5b40m\x20\uf00c\x20\x1b\x5b33m\x1b\x5b40m\ue0b2\x1b\x5b30m\x1b\x5b43m\x2021m\x2023s\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b33m
set -U _tide_prompt_79899 \x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b34m\x1b\x5b44m\x20\x40PWD\x40\x20\x1b\x5b34m\x1b\x5b40m\ue0b0\x1b\x5b32m\x1b\x5b40m\x20\u276f\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b30m\ue0b0 \x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b30m\ue0b2\x1b\x5b32m\x1b\x5b40m\x20\uf00c\x20\x1b\x5b33m\x1b\x5b40m\ue0b2\x1b\x5b30m\x1b\x5b43m\x2015s\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b33m set -U _tide_prompt_79899 \x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b34m\x1b\x5b44m\x20\x40PWD\x40\x20\x1b\x5b34m\x1b\x5b40m\ue0b0\x1b\x5b32m\x1b\x5b40m\x20\u276f\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b30m\ue0b0 \x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b30m\ue0b2\x1b\x5b32m\x1b\x5b40m\x20\uf00c\x20\x1b\x5b33m\x1b\x5b40m\ue0b2\x1b\x5b30m\x1b\x5b43m\x2015s\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b33m
set -U _tide_right_items status cmd_duration context jobs rustc nix_shell set -U _tide_right_items status cmd_duration jobs rustc nix_shell
# for the following values, -gx works too (-g doesn't) # for the following values, -gx works too (-g doesn't)
# but it pollutes children's env, so do -U # but it pollutes children's env, so do -U
@ -160,7 +160,7 @@
set -U tide_kubectl_color black set -U tide_kubectl_color black
set -U tide_kubectl_icon \u2388 set -U tide_kubectl_icon \u2388
set -U tide_left_prompt_frame_enabled false set -U tide_left_prompt_frame_enabled false
set -U tide_left_prompt_items pwd git vi_mode set -U tide_left_prompt_items context pwd git vi_mode
set -U tide_left_prompt_prefix set -U tide_left_prompt_prefix
set -U tide_left_prompt_separator_diff_color \ue0b0 set -U tide_left_prompt_separator_diff_color \ue0b0
set -U tide_left_prompt_separator_same_color \ue0b1 set -U tide_left_prompt_separator_same_color \ue0b1
@ -195,7 +195,7 @@
set -U tide_pwd_icon_unwritable \uf023 set -U tide_pwd_icon_unwritable \uf023
set -U tide_pwd_markers \x2ebzr \x2ecitc \x2egit \x2ehg \x2enode\x2dversion \x2epython\x2dversion \x2eruby\x2dversion \x2eshorten_folder_marker \x2esvn \x2eterraform Cargo\x2etoml composer\x2ejson CVS go\x2emod package\x2ejson set -U tide_pwd_markers \x2ebzr \x2ecitc \x2egit \x2ehg \x2enode\x2dversion \x2epython\x2dversion \x2eruby\x2dversion \x2eshorten_folder_marker \x2esvn \x2eterraform Cargo\x2etoml composer\x2ejson CVS go\x2emod package\x2ejson
set -U tide_right_prompt_frame_enabled false set -U tide_right_prompt_frame_enabled false
set -U tide_right_prompt_items status cmd_duration context jobs node rustc java php go kubectl toolbox terraform aws nix_shell crystal set -U tide_right_prompt_items status cmd_duration jobs node rustc java php go kubectl toolbox terraform aws nix_shell crystal
set -U tide_right_prompt_prefix \ue0b2 set -U tide_right_prompt_prefix \ue0b2
set -U tide_right_prompt_separator_diff_color \ue0b2 set -U tide_right_prompt_separator_diff_color \ue0b2
set -U tide_right_prompt_separator_same_color \ue0b3 set -U tide_right_prompt_separator_same_color \ue0b3

View file

@ -11,9 +11,9 @@
./zsh.nix ./zsh.nix
./fish.nix ./fish.nix
]; ];
manual.json.enable = true; manual.json.enable = !config.minimal;
services.gpg-agent = { services.gpg-agent = {
enable = true; enable = !config.minimal;
enableSshSupport = true; enableSshSupport = true;
maxCacheTtl = 72000; maxCacheTtl = 72000;
maxCacheTtlSsh = 72000; maxCacheTtlSsh = 72000;
@ -65,14 +65,14 @@
extraPackages = with pkgs; [ extraPackages = with pkgs; [
# utils # utils
gnused mktemp fzf coreutils-full findutils xdg-utils gnupg whois curl gnused mktemp fzf coreutils-full findutils xdg-utils gnupg whois curl
file mediainfo unzip gnutar man rclone sshfs trash-cli file mediainfo unzip gnutar man rclone
# for preview # for preview
# exa - TODO: replace with eza wrapper? # exa - TODO: replace with eza wrapper?
bat bat libarchive atool glow
libarchive atool
glow w3m
# for opening # for opening
p7zip unrar-wrapper odt2txt p7zip unrar-wrapper
] ++ lib.optionals (!config.minimal) [
odt2txt w3m sshfs trash-cli
]; ];
plugins = { plugins = {
src = pluginSrc; src = pluginSrc;
@ -92,14 +92,14 @@
home-manager.enable = true; home-manager.enable = true;
# i only use this as a login shell # i only use this as a login shell
bash = { bash = {
enable = true; enable = !config.minimal;
initExtra = '' initExtra = ''
bind -x '"\C-r": __atuin_history' bind -x '"\C-r": __atuin_history'
export ATUIN_NOBIND=true export ATUIN_NOBIND=true
''; '';
}; };
git = { git = {
enable = true; enable = !config.minimal;
package = pkgs.gitAndTools.gitFull; package = pkgs.gitAndTools.gitFull;
delta.enable = true; delta.enable = true;
extraConfig = { extraConfig = {
@ -135,7 +135,7 @@
}; };
}; };
ssh = { ssh = {
enable = true; enable = !config.minimal;
compression = true; compression = true;
}; };
tmux = { tmux = {
@ -145,7 +145,7 @@
keyMode = "vi"; keyMode = "vi";
}; };
gpg = { gpg = {
enable = true; enable = !config.minimal;
homedir = "${config.xdg.dataHome}/gnupg"; homedir = "${config.xdg.dataHome}/gnupg";
mutableKeys = true; mutableKeys = true;
mutableTrust = true; mutableTrust = true;
@ -156,7 +156,7 @@
variables.show-mode-in-prompt = true; variables.show-mode-in-prompt = true;
}; };
nix-index = { nix-index = {
enable = true; enable = !config.minimal;
# don't add pkgs.nix to PATH # don't add pkgs.nix to PATH
# use the nix that's already in PATH # use the nix that's already in PATH
# (because I use nix plugins and plugins are nix version-specific) # (because I use nix plugins and plugins are nix version-specific)
@ -168,31 +168,38 @@
# vimKeys = true; # vimKeys = true;
#}; #};
alot = { alot = {
enable = true; enable = !config.minimal;
settings = { settings = {
handle_mouse = true; handle_mouse = true;
initial_command = "search tag:inbox AND NOT tag:killed"; initial_command = "search tag:inbox AND NOT tag:killed";
prefer_plaintext = true; prefer_plaintext = true;
}; };
}; };
msmtp.enable = true; msmtp.enable = !config.minimal;
notmuch = { notmuch = {
enable = true; enable = !config.minimal;
hooks.preNew = '' hooks.preNew = ''
${config.services.mbsync.package}/bin/mbsync --all || ${pkgs.coreutils}/bin/true ${config.services.mbsync.package}/bin/mbsync --all || ${pkgs.coreutils}/bin/true
''; '';
}; };
mbsync.enable = true; mbsync.enable = !config.minimal;
}; };
#services.mbsync.enable = true; #services.mbsync.enable = true;
# TODO: see https://github.com/pazz/alot/issues/1632 # TODO: see https://github.com/pazz/alot/issues/1632
home.file.".mailcap".text = '' home.file.".mailcap" = lib.mkIf (!config.minimal) {
text = ''
text/html; ${pkgs.w3m}/bin/w3m -dump -o document_charset=%{charset} -o display_link_number=1 '%s'; nametemplate=%s.html; copiousoutput text/html; ${pkgs.w3m}/bin/w3m -dump -o document_charset=%{charset} -o display_link_number=1 '%s'; nametemplate=%s.html; copiousoutput
''; '';
};
home.file.".cache/nix-index/files".source = assert config.xdg.cacheHome == "${config.home.homeDirectory}/.cache"; inputs.nix-index-database.packages.${pkgs.system}.nix-index-database; home.file.".cache/nix-index/files" = lib.mkIf (!config.minimal) {
source =
assert config.xdg.cacheHome == "${config.home.homeDirectory}/.cache";
inputs.nix-index-database.packages.${pkgs.system}.nix-index-database;
};
systemd.user.tmpfiles.rules = builtins.map (file: "r! \"/home/${config.home.username}/${file}\"") [ systemd.user.tmpfiles.rules = lib.mkIf (!config.minimal)
(builtins.map (file: "r! \"/home/${config.home.username}/${file}\"") [
".local/share/clipman.json" ".local/share/clipman.json"
".local/state/lesshst" # I don't need less search history to persist across boots... ".local/state/lesshst" # I don't need less search history to persist across boots...
".Xauthority" ".Xauthority"
@ -301,12 +308,14 @@
] ++ builtins.map (dir: "x \"/home/${config.home.username}/${dir}/\"") [ ] ++ builtins.map (dir: "x \"/home/${config.home.username}/${dir}/\"") [
# WHY DOES THIS KEEP PART OF THE CONFIG # WHY DOES THIS KEEP PART OF THE CONFIG
".cache/keepassxc" ".cache/keepassxc"
]; ]);
home.packages = with pkgs; [ home.packages = with pkgs; [
rclone sshfs fuse rclone sshfs fuse
file jq python3Full killall file jq python3Full killall
appimage-run comma nix-output-monitor comma nix-output-monitor
unzip p7zip unrar-wrapper unzip p7zip unrar-wrapper
] ++ lib.optionals (!config.minimal) [
appimage-run
]; ];
} }

View file

@ -1,5 +1,9 @@
{ lib, config, ... }: { lib, config, ... }:
with lib; { with lib; {
options.minimal = mkOption {
type = types.bool;
default = false;
};
options.phone = { options.phone = {
enable = mkOption { enable = mkOption {
type = types.bool; type = types.bool;

View file

@ -1,7 +1,7 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
programs.zsh = { programs.zsh = {
enable = true; enable = !config.minimal;
# zsh-autosuggestions # zsh-autosuggestions
autosuggestion.enable = true; autosuggestion.enable = true;
# zsh-syntax-highlighting # zsh-syntax-highlighting