From b4aa7c5596ac483d67e452186f35f0ae3bc55a23 Mon Sep 17 00:00:00 2001 From: chayleaf Date: Sun, 19 Feb 2023 19:09:38 +0700 Subject: [PATCH] yomichan, fish, build librewolf from source, etc --- home/_sources/generated.json | 15 +++ home/_sources/generated.nix | 8 ++ home/common/firefox.nix | 33 ------ home/common/firefox/addons.json | 5 + home/common/firefox/addons.nix | 17 +++ home/common/firefox/default.nix | 99 +++++++++++++++++ home/common/firefox/generated.nix | 17 +++ home/common/fish.nix | 169 ++++++++++++++++++++++++++++++ home/common/general.nix | 13 ++- home/common/gui.nix | 7 +- home/common/i3-sway.nix | 157 +++++---------------------- home/common/options.nix | 5 - home/common/waybar.nix | 105 +++++++++++++++++++ home/common/zsh.nix | 3 - home/hosts/nixmsi.nix | 7 +- home/nvfetcher.toml | 4 + system/common/ccache.nix | 38 +++++++ system/flake.nix | 4 +- system/hosts/nixmsi.nix | 15 ++- 19 files changed, 542 insertions(+), 179 deletions(-) delete mode 100644 home/common/firefox.nix create mode 100644 home/common/firefox/addons.json create mode 100644 home/common/firefox/addons.nix create mode 100644 home/common/firefox/default.nix create mode 100644 home/common/firefox/generated.nix create mode 100644 home/common/fish.nix create mode 100644 home/common/waybar.nix create mode 100644 system/common/ccache.nix diff --git a/home/_sources/generated.json b/home/_sources/generated.json index f3c2fc0..e2aaea9 100644 --- a/home/_sources/generated.json +++ b/home/_sources/generated.json @@ -13,5 +13,20 @@ "url": "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/GE-Proton7-49/GE-Proton7-49.tar.gz" }, "version": "GE-Proton7-49" + }, + "yomichan": { + "cargoLocks": null, + "date": null, + "extract": null, + "name": "yomichan", + "passthru": null, + "pinned": false, + "src": { + "name": null, + "sha256": "sha256-l70wVXHEArifukDelZeoVxIyP2Crs6QZSD/kFdEml/8=", + "type": "url", + "url": "https://github.com/FooSoft/yomichan/releases/download/22.10.23.0/yomichan-firefox-dev.xpi" + }, + "version": "22.10.23.0" } } \ No newline at end of file diff --git a/home/_sources/generated.nix b/home/_sources/generated.nix index b8722f6..de43f35 100644 --- a/home/_sources/generated.nix +++ b/home/_sources/generated.nix @@ -9,4 +9,12 @@ sha256 = "sha256-T+7R+zFMd0yQ0v7/WGym2kzMMulUmATS/LCEQS8whiw="; }; }; + yomichan = { + pname = "yomichan"; + version = "22.10.23.0"; + src = fetchurl { + url = "https://github.com/FooSoft/yomichan/releases/download/22.10.23.0/yomichan-firefox-dev.xpi"; + sha256 = "sha256-l70wVXHEArifukDelZeoVxIyP2Crs6QZSD/kFdEml/8="; + }; + }; } diff --git a/home/common/firefox.nix b/home/common/firefox.nix deleted file mode 100644 index 10c5c10..0000000 --- a/home/common/firefox.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ config, pkgs, ... }: -{ - imports = [ ./gui.nix ]; - programs.firefox = { - enable = true; - package = pkgs.librewolf; - extensions = with config.nur.repos.rycee.firefox-addons; [ - youtube-shorts-block - vimium-c - search-by-image - unpaywall - ublock-origin - steam-database - sponsorblock - rust-search-extension - return-youtube-dislikes - protondb-for-steam - privacy-redirect - privacy-pass - noscript - localcdn - keepassxc-browser - i-dont-care-about-cookies - greasemonkey - don-t-fuck-with-paste - cookies-txt - # also yomichan, maybe i should package it - ]; - profiles = { - chayleaf = {}; - }; - }; -} diff --git a/home/common/firefox/addons.json b/home/common/firefox/addons.json new file mode 100644 index 0000000..cb89fd7 --- /dev/null +++ b/home/common/firefox/addons.json @@ -0,0 +1,5 @@ +[ + { + "slug": "youtube-nonstop" + } +] diff --git a/home/common/firefox/addons.nix b/home/common/firefox/addons.nix new file mode 100644 index 0000000..d9add27 --- /dev/null +++ b/home/common/firefox/addons.nix @@ -0,0 +1,17 @@ +{ buildFirefoxXpiAddon, fetchurl, lib, stdenv }: + { + "youtube-nonstop" = buildFirefoxXpiAddon { + pname = "youtube-nonstop"; + version = "0.9.1"; + addonId = "{0d7cafdd-501c-49ca-8ebb-e3341caaa55e}"; + url = "https://addons.mozilla.org/firefox/downloads/file/3848483/youtube_nonstop-0.9.1.xpi"; + sha256 = "8340d57622a663949ec1768eb37d47651c809fadf0ffaa5ff546c48fdd28e33d"; + meta = with lib; + { + homepage = "https://github.com/lawfx/YoutubeNonStop"; + description = "Tired of getting that \"Video paused. Continue watching?\" confirmation dialog?\nThis extension autoclicks it, so you can listen to your favorite music uninterrupted.\n\nWorking on YouTube and YouTube Music!"; + license = licenses.mit; + platforms = platforms.all; + }; + }; + } \ No newline at end of file diff --git a/home/common/firefox/default.nix b/home/common/firefox/default.nix new file mode 100644 index 0000000..8606272 --- /dev/null +++ b/home/common/firefox/default.nix @@ -0,0 +1,99 @@ +{ config, pkgs, lib, ... }: +let firefoxWithCcache = ({ useSccache, firefox-unwrapped }: + (firefox-unwrapped.override { + buildMozillaMach = (x: (pkgs.buildMozillaMach (x // { + extraConfigureFlags = x.extraConfigureFlags ++ [ + (if useSccache then "--with-ccache=sccache" else "--with-ccache") + ]; + }))); + }).overrideAttrs (prev: if useSccache then { + nativeBuildInputs = prev.nativeBuildInputs ++ [ pkgs.sccache ]; + SCCACHE_DIR = "/var/cache/sccache"; + SCCACHE_MAX_FRAME_LENGTH = "104857600"; + RUSTC_WRAPPER = "${pkgs.sccache}/bin/sccache"; + } else { + nativeBuildInputs = prev.nativeBuildInputs ++ [ pkgs.ccache ]; + CCACHE_CPP2 = "yes"; + CCACHE_COMPRESS = "1"; + CCACHE_UMASK = "007"; + CCACHE_DIR = "/var/cache/ccache"; + }) +); in { + imports = [ + ../gui.nix + ]; + programs.firefox = { + enable = true; + package = + let librewolf-unwrapped = firefoxWithCcache { + useSccache = true; + firefox-unwrapped = pkgs.librewolf-unwrapped.overrideAttrs (prev: { + MOZ_REQUIRE_SIGNING = ""; + }); + }; + in pkgs.wrapFirefox librewolf-unwrapped { + inherit (librewolf-unwrapped) extraPrefsFiles extraPoliciesFiles; + wmClass = "LibreWolf"; + libName = "librewolf"; + # TODO: keepass in extraNativeMessagingHosts? + }; + profiles = { + chayleaf = { + extensions = + with config.nur.repos.rycee.firefox-addons; + let sources = (import ../../_sources/generated.nix { + inherit (pkgs) fetchgit fetchurl fetchFromGitHub dockerTools; + }); + # addons.mozilla.org's version is horribly outdated for whatever reason + # I guess the extension normally autoupdates by itself? + # this is an unsigned build + yomichan = pkgs.stdenvNoCC.mkDerivation { + inherit (sources.yomichan) pname version src; + preferLocalBuild = true; + allowSubstitutes = true; + buildCommand = '' + dst="$out/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" + mkdir -p "$dst" + install -v -m644 "$src" "$dst/alex.testing@foosoft.net.xpi" + ''; + meta = with lib; { + homepage = "https://foosoft.net/projects/yomichan"; + description = "Yomichan turns your browser into a tool for building Japanese language literacy by helping you to decipher texts which would be otherwise too difficult tackle. It features a robust dictionary with EPWING and flashcard creation support."; + license = licenses.gpl3; + platforms = platforms.all; + }; + }; + in with (import ./generated.nix { + inherit lib stdenv fetchurl buildFirefoxXpiAddon; + }); + [ + # from rycee's repo + youtube-shorts-block + vimium-c + search-by-image + unpaywall + ublock-origin + steam-database + sponsorblock + rust-search-extension + return-youtube-dislikes + protondb-for-steam + privacy-redirect + privacy-pass + noscript + localcdn + keepassxc-browser + i-dont-care-about-cookies + greasemonkey + don-t-fuck-with-paste + cookies-txt + fastforward + + # my packages + yomichan + youtube-nonstop + ]; + }; + }; + }; +} diff --git a/home/common/firefox/generated.nix b/home/common/firefox/generated.nix new file mode 100644 index 0000000..b91ed5c --- /dev/null +++ b/home/common/firefox/generated.nix @@ -0,0 +1,17 @@ +{ buildFirefoxXpiAddon, fetchurl, lib, stdenv }: + { + "youtube-nonstop" = buildFirefoxXpiAddon { + pname = "youtube-nonstop"; + version = "0.9.1"; + addonId = "{0d7cafdd-501c-49ca-8ebb-e3341caaa55e}"; + url = "https://addons.mozilla.org/firefox/downloads/file/3848483/youtube_nonstop-0.9.1.xpi"; + sha256 = "8340d57622a663949ec1768eb37d47651c809fadf0ffaa5ff546c48fdd28e33d"; + meta = with lib; + { + homepage = "https://github.com/lawfx/YoutubeNonStop"; + description = "Tired of getting that \"Video paused. Continue watching?\" confirmation dialog?\nThis extension autoclicks it, so you can listen to your favorite music uninterrupted.\n\nWorking on YouTube and YouTube Music!"; + license = licenses.mit; + platforms = platforms.all; + }; + }; + } diff --git a/home/common/fish.nix b/home/common/fish.nix new file mode 100644 index 0000000..665b25b --- /dev/null +++ b/home/common/fish.nix @@ -0,0 +1,169 @@ +{ config, pkgs, lib, ... }: +{ + # TODO: theme (it's using fish variables...) + programs.fish = { + enable = true; + # not sure this is needed, but just in case + shellInit = '' + source /etc/fish/config.fish + ''; + interactiveShellInit = '' + ${pkgs.any-nix-shell}/bin/any-nix-shell fish --info-right | source + + # for posix compatibility + set -gx SHELL zsh + + set -gx fish_color_autosuggestion 777 brblack + set -gx fish_color_command green + set -gx fish_color_operator white + set -gx fish_color_param white + + set -gx fish_key_bindings fish_vi_key_bindings + set -gx fish_cursor_insert line + set -gx fish_cursor_replace underscore + + # set -gx doesn't work in this case for whatever reason + set -Ux _tide_left_items pwd git vi_mode + set -Ux _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 -Ux _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 -Ux _tide_right_items status cmd_duration context jobs virtual_env rustc nix_shell + + set -gx tide_aws_bg_color yellow + set -gx tide_aws_color brblack + set -gx tide_aws_icon \uf270 + set -gx tide_character_color brgreen + set -gx tide_character_color_failure brred + set -gx tide_character_icon \u276f + set -gx tide_character_vi_icon_default \u276e + set -gx tide_character_vi_icon_replace \u25b6 + set -gx tide_character_vi_icon_visual V + set -gx tide_chruby_bg_color red + set -gx tide_chruby_color black + set -gx tide_chruby_icon \ue23e + set -gx tide_cmd_duration_bg_color yellow + set -gx tide_cmd_duration_color black + set -gx tide_cmd_duration_decimals 0 + set -gx tide_cmd_duration_icon \x1d + set -gx tide_cmd_duration_threshold 3000 + set -gx tide_context_always_display false + set -gx tide_context_bg_color brblack + set -gx tide_context_color_default yellow + set -gx tide_context_color_root yellow + set -gx tide_context_color_ssh yellow + set -gx tide_context_hostname_parts 1 + set -gx tide_crystal_bg_color brwhite + set -gx tide_crystal_color black + set -gx tide_crystal_icon \u2b22 + set -gx tide_docker_bg_color blue + set -gx tide_docker_color black + set -gx tide_docker_default_contexts default colima + set -gx tide_docker_icon \uf308 + set -gx tide_git_bg_color green + set -gx tide_git_bg_color_unstable yellow + set -gx tide_git_bg_color_urgent red + set -gx tide_git_color_branch black + set -gx tide_git_color_conflicted black + set -gx tide_git_color_dirty black + set -gx tide_git_color_operation black + set -gx tide_git_color_staged black + set -gx tide_git_color_stash black + set -gx tide_git_color_untracked black + set -gx tide_git_color_upstream black + set -gx tide_git_icon \x1d + set -gx tide_git_truncation_length 24 + set -gx tide_go_bg_color brcyan + set -gx tide_go_color black + set -gx tide_go_icon \ue627 + set -gx tide_java_bg_color yellow + set -gx tide_java_color black + set -gx tide_java_icon \ue256 + set -gx tide_jobs_bg_color brblack + set -gx tide_jobs_color green + set -gx tide_jobs_icon \uf013 + set -gx tide_kubectl_bg_color blue + set -gx tide_kubectl_color black + set -gx tide_kubectl_icon \u2388 + set -gx tide_left_prompt_frame_enabled false + set -gx tide_left_prompt_items pwd git vi_mode + set -gx tide_left_prompt_prefix + set -gx tide_left_prompt_separator_diff_color \ue0b0 + set -gx tide_left_prompt_separator_same_color \ue0b1 + set -gx tide_left_prompt_suffix \ue0b0 + set -gx tide_nix_shell_bg_color brblue + set -gx tide_nix_shell_color white + set -gx tide_nix_shell_icon \uf313 + set -gx tide_node_bg_color green + set -gx tide_node_color black + set -gx tide_node_icon \u2b22 + set -gx tide_os_bg_color white + set -gx tide_os_color black + set -gx tide_os_icon \uf313 + set -gx tide_php_bg_color blue + set -gx tide_php_color black + set -gx tide_php_icon \ue608 + set -gx tide_private_mode_bg_color brwhite + set -gx tide_private_mode_color black + set -gx tide_private_mode_icon \ufaf8 + set -gx tide_prompt_add_newline_before true + set -gx tide_prompt_color_frame_and_connection brblack + set -gx tide_prompt_color_separator_same_color brblack + set -gx tide_prompt_icon_connection \x20 + set -gx tide_prompt_min_cols 34 + set -gx tide_prompt_pad_items true + set -gx tide_pwd_bg_color blue + set -gx tide_pwd_color_anchors brwhite + set -gx tide_pwd_color_dirs brwhite + set -gx tide_pwd_color_truncated_dirs white + set -gx tide_pwd_icon \x1d + set -gx tide_pwd_icon_home \uf015 + set -gx tide_pwd_icon_unwritable \uf023 + set -gx 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 -gx tide_right_prompt_frame_enabled false + set -gx tide_right_prompt_items status cmd_duration context jobs node virtual_env rustc java php chruby go kubectl toolbox terraform aws nix_shell crystal + set -gx tide_right_prompt_prefix \ue0b2 + set -gx tide_right_prompt_separator_diff_color \ue0b2 + set -gx tide_right_prompt_separator_same_color \ue0b3 + set -gx tide_right_prompt_suffix + set -gx tide_rustc_bg_color red + set -gx tide_rustc_color black + set -gx tide_rustc_icon \ue7a8 + set -gx tide_shlvl_bg_color yellow + set -gx tide_shlvl_color black + set -gx tide_shlvl_icon \uf120 + set -gx tide_shlvl_threshold 1 + set -gx tide_status_bg_color black + set -gx tide_status_bg_color_failure red + set -gx tide_status_color green + set -gx tide_status_color_failure brwhite + set -gx tide_status_icon \uf00c + set -gx tide_status_icon_failure \u2718 + set -gx tide_terraform_bg_color magenta + set -gx tide_terraform_color black + set -gx tide_terraform_icon \x1d + set -gx tide_time_bg_color white + set -gx tide_time_color black + set -gx tide_time_format + set -gx tide_toolbox_bg_color magenta + set -gx tide_toolbox_color black + set -gx tide_toolbox_icon \u2b22 + set -gx tide_vi_mode_bg_color_default black + set -gx tide_vi_mode_bg_color_insert black + set -gx tide_vi_mode_bg_color_replace black + set -gx tide_vi_mode_bg_color_visual black + set -gx tide_vi_mode_color_default green + set -gx tide_vi_mode_color_insert green + set -gx tide_vi_mode_color_replace green + set -gx tide_vi_mode_color_visual green + set -gx tide_vi_mode_icon_default \u276e + set -gx tide_vi_mode_icon_insert \u276f + set -gx tide_vi_mode_icon_replace R + set -gx tide_vi_mode_icon_visual V + set -gx tide_virtual_env_bg_color brblack + set -gx tide_virtual_env_color cyan + set -gx tide_virtual_env_icon \ue73c + ''; + plugins = with pkgs.fishPlugins; [ + { name = "tide"; src = tide.src; } + ]; + }; +} diff --git a/home/common/general.nix b/home/common/general.nix index 516aa0e..9832b18 100644 --- a/home/common/general.nix +++ b/home/common/general.nix @@ -1,6 +1,10 @@ { config, pkgs, lib, ... }: { - imports = [ ./options.nix ./zsh.nix ]; + imports = [ + ./options.nix + ./zsh.nix + ./fish.nix + ]; manual.json.enable = true; services.gpg-agent = { enable = true; @@ -8,6 +12,11 @@ maxCacheTtl = 72000; maxCacheTtlSsh = 72000; }; + home.shellAliases = { + s = "sudo -A"; + se = "sudo -AE"; + l = "lsd"; + }; programs = { atuin = { @@ -131,6 +140,6 @@ home.packages = with pkgs; [ rclone sshfs fuse file jq python3Full killall - appimage-run comma nvfetcher + appimage-run comma ]; } diff --git a/home/common/gui.nix b/home/common/gui.nix index 03a6564..9a466c1 100644 --- a/home/common/gui.nix +++ b/home/common/gui.nix @@ -128,7 +128,7 @@ # gui compat stuff qt5ct qgnomeplatform # various programs i use - keepassxc nheko qbittorrent anki mumble + keepassxc nheko qbittorrent mumble nextcloud-client gnome.zenity kdeconnect # cli tools imagemagick ffmpeg @@ -137,5 +137,10 @@ (nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; }) # might check out some day (tm) # nyxt qutebrowser + + # for updating parts of this repo + nvfetcher config.nur.repos.rycee.mozilla-addons-to-nix + + anki-bin ]; } diff --git a/home/common/i3-sway.nix b/home/common/i3-sway.nix index 22bbe9b..55ca4f4 100644 --- a/home/common/i3-sway.nix +++ b/home/common/i3-sway.nix @@ -83,6 +83,12 @@ commonConfig = { text = "#ebdadd"; }; }; + floating.criteria = [ + { class = "Anki"; title = "Add"; } + # { class = "Anki"; title = "Browse .*"; } + { class = "Anki"; title = "Statistics"; } + { class = "Anki"; title = "Preferences"; } + ]; floating.titlebar = true; fonts = { names = [ "Noto Sans Mono" "Symbols Nerd Font Mono" ]; @@ -119,7 +125,7 @@ genKeybindings = (default_options: kb: in { # TODO merge with colors in gui.nix - imports = [ ./options.nix ./gui.nix ]; + imports = [ ./options.nix ./gui.nix ./waybar.nix ]; home.sessionVariables = { BEMENU_OPTS = "--no-overlap --prompt '>' --tb '#24101a' --tf '#ebbe5f' --fb '#24101a' --nb '#24101ac0' --ab '#24101ac0' --nf '#ebdadd' --af '#ebdadd' --hb '#394893' --hf '#e66e6e' --list 30 --prefix '*' --scrollbar autohide --fn 'Noto Sans Mono' --line-height 23 --sb '#394893' --sf '#ebdadd' --scb '#6b4d52' --scf '#e66e6e'"; _JAVA_AWT_WM_NONREPARENTING = "1"; @@ -189,108 +195,6 @@ in xdg-desktop-portal-wlr xdg-desktop-portal-gtk ] else []; - services.playerctld.enable = true; - programs.waybar = { - enable = true; - package = (pkgs.waybar.override { - withMediaPlayer = true; - }).overrideAttrs (old: { - src = pkgs.fetchFromGitHub { - owner = "chayleaf"; - repo = "Waybar"; - rev = "47edd76a56120226f15852ca1f9b3e4d02567c91"; - sha256 = "sha256-s37M0ZG1S+Au68z6zC/QoJt+uLBdtFK1n1oCnWtwSc4="; - }; - }); - settings = [{ - layer = "bottom"; - # position = "bottom"; - ipc = true; - height = 40; - modules-left = [ "sway/workspaces" "sway/mode" "mpris" ]; - mpris = { - tooltip = true; - format = "{player_icon} {dynamic}"; - format-paused = "{status_icon} {dynamic}"; - interval = 10; - # tooltip-format = "{dynamic}"; - album-len = 32; - artist-len = 32; - title-len = 32; - dynamic-len = 32; - player-icons = { - default = "▶"; - mpd = "🎵"; - }; - status-icons.paused = "⏸"; - }; - "sway/workspaces" = { - disable-scroll = true; - format = "{value}{icon}"; - format-icons = { - default = ""; - focused = ""; - urgent = " "; - "2" = " 󰵅"; - "3" = " "; - "4" = " "; - "5" = " "; - }; - persistent-workspaces = { - "1" = []; "2" = []; "3" = []; "4" = []; "5" = []; - }; - }; - "sway/mode" = { - tooltip = false; - }; - modules-center = [ "sway/window" ]; - #fixed-center = false; - "sway/window" = { - format = "{title}"; - max-length = 50; - # tooltip = false; - icon = true; - rewrite = { - kitty = ""; - zsh = ""; - nheko = ""; - Nextcloud = ""; - "(.*) — LibreWolf" = "$1"; - "(.*) - KeePassXC" = "$1"; - }; - }; - modules-right = [ "memory" "cpu" "tray" "wireplumber" "clock" "sway/language" ]; - cpu = { - # format = "{usage}% "; - format = " {icon0}{icon1}{icon2}{icon3}{icon4}{icon5}{icon6}{icon7}{icon8}{icon9}{icon10}{icon11}{icon12}{icon13}{icon14}{icon15}"; - format-icons = ["▁" "▂" "▃" "▄" "▅" "▆" "▇" "█"]; - tooltip = false; - }; - memory = { - format = " {used}G"; - tooltip = false; - }; - tray = { - icon-size = 26; - spacing = 5; - }; - wireplumber = { - format = "{icon} {volume}%"; - format-muted = "ﱝ"; - format-icons = ["奄" "奔" "墳"]; - tooltip = false; - }; - clock = { - interval = 5; - format = "{:%Y-%m-%d %H:%M:%S}"; - tooltip = false; - }; - "sway/language" = { - tooltip = false; - }; - }]; - style = ./waybar.css; - }; wayland.windowManager.sway = { wrapperFeatures.gtk = true; config = let swayConfig = { @@ -377,19 +281,14 @@ in command = "~/scripts/initwm.sh"; } { - always = true; command = "${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${pkgs.clipman}/bin/clipman store --no-persist"; } - { - command = "${pkgs.swayidle}/bin/swayidle -w timeout 300 '' resume '${pkgs.sway}/bin/swaymsg \"output * dpms on\"'"; - } ]; output = { "*" = { bg = "~/var/wallpaper.jpg fill"; # improved screen latency, apparently max_render_time = "2"; - scale = builtins.toString config.displayScale; }; }; input = { @@ -409,16 +308,16 @@ in export GDK_BACKEND=wayland,x11 export GTK_USE_PORTAL=1 export XDG_CURRENT_DESKTOP=sway - # SDL3 exists, so i can't really set SDL_DYNAMIC_API - # instead, running apps with SDL_DYNAMIC_API=$SDL2_DYNAMIC_API does the trick - export SDL2_DYNAMIC_API=${pkgs.SDL2.out}/lib/libSDL2.so + export XDG_SESSION_DESKTOP=sway + # TODO: set to sdl3 compat when SDL3 releases + export SDL_DYNAMIC_API=${pkgs.SDL2.out}/lib/libSDL2.so ''; }; services.swayidle = let swaylock-start = builtins.toString (with pkgs; writeScript "swaylock-start" '' #! ${bash}/bin/bash - ${procps}/bin/pgrep -fx ${swaylock}/bin/swaylock || ${swaylock}/bin/swaylock + ${procps}/bin/pgrep -fx ${swaylock}/bin/swaylock || (${swaylock}/bin/swaylock && ${pkgs.sway}/bin/swaymsg "output * dpms on") ''); in { - enable = true; + enable = config.wayland.windowManager.sway.enable; events = [ { event = "before-sleep"; command = swaylock-start; } # after-resume, lock, unlock @@ -431,7 +330,7 @@ in command = swaylock-start; } ]; }; - programs.swaylock.settings = let textColor = "#ebdadd"; bgColor = "#24101ac0"; in { + programs.swaylock.settings = rec { image = "${config.home.homeDirectory}/var/wallpaper.jpg"; font = "Unifont"; font-size = 64; @@ -441,34 +340,34 @@ in indicator-thickness = 32; separator-color = "#00000000"; - layout-text-color = textColor; - layout-bg-color = bgColor; + layout-text-color = text-color; + layout-bg-color = inside-color; layout-border-color = "#00000000"; line-uses-inside = true; - inside-color = bgColor; - text-color = textColor; + inside-color = "#24101ac0"; + text-color = "#ebdadd"; ring-color = "#8cbf73"; # green key-hl-color = "#6398bf"; # blue bs-hl-color = "#e66e6e"; # red - inside-caps-lock-color = bgColor; - text-caps-lock-color = textColor; + inside-caps-lock-color = inside-color; + text-caps-lock-color = text-color; ring-caps-lock-color = "#ebbe5f"; # yellow - caps-lock-key-hl-color = "#6398bf"; # same as normal key-hl-color - caps-lock-bs-hl-color = "#e66e6e"; # same as normal bs-hl-color + caps-lock-key-hl-color = key-hl-color; + caps-lock-bs-hl-color = bs-hl-color; - inside-clear-color = bgColor; - text-clear-color = textColor; - ring-clear-color = "#8cbf73"; # green + inside-clear-color = inside-color; + text-clear-color = text-color; + ring-clear-color = ring-color; # green - inside-ver-color = bgColor; - text-ver-color = textColor; + inside-ver-color = inside-color; + text-ver-color = text-color; ring-ver-color = "#a64999"; # purple - inside-wrong-color = bgColor; - text-wrong-color = textColor; + inside-wrong-color = inside-color; + text-wrong-color = text-color; ring-wrong-color = "#e64e4e"; # deep-ish red }; } diff --git a/home/common/options.nix b/home/common/options.nix index 3baeeb2..f44d4f9 100644 --- a/home/common/options.nix +++ b/home/common/options.nix @@ -1,10 +1,5 @@ { lib, ... }: with lib; { - options.displayScale = mkOption { - type = types.float; - description = "display scale"; - default = 1; - }; options.terminals = mkOption { type = with types; listOf str; description = "terminal kinds (possible values are alacritty, urxvt, kitty, foot)"; diff --git a/home/common/waybar.nix b/home/common/waybar.nix new file mode 100644 index 0000000..76fa197 --- /dev/null +++ b/home/common/waybar.nix @@ -0,0 +1,105 @@ +{ config, pkgs, ... }: +{ + services.playerctld.enable = config.wayland.windowManager.sway.enable; + programs.waybar = { + enable = config.wayland.windowManager.sway.enable; + package = (pkgs.waybar.override { + withMediaPlayer = true; + }).overrideAttrs (old: { + src = pkgs.fetchFromGitHub { + owner = "chayleaf"; + repo = "Waybar"; + rev = "44984a3990d347af50c09d8492bf3853cd361b96"; + sha256 = "sha256-aiMvzB/uMaaQreCQ2T2nl4qFYW0DzMnvknvmdbGhF2c="; + }; + }); + settings = [{ + layer = "bottom"; + # position = "bottom"; + ipc = true; + height = 40; + modules-left = [ "sway/workspaces" "sway/mode" "mpris" ]; + mpris = { + tooltip = true; + format = "{player_icon} {dynamic}"; + format-paused = "{status_icon} {dynamic}"; + interval = 10; + # tooltip-format = "{dynamic}"; + album-len = 32; + artist-len = 32; + title-len = 32; + dynamic-len = 32; + player-icons = { + default = "▶"; + mpd = "🎵"; + }; + status-icons.paused = "⏸"; + }; + "sway/workspaces" = { + disable-scroll = true; + format = "{value}{icon}"; + format-icons = { + default = ""; + focused = ""; + urgent = " "; + "2" = " 󰵅"; + "3" = " "; + "4" = " "; + "5" = " "; + }; + persistent-workspaces = { + "1" = []; "2" = []; "3" = []; "4" = []; "5" = []; + }; + }; + "sway/mode" = { + tooltip = false; + }; + modules-center = [ "sway/window" ]; + #fixed-center = false; + "sway/window" = { + format = "{title}"; + max-length = 50; + # tooltip = false; + icon = true; + rewrite = { + kitty = ""; + zsh = ""; + nheko = ""; + Nextcloud = ""; + "(.*) — LibreWolf" = "$1"; + "(.*) - KeePassXC" = "$1"; + }; + }; + modules-right = [ "memory" "cpu" "tray" "wireplumber" "clock" "sway/language" ]; + cpu = { + # format = "{usage}% "; + format = " {icon0}{icon1}{icon2}{icon3}{icon4}{icon5}{icon6}{icon7}{icon8}{icon9}{icon10}{icon11}{icon12}{icon13}{icon14}{icon15}"; + format-icons = ["▁" "▂" "▃" "▄" "▅" "▆" "▇" "█"]; + tooltip = false; + }; + memory = { + format = " {used}G"; + tooltip = false; + }; + tray = { + icon-size = 26; + spacing = 5; + }; + wireplumber = { + format = "{icon} {volume}%"; + format-muted = "ﱝ"; + format-icons = ["奄" "奔" "墳"]; + tooltip = false; + }; + clock = { + interval = 5; + format = "{:%Y-%m-%d %H:%M:%S}"; + tooltip = false; + }; + "sway/language" = { + tooltip = false; + }; + }]; + style = ./waybar.css; + }; +} diff --git a/home/common/zsh.nix b/home/common/zsh.nix index 8ef342e..97bfceb 100644 --- a/home/common/zsh.nix +++ b/home/common/zsh.nix @@ -10,9 +10,6 @@ dotDir = ".config/zsh"; history.ignoreDups = true; history.path = "${config.xdg.dataHome}/zsh/zsh_history"; - shellAliases.s = "sudo -A"; - shellAliases.se = "sudo -AE"; - shellAliases.l = "lsd"; # I dont want to remap the up key, so only map this, setting ATUIN_NOBIND to true initExtra = '' up-line-or-local-history() { diff --git a/home/hosts/nixmsi.nix b/home/hosts/nixmsi.nix index f44d3a0..e4e175a 100644 --- a/home/hosts/nixmsi.nix +++ b/home/hosts/nixmsi.nix @@ -2,7 +2,7 @@ { imports = [ ../common/general.nix - ../common/firefox.nix + ../common/firefox ../common/i3-sway.nix ../common/vim.nix ../common/helix.nix @@ -11,10 +11,9 @@ home.stateVersion = "22.11"; home.username = "user"; home.homeDirectory = "/home/user"; - displayScale = 1.1; termShell = { enable = true; - path = "${pkgs.zsh}/bin/zsh"; + path = "${pkgs.fish}/bin/fish"; }; xsession.windowManager.i3.enable = true; wayland.windowManager.sway.enable = true; @@ -51,6 +50,8 @@ STEAM_EXTRA_COMPAT_TOOLS_PATHS = "${proton-ge}"; }; home.packages = with pkgs; [ + openrgb piper + steam-run steam easyeffects # wineWowPackages.waylandFull diff --git a/home/nvfetcher.toml b/home/nvfetcher.toml index 9facd71..108e685 100644 --- a/home/nvfetcher.toml +++ b/home/nvfetcher.toml @@ -1,3 +1,7 @@ [proton-ge] src.github = "GloriousEggroll/proton-ge-custom" fetch.url = "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/$ver/$ver.tar.gz" + +[yomichan] +src.github = "FooSoft/yomichan" +fetch.url = "https://github.com/FooSoft/yomichan/releases/download/$ver/yomichan-firefox-dev.xpi" diff --git a/system/common/ccache.nix b/system/common/ccache.nix new file mode 100644 index 0000000..bf0a1ff --- /dev/null +++ b/system/common/ccache.nix @@ -0,0 +1,38 @@ +{ config, lib, ... }: +{ + nix.settings.extra-sandbox-paths = lib.mkIf config.programs.ccache.enable [ + config.programs.ccache.cacheDir + "/var/cache/sccache" + ]; + environment.persistence."/persist".directories = lib.mkIf config.programs.ccache.enable [ + config.programs.ccache.cacheDir + "/var/cache/sccache" + ]; + nixpkgs.overlays = lib.mkIf (config.programs.ccache.enable && config.programs.ccache.packageNames == []) [ + (self: super: { + ccacheWrapper = super.ccacheWrapper.override { + extraConfig = '' + export CCACHE_COMPRESS=1 + export CCACHE_DIR="${config.programs.ccache.cacheDir}" + export CCACHE_UMASK=007 + if [ ! -d "$CCACHE_DIR" ]; then + echo "=====" + echo "Directory '$CCACHE_DIR' does not exist" + echo "Please create it with:" + echo " sudo mkdir -m0770 '$CCACHE_DIR'" + echo " sudo chown root:nixbld '$CCACHE_DIR'" + echo "=====" + exit 1 + fi + if [ ! -w "$CCACHE_DIR" ]; then + echo "=====" + echo "Directory '$CCACHE_DIR' is not accessible for user $(whoami)" + echo "Please verify its access permissions" + echo "=====" + exit 1 + fi + ''; + }; + }) + ]; +} diff --git a/system/flake.nix b/system/flake.nix index 1a6ea5e..b39c9a0 100644 --- a/system/flake.nix +++ b/system/flake.nix @@ -2,7 +2,8 @@ description = "NixOS configuration"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + # nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:nixos/nixpkgs"; utils.url = "github:gytis-ivaskevicius/flake-utils-plus"; nixos-hardware.url = "github:NixOS/nixos-hardware"; impermanence.url = "github:nix-community/impermanence"; @@ -27,6 +28,7 @@ inherit self inputs; hostDefaults.modules = [ ./common/vfio.nix + ./common/ccache.nix { # make this flake's nixpkgs available to the whole system nix = { diff --git a/system/hosts/nixmsi.nix b/system/hosts/nixmsi.nix index 06aa8c1..a2c4505 100644 --- a/system/hosts/nixmsi.nix +++ b/system/hosts/nixmsi.nix @@ -178,6 +178,8 @@ in { swapDevices = [ { device = "/swap/swapfile"; } ]; + services.ratbagd.enable = true; + ### SECTION 2: SYSTEM CONFIG/ENVIRONMENT ### i18n.defaultLocale = lib.mkDefault "en_US.UTF-8"; i18n.supportedLocales = lib.mkDefault [ "en_US.UTF-8/UTF-8" ]; @@ -227,11 +229,20 @@ in { rate = 48000; }; }; - # zsh - environment.pathsToLink = [ "/share/zsh" ]; + + # environment.pathsToLink = [ "/share/zsh" "/share/fish" ]; + programs.fish = { + enable = true; + }; + programs.zsh = { + enable = true; + enableBashCompletion = true; + }; programs.fuse.userAllowOther = true; + programs.ccache.enable = true; + xdg.portal = { enable = true; extraPortals = with pkgs; [ xdg-desktop-portal-gtk xdg-desktop-portal-wlr ];