diff --git a/flake.nix b/flake.nix index 200a2ec..b4448b3 100644 --- a/flake.nix +++ b/flake.nix @@ -231,7 +231,20 @@ # for each hostname, for each user, generate an attribute "${user}@${hostname}" 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 (hostname: { system, home ? {}, ... }: let diff --git a/home/hosts/remote.nix b/home/hosts/remote.nix new file mode 100644 index 0000000..c9256e0 --- /dev/null +++ b/home/hosts/remote.nix @@ -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; +} diff --git a/home/modules/fish.nix b/home/modules/fish.nix index cd8fa58..dfb04b1 100644 --- a/home/modules/fish.nix +++ b/home/modules/fish.nix @@ -99,10 +99,10 @@ # the following 4 values are special in some way # (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_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) # but it pollutes children's env, so do -U @@ -160,7 +160,7 @@ set -U tide_kubectl_color black set -U tide_kubectl_icon \u2388 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_separator_diff_color \ue0b0 set -U tide_left_prompt_separator_same_color \ue0b1 @@ -195,7 +195,7 @@ 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_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_separator_diff_color \ue0b2 set -U tide_right_prompt_separator_same_color \ue0b3 diff --git a/home/modules/general.nix b/home/modules/general.nix index e92cad4..64879ee 100644 --- a/home/modules/general.nix +++ b/home/modules/general.nix @@ -11,9 +11,9 @@ ./zsh.nix ./fish.nix ]; - manual.json.enable = true; + manual.json.enable = !config.minimal; services.gpg-agent = { - enable = true; + enable = !config.minimal; enableSshSupport = true; maxCacheTtl = 72000; maxCacheTtlSsh = 72000; @@ -65,14 +65,14 @@ extraPackages = with pkgs; [ # utils 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 # exa - TODO: replace with eza wrapper? - bat - libarchive atool - glow w3m + bat libarchive atool glow # for opening - p7zip unrar-wrapper odt2txt + p7zip unrar-wrapper + ] ++ lib.optionals (!config.minimal) [ + odt2txt w3m sshfs trash-cli ]; plugins = { src = pluginSrc; @@ -92,14 +92,14 @@ home-manager.enable = true; # i only use this as a login shell bash = { - enable = true; + enable = !config.minimal; initExtra = '' bind -x '"\C-r": __atuin_history' export ATUIN_NOBIND=true ''; }; git = { - enable = true; + enable = !config.minimal; package = pkgs.gitAndTools.gitFull; delta.enable = true; extraConfig = { @@ -135,7 +135,7 @@ }; }; ssh = { - enable = true; + enable = !config.minimal; compression = true; }; tmux = { @@ -145,7 +145,7 @@ keyMode = "vi"; }; gpg = { - enable = true; + enable = !config.minimal; homedir = "${config.xdg.dataHome}/gnupg"; mutableKeys = true; mutableTrust = true; @@ -156,7 +156,7 @@ variables.show-mode-in-prompt = true; }; nix-index = { - enable = true; + enable = !config.minimal; # don't add pkgs.nix to PATH # use the nix that's already in PATH # (because I use nix plugins and plugins are nix version-specific) @@ -168,31 +168,38 @@ # vimKeys = true; #}; alot = { - enable = true; + enable = !config.minimal; settings = { handle_mouse = true; initial_command = "search tag:inbox AND NOT tag:killed"; prefer_plaintext = true; }; }; - msmtp.enable = true; + msmtp.enable = !config.minimal; notmuch = { - enable = true; + enable = !config.minimal; hooks.preNew = '' ${config.services.mbsync.package}/bin/mbsync --all || ${pkgs.coreutils}/bin/true ''; }; - mbsync.enable = true; + mbsync.enable = !config.minimal; }; #services.mbsync.enable = true; # TODO: see https://github.com/pazz/alot/issues/1632 - home.file.".mailcap".text = '' - text/html; ${pkgs.w3m}/bin/w3m -dump -o document_charset=%{charset} -o display_link_number=1 '%s'; nametemplate=%s.html; copiousoutput - ''; + 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 + ''; + }; - 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/state/lesshst" # I don't need less search history to persist across boots... ".Xauthority" @@ -301,12 +308,14 @@ ] ++ builtins.map (dir: "x \"/home/${config.home.username}/${dir}/\"") [ # WHY DOES THIS KEEP PART OF THE CONFIG ".cache/keepassxc" - ]; + ]); home.packages = with pkgs; [ rclone sshfs fuse file jq python3Full killall - appimage-run comma nix-output-monitor + comma nix-output-monitor unzip p7zip unrar-wrapper + ] ++ lib.optionals (!config.minimal) [ + appimage-run ]; } diff --git a/home/modules/options.nix b/home/modules/options.nix index 03d33c6..67192a5 100644 --- a/home/modules/options.nix +++ b/home/modules/options.nix @@ -1,5 +1,9 @@ { lib, config, ... }: with lib; { + options.minimal = mkOption { + type = types.bool; + default = false; + }; options.phone = { enable = mkOption { type = types.bool; diff --git a/home/modules/zsh.nix b/home/modules/zsh.nix index c5f0caf..368cbe7 100644 --- a/home/modules/zsh.nix +++ b/home/modules/zsh.nix @@ -1,7 +1,7 @@ { config, pkgs, ... }: { programs.zsh = { - enable = true; + enable = !config.minimal; # zsh-autosuggestions autosuggestion.enable = true; # zsh-syntax-highlighting