Compare commits
No commits in common. "main" and "v0.0.3" have entirely different histories.
139
default.nix
139
default.nix
@ -3,13 +3,8 @@
|
|||||||
hostSystem ? buildSystem,
|
hostSystem ? buildSystem,
|
||||||
pkgsNix ? (import ./nix/pkgs.nix),
|
pkgsNix ? (import ./nix/pkgs.nix),
|
||||||
|
|
||||||
# We allow passing in the revision because nix flakes have their own mechanism
|
revision ? "dev",
|
||||||
# for determining the git revision, and they don't have the git repo present
|
|
||||||
# to determine it off of the normal way.
|
|
||||||
revision ? null,
|
|
||||||
|
|
||||||
releaseName ? "dev",
|
releaseName ? "dev",
|
||||||
buildNumber ? "1",
|
|
||||||
}: let
|
}: let
|
||||||
|
|
||||||
pkgs = pkgsNix.default {
|
pkgs = pkgsNix.default {
|
||||||
@ -25,22 +20,12 @@
|
|||||||
|
|
||||||
in rec {
|
in rec {
|
||||||
|
|
||||||
revisionFile = if builtins.isNull revision
|
|
||||||
then pkgsNative.stdenv.mkDerivation {
|
|
||||||
name = "revision.txt";
|
|
||||||
nativeBuildInputs = [ pkgsNative.git ];
|
|
||||||
src = ./.git;
|
|
||||||
phases = [ "installPhase" ];
|
|
||||||
installPhase = ''
|
|
||||||
git -c safe.directory='*' -C $src describe --tags > $out
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
else pkgsNative.writeText "revision.txt" revision;
|
|
||||||
|
|
||||||
version = pkgs.stdenv.mkDerivation {
|
version = pkgs.stdenv.mkDerivation {
|
||||||
name = "isle-version";
|
name = "isle-version";
|
||||||
|
|
||||||
inherit buildSystem hostSystem revisionFile;
|
inherit buildSystem hostSystem revision releaseName;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ pkgsNative.git ];
|
||||||
|
|
||||||
goVersion = pkgs.go.version;
|
goVersion = pkgs.go.version;
|
||||||
garageVersion = garageNix.version;
|
garageVersion = garageNix.version;
|
||||||
@ -51,37 +36,41 @@ in rec {
|
|||||||
|
|
||||||
versionFile=version
|
versionFile=version
|
||||||
|
|
||||||
echo "Version: $(cat $revisionFile)" >> "$versionFile"
|
echo "Release: $releaseName" >> "$versionFile"
|
||||||
echo "Platform: $hostSystem" >> "$versionFile"
|
echo "Platform: $hostSystem" >> "$versionFile"
|
||||||
echo "Go Version: $goVersion" >> "$versionFile"
|
echo "Git Revision: $revision" >> "$versionFile"
|
||||||
echo "Garage Version: $garageVersion" >> "$versionFile"
|
echo "Go Version: $goVersion" >> "$versionFile"
|
||||||
echo "NixPkgs Version: $nixpkgsVersion" >> "$versionFile"
|
echo "Garage Version: $garageVersion" >> "$versionFile"
|
||||||
echo "Build Platform: $buildSystem" >> "$versionFile"
|
echo "NixPkgs Version: $nixpkgsVersion" >> "$versionFile"
|
||||||
|
echo "Build Platform: $buildSystem" >> "$versionFile"
|
||||||
|
|
||||||
mkdir -p "$out"
|
mkdir -p "$out"/share
|
||||||
cp "$versionFile" "$out"/version
|
cp "$versionFile" "$out"/share
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
entrypoint = {
|
goBinaries = pkgs.buildGoModule {
|
||||||
systemRoot ? null,
|
pname = "isle-go-binaries";
|
||||||
}: (pkgs.buildGoModule {
|
version = "unstable";
|
||||||
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.runCommand "isle-go-src" {} ''cp -r "${./go}" "$out"'';
|
src = pkgs.stdenv.mkDerivation {
|
||||||
|
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" ];
|
|
||||||
}).overrideAttrs (prev: {
|
subPackages = [
|
||||||
ldflags = prev.ldflags ++
|
"./cmd/entrypoint"
|
||||||
(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;
|
||||||
@ -89,28 +78,30 @@ in rec {
|
|||||||
|
|
||||||
nebula = pkgs.callPackage ./nix/nebula.nix {};
|
nebula = pkgs.callPackage ./nix/nebula.nix {};
|
||||||
|
|
||||||
garage = garageNix.package {
|
garage = let
|
||||||
inherit pkgsNix buildSystem hostSystem;
|
hostPlatform = pkgs.stdenv.hostPlatform.parsed;
|
||||||
|
in garageNix.package {
|
||||||
|
inherit pkgsNix buildSystem;
|
||||||
|
hostSystem = "${hostPlatform.cpu.name}-unknown-${hostPlatform.kernel.name}-musl";
|
||||||
};
|
};
|
||||||
|
|
||||||
appDirBase = pkgs.runCommand "isle-AppDir-base" {} ''
|
appDirBase = pkgs.buildEnv {
|
||||||
mkdir -p "$out"/usr/libexec/isle
|
name = "isle-AppDir-base";
|
||||||
cp ${dnsmasq}/bin/* "$out"/usr/libexec/isle
|
paths = [
|
||||||
cp ${nebula}/bin/* "$out"/usr/libexec/isle
|
./AppDir
|
||||||
cp ${garage}/bin/* "$out"/usr/libexec/isle
|
version
|
||||||
cp ${pkgs.minio-client}/bin/* "$out"/usr/libexec/isle
|
dnsmasq
|
||||||
|
nebula
|
||||||
|
garage
|
||||||
|
pkgs.minio-client
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
cp ${./AppDir}/* "$out"/
|
appDir = pkgs.stdenv.mkDerivation {
|
||||||
|
|
||||||
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;
|
||||||
entrypoint = entrypoint { inherit systemRoot; };
|
inherit goBinaries;
|
||||||
|
|
||||||
builder = builtins.toFile "build.sh" ''
|
builder = builtins.toFile "build.sh" ''
|
||||||
source $stdenv/setup
|
source $stdenv/setup
|
||||||
@ -118,9 +109,7 @@ in rec {
|
|||||||
chmod +w "$out" -R
|
chmod +w "$out" -R
|
||||||
|
|
||||||
cd "$out"
|
cd "$out"
|
||||||
mkdir -p ./usr/bin
|
cp $goBinaries/bin/entrypoint ./AppRun
|
||||||
cp $entrypoint/bin/entrypoint ./usr/bin/isle
|
|
||||||
ln -s ./usr/bin/isle ./AppRun
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -144,40 +133,36 @@ 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 = [ appimagekit ];
|
nativeBuildInputs = [
|
||||||
|
(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=$(cat $revisionFile)
|
export VERSION=debug
|
||||||
|
|
||||||
|
# https://github.com/probonopd/go-appimage/issues/155
|
||||||
|
unset SOURCE_DATE_EPOCH
|
||||||
|
|
||||||
|
appimagetool ./isle.AppDir
|
||||||
mkdir -p "$out"/bin
|
mkdir -p "$out"/bin
|
||||||
appimagetool ./isle.AppDir "$out"/bin/isle
|
mv Isle-* "$out"/bin/isle
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
archPkg = ((import ./dist/linux/arch) {
|
archPkg = ((import ./dist/linux/arch) {
|
||||||
inherit hostSystem releaseName buildNumber;
|
inherit hostSystem releaseName appImage;
|
||||||
pkgs = pkgsNative;
|
pkgs = pkgsNative;
|
||||||
appDir = appDir { systemRoot = "/"; };
|
|
||||||
});
|
|
||||||
|
|
||||||
debPkg = ((import ./dist/linux/deb) {
|
|
||||||
inherit hostSystem releaseName buildNumber;
|
|
||||||
pkgs = pkgsNative;
|
|
||||||
appDir = appDir { systemRoot = "/"; };
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
46
dist/linux/arch/default.nix
vendored
46
dist/linux/arch/default.nix
vendored
@ -2,8 +2,7 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
hostSystem,
|
hostSystem,
|
||||||
releaseName,
|
releaseName,
|
||||||
buildNumber ? "1",
|
appImage,
|
||||||
appDir,
|
|
||||||
}: let
|
}: let
|
||||||
|
|
||||||
cpuArch = (pkgs.lib.systems.parse.mkSystemFromString hostSystem).cpu.name;
|
cpuArch = (pkgs.lib.systems.parse.mkSystemFromString hostSystem).cpu.name;
|
||||||
@ -11,25 +10,33 @@
|
|||||||
pkgbuild = pkgs.writeText "isle-arch-PKGBUILD-${releaseName}-${cpuArch}" ''
|
pkgbuild = pkgs.writeText "isle-arch-PKGBUILD-${releaseName}-${cpuArch}" ''
|
||||||
pkgname=isle
|
pkgname=isle
|
||||||
pkgver=${builtins.replaceStrings ["-"] ["_"] releaseName}
|
pkgver=${builtins.replaceStrings ["-"] ["_"] releaseName}
|
||||||
pkgrel=${buildNumber}
|
pkgrel=0
|
||||||
pkgdesc="The foundation for an autonomous community cloud infrastructure"
|
pkgdesc="The foundation for an autonomous community cloud infrastructure."
|
||||||
arch=('${cpuArch}')
|
arch=('${cpuArch}')
|
||||||
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')
|
||||||
|
|
||||||
source=('src.tar.zst')
|
depends=(
|
||||||
md5sums=('SKIP')
|
'fuse2'
|
||||||
|
)
|
||||||
|
|
||||||
|
# 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/
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
linuxRoot = (import ../default.nix).buildRoot {
|
|
||||||
inherit pkgs appDir;
|
|
||||||
};
|
|
||||||
|
|
||||||
in
|
in
|
||||||
pkgs.stdenv.mkDerivation {
|
pkgs.stdenv.mkDerivation {
|
||||||
name = "isle-arch-pkg-${releaseName}-${cpuArch}";
|
name = "isle-arch-pkg-${releaseName}-${cpuArch}";
|
||||||
@ -42,13 +49,28 @@ in
|
|||||||
];
|
];
|
||||||
|
|
||||||
inherit pkgbuild;
|
inherit pkgbuild;
|
||||||
src = linuxRoot;
|
src = appImage;
|
||||||
|
defaultDaemonYml = ../../../go/daemon/daecommon/daemon.yml;
|
||||||
|
systemdService = ../isle.service;
|
||||||
dontUnpack = true;
|
dontUnpack = true;
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
tar -cf src.tar.zst --zstd --mode=a+rX,u+w -C "$src" .
|
mkdir -p root/etc/isle/
|
||||||
|
cp "$defaultDaemonYml" root/etc/isle/daemon.yml
|
||||||
|
|
||||||
|
mkdir -p root/usr/lib/sysusers.d/
|
||||||
|
cat >root/usr/lib/sysusers.d/isle.conf <<EOF
|
||||||
|
u isle - "isle Daemon"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
mkdir -p root/usr/lib/systemd/system
|
||||||
|
cp "$systemdService" root/usr/lib/systemd/system/isle.service
|
||||||
|
|
||||||
cp $pkgbuild PKGBUILD
|
cp $pkgbuild PKGBUILD
|
||||||
|
|
||||||
|
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 \
|
||||||
--config ${pkgs.pacman}/etc/makepkg.conf
|
--config ${pkgs.pacman}/etc/makepkg.conf
|
||||||
|
73
dist/linux/deb/default.nix
vendored
73
dist/linux/deb/default.nix
vendored
@ -1,73 +0,0 @@
|
|||||||
{
|
|
||||||
pkgs,
|
|
||||||
hostSystem,
|
|
||||||
releaseName,
|
|
||||||
buildNumber ? "1",
|
|
||||||
appDir,
|
|
||||||
}: let
|
|
||||||
|
|
||||||
debArch = builtins.getAttr hostSystem {
|
|
||||||
"x86_64-linux" = "amd64";
|
|
||||||
"aarch64-linux" = "arm64";
|
|
||||||
"armv6l-linux" = "armhf";
|
|
||||||
"i686-linux" = "i386";
|
|
||||||
};
|
|
||||||
|
|
||||||
control = pkgs.writeTextDir "DEBIAN/control" ''
|
|
||||||
Package: isle
|
|
||||||
Version: ${releaseName}-${buildNumber}
|
|
||||||
Section: net
|
|
||||||
Priority: optional
|
|
||||||
Architecture: ${debArch}
|
|
||||||
Maintainer: Brian Picciano <me@mediocregopher.com>
|
|
||||||
Description: The foundation for an autonomous community cloud infrastructure
|
|
||||||
Homepage: https://code.betamike.com/micropelago/isle
|
|
||||||
'';
|
|
||||||
|
|
||||||
postinst = pkgs.writeTextDir "DEBIAN/postinst" ''
|
|
||||||
#!/bin/sh
|
|
||||||
systemctl daemon-reload
|
|
||||||
systemd-sysusers /usr/lib/sysusers.d/isle.conf
|
|
||||||
'';
|
|
||||||
|
|
||||||
postrm = pkgs.writeTextDir "DEBIAN/postrm" ''
|
|
||||||
#!/bin/sh
|
|
||||||
systemctl daemon-reload
|
|
||||||
'';
|
|
||||||
|
|
||||||
linuxRoot = (import ../default.nix).buildRoot {
|
|
||||||
inherit pkgs appDir;
|
|
||||||
};
|
|
||||||
|
|
||||||
root = pkgs.buildEnv {
|
|
||||||
name = "isle-deb-pkg-root";
|
|
||||||
paths = [
|
|
||||||
linuxRoot
|
|
||||||
control
|
|
||||||
postinst
|
|
||||||
postrm
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
in pkgs.stdenv.mkDerivation {
|
|
||||||
name = "isle-deb-pkg";
|
|
||||||
nativeBuildInputs = [
|
|
||||||
pkgs.zstd
|
|
||||||
pkgs.dpkg
|
|
||||||
];
|
|
||||||
src = root;
|
|
||||||
buildPhase = ''
|
|
||||||
cp -rL "$src" root
|
|
||||||
chmod +w -R root
|
|
||||||
chmod +x root/DEBIAN/post*
|
|
||||||
|
|
||||||
dpkg-deb \
|
|
||||||
--root-owner-group \
|
|
||||||
-Z zstd \
|
|
||||||
-b root isle_${releaseName}-${buildNumber}_${debArch}.deb
|
|
||||||
'';
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p "$out"
|
|
||||||
cp *.deb "$out"
|
|
||||||
'';
|
|
||||||
}
|
|
18
dist/linux/default.nix
vendored
18
dist/linux/default.nix
vendored
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
buildRoot = { pkgs, appDir}: pkgs.runCommand "isle-linux-root" {} ''
|
|
||||||
mkdir -p "$out"
|
|
||||||
cp -r ${appDir}/usr "$out"/
|
|
||||||
chmod +w -R "$out"/usr
|
|
||||||
|
|
||||||
mkdir -p "$out"/etc/isle
|
|
||||||
cp "${../../go/daemon/daecommon/daemon.yml}" "$out"/etc/isle/daemon.yml
|
|
||||||
|
|
||||||
mkdir -p "$out"/usr/lib/sysusers.d/
|
|
||||||
cat >"$out"/usr/lib/sysusers.d/isle.conf <<EOF
|
|
||||||
u isle - "isle Daemon"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
mkdir -p "$out"/usr/lib/systemd/system
|
|
||||||
cp "${./isle.service}" "$out"/usr/lib/systemd/system/isle.service
|
|
||||||
'';
|
|
||||||
}
|
|
@ -8,21 +8,12 @@ A release consists of:
|
|||||||
- A file containing a signature of the hash file, created by whoever is building
|
- A file containing a signature of the hash file, created by whoever is building
|
||||||
the release.
|
the release.
|
||||||
|
|
||||||
Releases are named using semantic versioning: <major>.<minor>.<patch>. A
|
|
||||||
preceding "v" is NOT a part of the canonical release name, though it use used in
|
|
||||||
specific contexts.
|
|
||||||
|
|
||||||
Release artifacts are also be labeled with a suffix indicating build number, eg
|
|
||||||
"0.1.3-2" which indicates that this is of release "0.1.3". The first build of a
|
|
||||||
release is always "1". Different build numbers of the same release indicate that
|
|
||||||
no code is different, only the packaging.
|
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
*NOTE: This has only been tested from an x86_64 linux machine*
|
*NOTE: This has only been tested from an x86_64 linux machine*
|
||||||
|
|
||||||
To create a release only a functional nix installation is required. Simply run
|
To create a release only a functional nix installation is required. Simply run
|
||||||
the `./release.sh` script, providing the release name and build number.
|
the `./release.sh` script, and input a release name when prompted.
|
||||||
|
|
||||||
From here an `isle` binary will be cross-compiled for all supported
|
From here an `isle` binary will be cross-compiled for all supported
|
||||||
platforms. This will take a long time the first time you perform it on your
|
platforms. This will take a long time the first time you perform it on your
|
||||||
@ -34,13 +25,12 @@ create the signature.
|
|||||||
|
|
||||||
## Releasing
|
## Releasing
|
||||||
|
|
||||||
Release artifacts are hosted at `micropelago.net` under
|
Release artifactes are hosted at `micropelago.net` under
|
||||||
`/isle/releases/v<release name>`. An `index.gmi` page should be created in that
|
`/isle/releases/<release name>`. An `index.gmi` page should be created in that
|
||||||
directory which includes links to each artifact, as well as a changelog
|
directory which includes links to each artifact, as well as a changelog
|
||||||
detailing all new features and fixes included since the previous release.
|
detailing all new features and fixes included since the previous release.
|
||||||
|
|
||||||
A link to the new release should be included at `/isle/releases/index.gmi`.
|
A link to the new release should be included at `/isle/releases/index.gmi`.
|
||||||
|
|
||||||
Each release should be tagged in the git repo using the release name and build
|
The release shoulld be tagged in the git repo using its release name as well,
|
||||||
number prefixed with a "v". If the build number of the release is "1" then the
|
with the tag notes linking to the `micropelago.net` page.
|
||||||
tag notes should link to the `micropelago.net` release page for the release.
|
|
||||||
|
@ -9,7 +9,6 @@ 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.)
|
||||||
|
|
||||||
|
@ -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"),
|
||||||
getBinDirPath(),
|
envBinDirPath,
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -15,30 +15,18 @@ import (
|
|||||||
"github.com/adrg/xdg"
|
"github.com/adrg/xdg"
|
||||||
)
|
)
|
||||||
|
|
||||||
const systemRootPath = ""
|
func getAppDirPath() string {
|
||||||
|
appDirPath := os.Getenv("APPDIR")
|
||||||
func getSystemRootPath() string {
|
if appDirPath == "" {
|
||||||
if systemRootPath != "" {
|
appDirPath = "."
|
||||||
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 (
|
||||||
envCacheDir = sync.OnceValue(func() toolkit.Dir {
|
envAppDirPath = getAppDirPath()
|
||||||
|
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))
|
||||||
@ -54,7 +42,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func binPath(name string) string {
|
func binPath(name string) string {
|
||||||
return filepath.Join(getBinDirPath(), name)
|
return filepath.Join(envBinDirPath, 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(getShareDirPath(), "version")
|
versionPath := filepath.Join(envAppDirPath, "share/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, "usr/libexec/isle")
|
return filepath.Join(appDirPath, "bin")
|
||||||
})
|
})
|
||||||
|
|
||||||
ipNetCounter = new(atomic.Uint64)
|
ipNetCounter = new(atomic.Uint64)
|
||||||
|
40
nix/appimagetool.nix
Normal file
40
nix/appimagetool.nix
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
{ 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
|
||||||
|
'';
|
||||||
|
}
|
@ -1,22 +0,0 @@
|
|||||||
{ 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.
@ -8,13 +8,6 @@ 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;
|
||||||
};
|
};
|
||||||
@ -38,7 +31,7 @@ rec {
|
|||||||
compile = (import "${src}/nix/compile.nix") {
|
compile = (import "${src}/nix/compile.nix") {
|
||||||
|
|
||||||
system = buildSystem;
|
system = buildSystem;
|
||||||
target = hostSystemTarget;
|
target = hostSystem;
|
||||||
pkgsSrc = pkgsNix.src;
|
pkgsSrc = pkgsNix.src;
|
||||||
|
|
||||||
cargo2nixOverlay = common.cargo2nixOverlay;
|
cargo2nixOverlay = common.cargo2nixOverlay;
|
||||||
|
BIN
nix/go-appimage/appimagetool-765-aarch64.AppImage
Executable file
BIN
nix/go-appimage/appimagetool-765-aarch64.AppImage
Executable file
Binary file not shown.
BIN
nix/go-appimage/appimagetool-765-armhf.AppImage
Executable file
BIN
nix/go-appimage/appimagetool-765-armhf.AppImage
Executable file
Binary file not shown.
BIN
nix/go-appimage/appimagetool-765-i686.AppImage
Executable file
BIN
nix/go-appimage/appimagetool-765-i686.AppImage
Executable file
Binary file not shown.
BIN
nix/go-appimage/appimagetool-765-x86_64.AppImage
Executable file
BIN
nix/go-appimage/appimagetool-765-x86_64.AppImage
Executable file
Binary file not shown.
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
vendorHash = "sha256-GvMiOEC3Y/pGG++Z+XCgLVADKymUR9shDxjx3xIz8u0=";
|
vendorHash = "sha256-GvMiOEC3Y/pGG++Z+XCgLVADKymUR9shDxjx3xIz8u0=";
|
||||||
|
|
||||||
subPackages = [ "cmd/nebula" ];
|
subPackages = [ "cmd/nebula" "cmd/nebula-cert" ];
|
||||||
|
|
||||||
ldflags = [ "-X main.Build=${version}" ];
|
ldflags = [ "-X main.Build=${version}" ];
|
||||||
}
|
}
|
||||||
|
23
nix/pkgs.nix
23
nix/pkgs.nix
@ -9,11 +9,6 @@ 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);
|
||||||
@ -40,16 +35,11 @@ rec {
|
|||||||
sha256 = "sha256:1lr1h35prqkd1mkmzriwlpvxcb34kmhc9dnr48gkm8hh089hifmx";
|
sha256 = "sha256:1lr1h35prqkd1mkmzriwlpvxcb34kmhc9dnr48gkm8hh089hifmx";
|
||||||
};
|
};
|
||||||
|
|
||||||
lib = import "${src}/lib";
|
supportedSystems = [
|
||||||
|
"x86_64-linux"
|
||||||
crossSystems = {
|
"aarch64-linux"
|
||||||
"x86_64-linux" = {config = "x86_64-linux";};
|
"i686-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,
|
||||||
@ -65,6 +55,7 @@ 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 = builtins.getAttr hostSystem crossSystems;
|
crossSystem.config = hostSystem;
|
||||||
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
13
release.nix
13
release.nix
@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
|
revision ? "dev",
|
||||||
releaseName ? "dev",
|
releaseName ? "dev",
|
||||||
buildNumber ? "1",
|
|
||||||
|
|
||||||
buildSystem ? builtins.currentSystem,
|
buildSystem ? builtins.currentSystem,
|
||||||
pkgsNix ? (import ./nix/pkgs.nix),
|
pkgsNix ? (import ./nix/pkgs.nix),
|
||||||
supportedSystems ? pkgsNix.supportedSystems,
|
supportedSystems ? pkgsNix.supportedSystems,
|
||||||
|
|
||||||
}: let
|
}: let
|
||||||
|
|
||||||
pkgs = pkgsNix.default { inherit buildSystem; };
|
pkgs = pkgsNix.default { inherit buildSystem; };
|
||||||
@ -12,24 +13,22 @@
|
|||||||
mkRelease = hostSystem: let
|
mkRelease = hostSystem: let
|
||||||
|
|
||||||
build = ((import ./default.nix) {
|
build = ((import ./default.nix) {
|
||||||
inherit buildSystem hostSystem releaseName buildNumber;
|
inherit buildSystem hostSystem releaseName revision;
|
||||||
}).build;
|
}).build;
|
||||||
|
|
||||||
in pkgs.stdenv.mkDerivation {
|
in pkgs.stdenv.mkDerivation {
|
||||||
name = "isle-release-${hostSystem}";
|
name = "isle-release-${hostSystem}";
|
||||||
inherit releaseName buildNumber hostSystem;
|
inherit releaseName hostSystem;
|
||||||
|
|
||||||
appImage = build.appImage;
|
appImage = build.appImage;
|
||||||
archPkg = build.archPkg;
|
archPkg = build.archPkg;
|
||||||
debPkg = build.debPkg;
|
|
||||||
|
|
||||||
builder = builtins.toFile "build.sh" ''
|
builder = builtins.toFile "build.sh" ''
|
||||||
source $stdenv/setup
|
source $stdenv/setup
|
||||||
|
|
||||||
mkdir -p "$out"/
|
mkdir -p "$out"/
|
||||||
cp "$appImage"/bin/isle "$out"/isle-$releaseName-$buildNumber-$hostSystem.AppImage
|
cp "$appImage"/bin/isle "$out"/isle-$releaseName-$hostSystem.AppImage
|
||||||
cp "$archPkg"/* "$out"/
|
cp "$archPkg"/*.tar.zst "$out"/isle-$releaseName-$hostSystem.pkg.tar.zst
|
||||||
cp "$debPkg"/* "$out"/
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
14
release.sh
14
release.sh
@ -7,25 +7,21 @@ cd "$scriptDir"
|
|||||||
|
|
||||||
releaseName="$1"
|
releaseName="$1"
|
||||||
if [ -z "$releaseName" ]; then
|
if [ -z "$releaseName" ]; then
|
||||||
echo "USAGE: $0 \"0.1.2\" [build number]"
|
echo "USAGE: $0 \"v0.1.2\""
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
buildNumber="$2"
|
|
||||||
if [ -z "$buildNumber" ]; then
|
|
||||||
buildNumber="0"
|
|
||||||
fi
|
|
||||||
|
|
||||||
releasesDir="$(pwd)/releases"
|
releasesDir="$(pwd)/releases"
|
||||||
mkdir -p "$releasesDir"
|
mkdir -p "$releasesDir"
|
||||||
echo '*' > "$releasesDir"/.gitignore
|
echo '*' > "$releasesDir"/.gitignore
|
||||||
|
|
||||||
out="$releasesDir/$releaseName-$buildNumber"
|
out="$releasesDir/$releaseName"
|
||||||
rm -rf "$out"
|
|
||||||
|
revision=$(git rev-parse HEAD)
|
||||||
|
|
||||||
result=$(nix-build -v \
|
result=$(nix-build -v \
|
||||||
|
--argstr revision "$revision" \
|
||||||
--argstr releaseName "$releaseName" \
|
--argstr releaseName "$releaseName" \
|
||||||
--argstr buildNumber "$buildNumber" \
|
|
||||||
--no-out-link \
|
--no-out-link \
|
||||||
release.nix \
|
release.nix \
|
||||||
)
|
)
|
||||||
|
7
tasks/soon/code/raspberry-pi-build.md
Normal file
7
tasks/soon/code/raspberry-pi-build.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
type: task
|
||||||
|
---
|
||||||
|
|
||||||
|
# Raspberry Pi Build
|
||||||
|
|
||||||
|
Get Isle build system to include rpi (armv7l-linux-musl)
|
Loading…
Reference in New Issue
Block a user