https://codeberg.org/interpeer/liberate.git
Revision 77f3407374f6a144656ae2186a85bcfc13636d19 authored by Jens Finkhaeuser on 03 January 2022, 10:46:02 UTC, committed by Jens Finkhaeuser on 03 January 2022, 10:46:02 UTC
1 parent e1b28db
Tip revision: 77f3407374f6a144656ae2186a85bcfc13636d19 authored by Jens Finkhaeuser on 03 January 2022, 10:46:02 UTC
Make socket_address pimpl'd - this is mostly to hide the definition of the address data struct. The previous approach worked when liberate was not a separate library
Make socket_address pimpl'd - this is mostly to hide the definition of the address data struct. The previous approach worked when liberate was not a separate library
Tip revision: 77f3407
flake.nix
{
description = "Interpeer project shared dependency";
# Nixpkgs / NixOS version to use.
inputs.nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-21.05";
outputs = { self, nixpkgs }:
let
# Generate a user-friendly version numer.
version = builtins.substring 0 8 self.lastModifiedDate;
# System types to support.
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
# Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; overlays = [ self.overlay ]; config.allowUnfree = true; });
gtest-meson = builtins.toFile "meson.build" ''
project('gtest')
gtest_dep = dependency('gtest')
'';
liberate =
{ stdenv, fetchurl, unzip, meson, ninja, gtest, lib, logBackend ? "stderr" }:
let
gtestWrap = builtins.readFile ./subprojects/gtest.wrap;
gtestUrl =
builtins.head (builtins.match ".*source_url = ([^\n]*).*" gtestWrap);
gtestHash =
builtins.head (builtins.match ".*source_hash = ([^\n]*).*" gtestWrap);
gtest' = gtest.overrideAttrs (_: {
src = fetchurl {
url = gtestUrl;
sha256 = gtestHash;
};
unpackCmd = "${unzip}/bin/unzip $curSrc";
});
in
stdenv.mkDerivation {
name = "liberate-${version}";
src = ./.;
postPatch = ''
echo > ./examples/meson.build
rm ./subprojects/gtest.wrap
mkdir ./subprojects/gtest
ln -s ${gtest-meson} ./subprojects/gtest/meson.build
'';
doCheck = true;
buildInputs = [ gtest' ];
nativeBuildInputs = [ meson ninja ];
mesonFlags = [ "-Dlog_backend=${logBackend}" ];
meta = with lib; {
description = "Interpeer project shared dependency";
homepage = "https://interpeer.io/";
license = licenses.gpl3Plus;
platforms = platforms.all;
};
};
in
rec {
overlay = final: prev: {
liberate = final.callPackage liberate {};
};
packages = forAllSystems (system:
{
inherit (nixpkgsFor.${system}) liberate;
});
defaultPackage = forAllSystems (system: self.packages.${system}.liberate);
devShell = defaultPackage;
hydraJobs.liberate = self.defaultPackage;
};
}
Computing file changes ...