Could someone please help me re-write this flake? I’m getting this message
`Dependency of package ‘nix-shell’ uses a nested list in attribute ‘buildInputs’. This is deprecated as of Nixpkgs release 26.05, and support will be removed in a future nixpkgs release.`
This is the kind of flake I’m using.
{
description = "A basic flake with a shell";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/25.11";
systems.url = "github:nix-systems/default";
flake-utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};
};
outputs =
{ nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = pkgs.mkShell {
nativeBuildInputs = [ pkgs.bashInteractive ];
buildInputs = with pkgs; [
R
quarto
chromium
pandoc
texlive.combined.scheme-medium
rstudio
(with rPackages; [
quarto
tidyverse
])
];
};
}
);
}
I believe the error comes from the (with rPackages…) part. I thought I could do something like the following, but it doesn’t work, it doesn’t like the second with.
buildInputs = with pkgs; [
R
quarto
chromium
pandoc
texlive.combined.scheme-full
rstudio
] ++
with pkgs.rPackages; [
quarto
tidyverse
]
];
I tried wrapping the second section in parentheses, but then it complains about a missing ; Could someone help me please? (Also, any general comments on the flake structure are appreciated. I’ve been copying and pasting for years.)
Your suspicion is right, and the second version should work once parenthesisized.
Though even better is to just not use with.
Also you might want to prefer packages over *Inputs. Your complete buildInputs list looks as if it is usually better tailored to the nativeBuildInputs list.
And to avoid this confusion in the first place, packages is recommended for mkShell.
Personally I use the former, but the latter is definitely seeing more active development. I’m considering trying out nixd again since some features I was looking for have been added.
Just since you’re calling the syntax opaque; I find it no more opaque than any other programming language, but good tooling definitely helps.
Sorry, I know it’s just me. For some reason I just have trouble grokking the nix language. TBF, I don’t use it much, so that’s on me. My main languages now are R, Python and Haskell, all of which seemed so clear and natural from the get go. Again, it’s just personal.
I didn’t realize that nil was the lsp for nix, lol. I had looked for one in my Mason (neovim) list, and it wasn’t obvious. Anyway, I’ve installed in now, thanks!