Compare commits

..

No commits in common. "a1b3ff71b33fe2e0ae81c4e03f1f716dbc44c3b0" and "3a3bd5629590f22f1f835e32ad9b0133a9a4435e" have entirely different histories.

15 changed files with 68 additions and 58 deletions

4
AppDir/AppRun Executable file
View File

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

View File

@ -91,32 +91,19 @@ in rec {
''; '';
}; };
appDir = pkgs.stdenv.mkDerivation { appDir = pkgs.buildEnv {
name = "cryptic-net-AppDir"; name = "cryptic-net-AppDir";
paths = [
src = pkgs.buildEnv { ./AppDir
name = "cryptic-net-AppDir-base"; version
paths = [ dnsmasq
nebula
garage
pkgs.minio-client
entrypoint
./AppDir ] ++ (if bootstrap != null then [ rootedBootstrap ] else []);
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 {}; appimagetool = pkgs.callPackage ./nix/appimagetool.nix {};

View File

@ -45,7 +45,7 @@ func dnsmasqPmuxProcConfig(
return pmuxlib.ProcessConfig{ return pmuxlib.ProcessConfig{
Name: "dnsmasq", Name: "dnsmasq",
Cmd: binPath("dnsmasq"), Cmd: "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{binPath("mc")}, args...) args = append([]string{"mc"}, args...)
var ( var (
mcHostVar = fmt.Sprintf( mcHostVar = fmt.Sprintf(
@ -92,7 +92,7 @@ var subCmdGarageCLI = subCmd{
} }
var ( var (
binPath = binPath("garage") binPath = filepath.Join(envAppDirPath, "bin/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: binPath("garage"), Cmd: "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,10 +31,6 @@ 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: binPath("nebula"), Cmd: "nebula",
Args: []string{"-config", nebulaYmlPath}, Args: []string{"-config", nebulaYmlPath},
}, nil }, nil
} }

View File

@ -1,6 +1,25 @@
{ {
"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,8 +1,10 @@
{ {
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, self, utils,
}: let }: let
supportedSystems = (import ./nix/pkgs.nix).supportedSystems; supportedSystems = (import ./nix/pkgs.nix).supportedSystems;

View File

@ -2,28 +2,39 @@
let let
version = "765"; version = "745";
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";
"aarch64" = "${srcDir}/go-appimage/appimagetool-${version}-aarch64.AppImage"; "x86_64" = fetchurl {
"armv7l" = "${srcDir}/go-appimage/appimagetool-${version}-armhf.AppImage"; url = "https://github.com/probonopd/go-appimage/releases/download/continuous/appimagetool-${version}-x86_64.AppImage";
"i686" = "${srcDir}/go-appimage/appimagetool-${version}-i686.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=";
};
}."${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 = ''

View File

@ -45,18 +45,9 @@ rec {
default = { default = {
buildSystem, buildSystem,
hostSystem ? buildSystem, hostSystem ? buildSystem,
}: import src ({ }: import src {
inherit overlays;
system = buildSystem; 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; crossSystem.config = hostSystem;
inherit overlays;
})); };
} }