mirror of
https://github.com/nmattia/niv.git
synced 2024-11-22 03:27:10 +03:00
Update nixpkgs & macos (#381)
This commit is contained in:
parent
723f0eeb96
commit
7b76374b2b
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -8,7 +8,7 @@ jobs:
|
||||
tests:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-20.04, macos-11]
|
||||
os: [ubuntu-20.04, macos-12]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
@ -5,10 +5,10 @@
|
||||
"homepage": null,
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5d6d90c3bf3d95902427c64dae883715de1fae19",
|
||||
"sha256": "027l7f1533wb8cb55dq11dfvkpi48s5m15cq3aj0f84m715682vn",
|
||||
"rev": "41e7ce9a0a29b26e5ca97fd0a4bd85765ed8f9ac",
|
||||
"sha256": "1gp9qwyqwfv8x8k8rj11w7ajlb96a9njxsb5vg14dzadhn97slrc",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/5d6d90c3bf3d95902427c64dae883715de1fae19.tar.gz",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/41e7ce9a0a29b26e5ca97fd0a4bd85765ed8f9ac.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"termtosvg": {
|
||||
|
@ -7,11 +7,11 @@ import Niv.Logger
|
||||
import System.Exit (exitFailure)
|
||||
import UnliftIO
|
||||
|
||||
tshow :: Show a => a -> T.Text
|
||||
tshow :: (Show a) => a -> T.Text
|
||||
tshow = T.pack . show
|
||||
|
||||
-- not quite the perfect place for this
|
||||
abort :: MonadIO io => T.Text -> io a
|
||||
abort :: (MonadIO io) => T.Text -> io a
|
||||
abort msg = do
|
||||
tsay $ T.unwords [tbold $ tred "FATAL:", msg]
|
||||
liftIO exitFailure
|
||||
|
@ -50,7 +50,7 @@ instance MonadUnliftIO NIO where
|
||||
getFindSourcesJson :: NIO FindSourcesJson
|
||||
getFindSourcesJson = ask
|
||||
|
||||
li :: MonadIO io => IO a -> io a
|
||||
li :: (MonadIO io) => IO a -> io a
|
||||
li = liftIO
|
||||
|
||||
cli :: IO ()
|
||||
@ -72,7 +72,8 @@ cli = do
|
||||
Just $
|
||||
"niv - dependency manager for Nix projects"
|
||||
Opts.<$$> ""
|
||||
Opts.<$$> "version:" Opts.<+> Opts.text (showVersion version)
|
||||
Opts.<$$> "version:"
|
||||
Opts.<+> Opts.text (showVersion version)
|
||||
]
|
||||
parseFindSourcesJson =
|
||||
AtPath
|
||||
@ -394,7 +395,7 @@ cmdShow = \case
|
||||
sources <- unSources <$> li (getSources fsj)
|
||||
forWithKeyM_ sources $ showPackage
|
||||
|
||||
showPackage :: MonadIO io => PackageName -> PackageSpec -> io ()
|
||||
showPackage :: (MonadIO io) => PackageName -> PackageSpec -> io ()
|
||||
showPackage (PackageName pname) (PackageSpec spec) = do
|
||||
tsay $ tbold pname
|
||||
forM_ (KM.toList spec) $ \(attrName, attrValValue) -> do
|
||||
|
@ -70,9 +70,9 @@ parseGitShortcut txt'@(T.dropWhileEnd (== '/') -> txt) =
|
||||
".git"
|
||||
`T.isSuffixOf` txt
|
||||
|| "git@"
|
||||
`T.isPrefixOf` txt
|
||||
`T.isPrefixOf` txt
|
||||
|| "ssh://"
|
||||
`T.isPrefixOf` txt
|
||||
`T.isPrefixOf` txt
|
||||
|
||||
parseGitPackageSpec :: Opts.Parser PackageSpec
|
||||
parseGitPackageSpec =
|
||||
|
@ -80,7 +80,7 @@ job str act = do
|
||||
indent = void $ atomicModifyIORef jobStack (\x -> (x + 1, undefined))
|
||||
deindent = void $ atomicModifyIORef jobStack (\x -> (x - 1, undefined))
|
||||
|
||||
jobStackSize :: MonadIO io => io Int
|
||||
jobStackSize :: (MonadIO io) => io Int
|
||||
jobStackSize = readIORef jobStack
|
||||
|
||||
jobStack :: IORef Int
|
||||
@ -88,10 +88,10 @@ jobStack = unsafePerformIO $ newIORef 0
|
||||
|
||||
{-# NOINLINE jobStackSize #-}
|
||||
|
||||
tsay :: MonadIO io => T.Text -> io ()
|
||||
tsay :: (MonadIO io) => T.Text -> io ()
|
||||
tsay = say . T.unpack
|
||||
|
||||
say :: MonadIO io => String -> io ()
|
||||
say :: (MonadIO io) => String -> io ()
|
||||
say msg = do
|
||||
stackSize <- jobStackSize
|
||||
let indent = replicate (stackSize * 2) ' '
|
||||
@ -102,7 +102,7 @@ say msg = do
|
||||
mkWarn :: T.Text -> T.Text
|
||||
mkWarn w = tbold (tyellow "WARNING") <> ": " <> w
|
||||
|
||||
twarn :: MonadIO io => T.Text -> io ()
|
||||
twarn :: (MonadIO io) => T.Text -> io ()
|
||||
twarn = tsay . mkWarn
|
||||
|
||||
mkNote :: T.Text -> T.Text
|
||||
|
@ -149,7 +149,7 @@ instance Applicative Box where
|
||||
boxOp = boxOp f <*> boxOp v
|
||||
}
|
||||
|
||||
instance Semigroup a => Semigroup (Box a) where
|
||||
instance (Semigroup a) => Semigroup (Box a) where
|
||||
(<>) = liftA2 (<>)
|
||||
|
||||
instance IsString (Box T.Text) where
|
||||
@ -283,10 +283,10 @@ runUpdate' attrs = \case
|
||||
Nothing -> pure $ UpdateFailed $ FailTemplate v' (HMS.keys attrs)
|
||||
Just v'' -> pure $ UpdateSuccess attrs (v'' <* v) -- carries over v's newness
|
||||
|
||||
decodeBox :: FromJSON a => T.Text -> Box Value -> Box a
|
||||
decodeBox :: (FromJSON a) => T.Text -> Box Value -> Box a
|
||||
decodeBox msg v = v {boxOp = boxOp v >>= decodeValue msg}
|
||||
|
||||
decodeValue :: FromJSON a => T.Text -> Value -> IO a
|
||||
decodeValue :: (FromJSON a) => T.Text -> Value -> IO a
|
||||
decodeValue msg v = case Aeson.fromJSON v of
|
||||
Aeson.Success x -> pure x
|
||||
Aeson.Error str ->
|
||||
@ -313,17 +313,17 @@ template = Template
|
||||
check :: (a -> Bool) -> Update (Box a) ()
|
||||
check = Check
|
||||
|
||||
load :: FromJSON a => T.Text -> Update () (Box a)
|
||||
load :: (FromJSON a) => T.Text -> Update () (Box a)
|
||||
load k = Load k >>> arr (decodeBox $ "When loading key " <> k)
|
||||
|
||||
-- TODO: should input really be Box?
|
||||
useOrSet :: JSON a => T.Text -> Update (Box a) (Box a)
|
||||
useOrSet :: (JSON a) => T.Text -> Update (Box a) (Box a)
|
||||
useOrSet k =
|
||||
arr (fmap Aeson.toJSON)
|
||||
>>> UseOrSet k
|
||||
>>> arr (decodeBox $ "When trying to use or set key " <> k)
|
||||
|
||||
update :: JSON a => T.Text -> Update (Box a) (Box a)
|
||||
update :: (JSON a) => T.Text -> Update (Box a) (Box a)
|
||||
update k =
|
||||
arr (fmap Aeson.toJSON)
|
||||
>>> Update k
|
||||
|
Loading…
Reference in New Issue
Block a user