Renaming and refactoring

* Define packages in terms of overlay

* rename everything
This commit is contained in:
Nathan van Doorn 2023-10-17 10:04:53 +02:00
parent d44045b415
commit c8e82b3b4b
5 changed files with 26 additions and 36 deletions

View File

@ -6,7 +6,7 @@
buildApps ? true, buildApps ? true,
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "ajantv2-dev"; name = "ntv2";
src = ntv2-src; src = ntv2-src;
nativeBuildInputs = [cmake]; nativeBuildInputs = [cmake];

View File

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

View File

@ -21,33 +21,23 @@
ntv2-src, ntv2-src,
ntv2-gst-src, ntv2-gst-src,
}: }:
( {
flake-utils.lib.eachSystem ["x86_64-linux"] (system: let overlays.default = final: prev: {
pkgs = import nixpkgs { ntv2 = final.callPackage ./aja-ntv2 { inherit ntv2-src; };
inherit system; ntv2-gst = final.callPackage ./ntv2-gst.nix { inherit ntv2-gst-src; };
}; linuxPackages = prev.linuxPackages.extend
in { (linuxFinal: linuxPrev: {
packages.aja-ntv2-gst = pkgs.callPackage ./ntv2-gst.nix { ntv2-driver = linuxFinal.callPackage ./aja-ntv2/driver.nix { inherit ntv2-src; };
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;
};
}; };
} // 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

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

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