From 45e99af483db4fdf9787d41e868dca2ec03c9b79 Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Sun, 2 May 2021 15:49:10 +0000 Subject: [PATCH] Fix jlink --- externals/packages/avarice/default.nix | 24 ++++++++++++++++++++++++ sets/hardware.nix | 4 ++-- 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 externals/packages/avarice/default.nix diff --git a/externals/packages/avarice/default.nix b/externals/packages/avarice/default.nix new file mode 100644 index 0000000..6cc613a --- /dev/null +++ b/externals/packages/avarice/default.nix @@ -0,0 +1,24 @@ +{ lib, stdenv, fetchurl, perl, libbfd, libusb-compat-0_1, hidapi }: + +stdenv.mkDerivation rec { + pname = "avarice"; + version = "2.14"; + src = fetchurl { + url = "mirror://sourceforge/project/avarice/avarice/avarice-${version}/avarice-${version}.tar.bz2"; + sha256 = "1ab2pxnkbw501iv1i9z9nj7hfzz4y7hid4l4q58cifm3aw17skjb"; + }; + + nativeBuildInputs = [ perl ]; + buildInputs = [ libbfd libusb-compat-0_1 hidapi ]; + prePatch = '' + find src -type f -name '*.cc' -exec sed -i "s@ __unused@@g" {} \; + ''; + + meta = with lib; { + homepage = "http://avarice.sourceforge.net/"; + description = "A program to facilitate AVR debugging using an Atmel or AVR ICE"; + license = licenses.gpl2; + platforms = platforms.unix; + maintainers = [ maintainers.artemist ]; + }; +} diff --git a/sets/hardware.nix b/sets/hardware.nix index 2f7ada0..9193bbe 100644 --- a/sets/hardware.nix +++ b/sets/hardware.nix @@ -1,7 +1,7 @@ { config, pkgs, ... }: let - oldpkgs = import (fetchTarball "http://nixos.org/channels/nixos-20.03/nixexprs.tar.xz") { config.allowUnfree = true; }; - jlink = oldpkgs.callPackage ../externals/packages/jlink { }; + call = if (pkgs.targetPlatform.system == "x86_64-linux") then pkgs.pkgsi686Linux.callPackage else pkgs.callPackage; + jlink = call ../externals/packages/jlink { }; in { services.udev.packages = [