diff --git a/flake.lock b/flake.lock index d97fd18..5ac22f5 100644 --- a/flake.lock +++ b/flake.lock @@ -25,11 +25,11 @@ ] }, "locked": { - "lastModified": 1702056258, - "narHash": "sha256-Fjhxm6GYq6Tos+Za5slrLRlc+UicOxgzGIxLNtoJpEA=", + "lastModified": 1703247585, + "narHash": "sha256-EHtgF4H68e7Ft1+ICiInUmEfBIfKW7tLHAapp868WHQ=", "owner": "chayleaf", "repo": "coop-ofd", - "rev": "a96a20b176da515ec090a783de39aa8d9e573be1", + "rev": "02ce0fe10c22de27d02aff22f926bd26ee60c0ab", "type": "github" }, "original": { diff --git a/home/common/general.nix b/home/common/general.nix index cdfc6c3..3a0d815 100644 --- a/home/common/general.nix +++ b/home/common/general.nix @@ -20,9 +20,9 @@ ll = "lsd -l"; g = "git"; gp = "git push"; - gpuo = "git push -u origin"; gr = "git rebase"; gri = "git rebase -i"; + grc = "git rebase --continue"; gc = "git commit"; gca = "git commit --amend"; gm = "git merge"; @@ -38,22 +38,21 @@ }; nnn = let pluginSrc = "${pkgs.nnn.src}/plugins"; in { enable = true; - package = (pkgs.nnn.override ({ withNerdIcons = true; })).overrideAttrs (oldAttrs: { + package = (pkgs.nnn.override { withNerdIcons = true; }).overrideAttrs (oldAttrs: { # no need to add makeWrapper to nativeBuildInputs as home-manager does it already postInstall = let nnnArchiveRegex = "\\.(${lib.strings.concatStringsSep "|" [ "7z" "a" "ace" "alz" "arc" "arj" "bz" "bz2" "cab" "cpio" "deb" "gz" "jar" "lha" "lz" "lzh" "lzma" "lzo" "rar" "rpm" "rz" "t7z" "tar" "tbz" "tbz2" "tgz" "tlz" "txz" "tZ" "tzo" "war" "xpi" "xz" "Z" "zip" - ]})$"; in with lib; with strings; '' - wrapProgram $out/bin/nnn \ - --set GUI 1 \ - --set NNN_OPENER ${escapeShellArg "${pluginSrc}/nuke"} \ - --set NNN_ARCHIVE ${escapeShellArg nnnArchiveRegex} \ - --add-flags ${ + ]})$"; in '' + wrapProgram $out/bin/nnn ${lib.escapeShellArgs [ + "--set" "GUI" "1" + "--set" "NNN_OPENER" "${pluginSrc}/nuke" + "--set" "NNN_ARCHIVE" nnnArchiveRegex # -a: auto create fifo file # -c: use NNN_OPENER # -x: x server features - escapeShellArg "-a -c -x" - } + "--add-flags" "-a -c -x" + ]} ''; }); extraPackages = with pkgs; [ diff --git a/home/common/gui.nix b/home/common/gui.nix index 4ae4022..abf8e90 100644 --- a/home/common/gui.nix +++ b/home/common/gui.nix @@ -1,6 +1,13 @@ { config, pkgs, lib, ... }: { imports = [ ./terminal.nix ]; + systemd.user.services.fcitx5-daemon = { + Unit.After = "graphical-session-pre.target"; + Service = { + Restart = "on-failure"; + RestartSec = 3; + }; + }; i18n.inputMethod = let fcitx5-qt = pkgs.libsForQt5.fcitx5-qt; in { enabled = "fcitx5"; fcitx5.addons = with pkgs; [ fcitx5-lua fcitx5-gtk fcitx5-mozc fcitx5-configtool fcitx5-qt ]; @@ -24,7 +31,7 @@ # this is for steam games, I set the launch options to: # `SDL_DYNAMIC_API=$SDL2_DYNAMIC_API %command%` # Steam itself doesn't work with SDL2_DYNAMIC_API set, so it's - # a bad idea to set SDL2_DYNAMIC_API globally + # a bad idea to set SDL_DYNAMIC_API globally SDL2_DYNAMIC_API = "${pkgs.SDL2}/lib/libSDL2.so"; }; programs.nnn.extraPackages = with pkgs; [ @@ -216,15 +223,6 @@ enable = true; }; - systemd.user.services = { - fcitx5-daemon = { - Unit.After = "graphical-session-pre.target"; - Service = { - Restart = "on-failure"; - RestartSec = 3; - }; - }; - }; # i run this manually instead #services.nextcloud-client = { # enable = true; @@ -249,7 +247,7 @@ qt5ct qgnomeplatform # various programs i use keepassxc nheko qbittorrent mumble - nextcloud-client gnome.zenity kdeconnect + nextcloud-client kdeconnect # cli tools imagemagick ffmpeg-full xdg-utils # fonts @@ -263,7 +261,5 @@ nix-init 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 11ecd09..fd75c26 100644 --- a/home/common/i3-sway.nix +++ b/home/common/i3-sway.nix @@ -3,35 +3,35 @@ let modifier = "Mod4"; rofiSway = config.programs.rofi.finalPackage; rofiI3 = pkgs.rofi.override { plugins = config.programs.rofi.plugins; }; -audioNext = with pkgs; writeShellScript "playerctl-next" '' - ${playerctl}/bin/playerctl next - PLAYER=$(${playerctl}/bin/playerctl -l | head -n 1) +audioNext = pkgs.writeShellScript "playerctl-next" '' + ${pkgs.playerctl}/bin/playerctl next + PLAYER=$(${pkgs.playerctl}/bin/playerctl -l | head -n 1) # mpdris2 bug: audio wont play after a seek/skip, you have to pause-unpause if [[ "$PLAYER" == "mpd" ]]; then - ${playerctl}/bin/playerctl pause - ${playerctl}/bin/playerctl position 0 - ${playerctl}/bin/playerctl play + ${pkgs.playerctl}/bin/playerctl pause + ${pkgs.playerctl}/bin/playerctl position 0 + ${pkgs.playerctl}/bin/playerctl play fi ''; -audioPrev = with pkgs; writeShellScript "playerctl-prev" '' +audioPrev = pkgs.writeShellScript "playerctl-prev" '' # just seek if over 5 seconds into the track - POS=$(${playerctl}/bin/playerctl position) - PLAYER=$(${playerctl}/bin/playerctl -l | head -n 1) + POS=$(${pkgs.playerctl}/bin/playerctl position) + PLAYER=$(${pkgs.playerctl}/bin/playerctl -l | head -n 1) if [ -n "$POS" ]; then - if (( $(echo "$POS > 5.01" | ${bc}/bin/bc -l) )); then + if (( $(echo "$POS > 5.01" | ${pkgs.bc}/bin/bc -l) )); then SEEK=1 fi fi if [ -z "$SEEK" ]; then - ${playerctl}/bin/playerctl previous + ${pkgs.playerctl}/bin/playerctl previous else - ${playerctl}/bin/playerctl position 0 + ${pkgs.playerctl}/bin/playerctl position 0 fi # mpdris2 bug: audio wont play after a seek/skip, you have to pause-unpause if [[ "$PLAYER" == "mpd" ]]; then - ${playerctl}/bin/playerctl pause - ${playerctl}/bin/playerctl position 0 - ${playerctl}/bin/playerctl play + ${pkgs.playerctl}/bin/playerctl pause + ${pkgs.playerctl}/bin/playerctl position 0 + ${pkgs.playerctl}/bin/playerctl play fi ''; barConfig = { @@ -79,13 +79,13 @@ barConfig = { commonConfig = { inherit modifier; startup = [ - { command = builtins.toString (with pkgs; writeShellScript "init-wm" '' - ${home-daemon}/bin/home-daemon system76-scheduler& - ${gnome.zenity}/bin/zenity --password | (${keepassxc}/bin/keepassxc --pw-stdin ~/Nextcloud/keepass.kdbx&) + { command = toString (pkgs.writeShellScript "init-wm" '' + ${pkgs.home-daemon}/bin/home-daemon system76-scheduler& + ${pkgs.gnome.zenity}/bin/zenity --password | (${pkgs.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& + ${pkgs.nextcloud-client}/bin/nextcloud --background& + ${pkgs.nheko}/bin/nheko& + ${pkgs.tdesktop}/bin/telegram-desktop -startintray& ''); } ]; colors = { @@ -149,13 +149,13 @@ genKeybindings = (default_options: kb: XF86MonBrightnessDown = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-"; XF86MonBrightnessUp = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%+"; } - // (lib.attrsets.filterAttrs + // (lib.filterAttrs (k: v: !(builtins.elem k - ["${modifier}+space" "${modifier}+Shift+space"])) - (lib.lists.head - (lib.lists.head + [ "${modifier}+space" "${modifier}+Shift+space" ])) + (builtins.head + (builtins.head default_options.config.type.getSubModules) .imports) .options.keybindings.default) @@ -342,9 +342,9 @@ in menu = "${rofiSway}/bin/rofi -show drun"; }; in commonConfig // swayConfig; # export WLR_RENDERER=vulkan - extraSessionCommands = (lib.optionalString config.wayland.windowManager.sway.vulkan '' + extraSessionCommands = lib.optionalString config.wayland.windowManager.sway.vulkan '' export WLR_RENDERER=vulkan - '') + '' + '' + '' export SDL_VIDEODRIVER=wayland,x11,kmsdrm,windows,directx # SDL3 export SDL_VIDEO_DRIVER=wayland,x11,kmsdrm,windows @@ -358,9 +358,8 @@ in export XDG_SESSION_DESKTOP=sway ''; }; - services.swayidle = let swaylock-start = builtins.toString (with pkgs; writeScript "swaylock-start" '' - #! ${bash}/bin/bash - ${procps}/bin/pgrep -fx "${swaylock}/bin/swaylock -f" || ${swaylock}/bin/swaylock -f + services.swayidle = let swaylock-start = toString (pkgs.writeShellScript "swaylock-start" '' + ${pkgs.procps}/bin/pgrep -fx "${pkgs.swaylock}/bin/swaylock -f" || ${pkgs.swaylock}/bin/swaylock -f ''); in { enable = config.wayland.windowManager.sway.enable; events = [ @@ -415,12 +414,12 @@ in text-wrong-color = text-color; ring-wrong-color = "#e64e4e"; # deep-ish red }; - home.packages = with pkgs; if config.wayland.windowManager.sway.enable then [ + home.packages = lib.mkIf config.wayland.windowManager.sway.enable (with pkgs; [ wl-clipboard xdg-desktop-portal xdg-desktop-portal-wlr xdg-desktop-portal-gtk - ] else []; + ]); programs.rofi = { enable = true; font = "Noto Sans Mono 16"; diff --git a/home/common/options.nix b/home/common/options.nix index 1c3f132..34feb21 100644 --- a/home/common/options.nix +++ b/home/common/options.nix @@ -28,50 +28,46 @@ with lib; { type = types.str; description = "Path to terminal binary for X server (output)"; }; - options.colors = mkOption { - type = types.submodule { - options = { - base = mkOption { - type = with types; listOf str; - description = "16 theme colors"; - }; - foreground = mkOption { - type = types.str; - }; - background = mkOption { - type = types.str; - }; - # 0-1 - alpha = mkOption { - type = types.float; - description = "opacity (0.0-1.0)"; - }; - hexAlpha = mkOption { - type = types.str; - description = "hex opacity (read-only)"; - }; - percentAlpha = mkOption { - type = types.int; - description = "opacity percentage (read-only)"; - }; - black = mkOption { type = types.str; description = "read-only"; }; - red = mkOption { type = types.str; description = "read-only"; }; - green = mkOption { type = types.str; description = "read-only"; }; - yellow = mkOption { type = types.str; description = "read-only"; }; - blue = mkOption { type = types.str; description = "read-only"; }; - magenta = mkOption { type = types.str; description = "read-only"; }; - cyan = mkOption { type = types.str; description = "read-only"; }; - white = mkOption { type = types.str; description = "read-only"; }; - brBlack = mkOption { type = types.str; description = "read-only"; }; - brRed = mkOption { type = types.str; description = "read-only"; }; - brGreen = mkOption { type = types.str; description = "read-only"; }; - brYellow = mkOption { type = types.str; description = "read-only"; }; - brBlue = mkOption { type = types.str; description = "read-only"; }; - brMagenta = mkOption { type = types.str; description = "read-only"; }; - brCyan = mkOption { type = types.str; description = "read-only"; }; - brWhite = mkOption { type = types.str; description = "read-only"; }; - }; + options.colors = { + base = mkOption { + type = with types; listOf str; + description = "16 theme colors"; }; + foreground = mkOption { + type = types.str; + }; + background = mkOption { + type = types.str; + }; + # 0-1 + alpha = mkOption { + type = types.float; + description = "opacity (0.0-1.0)"; + }; + hexAlpha = mkOption { + type = types.str; + description = "hex opacity (read-only)"; + }; + percentAlpha = mkOption { + type = types.int; + description = "opacity percentage (read-only)"; + }; + black = mkOption { type = types.str; description = "read-only"; }; + red = mkOption { type = types.str; description = "read-only"; }; + green = mkOption { type = types.str; description = "read-only"; }; + yellow = mkOption { type = types.str; description = "read-only"; }; + blue = mkOption { type = types.str; description = "read-only"; }; + magenta = mkOption { type = types.str; description = "read-only"; }; + cyan = mkOption { type = types.str; description = "read-only"; }; + white = mkOption { type = types.str; description = "read-only"; }; + brBlack = mkOption { type = types.str; description = "read-only"; }; + brRed = mkOption { type = types.str; description = "read-only"; }; + brGreen = mkOption { type = types.str; description = "read-only"; }; + brYellow = mkOption { type = types.str; description = "read-only"; }; + brBlue = mkOption { type = types.str; description = "read-only"; }; + brMagenta = mkOption { type = types.str; description = "read-only"; }; + brCyan = mkOption { type = types.str; description = "read-only"; }; + brWhite = mkOption { type = types.str; description = "read-only"; }; }; config.colors.hexAlpha = let hex = lib.trivial.toHexString (lib.trivial.min 255 (builtins.floor (config.colors.alpha * 256.0))); @@ -94,18 +90,13 @@ with lib; { config.colors.brCyan = builtins.elemAt config.colors.base 14; config.colors.brWhite = builtins.elemAt config.colors.base 15; options.termShell = mkOption { - type = types.submodule { - options = { - enable = mkOption { - type = types.bool; - default = false; - }; - path = mkOption { - type = types.str; - }; - }; + enable = mkOption { + description = "Use a separate shell for gui terminal"; + type = types.bool; + default = false; + }; + path = mkOption { + type = types.str; }; - default = {enable=false;}; - description = "Use a separate shell for gui terminal"; }; } diff --git a/home/common/terminal.nix b/home/common/terminal.nix index a4141ae..0c2a84d 100644 --- a/home/common/terminal.nix +++ b/home/common/terminal.nix @@ -1,14 +1,14 @@ { config, pkgs, lib, ... }: let - supportTerminal = (term: builtins.elem term config.terminals); - getTerminalBin = (term: ({ + supportTerminal = term: builtins.elem term config.terminals; + getTerminalBin = term: lib.getExe { alacritty = "${pkgs.alacritty}/bin/alacritty"; foot = "${pkgs.foot}/bin/footclient"; kitty = "${pkgs.kitty}/bin/kitty"; urxvt = "${pkgs.rxvt-unicode-emoji}/bin/urxvt"; - }).${term}); + }.${term}; color = builtins.elemAt config.colors.base; - hex = (x: if builtins.isFunction x then (y: "#" + (x y)) else ("#" + x)); + hex = x: if builtins.isFunction x then (y: "#" + (x y)) else ("#" + x); shell = lib.mkIf config.termShell.enable (lib.mkDefault config.termShell.path); in { imports = [ ./options.nix ]; @@ -94,7 +94,7 @@ in { xresources.properties = lib.mkIf config.programs.urxvt.enable { # special colors "*.foreground" = hex config.colors.foreground; - "*.background" = "[${builtins.toString config.colors.percentAlpha}]#${config.colors.background}"; + "*.background" = "[${toString config.colors.percentAlpha}]#${config.colors.background}"; "*.cursorColor" = hex config.colors.foreground; # black "*.color0" = hex color 0; @@ -174,7 +174,7 @@ in { repaint_delay = 4; foreground = hex config.colors.foreground; background = hex config.colors.background; - background_opacity = builtins.toString config.colors.alpha; + background_opacity = toString config.colors.alpha; color0 = hex color 0; color1 = hex color 1; color2 = hex color 2; @@ -196,18 +196,21 @@ in { enabled_layouts = "all"; }; }; - xdg.configFile."fontconfig/conf.d/10-kitty-fonts.conf".text = lib.mkIf ((supportTerminal "kitty") && (config.programs.kitty.font.name == "Noto Sans Mono")) '' - - - - - + xdg.configFile."fontconfig/conf.d/10-kitty-fonts.conf".text = + lib.mkIf + (supportTerminal "kitty" && config.programs.kitty.font.name == "Noto Sans Mono") + '' + + + + + Noto Sans Mono - - + + 90 - - - + + + ''; } diff --git a/home/common/zsh.nix b/home/common/zsh.nix index 02c4fe1..cf5b792 100644 --- a/home/common/zsh.nix +++ b/home/common/zsh.nix @@ -125,16 +125,16 @@ }; plugins = with pkgs; [ { name = "zsh-vi-mode"; - src = zsh-vi-mode.src; } + inherit (zsh-vi-mode) src; } { name = "fzf-tab"; - src = zsh-fzf-tab.src; } + inherit (zsh-fzf-tab) src; } { name = "nix-shell"; - src = zsh-nix-shell.src; } + inherit (zsh-nix-shell) src; } { name = "powerlevel10k"; - src = zsh-powerlevel10k.src; + inherit (zsh-powerlevel10k) src; file = "powerlevel10k.zsh-theme"; } { name = "you-should-use"; - src = zsh-you-should-use.src; } + inherit (zsh-you-should-use) src; } ]; }; } diff --git a/home/hosts/nixmsi.nix b/home/hosts/nixmsi.nix index c7a0d32..41e44aa 100644 --- a/home/hosts/nixmsi.nix +++ b/home/hosts/nixmsi.nix @@ -73,6 +73,7 @@ CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS = "-C link-arg=--ld-path=${pkgs.mold}/bin/mold"; }; home.packages = with pkgs; [ + anki-bin (gimp.overrideAttrs (old: { doCheck = false; })) krita blender-hip kdenlive glaxnimate mediainfo ghidra (cutter.withPlugins (p: with p; [ sigdb rz-ghidra ])) diff --git a/system/devices/oneplus-6-phone.nix b/system/devices/oneplus-6-phone.nix index 86ef46b..f0e8e55 100644 --- a/system/devices/oneplus-6-phone.nix +++ b/system/devices/oneplus-6-phone.nix @@ -1,5 +1,4 @@ { config -, lib , ... }: @@ -18,7 +17,6 @@ in # https://gitlab.com/postmarketOS/pmaports/-/issues/2440 # networking.wireless.iwd.enable = true; - networking.modemmanager.enable = lib.mkForce false; networking.networkmanager.enable = true; boot.loader = { diff --git a/system/hardware/oneplus-enchilada/default.nix b/system/hardware/oneplus-enchilada/default.nix index b163a78..2e1a357 100644 --- a/system/hardware/oneplus-enchilada/default.nix +++ b/system/hardware/oneplus-enchilada/default.nix @@ -58,6 +58,9 @@ in boot.kernelPackages = lib.mkForce (pkgs.linuxPackagesFor pkgs.linux_enchilada_ccache); hardware.deviceTree.enable = true; hardware.deviceTree.name = "qcom/sdm845-oneplus-enchilada.dtb"; + # loglevel=7 console=ttyMSM0,115200 is a way to delay boot + # see https://gitlab.freedesktop.org/drm/msm/-/issues/46 + boot.consoleLogLevel = 7; boot.kernelParams = [ "console=ttyMSM0,115200" "console=tty0" diff --git a/system/modules/common.nix b/system/modules/common.nix index b6331b0..62bcf6f 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -189,8 +189,9 @@ in { }) (lib.mkIf (!cfg.minimal) { + hardware.pulseaudio.enable = false; services.pipewire = { - enable = true; + enable = lib.mkDefault true; alsa.enable = true; alsa.support32Bit = true; pulse.enable = true;