diff --git a/default.nix b/default.nix index 15b4ff6a..3dc4c983 100644 --- a/default.nix +++ b/default.nix @@ -1,7 +1,7 @@ -{ nixpkgs ? import ./nixpkgs.nix, enableOpencv4 ? false +{ nixpkgs ? import ./nixpkgs.nix , system ? builtins.currentSystem }: import nixpkgs { inherit system; - overlays = [ (import ./overlay.nix enableOpencv4) ]; + overlays = [ (import ./overlay.nix) ]; } diff --git a/nix/sources.json b/nix/sources.json index 957823ba..04314a22 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -12,15 +12,15 @@ "url_template": "https://github.com///archive/.tar.gz" }, "nixpkgs": { - "branch": "nixos-unstable", - "description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to", + "branch": "nixos-23.05", + "description": " Nix Packages collection & NixOS", "homepage": "https://github.com/NixOS/nixpkgs", "owner": "NixOS", - "repo": "nixpkgs-channels", - "rev": "8d1510abfb592339e13ce8f6db6f29c1f8b72924", - "sha256": "0i4jscq2qy2vn9kr8ix9gr8ncf9dss24y09jrqhlpcpryi4i98dc", + "repo": "nixpkgs", + "rev": "da5adce0ffaff10f6d0fee72a02a5ed9d01b52fc", + "sha256": "sha256-32EnPCaVjOiEERZ+o/2Ir7JH9pkfwJZJ27SKHNvt4yk=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs-channels/archive/8d1510abfb592339e13ce8f6db6f29c1f8b72924.tar.gz", + "url": "https://github.com/NixOS/nixpkgs/archive/da5adce0ffaff10f6d0fee72a02a5ed9d01b52fc.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } diff --git a/overlay.nix b/overlay.nix index cf25d793..3fbab8b3 100644 --- a/overlay.nix +++ b/overlay.nix @@ -1,12 +1,8 @@ -enableOpencv4 : final : previous : with final.lib; with final.haskell.lib; +final : previous : with final.lib; with final.haskell.lib; let - handleOpencv4 = drv : if enableOpencv4 then enableCabalFlag drv "opencv4" else drv; - useOpencvHighgui = drv : overrideCabal drv (_drv: { libraryPkgconfigDepends = [ - (if enableOpencv4 - then final.opencv4_highgui - else final.opencv3_highgui) + final.opencv4_highgui ]; }); @@ -19,7 +15,7 @@ let ]); }); in { - opencv = handleOpencv4 (addBuildToolsInShell (doBenchmark (overrideCabal (super.callCabal2nix "opencv" ./opencv {}) (drv : { + opencv = addBuildToolsInShell (doBenchmark (overrideCabal (super.callCabal2nix "opencv" ./opencv {}) (drv : { src = final.runCommand "opencv-src" { files = final.lib.sourceByRegex ./opencv [ "^src$" @@ -46,9 +42,8 @@ let shellHook = '' export hardeningDisable=bindnow ''; - } // optionalAttrs enableOpencv4 { libraryPkgconfigDepends = [ final.opencv4 ]; - })))); + }))); opencv_highgui = useOpencvHighgui self.opencv; @@ -73,7 +68,7 @@ let }))).override { opencv = self.opencv_highgui; }; opencv-extra = - handleOpencv4 (addBuildToolsInShell (overrideCabal (super.callCabal2nix "opencv-extra" ./opencv-extra {}) (_drv : { + addBuildToolsInShell (overrideCabal (super.callCabal2nix "opencv-extra" ./opencv-extra {}) (_drv : { src = final.runCommand "opencv-extra-src" { files = final.lib.sourceByRegex ./opencv-extra [ "^include$" @@ -98,11 +93,9 @@ let ''; # TODO (BvD): This should be added by cabal2nix. Fix this upstream. libraryPkgconfigDepends = [ - (if enableOpencv4 - then final.opencv4 - else final.opencv3) + final.opencv4 ]; - }))); + })); opencv-extra_highgui = (useOpencvHighgui self.opencv-extra).override { opencv = self.opencv_highgui; @@ -137,9 +130,6 @@ in { haskellOverrides self super; }; - opencv3_highgui = previous.opencv3.override { - enableGtk3 = !final.stdenv.isDarwin; - }; opencv4_highgui = previous.opencv4.override { enableGtk3 = !final.stdenv.isDarwin; }; diff --git a/stack.yaml b/stack.yaml index afd6e1d3..1147973f 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,5 @@ -resolver: lts-20.26 +resolver: lts-20.26 # ghc-9.2.8 +# resolver: lts-20.11 # ghc-9.2.5 packages: - opencv/ - opencv-examples/ @@ -12,12 +13,14 @@ packages: allow-newer: true -extra-lib-dirs: -- /usr/local/lib - nix: - path: [ "nixpkgs=https://github.com/NixOS/nixpkgs/archive/8d1510abfb592339e13ce8f6db6f29c1f8b72924.tar.gz" ] - packages: [ zlib pkgconfig opencv3 ] + path: [ "nixpkgs=https://github.com/NixOS/nixpkgs/archive/da5adce0ffaff10f6d0fee72a02a5ed9d01b52fc.tar.gz" ] # nixos-22.11 with opencv4-4.7, and providing ghc-9.2.8 + # path: [ "nixpkgs=https://github.com/NixOS/nixpkgs/archive/ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b.tar.gz" ] # nixos-22.11 with opencv4-4.6, and providing ghc-9.2.5 + packages: + - zlib + - gmp + - pkg-config + - opencv4 # Uncomment if you wish to use Docker integration # See README.md for further information.