Group desktop modules
Some checks are pending
/ check (push) Waiting to run

This commit is contained in:
Oliver Davies 2025-11-22 14:33:48 +00:00
parent 7aaf90bc75
commit 278904eec6
56 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,7 @@
{
flake.modules.nixos.desktop = {
hardware.bluetooth.enable = true;
services.blueman.enable = true;
};
}

View file

@ -0,0 +1,29 @@
{
flake.modules.homeManager.base =
{ pkgs, ... }:
{
home.packages = [
pkgs.bluetuith
];
xdg.configFile."bluetuith/bluetuith.conf" = {
text = ''
{
adapter: ""
adapter-states: ""
connect-bdaddr: ""
gsm-apn: ""
gsm-number: ""
keybindings: {
NavigateDown: j
NavigateUp: k
}
receive-dir: ""
theme: {}
}
'';
};
};
}

View file

@ -0,0 +1,57 @@
{ lib, ... }:
{
flake.modules.homeManager.gui =
{ config, pkgs, ... }:
{
options.programs.bookmarkthis.snippetsFile = lib.mkOption {
default = "${config.xdg.dataHome}/snippets.txt";
type = lib.types.str;
};
config = {
home = {
packages = [
(pkgs.writeShellApplication {
name = "bookmarkthis";
text = ''
message() {
if command -v ${lib.getExe pkgs.libnotify} > /dev/null; then
${lib.getExe pkgs.libnotify} "$1" "$2"
else
echo "$2"
fi
}
main() {
bookmark="$(xclip -o)"
file="$SNIPPETS_FILE"
if grep -q "^$bookmark$" "$file"; then
message "Oops." "Already bookmarked." >&2
exit 2
fi
echo "$bookmark" >> "$file"
message "Bookmark added!" "$bookmark is now saved to the file."
}
main
'';
})
];
sessionVariables = {
SNIPPETS_FILE = config.programs.bookmarkthis.snippetsFile;
};
};
programs.zsh.zsh-abbr.abbreviations = lib.optionalAttrs (config.programs.zsh.enable) {
"sn" = "${config.home.sessionVariables.EDITOR} $SNIPPETS_FILE";
};
};
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.gui.programs.chromium.enable = true;
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.gui.programs.librewolf.enable = true;
}

View file

@ -0,0 +1,17 @@
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
programs.librewolf.profiles.default.extensions.packages =
with pkgs.nur.repos.rycee.firefox-addons; [
awesome-rss
bitwarden
darkreader
tree-style-tab
ublock-origin
videospeed
vimium
web-developer
];
};
}

View file

@ -0,0 +1,5 @@
{
flake.modules.homeManager.gui.programs.librewolf.languagePacks = [
"en-GB"
];
}

View file

@ -0,0 +1,70 @@
{
flake.modules.homeManager.gui.programs.librewolf.policies = {
CaptivePortal = false;
DisableFirefoxAccounts = true;
DisableFirefoxStudies = true;
DisablePocket = true;
DisableTelemetry = true;
EnableTrackingProtection = {
Cryptomining = true;
Fingerprinting = true;
Value = true;
};
ExtensionSettings = {
"jid1-ZAdIEUB7XOzOJw@jetpack" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/duckduckgo-for-firefox/latest.xpi";
installation_mode = "force_installed";
};
"uBlock0@raymondhill.net" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
installation_mode = "force_installed";
};
};
FirefoxHome = {
Highlights = false;
Pocket = false;
Search = true;
Snippets = false;
SponsoredPocket = false;
SponsoredTopSites = false;
TopSites = true;
};
FirefoxSuggest = {
ImproveSuggest = false;
SponsoredSuggestions = false;
WebSuggestions = false;
};
NoDefaultBookmarks = true;
OfferToSaveLogins = false;
OfferToSaveLoginsDefault = false;
PasswordManagerEnabled = false;
Preferences = {
"browser.newtabpage.enabled" = false;
"cookiebanners.service.mode" = 2; # Block cookie banners
"cookiebanners.service.mode.privateBrowsing" = 2; # Block cookie banners in private browsing
"privacy.donottrackheader.enabled" = true;
"privacy.fingerprintingProtection" = true;
"privacy.resistFingerprinting" = true;
"privacy.trackingprotection.emailtracking.enabled" = true;
"privacy.trackingprotection.enabled" = true;
"privacy.trackingprotection.fingerprinting.enabled" = true;
"privacy.trackingprotection.socialtracking.enabled" = true;
};
HardwareAcceleration = true;
TranslateEnabled = true;
UserMessaging = {
ExtensionRecommendations = false;
UrlbarInterventions = false;
SkipOnboarding = true;
};
};
}

View file

@ -0,0 +1,19 @@
{
flake.modules.homeManager.gui.programs.librewolf.profiles.default.search.engines = {
# TODO: Drupal.org users.
# TODO: Mastodon.
# TODO: GitHub.
# TODO: Forgejo.
drupal_projects = {
name = "Drupal.org projects";
urls = [ { template = "https://www.drupal.org/project/{searchTerms}"; } ];
definedAliases = [ "@dp" ];
};
nixvim = {
name = "Nixvim options search";
urls = [ { template = "https://nix-community.github.io/nixvim/search/?query={searchTerms}"; } ];
definedAliases = [ "@nxv" ];
};
};
}

View file

@ -0,0 +1,7 @@
{
flake.modules.homeManager.gui.programs.librewolf.profiles.default.search = {
default = "ddg";
force = true;
privateDefault = "ddg";
};
}

View file

@ -0,0 +1,10 @@
{
flake.modules.homeManager.gui.programs.librewolf.profiles.default.settings = {
"browser.search.isUS" = false;
"browser.search.region" = "GB";
"distribution.searchplugins.defaultLocale" = "en-GB";
"general.useragent.locale" = "en-GB";
"intl.accept_languages" = "en-GB, en";
"intl.regional_prefs.use_os_locales" = true;
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.gui.programs.qutebrowser.enable = true;
}

View file

@ -0,0 +1,14 @@
{ lib, ... }:
{
flake.modules.homeManager.gui.programs.qutebrowser.keyBindings.normal = {
"<Ctrl-d>" = "config-cycle colors.webpage.darkmode.enabled true false";
"xb" = "config-cycle statusbar.show always never";
"xt" = "config-cycle tabs.show always never";
"xx" = lib.mkMerge [
"config-cycle statusbar.show always never"
"config-cycle tabs.show always never"
];
};
}

View file

@ -0,0 +1,7 @@
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
programs.qutebrowser.package = pkgs.stable.qutebrowser;
};
}

View file

@ -0,0 +1,10 @@
{
flake.modules.homeManager.gui.programs.qutebrowser.searchEngines = {
dp = "https://www.drupal.org/project/{}";
du = "https://www.drupal.org/u/{}";
gh = "https://github.com/search?q={}";
mn = "https://mynixos.com/search?q={}";
nx = "https://search.nixos.org/packages?query={}";
yt = "https://www.youtube.com/results?search_query={}";
};
}

View file

@ -0,0 +1,5 @@
{
flake.modules.homeManager.gui.programs.qutebrowser.settings = {
colors.webpage.darkmode.enabled = true;
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.nixos.pc.programs.dconf.enable = true;
}

View file

@ -0,0 +1,7 @@
{ config, ... }:
{
flake.modules.nixos.desktop.imports = with config.flake.modules.nixos; [
pc
];
}

View file

@ -0,0 +1,35 @@
{ inputs, ... }:
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
home.packages = [
(pkgs.stdenv.mkDerivation {
pname = "displayselect";
version = "unstable";
src = inputs.voidrice;
dontUnpack = true;
buildInputs = with pkgs; [
bash
xorg.xrandr
];
prePatch = ''
cp "$src/.local/bin/displayselect" displayselect
'';
patches = [ ./scaling.patch ];
installPhase = ''
mkdir -p $out/bin
cp displayselect $out/bin
chmod +x $out/bin/displayselect
'';
})
];
};
}

View file

@ -0,0 +1,26 @@
diff --git a/.local/bin/displayselect b/.local/bin/displayselect
index 51dd468..c132b7a 100755
--- a/displayselect
+++ b/displayselect
@@ -15,20 +15,13 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \
tail -n 1 | awk '{print $1}')
- res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \
- tail -n 1 | awk '{print $1}')
res_ext_x=$(echo "$res_external" | sed 's/x.*//')
res_ext_y=$(echo "$res_external" | sed 's/.*x//')
- res_int_x=$(echo "$res_internal" | sed 's/x.*//')
- res_int_y=$(echo "$res_internal" | sed 's/.*x//')
-
- scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
- scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
xrandr --output "$external" --auto --scale 1.0x1.0 \
--output "$internal" --auto --same-as "$external" \
- --scale "$scale_x"x"$scale_y"
+ --scale-from "${res_ext_x}x${res_ext_y}"
else
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")

View file

@ -0,0 +1,24 @@
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
home.packages = [
(pkgs.writeShellApplication {
name = "dmenu_mpv";
text = ''
selected="$(find "$HOME/Videos" -type f | dmenu -i -l 15)"
if [[ -n "$selected" ]]; then
mpv --fs --speed=1.5 "$selected" >/dev/null 2>&1
fi
'';
runtimeInputs = with pkgs; [
dmenu
mpv
];
})
];
};
}

View file

@ -0,0 +1,26 @@
{ inputs, ... }:
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
home.packages = [
(pkgs.stdenv.mkDerivation rec {
pname = "dmenu_sys";
version = "unstable";
src = inputs.bop-scripts;
dontUnpack = true;
buildInputs = with pkgs; [ dmenu ];
installPhase = ''
mkdir -p $out/bin
cp $src/shortcuts-menus/sys $out/bin/${pname}
chmod +x $out/bin/${pname}
'';
})
];
};
}

View file

@ -0,0 +1,26 @@
{ inputs, ... }:
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
home.packages = [
(pkgs.stdenv.mkDerivation rec {
pname = "dmenu_timer";
version = "unstable";
src = inputs.bop-scripts;
dontUnpack = true;
buildInputs = with pkgs; [ dmenu ];
installPhase = ''
mkdir -p $out/bin
cp $src/statusbar/timer $out/bin/${pname}
chmod +x $out/bin/${pname}
'';
})
];
};
}

View file

@ -0,0 +1,36 @@
{ inputs, ... }:
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
home.packages = [
(pkgs.writeShellApplication {
name = "dmenu_tmux";
text = ''
selected="$(z tmux list | dmenu -l 40)" || exit 0
if tmux list-sessions >/dev/null 2>&1; then
if pgrep -x st >/dev/null; then
z tmux connect "$selected"
exit 0
fi
fi
pkill -x st 2>/dev/null || true
sleep 0.1
exec st -e z tmux connect "$selected"
'';
runtimeInputs = with pkgs; [
dmenu
inputs.z.packages.${pkgs.stdenv.hostPlatform.system}.default
st
];
})
];
};
}

View file

@ -0,0 +1,11 @@
{
flake.modules.homeManager.gui =
{ config, ... }:
{
home = {
file."${config.home.sessionVariables.XINITRC}".source = ./xinitrc;
sessionVariables.XINITRC = "${config.xdg.configHome}/X11/xinitrc";
};
};
}

View file

@ -0,0 +1,14 @@
diff --git a/dmenu.c b/dmenu.c
index fd49549..e9e2648 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -757,6 +757,8 @@ main(int argc, char *argv[])
colors[SchemeSel][ColFg] = argv[++i];
else if (!strcmp(argv[i], "-w")) /* embedding window id */
embed = argv[++i];
+ else if (!strcmp(argv[i], "-c"))
+ continue;
else
usage();

View file

@ -0,0 +1,20 @@
{
flake.modules.nixos.pc =
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
(dmenu.override {
patches = [
./dmenu-center-noop.patch
];
})
dmenu-bluetooth
dunst
networkmanager_dmenu
poweralertd
slock
xdotool
];
};
}

View file

@ -0,0 +1,12 @@
systemctl --user import-environment DISPLAY
poweralertd -s &
dwmblocks &
gammastep &
sxhkd &
export GPG_TTY=$(tty)
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
gpg-connect-agent updatestartuptty /bye
exec dwm

View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.gui.services.flameshot.enable = true;
}

View file

@ -0,0 +1,13 @@
{
flake.modules.homeManager.gui =
{ config, ... }:
{
services.flameshot.settings.General = {
disabledTrayIcon = false;
saveAfterCopy = true;
savePath = "${config.xdg.userDirs.pictures}/Screenshots";
showHelp = false;
uiColor = "#60a5fa";
};
};
}

16
modules/desktop/fonts.nix Normal file
View file

@ -0,0 +1,16 @@
{
flake.modules.nixos.desktop =
{ pkgs, ... }:
{
fonts = {
fontconfig.enable = true;
packages = with pkgs; [
nerd-fonts.jetbrains-mono
nerd-fonts.meslo-lg
terminus_font
terminus_font_ttf
];
};
};
}

View file

@ -0,0 +1,8 @@
{
nixpkgs.allowedUnfreePackages = [
"steam"
"steam-unwrapped"
];
flake.modules.nixos.desktop.programs.steam.enable = true;
}

View file

@ -0,0 +1,7 @@
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
home.packages = with pkgs; [ zeroad ];
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homManager.gui.services.gammastep.enable = true;
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homManager.gui.services.gammastep.provider = "geoclue2";
}

View file

@ -0,0 +1,6 @@
{
flake.modules.homeManager.gui.gtk = {
gtk3.extraConfig.gtk-enable-animations = false;
gtk4.extraConfig.gtk-enable-animations = false;
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.gui.gtk.enable = true;
}

View file

@ -0,0 +1,10 @@
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
gtk.iconTheme = {
name = "Arc";
package = pkgs.arc-icon-theme;
};
};
}

View file

@ -0,0 +1,10 @@
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
gtk.theme = {
name = "Arc-Dark";
package = pkgs.arc-theme;
};
};
}

View file

@ -0,0 +1,7 @@
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
home.packages = [ pkgs.handbrake ];
};
}

View file

@ -0,0 +1,15 @@
{ config, ... }:
{
nixpkgs.allowedUnfreePackages = [ "makemkv" ];
flake.modules.nixos.desktop =
{ pkgs, ... }:
{
boot.kernelModules = [ "sg" ];
environment.systemPackages = with pkgs; [ makemkv ];
users.users.${config.flake.meta.owner.username}.extraGroups = [ "cdrom" ];
};
}

View file

@ -0,0 +1,7 @@
{
# https://github.com/mpv-player/mpv/blob/master/etc/input.conf
flake.modules.homeManager.gui.programs.mpv.bindings = {
"DOWN" = "add volume -5";
"UP" = "add volume 5";
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.gui.programs.mpv.enable = true;
}

View file

@ -0,0 +1,8 @@
{
flake.modules.homeManager.gui.services.redshift = {
enable = true;
latitude = "51.58";
longitude = "-2.99";
};
}

View file

@ -0,0 +1,6 @@
{
flake.modules.nixos.desktop.services.pipewire.alsa = {
enable = true;
support32Bit = true;
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.nixos.pc.services.pipewire.enable = true;
}

View file

@ -0,0 +1,3 @@
{
flake.modules.nixos.pc.services.pipewire.pulse.enable = true;
}

9
modules/desktop/st.nix Normal file
View file

@ -0,0 +1,9 @@
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
home.packages = with pkgs; [
st
];
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.gui.services.sxhkd.enable = true;
}

View file

@ -0,0 +1,23 @@
{ lib, ... }:
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
services.sxhkd.keybindings = {
"@F10" = "/home/opdavies/.local/bin/unmounter";
"@F3" = "displayselect";
"@F9" = "/home/opdavies/.local/bin/mounter";
"super + BackSpace" = "dmenu_sys";
"super + shift + b" = "/etc/profiles/per-user/opdavies/bin/bookmarkthis";
"super + shift + i" =
"${pkgs.xdotool}/bin/xdotool type $(cat ~/.local/share/snippets.txt | grep -v '^#' | grep -v '^$' | sort | dmenu -i -l 50 | cut -d' ' -f1)";
"super + shift + p" = "${lib.getExe pkgs.passmenu-otp} -i";
"super + shift + t" = "dmenu_tmux";
"super + shift + v" = "dmenu_mpv";
"super + x; {1, 2, 3, 4}" = "st {notes, newsboat, nmtui, bluetuith}";
"{_, shift +, super +}XF86MonBrightness{Down,Up}" =
"${lib.getExe pkgs.brightnessctl} set {5%-,10%-,10%,+5%,+10%,100%} --quiet";
};
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.pc.nixos.programs.thunar.enable = true;
}

View file

@ -0,0 +1,7 @@
{
flake.modules.pc.nixos =
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [ xfce.tumbler ];
};
}

View file

@ -0,0 +1,9 @@
{
flake.modules.pc.nixos =
{ pkgs, ... }:
{
programs.thunar.plugins = with pkgs.xfce; [
thunar-archive-plugin
];
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.nixos.pc.services.xbanish.enable = true;
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.gui.xsession.enable = true;
}

7
modules/desktop/zram.nix Normal file
View file

@ -0,0 +1,7 @@
{
flake.modules.nixos.pc.zramSwap = {
enable = true;
algorithm = "zstd";
memoryPercent = 90;
};
}