Skip to content

Commit 5a3d690

Browse files
Change boolattr to always write to the attributes
1 parent 8e97f51 commit 5a3d690

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

cabal2nix/src/Distribution/Nixpkgs/Fetch.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ instance PP.Pretty DerivationSource where
9090
[ attr "url" $ string derivUrl
9191
, attr "sha256" $ string derivHash
9292
, if derivRevision /= "" then attr "rev" (string derivRevision) else PP.empty
93-
, boolattr "fetchSubmodules" (isJust derivSubmodule) (fromJust derivSubmodule)
93+
, boolattr "fetchSubmodules" (maybe True id derivSubmodule)
9494
]
9595
, rbrace PP.<> semi
9696
]

cabal2nix/src/Distribution/Nixpkgs/Haskell/Derivation.hs

+8-8
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ instance Pretty Derivation where
120120
, onlyIf (_revision > 0) $ attr "revision" $ doubleQuotes $ int _revision
121121
, onlyIf (not (null _editedCabalFile) && _revision > 0) $ attr "editedCabalFile" $ string _editedCabalFile
122122
, listattr "configureFlags" empty (map (show . show) renderedFlags)
123-
, boolattr "isLibrary" (not _isLibrary || _isExecutable) _isLibrary
124-
, boolattr "isExecutable" (not _isLibrary || _isExecutable) _isExecutable
123+
, boolattr "isLibrary" _isLibrary
124+
, boolattr "isExecutable" _isExecutable
125125
, boolattr "enableSeparateDataOutput" _enableSeparateDataOutput _enableSeparateDataOutput
126126
, onlyIf (_setupDepends /= mempty) $ pPrintBuildInfo "setup" _setupDepends
127127
, onlyIf (_libraryDepends /= mempty) $ pPrintBuildInfo "library" _libraryDepends
@@ -130,13 +130,13 @@ instance Pretty Derivation where
130130
, onlyIf (_benchmarkDepends /= mempty) $ pPrintBuildInfo "benchmark" _benchmarkDepends
131131
, boolattr "enableLibraryProfiling" _enableLibraryProfiling _enableLibraryProfiling
132132
, boolattr "enableExecutableProfiling" _enableExecutableProfiling _enableExecutableProfiling
133-
, boolattr "enableSplitObjs" (not _enableSplitObjs) _enableSplitObjs
134-
, boolattr "doHaddock" (not _runHaddock) _runHaddock
135-
, boolattr "jailbreak" _jailbreak _jailbreak
136-
, boolattr "doCheck" (not _doCheck) _doCheck
137-
, boolattr "doBenchmark" _doBenchmark _doBenchmark
133+
, boolattr "enableSplitObjs" _enableSplitObjs
134+
, boolattr "doHaddock" _runHaddock
135+
, boolattr "jailbreak" _jailbreak
136+
, boolattr "doCheck" _doCheck
137+
, boolattr "doBenchmark" _doBenchmark
138138
, onlyIf (not (null _testTarget)) $ attr "testTarget" $ string _testTarget
139-
, boolattr "hyperlinkSource" (not _hyperlinkSource) _hyperlinkSource
139+
, boolattr "hyperlinkSource" _hyperlinkSource
140140
, onlyIf (not (null _phaseOverrides)) $ vcat ((map text . lines) _phaseOverrides)
141141
, pPrint _metaSection
142142
, vcat [ attr k (text v) | (k,v) <- Map.toList _extraAttributes ]

distribution-nixpkgs/src/Distribution/Nixpkgs/Meta.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ instance Pretty Meta where
288288
, maybe mempty (renderPlatforms "hydraPlatforms") _hydraPlatforms
289289
, maybe mempty (attr "mainProgram" . string) _mainProgram
290290
, listattrDoc "maintainers" mempty $ renderMaintainers _maintainers
291-
, boolattr "broken" _broken _broken
291+
, boolattr "broken" _broken
292292
]
293293

294294
-- | This function renders an Nix attribute binding suitable for use in

distribution-nixpkgs/src/Language/Nix/PrettyPrinting.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ attr n v = text n <+> equals <+> v <> semi
3434
onlyIf :: Bool -> Doc -> Doc
3535
onlyIf b d = if b then d else empty
3636

37-
boolattr :: String -> Bool -> Bool -> Doc
38-
boolattr n p v = if p then attr n (bool v) else empty
37+
boolattr :: String -> Bool -> Doc
38+
boolattr n v = attr n (bool v)
3939

4040
listattrDoc :: String -> Doc -> [Doc] -> Doc
4141
listattrDoc n prefix vs = onlyIf (not (null vs)) $

0 commit comments

Comments
 (0)