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