patchelf/flake.nix

93 lines
2.9 KiB
Nix

{
description = "A tool for modifying ELF executables and libraries";
inputs.nixpkgs.url = "nixpkgs/nixos-21.05";
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
nixpkgsFor = forAllSystems (system:
import nixpkgs {
inherit system;
overlays = [ self.overlay ];
}
);
version = builtins.readFile ./version
+ "." + builtins.substring 0 8 self.lastModifiedDate
+ "." + (self.shortRev or "dirty");
pkgs = nixpkgsFor.${"x86_64-linux"};
in
{
overlay = final: prev: {
patchelf-new = final.callPackage ./patchelf.nix {
inherit version;
src = self;
};
};
hydraJobs = {
tarball =
pkgs.releaseTools.sourceTarball rec {
name = "patchelf-tarball";
inherit version;
versionSuffix = ""; # obsolete
src = self;
preAutoconf = "echo ${version} > version";
postDist = ''
cp README.md $out/
echo "doc readme $out/README.md" >> $out/nix-support/hydra-build-products
'';
};
coverage =
pkgs.releaseTools.coverageAnalysis {
name = "patchelf-coverage";
src = self.hydraJobs.tarball;
lcovFilter = ["*/tests/*"];
};
build = forAllSystems (system: nixpkgsFor.${system}.patchelf-new);
build-sanitized = forAllSystems (system: nixpkgsFor.${system}.patchelf-new.overrideAttrs (old: {
configureFlags = [ "--with-asan " "--with-ubsan" ];
# -Wno-unused-command-line-argument is for clang, which does not like
# our cc wrapper arguments
CFLAGS = "-Werror -Wno-unused-command-line-argument";
}));
build-sanitized-clang = forAllSystems (system: self.hydraJobs.build-sanitized.${system}.override {
stdenv = pkgs.libcxxStdenv;
});
release = pkgs.releaseTools.aggregate
{ name = "patchelf-${self.hydraJobs.tarball.version}";
constituents =
[ self.hydraJobs.tarball
self.hydraJobs.build.x86_64-linux
self.hydraJobs.build.i686-linux
self.hydraJobs.build-sanitized.x86_64-linux
self.hydraJobs.build-sanitized.i686-linux
self.hydraJobs.build-sanitized-clang.x86_64-linux
self.hydraJobs.build-sanitized-clang.i686-linux
];
meta.description = "Release-critical builds";
};
};
checks = forAllSystems (system: {
build = self.hydraJobs.build.${system};
});
defaultPackage = forAllSystems (system:
(import nixpkgs {
inherit system;
overlays = [ self.overlay ];
}).patchelf-new
);
};
}