From eb872da91ae8913c3d1353696612987b30d346a4 Mon Sep 17 00:00:00 2001 From: Bill Ewanick Date: Tue, 8 Aug 2023 17:51:50 -0400 Subject: [PATCH] Turn the site into a package And an app Build with `nix build`, run with `nix run` --- config.dhall | 7 ++++--- flake.lock | 14 +++++++------- flake.nix | 26 +++++++++++++++++++++----- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/config.dhall b/config.dhall index 9512ff0..5c8761b 100644 --- a/config.dhall +++ b/config.dhall @@ -1,6 +1,7 @@ -{ sealImagesPath = "./website/images" -, postsOutputPath = "./website/posts" -, startDate = 2022-01-01 +{ sealImagesPath = "images" +, postsOutputPath = "posts" +, startDate = 2022-09-11 +, seed = +137 , adjectives1 = [ "absorbing" , "adorable" diff --git a/flake.lock b/flake.lock index a91a7ae..ff026eb 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1690927903, - "narHash": "sha256-D5gCaCROnjEKDOel//8TO/pOP87pAEtT0uT8X+0Bj/U=", + "lastModified": 1691421349, + "narHash": "sha256-RRJyX0CUrs4uW4gMhd/X4rcDG8PTgaaCQM5rXEJOx6g=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "bd836ac5e5a7358dea73cb74a013ca32864ccb86", + "rev": "011567f35433879aae5024fc6ec53f2a0568a6c4", "type": "github" }, "original": { @@ -33,11 +33,11 @@ ] }, "locked": { - "lastModified": 1691015524, - "narHash": "sha256-Qg6wYm/T3qmEiwuff3hBmOnCe8MoC6LhHuKQDs+7YRE=", + "lastModified": 1691530010, + "narHash": "sha256-4xtMxEstoQ0iM/BOgGhla08xL/DFjS0+Q8nLOl9Gmls=", "ref": "refs/heads/main", - "rev": "73235cf0ab75d9823db99210ba8bdaf426e29714", - "revCount": 10, + "rev": "f25dd9c99382fd4e945e4d0d034254fc552d9aca", + "revCount": 14, "type": "git", "url": "https://git.ewanick.com/bill/sealPostGenerator.git" }, diff --git a/flake.nix b/flake.nix index 1ad80fd..adb329d 100644 --- a/flake.nix +++ b/flake.nix @@ -24,12 +24,32 @@ split ]); in - { + rec { apps.generateSealPosts = { type = "app"; program = "${inputs.spg.packages.${system}.default}/bin/generateSealPosts"; }; + apps.hakyll-site = { + type = "app"; + program = "${packages.default}/bin/site"; + }; + + apps.default = apps.hakyll-site; + + packages.default = pkgs.stdenv.mkDerivation { + name = "site"; + src = self; + buildPhase = '' + ${ghc'}/bin/ghc \ + -O2 \ + -static \ + -o site \ + site.hs + ''; + installPhase = "mkdir -p $out/bin; install -t $out/bin site"; + }; + devShells.default = pkgs.mkShell { name = "hakyll-shell"; @@ -37,10 +57,6 @@ ghc' hlint haskell-language-server - - (pkgs.writeShellScriptBin "build-site" '' - ${ghc'}/bin/ghc --make website/site -outputdir dist -static -O2 - '') ]; }; });