diff --git a/default.nix b/default.nix index 3b58a7e..70c34a3 100644 --- a/default.nix +++ b/default.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 diff --git a/flake.lock b/flake.lock index a701460..42bb9fa 100644 --- a/flake.lock +++ b/flake.lock @@ -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" } }, diff --git a/flake.nix b/flake.nix index ad7e848..5dcf885 100644 --- a/flake.nix +++ b/flake.nix @@ -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) ]; }; diff --git a/nix/appimagetool.nix b/nix/appimagetool.nix index cd5b154..701bc89 100644 --- a/nix/appimagetool.nix +++ b/nix/appimagetool.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; } diff --git a/nix/overlays/go.nix b/nix/overlays/go.nix new file mode 100644 index 0000000..1527a61 --- /dev/null +++ b/nix/overlays/go.nix @@ -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); + + } +) diff --git a/nix/overlays/go_1_18.nix b/nix/overlays/go_1_18.nix deleted file mode 100644 index b8f01f0..0000000 --- a/nix/overlays/go_1_18.nix +++ /dev/null @@ -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); - - } -)