-
-
Save ivanbrennan/bc4e3bcfa9560200c29f5dc2da115cd2 to your computer and use it in GitHub Desktop.
Custom X cursor in NixOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, lib, pkgs, ... }: | |
with lib; | |
let cfg = config.xcursor; | |
in { | |
options.xcursor = { | |
theme = mkOption { | |
default = "Premium"; | |
type = types.string; | |
description = '' | |
The X cursor theme to apply. | |
''; | |
}; | |
}; | |
config = { | |
environment = { | |
profileRelativeEnvVars.XCURSOR_PATH = [ "/share/icons" ]; | |
etc."xdg/gtk-3.0/settings.ini" = { | |
text = '' | |
[Settings] | |
gtk-cursor-theme-name=${cfg.theme} | |
''; | |
mode = "444"; | |
}; | |
systemPackages = [ | |
(pkgs.callPackage ({ stdenv }: stdenv.mkDerivation rec { | |
name = "default-xcursor-theme"; | |
phases = [ "installPhase" ]; | |
installPhase = '' | |
mkdir -p $out/share/icons/default | |
cat <<'EOL' > $out/share/icons/default/icon.theme | |
[Icon Theme] | |
Inherits=${cfg.theme} | |
EOL | |
ln -s /run/current-system/sw/share/icons/${cfg.theme}/cursors $out/share/icons/default/cursors | |
''; | |
meta = { | |
description = "Install the default X cursor theme globally."; | |
}; | |
}) { }) | |
]; | |
pathsToLink = [ "/share/icons" ]; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment