From c8e82b3b4b6aadae15da45d0868ad63ac765cda4 Mon Sep 17 00:00:00 2001 From: Nathan van Doorn Date: Tue, 17 Oct 2023 10:04:53 +0200 Subject: [PATCH] Renaming and refactoring * Define packages in terms of overlay * rename everything --- aja-ntv2/default.nix | 2 +- aja-ntv2/driver.nix | 2 +- flake.nix | 46 +++++++++++++++++--------------------------- ntv2-gst.nix | 8 ++++---- readme.md | 4 ++-- 5 files changed, 26 insertions(+), 36 deletions(-) diff --git a/aja-ntv2/default.nix b/aja-ntv2/default.nix index 885aa66..933de88 100644 --- a/aja-ntv2/default.nix +++ b/aja-ntv2/default.nix @@ -6,7 +6,7 @@ buildApps ? true, }: stdenv.mkDerivation { - name = "ajantv2-dev"; + name = "ntv2"; src = ntv2-src; nativeBuildInputs = [cmake]; diff --git a/aja-ntv2/driver.nix b/aja-ntv2/driver.nix index 28f4165..44a6fee 100644 --- a/aja-ntv2/driver.nix +++ b/aja-ntv2/driver.nix @@ -5,7 +5,7 @@ ntv2-src, }: stdenv.mkDerivation { - name = "ajantv2-driver-${kernel.version}"; + name = "ntv2-driver-${kernel.version}"; src = ntv2-src; patches = [./lol.patch ./newkernels.patch]; nativeBuildInputs = kernel.moduleBuildDependencies; diff --git a/flake.nix b/flake.nix index a514a75..0d8e2a3 100644 --- a/flake.nix +++ b/flake.nix @@ -21,33 +21,23 @@ ntv2-src, ntv2-gst-src, }: - ( - flake-utils.lib.eachSystem ["x86_64-linux"] (system: let - pkgs = import nixpkgs { - inherit system; - }; - in { - packages.aja-ntv2-gst = pkgs.callPackage ./ntv2-gst.nix { - ajantv2 = pkgs.callPackage ./aja-ntv2/default.nix { - inherit ntv2-src; - buildApps = false; - }; - inherit ntv2-gst-src; - }; - }) - ) - // flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { - inherit system; - }; - in { - formatter = pkgs.alejandra; - }) - // { - overlays.default = final: prev: { - ajantv-utils = final.callPackage ./aja-ntv2/default.nix { inherit ntv2-src; }; - ajantv-driver = final.linuxPackages.callPackage ./aja-ntv2/driver.nix { inherit ntv2-src; }; - aja-ntv2-gst = self.packages.${prev.system}.aja-ntv2-gst; - }; + { + overlays.default = final: prev: { + ntv2 = final.callPackage ./aja-ntv2 { inherit ntv2-src; }; + ntv2-gst = final.callPackage ./ntv2-gst.nix { inherit ntv2-gst-src; }; + linuxPackages = prev.linuxPackages.extend + (linuxFinal: linuxPrev: { + ntv2-driver = linuxFinal.callPackage ./aja-ntv2/driver.nix { inherit ntv2-src; }; + }); }; + } // flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: + let + pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.default ]; }; + in { + packages = { + inherit (pkgs) ntv2 ntv2-gst; + inherit (pkgs.linuxPackages) ntv2-driver; + }; + formatter = pkgs.alejandra; + }); } diff --git a/ntv2-gst.nix b/ntv2-gst.nix index 1bb3cf3..f4697c1 100644 --- a/ntv2-gst.nix +++ b/ntv2-gst.nix @@ -6,16 +6,16 @@ pkgconfig, libtool, gst_all_1, - ajantv2, + ntv2, }: stdenv.mkDerivation { - name = "aja-ntv2-gst"; + name = "ntv2-gst"; src = ntv2-gst-src; sourceRoot = "source/gst-plugin"; patches = [./no.patch]; - nativeBuildInputs = [autoconf automake pkgconfig libtool gst_all_1.gst-plugins-base ajantv2]; - GST_NTV2 = "${ajantv2}/include"; + nativeBuildInputs = [autoconf automake pkgconfig libtool gst_all_1.gst-plugins-base ntv2]; + GST_NTV2 = "${ntv2}/include"; preConfigure = '' ./autogen.sh ''; diff --git a/readme.md b/readme.md index de3c41c..6e18779 100644 --- a/readme.md +++ b/readme.md @@ -14,13 +14,13 @@ gstreamer plugin. This allows you to use Aja video IO cards on NixOS. - Add the kernel driver: ```nix # Include the kernel module - boot.extraModulePackages = [pkgs.ajantv-driver]; + boot.extraModulePackages = [pkgs.linuxPackages.ntv2-driver]; # And load it automatically boot.kernelModules = [ "ajantv2" ]; ``` - Include the utils/demos and gstreamer plugin: ```nix - environment.systemPackages = [pkgs.ajantv-utils pkgs.aja-ntv2-gst] + environment.systemPackages = [pkgs.ntv2 pkgs.ntv2-gst] ``` ## Gstreamer