nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at litex 41 lines 1.4 kB view raw
1{ lib, fetchurl, appimageTools }: 2 3let 4 pname = "via"; 5 version = "3.0.0"; 6 name = "${pname}-${version}"; 7 src = fetchurl { 8 url = "https://github.com/the-via/releases/releases/download/v${version}/via-${version}-linux.AppImage"; 9 name = "via-${version}-linux.AppImage"; 10 sha256 = "sha256-+uTvmrqHK7L5VA/lUHCZZeRYPUrcVA+vjG7venxuHhs="; 11 }; 12 appimageContents = appimageTools.extractType2 { inherit name src; }; 13in 14appimageTools.wrapType2 { 15 inherit name src; 16 17 profile = '' 18 # Skip prompt to add udev rule. 19 # On NixOS you can add this rule with `services.udev.packages = [ pkgs.via ];`. 20 export DISABLE_SUDO_PROMPT=1 21 ''; 22 23 extraInstallCommands = '' 24 mv $out/bin/${name} $out/bin/${pname} 25 install -m 444 -D ${appimageContents}/via-nativia.desktop -t $out/share/applications 26 substituteInPlace $out/share/applications/via-nativia.desktop \ 27 --replace 'Exec=AppRun' 'Exec=${pname}' 28 cp -r ${appimageContents}/usr/share/icons $out/share 29 30 mkdir -p $out/etc/udev/rules.d 31 echo 'KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0666", TAG+="uaccess", TAG+="udev-acl"' > $out/etc/udev/rules.d/92-viia.rules 32 ''; 33 34 meta = with lib; { 35 description = "Yet another keyboard configurator"; 36 homepage = "https://caniusevia.com/"; 37 license = licenses.gpl3; 38 maintainers = with maintainers; [ emilytrau ]; 39 platforms = [ "x86_64-linux" ]; 40 }; 41}