yomichan, fish, build librewolf from source, etc

This commit is contained in:
chayleaf 2023-02-19 19:09:38 +07:00
parent cce6043904
commit b4aa7c5596
19 changed files with 542 additions and 179 deletions

View file

@ -13,5 +13,20 @@
"url": "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/GE-Proton7-49/GE-Proton7-49.tar.gz" "url": "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/GE-Proton7-49/GE-Proton7-49.tar.gz"
}, },
"version": "GE-Proton7-49" "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"
} }
} }

View file

@ -9,4 +9,12 @@
sha256 = "sha256-T+7R+zFMd0yQ0v7/WGym2kzMMulUmATS/LCEQS8whiw="; 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=";
};
};
} }

View file

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

View file

@ -0,0 +1,5 @@
[
{
"slug": "youtube-nonstop"
}
]

View file

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

View file

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

View file

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

169
home/common/fish.nix Normal file
View file

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

View file

@ -1,6 +1,10 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
imports = [ ./options.nix ./zsh.nix ]; imports = [
./options.nix
./zsh.nix
./fish.nix
];
manual.json.enable = true; manual.json.enable = true;
services.gpg-agent = { services.gpg-agent = {
enable = true; enable = true;
@ -8,6 +12,11 @@
maxCacheTtl = 72000; maxCacheTtl = 72000;
maxCacheTtlSsh = 72000; maxCacheTtlSsh = 72000;
}; };
home.shellAliases = {
s = "sudo -A";
se = "sudo -AE";
l = "lsd";
};
programs = { programs = {
atuin = { atuin = {
@ -131,6 +140,6 @@
home.packages = with pkgs; [ home.packages = with pkgs; [
rclone sshfs fuse rclone sshfs fuse
file jq python3Full killall file jq python3Full killall
appimage-run comma nvfetcher appimage-run comma
]; ];
} }

View file

@ -128,7 +128,7 @@
# gui compat stuff # gui compat stuff
qt5ct qgnomeplatform qt5ct qgnomeplatform
# various programs i use # various programs i use
keepassxc nheko qbittorrent anki mumble keepassxc nheko qbittorrent mumble
nextcloud-client gnome.zenity kdeconnect nextcloud-client gnome.zenity kdeconnect
# cli tools # cli tools
imagemagick ffmpeg imagemagick ffmpeg
@ -137,5 +137,10 @@
(nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; }) (nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; })
# might check out some day (tm) # might check out some day (tm)
# nyxt qutebrowser # nyxt qutebrowser
# for updating parts of this repo
nvfetcher config.nur.repos.rycee.mozilla-addons-to-nix
anki-bin
]; ];
} }

View file

@ -83,6 +83,12 @@ commonConfig = {
text = "#ebdadd"; text = "#ebdadd";
}; };
}; };
floating.criteria = [
{ class = "Anki"; title = "Add"; }
# { class = "Anki"; title = "Browse .*"; }
{ class = "Anki"; title = "Statistics"; }
{ class = "Anki"; title = "Preferences"; }
];
floating.titlebar = true; floating.titlebar = true;
fonts = { fonts = {
names = [ "Noto Sans Mono" "Symbols Nerd Font Mono" ]; names = [ "Noto Sans Mono" "Symbols Nerd Font Mono" ];
@ -119,7 +125,7 @@ genKeybindings = (default_options: kb:
in in
{ {
# TODO merge with colors in gui.nix # TODO merge with colors in gui.nix
imports = [ ./options.nix ./gui.nix ]; imports = [ ./options.nix ./gui.nix ./waybar.nix ];
home.sessionVariables = { 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'"; 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"; _JAVA_AWT_WM_NONREPARENTING = "1";
@ -189,108 +195,6 @@ in
xdg-desktop-portal-wlr xdg-desktop-portal-wlr
xdg-desktop-portal-gtk xdg-desktop-portal-gtk
] else []; ] 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 = { wayland.windowManager.sway = {
wrapperFeatures.gtk = true; wrapperFeatures.gtk = true;
config = let swayConfig = { config = let swayConfig = {
@ -377,19 +281,14 @@ in
command = "~/scripts/initwm.sh"; 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.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 = { output = {
"*" = { "*" = {
bg = "~/var/wallpaper.jpg fill"; bg = "~/var/wallpaper.jpg fill";
# improved screen latency, apparently # improved screen latency, apparently
max_render_time = "2"; max_render_time = "2";
scale = builtins.toString config.displayScale;
}; };
}; };
input = { input = {
@ -409,16 +308,16 @@ in
export GDK_BACKEND=wayland,x11 export GDK_BACKEND=wayland,x11
export GTK_USE_PORTAL=1 export GTK_USE_PORTAL=1
export XDG_CURRENT_DESKTOP=sway export XDG_CURRENT_DESKTOP=sway
# SDL3 exists, so i can't really set SDL_DYNAMIC_API export XDG_SESSION_DESKTOP=sway
# instead, running apps with SDL_DYNAMIC_API=$SDL2_DYNAMIC_API does the trick # TODO: set to sdl3 compat when SDL3 releases
export SDL2_DYNAMIC_API=${pkgs.SDL2.out}/lib/libSDL2.so export SDL_DYNAMIC_API=${pkgs.SDL2.out}/lib/libSDL2.so
''; '';
}; };
services.swayidle = let swaylock-start = builtins.toString (with pkgs; writeScript "swaylock-start" '' services.swayidle = let swaylock-start = builtins.toString (with pkgs; writeScript "swaylock-start" ''
#! ${bash}/bin/bash #! ${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 { ''); in {
enable = true; enable = config.wayland.windowManager.sway.enable;
events = [ events = [
{ event = "before-sleep"; command = swaylock-start; } { event = "before-sleep"; command = swaylock-start; }
# after-resume, lock, unlock # after-resume, lock, unlock
@ -431,7 +330,7 @@ in
command = swaylock-start; } command = swaylock-start; }
]; ];
}; };
programs.swaylock.settings = let textColor = "#ebdadd"; bgColor = "#24101ac0"; in { programs.swaylock.settings = rec {
image = "${config.home.homeDirectory}/var/wallpaper.jpg"; image = "${config.home.homeDirectory}/var/wallpaper.jpg";
font = "Unifont"; font = "Unifont";
font-size = 64; font-size = 64;
@ -441,34 +340,34 @@ in
indicator-thickness = 32; indicator-thickness = 32;
separator-color = "#00000000"; separator-color = "#00000000";
layout-text-color = textColor; layout-text-color = text-color;
layout-bg-color = bgColor; layout-bg-color = inside-color;
layout-border-color = "#00000000"; layout-border-color = "#00000000";
line-uses-inside = true; line-uses-inside = true;
inside-color = bgColor; inside-color = "#24101ac0";
text-color = textColor; text-color = "#ebdadd";
ring-color = "#8cbf73"; # green ring-color = "#8cbf73"; # green
key-hl-color = "#6398bf"; # blue key-hl-color = "#6398bf"; # blue
bs-hl-color = "#e66e6e"; # red bs-hl-color = "#e66e6e"; # red
inside-caps-lock-color = bgColor; inside-caps-lock-color = inside-color;
text-caps-lock-color = textColor; text-caps-lock-color = text-color;
ring-caps-lock-color = "#ebbe5f"; # yellow ring-caps-lock-color = "#ebbe5f"; # yellow
caps-lock-key-hl-color = "#6398bf"; # same as normal key-hl-color caps-lock-key-hl-color = key-hl-color;
caps-lock-bs-hl-color = "#e66e6e"; # same as normal bs-hl-color caps-lock-bs-hl-color = bs-hl-color;
inside-clear-color = bgColor; inside-clear-color = inside-color;
text-clear-color = textColor; text-clear-color = text-color;
ring-clear-color = "#8cbf73"; # green ring-clear-color = ring-color; # green
inside-ver-color = bgColor; inside-ver-color = inside-color;
text-ver-color = textColor; text-ver-color = text-color;
ring-ver-color = "#a64999"; # purple ring-ver-color = "#a64999"; # purple
inside-wrong-color = bgColor; inside-wrong-color = inside-color;
text-wrong-color = textColor; text-wrong-color = text-color;
ring-wrong-color = "#e64e4e"; # deep-ish red ring-wrong-color = "#e64e4e"; # deep-ish red
}; };
} }

View file

@ -1,10 +1,5 @@
{ lib, ... }: { lib, ... }:
with lib; { with lib; {
options.displayScale = mkOption {
type = types.float;
description = "display scale";
default = 1;
};
options.terminals = mkOption { options.terminals = mkOption {
type = with types; listOf str; type = with types; listOf str;
description = "terminal kinds (possible values are alacritty, urxvt, kitty, foot)"; description = "terminal kinds (possible values are alacritty, urxvt, kitty, foot)";

105
home/common/waybar.nix Normal file
View file

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

View file

@ -10,9 +10,6 @@
dotDir = ".config/zsh"; dotDir = ".config/zsh";
history.ignoreDups = true; history.ignoreDups = true;
history.path = "${config.xdg.dataHome}/zsh/zsh_history"; 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 # I dont want to remap the up key, so only map this, setting ATUIN_NOBIND to true
initExtra = '' initExtra = ''
up-line-or-local-history() { up-line-or-local-history() {

View file

@ -2,7 +2,7 @@
{ {
imports = [ imports = [
../common/general.nix ../common/general.nix
../common/firefox.nix ../common/firefox
../common/i3-sway.nix ../common/i3-sway.nix
../common/vim.nix ../common/vim.nix
../common/helix.nix ../common/helix.nix
@ -11,10 +11,9 @@
home.stateVersion = "22.11"; home.stateVersion = "22.11";
home.username = "user"; home.username = "user";
home.homeDirectory = "/home/user"; home.homeDirectory = "/home/user";
displayScale = 1.1;
termShell = { termShell = {
enable = true; enable = true;
path = "${pkgs.zsh}/bin/zsh"; path = "${pkgs.fish}/bin/fish";
}; };
xsession.windowManager.i3.enable = true; xsession.windowManager.i3.enable = true;
wayland.windowManager.sway.enable = true; wayland.windowManager.sway.enable = true;
@ -51,6 +50,8 @@
STEAM_EXTRA_COMPAT_TOOLS_PATHS = "${proton-ge}"; STEAM_EXTRA_COMPAT_TOOLS_PATHS = "${proton-ge}";
}; };
home.packages = with pkgs; [ home.packages = with pkgs; [
openrgb piper
steam-run steam steam-run steam
easyeffects easyeffects
# wineWowPackages.waylandFull # wineWowPackages.waylandFull

View file

@ -1,3 +1,7 @@
[proton-ge] [proton-ge]
src.github = "GloriousEggroll/proton-ge-custom" src.github = "GloriousEggroll/proton-ge-custom"
fetch.url = "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/$ver/$ver.tar.gz" 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"

38
system/common/ccache.nix Normal file
View file

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

View file

@ -2,7 +2,8 @@
description = "NixOS configuration"; description = "NixOS configuration";
inputs = { 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"; utils.url = "github:gytis-ivaskevicius/flake-utils-plus";
nixos-hardware.url = "github:NixOS/nixos-hardware"; nixos-hardware.url = "github:NixOS/nixos-hardware";
impermanence.url = "github:nix-community/impermanence"; impermanence.url = "github:nix-community/impermanence";
@ -27,6 +28,7 @@
inherit self inputs; inherit self inputs;
hostDefaults.modules = [ hostDefaults.modules = [
./common/vfio.nix ./common/vfio.nix
./common/ccache.nix
{ {
# make this flake's nixpkgs available to the whole system # make this flake's nixpkgs available to the whole system
nix = { nix = {

View file

@ -178,6 +178,8 @@ in {
swapDevices = [ { device = "/swap/swapfile"; } ]; swapDevices = [ { device = "/swap/swapfile"; } ];
services.ratbagd.enable = true;
### SECTION 2: SYSTEM CONFIG/ENVIRONMENT ### ### SECTION 2: SYSTEM CONFIG/ENVIRONMENT ###
i18n.defaultLocale = lib.mkDefault "en_US.UTF-8"; i18n.defaultLocale = lib.mkDefault "en_US.UTF-8";
i18n.supportedLocales = lib.mkDefault [ "en_US.UTF-8/UTF-8" ]; i18n.supportedLocales = lib.mkDefault [ "en_US.UTF-8/UTF-8" ];
@ -227,11 +229,20 @@ in {
rate = 48000; 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.fuse.userAllowOther = true;
programs.ccache.enable = true;
xdg.portal = { xdg.portal = {
enable = true; enable = true;
extraPortals = with pkgs; [ xdg-desktop-portal-gtk xdg-desktop-portal-wlr ]; extraPortals = with pkgs; [ xdg-desktop-portal-gtk xdg-desktop-portal-wlr ];