NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.5k stars 13.68k forks source link

Build failure: plausible #220178

Closed jonaslanglotz closed 1 year ago

jonaslanglotz commented 1 year ago

Steps To Reproduce

Steps to reproduce the behavior:

  1. build a system configuration with plausible as a service (I'm on NixOS 22.11)

Build log

https://gist.github.com/jonaslanglotz/57e0dd20303ab4c3e6586a4ad96dc4ee

Additional context

I'm new to Nix, so I can't make the changes myself, but I've analyzed the issue and have found the problem.

The issue is that when the package was made, nodejs included an older npm version (<9) which still had the npm bin command. This has been removed in newer nodejs versions however. This causes an error, because npm bin is used in the repository of plausible (atleast for the version that is pinned here). It can either be fixed by using an older nodejs package, using a newer version of the plausible repository or not using the deploy script from the repository and instead calling webpack manually using npm exec.

Notify maintainers

Unfortunately, there are currently no maintainers. @Ma27 was originally a maintainer, but has removed himself.

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.97, NixOS, 22.11 (Raccoon), 22.11.git.47c00341629M`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.11.1`
 - channels(jonaslanglotz): `"home-manager"`
 - channels(root): `"nixos-22.11"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
jonaslanglotz commented 1 year ago

I'd be willing to help here in some capacity, but as I've said I'm new to Nix, so I would atleast need some guidance.

I feel there are two ways of going forward here: either updating the package to not use npm bin while still pinning the same underlying version of plausible OR updating the package to use a newer version of plausible, which would mitigate the issue.

With the first solution, I'm not sure what would happen with the version number. Would it stay the same, basically applying a fix for the already released version so it works again? Or would the version be incremented to something else (1.4.4.2?) to reflect the change, with the already published version remaining in a broken state?

It would be helpful if someone with more experience could comment on this topic, or atleast point me in the right direction. I saw some stuff in the docs about backporting, but I'm not sure if this applies here.

kirillrdy commented 1 year ago

@jonaslanglotz can you test https://github.com/NixOS/nixpkgs/pull/220246

jonaslanglotz commented 1 year ago

Hey, thank you for working on this. Unfortunately, it does not seem to be working for me. Behaviour is as before. I ran sudo nixos-rebuild test -I nixkpgs=<path to your repo> --fast on your branch.

Generated plausible app

> deploy
> $(npm bin)/webpack --mode production

sh: line 1: Unknown: command not found
error: builder for '/nix/store/37k02mm310ivaqd6qwbw4yzmkmspbfhy-plausible-1.4.4.drv' failed with exit code 127
error: 1 dependencies of derivation '/nix/store/x6kpb1f2s9fnh1dwb4dwqz6nx59xgcp4-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/yavwz00wb2kwqnpi9500pxdg3dif1ajw-unit-script-plausible-start.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ylpz6ac07m2i5m5g4g8w269jhx9k9hyw-dbus-1.drv' failed to build
error: 2 dependencies of derivation '/nix/store/mdfaz03v1gimh9bzy5vy8i46vvx94mkw-unit-plausible.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/2f9ay8jxvymp9b17493k0ia3dmksr24w-unit-polkit.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/l1z686r0jqy1z5nyrahaf15qz1d2k1xd-unit-systemd-fsck-.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/086vnjxa9vwq6mxlnxf3jrk6q3l36bps-unit-dbus.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/hvd7qv09390gdjcrfmy5xqgvnp9i39ip-unit-dbus.service.drv' failed to build
error: 4 dependencies of derivation '/nix/store/s30rh6fxrshzdyalmw3nkdlqip9ll73v-system-units.drv' failed to build
error: 1 dependencies of derivation '/nix/store/5dxyixf9zl5nghkfq6ra87rqy85a04zn-user-units.drv' failed to build
error: 4 dependencies of derivation '/nix/store/7hiab3348fm7whi2jqjbbk52kv991gvm-etc.drv' failed to build
error: 2 dependencies of derivation '/nix/store/rqqky25j3cq69s9mhk0d50lypmykn570-nixos-system-nix-22.11.2979.47c00341629.drv' failed to build
kirillrdy commented 1 year ago

Hey, thank you for working on this. Unfortunately, it does not seem to be working for me. Behaviour is as before. I ran sudo nixos-rebuild test -I nixkpgs=<path to your repo> --fast on your branch.

Generated plausible app

> deploy
> $(npm bin)/webpack --mode production

sh: line 1: Unknown: command not found
error: builder for '/nix/store/37k02mm310ivaqd6qwbw4yzmkmspbfhy-plausible-1.4.4.drv' failed with exit code 127
error: 1 dependencies of derivation '/nix/store/x6kpb1f2s9fnh1dwb4dwqz6nx59xgcp4-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/yavwz00wb2kwqnpi9500pxdg3dif1ajw-unit-script-plausible-start.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ylpz6ac07m2i5m5g4g8w269jhx9k9hyw-dbus-1.drv' failed to build
error: 2 dependencies of derivation '/nix/store/mdfaz03v1gimh9bzy5vy8i46vvx94mkw-unit-plausible.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/2f9ay8jxvymp9b17493k0ia3dmksr24w-unit-polkit.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/l1z686r0jqy1z5nyrahaf15qz1d2k1xd-unit-systemd-fsck-.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/086vnjxa9vwq6mxlnxf3jrk6q3l36bps-unit-dbus.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/hvd7qv09390gdjcrfmy5xqgvnp9i39ip-unit-dbus.service.drv' failed to build
error: 4 dependencies of derivation '/nix/store/s30rh6fxrshzdyalmw3nkdlqip9ll73v-system-units.drv' failed to build
error: 1 dependencies of derivation '/nix/store/5dxyixf9zl5nghkfq6ra87rqy85a04zn-user-units.drv' failed to build
error: 4 dependencies of derivation '/nix/store/7hiab3348fm7whi2jqjbbk52kv991gvm-etc.drv' failed to build
error: 2 dependencies of derivation '/nix/store/rqqky25j3cq69s9mhk0d50lypmykn570-nixos-system-nix-22.11.2979.47c00341629.drv' failed to build

can you provide exact commands you used to get right version of nixpkgs, including full command for nixos-rebuild

jonaslanglotz commented 1 year ago

Sure.

cd projects
mkdir kirillrdy
cd kirillrdy
git clone git@github.com:kirillrdy/nixpkgs.git
git checkout plausible
sudo nixos-rebuild test -I nixkpgs=/home/jonaslanglotz/projects/kirillrdy/nixpkgs --fast

My config for plausible looks like this:

{config, pkgs, lib, ...}:

{
  services.plausible = {
    enable = true;

    releaseCookiePath = "/run/secrets/plausible-release-cookie";

    adminUser = {
      activate = true;
      email = "admin@localhost";
      passwordFile = "/run/secrets/plausible-admin-passwd";
    };

    server = {
      baseUrl = "http://localhost";
      port = 9010;
      secretKeybaseFile = "/run/secrets/plausible-secret-key";
    };
  };
}
kirillrdy commented 1 year ago

there is a typo

sudo nixos-rebuild test -I nixkpgs=/home/jonaslanglotz/projects/kirillrdy/nixpkgs --fast

should be -I nixpkgs

jonaslanglotz commented 1 year ago

Ahh, sorry. With the correct command the build works now. Thank you.

I'm still getting another error when the unit is actually started, but it seems unrelated and probably has something to do with my config.

kirillrdy commented 1 year ago

@jonaslanglotz were you successful at starting plausible ? if so could you share your configuration ?