Update nixpkgs, add appimagetool for other archs

This commit is contained in:
Brian Picciano 2023-01-29 15:31:11 +01:00
parent 5061fb5670
commit 05f9064d10
6 changed files with 44 additions and 56 deletions

View File

@ -67,8 +67,6 @@
nativeBuildInputs = [ nativeBuildInputs = [
appimagetool appimagetool
pkgs.file
pkgs.fuse
]; ];
ARCH = "x86_64"; ARCH = "x86_64";
@ -82,6 +80,7 @@
# https://github.com/probonopd/go-appimage/issues/155 # https://github.com/probonopd/go-appimage/issues/155
unset SOURCE_DATE_EPOCH unset SOURCE_DATE_EPOCH
appimagetool ./cryptic-net.AppDir appimagetool ./cryptic-net.AppDir
mkdir -p "$out"/bin mkdir -p "$out"/bin

View File

@ -95,16 +95,16 @@
}, },
"pkgsSrc": { "pkgsSrc": {
"locked": { "locked": {
"lastModified": 1672580127, "lastModified": 1674868155,
"narHash": "sha256-3lW3xZslREhJogoOkjeZtlBtvFMyxHku7I/9IVehhT8=", "narHash": "sha256-eFNm2h6fNbgD7ZpO4MHikCB5pSnCJ7DTmwPisjetmwc=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0874168639713f547c05947c76124f78441ea46c", "rev": "ce20e9ebe1903ea2ba1ab006ec63093020c761cb",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",
"ref": "nixos-22.05", "ref": "nixos-22.11",
"type": "indirect" "type": "indirect"
} }
}, },

View File

@ -1,6 +1,6 @@
{ {
inputs.pkgsSrc.url = "nixpkgs/nixos-22.05"; inputs.pkgsSrc.url = "nixpkgs/nixos-22.11";
inputs.utils.url = "github:numtide/flake-utils"; inputs.utils.url = "github:numtide/flake-utils";
@ -18,9 +18,9 @@ cloud infrastructure";
supportedSystems = [ supportedSystems = [
"x86_64-linux" "x86_64-linux"
#"aarch64-linux" "aarch64-linux"
#"armv7l-linux" # rpi, I think? "armv7l-linux" # rpi, I think?
#"i686-linux" "i686-linux"
]; ];
in utils.lib.eachSystem supportedSystems (system: let in utils.lib.eachSystem supportedSystems (system: let
@ -33,7 +33,7 @@ cloud infrastructure";
#}; #};
overlays = [ overlays = [
(import ./nix/overlays/go_1_18.nix) (import ./nix/overlays/go.nix)
]; ];
}; };

View File

@ -1,15 +1,7 @@
# Modified from https://github.com/matthewbauer/nix-bundle/blob/e9fa7e8a118942adafa8592a28b301ee23d37c13/appimagetool.nix { stdenv, fetchurl }:
{ stdenv, lib, fetchurl, fuse, zlib, file, glib, }:
# This is from some binaries.
# Ideally, this should be source based,
# but I can't get it to build from GitHub
let let
inherit (stdenv.cc.bintools) dynamicLinker;
version = "745"; version = "745";
cpuArch = stdenv.buildPlatform.parsed.cpu.arch; cpuArch = stdenv.buildPlatform.parsed.cpu.arch;
@ -21,38 +13,38 @@ let
sha256 = "sha256-HQ7d9LQDaPm6sGZ5boWZdmGTNqiGN9NWHUWPiDhl2Xc="; sha256 = "sha256-HQ7d9LQDaPm6sGZ5boWZdmGTNqiGN9NWHUWPiDhl2Xc=";
}; };
# TODO other archs "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 {
inherit version src;
pname = "go-appimage"; pname = "go-appimage";
inherit version src;
sourceRoot = "squashfs-root"; sourceRoot = "squashfs-root";
unpackPhase = '' unpackPhase = ''
cp $src appimagetool cp $src appimagetool
chmod u+wx appimagetool chmod u+wx appimagetool
#patchelf --set-interpreter ${dynamicLinker} \
# --set-rpath ${fuse}/lib:${zlib}/lib \
# appimagetool
./appimagetool --appimage-extract ./appimagetool --appimage-extract
''; '';
installPhase = '' installPhase = ''
mkdir -p $out mkdir -p $out
cp -r usr/* $out cp -r usr/* $out
for x in $out/bin/*; do
patchelf \
--set-interpreter ${dynamicLinker} \
--set-rpath ${lib.makeLibraryPath [ zlib stdenv.glibc.out fuse glib ]} \
$x || true
done
''; '';
dontStrip = true;
dontPatchELF = true;
} }

18
nix/overlays/go.nix Normal file
View File

@ -0,0 +1,18 @@
# Make buildGoModules use static compilation by default
(final: prev:
let
buildArgs = {
doCheck = false;
CGO_ENABLED=0;
tags = [ "netgo" "timetzdata" ];
ldflags = [ "-w" "-extldflags=-static" ];
};
in {
buildGoModule = args: prev.buildGoModule (buildArgs // args);
}
)

View File

@ -1,21 +0,0 @@
# Make buildGoModules use static compilation by default, and use go 1.18
# everywhere.
(final: prev:
let
buildArgs = {
doCheck = false;
CGO_ENABLED=0;
tags = [ "netgo" "timetzdata" ];
ldflags = [ "-w" "-extldflags=-static" ];
};
in {
go = prev.go_1_18;
buildGoModule = args: prev.buildGo118Module (buildArgs // args);
buildGo118Module = args: prev.buildGo118Module (buildArgs // args);
}
)