From 3f728a7c57692d8ddcc85c6825ff03838f24203e Mon Sep 17 00:00:00 2001 From: Nathan van Doorn Date: Wed, 18 Oct 2023 19:58:02 +0200 Subject: [PATCH 1/2] Rename pkgconfig => pkg-config To match an upstream warning. It'd be nice if we got a warning... --- ntv2-gst/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntv2-gst/default.nix b/ntv2-gst/default.nix index f4697c1..5521bbc 100644 --- a/ntv2-gst/default.nix +++ b/ntv2-gst/default.nix @@ -3,7 +3,7 @@ ntv2-gst-src, autoconf, automake, - pkgconfig, + pkg-config, libtool, gst_all_1, ntv2, @@ -14,7 +14,7 @@ stdenv.mkDerivation { sourceRoot = "source/gst-plugin"; patches = [./no.patch]; - nativeBuildInputs = [autoconf automake pkgconfig libtool gst_all_1.gst-plugins-base ntv2]; + nativeBuildInputs = [autoconf automake pkg-config libtool gst_all_1.gst-plugins-base ntv2]; GST_NTV2 = "${ntv2}/include"; preConfigure = '' ./autogen.sh From 8161d3e369ca7c0cd23e11b7d9d3b60da495828c Mon Sep 17 00:00:00 2001 From: Nathan van Doorn Date: Wed, 18 Oct 2023 19:58:58 +0200 Subject: [PATCH 2/2] Make a nixos module and make the readme suggest you use that --- flake.nix | 21 +++++++++++++++++++++ readme.md | 15 ++------------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/flake.nix b/flake.nix index d604d53..556efd3 100644 --- a/flake.nix +++ b/flake.nix @@ -30,6 +30,27 @@ ntv2-driver = linuxFinal.callPackage ./ntv2/driver.nix { inherit ntv2-src; }; }); }; + nixosModules.default = { config, lib, pkgs, ... }: { + options = { + ntv2 = { + enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = "If enabled, install the AJA driver, utilities, and gstreamer plugin."; + }; + }; + }; + config = lib.mkIf config.ntv2.enable { + # Apply the overlay to the system nixpkgs + nixpkgs.overlays = [ self.overlays.default ]; + # Include the kernel module... + boot.extraModulePackages = [ pkgs.linuxPackages.ntv2-driver ]; + # ...and load it automatically. + boot.kernelModules = [ "ajantv2" ]; + # Include the utils and demos, and the gstreamer plugin + environment.systemPackages = [ pkgs.ntv2 pkgs.ntv2-gst ]; + }; + }; } // flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: let pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.default ]; }; diff --git a/readme.md b/readme.md index 6e18779..9bb6857 100644 --- a/readme.md +++ b/readme.md @@ -7,20 +7,9 @@ gstreamer plugin. This allows you to use Aja video IO cards on NixOS. ## Usage - Add the flake to your system flake's inputs. -- Apply the overlay to your system's nixpkgs, e.g. +- Enable the module by adding the following to your system config: ```nix - nixpkgs.overlays = [ ajantv2.overlays.default ]; - ``` -- Add the kernel driver: - ```nix - # Include the kernel module - boot.extraModulePackages = [pkgs.linuxPackages.ntv2-driver]; - # And load it automatically - boot.kernelModules = [ "ajantv2" ]; - ``` -- Include the utils/demos and gstreamer plugin: - ```nix - environment.systemPackages = [pkgs.ntv2 pkgs.ntv2-gst] + ntv2.enable = true; ``` ## Gstreamer