diff --git a/.gitignore b/.gitignore index ca35be0..75c328e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ _site +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..5528cc0 --- /dev/null +++ b/flake.lock @@ -0,0 +1,62 @@ +{ + "nodes": { + "assets": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1652540787, + "narHash": "sha256-VU598G+6sAPkmHRIOoZohduMMjwXv/zRf2BYlgIcChA=", + "ref": "refs/heads/master", + "rev": "de5a0ba39fb9da7eec81f1f59d07af67ec4a9233", + "revCount": 17, + "type": "git", + "url": "https://git.polynom.me/polynom.me/shared-assets.git" + }, + "original": { + "type": "git", + "url": "https://git.polynom.me/polynom.me/shared-assets.git" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1638239011, + "narHash": "sha256-AjhmbT4UBlJWqxY0ea8a6GU2C2HdKUREkG43oRr3TZg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a7ecde854aee5c4c7cd6177f54a99d2c1ff28a31", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "21.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1638239011, + "narHash": "sha256-AjhmbT4UBlJWqxY0ea8a6GU2C2HdKUREkG43oRr3TZg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a7ecde854aee5c4c7cd6177f54a99d2c1ff28a31", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "21.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "assets": "assets", + "nixpkgs": "nixpkgs_2" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..54402fa --- /dev/null +++ b/flake.nix @@ -0,0 +1,25 @@ +{ + description = "The website hosted at https://polynom.me"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/21.11"; + assets.url = "git+https://git.polynom.me/polynom.me/shared-assets.git"; + }; + + outputs = { + self, + nixpkgs, + assets + }: let + supportedSystems = [ "x86_64-linux" ]; + forAllSystems = nixpkgs.lib.attrsets.genAttrs supportedSystems; + in { + packages = forAllSystems (system: let + pkgs = import nixpkgs { inherit system; }; + in { + default = pkgs.callPackage ./pkgs/website.nix { + shared-assets = assets.packages.${system}.default; + }; + }); + }; +} diff --git a/layout/page.html b/layout/page.html index a725537..f3a5af6 100644 --- a/layout/page.html +++ b/layout/page.html @@ -10,8 +10,7 @@ content="width=device-width, initial-scale=1.0, maximum-scale=1" /> - - + diff --git a/pkgs/website.nix b/pkgs/website.nix new file mode 100644 index 0000000..788ce56 --- /dev/null +++ b/pkgs/website.nix @@ -0,0 +1,37 @@ +{ + lib, stdenv +, python3 +, shared-assets +}: + +stdenv.mkDerivation { + pname = "website"; + version = "202205120-01"; + + src = ../.; + + buildInputs = [ shared-assets python3 ]; + + buildPhase = '' + ${python3}/bin/python ${shared-assets}/bin/makesite.py \ + -v page_assets=https://cdn.polynom.me \ + --assets ./assets \ + --copy-assets \ + --include robots.txt \ + -p params.json + ''; + + installPhase = '' + mkdir -p $out/srv/www/website + cp -vr _site/* $out/srv/www/website + ''; + + doCheck = false; + + meta = with lib; { + description = "The website hosted at https://polynom.me"; + homepage = "https://git.polynom.me/polynom.me/website"; + maintainers = []; + license = licenses.gpl3; + }; +}