Got armv6l compiling, but it's not yet tested

This commit is contained in:
Brian Picciano 2024-12-19 17:49:10 +01:00
parent 2bb7537602
commit 414219f066
16 changed files with 71 additions and 86 deletions

View File

@ -20,19 +20,19 @@
in rec { in rec {
version = let revisionFile = if builtins.isNull revision
revisionFile = if builtins.isNull revision then pkgsNative.stdenv.mkDerivation {
then pkgsNative.stdenv.mkDerivation { name = "revision.txt";
name = "revision.txt"; nativeBuildInputs = [ pkgsNative.git ];
nativeBuildInputs = [ pkgsNative.git ]; src = ./.git;
src = ./.git; phases = [ "installPhase" ];
phases = [ "installPhase" ]; installPhase = ''
installPhase = '' git -c safe.directory='*' -C $src describe --tags > $out
git -c safe.directory='*' -C $src describe --tags > $out '';
''; }
} else pkgsNative.writeText "revision.txt" revision;
else pkgsNative.writeText "revision.txt" revision;
in pkgs.stdenv.mkDerivation { version = pkgs.stdenv.mkDerivation {
name = "isle-version"; name = "isle-version";
inherit buildSystem hostSystem revisionFile releaseName; inherit buildSystem hostSystem revisionFile releaseName;
@ -88,11 +88,8 @@ in rec {
nebula = pkgs.callPackage ./nix/nebula.nix {}; nebula = pkgs.callPackage ./nix/nebula.nix {};
garage = let garage = garageNix.package {
hostPlatform = pkgs.stdenv.hostPlatform.parsed; inherit pkgsNix buildSystem hostSystem;
in garageNix.package {
inherit pkgsNix buildSystem;
hostSystem = "${hostPlatform.cpu.name}-unknown-${hostPlatform.kernel.name}-musl";
}; };
appDirBase = pkgs.buildEnv { appDirBase = pkgs.buildEnv {
@ -143,30 +140,26 @@ in rec {
]; ];
}; };
appimagekit = pkgsNative.callPackage ./nix/appimagetool {
inherit hostSystem;
};
build = rec { build = rec {
appImage = pkgs.stdenv.mkDerivation { appImage = pkgs.stdenv.mkDerivation {
name = "isle-AppImage"; name = "isle-AppImage";
src = appDir; src = appDir;
inherit revisionFile;
nativeBuildInputs = [ nativeBuildInputs = [ appimagekit ];
(pkgsNative.callPackage ./nix/appimagetool.nix {})
];
ARCH = pkgs.stdenv.hostPlatform.parsed.cpu.name;
builder = builtins.toFile "build.sh" '' builder = builtins.toFile "build.sh" ''
source $stdenv/setup source $stdenv/setup
cp -rL "$src" isle.AppDir cp -rL "$src" isle.AppDir
chmod +w isle.AppDir -R chmod +w isle.AppDir -R
export VERSION=debug export VERSION=$(cat $revisionFile)
# https://github.com/probonopd/go-appimage/issues/155
unset SOURCE_DATE_EPOCH
appimagetool ./isle.AppDir
mkdir -p "$out"/bin mkdir -p "$out"/bin
mv Isle-* "$out"/bin/isle appimagetool ./isle.AppDir "$out"/bin/isle
''; '';
}; };

View File

@ -9,6 +9,7 @@ supported:
- `x86_64` (aka `amd64`) - `x86_64` (aka `amd64`)
- `aarch64` (aka `arm64`) - `aarch64` (aka `arm64`)
- `i686` - `i686`
- `armv6l` (For older Raspberry Pis)
(`i686` has not been tested.) (`i686` has not been tested.)

View File

@ -1,40 +0,0 @@
{ stdenv, fetchurl }:
let
version = "765";
cpuArch = stdenv.buildPlatform.parsed.cpu.name;
srcDir = ./go-appimage;
# https://github.com/probonopd/go-appimage
# The author of go-appimage has set up some crazy continuous integration build
# system with github, which is really cool, except that it doesn't preserve
# any older builds of the project. And it's pretty difficult to build it
# ourselves. So fuck it, just embed the build artifacts directly in this
# project.
src = {
"x86_64" = "${srcDir}/appimagetool-${version}-x86_64.AppImage";
"aarch64" = "${srcDir}/go-appimage/appimagetool-${version}-aarch64.AppImage";
"armv7l" = "${srcDir}/go-appimage/appimagetool-${version}-armhf.AppImage";
"i686" = "${srcDir}/go-appimage/appimagetool-${version}-i686.AppImage";
}."${cpuArch}";
in stdenv.mkDerivation rec {
pname = "go-appimage";
inherit version src;
sourceRoot = "squashfs-root";
unpackPhase = ''
cp $src appimagetool
chmod u+wx appimagetool
./appimagetool --appimage-extract
'';
installPhase = ''
mkdir -p $out
cp -r usr/* $out
'';
}

View File

@ -0,0 +1,22 @@
{ appimagekit, hostSystem, writeScriptBin }: let
arch = builtins.getAttr hostSystem {
"x86_64-linux" = "x86_64";
"aarch64-linux" = "aarch64";
"armv6l-linux" = "armhf";
"i686-linux" = "i686";
};
# https://github.com/AppImage/type2-runtime
# The author has set up some crazy continuous integration build system with
# github, which is really cool, except that it doesn't preserve any older
# builds of the project. And it's pretty difficult to build it ourselves. So
# fuck it, just embed the build artifacts directly in this project.
runtimeFileVersion = "81de3e1";
runtimeFile = "${./.}/runtime-${arch}-${runtimeFileVersion}";
in writeScriptBin "appimagetool" ''
export PATH=$PATH:${appimagekit}/bin
export ARCH=${arch}
exec ${appimagekit}/bin/appimagetool --runtime-file ${runtimeFile} "$@"
''

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -8,6 +8,13 @@ rec {
hostSystem, hostSystem,
}: let }: let
hostSystemTarget = builtins.getAttr hostSystem {
"x86_64-linux" = "x86_64-unknown-linux-musl";
"aarch64-linux" = "aarch64-unknown-linux-musl";
"i686-linux" = "i686-unknown-linux-musl";
"armv6l-linux" = "armv6l-unknown-linux-musleabihf";
};
pkgs = pkgsNix.default { pkgs = pkgsNix.default {
inherit buildSystem hostSystem; inherit buildSystem hostSystem;
}; };
@ -31,7 +38,7 @@ rec {
compile = (import "${src}/nix/compile.nix") { compile = (import "${src}/nix/compile.nix") {
system = buildSystem; system = buildSystem;
target = hostSystem; target = hostSystemTarget;
pkgsSrc = pkgsNix.src; pkgsSrc = pkgsNix.src;
cargo2nixOverlay = common.cargo2nixOverlay; cargo2nixOverlay = common.cargo2nixOverlay;

View File

@ -20,7 +20,7 @@
vendorHash = "sha256-GvMiOEC3Y/pGG++Z+XCgLVADKymUR9shDxjx3xIz8u0="; vendorHash = "sha256-GvMiOEC3Y/pGG++Z+XCgLVADKymUR9shDxjx3xIz8u0=";
subPackages = [ "cmd/nebula" "cmd/nebula-cert" ]; subPackages = [ "cmd/nebula" ];
ldflags = [ "-X main.Build=${version}" ]; ldflags = [ "-X main.Build=${version}" ];
} }

View File

@ -9,6 +9,11 @@ rec {
CGO_ENABLED=0; CGO_ENABLED=0;
tags = [ "netgo" "timetzdata" ]; tags = [ "netgo" "timetzdata" ];
ldflags = [ "-w" "-extldflags=-static" ]; ldflags = [ "-w" "-extldflags=-static" ];
# Not sure why buildGoModule doesn't handle this correctly.
GOARM = if prev.stdenv.hostPlatform.parsed.cpu.name == "armv6l"
then "6,hardfloat"
else null;
}; };
in { in {
buildGoModule = args: prev.buildGoModule (buildArgs // args); buildGoModule = args: prev.buildGoModule (buildArgs // args);
@ -35,11 +40,16 @@ rec {
sha256 = "sha256:1lr1h35prqkd1mkmzriwlpvxcb34kmhc9dnr48gkm8hh089hifmx"; sha256 = "sha256:1lr1h35prqkd1mkmzriwlpvxcb34kmhc9dnr48gkm8hh089hifmx";
}; };
supportedSystems = [ lib = import "${src}/lib";
"x86_64-linux"
"aarch64-linux" crossSystems = {
"i686-linux" "x86_64-linux" = {config = "x86_64-linux";};
]; "aarch64-linux" = lib.systems.examples.aarch64-multiplatform;
"i686-linux" = {config = "i686-linux";};
"armv6l-linux" = lib.systems.examples.raspberryPi;
};
supportedSystems = builtins.attrNames crossSystems;
default = { default = {
buildSystem, buildSystem,
@ -55,7 +65,6 @@ rec {
# enabled, even if the target platform is actually the same as the build # enabled, even if the target platform is actually the same as the build
# platform (and therefore it's not really cross-compiling). So we only set # platform (and therefore it's not really cross-compiling). So we only set
# up the cross-compiling config if the target platform is different. # up the cross-compiling config if the target platform is different.
crossSystem.config = hostSystem; crossSystem = builtins.getAttr hostSystem crossSystems;
})); }));
} }

View File

@ -1,7 +0,0 @@
---
type: task
---
# Raspberry Pi Build
Get Isle build system to include rpi (armv7l-linux-musl)