(flox v0.2.0-r474) When flox develop
ing a project I want to use packages from nixpkgs 22.11 channel with backports.
But flox tells me this:
...
• Updated input 'flox-floxpkgs/nixpkgs/nixpkgs':
follows 'flox-floxpkgs/nixpkgs/nixpkgs-stable'
→ 'github:flox/nixpkgs/60c1d71f2ba4c80178ec84523c2ca0801522e0a6' (2023-03-19)
...
i.e. an older nixpkgs version that does not include specific backports. How can I let flox re-use the nixpkgs that my system uses? Should this be set in shells/<project>/default.nix
and if so what is the recommended way?
1 Like
Right now I believe it’s necessary to use inline dependency declarations for anything that isn’t using the flox-floxpkgs/nixpkgs
input. We have plans to improve this in the future, but this should work for you in the mean time:
$ flox edit -e my-env;
# Write your inline package like this.
# Replace that `rev' with whatever you'd like.
{
inline.packages.terraform = { system, ... }: let
nixpkgs = builtins.getFlake
"github:NixOS/nixpkgs/f8f124009497b3f9908f395d2533a990feee1de8";
in nixpkgs.legacyPackages.${system}.terraform;
}
Any time I think I grokked the *.nix, soon there comes something I want to do that does not fit quite right. I am using ./shells/test-project/default.nix
with these contents:
{
mkShell,
stdenv,
zlib,
pkgs,
llvmPackages_16,
}:
mkShell {
nativeBuildInputs = with pkgs; [
cmake
gdb
libxml2
ninja
qemu
wasmtime
zlib
] ++ (with llvmPackages_16; [
clang
clang-unwrapped
lld
llvm
]);
hardeningDisable = [ "all" ];
shellHook = ''
echo "setting shell hooks to include zig compiled from source"
...
'';
}
so how would I use your snippet with that?
edit: I am using .envrc with flox (. <(flox print-dev-env)
) and when I cd
-ed into the project dir just now it updated nixpkgs automatically…
...
warning: not writing modified lock file of flake 'git+file:///home/fps/dev/ziglings':
• Updated input 'flox-floxpkgs/nixpkgs/nixpkgs':
follows 'flox-floxpkgs/nixpkgs/nixpkgs-stable'
→ 'github:flox/nixpkgs/7084250df3d7f9735087d3234407f3c1fc2400e3' (2023-05-22)
...
So it works now, I don’t know why it did not update last time I tried.