diff options
author | Franck Cuny <franck@fcuny.net> | 2022-05-25 19:19:24 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2022-05-25 19:19:24 -0700 |
commit | c54e3a336fe460db3b4ec156beac452850838555 (patch) | |
tree | 7dca8abd153d8d21a3afa6e2bd21687c37d7d77d /users/fcuny/notes | |
parent | ref(notes): don't rely on git for modified date (diff) | |
download | world-c54e3a336fe460db3b4ec156beac452850838555.tar.gz |
ref(notes): drop flake.nix
There's no need to have a flake.nix for the notes, we can use the same mechanism as for the blog and resume. Add a README so I remember how to use this in the future.
Diffstat (limited to '')
-rw-r--r-- | users/fcuny/notes/README.org | 10 | ||||
-rw-r--r-- | users/fcuny/notes/default.nix | 30 | ||||
-rw-r--r-- | users/fcuny/notes/flake.lock | 42 | ||||
-rw-r--r-- | users/fcuny/notes/flake.nix | 46 | ||||
-rwxr-xr-x | users/fcuny/notes/scripts/deploy.sh | 6 |
5 files changed, 46 insertions, 88 deletions
diff --git a/users/fcuny/notes/README.org b/users/fcuny/notes/README.org new file mode 100644 index 0000000..9b8ac98 --- /dev/null +++ b/users/fcuny/notes/README.org @@ -0,0 +1,10 @@ +#+TITLE: notes.fcuny.net + +A collection of notes. + +* Build +To build the site, run =nix build .#users.fcuny.notes -o users/fcuny/notes/result=. +* Run +The dependencies are managed with nix. Running =nix run .#users.fcuny.notes.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/notes/default.nix b/users/fcuny/notes/default.nix new file mode 100644 index 0000000..ee9ebb9 --- /dev/null +++ b/users/fcuny/notes/default.nix @@ -0,0 +1,30 @@ +{ pkgs, ... }: + +pkgs.stdenv.mkDerivation rec { + name = "notes.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/notes + export PATH=${pkgs.lib.makeBinPath [ pkgs.hugo pkgs.git ]} + hugo server -D + ''; + + meta = with pkgs.lib; { + description = "franck cuny's notes"; + homepage = "https://notes.fcuny.net"; + license = licenses.mit; + platforms = platforms.linux; + maintainers = [ ]; + }; +} diff --git a/users/fcuny/notes/flake.lock b/users/fcuny/notes/flake.lock deleted file mode 100644 index afaae62..0000000 --- a/users/fcuny/notes/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": 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 deleted file mode 100644 index 52e25c1..0000000 --- a/users/fcuny/notes/flake.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ - 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 ]; }; - }); -} diff --git a/users/fcuny/notes/scripts/deploy.sh b/users/fcuny/notes/scripts/deploy.sh index 4075f08..4c6851c 100755 --- a/users/fcuny/notes/scripts/deploy.sh +++ b/users/fcuny/notes/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/notes + flyctl deploy VERSION=$(flyctl info -j |jq -r '.App | "notes.fcuny.net/v\(.Version)"') |