From ddf226bd064e2d10e3c8a8a0ef388a595f0a16f3 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Thu, 28 Dec 2023 16:34:26 +0100 Subject: [PATCH] add vuescan definition --- nixos/default.nix | 9 ++++++- nixos/vuescan.nix | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 nixos/vuescan.nix diff --git a/nixos/default.nix b/nixos/default.nix index 3decc34..a32b1ec 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -1,4 +1,9 @@ -{ pkgs, config, lib, ... }: { +{ pkgs, config, lib, ... }: + +let + vuescan = pkgs.callPackage ./vuescan.nix { }; +in +{ imports = [ ./hardware-configuration.nix ]; boot = { loader.systemd-boot.enable = true; }; @@ -7,6 +12,7 @@ i18n.defaultLocale = "en_US.UTF-8"; services = { + udev.packages = [ vuescan ]; gnome.gnome-keyring.enable = lib.mkForce false; xserver = { @@ -49,6 +55,7 @@ dogdns tree dig + vuescan ]; gnome.excludePackages = with pkgs; [ gnome.totem diff --git a/nixos/vuescan.nix b/nixos/vuescan.nix new file mode 100644 index 0000000..89759ba --- /dev/null +++ b/nixos/vuescan.nix @@ -0,0 +1,60 @@ +{ stdenv +, fetchurl +, gnutar +, autoPatchelfHook +, glibc +, gtk2 +, xorg +, libgudev +, makeDesktopItem +}: +let + pname = "vuescan"; + version = "9.8"; + desktopItem = makeDesktopItem { + name = "VueScan"; + desktopName = "VueScan"; + genericName = "Scanning Program"; + comment = "Scanning Program"; + icon = "vuescan"; + terminal = false; + type = "Application"; + startupNotify = true; + categories = [ "Graphics" "Utility" ]; + keywords = [ "scan" "scanner" ]; + + exec = "vuescan"; + }; +in +stdenv.mkDerivation { + name = "${pname}-${version}"; + + src = fetchurl { + url = "https://www.hamrick.com/files/vuex6498.tgz"; + hash = "sha256-qTSZuNPCi+G4e7PfnJEDj8rBMYV/Tw/ye3nDspqIPlE="; + }; + + # Stripping breaks the program + dontStrip = true; + + nativeBuildInputs = [ gnutar autoPatchelfHook ]; + + buildInputs = [ glibc gtk2 xorg.libSM libgudev ]; + + unpackPhase = '' + tar xfz $src + ''; + + installPhase = '' + install -m755 -D VueScan/vuescan $out/bin/vuescan + + mkdir -p $out/share/icons/hicolor/scalable/apps/ + cp VueScan/vuescan.svg $out/share/icons/hicolor/scalable/apps/vuescan.svg + + mkdir -p $out/lib/udev/rules.d/ + cp VueScan/vuescan.rul $out/lib/udev/rules.d/60-vuescan.rules + + mkdir -p $out/share/applications/ + ln -s ${desktopItem}/share/applications/* $out/share/applications + ''; +}