- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 159
hackage2nix: add excluded-packages config option #667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| I'm currently experimenting with this in Nixpkgs and I'm confused about something: When I remove a package that is used by others, then in some cases hackage2nix / cabal2nix behave differently than in others: 
 Two random examples. I excluded    "caldims" = callPackage
    ({ mkDerivation, base, containers, directory, haskell98, mtl
     , parsec, readline
     }:
     mkDerivation {
       pname = "caldims";
       version = "0.1.0";
       sha256 = "0mlgxghah8mw0v17rywfj190kmc4jajpmjpgkpgfxdqzw8djyph0";
       isLibrary = true;
       isExecutable = true;
       libraryHaskellDepends = [
         base containers directory haskell98 mtl parsec readline
       ];
       executableHaskellDepends = [
         base containers directory haskell98 mtl parsec readline
       ];
       description = "Calculation tool and library supporting units";
       license = "GPL";
       hydraPlatforms = lib.platforms.none;
       mainProgram = "caldims";
       broken = true;
     }) {haskell98 = null;};haskell98 is passed as    "accelerate-fft" = callPackage
    ({ mkDerivation, accelerate, accelerate-llvm
     , accelerate-llvm-native, accelerate-llvm-ptx, base, bytestring
     , carray, containers, cuda, cufft, fft, file-embed, hashable
     , hedgehog, lens-accelerate, mtl, tasty, tasty-hedgehog
     , unordered-containers
     }:
     mkDerivation {
       pname = "accelerate-fft";
       version = "1.3.0.0";
       sha256 = "1a7cwzbs8r3rvaymrq2kfx83lqb3i7wz0gmz3ppz59f40rxn974x";
       libraryHaskellDepends = [
         accelerate accelerate-llvm accelerate-llvm-native
         accelerate-llvm-ptx base bytestring carray containers cuda cufft
         fft file-embed hashable lens-accelerate mtl unordered-containers
       ];
       testHaskellDepends = [
         accelerate accelerate-llvm-native accelerate-llvm-ptx base hedgehog
         tasty tasty-hedgehog
       ];
       description = "FFT using the Accelerate library";
       license = lib.licenses.bsd3;
       hydraPlatforms = lib.platforms.none;
       broken = true;
     }) {lens-accelerate = null;};
 Why is that? @sternenseemann any insight? | 
| I would need to investigate, too. Possible that this is stateful somehow. I've never really touched hackaeg2nix, but do know that it uses STM, so may be tricky behavior involved. | 
| So it seems like  | 
c3bc025    to
    30a1431      
    Compare
  
    30a1431    to
    8f8f952      
    Compare
  
    | The first approach wasn't working well: Initially, I removed the excluded package from the hackage db at the very beginning. But this would lead to unexpected results later: Cabal would miss some dependencies, and thus toggle flags in a different way. This would also affect packages that were not broken, right now. For example  The new approach is different: Now, I'm just writing  | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a good starting point. I feel like we may eventually want to figure out a way to get rid of them completely, but I would do that later. (There may even be things we want to do first, e.g. changing the DB backend from all-cabal-hashes to the normal cabal-install index tar which now has cryptographic hashes for a hopefully large enough subset of Hackage).
One consideration could be to automatically create throws for the removed attribtues by
- Passing configintohackage-packages.nix.
- Adding a __throwIfAliases = name: if config.allowAliases then … else null
- Using that in the generated binds.
Maybe that's overkill though?
| 
 I want to have  
 This would save us a few thousand lines in hackage-packages.nix, because we don't need to repeat each of these attributes in two files. Also, it would make us more flexible regarding potential changes in how aliases / throws are represented in Nixpkgs (see my initial work in NixOS/nixpkgs#442066). | 
| 
 This sounds good. It is probably better to have something explode if a package actually ends up depending on an excluded one as that would be very confusing to debug. | 
Spaces instead of tabs, as used everywhere.
8f8f952    to
    be7f47f      
    Compare
  
    | Changed it here, so that these are not created at all. The Nixpkgs PR is updated accordingly. | 
| How do you prevent the old problem that the dependency specification/resolution is incorrect? | 
| The resolution is correct right now, because I exclude these packages later. My first try excluded them here: 
 But now I exclude them in  So it's just the iteration when writing out the packages that is affected now. | 
The package expression for acme-everything is huge since it has to list all packages released to Hackage as of 2018 twice. As this package isn't actually useful and probably doesn't even have a valid install plan, we can remove it to keep the size of hackage-packages.nix in check. In the future, such exclusions should be decided by configurable exclusions as proposed in #667. It may be a prudent idea to use the spam and acme categories of Hackage as a baseline for package exclusions. This partially reverts commit d105bfc.
| I think the current state is what we'll want to do on the hackage2nix side - we just need to iterate on the nixpkgs side. Are you OK with merging this as-is, @sternenseemann? | 
| disabledPackages = Set.unions | ||
| [ dontDistributePackages | ||
| , Set.fromList (constraintPkgName <$> brokenPackages) | ||
| , excludedPackages | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you note why they have to be added to disabled here? This may not be clear since they are removed anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the idea was that if there is a maintained package that will be removed (excluded) that way, this would throw an error - which I think is a good thing to look into that case in more detail.
I didn't test this, though. Is that roughly what this function does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I believe so.
| Note that I did not test this or investigate if there are any problems with it in practice, but I believe you have done that. | 
This adds a config option
excluded-packages, which can be used in Nixpkgs to remove a big chunk of old, broken packages.WIP PR in Nixpkgs at NixOS/nixpkgs#441204.