Compare commits

..

12 Commits

Author SHA1 Message Date
Sam W 6d1961cbbd Add including the module to usage 2024-05-15 14:03:01 +01:00
Sam W 8230174631 Add license 2023-10-19 10:46:13 +01:00
Nathan van Doorn 26418cf627
Merge pull request #4 from streams-r-us/nixos-module
Add a NixOS module!
2023-10-19 11:39:42 +02:00
Nathan van Doorn 8161d3e369 Make a nixos module and make the readme suggest you use that 2023-10-18 19:58:58 +02:00
Nathan van Doorn 3f728a7c57 Rename pkgconfig => pkg-config
To match an upstream warning. It'd be nice if we got a warning...
2023-10-18 19:58:02 +02:00
Sam W 1a12a03e95
Merge pull request #3 from streams-r-us/big-changes
Major refactoring
2023-10-18 17:28:37 +01:00
Nathan van Doorn a763f7cd33 Move gst into its own directory 2023-10-17 10:12:04 +02:00
Nathan van Doorn a114003e54 Move a directory 2023-10-17 10:07:28 +02:00
Nathan van Doorn c8e82b3b4b Renaming and refactoring
* Define packages in terms of overlay

* rename everything
2023-10-17 10:04:53 +02:00
Nathan van Doorn d44045b415 Make gst source a flake input 2023-10-17 09:49:56 +02:00
Nathan van Doorn 4490b28541 Rename aja-ntv2 input to ntv2-src 2023-10-17 09:47:19 +02:00
Nathan van Doorn 7f33c8843f Use github flake input type 2023-10-17 09:15:19 +02:00
12 changed files with 143 additions and 88 deletions

View File

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

View File

@ -1,7 +1,16 @@
{
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;
};
@ -9,34 +18,47 @@
self,
nixpkgs,
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;
{
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.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
};
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;
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 {
packages = {
inherit (pkgs) ntv2 ntv2-gst;
inherit (pkgs.linuxPackages) ntv2-driver;
};
formatter = pkgs.alejandra;
});
}

19
license.txt Normal file
View File

@ -0,0 +1,19 @@
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.

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,
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

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

View File

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

View File

@ -7,20 +7,22 @@ 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.
- Include the nixos module in your config:
```nix
nixpkgs.overlays = [ ajantv2.overlays.default ];
...
nixosConfigurations = {
mymachine = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
# ... your other modules ...
ajantv2.nixosModules.default
];
};
...
```
- Add the kernel driver:
- Enable the module by adding the following to your system config:
```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]
ntv2.enable = true;
```
## Gstreamer