Set flake default package to another package

Hey all, I have a simple question, I feel like i’ve seen it done.

How do I set the default package in a flake output to a package elsewhere in the flake?

It might not be possible maybe but I thought I could do something like this:

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/release-23.05";
    flake-utils.url = "github:numtide/flake-utils";
  outputs = { self, nixpkgs, flake-utils };
    ( system:
        pkgs = import nixpkgs {
          inherit system;
      { = pkgs.mkShell {
             # ...

          # usually there is an error on the line below
          packages.default =;

Usually when running nix build there is an error saying something like

attribute 'foo' missing

Is there any way to do this?


I believe it should be packages.default = self.packages.${system}.foo;

1 Like

:pray: Thanks, that makes sense!