~kaction/nix-sys

9fe77f393d6f57c993183c9d53da06259787c553 — Dmitry Bogatov 1 year, 2 months ago ebdef09
preprocess: actually use --hash option instead of just "foo"

Also make build system of nix-sys proper to pass this parameter
3 files changed, 7 insertions(+), 2 deletions(-)

M nix-sys/generate.do
M preprocess/src/NixSys/CmdOptions.hs
M preprocess/src/NixSys/Main.hs
M nix-sys/generate.do => nix-sys/generate.do +1 -0
@@ 8,4 8,5 @@ exec nixsys-preprocess            \
      --output-config config.h    \
      --install-cdb "$cdb"        \
      --output-cdb index.cdb      \
      --hash "$hash"              \
      < conf/manifest

M preprocess/src/NixSys/CmdOptions.hs => preprocess/src/NixSys/CmdOptions.hs +5 -1
@@ 17,6 17,7 @@ import Options.Applicative
    value,
    (<**>),
  )
import Data.Text (Text)

data CmdOptions = CmdOptions
  { -- It would be much simpler to just read from stdin, but ghci does not


@@ 28,7 29,8 @@ data CmdOptions = CmdOptions
    -- Path where database will be finally installed (probably $cdb output)
    installCDB :: FilePath,
    -- Path to write constant database.
    outputCDB :: FilePath
    outputCDB :: FilePath,
    hash :: Text
  }

cmdOptions :: Parser CmdOptions


@@ 60,6 62,8 @@ cmdOptions =
          <> value "out.cdb"
          <> showDefault
      )
    <*> strOption
      ( long "hash" <> help "hash of nix-sys output path")

ioCmdOptions :: IO CmdOptions
ioCmdOptions = execParser opts

M preprocess/src/NixSys/Main.hs => preprocess/src/NixSys/Main.hs +1 -1
@@ 98,7 98,7 @@ main = do
      spec1 = spec0 {symlink = addInstallCDB (symlink spec0)}

  let template = $(compileMustacheFile "./data/config.h.mustache")
      Object m0 = specToContext spec1 "foo"
      Object m0 = specToContext spec1 hash
      value1 =
        Object
          . HashMap.insert "install_cdb" (String installCDB')