Don't use AppImage in arch package install
This commit is contained in:
parent
414219f066
commit
86db5fb5ba
69
default.nix
69
default.nix
@ -54,33 +54,30 @@ in rec {
|
|||||||
echo "NixPkgs Version: $nixpkgsVersion" >> "$versionFile"
|
echo "NixPkgs Version: $nixpkgsVersion" >> "$versionFile"
|
||||||
echo "Build Platform: $buildSystem" >> "$versionFile"
|
echo "Build Platform: $buildSystem" >> "$versionFile"
|
||||||
|
|
||||||
mkdir -p "$out"/share
|
mkdir -p "$out"
|
||||||
cp "$versionFile" "$out"/share
|
cp "$versionFile" "$out"/version
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
goBinaries = pkgs.buildGoModule {
|
entrypoint = {
|
||||||
pname = "isle-go-binaries";
|
systemRoot ? null,
|
||||||
version = "unstable";
|
}: (pkgs.buildGoModule {
|
||||||
|
pname = "isle-entrypoint";
|
||||||
|
version = builtins.readFile revisionFile;
|
||||||
|
|
||||||
# If this seems pointless, that's because it is! buildGoModule doesn't like
|
# If this seems pointless, that's because it is! buildGoModule doesn't like
|
||||||
# it if the src derivation's name ends in "-go". So this mkDerivation here
|
# it if the src derivation's name ends in "-go". So this mkDerivation here
|
||||||
# only serves to give buildGoModule a src derivation with a name it likes.
|
# only serves to give buildGoModule a src derivation with a name it likes.
|
||||||
src = pkgs.stdenv.mkDerivation {
|
src = pkgs.runCommand "isle-go-src" {} ''cp -r "${./go}" "$out"'';
|
||||||
name = "isle-go-src";
|
|
||||||
src = ./go;
|
|
||||||
builder = builtins.toFile "builder.sh" ''
|
|
||||||
source $stdenv/setup
|
|
||||||
cp -r "$src" "$out"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
vendorHash = "sha256-uq+UgoVKqMUE4hEVlMFQnZuyFOilUyZDmiy7ASrq338=";
|
vendorHash = "sha256-uq+UgoVKqMUE4hEVlMFQnZuyFOilUyZDmiy7ASrq338=";
|
||||||
|
subPackages = [ "./cmd/entrypoint" ];
|
||||||
subPackages = [
|
}).overrideAttrs (prev: {
|
||||||
"./cmd/entrypoint"
|
ldflags = prev.ldflags ++
|
||||||
];
|
(if builtins.isNull systemRoot
|
||||||
};
|
then []
|
||||||
|
else [ "-X main.systemRoot=${systemRoot}" ]);
|
||||||
|
});
|
||||||
|
|
||||||
dnsmasq = (pkgs.callPackage ./nix/dnsmasq.nix {
|
dnsmasq = (pkgs.callPackage ./nix/dnsmasq.nix {
|
||||||
stdenv = pkgs.pkgsStatic.stdenv;
|
stdenv = pkgs.pkgsStatic.stdenv;
|
||||||
@ -92,23 +89,24 @@ in rec {
|
|||||||
inherit pkgsNix buildSystem hostSystem;
|
inherit pkgsNix buildSystem hostSystem;
|
||||||
};
|
};
|
||||||
|
|
||||||
appDirBase = pkgs.buildEnv {
|
appDirBase = pkgs.runCommand "isle-AppDir-base" {} ''
|
||||||
name = "isle-AppDir-base";
|
mkdir -p "$out"/usr/libexec/isle
|
||||||
paths = [
|
cp ${dnsmasq}/bin/* "$out"/usr/libexec/isle
|
||||||
./AppDir
|
cp ${nebula}/bin/* "$out"/usr/libexec/isle
|
||||||
version
|
cp ${garage}/bin/* "$out"/usr/libexec/isle
|
||||||
dnsmasq
|
cp ${pkgs.minio-client}/bin/* "$out"/usr/libexec/isle
|
||||||
nebula
|
|
||||||
garage
|
|
||||||
pkgs.minio-client
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
appDir = pkgs.stdenv.mkDerivation {
|
cp ${./AppDir}/* "$out"/
|
||||||
|
|
||||||
|
mkdir -p "$out"/usr/share/isle
|
||||||
|
cp ${version}/* "$out"/usr/share/isle
|
||||||
|
'';
|
||||||
|
|
||||||
|
appDir = { systemRoot ? null, }: pkgs.stdenv.mkDerivation {
|
||||||
name = "isle-AppDir";
|
name = "isle-AppDir";
|
||||||
|
|
||||||
src = appDirBase;
|
src = appDirBase;
|
||||||
inherit goBinaries;
|
entrypoint = entrypoint { inherit systemRoot; };
|
||||||
|
|
||||||
builder = builtins.toFile "build.sh" ''
|
builder = builtins.toFile "build.sh" ''
|
||||||
source $stdenv/setup
|
source $stdenv/setup
|
||||||
@ -116,7 +114,9 @@ in rec {
|
|||||||
chmod +w "$out" -R
|
chmod +w "$out" -R
|
||||||
|
|
||||||
cd "$out"
|
cd "$out"
|
||||||
cp $goBinaries/bin/entrypoint ./AppRun
|
mkdir -p ./usr/bin
|
||||||
|
cp $entrypoint/bin/entrypoint ./usr/bin/isle
|
||||||
|
ln -s ./usr/bin/isle ./AppRun
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ in rec {
|
|||||||
build = rec {
|
build = rec {
|
||||||
appImage = pkgs.stdenv.mkDerivation {
|
appImage = pkgs.stdenv.mkDerivation {
|
||||||
name = "isle-AppImage";
|
name = "isle-AppImage";
|
||||||
src = appDir;
|
src = appDir {};
|
||||||
inherit revisionFile;
|
inherit revisionFile;
|
||||||
|
|
||||||
nativeBuildInputs = [ appimagekit ];
|
nativeBuildInputs = [ appimagekit ];
|
||||||
@ -164,8 +164,9 @@ in rec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
archPkg = ((import ./dist/linux/arch) {
|
archPkg = ((import ./dist/linux/arch) {
|
||||||
inherit hostSystem releaseName appImage;
|
inherit hostSystem releaseName;
|
||||||
pkgs = pkgsNative;
|
pkgs = pkgsNative;
|
||||||
|
appDir = appDir { systemRoot = "/"; };
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
24
dist/linux/arch/default.nix
vendored
24
dist/linux/arch/default.nix
vendored
@ -2,7 +2,7 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
hostSystem,
|
hostSystem,
|
||||||
releaseName,
|
releaseName,
|
||||||
appImage,
|
appDir,
|
||||||
}: let
|
}: let
|
||||||
|
|
||||||
cpuArch = (pkgs.lib.systems.parse.mkSystemFromString hostSystem).cpu.name;
|
cpuArch = (pkgs.lib.systems.parse.mkSystemFromString hostSystem).cpu.name;
|
||||||
@ -16,24 +16,12 @@
|
|||||||
url="https://code.betamike.com/micropelago/isle"
|
url="https://code.betamike.com/micropelago/isle"
|
||||||
license=('AGPL-3.0-or-later')
|
license=('AGPL-3.0-or-later')
|
||||||
|
|
||||||
depends=(
|
source=('src.tar.zst')
|
||||||
'fuse2'
|
md5sums=('SKIP')
|
||||||
)
|
|
||||||
|
|
||||||
# The appImage is deliberately kept separate from the src.tar.zst. For some
|
|
||||||
# reason including the appImage within the archive results in a large part
|
|
||||||
# of the binary being stripped away and some weird skeleton appImage comes
|
|
||||||
# out the other end.
|
|
||||||
source=('isle' 'src.tar.zst')
|
|
||||||
md5sums=('SKIP' 'SKIP')
|
|
||||||
noextract=('isle')
|
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
cp -r etc "$pkgdir"/etc
|
cp -r etc "$pkgdir"/etc
|
||||||
cp -r usr "$pkgdir"/usr
|
cp -r usr "$pkgdir"/usr
|
||||||
|
|
||||||
mkdir -p "$pkgdir"/usr/bin/
|
|
||||||
cp isle "$pkgdir"/usr/bin/
|
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
@ -49,12 +37,15 @@ in
|
|||||||
];
|
];
|
||||||
|
|
||||||
inherit pkgbuild;
|
inherit pkgbuild;
|
||||||
src = appImage;
|
src = appDir;
|
||||||
defaultDaemonYml = ../../../go/daemon/daecommon/daemon.yml;
|
defaultDaemonYml = ../../../go/daemon/daecommon/daemon.yml;
|
||||||
systemdService = ../isle.service;
|
systemdService = ../isle.service;
|
||||||
dontUnpack = true;
|
dontUnpack = true;
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
|
cp -rL "$src" root
|
||||||
|
chmod -R +w root
|
||||||
|
|
||||||
mkdir -p root/etc/isle/
|
mkdir -p root/etc/isle/
|
||||||
cp "$defaultDaemonYml" root/etc/isle/daemon.yml
|
cp "$defaultDaemonYml" root/etc/isle/daemon.yml
|
||||||
|
|
||||||
@ -69,7 +60,6 @@ in
|
|||||||
cp $pkgbuild PKGBUILD
|
cp $pkgbuild PKGBUILD
|
||||||
|
|
||||||
tar -cf src.tar.zst --zstd --mode=a+rX,u+w -C root .
|
tar -cf src.tar.zst --zstd --mode=a+rX,u+w -C root .
|
||||||
cp "$src"/bin/isle isle
|
|
||||||
|
|
||||||
PKGEXT=".pkg.tar.zst" CARCH="${cpuArch}" makepkg \
|
PKGEXT=".pkg.tar.zst" CARCH="${cpuArch}" makepkg \
|
||||||
--nodeps \
|
--nodeps \
|
||||||
|
@ -43,7 +43,7 @@ var subCmdDaemon = subCmd{
|
|||||||
networkLoader, err := network.NewLoader(
|
networkLoader, err := network.NewLoader(
|
||||||
ctx,
|
ctx,
|
||||||
ctx.logger.WithNamespace("network-loader"),
|
ctx.logger.WithNamespace("network-loader"),
|
||||||
envBinDirPath,
|
getBinDirPath(),
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -15,18 +15,30 @@ import (
|
|||||||
"github.com/adrg/xdg"
|
"github.com/adrg/xdg"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getAppDirPath() string {
|
const systemRootPath = ""
|
||||||
appDirPath := os.Getenv("APPDIR")
|
|
||||||
if appDirPath == "" {
|
func getSystemRootPath() string {
|
||||||
appDirPath = "."
|
if systemRootPath != "" {
|
||||||
|
return systemRootPath
|
||||||
}
|
}
|
||||||
return appDirPath
|
|
||||||
|
if appDirPath := os.Getenv("APPDIR"); appDirPath != "" {
|
||||||
|
return appDirPath
|
||||||
|
}
|
||||||
|
|
||||||
|
return "/"
|
||||||
|
}
|
||||||
|
|
||||||
|
func getBinDirPath() string {
|
||||||
|
return filepath.Join(getSystemRootPath(), "usr/libexec/isle")
|
||||||
|
}
|
||||||
|
|
||||||
|
func getShareDirPath() string {
|
||||||
|
return filepath.Join(getSystemRootPath(), "usr/share/isle")
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
envAppDirPath = getAppDirPath()
|
envCacheDir = sync.OnceValue(func() toolkit.Dir {
|
||||||
envBinDirPath = filepath.Join(envAppDirPath, "bin")
|
|
||||||
envCacheDir = sync.OnceValue(func() toolkit.Dir {
|
|
||||||
cacheHome, err := toolkit.MkDir(xdg.CacheHome, true)
|
cacheHome, err := toolkit.MkDir(xdg.CacheHome, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Errorf("creating cache directory %q: %w", xdg.CacheHome, err))
|
panic(fmt.Errorf("creating cache directory %q: %w", xdg.CacheHome, err))
|
||||||
@ -42,7 +54,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func binPath(name string) string {
|
func binPath(name string) string {
|
||||||
return filepath.Join(envBinDirPath, name)
|
return filepath.Join(getBinDirPath(), name)
|
||||||
}
|
}
|
||||||
|
|
||||||
var rootCmd = subCmd{
|
var rootCmd = subCmd{
|
||||||
|
@ -17,7 +17,7 @@ var subCmdVersion = subCmd{
|
|||||||
return fmt.Errorf("parsing flags: %w", err)
|
return fmt.Errorf("parsing flags: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
versionPath := filepath.Join(envAppDirPath, "share/version")
|
versionPath := filepath.Join(getShareDirPath(), "version")
|
||||||
|
|
||||||
version, err := os.ReadFile(versionPath)
|
version, err := os.ReadFile(versionPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -28,7 +28,7 @@ var (
|
|||||||
if appDirPath == "" {
|
if appDirPath == "" {
|
||||||
panic("APPDIR not set")
|
panic("APPDIR not set")
|
||||||
}
|
}
|
||||||
return filepath.Join(appDirPath, "bin")
|
return filepath.Join(appDirPath, "usr/libexec/isle")
|
||||||
})
|
})
|
||||||
|
|
||||||
ipNetCounter = new(atomic.Uint64)
|
ipNetCounter = new(atomic.Uint64)
|
||||||
|
Loading…
Reference in New Issue
Block a user