Update nixpkgs, add appimagetool for other archs

main
Brian Picciano 1 year ago
parent 5061fb5670
commit 05f9064d10
  1. 3
      default.nix
  2. 8
      flake.lock
  3. 10
      flake.nix
  4. 40
      nix/appimagetool.nix
  5. 18
      nix/overlays/go.nix
  6. 21
      nix/overlays/go_1_18.nix

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

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

@ -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";
@ -18,9 +18,9 @@ cloud infrastructure";
supportedSystems = [
"x86_64-linux"
#"aarch64-linux"
#"armv7l-linux" # rpi, I think?
#"i686-linux"
"aarch64-linux"
"armv7l-linux" # rpi, I think?
"i686-linux"
];
in utils.lib.eachSystem supportedSystems (system: let
@ -33,7 +33,7 @@ cloud infrastructure";
#};
overlays = [
(import ./nix/overlays/go_1_18.nix)
(import ./nix/overlays/go.nix)
];
};

@ -1,15 +1,7 @@
# Modified from https://github.com/matthewbauer/nix-bundle/blob/e9fa7e8a118942adafa8592a28b301ee23d37c13/appimagetool.nix
{ 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
{ stdenv, fetchurl }:
let
inherit (stdenv.cc.bintools) dynamicLinker;
version = "745";
cpuArch = stdenv.buildPlatform.parsed.cpu.arch;
@ -21,38 +13,38 @@ let
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}";
in stdenv.mkDerivation rec {
inherit version src;
pname = "go-appimage";
inherit version src;
sourceRoot = "squashfs-root";
unpackPhase = ''
cp $src appimagetool
chmod u+wx appimagetool
#patchelf --set-interpreter ${dynamicLinker} \
# --set-rpath ${fuse}/lib:${zlib}/lib \
# appimagetool
./appimagetool --appimage-extract
'';
installPhase = ''
mkdir -p $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;
}

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

@ -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);
}
)
Loading…
Cancel
Save