update coop-ofd; cleanup

This commit is contained in:
chayleaf 2023-12-22 19:22:17 +07:00
parent ef7340e32a
commit bb80b9811a
Signed by: chayleaf
GPG key ID: 78171AD46227E68E
11 changed files with 129 additions and 138 deletions

View file

@ -25,11 +25,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1702056258, "lastModified": 1703247585,
"narHash": "sha256-Fjhxm6GYq6Tos+Za5slrLRlc+UicOxgzGIxLNtoJpEA=", "narHash": "sha256-EHtgF4H68e7Ft1+ICiInUmEfBIfKW7tLHAapp868WHQ=",
"owner": "chayleaf", "owner": "chayleaf",
"repo": "coop-ofd", "repo": "coop-ofd",
"rev": "a96a20b176da515ec090a783de39aa8d9e573be1", "rev": "02ce0fe10c22de27d02aff22f926bd26ee60c0ab",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -20,9 +20,9 @@
ll = "lsd -l"; ll = "lsd -l";
g = "git"; g = "git";
gp = "git push"; gp = "git push";
gpuo = "git push -u origin";
gr = "git rebase"; gr = "git rebase";
gri = "git rebase -i"; gri = "git rebase -i";
grc = "git rebase --continue";
gc = "git commit"; gc = "git commit";
gca = "git commit --amend"; gca = "git commit --amend";
gm = "git merge"; gm = "git merge";
@ -38,22 +38,21 @@
}; };
nnn = let pluginSrc = "${pkgs.nnn.src}/plugins"; in { nnn = let pluginSrc = "${pkgs.nnn.src}/plugins"; in {
enable = true; 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 # no need to add makeWrapper to nativeBuildInputs as home-manager does it already
postInstall = postInstall =
let nnnArchiveRegex = "\\.(${lib.strings.concatStringsSep "|" [ 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" "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; '' ]})$"; in ''
wrapProgram $out/bin/nnn \ wrapProgram $out/bin/nnn ${lib.escapeShellArgs [
--set GUI 1 \ "--set" "GUI" "1"
--set NNN_OPENER ${escapeShellArg "${pluginSrc}/nuke"} \ "--set" "NNN_OPENER" "${pluginSrc}/nuke"
--set NNN_ARCHIVE ${escapeShellArg nnnArchiveRegex} \ "--set" "NNN_ARCHIVE" nnnArchiveRegex
--add-flags ${
# -a: auto create fifo file # -a: auto create fifo file
# -c: use NNN_OPENER # -c: use NNN_OPENER
# -x: x server features # -x: x server features
escapeShellArg "-a -c -x" "--add-flags" "-a -c -x"
} ]}
''; '';
}); });
extraPackages = with pkgs; [ extraPackages = with pkgs; [

View file

@ -1,6 +1,13 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
imports = [ ./terminal.nix ]; 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 { i18n.inputMethod = let fcitx5-qt = pkgs.libsForQt5.fcitx5-qt; in {
enabled = "fcitx5"; enabled = "fcitx5";
fcitx5.addons = with pkgs; [ fcitx5-lua fcitx5-gtk fcitx5-mozc fcitx5-configtool fcitx5-qt ]; 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: # this is for steam games, I set the launch options to:
# `SDL_DYNAMIC_API=$SDL2_DYNAMIC_API %command%` # `SDL_DYNAMIC_API=$SDL2_DYNAMIC_API %command%`
# Steam itself doesn't work with SDL2_DYNAMIC_API set, so it's # 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"; SDL2_DYNAMIC_API = "${pkgs.SDL2}/lib/libSDL2.so";
}; };
programs.nnn.extraPackages = with pkgs; [ programs.nnn.extraPackages = with pkgs; [
@ -216,15 +223,6 @@
enable = true; enable = true;
}; };
systemd.user.services = {
fcitx5-daemon = {
Unit.After = "graphical-session-pre.target";
Service = {
Restart = "on-failure";
RestartSec = 3;
};
};
};
# i run this manually instead # i run this manually instead
#services.nextcloud-client = { #services.nextcloud-client = {
# enable = true; # enable = true;
@ -249,7 +247,7 @@
qt5ct qgnomeplatform qt5ct qgnomeplatform
# various programs i use # various programs i use
keepassxc nheko qbittorrent mumble keepassxc nheko qbittorrent mumble
nextcloud-client gnome.zenity kdeconnect nextcloud-client kdeconnect
# cli tools # cli tools
imagemagick ffmpeg-full xdg-utils imagemagick ffmpeg-full xdg-utils
# fonts # fonts
@ -263,7 +261,5 @@
nix-init nix-init
nvfetcher nvfetcher
config.nur.repos.rycee.mozilla-addons-to-nix config.nur.repos.rycee.mozilla-addons-to-nix
anki-bin
]; ];
} }

View file

@ -3,35 +3,35 @@ let
modifier = "Mod4"; modifier = "Mod4";
rofiSway = config.programs.rofi.finalPackage; rofiSway = config.programs.rofi.finalPackage;
rofiI3 = pkgs.rofi.override { plugins = config.programs.rofi.plugins; }; rofiI3 = pkgs.rofi.override { plugins = config.programs.rofi.plugins; };
audioNext = with pkgs; writeShellScript "playerctl-next" '' audioNext = pkgs.writeShellScript "playerctl-next" ''
${playerctl}/bin/playerctl next ${pkgs.playerctl}/bin/playerctl next
PLAYER=$(${playerctl}/bin/playerctl -l | head -n 1) PLAYER=$(${pkgs.playerctl}/bin/playerctl -l | head -n 1)
# mpdris2 bug: audio wont play after a seek/skip, you have to pause-unpause # mpdris2 bug: audio wont play after a seek/skip, you have to pause-unpause
if [[ "$PLAYER" == "mpd" ]]; then if [[ "$PLAYER" == "mpd" ]]; then
${playerctl}/bin/playerctl pause ${pkgs.playerctl}/bin/playerctl pause
${playerctl}/bin/playerctl position 0 ${pkgs.playerctl}/bin/playerctl position 0
${playerctl}/bin/playerctl play ${pkgs.playerctl}/bin/playerctl play
fi fi
''; '';
audioPrev = with pkgs; writeShellScript "playerctl-prev" '' audioPrev = pkgs.writeShellScript "playerctl-prev" ''
# just seek if over 5 seconds into the track # just seek if over 5 seconds into the track
POS=$(${playerctl}/bin/playerctl position) POS=$(${pkgs.playerctl}/bin/playerctl position)
PLAYER=$(${playerctl}/bin/playerctl -l | head -n 1) PLAYER=$(${pkgs.playerctl}/bin/playerctl -l | head -n 1)
if [ -n "$POS" ]; then 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 SEEK=1
fi fi
fi fi
if [ -z "$SEEK" ]; then if [ -z "$SEEK" ]; then
${playerctl}/bin/playerctl previous ${pkgs.playerctl}/bin/playerctl previous
else else
${playerctl}/bin/playerctl position 0 ${pkgs.playerctl}/bin/playerctl position 0
fi fi
# mpdris2 bug: audio wont play after a seek/skip, you have to pause-unpause # mpdris2 bug: audio wont play after a seek/skip, you have to pause-unpause
if [[ "$PLAYER" == "mpd" ]]; then if [[ "$PLAYER" == "mpd" ]]; then
${playerctl}/bin/playerctl pause ${pkgs.playerctl}/bin/playerctl pause
${playerctl}/bin/playerctl position 0 ${pkgs.playerctl}/bin/playerctl position 0
${playerctl}/bin/playerctl play ${pkgs.playerctl}/bin/playerctl play
fi fi
''; '';
barConfig = { barConfig = {
@ -79,13 +79,13 @@ barConfig = {
commonConfig = { commonConfig = {
inherit modifier; inherit modifier;
startup = [ startup = [
{ command = builtins.toString (with pkgs; writeShellScript "init-wm" '' { command = toString (pkgs.writeShellScript "init-wm" ''
${home-daemon}/bin/home-daemon system76-scheduler& ${pkgs.home-daemon}/bin/home-daemon system76-scheduler&
${gnome.zenity}/bin/zenity --password | (${keepassxc}/bin/keepassxc --pw-stdin ~/Nextcloud/keepass.kdbx&) ${pkgs.gnome.zenity}/bin/zenity --password | (${pkgs.keepassxc}/bin/keepassxc --pw-stdin ~/Nextcloud/keepass.kdbx&)
# nextcloud and nheko need secret service access # nextcloud and nheko need secret service access
${nextcloud-client}/bin/nextcloud --background& ${pkgs.nextcloud-client}/bin/nextcloud --background&
${nheko}/bin/nheko& ${pkgs.nheko}/bin/nheko&
${tdesktop}/bin/telegram-desktop -startintray& ${pkgs.tdesktop}/bin/telegram-desktop -startintray&
''); } ''); }
]; ];
colors = { colors = {
@ -149,13 +149,13 @@ genKeybindings = (default_options: kb:
XF86MonBrightnessDown = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-"; XF86MonBrightnessDown = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
XF86MonBrightnessUp = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%+"; XF86MonBrightnessUp = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%+";
} }
// (lib.attrsets.filterAttrs // (lib.filterAttrs
(k: v: (k: v:
!(builtins.elem !(builtins.elem
k k
[ "${modifier}+space" "${modifier}+Shift+space" ])) [ "${modifier}+space" "${modifier}+Shift+space" ]))
(lib.lists.head (builtins.head
(lib.lists.head (builtins.head
default_options.config.type.getSubModules) default_options.config.type.getSubModules)
.imports) .imports)
.options.keybindings.default) .options.keybindings.default)
@ -342,9 +342,9 @@ in
menu = "${rofiSway}/bin/rofi -show drun"; menu = "${rofiSway}/bin/rofi -show drun";
}; in commonConfig // swayConfig; }; in commonConfig // swayConfig;
# export WLR_RENDERER=vulkan # 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 WLR_RENDERER=vulkan
'') + '' '' + ''
export SDL_VIDEODRIVER=wayland,x11,kmsdrm,windows,directx export SDL_VIDEODRIVER=wayland,x11,kmsdrm,windows,directx
# SDL3 # SDL3
export SDL_VIDEO_DRIVER=wayland,x11,kmsdrm,windows export SDL_VIDEO_DRIVER=wayland,x11,kmsdrm,windows
@ -358,9 +358,8 @@ in
export XDG_SESSION_DESKTOP=sway export XDG_SESSION_DESKTOP=sway
''; '';
}; };
services.swayidle = let swaylock-start = builtins.toString (with pkgs; writeScript "swaylock-start" '' services.swayidle = let swaylock-start = toString (pkgs.writeShellScript "swaylock-start" ''
#! ${bash}/bin/bash ${pkgs.procps}/bin/pgrep -fx "${pkgs.swaylock}/bin/swaylock -f" || ${pkgs.swaylock}/bin/swaylock -f
${procps}/bin/pgrep -fx "${swaylock}/bin/swaylock -f" || ${swaylock}/bin/swaylock -f
''); in { ''); in {
enable = config.wayland.windowManager.sway.enable; enable = config.wayland.windowManager.sway.enable;
events = [ events = [
@ -415,12 +414,12 @@ in
text-wrong-color = text-color; text-wrong-color = text-color;
ring-wrong-color = "#e64e4e"; # deep-ish red 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 wl-clipboard
xdg-desktop-portal xdg-desktop-portal
xdg-desktop-portal-wlr xdg-desktop-portal-wlr
xdg-desktop-portal-gtk xdg-desktop-portal-gtk
] else []; ]);
programs.rofi = { programs.rofi = {
enable = true; enable = true;
font = "Noto Sans Mono 16"; font = "Noto Sans Mono 16";

View file

@ -28,9 +28,7 @@ with lib; {
type = types.str; type = types.str;
description = "Path to terminal binary for X server (output)"; description = "Path to terminal binary for X server (output)";
}; };
options.colors = mkOption { options.colors = {
type = types.submodule {
options = {
base = mkOption { base = mkOption {
type = with types; listOf str; type = with types; listOf str;
description = "16 theme colors"; description = "16 theme colors";
@ -71,8 +69,6 @@ with lib; {
brCyan = mkOption { type = types.str; description = "read-only"; }; brCyan = mkOption { type = types.str; description = "read-only"; };
brWhite = mkOption { type = types.str; description = "read-only"; }; brWhite = mkOption { type = types.str; description = "read-only"; };
}; };
};
};
config.colors.hexAlpha = config.colors.hexAlpha =
let hex = lib.trivial.toHexString (lib.trivial.min 255 (builtins.floor (config.colors.alpha * 256.0))); let hex = lib.trivial.toHexString (lib.trivial.min 255 (builtins.floor (config.colors.alpha * 256.0)));
in if (builtins.stringLength hex) == 2 then hex else "0${hex}"; in if (builtins.stringLength hex) == 2 then hex else "0${hex}";
@ -94,9 +90,8 @@ with lib; {
config.colors.brCyan = builtins.elemAt config.colors.base 14; config.colors.brCyan = builtins.elemAt config.colors.base 14;
config.colors.brWhite = builtins.elemAt config.colors.base 15; config.colors.brWhite = builtins.elemAt config.colors.base 15;
options.termShell = mkOption { options.termShell = mkOption {
type = types.submodule {
options = {
enable = mkOption { enable = mkOption {
description = "Use a separate shell for gui terminal";
type = types.bool; type = types.bool;
default = false; default = false;
}; };
@ -104,8 +99,4 @@ with lib; {
type = types.str; type = types.str;
}; };
}; };
};
default = {enable=false;};
description = "Use a separate shell for gui terminal";
};
} }

View file

@ -1,14 +1,14 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
supportTerminal = (term: builtins.elem term config.terminals); supportTerminal = term: builtins.elem term config.terminals;
getTerminalBin = (term: ({ getTerminalBin = term: lib.getExe {
alacritty = "${pkgs.alacritty}/bin/alacritty"; alacritty = "${pkgs.alacritty}/bin/alacritty";
foot = "${pkgs.foot}/bin/footclient"; foot = "${pkgs.foot}/bin/footclient";
kitty = "${pkgs.kitty}/bin/kitty"; kitty = "${pkgs.kitty}/bin/kitty";
urxvt = "${pkgs.rxvt-unicode-emoji}/bin/urxvt"; urxvt = "${pkgs.rxvt-unicode-emoji}/bin/urxvt";
}).${term}); }.${term};
color = builtins.elemAt config.colors.base; 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); shell = lib.mkIf config.termShell.enable (lib.mkDefault config.termShell.path);
in { in {
imports = [ ./options.nix ]; imports = [ ./options.nix ];
@ -94,7 +94,7 @@ in {
xresources.properties = lib.mkIf config.programs.urxvt.enable { xresources.properties = lib.mkIf config.programs.urxvt.enable {
# special colors # special colors
"*.foreground" = hex config.colors.foreground; "*.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; "*.cursorColor" = hex config.colors.foreground;
# black # black
"*.color0" = hex color 0; "*.color0" = hex color 0;
@ -174,7 +174,7 @@ in {
repaint_delay = 4; repaint_delay = 4;
foreground = hex config.colors.foreground; foreground = hex config.colors.foreground;
background = hex config.colors.background; background = hex config.colors.background;
background_opacity = builtins.toString config.colors.alpha; background_opacity = toString config.colors.alpha;
color0 = hex color 0; color0 = hex color 0;
color1 = hex color 1; color1 = hex color 1;
color2 = hex color 2; color2 = hex color 2;
@ -196,7 +196,10 @@ in {
enabled_layouts = "all"; 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")
''
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <fontconfig>

View file

@ -125,16 +125,16 @@
}; };
plugins = with pkgs; [ plugins = with pkgs; [
{ name = "zsh-vi-mode"; { name = "zsh-vi-mode";
src = zsh-vi-mode.src; } inherit (zsh-vi-mode) src; }
{ name = "fzf-tab"; { name = "fzf-tab";
src = zsh-fzf-tab.src; } inherit (zsh-fzf-tab) src; }
{ name = "nix-shell"; { name = "nix-shell";
src = zsh-nix-shell.src; } inherit (zsh-nix-shell) src; }
{ name = "powerlevel10k"; { name = "powerlevel10k";
src = zsh-powerlevel10k.src; inherit (zsh-powerlevel10k) src;
file = "powerlevel10k.zsh-theme"; } file = "powerlevel10k.zsh-theme"; }
{ name = "you-should-use"; { name = "you-should-use";
src = zsh-you-should-use.src; } inherit (zsh-you-should-use) src; }
]; ];
}; };
} }

View file

@ -73,6 +73,7 @@
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS = "-C link-arg=--ld-path=${pkgs.mold}/bin/mold"; CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS = "-C link-arg=--ld-path=${pkgs.mold}/bin/mold";
}; };
home.packages = with pkgs; [ home.packages = with pkgs; [
anki-bin
(gimp.overrideAttrs (old: { doCheck = false; })) krita blender-hip (gimp.overrideAttrs (old: { doCheck = false; })) krita blender-hip
kdenlive glaxnimate mediainfo kdenlive glaxnimate mediainfo
ghidra (cutter.withPlugins (p: with p; [ sigdb rz-ghidra ])) ghidra (cutter.withPlugins (p: with p; [ sigdb rz-ghidra ]))

View file

@ -1,5 +1,4 @@
{ config { config
, lib
, ... , ...
}: }:
@ -18,7 +17,6 @@ in
# https://gitlab.com/postmarketOS/pmaports/-/issues/2440 # https://gitlab.com/postmarketOS/pmaports/-/issues/2440
# networking.wireless.iwd.enable = true; # networking.wireless.iwd.enable = true;
networking.modemmanager.enable = lib.mkForce false;
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
boot.loader = { boot.loader = {

View file

@ -58,6 +58,9 @@ in
boot.kernelPackages = lib.mkForce (pkgs.linuxPackagesFor pkgs.linux_enchilada_ccache); boot.kernelPackages = lib.mkForce (pkgs.linuxPackagesFor pkgs.linux_enchilada_ccache);
hardware.deviceTree.enable = true; hardware.deviceTree.enable = true;
hardware.deviceTree.name = "qcom/sdm845-oneplus-enchilada.dtb"; 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 = [ boot.kernelParams = [
"console=ttyMSM0,115200" "console=ttyMSM0,115200"
"console=tty0" "console=tty0"

View file

@ -189,8 +189,9 @@ in {
}) })
(lib.mkIf (!cfg.minimal) { (lib.mkIf (!cfg.minimal) {
hardware.pulseaudio.enable = false;
services.pipewire = { services.pipewire = {
enable = true; enable = lib.mkDefault true;
alsa.enable = true; alsa.enable = true;
alsa.support32Bit = true; alsa.support32Bit = true;
pulse.enable = true; pulse.enable = true;