Commit 49a5283a authored by Daniel Firth's avatar Daniel Firth
Browse files

Merge branch 'lc/flake-parts' into 'master'

hlint

See merge request haskell/flake-to-gitlab-ci!8
parents 04f61f53 85a47de8
......@@ -30,7 +30,7 @@ nixBin :: FilePath
nixBin = $(staticWhich "nix")
type Step :: Type
data Step = Step {
newtype Step = Step {
script :: [Text]
} deriving stock (Show, Eq, Generic)
deriving anyclass (FromJSON, ToJSON)
......@@ -51,13 +51,13 @@ getDevShellsJSON :: Value -> [Text]
getDevShellsJSON = Map.keys . toMapText . view (_Object . ix "devShells" . _Object . ix "x86_64-linux" . _Object)
mkCheck :: Text -> (Text, Step)
mkCheck x = (sformat ("checks." % stext) x, Step $ [sformat nixBuildCmd "checks.x86_64-linux" x] )
mkCheck x = (sformat ("checks." % stext) x, Step [sformat nixBuildCmd "checks.x86_64-linux" x] )
mkPkg :: Text -> (Text, Step)
mkPkg x = (sformat ("packages." % stext) x, Step $ [sformat nixBuildCmd "packages.x86_64-linux" x])
mkPkg x = (sformat ("packages." % stext) x, Step [sformat nixBuildCmd "packages.x86_64-linux" x])
mkDevShell :: Text -> (Text, Step)
mkDevShell x = (sformat ("devShells." % stext) x, Step $ [sformat nixBuildCmd "devShells.x86_64-linux" x])
mkDevShell x = (sformat ("devShells." % stext) x, Step [sformat nixBuildCmd "devShells.x86_64-linux" x])
main :: IO ()
main = do
......@@ -65,7 +65,7 @@ main = do
case A.eitherDecode @Value x of
Left e -> error $ "Could not decode nix flake show --allow-import-from-derivation --json" <> show e
Right r -> do
let pkgs = fmap mkPkg $ getPackagesJSON r
chks = fmap mkCheck $ getChecksJSON r
ds = fmap mkDevShell $ getDevShellsJSON r
let pkgs = mkPkg <$> getPackagesJSON r
chks = mkCheck <$> getChecksJSON r
ds = mkDevShell <$> getDevShellsJSON r
BS.putStr $ Y.encodePretty Y.defConfig $ Map.fromList $ pkgs <> chks <> ds
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment