diff --git a/src/NixTree/App.hs b/src/NixTree/App.hs index 1481e11..87e3896 100644 --- a/src/NixTree/App.hs +++ b/src/NixTree/App.hs @@ -150,7 +150,8 @@ renderList highlightSort = StorePath { spName, spPayload = PathStats {psTotalSize, psAddedSize}, - spRefs + spRefs, + spSignatures } -> let color = if null spRefs @@ -158,7 +159,10 @@ renderList highlightSort = else identity in color $ B.hBox - [ B.txt (storeNameToShortText spName) + [ if null spSignatures + then B.txt " " + else B.txt "✓ ", + B.txt (storeNameToShortText spName) & underlineWhen SortOrderAlphabetical & B.padRight (B.Pad 1) & B.padRight B.Max, @@ -372,12 +376,18 @@ renderInfoPane :: AppEnv s -> B.Widget Widgets renderInfoPane env = let selected = selectedPath env immediateParents = psImmediateParents $ spPayload selected + signatures = spSignatures selected in B.vBox [ let (f, s) = storeNameToSplitShortText (spName selected) 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) + 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 ", " ] & intersperse (B.txt " | ") & B.hBox, diff --git a/src/NixTree/StorePath.hs b/src/NixTree/StorePath.hs index f83b425..aa05db3 100644 --- a/src/NixTree/StorePath.hs +++ b/src/NixTree/StorePath.hs @@ -140,7 +140,8 @@ data StorePath s ref payload = StorePath { spName :: StoreName s, spSize :: Int, spRefs :: [ref], - spPayload :: payload + spPayload :: payload, + spSignatures :: [String] } deriving (Show, Eq, Ord, Functor, Generic) @@ -187,7 +188,7 @@ getPathInfo nixStore nixVersion options names = do mapM infoToStorePath infos where - infoToStorePath NixPathInfo {npiPath, npiNarSize, npiReferences} = do + infoToStorePath NixPathInfo {npiPath, npiNarSize, npiReferences, npiSignatures} = do name <- mkStoreNameIO npiPath refs <- filter (/= name) <$> mapM mkStoreNameIO npiReferences return $ @@ -195,6 +196,7 @@ getPathInfo nixStore nixVersion options names = do { spName = name, spRefs = refs, spSize = npiNarSize, + spSignatures = npiSignatures, spPayload = () } mkStoreNameIO p = @@ -372,7 +374,8 @@ storeEnvToDot env = data NixPathInfo = NixPathInfo { npiPath :: FilePath, npiNarSize :: Int, - npiReferences :: [FilePath] + npiReferences :: [FilePath], + npiSignatures :: [String] } data NixPathInfoResult @@ -386,6 +389,7 @@ parse2_18 (Object obj) = <$> obj .: "path" <*> obj .: "narSize" <*> obj .: "references" + <*> obj .: "signatures" ) ) <|> ( do @@ -403,6 +407,7 @@ parse2_19 (path, Object obj) = path <$> obj .: "narSize" <*> obj .: "references" + <*> obj .: "signatures" ) parse2_19 (path, Null) = return $ NixPathInfoInvalid path parse2_19 (_, _) = fail "Expecting an object or null"