mirror of
https://github.com/nmattia/niv.git
synced 2024-11-07 22:36:53 +03:00
Clean up
This commit is contained in:
parent
956f976f5b
commit
fbaed6d725
23
Main.hs
23
Main.hs
@ -12,8 +12,7 @@ import Control.Applicative
|
||||
import Control.Monad
|
||||
import Control.Monad.State
|
||||
import Data.Aeson (FromJSON, FromJSONKey, ToJSON, ToJSONKey)
|
||||
import Data.Char (isSpace)
|
||||
import Data.Char (toUpper)
|
||||
import Data.Char (isSpace, toUpper)
|
||||
import Data.Functor ((<&>))
|
||||
import Data.Hashable (Hashable)
|
||||
import Data.Maybe (mapMaybe, fromMaybe)
|
||||
@ -316,7 +315,16 @@ cmdInit = do
|
||||
-- Writes all the default files
|
||||
-- a path, a "create" function and an update function for each file.
|
||||
forM_
|
||||
[ ( pathNixSourcesJson
|
||||
[ ( pathNixSourcesNix
|
||||
, (`createFile` initNixSourcesNixContent)
|
||||
, \path content -> do
|
||||
if shouldUpdateNixSourcesNix content
|
||||
then do
|
||||
putStrLn "Updating sources.nix"
|
||||
writeFile path initNixSourcesNixContent
|
||||
else putStrLn "Not updating sources.nix"
|
||||
)
|
||||
, ( pathNixSourcesJson
|
||||
, \path -> do
|
||||
createFile path initNixSourcesJsonContent
|
||||
-- Imports @niv@ and @nixpkgs@ (18.09)
|
||||
@ -328,15 +336,6 @@ cmdInit = do
|
||||
( PackageName "NixOS/nixpkgs-channels"
|
||||
, PackageSpec (HMap.singleton "branch" "nixos-18.09"))
|
||||
, \path _content -> dontCreateFile path)
|
||||
, ( pathNixSourcesNix
|
||||
, (`createFile` initNixSourcesNixContent)
|
||||
, \path content -> do
|
||||
if shouldUpdateNixSourcesNix content
|
||||
then do
|
||||
putStrLn "Updating sources.nix"
|
||||
writeFile path initNixSourcesNixContent
|
||||
else putStrLn "Not updating sources.nix"
|
||||
)
|
||||
, ( pathNixDefaultNix
|
||||
, (`createFile` initNixDefaultNixContent)
|
||||
, \path _content -> dontCreateFile path)
|
||||
|
Loading…
Reference in New Issue
Block a user