Skip to content

[BUG]: Default devshell already defined in devenv flake module #58

@TakodaS

Description

@TakodaS

Describe the bug

The option perSystem.x86_64-linux.devenv.shells.default.shell is defined
multiple times when initialized with flake-parts-builder.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Run flake-parts-builder init -p devenv devenv-test/
  2. cd devenv-test/ then run nix flake check --impure (impure because devenv
    requires this)
  3. Get error
error: The option `perSystem.x86_64-linux.devenv.shells.default.shell' is defined multiple times while it's expected to be unique.

       Definition values:
       - In `/nix/store/hckrj09f1c8ixbx0vk2qq4dn0mcv4pa1-source/flake-parts/devenv, via option perSystem': <derivation devenv-shell>
       - In `/nix/store/mfqr8r97n5i9igd9c1g06ij9nx2chxbr-source/src/modules/top-level.nix': <derivation devenv-shell>
       Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions.

Expected behavior

There should be no error

Additional context

Removing the assignment of the dev devshell to default in
flake-parts/devenv/default.nix removes this problem, but we want dev to be
the default devshell.

Debug log

[2025-05-14T07:42:14Z DEBUG flake_parts_builder] color-eyre installed and logger initialized
[2025-05-14T07:42:14Z INFO  flake_parts_builder] Executing init command
[2025-05-14T07:42:14Z INFO  flake_parts_builder::cmd::init] Adding base parts store to `cmd.shared_args.parts_stores`
[2025-05-14T07:42:14Z INFO  flake_parts_builder::cmd::init] Adding bootstrap parts store to `cmd.shared_args.parts_stores`
[2025-05-14T07:42:14Z INFO  flake_parts_builder::cmd::init] Adding _bootstrap to required `cmd.parts`
[2025-05-14T07:42:16Z DEBUG flake_parts_builder::cmd::init] All parts stores: ["github:tsandrini/flake-parts-builder#flake-parts", "github:tsandrini/flake-parts-builder#flake-parts-bootstrap"]
[2025-05-14T07:42:16Z DEBUG flake_parts_builder::cmd::init] User requested parts: ["devenv", "github:tsandrini/flake-parts-builder#flake-parts-bootstrap/_bootstrap"]
[2025-05-14T07:42:16Z DEBUG flake_parts_builder::cmd::init] Resolved dependencies: ["github:tsandrini/flake-parts-builder#flake-parts/systems"]
[2025-05-14T07:42:16Z DEBUG flake_parts_builder::cmd::init] Unresolved dependencies: []
[2025-05-14T07:42:16Z DEBUG flake_parts_builder::cmd::init] All required parts: ["devenv", "github:tsandrini/flake-parts-builder#flake-parts-bootstrap/_bootstrap", "github:tsandrini/flake-parts-builder#flake-parts/systems"]
[2025-05-14T07:42:16Z DEBUG flake_parts_builder::cmd::init] Full user provided path: "/home/austen/dev/flake-parts-builder/test-devenv"
[2025-05-14T07:42:16Z INFO  flake_parts_builder::cmd::init] Preparing new project in a tmpdir at "/tmp/.tmpwJCbWW"
[2025-05-14T07:42:16Z DEBUG flake_parts_builder::cmd::init] Copying the following part into tmpdir: "devenv"
[2025-05-14T07:42:16Z DEBUG flake_parts_builder::cmd::init] Copying the following part into tmpdir: "systems"
[2025-05-14T07:42:16Z DEBUG flake_parts_builder::cmd::init] Copying the following part into tmpdir: "_bootstrap"
[2025-05-14T07:42:16Z DEBUG flake_parts_builder::cmd::init] Removing meta file from tmpdir
[2025-05-14T07:42:16Z INFO  flake_parts_builder::cmd::init] Resetting permissions in tmpdir
[2025-05-14T07:42:16Z INFO  flake_parts_builder::cmd::init] Rendering `flake.nix.template` in tmpdir
[2025-05-14T07:42:16Z INFO  flake_parts_builder::cmd::init] Running nixfmt on flake.nix in tmpdir
[2025-05-14T07:42:16Z INFO  flake_parts_builder::cmd::init] Globally replacing NAMEPLACEHOLDER in tmpdir to name: test-devenv
[2025-05-14T07:42:16Z INFO  flake_parts_builder::cmd::init] Project successfully prepared in tmpdir, now copying to target directory

Add a 👍 [reaction] to [issues you find important].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions