Skip to content

Commit

Permalink
Merge pull request #616 from NixOS/localeindependence
Browse files Browse the repository at this point in the history
Make hackage2nix locale independent
  • Loading branch information
maralorn authored Feb 5, 2024
2 parents 89857ea + d0b5861 commit 173e8a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cabal2nix/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Revision History for cabal2nix

## Unreleased

* `hackage2nix` now defaults internally to a utf-8 locale ignoring enviroment
variables.

## 2.19.1

**Warning**: This version of `cabal2nix` generates Nix expressions that
Expand Down
2 changes: 2 additions & 0 deletions cabal2nix/hackage2nix/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import Text.PrettyPrint.HughesPJClass hiding ( (<>) )
import Data.List.NonEmpty (NonEmpty)
import Data.Semigroup (sconcat)
import Options.Applicative.NonEmpty (some1)
import GHC.IO.Encoding (setLocaleEncoding)

type PackageSet = Map PackageName Version
type PackageMultiSet = Map PackageName (Set Version)
Expand All @@ -56,6 +57,7 @@ data CLI = CLI

main :: IO ()
main = do
setLocaleEncoding utf8
let cliOptions :: Parser CLI
cliOptions = CLI
<$> strOption (long "hackage" <> help "path to Hackage git repository" <> value "hackage" <> showDefaultWith id <> metavar "PATH")
Expand Down

0 comments on commit 173e8a5

Please sign in to comment.