Compare commits

...

5 Commits
v0.0.3 ... main

26 changed files with 283 additions and 180 deletions

View File

@ -3,8 +3,13 @@
hostSystem ? buildSystem, hostSystem ? buildSystem,
pkgsNix ? (import ./nix/pkgs.nix), pkgsNix ? (import ./nix/pkgs.nix),
revision ? "dev", # We allow passing in the revision because nix flakes have their own mechanism
# 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 {
@ -20,12 +25,22 @@
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 revision releaseName; inherit buildSystem hostSystem revisionFile;
nativeBuildInputs = [ pkgsNative.git ];
goVersion = pkgs.go.version; goVersion = pkgs.go.version;
garageVersion = garageNix.version; garageVersion = garageNix.version;
@ -36,41 +51,37 @@ in rec {
versionFile=version versionFile=version
echo "Release: $releaseName" >> "$versionFile" echo "Version: $(cat $revisionFile)" >> "$versionFile"
echo "Platform: $hostSystem" >> "$versionFile" echo "Platform: $hostSystem" >> "$versionFile"
echo "Git Revision: $revision" >> "$versionFile" echo "Go Version: $goVersion" >> "$versionFile"
echo "Go Version: $goVersion" >> "$versionFile" echo "Garage Version: $garageVersion" >> "$versionFile"
echo "Garage Version: $garageVersion" >> "$versionFile" 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;
@ -78,30 +89,28 @@ in rec {
nebula = pkgs.callPackage ./nix/nebula.nix {}; nebula = pkgs.callPackage ./nix/nebula.nix {};
garage = let garage = garageNix.package {
hostPlatform = pkgs.stdenv.hostPlatform.parsed; inherit pkgsNix buildSystem hostSystem;
in garageNix.package {
inherit pkgsNix buildSystem;
hostSystem = "${hostPlatform.cpu.name}-unknown-${hostPlatform.kernel.name}-musl";
}; };
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
@ -109,7 +118,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
''; '';
}; };
@ -133,36 +144,40 @@ 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 = [ nativeBuildInputs = [ appimagekit ];
(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=debug export VERSION=$(cat $revisionFile)
# https://github.com/probonopd/go-appimage/issues/155
unset SOURCE_DATE_EPOCH
appimagetool ./isle.AppDir
mkdir -p "$out"/bin mkdir -p "$out"/bin
mv Isle-* "$out"/bin/isle appimagetool ./isle.AppDir "$out"/bin/isle
''; '';
}; };
archPkg = ((import ./dist/linux/arch) { archPkg = ((import ./dist/linux/arch) {
inherit hostSystem releaseName appImage; inherit hostSystem releaseName buildNumber;
pkgs = pkgsNative; pkgs = pkgsNative;
appDir = appDir { systemRoot = "/"; };
});
debPkg = ((import ./dist/linux/deb) {
inherit hostSystem releaseName buildNumber;
pkgs = pkgsNative;
appDir = appDir { systemRoot = "/"; };
}); });
}; };
} }

View File

@ -2,7 +2,8 @@
pkgs, pkgs,
hostSystem, hostSystem,
releaseName, releaseName,
appImage, buildNumber ? "1",
appDir,
}: let }: let
cpuArch = (pkgs.lib.systems.parse.mkSystemFromString hostSystem).cpu.name; cpuArch = (pkgs.lib.systems.parse.mkSystemFromString hostSystem).cpu.name;
@ -10,33 +11,25 @@
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=0 pkgrel=${buildNumber}
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')
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/
} }
''; '';
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}";
@ -49,28 +42,13 @@ in
]; ];
inherit pkgbuild; inherit pkgbuild;
src = appImage; src = linuxRoot;
defaultDaemonYml = ../../../go/daemon/daecommon/daemon.yml;
systemdService = ../isle.service;
dontUnpack = true; dontUnpack = true;
buildPhase = '' buildPhase = ''
mkdir -p root/etc/isle/ tar -cf src.tar.zst --zstd --mode=a+rX,u+w -C "$src" .
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 Normal file
View File

@ -0,0 +1,73 @@
{
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 Normal file
View File

@ -0,0 +1,18 @@
{
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
'';
}

View File

@ -8,12 +8,21 @@ 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, and input a release name when prompted. the `./release.sh` script, providing the release name and build number.
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
@ -25,12 +34,13 @@ create the signature.
## Releasing ## Releasing
Release artifactes are hosted at `micropelago.net` under Release artifacts are hosted at `micropelago.net` under
`/isle/releases/<release name>`. An `index.gmi` page should be created in that `/isle/releases/v<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`.
The release shoulld be tagged in the git repo using its release name as well, Each release should be tagged in the git repo using the release name and build
with the tag notes linking to the `micropelago.net` page. number prefixed with a "v". If the build number of the release is "1" then the
tag notes should link to the `micropelago.net` release page for the release.

View File

@ -9,6 +9,7 @@ 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.)

View File

@ -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 {

View File

@ -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{

View File

@ -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 {

View File

@ -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)

View File

@ -1,40 +0,0 @@
{ 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
'';
}

View File

@ -0,0 +1,22 @@
{ 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.

View File

@ -8,6 +8,13 @@ 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;
}; };
@ -31,7 +38,7 @@ rec {
compile = (import "${src}/nix/compile.nix") { compile = (import "${src}/nix/compile.nix") {
system = buildSystem; system = buildSystem;
target = hostSystem; target = hostSystemTarget;
pkgsSrc = pkgsNix.src; pkgsSrc = pkgsNix.src;
cargo2nixOverlay = common.cargo2nixOverlay; cargo2nixOverlay = common.cargo2nixOverlay;

View File

@ -20,7 +20,7 @@
vendorHash = "sha256-GvMiOEC3Y/pGG++Z+XCgLVADKymUR9shDxjx3xIz8u0="; vendorHash = "sha256-GvMiOEC3Y/pGG++Z+XCgLVADKymUR9shDxjx3xIz8u0=";
subPackages = [ "cmd/nebula" "cmd/nebula-cert" ]; subPackages = [ "cmd/nebula" ];
ldflags = [ "-X main.Build=${version}" ]; ldflags = [ "-X main.Build=${version}" ];
} }

View File

@ -9,6 +9,11 @@ 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);
@ -35,11 +40,16 @@ rec {
sha256 = "sha256:1lr1h35prqkd1mkmzriwlpvxcb34kmhc9dnr48gkm8hh089hifmx"; sha256 = "sha256:1lr1h35prqkd1mkmzriwlpvxcb34kmhc9dnr48gkm8hh089hifmx";
}; };
supportedSystems = [ lib = import "${src}/lib";
"x86_64-linux"
"aarch64-linux" crossSystems = {
"i686-linux" "x86_64-linux" = {config = "x86_64-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,
@ -55,7 +65,6 @@ 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.config = hostSystem; crossSystem = builtins.getAttr hostSystem crossSystems;
})); }));
} }

View File

@ -1,11 +1,10 @@
{ {
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; };
@ -13,22 +12,24 @@
mkRelease = hostSystem: let mkRelease = hostSystem: let
build = ((import ./default.nix) { build = ((import ./default.nix) {
inherit buildSystem hostSystem releaseName revision; inherit buildSystem hostSystem releaseName buildNumber;
}).build; }).build;
in pkgs.stdenv.mkDerivation { in pkgs.stdenv.mkDerivation {
name = "isle-release-${hostSystem}"; name = "isle-release-${hostSystem}";
inherit releaseName hostSystem; inherit releaseName buildNumber 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-$hostSystem.AppImage cp "$appImage"/bin/isle "$out"/isle-$releaseName-$buildNumber-$hostSystem.AppImage
cp "$archPkg"/*.tar.zst "$out"/isle-$releaseName-$hostSystem.pkg.tar.zst cp "$archPkg"/* "$out"/
cp "$debPkg"/* "$out"/
''; '';
}; };

View File

@ -7,21 +7,25 @@ cd "$scriptDir"
releaseName="$1" releaseName="$1"
if [ -z "$releaseName" ]; then if [ -z "$releaseName" ]; then
echo "USAGE: $0 \"v0.1.2\"" echo "USAGE: $0 \"0.1.2\" [build number]"
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" out="$releasesDir/$releaseName-$buildNumber"
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 \
) )

View File

@ -1,7 +0,0 @@
---
type: task
---
# Raspberry Pi Build
Get Isle build system to include rpi (armv7l-linux-musl)