about summary refs log tree commit diff
path: root/users/grfn
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2021-08-18T09·38+0200
committersterni <sternenseemann@systemli.org>2021-08-24T12·13+0000
commit32de4cbd934894e7be3dcb2c695229f8056f28cf (patch)
treebf8b0a0a31a7c95a374c05dc1a44d39d93062acb /users/grfn
parenteb6c7fd3bf5b0ada48b3561c0177dc41102edafc (diff)
refactor(users/grfn/gws.fyi): implement isDirectory in pure nix r/2753
Another day, another import from derivation avoided by
builtins.unsafeDiscardStringContext!

Change-Id: I67274b1ba13ba980bb3346b22f2955c702aa3151
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3372
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'users/grfn')
-rw-r--r--users/grfn/gws.fyi/orgExportHTML.nix12
1 files changed, 2 insertions, 10 deletions
diff --git a/users/grfn/gws.fyi/orgExportHTML.nix b/users/grfn/gws.fyi/orgExportHTML.nix
index e918e697d973..ac28580a5926 100644
--- a/users/grfn/gws.fyi/orgExportHTML.nix
+++ b/users/grfn/gws.fyi/orgExportHTML.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+{ pkgs, depot, ... }:
 
 with pkgs;
 with lib;
@@ -22,21 +22,13 @@ let
   bn = builtins.baseNameOf src;
   filename = elemAt (splitString "." bn) 0;
 
-  isDirectory = import (runCommand "isDirectory" {} ''
-    if [ -d ${src} ]; then
-      echo "true" > $out
-    else
-      echo "false" > $out
-    fi
-  '');
-
   outName =
     if isNull headline
     then
       let bn = builtins.baseNameOf src;
           filename = elemAt (splitString "." bn) 0;
       in
-        if isDirectory
+        if depot.nix.utils.isDirectory src
         then filename
         else filename + ".html"
     else "${filename}-${replaceStrings [" "] ["-"] filename}.html";