about summary refs log tree commit diff
path: root/users/fcuny/notes/flake.nix
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-05-23 19:32:36 -0700
committerFranck Cuny <franck@fcuny.net>2022-05-23 19:32:36 -0700
commit69fb19cd967ac301efba635fea9f31bf203cf0cb (patch)
tree8423069a26e5c8c845b0bbe58d2c2ea59a7ac6eb /users/fcuny/notes/flake.nix
parentref(blog): remove unneeded files for the blog (diff)
parentdelete Makefile (diff)
downloadworld-69fb19cd967ac301efba635fea9f31bf203cf0cb.tar.gz
Merge remote-tracking branch 'notes/main'
Diffstat (limited to 'users/fcuny/notes/flake.nix')
-rw-r--r--users/fcuny/notes/flake.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/users/fcuny/notes/flake.nix b/users/fcuny/notes/flake.nix
new file mode 100644
index 0000000..52e25c1
--- /dev/null
+++ b/users/fcuny/notes/flake.nix
@@ -0,0 +1,46 @@
+{
+  description = "Franck Cuny's notes.";
+
+  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 = "notes.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 ]; };
+      });
+}