Discussion:
[Nix-dev] git in nix is broken...
Alexander Schmolck via nix-dev
2017-07-10 17:25:26 UTC
Permalink
... because it appears to be missing dependencies like sed for
commands such as git-filter-branch which are implemented as bash
scripts.

I've submitted a PR which tries to fix that
(https://github.com/NixOS/nixpkgs/pull/27221) by

a) adding missing dependencies like awk, sed and coreutils
b) rewriting the affected scripts to use absolute references to grep,
awk, sed etc. (e.g. grep ->
/nix/store/r6s8rcd28wsk4gwviyc93343bq5zwlqq-gnugrep-3.0/bin/grep)

Having a less than fully working version of something as core as git
seems a bit undesirable.

I'm new to contributing to nixpkgs, so could someone more experienced
let me know if what I've done looks roughly plausible?

Thanks!

alexander
Eelco Dolstra via nix-dev
2017-07-10 17:47:41 UTC
Permalink
Hi,
Post by Alexander Schmolck via nix-dev
... because it appears to be missing dependencies like sed for
commands such as git-filter-branch which are implemented as bash
scripts.
Broken how? What doesn't work?

I guess you mean that some things fail if you execute with a $PATH that doesn't
contain the basic Unix utilities. This is likely the case for most shell code in
Nixpkgs.
--
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/
Alexander Schmolck via nix-dev
2017-07-10 18:36:05 UTC
Permalink
Yes, git filter-branch failing because e.g. sed is either not
installed at all or not in PATH is what I meant.

I wasn't aware that this is "intended behavior", I thought that nix
packages were intended to be self-contained other than explicitly
declared dependencies

The way I ran into this was by building a docker image for a python
application that has a runtime dependency on git with
dockerTools.buildImage (code is here:
https://github.com/smarkets/marge/blob/master/dockerize.nix). Most git
commands work fine, but not ones that use the few commands that are
implemented as shell scripts. Pulling in the branch in the PR via
fetchTarball fixes the problem, but what would be the preferred way of
doing this?

alexander

On 10 July 2017 at 18:47, Eelco Dolstra via nix-dev
Post by Eelco Dolstra via nix-dev
Hi,
Post by Alexander Schmolck via nix-dev
... because it appears to be missing dependencies like sed for
commands such as git-filter-branch which are implemented as bash
scripts.
Broken how? What doesn't work?
I guess you mean that some things fail if you execute with a $PATH that doesn't
contain the basic Unix utilities. This is likely the case for most shell code in
Nixpkgs.
--
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/
_______________________________________________
nix-dev mailing list
https://mailman.science.uu.nl/mailman/listinfo/nix-dev
Alexander Schmolck via nix-dev
2017-07-10 18:52:46 UTC
Permalink
It's probably also worth mentioning that git/default.nix in its
current state does appear to make some attempt to rewrite the path to
basic unix utilities (like grep) to absolute paths in some places, but
not others and some of the existing patching is obsolete (e.g. it
tries to do so git-am which has been migrated from a shell script to
c).

E.g. lines 102 and following

https://github.com/smarkets/nixpkgs/blob/1a25495b6344c832dc3750dc9b8a95fd2d68583c/pkgs/applications/version-management/git-and-tools/git/default.nix#L102
Post by Alexander Schmolck via nix-dev
Yes, git filter-branch failing because e.g. sed is either not
installed at all or not in PATH is what I meant.
I wasn't aware that this is "intended behavior", I thought that nix
packages were intended to be self-contained other than explicitly
declared dependencies
The way I ran into this was by building a docker image for a python
application that has a runtime dependency on git with
https://github.com/smarkets/marge/blob/master/dockerize.nix). Most git
commands work fine, but not ones that use the few commands that are
implemented as shell scripts. Pulling in the branch in the PR via
fetchTarball fixes the problem, but what would be the preferred way of
doing this?
alexander
On 10 July 2017 at 18:47, Eelco Dolstra via nix-dev
Post by Eelco Dolstra via nix-dev
Hi,
Post by Alexander Schmolck via nix-dev
... because it appears to be missing dependencies like sed for
commands such as git-filter-branch which are implemented as bash
scripts.
Broken how? What doesn't work?
I guess you mean that some things fail if you execute with a $PATH that doesn't
contain the basic Unix utilities. This is likely the case for most shell code in
Nixpkgs.
--
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/
_______________________________________________
nix-dev mailing list
https://mailman.science.uu.nl/mailman/listinfo/nix-dev
Dmitry Kalinkin via nix-dev
2017-07-10 21:06:49 UTC
Permalink
Same can be achieved with makeWrapper
(http://nixos.org/nixpkgs/manual/#ssec-stdenv-functions)
Also, there is propagatedBuildInputs, but it is limited to Nix build
environment.

On Mon, Jul 10, 2017 at 2:36 PM, Alexander Schmolck via nix-dev
Post by Alexander Schmolck via nix-dev
Yes, git filter-branch failing because e.g. sed is either not
installed at all or not in PATH is what I meant.
I wasn't aware that this is "intended behavior", I thought that nix
packages were intended to be self-contained other than explicitly
declared dependencies
The way I ran into this was by building a docker image for a python
application that has a runtime dependency on git with
https://github.com/smarkets/marge/blob/master/dockerize.nix). Most git
commands work fine, but not ones that use the few commands that are
implemented as shell scripts. Pulling in the branch in the PR via
fetchTarball fixes the problem, but what would be the preferred way of
doing this?
alexander
On 10 July 2017 at 18:47, Eelco Dolstra via nix-dev
Post by Eelco Dolstra via nix-dev
Hi,
Post by Alexander Schmolck via nix-dev
... because it appears to be missing dependencies like sed for
commands such as git-filter-branch which are implemented as bash
scripts.
Broken how? What doesn't work?
I guess you mean that some things fail if you execute with a $PATH that doesn't
contain the basic Unix utilities. This is likely the case for most shell code in
Nixpkgs.
--
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/
_______________________________________________
nix-dev mailing list
https://mailman.science.uu.nl/mailman/listinfo/nix-dev
_______________________________________________
nix-dev mailing list
https://mailman.science.uu.nl/mailman/listinfo/nix-dev
Vladimír Čunát via nix-dev
2017-07-11 04:30:56 UTC
Permalink
Post by Dmitry Kalinkin via nix-dev
Same can be achieved with makeWrapper
(http://nixos.org/nixpkgs/manual/#ssec-stdenv-functions)
Also, there is propagatedBuildInputs, but it is limited to Nix build
environment.
For completeness, propagatedUserEnvPkgs extends that to user/system envs
(docs seem to be missing), though in most cases I personally prefer when
things are runnable from the nix store directly.

--Vladimir

Continue reading on narkive:
Loading...