@@ -190,10 +190,18 @@ bind s = binding # (i, path # is)
190 is = map (review ident) (splitOn "." s)
190 is = map (review ident) (splitOn "." s)
191 i = last is
191 i = last is
193+-- | @replace old new bset@ replaces the Nix binding @old@ with @new@ in the
194+-- set of bindings @bset@. If @old@ is not found in @bset@, then the function
195+-- fails with an 'error'.
193replace :: Binding -> Binding -> Set Binding -> Set Binding
196replace :: Binding -> Binding -> Set Binding -> Set Binding
194−replace old new bs = if old `Set.member` bs then Set.insert new (Set.delete old bs) else bs
198+ | old `Set.member` bs = Set.insert new (Set.delete old bs)
199+ | otherwise = error (unwords [ "post-process: cannot replace name binding"
200+ , show old, "by", show new
201+ , "because it's not found in set"
196−-- TODO: I need to figure out how to conveniently replace a binding in a set.
197gtk3Hook :: Derivation -> Derivation -- https://github.com/NixOS/cabal2nix/issues/145
205gtk3Hook :: Derivation -> Derivation -- https://github.com/NixOS/cabal2nix/issues/145
198gtk3Hook = set (libraryDepends . pkgconfig . contains (pkg "gtk3")) True
206gtk3Hook = set (libraryDepends . pkgconfig . contains (pkg "gtk3")) True
199 . over (libraryDepends . pkgconfig) (Set.filter (\b -> view localName b /= "gtk3"))
207 . over (libraryDepends . pkgconfig) (Set.filter (\b -> view localName b /= "gtk3"))