Skip to content

Commit

Permalink
allow importing files from inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
domenkozar committed Mar 22, 2024
1 parent 84ce563 commit 4e446c6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions devenv/src/flake.tmpl.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,14 @@
name = builtins.head paths;
input = inputs.${name} or (throw "Unknown input ${name}");
subpath = "/${lib.concatStringsSep "/" (builtins.tail paths)}";
devenvpath = "${input}" + subpath + "/devenv.nix";
devenvpath = "${input}" + subpath;
devenvdefaultpath = filepath + "/devenv.nix";
in
if builtins.pathExists devenvpath
then devenvpath
else throw (devenvpath + " file does not exist for input ${name}.");
if lib.hasSuffix ".nix" devenvpath
then filepath
else if builtins.pathExists devenvdefaultpath
then devenvdefaultpath
else throw (devenvdefaultpath + " file does not exist for input ${name}.");
project = pkgs.lib.evalModules {
specialArgs = inputs // { inherit inputs pkgs; };
modules = [
Expand Down

0 comments on commit 4e446c6

Please sign in to comment.