Unable to install st fork from home-manager

So the title is self explanatory, whenever i tried to run home-manager switch i got this

git submodule init
make: git: No such file or directory
make: *** [Makefile:43: install] Error 127
builder for '/nix/store/mx1q76ir4slh3smp01rhm313xpjka7ii-st-0.8.4.drv' failed with exit code 2
cannot build derivation '/nix/store/ci6fk6fwmji3xz594azngl8lzynygb9d-home-manager-path.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/3c2xf6wrm73mfp4nx1x4s3zbiibmcjql-home-manager-generation.drv': 1 dependencies couldn't be built
error: build of '/nix/store/3c2xf6wrm73mfp4nx1x4s3zbiibmcjql-home-manager-generation.drv' failed

doing more research i found using nix-shell that it fails in the installPhase here the output:

mkdir: cannot create directory ‘/nix/store/p1ps31l923amv0ygqpj2jc2gjh5jz6zs-st-0.8.4’: Read-only file system
install flags: SHELL=/nix/store/3xp6zj3gj0qwgz7nq2wcslwvak493srs-bash-interactive-4.4-p23/bin/bash PKG_CONFIG=pkg-config install
make: *** No rule to make target 'install'.  Stop.

and this is how i’ve home manager setup:

home.packages = with pkgs; [
  (st.overrideAttrs (oldAttrs: rec {
    buildInputs = oldAttrs.buildInputs ++ [ harfbuzz ];
    src = builtins.fetchTarball {
    url = "https://github.com/lukesmithxyz/st/archive/master.tar.gz";

How can i fix this? :confused:

home-manager still pulls the package set from nixpkgs.

st builds currently on unstable

[13:14:38] jon@nixos ~/projects/nixpkgs (nixos-unstable)
$ nix-build -A st

Do you mind checking your channels and their status?

nix-shell -p nix-info --run "nix-info -m"

Should get something like:

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.81, NixOS, 22.05 (Quokka)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.5pre20211126_55275fc`
 - channels(root): `"nixos-22.05pre335103.6daa4a5c045"`
 - channels(jon): `"home-manager, nixos-22.05pre335103.6daa4a5c045"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

You may need to sudo nixos-channel --update if your ownly nixpkgs channel is from root.

Hi thanks for you answer, here is the output of:

nix-shell -p nix-info --run "nix-info -m"

 - system: `"x86_64-linux"`
 - host os: `Linux 5.13.13-zen1, NixOS, 21.05.4381.3bea86e918d (Okapi)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.16`
 - channels(MyUser): `"home-manager"`
 - channels(root): `"home-manager, nixos-21.05.4381.3bea86e918d"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

I only have home-manager in the ouput of nixos-channel i also tried running nix-channel --update

nix-channel --list                                                                                                                                                          ~
home-manager https://github.com/nix-community/home-manager/archive/master.tar.gz

Your user is inheriting from the root’s channel.

I would do:

sudo nix-channel --update
home-manager switch

st builds on the latest nixos-21.05

[13:45:12] jon@jon-desktop /home/jon/projects/nixpkgs (nixos-21.05)
$ nix-build -A st

I think i mess up my channels, and that’s why is not working, how can i configure my channels like yours?

Technically, the only difference is my root user is following nixos-unstable instead of 21.05.

If you do want to follow nixos-unstable, you can do:

sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos
sudo nix-channel --update

Which will update the reference, then update the channel checkout.

Note: this will be “upgrading” your system next time you do sudo nixos-rebuild. You may want to instead follow 21.11 where you’re less likely to get into further “something is broken in nixpkgs” situations.

The makefile of that fork tries to setup git submodules when installing:

So if you provide git as a nativeBuildInput it will fail with errors about network not being available.

To be able to build that certain fork you probably need to do more involved override that either patches the makefile and provides the modules by other means, or make it a FOD, which though might be problematic with following master.

Last but not least, you probably do not want to follow master that way, but instead provide a fixed commit.

1 Like

Thanks for you answer, i’m new to nix ecosystem in general, could you please indicate which could be a good way to start aproaching this issue?,

The easiest thing is probably to use a different fork or patchset for st.

One that does not require network access for installation.

When I’m back at a computer I might take a closer look why it does the git submodule thing on installation only, but not for building. This feels weird…

That sound pretty weird, i’m gonna try out with the vanilla version and see what happens

The repository doesn’t even have submodules configured… So patching them out might resolve the issue.

Using the following patch might solve that problem, while at the same time might introduce new ones, I can’t currently check.

diff --git a/Makefile b/Makefile
index 0e9d2d9..02045f0 100644
--- a/Makefile
+++ b/Makefile
@@ -40,8 +40,6 @@ dist: clean
        rm -rf st-$(VERSION)
 install: st
-       git submodule init
-       git submodule update
        mkdir -p $(DESTDIR)$(PREFIX)/bin
        cp -f st $(DESTDIR)$(PREFIX)/bin
        cp -f st-copyout $(DESTDIR)$(PREFIX)/bin

Thanks, that works :smile:

Oh, didn’t realize you were working from a fork. My bad.

adding fetchSubmodules = true; to the fetcher, and then adding git in nativeBuildInputs should have also worked; as the makeFile commands would have been a noop at that point.

Good to know, i would try your approach next time, thanks for the help anyway :stuck_out_tongue_winking_eye:

Also: is worth mentioning that someone should update the wiki article about this topic to avoid confusion in the near future