From 159542369d9ff074245183ccde036b4daf72c5eb Mon Sep 17 00:00:00 2001 From: chayleaf Date: Mon, 20 Feb 2023 00:49:39 +0700 Subject: [PATCH] rofi, osu-lazer-bin, etc --- .gitignore | 1 - home/common/firefox/addons.json | 3 + home/common/firefox/addons.nix | 17 ------ home/common/firefox/default.nix | 3 +- home/common/firefox/generated.nix | 15 ++++- home/common/general.nix | 4 ++ home/common/home-daemon.nix | 4 +- home/common/i3-sway.nix | 99 ++++++++++++++++++++++++------- home/common/terminal.nix | 16 ++--- home/flake.lock | 21 +++++++ home/flake.nix | 7 ++- home/hosts/nixmsi.nix | 6 +- home/overlays.nix | 2 +- 13 files changed, 141 insertions(+), 57 deletions(-) delete mode 100644 home/common/firefox/addons.nix diff --git a/.gitignore b/.gitignore index 09a4781..a211cae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -flake.lock private.nix diff --git a/home/common/firefox/addons.json b/home/common/firefox/addons.json index cb89fd7..7cfa6e3 100644 --- a/home/common/firefox/addons.json +++ b/home/common/firefox/addons.json @@ -1,5 +1,8 @@ [ { "slug": "youtube-nonstop" + }, + { + "slug": "middle-mouse-button-scroll" } ] diff --git a/home/common/firefox/addons.nix b/home/common/firefox/addons.nix deleted file mode 100644 index d9add27..0000000 --- a/home/common/firefox/addons.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ 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 index 8606272..0236f44 100644 --- a/home/common/firefox/default.nix +++ b/home/common/firefox/default.nix @@ -78,7 +78,7 @@ let firefoxWithCcache = ({ useSccache, firefox-unwrapped }: rust-search-extension return-youtube-dislikes protondb-for-steam - privacy-redirect + libredirect privacy-pass noscript localcdn @@ -92,6 +92,7 @@ let firefoxWithCcache = ({ useSccache, firefox-unwrapped }: # my packages yomichan youtube-nonstop + middle-mouse-button-scroll ]; }; }; diff --git a/home/common/firefox/generated.nix b/home/common/firefox/generated.nix index b91ed5c..d7974a0 100644 --- a/home/common/firefox/generated.nix +++ b/home/common/firefox/generated.nix @@ -1,5 +1,18 @@ { buildFirefoxXpiAddon, fetchurl, lib, stdenv }: { + "middle-mouse-button-scroll" = buildFirefoxXpiAddon { + pname = "middle-mouse-button-scroll"; + version = "0.3.2"; + addonId = "{b687f6ef-3299-4a75-8279-8b1c30dfcc9d}"; + url = "https://addons.mozilla.org/firefox/downloads/file/3505309/middle_mouse_button_scroll-0.3.2.xpi"; + sha256 = "d21d29b29a7bd3fae5407d995737c4c41d66daf73729b88ad39d149223362412"; + meta = with lib; + { + homepage = "https://github.com/StoyanDimitrov/middle-mouse-button-scroll"; + description = "Scroll fast or precise through long documents with pressed middle mouse button"; + platforms = platforms.all; + }; + }; "youtube-nonstop" = buildFirefoxXpiAddon { pname = "youtube-nonstop"; version = "0.9.1"; @@ -14,4 +27,4 @@ platforms = platforms.all; }; }; - } + } \ No newline at end of file diff --git a/home/common/general.nix b/home/common/general.nix index 9832b18..addc02c 100644 --- a/home/common/general.nix +++ b/home/common/general.nix @@ -135,6 +135,10 @@ mutableTrust = true; }; nix-index.enable = true; + readline = { + enable = true; + variables.editing-mode = "vi"; + }; }; home.packages = with pkgs; [ diff --git a/home/common/home-daemon.nix b/home/common/home-daemon.nix index 4d743b3..5c59ba7 100644 --- a/home/common/home-daemon.nix +++ b/home/common/home-daemon.nix @@ -1,5 +1,5 @@ -{ lib, pkgs, ... }: -pkgs.rustPlatform.buildRustPackage { +{ lib, rustPlatform }: +rustPlatform.buildRustPackage { pname = "home-daemon"; version = "0.1"; diff --git a/home/common/i3-sway.nix b/home/common/i3-sway.nix index 55ca4f4..7e2a87f 100644 --- a/home/common/i3-sway.nix +++ b/home/common/i3-sway.nix @@ -44,9 +44,16 @@ barConfig = { }; }; commonConfig = { - modifier = modifier; + inherit modifier; startup = [ - { command = "~/scripts/initwm.sh"; } + { command = builtins.toString (with pkgs; writeShellScript "init-wm" '' + ${callPackage ./home-daemon.nix {}}/bin/dotfiles-home-daemon system76-scheduler& + ${gnome.zenity}/bin/zenity --password | (${keepassxc}/bin/keepassxc --pw-stdin ~/Nextcloud/keepass.kdbx&) + # nextcloud and nheko need secret service access + ${nextcloud-client}/bin/nextcloud --background& + ${nheko}/bin/nheko& + ${tdesktop}/bin/telegram-desktop -startintray& + ''); } ]; colors = { focused = { @@ -85,7 +92,6 @@ commonConfig = { }; floating.criteria = [ { class = "Anki"; title = "Add"; } - # { class = "Anki"; title = "Browse .*"; } { class = "Anki"; title = "Statistics"; } { class = "Anki"; title = "Preferences"; } ]; @@ -99,7 +105,6 @@ commonConfig = { smartGaps = true; inner = 10; }; - menu = "${pkgs.bemenu}/bin/bemenu-run --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'"; window.hideEdgeBorders = "smart"; workspaceAutoBackAndForth = true; }; @@ -124,10 +129,9 @@ genKeybindings = (default_options: kb: ); in { - # TODO merge with colors in gui.nix + # TODO merge with colors in gui.nix and terminal.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"; GTK_IM_MODULE = "fcitx"; QT_IM_MODULE = "fcitx"; @@ -165,6 +169,7 @@ in statusCommand = "${pkgs.i3status}/bin/i3status"; }) ]; + menu = "${pkgs.rofi}/bin/rofi -show drun"; keybindings = genKeybindings options.xsession.windowManager.i3 { XF86AudioRaiseVolume = "exec ${pkgs.pamixer}/bin/pamixer --increase 5"; XF86AudioLowerVolume = "exec ${pkgs.pamixer}/bin/pamixer --decrease 5"; @@ -174,7 +179,7 @@ in XF86AudioPrev = "exec ${pkgs.playerctl}/bin/playerctl previous"; }; terminal = config.terminalBinX; - }; in i3Config // commonConfig // i3Config; + }; in commonConfig // i3Config; }; home.file.".xinitrc".text = '' if test -z "$DBUS_SESSION_BUS_ADDRESS"; then @@ -189,12 +194,6 @@ in xsession.initExtra = '' setxkbmap -layout jp,ru -option compose:ralt,grp:win_space_toggle ''; - home.packages = with pkgs; if config.wayland.windowManager.sway.enable then [ - wl-clipboard - xdg-desktop-portal - xdg-desktop-portal-wlr - xdg-desktop-portal-gtk - ] else []; wayland.windowManager.sway = { wrapperFeatures.gtk = true; config = let swayConfig = { @@ -207,13 +206,13 @@ in } ]; terminal = config.terminalBin; - window.commands = [ + window = commonConfig.window // { commands = [ { command = "floating enable; move workspace current"; criteria = { app_id = "^org.keepassxc.KeePassXC$"; title = "^KeePassXC - (?:Browser |ブラウザーの)?(?:Access Request|アクセス要求)$"; }; } - ]; + ]; }; assigns = { "2" = [ { app_id = "org.telegram.desktop"; } @@ -272,14 +271,11 @@ in "--locked --inhibited XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next"; "--locked --inhibited XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous"; }); - startup = [ + startup = commonConfig.startup ++ [ { always = true; command = "systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP"; } - { - command = "~/scripts/initwm.sh"; - } { command = "${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${pkgs.clipman}/bin/clipman store --no-persist"; } @@ -297,9 +293,9 @@ in xkb_options = "compose:ralt,grp:win_space_toggle"; }; }; - }; in swayConfig // commonConfig // swayConfig; + menu = "${pkgs.rofi-wayland}/bin/rofi -show drun"; + }; in commonConfig // swayConfig; extraSessionCommands = '' - export BEMENU_BACKEND=wayland export SDL_VIDEODRIVER=wayland export QT_QPA_PLATFORM=wayland export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 @@ -327,7 +323,8 @@ in command = "${pkgs.sway}/bin/swaymsg \"output * dpms off\""; resumeCommand = "${pkgs.sway}/bin/swaymsg \"output * dpms on\""; } { timeout = 600; - command = swaylock-start; } + command = swaylock-start; + resumeCommand = "${pkgs.sway}/bin/swaymsg \"output * dpms on\""; } ]; }; programs.swaylock.settings = rec { @@ -370,4 +367,62 @@ in text-wrong-color = text-color; ring-wrong-color = "#e64e4e"; # deep-ish red }; + home.packages = with pkgs; if config.wayland.windowManager.sway.enable then [ + wl-clipboard + xdg-desktop-portal + xdg-desktop-portal-wlr + xdg-desktop-portal-gtk + ] else []; + programs.rofi = { + enable = true; + font = "Noto Sans Mono 12"; + package = lib.mkIf config.wayland.windowManager.sway.enable pkgs.rofi-wayland; + plugins = with pkgs; [ + rofi-calc + ]; + theme = with config.lib.formats.rasi; let transparent = mkLiteral "transparent"; in { + "*" = rec { + highlight = mkLiteral "bold italic"; + scrollbar = true; + + background = transparent; + background-color = mkLiteral "#24101a80"; + foreground = mkLiteral "#ebdadd"; + border-color = foreground; + separatorcolor = border-color; + scrollbar-handle = border-color; + + normal-background = transparent; + normal-foreground = foreground; + alternate-normal-background = transparent; + alternate-normal-foreground = normal-foreground; + selected-normal-background = mkLiteral "#394893"; + selected-normal-foreground = mkLiteral "#e66e6e"; + + active-background = foreground; + active-foreground = mkLiteral "#24101a"; + alternate-active-background = active-background; + alternate-active-foreground = active-foreground; + selected-active-background = mkLiteral "#e66e6e"; + selected-active-foreground = mkLiteral "#394893"; + + urgent-background = mkLiteral "#e66e6e"; + urgent-foreground = foreground; + alternate-urgent-background = urgent-background; + alternate-urgent-foreground = urgent-foreground; + selected-urgent-background = mkLiteral "#394893"; + selected-urgent-foreground = mkLiteral "#ebbe5f"; + }; + "@import" = "gruvbox-common.rasi"; + }; + terminal = config.terminalBin; + extraConfig = { + icon-theme = "hicolor"; + drun-match-fields = "name,generic,exec,keywords"; + show-icons = true; + sort = true; + sorting-method = "fzf"; + steal-focus = true; + }; + }; } diff --git a/home/common/terminal.nix b/home/common/terminal.nix index b1e5f97..8d71151 100644 --- a/home/common/terminal.nix +++ b/home/common/terminal.nix @@ -16,14 +16,14 @@ in { terminalBinX = getTerminalBin (lib.lists.findFirst (term: term != "foot") null config.terminals); colors = { base = [ - "523b3f" - "e66e6e" - "8cbf73" - "ebbe5f" - "5968b3" - "a64999" - "77c7c2" - "f0e4e6" + "523b3f" # black + "e66e6e" # red + "8cbf73" # green + "ebbe5f" # yellow + "5968b3" # blue + "a64999" # magenta + "77c7c2" # cyan + "f0e4e6" # white "6b4d52" "e66e6e" "8cbf73" diff --git a/home/flake.lock b/home/flake.lock index 559a6b5..8af6bd5 100644 --- a/home/flake.lock +++ b/home/flake.lock @@ -21,6 +21,26 @@ "type": "github" } }, + "nix-gaming": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1676564857, + "narHash": "sha256-E2O086asoR2sFhsEvPVCdneVYNoP1JbQ4B8OcIdpdPU=", + "owner": "fufexan", + "repo": "nix-gaming", + "rev": "dbe7029d83ff8ab3db3e379c7a1fb65a309c5c54", + "type": "github" + }, + "original": { + "owner": "fufexan", + "repo": "nix-gaming", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1676795730, @@ -52,6 +72,7 @@ "root": { "inputs": { "home-manager": "home-manager", + "nix-gaming": "nix-gaming", "nixpkgs": "nixpkgs", "nur": "nur" } diff --git a/home/flake.nix b/home/flake.nix index c47a39f..f623d15 100644 --- a/home/flake.nix +++ b/home/flake.nix @@ -9,9 +9,13 @@ url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + nix-gaming = { + url = "github:fufexan/nix-gaming"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixpkgs, home-manager, nur }: + outputs = { self, nixpkgs, home-manager, nur, nix-gaming }: let # IRL-related private config priv = if builtins.pathExists ./private.nix then (import ./private.nix) else {}; @@ -22,6 +26,7 @@ pkgs = nixpkgs.legacyPackages."x86_64-linux"; modules = [ nur.nixosModules.nur + { nixpkgs.overlays = [ nix-gaming.overlays.default ]; } ./hosts/nixmsi.nix (getPriv "nixmsi") ]; diff --git a/home/hosts/nixmsi.nix b/home/hosts/nixmsi.nix index e4e175a..3b941ca 100644 --- a/home/hosts/nixmsi.nix +++ b/home/hosts/nixmsi.nix @@ -35,6 +35,7 @@ "steam-original" "steam-runtime" "steamcmd" + "osu-lazer-bin" ]; home.sessionVariables = let sources = (import ../_sources/generated.nix { inherit (pkgs) fetchgit fetchurl fetchFromGitHub dockerTools; @@ -51,18 +52,17 @@ }; home.packages = with pkgs; [ openrgb piper - steam-run steam + osu-lazer-bin easyeffects # wineWowPackages.waylandFull winetricks protontricks # proton-caller - bottles + # bottles virtmanager gimp krita blender tdesktop clang rustc rustfmt cargo clippy - (import ../common/home-daemon.nix { inherit lib pkgs; }) # waiting until the PR gets merged (looking-glass-client.overrideAttrs (old: { version = "B6"; diff --git a/home/overlays.nix b/home/overlays.nix index 68a482c..40a060c 100644 --- a/home/overlays.nix +++ b/home/overlays.nix @@ -1,2 +1,2 @@ # [ (import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz")) ] -[ (import ) ] +[ (import ) (import ).overlays.default ]