about summary refs log tree commit diff
path: root/users/fcuny/blog/flake.nix
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-05-23 17:43:02 -0700
committerFranck Cuny <franck@fcuny.net>2022-05-23 17:43:02 -0700
commit14a5a6d480f0c2d71b3f43b272e07c5ce769ad83 (patch)
tree33c9de5c9d5d2da8d0dc16302dfb9500717a490b /users/fcuny/blog/flake.nix
parentfeat(tahoe): enable sourcegraph (diff)
parentsign the drone configuration (diff)
downloadworld-14a5a6d480f0c2d71b3f43b272e07c5ce769ad83.tar.gz
Merge remote-tracking branch 'blog/main' into fcuny/migrate-monorepo-blog
Diffstat (limited to 'users/fcuny/blog/flake.nix')
-rw-r--r--users/fcuny/blog/flake.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/users/fcuny/blog/flake.nix b/users/fcuny/blog/flake.nix
new file mode 100644
index 0000000..79e6953
--- /dev/null
+++ b/users/fcuny/blog/flake.nix
@@ -0,0 +1,46 @@
+{
+  description = "Franck Cuny's personal website.";
+
+  inputs = {
+    nixpkgs.url = "github:nixos/nixpkgs";
+    flake-utils.url = "github:numtide/flake-utils";
+  };
+
+  outputs = { self, nixpkgs, flake-utils }:
+    flake-utils.lib.eachDefaultSystem (system:
+      let pkgs = nixpkgs.legacyPackages.${system};
+      in {
+        defaultPackage = with pkgs;
+          stdenv.mkDerivation {
+            pname = "fcuny.net";
+            version = self.lastModifiedDate;
+            src = ./.;
+            buildInputs = [ hugo git ];
+            buildPhase = ''
+              mkdir -p $out
+              hugo --minify --destination $out
+            '';
+            dontInstall = true;
+          };
+
+        defaultApp = pkgs.writers.writeBashBin "run-hugo" ''
+          set -e
+          set -o pipefail
+          export PATH=${pkgs.lib.makeBinPath [ pkgs.hugo pkgs.git ]}
+          hugo server -D
+        '';
+
+        apps = {
+          deploy = pkgs.pkgs.writeShellScriptBin "run-deploy" ''
+            set -euxo pipefail
+            export PATH=${
+              pkgs.lib.makeBinPath [ pkgs.hugo pkgs.git pkgs.jq pkgs.flyctl ]
+            }:$PATH
+            bash ./scripts/deploy.sh
+          '';
+        };
+
+        devShell =
+          pkgs.mkShell { buildInputs = with pkgs; [ hugo flyctl git jq ]; };
+      });
+}