Merge pull request #3 from streams-r-us/big-changes

Major refactoring
This commit is contained in:
Sam W 2023-10-18 17:28:37 +01:00 committed by GitHub
commit 1a12a03e95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 96 additions and 83 deletions

View File

@ -1,21 +1,5 @@
{ {
"nodes": { "nodes": {
"aja-ntv2": {
"flake": false,
"locked": {
"lastModified": 1662565853,
"narHash": "sha256-rXjKDhQcZwAxsMjCoL21gpWeLWyIXyK/1y+78mhKgeo=",
"owner": "aja-video",
"repo": "ntv2",
"rev": "3a1e91f740e36e43a1ec74ff446a097330e87220",
"type": "github"
},
"original": {
"owner": "aja-video",
"repo": "ntv2",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
@ -46,11 +30,44 @@
"type": "indirect" "type": "indirect"
} }
}, },
"ntv2-gst-src": {
"flake": false,
"locked": {
"lastModified": 1692893804,
"narHash": "sha256-90TdrsnO5LatLD4dwivOnZG4tGJmNs2tdAsrL7eQF8g=",
"owner": "aja-video",
"repo": "ntv2-gst",
"rev": "33d3a4957088e49ccecd9efa577b87bb0492f738",
"type": "github"
},
"original": {
"owner": "aja-video",
"repo": "ntv2-gst",
"type": "github"
}
},
"ntv2-src": {
"flake": false,
"locked": {
"lastModified": 1662565853,
"narHash": "sha256-rXjKDhQcZwAxsMjCoL21gpWeLWyIXyK/1y+78mhKgeo=",
"owner": "aja-video",
"repo": "ntv2",
"rev": "3a1e91f740e36e43a1ec74ff446a097330e87220",
"type": "github"
},
"original": {
"owner": "aja-video",
"repo": "ntv2",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"aja-ntv2": "aja-ntv2",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs",
"ntv2-gst-src": "ntv2-gst-src",
"ntv2-src": "ntv2-src"
} }
}, },
"systems": { "systems": {

View File

@ -1,7 +1,16 @@
{ {
description = "AJA video card software"; description = "AJA video card software";
inputs.aja-ntv2 = {
url = "github:aja-video/ntv2"; inputs.ntv2-src = {
type = "github";
owner = "aja-video";
repo = "ntv2";
flake = false;
};
inputs.ntv2-gst-src = {
type = "github";
owner = "aja-video";
repo = "ntv2-gst";
flake = false; flake = false;
}; };
@ -9,34 +18,26 @@
self, self,
nixpkgs, nixpkgs,
flake-utils, flake-utils,
aja-ntv2, 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 {
aja-src = aja-ntv2;
buildApps = false;
};
};
})
)
// flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
};
in {
formatter = pkgs.alejandra;
})
// {
overlays.default = final: prev: { overlays.default = final: prev: {
ajantv-utils = final.callPackage ./aja-ntv2/default.nix {aja-src = aja-ntv2;}; ntv2 = final.callPackage ./ntv2 { inherit ntv2-src; };
ajantv-driver = final.linuxPackages.callPackage ./aja-ntv2/driver.nix {aja-src = aja-ntv2;}; ntv2-gst = final.callPackage ./ntv2-gst { inherit ntv2-gst-src; };
aja-ntv2-gst = self.packages.${prev.system}.aja-ntv2-gst; linuxPackages = prev.linuxPackages.extend
(linuxFinal: linuxPrev: {
ntv2-driver = linuxFinal.callPackage ./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;
});
} }

View File

@ -1,27 +0,0 @@
{
stdenv,
fetchFromGitHub,
autoconf,
automake,
pkgconfig,
libtool,
gst_all_1,
ajantv2,
}:
stdenv.mkDerivation {
name = "aja-ntv2-gst";
src = fetchFromGitHub {
owner = "aja-video";
repo = "ntv2-gst";
rev = "refs/heads/master";
hash = "sha256-90TdrsnO5LatLD4dwivOnZG4tGJmNs2tdAsrL7eQF8g=";
};
sourceRoot = "source/gst-plugin";
patches = [./no.patch];
nativeBuildInputs = [autoconf automake pkgconfig libtool gst_all_1.gst-plugins-base ajantv2];
GST_NTV2 = "${ajantv2}/include";
preConfigure = ''
./autogen.sh
'';
}

22
ntv2-gst/default.nix Normal file
View File

@ -0,0 +1,22 @@
{
stdenv,
ntv2-gst-src,
autoconf,
automake,
pkgconfig,
libtool,
gst_all_1,
ntv2,
}:
stdenv.mkDerivation {
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 ntv2];
GST_NTV2 = "${ntv2}/include";
preConfigure = ''
./autogen.sh
'';
}

View File

@ -2,12 +2,12 @@
stdenv, stdenv,
lib, lib,
cmake, cmake,
aja-src, ntv2-src,
buildApps ? true, buildApps ? true,
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "ajantv2-dev"; name = "ntv2";
src = aja-src; src = ntv2-src;
nativeBuildInputs = [cmake]; nativeBuildInputs = [cmake];
cmakeFlags = cmakeFlags =

View File

@ -2,11 +2,11 @@
stdenv, stdenv,
nukeReferences, nukeReferences,
kernel, kernel,
aja-src, ntv2-src,
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "ajantv2-driver-${kernel.version}"; name = "ntv2-driver-${kernel.version}";
src = aja-src; src = ntv2-src;
patches = [./lol.patch ./newkernels.patch]; patches = [./lol.patch ./newkernels.patch];
nativeBuildInputs = kernel.moduleBuildDependencies; nativeBuildInputs = kernel.moduleBuildDependencies;
buildInputs = [nukeReferences]; buildInputs = [nukeReferences];

View File

@ -14,13 +14,13 @@ gstreamer plugin. This allows you to use Aja video IO cards on NixOS.
- Add the kernel driver: - Add the kernel driver:
```nix ```nix
# Include the kernel module # Include the kernel module
boot.extraModulePackages = [pkgs.ajantv-driver]; boot.extraModulePackages = [pkgs.linuxPackages.ntv2-driver];
# And load it automatically # And load it automatically
boot.kernelModules = [ "ajantv2" ]; boot.kernelModules = [ "ajantv2" ];
``` ```
- Include the utils/demos and gstreamer plugin: - Include the utils/demos and gstreamer plugin:
```nix ```nix
environment.systemPackages = [pkgs.ajantv-utils pkgs.aja-ntv2-gst] environment.systemPackages = [pkgs.ntv2 pkgs.ntv2-gst]
``` ```
## Gstreamer ## Gstreamer