104 lines
4.2 KiB
Nix
104 lines
4.2 KiB
Nix
{
|
|
pkgs,
|
|
}:
|
|
let tiny-dfr = with pkgs; rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "tiny-dfr";
|
|
version = "0.3.2";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "xeniagda";
|
|
repo = "tiny-dfr";
|
|
rev = "v${version}";
|
|
hash = "sha256-6BzUMh6Mrae6QNwEWNmZVeKGJ8e2uFmx/O10bxt5k8I=";
|
|
};
|
|
|
|
cargoHash = "sha256-IfjXuXDMZ1hOwPWSXgNk5rin/uwFc2iFE+XusjQ3kKE=";
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
buildInputs = [ cairo gdk-pixbuf glib libinput libxml2 pango udev ];
|
|
|
|
postConfigure = ''
|
|
substituteInPlace etc/systemd/system/tiny-dfr.service \
|
|
--replace-fail /usr/bin $out/bin
|
|
substituteInPlace src/*.rs --replace-quiet /usr/share $out/share
|
|
'';
|
|
|
|
postInstall = ''
|
|
cp -R etc $out/lib
|
|
cp -R share $out
|
|
'';
|
|
};
|
|
in
|
|
{
|
|
services.udev.packages = [ tiny-dfr ];
|
|
systemd.services.tiny-dfr = {
|
|
enable = true;
|
|
description = "tiny-dfr";
|
|
after = ["systemd-user-sessions.service" "getty@tty1.service" "plymouth-quit.service" "systemd-logind.service" "dev-tiny_dfr_display.device" "dev-tiny_dfr_backlight.device" "dev-tiny_dfr_display_backlight.device"];
|
|
wantedBy = ["multi-user.target"];
|
|
bindsTo = ["dev-tiny_dfr_display.device" "dev-tiny_dfr_backlight.device" "dev-tiny_dfr_display_backlight.device"];
|
|
startLimitIntervalSec = 30;
|
|
startLimitBurst = 2;
|
|
serviceConfig = {
|
|
ExecStart = "${tiny-dfr}/bin/tiny-dfr";
|
|
Restart = "always";
|
|
};
|
|
restartIfChanged = true;
|
|
};
|
|
environment.etc."tiny-dfr/next-workspace.svg".source = ./tiny-dfr-icons/next-workspace.svg;
|
|
environment.etc."tiny-dfr/prev-workspace.svg".source = ./tiny-dfr-icons/prev-workspace.svg;
|
|
environment.etc."tiny-dfr/brightness_high.svg".source = ./tiny-dfr-icons/brightness_high.svg;
|
|
environment.etc."tiny-dfr/brightness_low.svg".source = ./tiny-dfr-icons/brightness_low.svg;
|
|
environment.etc."tiny-dfr/backlight_high.svg".source = ./tiny-dfr-icons/backlight_high.svg;
|
|
environment.etc."tiny-dfr/backlight_low.svg".source = ./tiny-dfr-icons/backlight_low.svg;
|
|
environment.etc."tiny-dfr/play_pause.svg".source = ./tiny-dfr-icons/play_pause.svg;
|
|
environment.etc."tiny-dfr/fast_forward.svg".source = ./tiny-dfr-icons/fast_forward.svg;
|
|
environment.etc."tiny-dfr/fast_rewind.svg".source = ./tiny-dfr-icons/fast_rewind.svg;
|
|
environment.etc."tiny-dfr/volume_up.svg".source = ./tiny-dfr-icons/volume_up.svg;
|
|
environment.etc."tiny-dfr/volume_down.svg".source = ./tiny-dfr-icons/volume_down.svg;
|
|
environment.etc."tiny-dfr/volume_off.svg".source = ./tiny-dfr-icons/volume_off.svg;
|
|
environment.etc."tiny-dfr/config.toml".source = (pkgs.formats.toml {}).generate "tiny-dfr-config" {
|
|
FontTemplate = "monospace-12";
|
|
ActiveBrightness = 255;
|
|
ShowButtonOutlines = false;
|
|
MediaLayerDefault = true;
|
|
|
|
MediaLayerKeys = [
|
|
{ Icon = "prev-workspace"; Action = "Finance"; } # bind me in the window manager!
|
|
{ Icon = "next-workspace"; Action = "Sport"; } # bind me in the window manager!
|
|
{ Icon = "brightness_low"; Action = "BrightnessDown"; }
|
|
{ Icon = "brightness_high"; Action = "BrightnessUp"; }
|
|
{ Icon = "backlight_low"; Action = "IllumDown"; }
|
|
{ Icon = "backlight_high"; Action = "IllumUp"; }
|
|
{ Icon = "fast_rewind"; Action = "PreviousSong"; }
|
|
{ Icon = "play_pause"; Action = "PlayPause"; }
|
|
{ Icon = "fast_forward"; Action = "NextSong"; }
|
|
{ Icon = "volume_off"; Action = "Mute"; }
|
|
{ Icon = "volume_down"; Action = "VolumeDown"; }
|
|
{ Icon = "volume_up"; Action = "VolumeUp"; }
|
|
];
|
|
PrimaryLayerKeys = [
|
|
{ Text = "F1"; Action = "F1"; }
|
|
{ Text = "F2"; Action = "F2"; }
|
|
{ Text = "F3"; Action = "F3"; }
|
|
{ Text = "F4"; Action = "F4"; }
|
|
{ Text = "F5"; Action = "F5"; }
|
|
{ Text = "F6"; Action = "F6"; }
|
|
{ Text = "F7"; Action = "F7"; }
|
|
{ Text = "F8"; Action = "F8"; }
|
|
{ Text = "3"; Action = "Num3"; }
|
|
{ Text = "F10"; Action = "F10"; }
|
|
{ Text = "F11"; Action = "F11"; }
|
|
{ Text = "F12"; Action = "F12"; }
|
|
];
|
|
ButtonStyle = {
|
|
InactiveColor = [0.05 0.0 0.1];
|
|
ActiveColor = [0.7 0.5 0.8];
|
|
OnTime = 0.03;
|
|
OffTime = 0.1;
|
|
Bounce = 5;
|
|
};
|
|
};
|
|
}
|