nixpkgs/pkgs/tools/misc/via/default.nix

43 lines
1.4 KiB
Nix
Raw Normal View History

2021-07-06 00:47:00 +00:00
{ lib, fetchurl, appimageTools }:
let
pname = "via";
2023-03-21 21:46:15 +00:00
version = "3.0.0";
2021-07-06 00:47:00 +00:00
name = "${pname}-${version}";
src = fetchurl {
url = "https://github.com/the-via/releases/releases/download/v${version}/via-${version}-linux.AppImage";
name = "via-${version}-linux.AppImage";
2023-03-21 21:46:15 +00:00
sha256 = "sha256-+uTvmrqHK7L5VA/lUHCZZeRYPUrcVA+vjG7venxuHhs=";
2021-07-06 00:47:00 +00:00
};
appimageContents = appimageTools.extractType2 { inherit name src; };
in
appimageTools.wrapType2 {
2021-07-06 00:47:00 +00:00
inherit name src;
profile = ''
# Skip prompt to add udev rule.
# On NixOS you can add this rule with `services.udev.packages = [ pkgs.via ];`.
export DISABLE_SUDO_PROMPT=1
'';
extraInstallCommands = ''
mv $out/bin/${name} $out/bin/${pname}
install -m 444 -D ${appimageContents}/via-nativia.desktop -t $out/share/applications
substituteInPlace $out/share/applications/via-nativia.desktop \
2021-07-06 00:47:00 +00:00
--replace 'Exec=AppRun' 'Exec=${pname}'
cp -r ${appimageContents}/usr/share/icons $out/share
mkdir -p $out/etc/udev/rules.d
echo 'KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0666", TAG+="uaccess", TAG+="udev-acl"' > $out/etc/udev/rules.d/92-viia.rules
'';
meta = with lib; {
description = "Yet another keyboard configurator";
homepage = "https://caniusevia.com/";
license = licenses.gpl3;
2022-02-11 04:45:03 +00:00
maintainers = with maintainers; [ emilytrau ];
2021-07-06 00:47:00 +00:00
platforms = [ "x86_64-linux" ];
2023-11-27 01:17:53 +00:00
mainProgram = "via";
2021-07-06 00:47:00 +00:00
};
}