about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--users/fcuny/notes/.envrc1
-rw-r--r--users/fcuny/notes/flake.lock42
-rw-r--r--users/fcuny/notes/flake.nix46
3 files changed, 89 insertions, 0 deletions
diff --git a/users/fcuny/notes/.envrc b/users/fcuny/notes/.envrc
new file mode 100644
index 0000000..3550a30
--- /dev/null
+++ b/users/fcuny/notes/.envrc
@@ -0,0 +1 @@
+use flake
diff --git a/users/fcuny/notes/flake.lock b/users/fcuny/notes/flake.lock
new file mode 100644
index 0000000..afaae62
--- /dev/null
+++ b/users/fcuny/notes/flake.lock
@@ -0,0 +1,42 @@
+{
+  "nodes": {
+    "flake-utils": {
+      "locked": {
+        "lastModified": 1649676176,
+        "narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1652295142,
+        "narHash": "sha256-vqvZa2xoNPhkpAhAbtUCA2wyga1qv6QeuGH2C8IVnus=",
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "rev": "174c43d7d17b27e50074fe3c970a5659a4d8e39b",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "flake-utils": "flake-utils",
+        "nixpkgs": "nixpkgs"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}
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 ]; };
+      });
+}