From 421d930c9abb6c0a06351f15bf0e763894b2725b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= <tm@tlater.net>
Date: Thu, 26 May 2022 04:07:05 +0100
Subject: [PATCH] Use stdenv.mkDerivation instead of runCommand

I'm silly sometimes:
https://discourse.nixos.org/t/using-the-src-attribute-in-runcommand/19329
---
 flake.nix | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/flake.nix b/flake.nix
index 2077729..d7f3938 100644
--- a/flake.nix
+++ b/flake.nix
@@ -18,25 +18,31 @@
       inherit (pkgs.lib.sources) sourceFilesBySuffices;
     in {
       packages = {
-        default =
-          pkgs.runCommand "build-cv" {
-            OSFONTDIR =
-              concatMapStringsSep ";" (pkg: "${pkg}/share/fonts/truetype/")
-              (with pkgs; [
-                roboto
-                roboto-slab
-                roboto-mono
-              ]);
-            buildInputs = with pkgs; [
-              texlive.combined.scheme-context
-            ];
-            input = sourceFilesBySuffices self [".tex"];
-          } ''
-            cp ${self}/*.tex .
+        default = pkgs.stdenvNoCC.mkDerivation {
+          name = "cv";
+          src = sourceFilesBySuffices self [".tex"];
+
+          buildInputs = with pkgs; [
+            texlive.combined.scheme-context
+          ];
+
+          OSFONTDIR =
+            concatMapStringsSep ";" (pkg: "${pkg}/share/fonts/truetype/")
+            (with pkgs; [
+              roboto
+              roboto-slab
+              roboto-mono
+            ]);
+
+          buildPhase = ''
             context cv
+          '';
+
+          installPhase = ''
             mkdir -p $out
             cp cv.pdf $out/cv.pdf
           '';
+        };
       };
       # Legacy nix command support
       # TODO(tlater): Remove once 22.05 is adopted