Skip to content

Commit 4e446c6

Browse files
committed
allow importing files from inputs
1 parent 84ce563 commit 4e446c6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

devenv/src/flake.tmpl.nix

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,14 @@
5050
name = builtins.head paths;
5151
input = inputs.${name} or (throw "Unknown input ${name}");
5252
subpath = "/${lib.concatStringsSep "/" (builtins.tail paths)}";
53-
devenvpath = "${input}" + subpath + "/devenv.nix";
53+
devenvpath = "${input}" + subpath;
54+
devenvdefaultpath = filepath + "/devenv.nix";
5455
in
55-
if builtins.pathExists devenvpath
56-
then devenvpath
57-
else throw (devenvpath + " file does not exist for input ${name}.");
56+
if lib.hasSuffix ".nix" devenvpath
57+
then filepath
58+
else if builtins.pathExists devenvdefaultpath
59+
then devenvdefaultpath
60+
else throw (devenvdefaultpath + " file does not exist for input ${name}.");
5861
project = pkgs.lib.evalModules {
5962
specialArgs = inputs // { inherit inputs pkgs; };
6063
modules = [

0 commit comments

Comments
 (0)