commit 1cb056db47e1d572ff0271467438b5c00d3baa21 Author: Lyle Mantooth Date: Sun Aug 28 12:30:39 2022 -0400 Initial commit. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..364fdec --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +public/ diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..5efd685 --- /dev/null +++ b/config.toml @@ -0,0 +1,25 @@ +# The URL the site will be built for +base_url = "https://menteeth.us" + +# Whether to automatically compile all Sass files in the sass directory +compile_sass = true + +# Whether to do syntax highlighting +# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola +highlight_code = true + +# Whether to build a search index to be used later on by a JavaScript library +build_search_index = true + +[extra] +# Put all your custom variables here +home_subtitle = "Infrequently increasing in interesting entries" + +hermit_social = [ +{ name = "github", link = "https://github.com/IslandUsurper" }, +{ name = "twitter", link = "https://fosstodon.org/@IslandUsurper" } +] + +[extra.author] +name = "Lyle Mantooth" + diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..77cb835 --- /dev/null +++ b/flake.lock @@ -0,0 +1,60 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "hermit-zola": { + "flake": false, + "locked": { + "lastModified": 1649343104, + "narHash": "sha256-tiry4rMOnduQ2JtnpgxRqBsMLICr7JuxaMlONGfwSpA=", + "owner": "VersBinarii", + "repo": "hermit_zola", + "rev": "36009d83123a83ca2a06af36bbc01a6d4bd10ae6", + "type": "github" + }, + "original": { + "owner": "VersBinarii", + "repo": "hermit_zola", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1661617163, + "narHash": "sha256-NN9Ky47j8ohgPhA9JZyfkYIbbAo6RJkGz+7h8/exVpE=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "0ba2543f8c855d7be8e90ef6c8dc89c1617e8a08", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-22.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "hermit-zola": "hermit-zola", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d8337c8 --- /dev/null +++ b/flake.nix @@ -0,0 +1,38 @@ +{ + description = "Annotated Annals: A blog"; + + inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs.flake-utils.inputs.nxipkgs.follows = "nixpkgs"; + inputs.hermit-zola = { url = "github:VersBinarii/hermit_zola"; flake = false; }; + + outputs = { self, nixpkgs, flake-utils, hermit-zola }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + themeName = "hermit_zola"; + in + { + packages.blog = pkgs.stdenv.mkDerivation rec { + pname = "annotated-annals"; + version = "2022-08-28"; + src = ./.; + nativeBuildInputs = [ pkgs.zola ]; + configurePhase = '' + mkdir -p "themes/${themeName}" + cp -r ${hermit-zola}/* "themes/${themeName}" + ''; + buildPhase = "zola build"; + installPhase = "cp -r public $out"; + }; + + defaultPackage = self.packages.${system}.blog; + + devShell = pkgs.mkShell { + packages = [ pkgs.zola ]; + shellHook = '' + ln -sn "${hermit-zola}" "themes/${themeName}" + ''; + }; + }); +} diff --git a/nix/sources.json b/nix/sources.json new file mode 100644 index 0000000..a595747 --- /dev/null +++ b/nix/sources.json @@ -0,0 +1,26 @@ +{ + "niv": { + "branch": "master", + "description": "Easy dependency management for Nix projects", + "homepage": "https://github.com/nmattia/niv", + "owner": "nmattia", + "repo": "niv", + "rev": "f73bf8d584148677b01859677a63191c31911eae", + "sha256": "0jlmrx633jvqrqlyhlzpvdrnim128gc81q5psz2lpp2af8p8q9qs", + "type": "tarball", + "url": "https://github.com/nmattia/niv/archive/f73bf8d584148677b01859677a63191c31911eae.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + }, + "nixpkgs": { + "branch": "nixos-19.09", + "description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to", + "homepage": "https://github.com/NixOS/nixpkgs", + "owner": "NixOS", + "repo": "nixpkgs-channels", + "rev": "cae3ac8c30bf60af7fe9f887da213cb8687ec5ef", + "sha256": "1s66wrqpv05i9rmvyg95dgdkhqjkpy15gpwgz1sva5r8zhhdvk1m", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs-channels/archive/cae3ac8c30bf60af7fe9f887da213cb8687ec5ef.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + } +} diff --git a/nix/sources.nix b/nix/sources.nix new file mode 100644 index 0000000..8a725cb --- /dev/null +++ b/nix/sources.nix @@ -0,0 +1,134 @@ +# This file has been generated by Niv. + +let + + # + # The fetchers. fetch_ fetches specs of type . + # + + fetch_file = pkgs: spec: + if spec.builtin or true then + builtins_fetchurl { inherit (spec) url sha256; } + else + pkgs.fetchurl { inherit (spec) url sha256; }; + + fetch_tarball = pkgs: spec: + if spec.builtin or true then + builtins_fetchTarball { inherit (spec) url sha256; } + else + pkgs.fetchzip { inherit (spec) url sha256; }; + + fetch_git = spec: + builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; }; + + fetch_builtin-tarball = spec: + builtins.trace + '' + WARNING: + The niv type "builtin-tarball" will soon be deprecated. You should + instead use `builtin = true`. + + $ niv modify -a type=tarball -a builtin=true + '' + builtins_fetchTarball { inherit (spec) url sha256; }; + + fetch_builtin-url = spec: + builtins.trace + '' + WARNING: + The niv type "builtin-url" will soon be deprecated. You should + instead use `builtin = true`. + + $ niv modify -a type=file -a builtin=true + '' + (builtins_fetchurl { inherit (spec) url sha256; }); + + # + # Various helpers + # + + # The set of packages used when specs are fetched using non-builtins. + mkPkgs = sources: + let + sourcesNixpkgs = + import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {}; + hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath; + hasThisAsNixpkgsPath = == ./.; + in + if builtins.hasAttr "nixpkgs" sources + then sourcesNixpkgs + else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then + import {} + else + abort + '' + Please specify either (through -I or NIX_PATH=nixpkgs=...) or + add a package called "nixpkgs" to your sources.json. + ''; + + # The actual fetching function. + fetch = pkgs: name: spec: + + if ! builtins.hasAttr "type" spec then + abort "ERROR: niv spec ${name} does not have a 'type' attribute" + else if spec.type == "file" then fetch_file pkgs spec + else if spec.type == "tarball" then fetch_tarball pkgs spec + else if spec.type == "git" then fetch_git spec + else if spec.type == "builtin-tarball" then fetch_builtin-tarball spec + else if spec.type == "builtin-url" then fetch_builtin-url spec + else + abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}"; + + # Ports of functions for older nix versions + + # a Nix version of mapAttrs if the built-in doesn't exist + mapAttrs = builtins.mapAttrs or ( + f: set: with builtins; + listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set)) + ); + + # fetchTarball version that is compatible between all the versions of Nix + builtins_fetchTarball = { url, sha256 }@attrs: + let + inherit (builtins) lessThan nixVersion fetchTarball; + in + if lessThan nixVersion "1.12" then + fetchTarball { inherit url; } + else + fetchTarball attrs; + + # fetchurl version that is compatible between all the versions of Nix + builtins_fetchurl = { url, sha256 }@attrs: + let + inherit (builtins) lessThan nixVersion fetchurl; + in + if lessThan nixVersion "1.12" then + fetchurl { inherit url; } + else + fetchurl attrs; + + # Create the final "sources" from the config + mkSources = config: + mapAttrs ( + name: spec: + if builtins.hasAttr "outPath" spec + then abort + "The values in sources.json should not have an 'outPath' attribute" + else + spec // { outPath = fetch config.pkgs name spec; } + ) config.sources; + + # The "config" used by the fetchers + mkConfig = + { sourcesFile ? ./sources.json + , sources ? builtins.fromJSON (builtins.readFile sourcesFile) + , pkgs ? mkPkgs sources + }: rec { + # The sources, i.e. the attribute set of spec name to spec + inherit sources; + + # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers + inherit pkgs; + }; +in +mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); } diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..0b9dba7 --- /dev/null +++ b/shell.nix @@ -0,0 +1,9 @@ +let + sources = import ./nix/sources.nix; + pkgs = import sources.nixpkgs {}; +in +pkgs.mkShell { + buildInputs = [ + pkgs.zola + ]; +} diff --git a/themes/hermit_zola b/themes/hermit_zola new file mode 120000 index 0000000..e434150 --- /dev/null +++ b/themes/hermit_zola @@ -0,0 +1 @@ +/nix/store/2507rpn1lpgzsmg733p133bjmn84hgmf-source \ No newline at end of file