Skip to content

Support flake in a subdir of src #89

@deemp

Description

@deemp

Context

I have a project where I have two flakes:

  • ./flake.nix
  • ./nix-dev/flake.nix

./flake.nix uses inputs from ./nix-dev/flake.nix:

./nix-dev/flake.nix accesses files in ./ via the path:../ input:

Problem

In the current flake-compat implementation, the src coincides with rootSrc.

Therefore, if I set src to ./nix-dev, I get an error

 at /nix/store/ndslvddkj5h37rn09ccnk9s8bzydcz3z-nix-dev/flake.nix:44:24:
           43|       parent = inputs.parent.outPath;
           44|       systemPlatform = import "${parent}/nix/systemPlatform.nix";
             |                        ^
           45|       systems = builtins.attrNames systemPlatform;

       error: access to absolute path '/nix/store/nix/systemPlatform.nix' is forbidden in pure evaluation mode (use '--impure' to override)

Solution

Introduce an additional argument to the main function in default.nix that will let a user specify the "root" within src, i.e. where the flake.nix is within src.

This suggestion is implemented in #90.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions