How can you expose pkgs in the outputs? #297
Answered
by
roberth
Nebucatnetzer
asked this question in
Q&A
-
|
I recently started to re-expose pkgs in the flakes output. |
Beta Was this translation helpful? Give feedback.
Answered by
roberth
Jul 21, 2025
Replies: 1 comment 1 reply
-
|
Try importing this module: { config, lib, withSystem, ... }: {
_class = "flake"; # imports checking, optional
flake.pkgsYolo = withSystem "x86_64-linux" ({ pkgs, ... }: pkgs );
flake.pkgs = lib.mapAttrs
(system: config:
# module arguments don't appear in config, so we use withSystem
withSystem system ({ pkgs, ... }: pkgs)
)
config.allSystems;
}nix-repl> pkgs.x86_64-linux.hello
«derivation /nix/store/krmi4k907lh3wfrw3kr5w30ydwhnzrvw-hello-2.12.2.drv»
nix-repl> pkgsYolo.hello
«derivation /nix/store/krmi4k907lh3wfrw3kr5w30ydwhnzrvw-hello-2.12.2.drv»or if you want to be fancy about it and distribute a module that does stuff like this, you could declare an option for |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Nebucatnetzer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try importing this module:
or if you want to be fancy about it and distribute a module that does stuff like this, you could declare an op…