aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-05-11 12:18:13 -0700
committerFranck Cuny <franck@fcuny.net>2022-05-11 12:18:13 -0700
commit32f1ea7d820d3806fa761f399f18619fafe2a2d7 (patch)
treedd68f37d31d6d698987e77839cff6fa7a17d8e76
parentadd a script to deploy the site (diff)
downloadinfra-32f1ea7d820d3806fa761f399f18619fafe2a2d7.tar.gz
add flake support
-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 ]; };
+ });
+}