My system rebuild failed today after a flake update (I’m using unstable). The error referenced r-languageserver, but it is not explicitly included in my configuration. I tried nix why-depends to find out which package needed it, but I got this error:
nix why-depends . r-languageserver
error: flake 'git+file:///home/biscotty/.dotfiles' does not provide attribute 'packages.x86_64-linux.default' or 'defaultPackage.x86_64-linux'
I tried looking around for advice, and I guess I just can’t figure out how (where) to actually add these definitions to my flake. Almost everything I’ve found seems to refer to specific packages, but I need it for my whole system config. My flake can be found at https://github.com/biscotty666/dotfiles-nixos-bw/blob/c9e6d6b3bd7958b6507009f909ac96916504d4c8/flake.nix, but the skeleton is
{
description = "Biscotty's Workshop";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
yazi.url = "github:sxyazi/yazi";
nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=latest";
};
outputs =
{
self,
nixpkgs,
home-manager,
nix-flatpak,
...
}@inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in
{
nixosConfigurations."nixos" = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs; };
modules = [
./configuration.nix
nix-flatpak.nixosModules.nix-flatpak
];
};
homeConfigurations."biscotty" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit inputs; };
modules = [
./biscotty/home.nix
];
};
};
}
I’d appreciate advice on this. Thanks.
To set a default for the system you should add this to the outputs attribute set. This is what I do for one of my flakes.
packages.${system}.default = self.nixosConfigurations.nixos.config.system.build.toplevel;
Alternatively if you do not want to set it permanently you can call nix why-depends with .#nixosConfigurations.nixos.config.system.build.toplevel as an argument.
1 Like
You should use nix-tree (3rd party tool) instead.
Also what is the error? Eval-time or build-time?
1 Like
Thanks. Both solutions worked, in the sense that I can run the command. It doesn’t seem to tell me which package wants r-languageserver, but it does give some indication as to why it is failing (see answer below).
The error is:
❯ nix why-depends . r-languageserver
warning: Git tree '/home/biscotty/.dotfiles' is dirty
error: output '/nix/store/bia0c3vkasj2czyqcpw77340xaxb36l3-r-ps-1.9.3' is not allowed to refer to the following paths:
/nix/store/qrn789mrv652j7f5bcjp367npzpcyvdi-gcc-15.3.0
error: Cannot build '/nix/store/izrj6wddj3p8vf8f4gahc3m708y2ywby-r-processx-3.9.0.drv'.
Reason: 1 dependency failed.
Output paths:
/nix/store/b4ag21gsjpwgc3c5zchy6kb2wp8k5vhb-r-processx-3.9.0
error: Cannot build '/nix/store/ssinwanqphd1krzk4g75vhaddgva33vj-r-callr-3.8.0.drv'.
Reason: 1 dependency failed.
Output paths:
/nix/store/7vfyrl555wcs96w7i1dzcppkxrhj4pwm-r-callr-3.8.0
error: Cannot build '/nix/store/w7qkfnvid4b31w3g73ycw72763hs5ym1-r-pkgload-1.5.3.drv'.
Reason: 1 dependency failed.
Output paths:
/nix/store/iwb76akl27fqag5ijd920dzxxq9wi1iz-r-pkgload-1.5.3
error: Cannot build '/nix/store/l6iglhkja96pg7x54xdav2jvr8pk5ls6-r-languageserver-0.3.18.drv'.
Reason: 1 dependency failed.
Output paths:
/nix/store/6dbgrqvrdm2lmz5236yg3g5faq631vcw-r-languageserver-0.3.18
error: Cannot build '/nix/store/f1m08iis2b1l7xcidizkzfywhgfqg9jp-system-path.drv'.
Reason: 1 dependency failed.
Output paths:
/nix/store/76hpqn951ypcpjhjv42n4drzrmm9l164-system-path
error: Cannot build '/nix/store/x209ickpdvav25xbmm5smn8ji71xh70s-nixos-system-nixos-26.11.20260805.b7c2ada.drv'.
Reason: 1 dependency failed.
Output paths:
/nix/store/x0wxp7dxkc0y2zgziy35r9gffl3zpgbl-nixos-system-nixos-26.11.20260805.b7c2ada
This is the same error I get when I try to build my configuration.
When I use nix-tree and try to search for r-languageserver, nothing comes up. The same is true for the other packages mentioned in the error message, except gcc itself, which does show up. So, for some reason, r-ps can’t see the compiler.
I imagine this will be fixed in the next update, so I’ll just wait for a new build of unstable.
I still can’t figure out what package wants the language server, though, since none of the packages mentioned in the error are actually in my config (except gcc).
I’m totally embarrassed. I was all along searching for r-languageserver, not rPackages.languageserver. Problem solved, thank you all.
2 Likes
What ended up pulling it in? Odd that it would be in system-path, IMO, without manually putting it there.
I was declaring it myself. I just didn’t find it in my configs when I grepped because I was looking for r-languageserver. (Hence my embarrassment on this one, I didn’t think it through.)
2 Likes