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
commit1270dbff9ca7f13900d8ab0ce0011aa626029623 (patch)
treef554ac5f81be34b6c0f24a2523612151036ac049
parentstatic: add my resume as a static page (diff)
downloadfcuny.net-1270dbff9ca7f13900d8ab0ce0011aa626029623.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--.drone.yml18
-rw-r--r--.gitignore2
-rw-r--r--flake.lock16
-rw-r--r--flake.nix32
4 files changed, 54 insertions, 14 deletions
diff --git a/.drone.yml b/.drone.yml
new file mode 100644
index 0000000..7c0c283
--- /dev/null
+++ b/.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/.gitignore b/.gitignore
index 6e68499..8ec0a90 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
 /docs/
+/.hugo_build.lock
+/result
diff --git a/flake.lock b/flake.lock
index d7426e1..8af4281 100644
--- a/flake.lock
+++ b/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/flake.nix b/flake.nix
index 59ef578..fa39b45 100644
--- a/flake.nix
+++ b/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 ]; };
+      });
 }