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,8 +91,11 @@ in rec {
''; '';
}; };
appDir = pkgs.buildEnv { appDir = pkgs.stdenv.mkDerivation {
name = "cryptic-net-AppDir"; name = "cryptic-net-AppDir";
src = pkgs.buildEnv {
name = "cryptic-net-AppDir-base";
paths = [ paths = [
./AppDir ./AppDir
@ -106,6 +109,16 @@ in rec {
] ++ (if bootstrap != null then [ rootedBootstrap ] else []); ] ++ (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 {}; appimagetool = pkgs.callPackage ./nix/appimagetool.nix {};
appImage = pkgs.stdenv.mkDerivation { appImage = pkgs.stdenv.mkDerivation {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,25 +1,6 @@
{ {
"nodes": { "nodes": {
"root": { "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": "root",
"version": 7 "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"; description = "cryptic-net provides the foundation for an autonomous community cloud infrastructure";
outputs = { outputs = {
self, utils, self,
}: let }: let
supportedSystems = (import ./nix/pkgs.nix).supportedSystems; supportedSystems = (import ./nix/pkgs.nix).supportedSystems;

View File

@ -2,39 +2,28 @@
let let
version = "745"; version = "765";
cpuArch = stdenv.buildPlatform.parsed.cpu.name; 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 = { src = {
"x86_64" = "${srcDir}/appimagetool-${version}-x86_64.AppImage";
"x86_64" = fetchurl { "aarch64" = "${srcDir}/go-appimage/appimagetool-${version}-aarch64.AppImage";
url = "https://github.com/probonopd/go-appimage/releases/download/continuous/appimagetool-${version}-x86_64.AppImage"; "armv7l" = "${srcDir}/go-appimage/appimagetool-${version}-armhf.AppImage";
sha256 = "sha256-HQ7d9LQDaPm6sGZ5boWZdmGTNqiGN9NWHUWPiDhl2Xc="; "i686" = "${srcDir}/go-appimage/appimagetool-${version}-i686.AppImage";
};
"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=";
};
}."${cpuArch}"; }."${cpuArch}";
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
pname = "go-appimage"; pname = "go-appimage";
inherit version src; inherit version src;
sourceRoot = "squashfs-root"; sourceRoot = "squashfs-root";
unpackPhase = '' 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 = { default = {
buildSystem, buildSystem,
hostSystem ? buildSystem, hostSystem ? buildSystem,
}: import src { }: import src ({
system = buildSystem;
crossSystem.config = hostSystem;
inherit overlays; 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;
}));
} }