diff options
author | sternenseemann <sternenseemann@systemli.org> | 2021-11-08 23:11:06 +0100 |
---|---|---|
committer | sternenseemann <sternenseemann@systemli.org> | 2021-11-08 23:11:06 +0100 |
commit | f522c412d5e15fa2b6ed530f6e33bac37847a58b (patch) | |
tree | 3c62d8abbf9f2dbc2a6b00784aa41a64f8eb2bbe /pkgs | |
parent | 07c7f8e267f024db5fd332f993fcca9ece6fb211 (diff) |
haskellPackages.graphviz: hardcode references to graphviz tools
This will make everything using graphviz just work without graphviz having to be able from PATH (in a nix-shell or installed globally).
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/development/haskell-modules/configuration-nix.nix | 11 | ||||
-rw-r--r-- | pkgs/development/haskell-modules/patches/graphviz-hardcode-graphviz-store-path.patch | 40 |
2 files changed, 51 insertions, 0 deletions
diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix index 2eaf820a3aa8e..7143d639b052b 100644 --- a/pkgs/development/haskell-modules/configuration-nix.nix +++ b/pkgs/development/haskell-modules/configuration-nix.nix @@ -996,4 +996,15 @@ self: super: builtins.intersectAttrs super { fi '' + (drv.postConfigure or ""); }) super.procex; + + # Apply a patch which hardcodes the store path of graphviz instead of using + # whatever graphviz is in PATH. + graphviz = overrideCabal (drv: { + patches = [ + (pkgs.substituteAll { + src = ./patches/graphviz-hardcode-graphviz-store-path.patch; + inherit (pkgs) graphviz; + }) + ] ++ (drv.patches or []); + }) super.graphviz; } diff --git a/pkgs/development/haskell-modules/patches/graphviz-hardcode-graphviz-store-path.patch b/pkgs/development/haskell-modules/patches/graphviz-hardcode-graphviz-store-path.patch new file mode 100644 index 0000000000000..f0331e3a2b60b --- /dev/null +++ b/pkgs/development/haskell-modules/patches/graphviz-hardcode-graphviz-store-path.patch @@ -0,0 +1,40 @@ +diff --git a/Data/GraphViz/Commands.hs b/Data/GraphViz/Commands.hs +index 20e7dbe..514c29d 100644 +--- a/Data/GraphViz/Commands.hs ++++ b/Data/GraphViz/Commands.hs +@@ -63,14 +63,14 @@ import System.IO (Handle, hPutStrLn, hSetBinaryMode, stderr) + -- ----------------------------------------------------------------------------- + + showCmd :: GraphvizCommand -> String +-showCmd Dot = "dot" +-showCmd Neato = "neato" +-showCmd TwoPi = "twopi" +-showCmd Circo = "circo" +-showCmd Fdp = "fdp" +-showCmd Sfdp = "sfdp" +-showCmd Osage = "osage" +-showCmd Patchwork = "patchwork" ++showCmd Dot = "@graphviz@/bin/dot" ++showCmd Neato = "@graphviz@/bin/neato" ++showCmd TwoPi = "@graphviz@/bin/twopi" ++showCmd Circo = "@graphviz@/bin/circo" ++showCmd Fdp = "@graphviz@/bin/fdp" ++showCmd Sfdp = "@graphviz@/bin/sfdp" ++showCmd Osage = "@graphviz@/bin/osage" ++showCmd Patchwork = "@graphviz@/bin/patchwork" + + -- | The default command for directed graphs. + dirCommand :: GraphvizCommand +@@ -312,8 +312,11 @@ runGraphvizCanvas' d = runGraphvizCanvas (commandFor d) d + + -- | Is the Graphviz suite of tools installed? This is determined by + -- whether @dot@ is available in the @PATH@. ++-- ++-- Note: With nixpkgs, this will always return 'True' as graphviz' ++-- store paths are hardcoded instead of looking at @PATH@. + isGraphvizInstalled :: IO Bool +-isGraphvizInstalled = liftM isJust . findExecutable $ showCmd Dot ++isGraphvizInstalled = pure True -- :) + + -- | If Graphviz does not seem to be available, print the provided + -- error message and then exit fatally. |