Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix-direnv in the nixos-21.11 channel doesn’t work with flakes #147974

Closed
reckenrode opened this issue Nov 30, 2021 · 5 comments
Closed

nix-direnv in the nixos-21.11 channel doesn’t work with flakes #147974

reckenrode opened this issue Nov 30, 2021 · 5 comments
Labels
0.kind: bug Something is broken
Milestone

Comments

@reckenrode
Copy link
Contributor

Describe the bug

nix-direnv was updated in #145236 to assume that nix is 2.4, but that is no longer true after #147511 was merged. This causes .envrc files with use flake to fail to active the devShell.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Make sure your system is running NixOS 21.11 or is nix-darwin following the nixos-21.11 channel;
  2. git clone https://github.com/reckenrode/verify-archive.git (or any project with a flake); and
  3. cd verify-archive && direnv allow.

Expected behavior

The devShell specified in the flake is activated.

Screenshots

reckenrode@dyrstelice ~/D/verify-archive (main)> direnv allow
direnv: loading ~/Developer/verify-archive/.envrc
direnv: using flake
error: 'print-dev-env' is not a recognised command
Try '/nix/store/sbf432gsiw41ri4nqgrnxhvhbb9gidx4-nix-2.3.16/bin/nix --help' for more information.
error: 'flake' is not a recognised command
Try '/nix/store/sbf432gsiw41ri4nqgrnxhvhbb9gidx4-nix-2.3.16/bin/nix --help' for more information.
direnv: renewed cache
direnv: export ~XDG_DATA_DIRS

Additional context

Overriding nix in an overlay with nix_2_4 allows the flake to activate the devShell as expected.

Notify maintainers

@Mic92

Metadata

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

reckenrode@dyrstelice ~> nix-shell -p nix-info --run "nix-info -m"
 - system: `"aarch64-darwin"`
 - host os: `Darwin 21.1.0, macOS 12.0.1`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.4`
 - channels(root): `""`
 - nixpkgs: `/etc/nix/inputs/nixpkgs`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: nix-direnv
# a list of nixos modules affected by the problem
module:
@reckenrode reckenrode added the 0.kind: bug Something is broken label Nov 30, 2021
Mic92 added a commit to Mic92/nixpkgs that referenced this issue Nov 30, 2021
@Mic92
Copy link
Member

Mic92 commented Nov 30, 2021

This is only for nixpkgs. There was also a home-manager module option that needs to be re-introduced: #147998

@SenchoPens
Copy link
Contributor

Hi, had the same problem too, just updated and everything is fine, seems like it's fixed now. @reckenrode

@Mic92
Copy link
Member

Mic92 commented Dec 5, 2021

Yes. This was fixed in the linked pull requests.

@Mic92 Mic92 closed this as completed Dec 5, 2021
@mainrs
Copy link

mainrs commented Dec 27, 2021

I'm using flakes for my configuration and I still exhibit the problem with these fixed inputs:

inputs = {
    home-manager.url = "github:nix-community/home-manager?ref=release-21.11";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";
    nixpkgs.url = "github:NixOS/nixpkgs?ref=release-21.11";
    nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
    nixops-plugged.url = "github:lukebfox/nixops-plugged";
    flake-utils.url = "github:numtide/flake-utils";
    nur.url = "github:nix-community/NUR";
  };
Inputs:
├───flake-utils: github:numtide/flake-utils/74f7e4319258e287b0f9cb95426c9853b282730b
├───home-manager: github:nix-community/home-manager/697cc8c68ed6a606296efbbe9614c32537078756
│   └───nixpkgs follows input 'nixpkgs'
├───nixops-plugged: github:lukebfox/nixops-plugged/d063dfc2a1ab3d62529716626b64964592230077
│   ├───flake-compat: github:edolstra/flake-compat/99f1c2157fba4bfe6211a321fd0ee43199025dbf
│   ├───flake-utils: github:numtide/flake-utils/b543720b25df6ffdfcf9227afafc5b8c1fabfae8
│   ├───nixpkgs: github:nixos/nixpkgs/efee454783c5c14ae78687439077c1d3f0544d97
│   └───poetry2nix: github:nix-community/poetry2nix/a5d82ecb020e6c058c0a515520a4e22133278b92
│       ├───flake-utils: github:numtide/flake-utils/3982c9903e93927c2164caa727cd3f6a0e6d14cc
│       └───nixpkgs: github:NixOS/nixpkgs/04af07c659c6723a2259bb6bc00a47ec53330f20
├───nixpkgs: github:NixOS/nixpkgs/d887ac7aee92e8fc54dde9060d60d927afae9d69
├───nixpkgs-unstable: github:NixOS/nixpkgs/5c37ad87222cfc1ec36d6cd1364514a9efc2f7f2
└───nur: github:nix-community/NUR/353ba5a371a0ebed815366b083d24caff3bc1582

Is this expected? Or am I doing something wrong?

@mainrs
Copy link

mainrs commented Dec 30, 2021

Looks like it was a configuration problem (nix-community/nix-direnv#122). Enabling programs.direnv.nix-direnv.enableFlakes=true solved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

5 participants