From dd0a2b5d47d7e11d7fd31dff5b26a6b230d355eb Mon Sep 17 00:00:00 2001 From: Steam Deck User Date: Fri, 4 Nov 2022 08:06:22 -0400 Subject: [PATCH] Init repo --- LICENSE | 9 +++++++++ README.org | 10 ++++++++++ flake.nix | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 LICENSE create mode 100644 README.org create mode 100644 flake.nix diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0f2bb7a --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2022 chris@chrishayward.xyz + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.org b/README.org new file mode 100644 index 0000000..a587632 --- /dev/null +++ b/README.org @@ -0,0 +1,10 @@ +#+TITLE: Website +#+AUTHOR: Christopher James Hayward +#+EMAIL: chris@chrishayward.xyz + +* Instructions + +1. Clone this repository: ~git clone https://git.chrishayward.xyz/chris/website.git && cd website~ +2. Load the development shell: ~nix develop~ +3. Run the test server: ~website-test~ +4. Build and update: ~website-build && website-update~ diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..08d736b --- /dev/null +++ b/flake.nix @@ -0,0 +1,41 @@ +{ + description = "Source code for https://chrishayward.xyz"; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = inputs @ { self, nixpkgs, ... }: + inputs.flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + myWebsiteDir = "$MY_WEBSITE_DIR"; + myWebsiteTgt = "ubuntu@chrishayward.xyz:/var/www/TODO"; + myWebsiteTest = pkgs.writeShellScriptBin "website-test" '' + pushd ${myWebsiteDir} > /dev/null && + ${pkgs.hugo}/bin/hugo -v && ${pkgs.hugo}/bin/hugo server ; \ + popd > /dev/null + ''; + myWebsiteBuild = pkgs.writeShellScriptBin "website-build" '' + pushd ${myWebsiteDir} > /dev/null && + ${pkgs.hugo}/bin/hugo -v ; \ + popd > /dev/null + ''; + myWebsiteUpdate = pkgs.writeShellScriptBin "website-update" '' + ${pkgs.rsync}/bin/rsync -aP ${myWebsiteDir}/public/ ${myWebsiteTgt} + ''; + in + rec { + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + myWebsiteTest + myWebsiteBuild + myWebsiteUpdate + ]; + + shellHook = '' + export MY_WEBSITE_DIR="$(pwd)" + ''; + }; + } + ); +}