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
opened 05:41PM - 20 Feb 21 UTC
I appreciate that the creators of Symfony provided the world with a great gift f… or free. Thus I don't want to argue again to open source the CLI. This was discussed before in #37, #155 and #272.
However it took me quite some time starting from the documentation of the [Symfony Server](https://symfony.com/doc/current/setup/symfony_server.html) to find out that the CLI is closed source. I even accidentally installed non-free software on a throwaway VM without realising it. Now on my development laptop I searched for the Debian package containing the web server and could not find it.
Symfony has transformed PHP into a serious platform and it would be sad, if its reputation could be damaged by people accidentally feeling mislead about the non-free nature of the CLI. I fully understand that you believe this to be a good idea. I don't. But that is your prerogative to decide.
This feeling could be even reinforced by this sentence from the README: "The Symfony binary is a must-have tool when developing Symfony applications on your local machine." Most people probably correctly understand this as advertising. But it is strictly speaking misleading since one can perfectly develop Symfony applications also without the tool.
So please make it clear that the Symfony tool is non-free. It suggest to mention this on these pages at least:
- https://symfony.com/doc/current/setup/symfony_server.html
- https://github.com/symfony/cli
- https://symfony.com/doc/current/cloud/getting-started.html
- https://symfony.com/doc/current/setup.html
As a side-note I'd also recommend not to educate people to follow the <code>wget $SOMETHING | bash</code> anti-pattern. It could make people question the security philosophy of the whole platform.
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
pkgs/development/tools/ccloud-cli/default.nix
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 {}) ];
2 Likes
Things are working. Many thanks to @nixinator and @peterhoeg
You helped me a lot to understand how things works (well, in part at least). I’ll just post the blocks of code that works if it can help better someone else:
symfony-cli.nix
:
{ stdenv, fetchurl, lib }:
stdenv.mkDerivation rec {
pname = "symfony-cli";
version = "4.23.5";
src = fetchurl {
url = "https://github.com/symfony/cli/releases/download/v${version}/symfony_linux_amd64";
sha256 = "43aef5fd5d45f4602697cad016eff504cb68ec6ad1271c7b1e2a089e1eedd05a";
};
phases = [ "installPhase" ];
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" ];
};
}
In configuration.nix
:
environment.systemPackages = with pkgs; [
(callPackage ./symfony-cli.nix {})
];
1 Like
Hi,
Is there an official package for this?
Thanks!
drupol
June 9, 2021, 12:43pm
7
Nice! It will help me to see how to submit a new package like this.
I have some issues with the program on NixOS, especially on the use of the local certificate authority that can be created by the program.
1 Like