4 ms·
Let's say I want to have the last five versions of my application installed as a mortal user, for testing purposes. Let's say that my application's build syste
by jancsika 8y ago
Let's say I want to have the last five versions of my application installed as a mortal user, for testing purposes.
Let's say that my application's build system pulls in a big GUI toolkit binary because reasons.
Let's say I don't want to create "official" packages for it, just something quick and dirty that will get me these versions installed.
Can I do this with GNU Guix?
- rekado 8y ago> last five versions If the build method has not changed then all you need is five tarballs and use `guix build foo --with-source=foo-0.0.n.tar.gz`. > build system pulls in a big GUI toolkit binary This is less likely to work, but it depends on how the big binary is linked. > just something quick and dirty You can use "guix build foo --with-source=..." for quick and dirty things. For something slightly less quick and slightly less dirty you can define a local package expression using the Guix DSL, dump that in a file, and build it from there.
- nextos 8y agoWith Nix you can, and Guix is a Nix reimplementation, so you can too. In Nix, some details are still a bit clunky. Like pinning particular package versions. But Nix / Guix are, in my opinion, already more useful and robust that other distros. For edge cases, I still use some ad hoc Dockers.
- Nullabillity 8y agoMy examples are in Nix, because that's what I'm familiar with, but everything should apply to Guix too (with some translation). > Let's say I want to have the last five versions of my application installed as a mortal user, for testing purposes. Sure, you can use linkFarm to collect multiple variants: let pkgs = import <nixpkgs>; repoUrl = "https://gitlab.com/teozkr/sbtix.git"; versions = [ { rev = "v1.0"; sha256 = "storehash1"; } { rev = "v1.1"; sha256 = "storehash2"; } ]; programOfVersion = version: pkgs.callPackage (pkgs.fetchgit { inherit (version) rev sha256; url = repoUrl; }) {}; allBins = map (version: { name = "sbtix-${version.rev}"; path = "${programOfVersion version}/bin/sbtix"; }) versions; binFarm = pkgs.linkFarm "sbtix-binfarm" allBins; in pkgs.linkFarm "sbtix-farm" [ { name = "bin"; path = binFarm; } ]; That said... the Nix way would have been to just build the version you care about, when you care about it, without installing it globally. To do that you could just run `nix build` in your project directory, and then run `result/bin/my-program`. > Let's say that my application's build system pulls in a big GUI toolkit binary because reasons. Not sure which toolkit you're talking about, the the big ones (GTK, Qt, wxWidgets, etc) are already packaged for you. > Let's say I don't want to create "official" packages for it, just something quick and dirty that will get me these versions installed. This depends on what language you're using, but it's usually a matter of 1) defining your dependencies and 2) running your preferred build tool. The usual recipe for a default.nix looks like this: { pkgs ? import <nixpkgs> {} }: pkgs.stdenv { name = "my-program"; src = ./.; buildInputs = [ pkgs.qt5 pkgs.pulseaudio ... ]; configurePhase = "./configure --prefix $out"; buildPhase = "make"; installPhase = "make install"; } Though most languages have helpers to avoid this boilerplate (and, usually, to help with things like caching across builds). Haskell has buildStackProject[1], Node has yarn2nix[2], etc. stdenv will default to the Autotools workflow (./configure; make; make install) if you don't define the phases yourself. [1]: https://nixos.org/nixpkgs/manual/#how-to-build-a-haskell-project-using-stack https://nixos.org/nixpkgs/manual/#how-to-build-a-haskell-pro... [2]: https://github.com/moretea/yarn2nix https://github.com/moretea/yarn2nix > Can I do this with GNU Guix? Yes ;)