about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-05-10 17:56:40 -0700
committerFranck Cuny <franck@fcuny.net>2022-05-10 17:57:41 -0700
commit2e8a5c27fb3c48cd4c32e001d4cfc4b3f051d72f (patch)
tree23115b51923bd07bf78ed462227bda7e3ce79469
parentstatic: add my resume as a static page (diff)
downloadworld-2e8a5c27fb3c48cd4c32e001d4cfc4b3f051d72f.tar.gz
add drone configuration and cleanup nix
Add a drone configuration to run the deploy on a push to the main
branch.

Cleanup the nix configuration to only keep support for `nix run` (which
will run the hugo server).
-rw-r--r--users/fcuny/blog/.drone.yml18
-rw-r--r--users/fcuny/blog/.gitignore2
-rw-r--r--users/fcuny/blog/flake.lock16
-rw-r--r--users/fcuny/blog/flake.nix32
4 files changed, 54 insertions, 14 deletions
diff --git a/users/fcuny/blog/.drone.yml b/users/fcuny/blog/.drone.yml
new file mode 100644
index 0000000..7c0c283
--- /dev/null
+++ b/users/fcuny/blog/.drone.yml
@@ -0,0 +1,18 @@
+kind: pipeline
+type: exec
+name: default
+
+trigger:
+  event:
+    - push
+  branch:
+    - master
+
+steps:
+  - name: deploy
+    environment:
+      FLY_API_TOKEN:
+        from_secret: FLY_API_TOKEN
+    commands:
+      - nix develop
+      - ./script/deploy.sh
diff --git a/users/fcuny/blog/.gitignore b/users/fcuny/blog/.gitignore
index 6e68499..8ec0a90 100644
--- a/users/fcuny/blog/.gitignore
+++ b/users/fcuny/blog/.gitignore
@@ -1 +1,3 @@
 /docs/
+/.hugo_build.lock
+/result
diff --git a/users/fcuny/blog/flake.lock b/users/fcuny/blog/flake.lock
index d7426e1..8af4281 100644
--- a/users/fcuny/blog/flake.lock
+++ b/users/fcuny/blog/flake.lock
@@ -1,5 +1,20 @@
 {
   "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": 1651345462,
@@ -17,6 +32,7 @@
     },
     "root": {
       "inputs": {
+        "flake-utils": "flake-utils",
         "nixpkgs": "nixpkgs"
       }
     }
diff --git a/users/fcuny/blog/flake.nix b/users/fcuny/blog/flake.nix
index 59ef578..fa39b45 100644
--- a/users/fcuny/blog/flake.nix
+++ b/users/fcuny/blog/flake.nix
@@ -1,19 +1,23 @@
 {
   description = "Franck Cuny's personal website.";
 
-  inputs = { nixpkgs.url = "github:nixos/nixpkgs"; };
+  inputs = {
+    nixpkgs.url = "github:nixos/nixpkgs";
+    flake-utils.url = "github:numtide/flake-utils";
+  };
 
-  outputs = { self, nixpkgs }:
-    let pkgs = nixpkgs.legacyPackages.x86_64-linux;
-    in {
-      defaultApp.x86_64-linux = self.apps.server;
-      apps.server = pkgs.writers.writeBashBin "server" ''
-        set -e
-        set -o pipefail
-        PATH=${pkgs.lib.makeBinPath [ pkgs.hugo pkgs.git ]}
-        hugo server
-      '';
-      devShell.x86_64-linux =
-        pkgs.mkShell { buildInputs = with pkgs; [ hugo flyctl git ]; };
-    };
+  outputs = { self, nixpkgs, flake-utils }:
+    flake-utils.lib.eachDefaultSystem (system:
+      let pkgs = nixpkgs.legacyPackages.${system};
+      in {
+        defaultApp = pkgs.writers.writeBashBin "run-hugo" ''
+          set -e
+          set -o pipefail
+          export PATH=${pkgs.lib.makeBinPath [ pkgs.hugo pkgs.git ]}
+          hugo server -D
+        '';
+
+        devShell =
+          pkgs.mkShell { buildInputs = with pkgs; [ hugo flyctl git ]; };
+      });
 }