about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-05-25 17:53:12 -0700
committerFranck Cuny <franck@fcuny.net>2022-05-25 17:53:12 -0700
commitfa4da9546d321b7837469cfd006ee45c57c3ae29 (patch)
treec4d47129fd9515b0fe5377da235f6e4b7eb2fe26 /users
parentref(blog): drop the `enableGitInfo` option (diff)
downloadworld-fa4da9546d321b7837469cfd006ee45c57c3ae29.tar.gz
ref(blog): drop the flake configuration
There's no need to have multiple `flake.nix` in the repository. Make the
blog part of the flake configuration at the root level of the
repository, delete the one in the blog, and update the documentation.
Diffstat (limited to 'users')
-rw-r--r--users/fcuny/blog/README.org4
-rw-r--r--users/fcuny/blog/default.nix30
-rw-r--r--users/fcuny/blog/flake.lock42
-rw-r--r--users/fcuny/blog/flake.nix46
-rwxr-xr-xusers/fcuny/blog/scripts/deploy.sh6
5 files changed, 39 insertions, 89 deletions
diff --git a/users/fcuny/blog/README.org b/users/fcuny/blog/README.org
index 1342eeb..5d27121 100644
--- a/users/fcuny/blog/README.org
+++ b/users/fcuny/blog/README.org
@@ -2,7 +2,9 @@
 
 My personal blog.
 
+* Build
+To build the site, run =nix build .#users.fcuny.blog -o users/fcuny/blog/result=.
 * Run
-The dependencies are managed with nix. Running =nix run= will start the hugo server.
+The dependencies are managed with nix. Running =nix run .#users.fcuny.blog.server= will start the hugo server.
 * Deploy
 You can deploy the site by running [[file:scripts/deploy.sh][scripts/deploy.sh]].
diff --git a/users/fcuny/blog/default.nix b/users/fcuny/blog/default.nix
new file mode 100644
index 0000000..8c817f5
--- /dev/null
+++ b/users/fcuny/blog/default.nix
@@ -0,0 +1,30 @@
+{ pkgs, ... }:
+
+pkgs.stdenv.mkDerivation rec {
+  name = "fcuny.net";
+
+  src = ./.;
+
+  nativeBuildInputs = [ pkgs.hugo pkgs.git ];
+
+  installPhase = ''
+    mkdir -p $out
+    ${pkgs.hugo}/bin/hugo --minify -d $out/
+  '';
+
+  server = pkgs.writers.writeBashBin "run-server" ''
+    set -ueo pipefail
+    cd $(git rev-parse --show-toplevel)
+    cd users/fcuny/blog
+    export PATH=${pkgs.lib.makeBinPath [ pkgs.hugo pkgs.git ]}
+    hugo server -D
+  '';
+
+  meta = with pkgs.lib; {
+    description = "franck cuny's blog";
+    homepage = "https://fcuny.net";
+    license = licenses.mit;
+    platforms = platforms.linux;
+    maintainers = [ ];
+  };
+}
diff --git a/users/fcuny/blog/flake.lock b/users/fcuny/blog/flake.lock
deleted file mode 100644
index 8af4281..0000000
--- a/users/fcuny/blog/flake.lock
+++ /dev/null
@@ -1,42 +0,0 @@
-{
-  "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,
-        "narHash": "sha256-4wf9sMUKGBjC2jWnUwG52ychtXRKlS3LfX/HEY6DjhM=",
-        "owner": "nixos",
-        "repo": "nixpkgs",
-        "rev": "870249df2cc640e2278cd0bc599ebbb246b00802",
-        "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/blog/flake.nix b/users/fcuny/blog/flake.nix
deleted file mode 100644
index 79e6953..0000000
--- a/users/fcuny/blog/flake.nix
+++ /dev/null
@@ -1,46 +0,0 @@
-{
-  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 ]; };
-      });
-}
diff --git a/users/fcuny/blog/scripts/deploy.sh b/users/fcuny/blog/scripts/deploy.sh
index 69ad82a..4199766 100755
--- a/users/fcuny/blog/scripts/deploy.sh
+++ b/users/fcuny/blog/scripts/deploy.sh
@@ -1,8 +1,14 @@
 #!/usr/bin/env bash
 
+set -ueo pipefail
+
+cd $(git rev-parse --show-toplevel)
+
 git diff --exit-code
 git diff --staged --exit-code
 
+cd users/fcuny/blog
+
 flyctl deploy
 
 VERSION=$(flyctl info -j |jq -r '.App | "fcuny.net/v\(.Version)"')