liquid-dsp guix package definition

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 Christopher Howard <christopher@librehacker.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages liquid-dsp)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system gnu)
  #:use-module (gnu packages)
  #:use-module (gnu packages algebra)
  #:use-module (gnu packages autotools))

(define-public liquid-dsp
  (package
    (name "liquid-dsp")
    (version "1.3.2")
    (source
     (origin (method git-fetch)
             (uri (git-reference
                   (url (string-append "https://github.com/jgaeddert/liquid-dsp.git"))
                   (commit (string-append "v" version))))
             (file-name (git-file-name name version))
             (sha256
              (base32 "1n6dbg13q8ga5qhg1yiszwly4jj0rxqr6f1xwm9waaly5z493xsd"))))
    (build-system gnu-build-system)
    (native-inputs
     `(("autoconf" ,autoconf)))
    (inputs
     `(("fftw" ,fftw)
       ("fftwf" ,fftwf)))
    (home-page "https://liquidsdr.org")
    (synopsis "Signal processing library for software-defined radios written in C")
    (description
     "Liquid DSP provides a set of extensible DSP modules that do not
rely on external dependencies or cumbersome frameworks")
    (license license:expat)))

Here is the guix patch request:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38865

HackRF Shell Guix Definition

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 Christopher Howard <christopher@librehacker.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages hackrfshell)
  #:use-module (guix)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system gnu)
  #:use-module (gnu packages)
  #:use-module (gnu packages algebra)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages guile)
  #:use-module (gnu packages hackrf)
  #:use-module (gnu packages pkg-config))

(define-public hackrfshell
  (package
    (name "hackrfshell")
    (version "0.0.1")
    (source
     (origin (method url-fetch)
             (uri (string-append
                   "ftp://git.librehacker.com/hackrfshell/hackrfshell-"
                   version ".tar.gz"))
             (file-name (string-append "hackrfshell-" version "-tar.gz"))
             (sha256
              (base32 "0iqnd1jbhq5wjrp30d9i0yy9jqshyy00nzsmh78dnxp1yjm2wppa"))))
    (build-system gnu-build-system)
    (native-inputs
     `(("pkg-config" ,pkg-config)))
    (inputs
     `(("hackrf" ,hackrf)
       ("glib" ,glib)
       ("guile-2.2" ,guile-2.2)
       ("fftwf", fftwf)))
    (home-page "https://librehacker.com")
    (synopsis
     "Program which loads HackRF control procedures into a Scheme shell")
    (description
     "This is a C program loads up a Guile Scheme shell with primitive
HackRF control functions, as well as some other useful core functions
for Software Defined Radio (SDR) data processing.  This is something
that maybe could be done with a FFI interface, but this approach works
also and arguably has one or two advantages.")
    (license license:gpl3+)))

WIP: HackRF Package Definition for Guix

I created this package definition, which I believe is in-and-of-itself complete:

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 Christopher Howard <christopher@librehacker.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages hackrf)
  #:use-module (gnu packages)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system cmake)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages algebra)
  #:use-module (gnu packages libusb))

(define-public hackrf
  (let ((commit "e9c6c2d2e6f9c2e903c1e69de9a48aa4b28a1e55")
        (revision "0"))
  (package
    (name "hackrf")
    (version (string-append "2018.01.1-" revision "." (string-take commit 7)))
    (home-page "https://greatscottgadgets.com/hackrf/")
    (synopsis "User-space library and utilities for HackRF SDR")
    (description
     "Command line utilities and a C library for controlling the HackRF
Software Defined Radio (SDR) over USB.")
    (license license:gpl2)
    (source
     (origin
      (method git-fetch)
      (uri (git-reference
            (url "https://github.com/mossmann/hackrf.git")
            (commit commit)))
      (sha256
       (base32 "0vqlr0nph9r7wpqn81ghhdbb131803b8wi328iaz37304mrr6hkw"))
      (file-name (git-file-name name version))))
    (build-system cmake-build-system)
    (arguments '(#:configure-flags
                 (list "-DUDEV_RULES_GROUP=dialout"
                       (string-append "-DUDEV_RULES_PATH="
                                      (assoc-ref
                                       %outputs "out") "/lib/udev/rules.d"))
                 #:phases (modify-phases %standard-phases
                            (add-before 'configure 'enter-source-directory
                              (lambda _ (chdir "host") #t))
                            (add-before 'install-license-files
                                'change-back (lambda _ (chdir "..") #t)))
                 #:tests? #f #| no test suite |# ))
    (native-inputs
     `(("pkg-config" ,pkg-config)))
    (inputs `(("libusb" ,libusb)
              ("fftw" ,fftw)
              ("fftwf" ,fftwf))))))

However, I have not submitted it as a patch yet, as I wanted to test it with my HackRF SDR first, and that let me down a rabbit trail on how to install udev rules in Guix. I’m about out of time for this project for today, so I’ll finish this up next week, God willing.

Guix Migration

I made a dramatic move last weekend, switching my home desktop PC from Debian 9 to Guix System 1.0.1. The transition has been an ongoing process over the last week, with some challenges that I’m still working through, but Guix is so much fun to work with that I don’t mind.

Some of my preferred applications have not made it into Guix yet, or I could not get them to work under Guix, so I’ve been learning a few substitute applications. E.g., I couldn’t get Raptor chess client to work with Guix Java libraries (I think Raptor is too old) so I switched to Xboard to play FICS. Xboard in Guix seems to be a nice enough client for my needs.

In Guix, you can update the System separately from your user applications. It is kind of like the ability to have your System running from Debian 9 repository but all your applications running from Debian 10. So I’ve kept my System running Guix System 1.0.1 with the user applications running from the latest Guix pull. I actual tried to upgrade to a new version of System, but ran into trouble after a reboot logging into Gnome, so I just rolled back to 1.0.1, which is about a 1 second process in Guix, not counting the computer reboot.

One cool thing, aside from the ability to be running a very recent Emacs (26.3), is access to every Emacs package imaginable, including the emacs-guix package for managing your Guix system from Emacs.

I found out that Warzone2100 package works great in Guix, whereas it was pretty much half-broken in Debian 9. One of the problems with Warzone2100 in Debian is that the JavaScripts that ran a lot of the game logic broke in the transition from Debian 8 to Debian 9, and nobody wanted to invest the energy to fix it. But that sort of thing is not an issue in Guix because Guix allows every versions of every package to have unique versions of all their dependencies if needed.

Guix is basically a “have your cake and eat it too” distro with the ability to have the latest and greatest of everything (potentially) but also the ability to roll back at a moments notice, while cleanly dodging the bullet of dependency hell. I’m still working through some issues, for sure (e.g., a problem getting my cups printer to show up in Gnome dialog box). But Guix is truly the hacker’s distro.

Remote TCP Dump for Wireshark

ssh root@host.example.com 'tcpdump -i eth0 -c 1000 -w -' > host.pcap

This command logs into the remote system, captures 1000 packets with tcpdump, and saves them to local file host.pcap in pcap format for analysis by Wireshark.

This is a simple and quick command. If performance was a concern, e.g., if you needed to capture 10 billion packets per second, you might need to take a different approach.