From d5cd8905bb11d9796a5e2c4f588a3da86517c0fa Mon Sep 17 00:00:00 2001 From: Paul Brinkmeier Date: Thu, 9 Mar 2023 02:22:34 +0100 Subject: [PATCH] Reduce files copied into build --- app/Main.hs | 2 +- package.yaml | 2 +- utoy.css => static/utoy.css | 0 utoy.nix | 17 ++++++++++++++++- 4 files changed, 18 insertions(+), 3 deletions(-) rename utoy.css => static/utoy.css (100%) diff --git a/app/Main.hs b/app/Main.hs index 1fcd2cd..042c948 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -108,7 +108,7 @@ instance MimeRender HTML BytesModel where H.head $ do H.meta ! A.charset "utf-8" H.title "utoy" - H.style $ H.toHtml $ Encoding.decodeUtf8 $(embedFile "utoy.css") + H.style $ H.toHtml $ Encoding.decodeUtf8 $(embedFile "static/utoy.css") H.body $ do H.table $ for_ model.codepoints $ \(bytes, eiC) -> do H.tr $ do diff --git a/package.yaml b/package.yaml index 6c46dd2..af9dfd8 100644 --- a/package.yaml +++ b/package.yaml @@ -10,7 +10,7 @@ copyright: "2023 Paul Brinkmeier" extra-source-files: - README.md -- utoy.css +- static/utoy.css dependencies: - base >= 4.7 && < 5 diff --git a/utoy.css b/static/utoy.css similarity index 100% rename from utoy.css rename to static/utoy.css diff --git a/utoy.nix b/utoy.nix index cff23b1..8fc87fd 100644 --- a/utoy.nix +++ b/utoy.nix @@ -11,7 +11,22 @@ let version = "0.1.0.0"; pname = "utoy"; license = pkgs.lib.licenses.mit; - src = ./.; + src = + let + buildFiles = [ + ./LICENSE + ./utoy.cabal + ./Setup.hs + ./app + ./src + ./static + ./test + ]; + in + pkgs.lib.sources.cleanSourceWith { + src = ./.; + filter = path: _type: pkgs.lib.any (prefix: pkgs.lib.hasPrefix (toString prefix) path) buildFiles; + }; libraryHaskellDepends = haskellDeps haskellPackages; };