Compare commits

..

No commits in common. "823017463120c67bb2dabff9da69f76ff452f03e" and "9e1beef1c8b00e60f34f53de153273a91dd1128f" have entirely different histories.

12 changed files with 90 additions and 132 deletions

View File

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

View File

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

View File

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

View File

@ -1,19 +0,0 @@
Copyright (c) 2023 Sam Willcocks <sam@wlcx.cc>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

27
ntv2-gst.nix Normal file
View File

@ -0,0 +1,27 @@
{
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
'';
}

View File

@ -1,22 +0,0 @@
{
stdenv,
ntv2-gst-src,
autoconf,
automake,
pkg-config,
libtool,
gst_all_1,
ntv2,
}:
stdenv.mkDerivation {
name = "ntv2-gst";
src = ntv2-gst-src;
sourceRoot = "source/gst-plugin";
patches = [./no.patch];
nativeBuildInputs = [autoconf automake pkg-config libtool gst_all_1.gst-plugins-base ntv2];
GST_NTV2 = "${ntv2}/include";
preConfigure = ''
./autogen.sh
'';
}

View File

@ -7,9 +7,20 @@ gstreamer plugin. This allows you to use Aja video IO cards on NixOS.
## Usage ## Usage
- Add the flake to your system flake's inputs. - Add the flake to your system flake's inputs.
- Enable the module by adding the following to your system config: - Apply the overlay to your system's nixpkgs, e.g.
```nix ```nix
ntv2.enable = true; nixpkgs.overlays = [ ajantv2.overlays.default ];
```
- Add the kernel driver:
```nix
# Include the kernel module
boot.extraModulePackages = [pkgs.ajantv-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]
``` ```
## Gstreamer ## Gstreamer