diff --git a/flake.nix b/flake.nix index b10e1b5..2d9caf9 100644 --- a/flake.nix +++ b/flake.nix @@ -38,7 +38,7 @@ }; linuxInterpreter = linuxInterpreters.${pkgs.stdenv.hostPlatform.parsed.cpu.name}; in - { + rec { tsui = pkgs.buildGoModule { inherit pname; inherit version; @@ -65,12 +65,24 @@ vendorHash = "sha256-FIbkPE5KQ4w7Tc7kISQ7ZYFZAoMNGiVlFWzt8BPCf+A="; buildInputs = dependenciesFor pkgs; + }; + # This is an attempt at building a package independent from nix. + # In order to do so, it changes the library loader for the one + # usually found in `/lib/ld-linux....so` + # Note that this does not change binary rpath, so libraries may still + # be searched in `/nix/store`, but depending on the new ld-linux + # used, it may also fallsback onto more "traditional" (e.g. + # `/usr/lib64`) directories. + # Note that this breaks the run on nixos-system, because + # `/lib/ld-linux...` is not a real library loader. + tsui_no_nix_ld = tsui.overrideAttrs (oldAttrs: + { # Un-Nix the build so it can dlopen() X11 outside of Nix environments. preFixup = if pkgs.stdenv.isLinux then '' patchelf --remove-rpath --set-interpreter ${linuxInterpreter} $out/bin/${pname} '' else null; - }; + }); }); # Add dependencies that are only needed for development @@ -89,5 +101,10 @@ # flake provides only one package or there is a clear "main" # package. defaultPackage = forAllSystems (system: self.packages.${system}.tsui); + + # nix bundle .# creates a file `tsui` in current directory which is a + # self auto-extractable archive which should be self contained and hence + # easy to deploy. + bundles = forAllSystems (system: self.packages.${system}.tsui); }; }