What is the right way to install Symfony CLI?

Hi! I’m at the very beginning of my discover of NixOS (and Nix).

I tried to find the right way to install the Symfony CLI. This binary isn’t in the nixpkgs and maybe for a reason. The recommended way is a script but the binary is also release in a github repository (the source isn’t provided). I know the binary contain a self updater.

I believe it’s possible to specify the path to the binary to install. Is it the right way? If so, where can I find documentation on this?
Or do I have to plan to run the script in a particular way?

Thanks for your help!

Welcome… interesting project… however

makes for interesting reading… another one of these open source / closed source type projects.

nix likes source code. But binaries can be package with some extra effort.

You may need to use a fhs buildroot , or a combination of binary patching patchelf.

Success is highly dependant on the nature of the executable and if the libraries it need exist on within nix.

Grepping nixpkgs is alway where i start, to see if a similar project. Get a basic derivation going and usually someone will help with pointers to get it working.

The idea situation is to always start with the source, but it’s no always possible, and that is usually a layer 9 problem (politics).

take a look at this for inspiration with nixpkgs GitHub - NixOS/nixpkgs: Nix Packages collection


take a look at. buildFHSUserEnv too.

Maybe I started to understand something, but I’m not sure because all the things I tried didn’t work.

Inspired by the ccloud-cli example, I created a symfony-cli.nix (in the same folder as configuration.nix):

{ stdenv, autoPatchelfHook, fetchurl, lib }:

stdenv.mkDerivation rec {
  pname = "symfony-cli";
  version = "4.23.5";

  # To get the latest version:
  # wget https://get.symfony.com/cli/installer -O - | bash
  src = fetchurl {
    url = "https://github.com/symfony/cli/releases/download/v${version}/symfony_linux_amd64.gz";
    sha256 = "43aef5fd5d45f4602697cad016eff504cb68ec6ad1271c7b1e2a089e1eedd05a";

  nativeBuildInputs = [ autoPatchelfHook ];

  installPhase = ''
    mkdir -p $out/bin
    cp $src $out/bin/symfony
    chmod +x $out/bin/symfony

  meta = with lib; {
    description = "Symfony CLI";
    homepage = "https://symfony.com/download";
    license = licenses.unfree;
    platforms = [ "x86_64-linux" ];

But I don’t know what to do with that. What can I write now in my configuration.nix?

But I don’t know what to do with that. What can I write now in my configuration.nix?

environment.systemPackages = [ (pkgs.callPackage ./symphony-cli.nix {}) ];
1 Like