flake: Make building variants easier

This commit is contained in:
Simon Bruder 2023-05-20 11:20:03 +02:00
parent c263958d3b
commit 7dacccdbd0

View file

@ -6,6 +6,7 @@
outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system:
let
inherit (nixpkgs) lib;
pkgs = import nixpkgs { inherit system; };
mkNocheck = drv: drv.overrideAttrs (o: {
doCheck = false;
@ -13,48 +14,51 @@
});
in
{
packages = rec {
u01 = pkgs.callPackage
({ stdenv, catch2_3, cmake }: stdenv.mkDerivation {
name = "ecg-u01";
src = ./u01;
nativeBuildInputs = [ cmake ];
checkInputs = [ catch2_3 ];
doCheck = true;
packages = lib.foldAttrs lib.const { }
(lib.flatten (lib.mapAttrsToList
(name: v: {
"${name}" = v;
"${name}-nocheck" = mkNocheck v;
})
{ };
rec {
u01 = pkgs.callPackage
({ stdenv, catch2_3, cmake }: stdenv.mkDerivation {
name = "ecg-u01";
u02 = pkgs.callPackage
({ stdenv, catch2_3, cmake, freeglut, libGL, libGLU }: stdenv.mkDerivation {
name = "ecg-u02";
src = ./u01;
src = ./u02;
nativeBuildInputs = [ cmake ];
checkInputs = [ catch2_3 ];
nativeBuildInputs = [ cmake ];
buildInputs = [ freeglut libGL libGLU ];
checkInputs = [ catch2_3 ];
doCheck = true;
})
{ };
doCheck = true;
})
{ };
u02 = pkgs.callPackage
({ stdenv, catch2_3, cmake, freeglut, libGL, libGLU }: stdenv.mkDerivation {
name = "ecg-u02";
u03 = pkgs.callPackage
({ stdenv, cmake, freeglut, libGL, libGLU }: stdenv.mkDerivation {
name = "ecg-u03";
src = ./u02;
src = ./u03;
nativeBuildInputs = [ cmake ];
buildInputs = [ freeglut libGL libGLU ];
checkInputs = [ catch2_3 ];
nativeBuildInputs = [ cmake ];
buildInputs = [ freeglut libGL libGLU ];
})
{ };
doCheck = true;
})
{ };
u01-nocheck = mkNocheck u01;
u02-nocheck = mkNocheck u02;
};
u03 = pkgs.callPackage
({ stdenv, cmake, freeglut, libGL, libGLU }: stdenv.mkDerivation {
name = "ecg-u03";
src = ./u03;
nativeBuildInputs = [ cmake ];
buildInputs = [ freeglut libGL libGLU ];
})
{ };
}));
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [ catch2_3 cmake freeglut libGL libGLU reuse ];