Compare commits

..

3 Commits

Author SHA1 Message Date
Brian Picciano
a1b3ff71b3 Use entrypoint directly as AppRun
This removes the intermediate bash script which was running, which
_potentially_ fixes #2.

Since that bash script is no longer setting PATH, the daemon must
manually create the binary path for each sub-process anyway.
2023-04-23 16:30:47 +02:00
Brian Picciano
57f63750f3 Fix appimagetool build 2023-04-12 01:58:52 +02:00
Brian Picciano
1180540ce3 Make sure we can use nix cache for non-cross-compiling 2023-03-25 17:05:29 +01:00
15 changed files with 59 additions and 69 deletions

View File

@ -1,4 +0,0 @@
#!/bin/sh
export PATH=$APPDIR/bin
exec entrypoint "$@"

View File

@ -91,19 +91,32 @@ in rec {
'';
};
appDir = pkgs.buildEnv {
appDir = pkgs.stdenv.mkDerivation {
name = "cryptic-net-AppDir";
paths = [
./AppDir
version
dnsmasq
nebula
garage
pkgs.minio-client
entrypoint
src = pkgs.buildEnv {
name = "cryptic-net-AppDir-base";
paths = [
] ++ (if bootstrap != null then [ rootedBootstrap ] else []);
./AppDir
version
dnsmasq
nebula
garage
pkgs.minio-client
entrypoint
] ++ (if bootstrap != null then [ rootedBootstrap ] else []);
};
builder = builtins.toFile "build.sh" ''
source $stdenv/setup
cp -rL "$src" "$out"
chmod +w "$out" -R
cd "$out"
cp ./bin/entrypoint ./AppRun
'';
};
appimagetool = pkgs.callPackage ./nix/appimagetool.nix {};

View File

@ -45,7 +45,7 @@ func dnsmasqPmuxProcConfig(
return pmuxlib.ProcessConfig{
Name: "dnsmasq",
Cmd: "dnsmasq",
Cmd: binPath("dnsmasq"),
Args: []string{"-d", "-C", confPath},
}, nil
}

View File

@ -50,7 +50,7 @@ var subCmdGarageMC = subCmd{
args = args[i:]
}
args = append([]string{"mc"}, args...)
args = append([]string{binPath("mc")}, args...)
var (
mcHostVar = fmt.Sprintf(
@ -92,7 +92,7 @@ var subCmdGarageCLI = subCmd{
}
var (
binPath = filepath.Join(envAppDirPath, "bin/garage")
binPath = binPath("garage")
args = append([]string{"garage"}, subCmdCtx.args...)
cliEnv = append(
os.Environ(),

View File

@ -168,7 +168,7 @@ func garagePmuxProcConfigs(
pmuxProcConfigs = append(pmuxProcConfigs, pmuxlib.ProcessConfig{
Name: fmt.Sprintf("garage-%d", alloc.RPCPort),
Cmd: "garage",
Cmd: binPath("garage"),
Args: []string{"-c", childConfigPath, "server"},
StartAfterFunc: func(ctx context.Context) error {
return waitForNebula(ctx, hostBootstrap)

View File

@ -31,6 +31,10 @@ var (
envDataDirPath = filepath.Join(xdg.DataHome, "cryptic-net")
)
func binPath(name string) string {
return filepath.Join(envAppDirPath, "bin", name)
}
func main() {
logger := mlog.NewLogger(&mlog.LoggerOpts{

View File

@ -111,7 +111,7 @@ func nebulaPmuxProcConfig(
return pmuxlib.ProcessConfig{
Name: "nebula",
Cmd: "nebula",
Cmd: binPath("nebula"),
Args: []string{"-config", nebulaYmlPath},
}, nil
}

View File

@ -1,25 +1,6 @@
{
"nodes": {
"root": {
"inputs": {
"utils": "utils"
}
},
"utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
"root": {}
},
"root": "root",
"version": 7

View File

@ -1,10 +1,8 @@
{
inputs.utils.url = "github:numtide/flake-utils";
description = "cryptic-net provides the foundation for an autonomous community cloud infrastructure";
outputs = {
self, utils,
self,
}: let
supportedSystems = (import ./nix/pkgs.nix).supportedSystems;

View File

@ -2,39 +2,28 @@
let
version = "745";
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 a tarball into the repo.
src = {
"x86_64" = fetchurl {
url = "https://github.com/probonopd/go-appimage/releases/download/continuous/appimagetool-${version}-x86_64.AppImage";
sha256 = "sha256-HQ7d9LQDaPm6sGZ5boWZdmGTNqiGN9NWHUWPiDhl2Xc=";
};
"aarch64" = fetchurl {
url = "https://github.com/probonopd/go-appimage/releases/download/continuous/appimagetool-${version}-aarch64.AppImage";
sha256 = "sha256-VvH2qXULliCiyFrisaIJbM0ApXp++ZAtxHiS6FM3XT0=";
};
"armv7l" = fetchurl {
url = "https://github.com/probonopd/go-appimage/releases/download/continuous/appimagetool-${version}-armhf.AppImage";
sha256 = "sha256-ytJjN2dLYOSwqCCFZvqnt+wt2wX/lZ1R+nVz5C+Akvo=";
};
"i686" = fetchurl {
url = "https://github.com/probonopd/go-appimage/releases/download/continuous/appimagetool-${version}-i686.AppImage";
sha256 = "sha256-GLEhn3dcrwdU3mG0lB6H7PQ5JwEIGqWlGrO1IifeQv4=";
};
"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 = ''

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -45,9 +45,18 @@ rec {
default = {
buildSystem,
hostSystem ? buildSystem,
}: import src {
system = buildSystem;
crossSystem.config = hostSystem;
}: import src ({
inherit overlays;
};
system = buildSystem;
} // (if buildSystem == hostSystem then {} else {
# The nixpkgs cache doesn't have any packages where cross-compiling has been
# 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
# up the cross-compiling config if the target platform is different.
crossSystem.config = hostSystem;
}));
}