diff options
Diffstat (limited to 'pkgs/servers/dns/ncdns/fix-tpl-path.patch')
-rw-r--r-- | pkgs/servers/dns/ncdns/fix-tpl-path.patch | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/pkgs/servers/dns/ncdns/fix-tpl-path.patch b/pkgs/servers/dns/ncdns/fix-tpl-path.patch new file mode 100644 index 0000000000000..850fb4d1b189f --- /dev/null +++ b/pkgs/servers/dns/ncdns/fix-tpl-path.patch @@ -0,0 +1,27 @@ +This sets a default value for the tpl directory that works for Nixpkgs. + +diff --git a/server/web.go b/server/web.go +index d024a42..0522d02 100644 +--- a/server/web.go ++++ b/server/web.go +@@ -10,6 +10,7 @@ import "path/filepath" + import "time" + import "strings" + import "fmt" ++import "os" + + var layoutTpl *template.Template + var mainPageTpl *template.Template +@@ -44,7 +45,11 @@ func deriveTemplate(filename string) (*template.Template, error) { + } + + func (s *Server) tplFilename(filename string) string { +- td := filepath.Join(s.cfg.ConfigDir, "..", "tpl") ++ ex, err := os.Executable() ++ if err != nil { ++ panic(err) ++ } ++ td := filepath.Join(filepath.Dir(ex), "..", "share", "tpl") + if s.cfg.TplPath != "" { + td = s.cfg.TplPath + } |