illegal path references in fixed-output derivation
When trying to set up a minecraft server for the new year I wanted to give flux a try as it looks very promising. However, I quickly faced the error: illegal path references in fixed-output derivation which has proven to be a huge headache.
As far as I understand, the server derivation has to be "fixed-output" as mcman fetches packages in the build phase. So the issue that persists is what references other Nix paths and why. Since the error itself is poorly explained and documented I tried fixing this for quite some time and although I could not fix it I could find which files contain these references. Namely,
- start.sh
- run.sh
- forge-1.20.1-47.3.22-installer.jar.log
- libraries/net/minecraftforge/forge/1.20.1-47.3.22/unix_args.txt
- libraries/net/minecraftforge/forge/1.20.1-47.3.22/win_args.txt and potentially others if you use another mod loader.
This seems like unintended behaviour since the readme mentions nothing of it. If this is a previously known issue maybe mod support should be specifically listed in the TODO section?
Could you provide the mix code you are using to build the server?
This is unexpected behavior.
Heres a flake that builds just the server, the issue is identical in a (my) system config. https://github.com/Strosel/mc3/blob/5b002b19e2c3c90dd1ac3c05037917e321a9ad01/flake.nix
Same issue. I don't know what to do.
The reason this error is present is because the files you have in the fixed output derivation contain a path to the nix store.
You have your server files in the same dir as the flake and lockfile.
So ideally you would just put your server files into a subdirectory and change the package to point to the subdir. I think this is the issue
Sadly, subdirectories do not solve the issue and from my rudimentary research it seems that mcman is the one pointing to store paths in its output (although I am not sure)
The reason this error is present is because the files you have in the fixed output derivation contain a path to the nix store.
You have your server files in the same dir as the flake and lockfile.
So ideally you would just put your server files into a subdirectory and change the package to point to the subdir. I think this is the issue
This would easily be the one of (if not the) best solution for minecraft servers on Nix if this gets fixed
[root@Fruit:/etc/nixos/Fruit]# nixos-rebuild switch building the system configuration... warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=' error: illegal path references in fixed-output derivation '/nix/store/4nbzsgkmfkm40jyz0k5acsq54c235l7s-modpack-build.drv' error: 1 dependencies of derivation '/nix/store/z6f0nkdcw6l17fpa175w7lfyrxrnhpbm-modpack-runtime.drv' failed to build error: 1 dependencies of derivation '/nix/store/ga3dliijx22g9iv8rzj6a8xgwgh37ifn-modpack-usr-target.drv' failed to build error: 1 dependencies of derivation '/nix/store/svrqj0lpqgq8zs1g7ah1nbnisdcmy109-modpack-fhs.drv' failed to build error: 1 dependencies of derivation '/nix/store/4caqzy2z55w64n2vgr4ri4gjrc1sms8c-modpack-bwrap.drv' failed to build error: 1 dependencies of derivation '/nix/store/rcc5qgqpmfy08608fl3r3bmvgljzwyr4-modpack.drv' failed to build error: 1 dependencies of derivation '/nix/store/62iaza53zynxklpypc8lzc68xjg9asx9-unit-script-modpack-start.drv' failed to build error: 1 dependencies of derivation '/nix/store/ii0rspvmvry45j51v2scbw8zvfhj67a3-unit-modpack.service.drv' failed to build error: 1 dependencies of derivation '/nix/store/dcx6zcj8zky7q9pd18iagvjn1k8pvnf0-system-units.drv' failed to build error: 1 dependencies of derivation '/nix/store/8pb0gcdw5ddl9c1m6rj9mdmlp8n5m9ny-etc.drv' failed to build error: 1 dependencies of derivation '/nix/store/mzgf98b5466f8qx7mmk29rfh4xnbw1dn-nixos-system-Fruit-24.05.20241227.31ac92f.drv' failed to build
{ pkgs, inputs, ... }:
{
imports = [ inputs.flux.nixosModules.default ];
environment.systemPackages = with pkgs; [ mcman ];
nixpkgs.overlays = [ inputs.flux.overlays.default ];
flux = {
enable = true;
servers = {
modpack = {
package = pkgs.mkMinecraftServer {
name = "modpack";
src = ./minecraft-servers/modpack;
hash = "";
};
};
};
};
}
Sadly, subdirectories do not solve the issue and from my rudimentary research it seems that mcman is the one pointing to store paths in its output (although I am not sure)
Doing a velocity instance seems fine for some reason. I installed plugins on it like you would on Forge
Doing a velocity instance seems fine for some reason. I installed plugins on it like you would on Forge
Could you share the flake/derivation that worked? I'm not super savvy with mods but velocity uses plugins not mods right? So the issue could be caused by the choice of platform/modloader which would be a shame.
It's like you did but i declared velocity and added the plugins like you would imnport on forge
The last line is interesting... checking for references to /build/ in /nix/store/prwmfz3lh7c8yf5kdswys2hlpx8fr12i-modpack-build...
Fabric also seems fine?
But yeah, something's going on iwth forge
Interesting
For what it's worth, I'm having the exact same issue
When trying to set up a minecraft server for the new year I wanted to give flux a try as it looks very promising. However, I quickly faced the
error: illegal path references in fixed-output derivationwhich has proven to be a huge headache.As far as I understand, the server derivation has to be "fixed-output" as
mcmanfetches packages in the build phase. So the issue that persists is what references other Nix paths and why. Since the error itself is poorly explained and documented I tried fixing this for quite some time and although I could not fix it I could find which files contain these references. Namely,* start.sh * run.sh * forge-1.20.1-47.3.22-installer.jar.log * libraries/net/minecraftforge/forge/1.20.1-47.3.22/unix_args.txt * libraries/net/minecraftforge/forge/1.20.1-47.3.22/win_args.txt and potentially others if you use another mod loader.This seems like unintended behaviour since the readme mentions nothing of it. If this is a previously known issue maybe mod support should be specifically listed in the TODO section?
Funnily enough these files (namely *_args.txt) are now missing on old forge versions too, although it won't prevent your minecraft instance from building.
News here, Nix now reports what's wrong:
fixed-output derivations must not reference store paths
And given that you use two separate derivations and you use the path of one of them (instead of passing it in as a function input) is probably the culprit.
I'll see if I can fix it up.
patchELF is at fault FYI
Disabled patchELF, errors at installPhase
