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
|
||||||
import Control.Monad.State
|
import Control.Monad.State
|
||||||
import Data.Aeson (FromJSON, FromJSONKey, ToJSON, ToJSONKey)
|
import Data.Aeson (FromJSON, FromJSONKey, ToJSON, ToJSONKey)
|
||||||
import Data.Char (isSpace)
|
import Data.Char (isSpace, toUpper)
|
||||||
import Data.Char (toUpper)
|
|
||||||
import Data.Functor ((<&>))
|
import Data.Functor ((<&>))
|
||||||
import Data.Hashable (Hashable)
|
import Data.Hashable (Hashable)
|
||||||
import Data.Maybe (mapMaybe, fromMaybe)
|
import Data.Maybe (mapMaybe, fromMaybe)
|
||||||
@ -316,7 +315,16 @@ cmdInit = do
|
|||||||
-- Writes all the default files
|
-- Writes all the default files
|
||||||
-- a path, a "create" function and an update function for each file.
|
-- a path, a "create" function and an update function for each file.
|
||||||
forM_
|
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
|
, \path -> do
|
||||||
createFile path initNixSourcesJsonContent
|
createFile path initNixSourcesJsonContent
|
||||||
-- Imports @niv@ and @nixpkgs@ (18.09)
|
-- Imports @niv@ and @nixpkgs@ (18.09)
|
||||||
@ -328,15 +336,6 @@ cmdInit = do
|
|||||||
( PackageName "NixOS/nixpkgs-channels"
|
( PackageName "NixOS/nixpkgs-channels"
|
||||||
, PackageSpec (HMap.singleton "branch" "nixos-18.09"))
|
, PackageSpec (HMap.singleton "branch" "nixos-18.09"))
|
||||||
, \path _content -> dontCreateFile path)
|
, \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
|
, ( pathNixDefaultNix
|
||||||
, (`createFile` initNixDefaultNixContent)
|
, (`createFile` initNixDefaultNixContent)
|
||||||
, \path _content -> dontCreateFile path)
|
, \path _content -> dontCreateFile path)
|
||||||
|
Loading…
Reference in New Issue
Block a user