Compare commits

..

No commits in common. "main" and "samwtest" have entirely different histories.

12 changed files with 88 additions and 143 deletions

View File

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

View File

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

View File

@ -1,5 +1,21 @@
{
"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": {
"inputs": {
"systems": "systems"
@ -30,44 +46,11 @@
"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": {
"inputs": {
"aja-ntv2": "aja-ntv2",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"ntv2-gst-src": "ntv2-gst-src",
"ntv2-src": "ntv2-src"
"nixpkgs": "nixpkgs"
}
},
"systems": {

View File

@ -1,16 +1,7 @@
{
description = "AJA video card software";
inputs.ntv2-src = {
type = "github";
owner = "aja-video";
repo = "ntv2";
flake = false;
};
inputs.ntv2-gst-src = {
type = "github";
owner = "aja-video";
repo = "ntv2-gst";
inputs.aja-ntv2 = {
url = "github:aja-video/ntv2";
flake = false;
};
@ -18,47 +9,34 @@
self,
nixpkgs,
flake-utils,
ntv2-src,
ntv2-gst-src,
aja-ntv2,
}:
{
overlays.default = final: prev: {
ntv2 = final.callPackage ./ntv2 { inherit ntv2-src; };
ntv2-gst = final.callPackage ./ntv2-gst { inherit ntv2-gst-src; };
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.";
(
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;
};
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 ];
in {
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;
};
};
} // 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,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,22 +7,20 @@ gstreamer plugin. This allows you to use Aja video IO cards on NixOS.
## Usage
- Add the flake to your system flake's inputs.
- Include the nixos module in your config:
- Apply the overlay to your system's nixpkgs, e.g.
```nix
...
nixosConfigurations = {
mymachine = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
# ... your other modules ...
ajantv2.nixosModules.default
];
};
...
nixpkgs.overlays = [ ajantv2.overlays.default ];
```
- Enable the module by adding the following to your system config:
- Add the kernel driver:
```nix
ntv2.enable = true;
# 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