diff --git a/src/NixTree/App.hs b/src/NixTree/App.hs index 87e3896..c0149fc 100644 --- a/src/NixTree/App.hs +++ b/src/NixTree/App.hs @@ -382,15 +382,19 @@ renderInfoPane env = in B.txt f B.<+> underlineWhen SortOrderAlphabetical (B.txt s), [ B.txt $ "NAR Size: " <> prettySize (spSize selected), underlineWhen SortOrderClosureSize . B.txt $ "Closure Size: " <> prettySize (psTotalSize $ spPayload selected), - underlineWhen SortOrderAddedSize . B.txt $ "Added Size: " <> prettySize (psAddedSize $ spPayload selected), - B.txt $ - "Signatures: " - <> if null signatures - then "✗" - else (map (\s -> (fromMaybe "?" (viaNonEmpty head (T.splitOn ":" (T.pack s))))) signatures) & T.intercalate ", " + underlineWhen SortOrderAddedSize . B.txt $ "Added Size: " <> prettySize (psAddedSize $ spPayload selected) ] & intersperse (B.txt " | ") & B.hBox, + B.txt $ + "Signatures: " + <> if null signatures + then "✗" + else + ( signatures + & map npsKeyName + & T.intercalate ", " + ), B.txt $ if null immediateParents then "Immediate Parents: -" diff --git a/src/NixTree/StorePath.hs b/src/NixTree/StorePath.hs index aa05db3..670ba95 100644 --- a/src/NixTree/StorePath.hs +++ b/src/NixTree/StorePath.hs @@ -4,6 +4,7 @@ module NixTree.StorePath storeNameToText, storeNameToShortText, storeNameToSplitShortText, + NixPathSignature (..), StorePath (..), Installable (..), StoreEnv (..), @@ -141,7 +142,7 @@ data StorePath s ref payload = StorePath spSize :: Int, spRefs :: [ref], spPayload :: payload, - spSignatures :: [String] + spSignatures :: [NixPathSignature] } deriving (Show, Eq, Ord, Functor, Generic) @@ -375,9 +376,24 @@ data NixPathInfo = NixPathInfo { npiPath :: FilePath, npiNarSize :: Int, npiReferences :: [FilePath], - npiSignatures :: [String] + npiSignatures :: [NixPathSignature] } +data NixPathSignature = NixPathSignature + { npsKeyName :: Text, + npsSignature :: Text + } + deriving (Show, Eq, Ord, NFData, Generic) + +instance FromJSON NixPathSignature where + parseJSON (String t) = + case T.splitOn ":" t of + [key, sig] + | not (T.null key) && not (T.null sig) -> + Just $ NixPathSignature key sig + _ -> fail "Expecting a string in the form of 'key:sig'." + parseJSON _ = fail "Expecting a string." + data NixPathInfoResult = NixPathInfoValid NixPathInfo | NixPathInfoInvalid FilePath