added aarch64 (raspberry pi) support

This commit is contained in:
Benton Edmondson 2022-09-03 19:24:18 -05:00
parent 26fe53dfd8
commit f60e2a4537
2 changed files with 190 additions and 168 deletions

View file

@ -16,6 +16,21 @@
"url": "https://gist.github.com/f0fd86b6c73063283afe550bc5d77594.git"
}
},
"flake-utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gourou-src": {
"flake": false,
"locked": {
@ -68,6 +83,7 @@
"root": {
"inputs": {
"base64-src": "base64-src",
"flake-utils": "flake-utils",
"gourou-src": "gourou-src",
"nixpkgs": "nixpkgs",
"pugixml-src": "pugixml-src",

View file

@ -1,6 +1,7 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
gourou-src = {
url = "git://soutade.fr/libgourou.git";
flake = false;
@ -20,22 +21,24 @@
};
outputs = flakes:
flakes.flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ]
(system:
let
version = "1.3.0";
self = flakes.self.packages.x86_64-linux;
nixpkgs = flakes.nixpkgs.legacyPackages.x86_64-linux.pkgsStatic;
nixpkgs-dyn = flakes.nixpkgs.legacyPackages.x86_64-linux;
nixpkgs-fmt = flakes.nixpkgs-fmt.defaultPackage.x86_64-linux;
version = "1.3.1";
self = flakes.self.packages.${system};
nixpkgs = flakes.nixpkgs.legacyPackages.${system}.pkgsStatic;
nixpkgs-dyn = flakes.nixpkgs.legacyPackages.${system};
nixpkgs-fmt = flakes.nixpkgs-fmt.defaultPackage.${system};
gourou-src = flakes.gourou-src;
updfparser-src = flakes.updfparser-src;
base64-src = flakes.base64-src;
pugixml-src = flakes.pugixml-src;
cxx = "${nixpkgs.stdenv.cc}/bin/x86_64-unknown-linux-musl-g++";
ar = "${nixpkgs.stdenv.cc.bintools.bintools_bin}/bin/x86_64-unknown-linux-musl-ar";
cxx = "${nixpkgs.stdenv.cc}/bin/${nixpkgs.stdenv.cc.targetPrefix}c++";
ar = "${nixpkgs.stdenv.cc.bintools.bintools_bin}/bin/${nixpkgs.stdenv.cc.targetPrefix}ar";
obj-flags = "-O2 -static";
in
rec {
packages.x86_64-linux.libzip-static = nixpkgs.libzip.overrideAttrs (prev: {
packages.libzip-static = nixpkgs.libzip.overrideAttrs (prev: {
cmakeFlags = (prev.cmakeFlags or [ ]) ++ [
"-DBUILD_SHARED_LIBS=OFF"
"-DBUILD_EXAMPLES=OFF"
@ -45,9 +48,9 @@
];
outputs = [ "out" ];
});
packages.x86_64-linux.base64 = derivation {
packages.base64 = derivation {
name = "updfparser";
system = "x86_64-linux";
inherit system;
builder = "${nixpkgs.bash}/bin/bash";
PATH = "${nixpkgs.coreutils}/bin";
args = [
@ -58,9 +61,9 @@
''
];
};
packages.x86_64-linux.updfparser = derivation {
packages.updfparser = derivation {
name = "updfparser";
system = "x86_64-linux";
inherit system;
builder = "${nixpkgs.bash}/bin/bash";
PATH = "${nixpkgs.coreutils}/bin";
args = [
@ -75,17 +78,18 @@
''
];
};
packages.x86_64-linux.gourou = derivation {
packages.gourou = derivation {
name = "gourou";
system = "x86_64-linux";
inherit system;
builder = "${nixpkgs.bash}/bin/bash";
PATH = "${nixpkgs.coreutils}/bin";
args = [
"-c"
''
shopt -s extglob
${cxx} \
-c \
${gourou-src}/src/*.cpp \
${gourou-src}/src/!(pugixml).cpp \
${pugixml-src}/src/pugixml.cpp \
-I ${self.base64}/include \
-I ${gourou-src}/include \
@ -98,9 +102,9 @@
''
];
};
packages.x86_64-linux.utils-common = derivation {
packages.utils-common = derivation {
name = "utils-common";
system = "x86_64-linux";
inherit system;
builder = "${nixpkgs.bash}/bin/bash";
PATH = "${nixpkgs.coreutils}/bin";
args = [
@ -122,9 +126,9 @@
''
];
};
packages.x86_64-linux.knock = derivation {
packages.knock = derivation {
name = "knock";
system = "x86_64-linux";
inherit system;
builder = "${nixpkgs.bash}/bin/bash";
PATH = "${nixpkgs.coreutils}/bin";
args = [
@ -135,6 +139,7 @@
-o $out/bin/knock \
${./src/knock.cpp} \
-D KNOCK_VERSION='"${version}"' \
--std=c++17 \
-Wl,--as-needed -static \
${self.utils-common}/lib/libutils-common.a \
${self.gourou}/lib/libgourou.a \
@ -162,8 +167,8 @@
''
];
};
packages.x86_64-linux.default = self.knock;
packages.x86_64-linux.tests = nixpkgs-dyn.stdenv.mkDerivation {
packages.default = self.knock;
packages.tests = nixpkgs-dyn.stdenv.mkDerivation {
name = "tests";
src = ./tests;
buildInputs = [
@ -181,11 +186,12 @@
chmod +x $out/bin/tests
'';
};
packages.x86_64-linux.formatter = nixpkgs.writeShellScriptBin "formatter" ''
packages.formatter = nixpkgs.writeShellScriptBin "formatter" ''
set -x
${nixpkgs-dyn.clang-tools}/bin/clang-format -i --verbose ./src/*.cpp
${nixpkgs-dyn.nixpkgs-fmt}/bin/nixpkgs-fmt .
${nixpkgs-dyn.black}/bin/black ./tests
'';
};
}
);
}