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": {
"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": {

View file

@ -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; [

View file

@ -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
];
}

View file

@ -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";

View file

@ -28,9 +28,7 @@ with lib; {
type = types.str;
description = "Path to terminal binary for X server (output)";
};
options.colors = mkOption {
type = types.submodule {
options = {
options.colors = {
base = mkOption {
type = with types; listOf str;
description = "16 theme colors";
@ -71,8 +69,6 @@ with lib; {
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)));
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.brWhite = builtins.elemAt config.colors.base 15;
options.termShell = mkOption {
type = types.submodule {
options = {
enable = mkOption {
description = "Use a separate shell for gui terminal";
type = types.bool;
default = false;
};
@ -104,8 +99,4 @@ with lib; {
type = types.str;
};
};
};
default = {enable=false;};
description = "Use a separate shell for gui terminal";
};
}

View file

@ -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")) ''
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="scan">
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"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="scan">
<test name="family">
<string>Noto Sans Mono</string>
</test>
<edit name="spacing">
<int>90</int>
</edit>
</match>
</fontconfig>
</match>
</fontconfig>
'';
}

View file

@ -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; }
];
};
}

View file

@ -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 ]))

View file

@ -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 = {

View file

@ -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"

View file

@ -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;