mirror of
https://github.com/nmattia/niv.git
synced 2024-11-25 01:42:46 +03:00
Drop null elements in sources.json
This commit is contained in:
parent
64e80a0cac
commit
cd066313ca
14
app/Niv.hs
14
app/Niv.hs
@ -91,7 +91,19 @@ newtype PackageSpec = PackageSpec { unPackageSpec :: Aeson.Object }
|
|||||||
|
|
||||||
-- | Simply discards the 'Freedom'
|
-- | Simply discards the 'Freedom'
|
||||||
attrsToSpec :: Attrs -> PackageSpec
|
attrsToSpec :: Attrs -> PackageSpec
|
||||||
attrsToSpec = PackageSpec . fmap snd
|
attrsToSpec = PackageSpec . dropNulls . fmap snd
|
||||||
|
where
|
||||||
|
dropNulls
|
||||||
|
:: HMS.HashMap T.Text Aeson.Value
|
||||||
|
-> HMS.HashMap T.Text Aeson.Value
|
||||||
|
dropNulls = HMS.mapMaybe $ \case
|
||||||
|
x@Aeson.Object{} -> Just x
|
||||||
|
x@Aeson.Array{} -> Just x
|
||||||
|
x@Aeson.String{} -> Just x
|
||||||
|
x@Aeson.Number{} -> Just x
|
||||||
|
x@Aeson.Bool{} -> Just x
|
||||||
|
Aeson.Null -> Nothing
|
||||||
|
|
||||||
|
|
||||||
parsePackageSpec :: Opts.Parser PackageSpec
|
parsePackageSpec :: Opts.Parser PackageSpec
|
||||||
parsePackageSpec =
|
parsePackageSpec =
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"homepage": null,
|
|
||||||
"url": "http://localhost:3333/NixOS/nixpkgs-channels/archive/571b40d3f50466d3e91c1e609d372de96d782793.tar.gz",
|
"url": "http://localhost:3333/NixOS/nixpkgs-channels/archive/571b40d3f50466d3e91c1e609d372de96d782793.tar.gz",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"branch": "nixos-18.09",
|
"branch": "nixos-18.09",
|
||||||
|
Loading…
Reference in New Issue
Block a user