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 };
flake-utils.lib.eachDefaultSystem
( system:
let
pkgs = import nixpkgs {
inherit system;
};
in
{
packages.foo = pkgs.mkShell {
# ...
};
# usually there is an error on the line below
packages.default = self.packages.foo;
};
);
}
Usually when running nix build
there is an error saying something like
attribute 'foo' missing
Is there any way to do this?
Thanks