From 6ac793b7e2f5c20a170a98324ef04b6d8a60c814 Mon Sep 17 00:00:00 2001 From: David Lynch <98290029+coillteoir@users.noreply.github.com> Date: Wed, 12 Feb 2025 21:22:18 +0000 Subject: [PATCH 1/3] Update ShellifyTemplate.hs --- src/ShellifyTemplate.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ShellifyTemplate.hs b/src/ShellifyTemplate.hs index 1a549b0..77d307b 100644 --- a/src/ShellifyTemplate.hs +++ b/src/ShellifyTemplate.hs @@ -17,4 +17,5 @@ $if(shell_hook)$ ''; $endif$ } + |] From 7d22ec2748b18999df060a0c34054f1a61ca0740 Mon Sep 17 00:00:00 2001 From: David Lynch <98290029+coillteoir@users.noreply.github.com> Date: Wed, 12 Feb 2025 21:23:02 +0000 Subject: [PATCH 2/3] Update FlakeTemplate.hs --- src/FlakeTemplate.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/FlakeTemplate.hs b/src/FlakeTemplate.hs index 3060649..a8de32b 100644 --- a/src/FlakeTemplate.hs +++ b/src/FlakeTemplate.hs @@ -24,4 +24,5 @@ flakeTemplate = [r|{ devShells.default = import ./shell.nix { $shell_args;separator=' '$ }; } ); -}|] +} +|] From 0333fe9730bcf4c35a2a08f3d533dfa8ffd8f945 Mon Sep 17 00:00:00 2001 From: David Lynch Date: Tue, 18 Feb 2025 00:21:23 +0000 Subject: [PATCH 3/3] fix: added newlines to template * added newlines to both src/FlakeTemplate.hs and src/ShellifyTemplate.hs templates. * updated test logic to not strip out newlines to ensure that generated templates are matching correct file output. --- src/FlakeTemplate.hs | 4 +++- src/ShellifyTemplate.hs | 1 + test/TestHelpers.hs | 6 +----- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/FlakeTemplate.hs b/src/FlakeTemplate.hs index 3060649..e0af2e1 100644 --- a/src/FlakeTemplate.hs +++ b/src/FlakeTemplate.hs @@ -24,4 +24,6 @@ flakeTemplate = [r|{ devShells.default = import ./shell.nix { $shell_args;separator=' '$ }; } ); -}|] +} + +|] diff --git a/src/ShellifyTemplate.hs b/src/ShellifyTemplate.hs index 1a549b0..77d307b 100644 --- a/src/ShellifyTemplate.hs +++ b/src/ShellifyTemplate.hs @@ -17,4 +17,5 @@ $if(shell_hook)$ ''; $endif$ } + |] diff --git a/test/TestHelpers.hs b/test/TestHelpers.hs index 2b928c8..1a3812b 100644 --- a/test/TestHelpers.hs +++ b/test/TestHelpers.hs @@ -136,11 +136,7 @@ theOptions = options "nix-shellify" . words instance Show Options readNixTemplate :: FilePath -> IO Text -readNixTemplate fileName = - stripTrailingNewline <$> readFile ("test/outputs/" <> fileName) - where stripTrailingNewline f = bool id stripLastChar (lastCharIsNewline f) f - lastCharIsNewline = (== '\n') . last - stripLastChar = reverse . tail . reverse +readNixTemplate fileName = readFile ("test/outputs/" <> fileName) flakeFile = (<> "-flake.nix") shellFile = (<> "-shell.nix")