-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
Open
Labels
0.kind: enhancementAdd something new or improve an existing system.Add something new or improve an existing system.2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.mdhttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: haskellGeneral-purpose, statically typed, purely functional programming languageGeneral-purpose, statically typed, purely functional programming language
Description
Hey 👋
I've recently migrated a project from haskell.nix to nixpkgs/cabal2nix.
One thing I found quite useful in haskell.nix was the ability to directly reference executables, test executables and benchmark executables, e.g.:
Cabal:
executable my-package-foo
main-is: MyPackageFoo.hs
executable my-package-bar
main-is: MyPackageBar.hsmy-package-foo = my-package.exes.my-package-foo
my-package-bar = my-package.exes.my-package-barI had a look at fromPackageDescription, as well as the Pretty instance of Derivation,
and I think it wouldn't be too hard to generate something like this:
mkDerivation {
# ...
passthru = {
executables = {
my-package-foo = haskell.lib.compose.setBuildTarget "my-package-foo" my-package;
my-package-bar = haskell.lib.compose.setBuildTarget "my-package-foo" my-package;
};
testExecutables = {
my-package-foo-spec = haskell.lib.compose.setBuildTarget "my-package-foo-spec" my-package;
my-package-bar-integration = haskell.lib.compose.setBuildTarget "my-package-bar-intergration" my-package;
};
benchExecutables = # ...
};
}What do you think?
Am I missing something? Would you consider this a useful feature?
An obvious downside would be the need for my-package to be passed in via callPackage.
This could be mitigated by providing executable names instead of derivations.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
0.kind: enhancementAdd something new or improve an existing system.Add something new or improve an existing system.2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.mdhttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: haskellGeneral-purpose, statically typed, purely functional programming languageGeneral-purpose, statically typed, purely functional programming language