Skip to content

Commit

Permalink
shell: workaround locking in to default.nix
Browse files Browse the repository at this point in the history
When supplying a url to nix-shell:

nix-shell https://github/tweag/nickel/archive/master.tar.gz

It does not attempt to load the shell.nix file contained in the tarball, instead only loading default.nix, which fails if it doesn't provide a viable shell.

I would expect the behavior to be consistent with launching from the base of a repository, namely, load shell.nix if it exists, default.nix otherwise.

(see divnix/digga@e2172c8)
  • Loading branch information
573 authored Apr 8, 2021
1 parent d1bf61e commit 9df972f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
let
inherit (default.inputs.nixos.lib) recurseIntoAttrs;

default = (import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
src = builtins.fetchGit ./.;
}).defaultNix
}).defaultNix;
in
builtins.mapAttrs (_: v: recurseIntoAttrs v) default.packages // {
shell = import ./shell.nix;
}

1 comment on commit 9df972f

@573
Copy link
Author

@573 573 commented on 9df972f Apr 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why NIX_PATH=nixpkgs=http://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz nix-shell https://github.com/tweag/nickel/archive/9df972fb9119900198d7f0b21a8e6dc19032decb.tar.gz does not work directly with PR: NixOS/nix#2431 (one might pass import...fetchGit with ref via -E as elaborated here: NixOS/nix#726 (comment) as a workaround)

EDIT: This is probably misleading context. I'm removing it from this PR.

Please sign in to comment.