Coder Social home page Coder Social logo

Comments (2)

bennofs avatar bennofs commented on June 30, 2024

The reason for this behaviour is that when you give cabal2nix a file path as an argument, it still tries to fetch from hackage (because that's what it did before) and also generates expressions that fetch from hackage. To build a nix expression for a local project, you need to supply cabal2nix a directory:

$ cabal2nix /data/apps/cabal2nix
# This file was auto-generated by cabal2nix. Please do NOT edit manually!

{ cabal, Cabal, doctest, filepath, hackageDb, mtl, regexPosix
, transformers
}:

cabal.mkDerivation (self: {
  pname = "cabal2nix";
  version = "1.69";
  src = ./.;
  isLibrary = false;
  isExecutable = true;
  buildDepends = [
    Cabal filepath hackageDb mtl regexPosix transformers
  ];
  testDepends = [ doctest ];
  doCheck = self.stdenv.lib.versionOlder "7.6" self.ghc.version;
  meta = {
    homepage = "http://github.com/NixOS/cabal2nix";
    description = "Convert Cabal files into Nix build instructions";
    license = self.stdenv.lib.licenses.bsd3;
    platforms = self.ghc.meta.platforms;
  };
})

The logic behind this is that cabal2nix always generates derivations for building from hackage if you supply a cabal file. If you want to build directly from some source, you need to supply the path to that source, not to the cabal file.

$ cabal2nix /data/libs/fsnotify/fsnotify.cabal 
* trying fetcher: url
# This file was auto-generated by cabal2nix. Please do NOT edit manually!

{ cabal, async, hinotify, systemFileio, systemFilepath, tasty
, tastyHunit, text, time
}:

cabal.mkDerivation (self: {
  pname = "fsnotify";
  version = "0.0.11";
  sha256 = "03m911pncyzgfdx4aj38azbbmj25fdm3s9l1w27zv0l730fy8ywq";
  buildDepends = [
    async hinotify systemFileio systemFilepath text time
  ];
  testDepends = [
    async systemFileio systemFilepath tasty tastyHunit
  ];
  meta = {
    description = "Cross platform library for file change notification";
    license = self.stdenv.lib.licenses.bsd3;
    platforms = self.ghc.meta.platforms;
  };
})

There still remains the bug the specifying the sha256 manually didn't work, though. The error message / documentation could probably also be improved to mention this.

from cabal2nix.

Fuuzetsu avatar Fuuzetsu commented on June 30, 2024

OK, using directory works but as you say, the bug where we manually specify sha256 remains.

from cabal2nix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.