nh2 / static-haskell-nix

easily build most Haskell programs into fully static Linux executables
388 stars 36 forks source link

cp: missing destination file operand after '/tmp/**/setup-package.conf.d/' #16

Closed clojurians-org closed 5 years ago

clojurians-org commented 5 years ago

i have no way to pass it when using nix-build, it report:

[op@my-200 minio-migration]$ nix-build
these derivations will be built:
  /nix/store/m7f8vn4ry5b79csvikcc396n572wqgyx-minio-migration-0.1.0.0.drv
building '/nix/store/m7f8vn4ry5b79csvikcc396n572wqgyx-minio-migration-0.1.0.0.drv'...
setupCompilerEnvironmentPhase
Build with /nix/store/v2qr71m53qpcgjkbc84iggr72f0zivhw-ghc-8.4.3.
cp: missing destination file operand after '/tmp/nix-build-minio-migration-0.1.0.0.drv-0/setup-package.conf.d/'
Try 'cp --help' for more information.
builder for '/nix/store/m7f8vn4ry5b79csvikcc396n572wqgyx-minio-migration-0.1.0.0.drv' failed with exit code 1
error: build of '/nix/store/m7f8vn4ry5b79csvikcc396n572wqgyx-minio-migration-0.1.0.0.drv' failed
[op@my-200 minio-migration]$ cat default.nix
{ pkgs ? import (builtins.fetchTarball {url="https://github.com/NixOS/nixpkgs/archive/2c07921cff84dfb0b9e0f6c2d10ee2bfee6a85ac.tar.gz";}) {}} :

with pkgs;
let
  haskellPackages = pkgs.haskellPackages.override {
    overrides = self: super: with pkgs.haskell.lib; {
      # clntsh = oracle-instantclient ;
      minio-hs = dontCheck super.minio-hs ;
      # conduit = doJailbreak super.conduit ;
    } ;
  } ;
  pkg = haskellPackages.developPackage {
    root = ./.;

    modifier = drv: haskell.lib.overrideCabal drv (attrs: {
      buildTools = (attrs.buildTools or []) ++ [haskellPackages.cabal-install] ;
    }) ;
  } ;
  buildInputs = [ ] ;
in pkg.overrideAttrs(attrs: {
  buildInputs = attrs.buildInputs ++ buildInputs ;
})
[op@my-200 minio-migration]$ cat minio-migration.cabal
cabal-version:       >=1.10
-- Initial package description 'minio-migration.cabal' generated by 'cabal
-- init'.  For further documentation, see
-- http://haskell.org/cabal/users-guide/

name:                minio-migration
version:             0.1.0.0
-- synopsis:
-- description:
-- bug-reports:
license:             BSD3
license-file:        LICENSE
author:              clojurians-org
maintainer:          larluo@clojurians.org
-- copyright:
-- category:
build-type:          Simple
extra-source-files:  CHANGELOG.md

executable minio-migration
  main-is:             Main.hs
  -- other-modules:
  -- other-extensions:
  build-depends:
      base
    , criterion-measurement
    , conduit
    , minio-hs
    , stm-chans
    , stm-conduit
  hs-source-dirs:      src
  default-language:    Haskell2010
  default-extensions: OverloadedStrings
[op@my-200 minio-migration]$ cat src/Main.hs
module Main where

import Control.Monad.IO.Class (liftIO)
import Data.Function ((&))
import Control.Monad (void, when)
import Network.Minio (
    ConnectInfo(..), Credentials(..)
  , setCreds, setRegion
  , runMinio, makeBucket, bucketExists, listBuckets
  , listObjects
  , fPutObject, defaultPutObjectOptions
  )

import Criterion.Measurement (getCPUTime, getTime, secs)
import Conduit (runConduit, (.|), takeC, mapM_C, lengthC)
import Control.Concurrent (threadDelay)

myCI :: ConnectInfo
myCI = "http://10.132.34.83:9000"
         & setCreds (Credentials "***"
                                 "***")
         & setRegion "us-east-1"

myCIDev :: ConnectInfo
myCIDev = "http://10.132."
         & setCreds (Credentials "***"
                                 "***")
         & setRegion "us-east-1"

main :: IO ()
main = do
  res <- runMinio myCI $ do
    startTs <- liftIO getTime
    liftIO $ putStrLn $ "start ..."

    liftIO $ threadDelay 5000
    {--
    buckets <- listBuckets
    liftIO $ print $ "Top 5 buckets: " ++ show (take 5 buckets)
    bExist <- bucketExists "larluo"
    when (not bExist) $ void $ makeBucket "larluo" Nothing
    liftIO $ putStrLn $ "--> put tgz.nix-2.2.2"

    fPutObject "larluo"
      "tgz.nix-2.2.2"
      "/home/op/my-env/nix.sh.out/tgz.nix-2.2.2"
      defaultPutObjectOptions
    --}
    runConduit $ listObjects "icif.uat" Nothing True
              .| takeC 10
              .| mapM_C (liftIO . print)
    endTs <- liftIO getTime
    return (endTs - startTs)
  case res of
    Left e -> putStrLn $ "operate failed due to " ++ (show e)
    Right duration -> putStrLn (secs duration)
clojurians-org commented 5 years ago

which NIX_PATH is the latest version? i use some old NIX_PATH can build it finally, thought the above NIX_PATH offer by your page fail always.

OLD NIX_PATH need to doJailBreak and fetchFromGitHub, it's rather inconvinient.

clojurians-org commented 5 years ago

the readme.md document offer two NIX_PATH:

NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/2c07921cff84dfb0b9e0f6c2d10ee2bfee6a85ac.tar.gz NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/88ae8f7d.tar.gz

the latter can be used to build my personal static haskell project?