Compare commits
3 Commits
2040281fcf
...
8324bcc33e
| Author | SHA1 | Date | |
|---|---|---|---|
|
8324bcc33e
|
|||
|
ba247f88d4
|
|||
|
7cb266782d
|
@@ -2,48 +2,56 @@
|
||||
title: Curriculum Vitae
|
||||
---
|
||||
|
||||
#+HTML: <h1>Curriculum Vitae</h1>Go <a href="/documents/cv.pdf">here</a> for the pdf.<hr>
|
||||
#+MACRO: SMALL \mdseries\smaller @@html:<small>@@ /$1/ @@html:</small>@@
|
||||
#+MACRO: RIGHT \hfill @@html:<span style="float:right">@@ /$1/ @@html:</span>@@
|
||||
#+MACRO: TRULE \titlerule @@html:<hr />@@
|
||||
|
||||
#+HTML: <h1>Curriculum Vitae</h1>Go <a href="/documents/cv.pdf">here</a> for the pdf.<hr>
|
||||
* Amneesh Singh
|
||||
{{{TRULE}}}
|
||||
| Email | : | [[mailto:natto@weirdnatto.in][natto at weirdnatto dot in]] |
|
||||
| Homepage | : | [[https://weirdnatto.in][weirdnatto.in]] |
|
||||
|
||||
Hello, I am Amneesh Singh, I also go by =natto1784= online. I live in Delhi, India; and do random stuff. I am more of a "system-administrator" type of guy, but when it comes to programming, I want to do it all low-level; unless it relates to my hobby.
|
||||
|
||||
* Work Experience
|
||||
** Cypherock - Software Engineer Intern
|
||||
*** (June 2023 -)
|
||||
- Working with C/C++ libraries involving cryptographic primitives.
|
||||
- Working on the React-Typescript frontend.
|
||||
{{{TRULE}}}
|
||||
** Cypherock - Software Engineer Intern {{{RIGHT(June 2023 -)}}}
|
||||
C, Sockets, Cryptography, Protocol buffers, Typescript, React
|
||||
|
||||
* Student Programs, Scholarships, Examinations
|
||||
- *Google Summer of Code 2022*
|
||||
{{{TRULE}}}
|
||||
- *Google Summer of Code 2022* | {{{SMALL(C - GLib - Git)}}}
|
||||
I participated as a contributor in [[https://summerofcode.withgoogle.com/archive/2022][Google Summer of Code 2022]] at [[https://libvirt.org][libvirt]] and got paid a stipend for it by Google. The project involved adding the new introspectable statistics provided by QEMU and adding them under the libvirt statistics API.
|
||||
- NOC: Foundations of Cryptography, IIIT Bangalore, NPTEL - *May 2022*
|
||||
- NOC: Computer Architecture, IIT Delhi, NPTEL - *May 2022*
|
||||
- NOC: Foundations of Cryptography, IIIT Bangalore, NPTEL {{{RIGHT(May 2022)}}}
|
||||
- NOC: Computer Architecture, IIT Delhi, NPTEL - {{{RIGHT(May 2022)}}}
|
||||
|
||||
* Education
|
||||
- B.Tech, Information Technology, Maharaja Agrasen Institute of Technology *(2021 - 2025), 8.6GPA*
|
||||
{{{TRULE}}}
|
||||
** B.Tech, Information Technology
|
||||
Maharaja Agrasen Institute of Technology {{{RIGHT((2021 - 2025)\, 8.6GPA)}}}
|
||||
|
||||
* Projects
|
||||
** Home Lab
|
||||
{{{TRULE}}}
|
||||
** Home Lab | {{{SMALL(linux - NixOS - WireGuard - OCI - Hashicorp)}}}
|
||||
I have an automated home VPN running multiple utility containers with most services reverse proxied via my VPS. Huge fan of [[https://en.wikipedia.org/wiki/Nix_(package_manager)][Nix]] package management.
|
||||
** tricc
|
||||
A very WIP toy compiler for my toy language.
|
||||
** tricc | {{{SMALL(Rust - Compiler Design)}}}
|
||||
A WIP toy compiler for my toy language.
|
||||
** matar (no public code) | {{{SMALL(C++ - Meson - ARM/THUMB architecture)}}}
|
||||
A very early stage WIP Nintendo Game Boy Advance emulator.
|
||||
|
||||
* Skills
|
||||
{{{TRULE}}}
|
||||
** Programming Languages
|
||||
*** Experienced
|
||||
C/C++, Rust, Python, Javascript
|
||||
*** Have used before
|
||||
Lisp, Haskell, PHP, Java, Lua, Go, x86-Assembly, ARM-Assembly
|
||||
| Proficient | : | C/C++, Rust, Python, Javascript |
|
||||
| Experienced | : | Lisp, Haskell, PHP, Java, Lua, Go, x86-Assembly, ARM-Assembly |
|
||||
|
||||
** Tools
|
||||
*** Experienced
|
||||
GNU/Linux, POSIX Shells, TeX, Git, Nix/NixOS, GNU Make, ffmpeg, OpenSSH, vi/vim, GNU Emacs, Docker, Nomad, Vault, nginx, ConcourseCI, NodeJS, ReactJS
|
||||
*** Have used before
|
||||
Pandoc, GitHub Actions, ZFS, OCI, Terraform, Hashicorp Consul, Portage, yarn/npm, Rocket
|
||||
| Proficient | : | GNU/Linux, POSIX Shells, TeX, Git, Nix/NixOS, GNU Make, ffmpeg, OpenSSH, vi/vim, |
|
||||
| | | GNU Emacs, Docker, Nomad, Vault, nginx, ConcourseCI, NodeJS, ReactJS |
|
||||
| Experienced | : | Pandoc, GitHub Actions, ZFS, OCI, Terraform, Consul, Portage, yarn/npm, Rocket |
|
||||
|
||||
** Soft Skills
|
||||
- *Languages*: Hindi, Punjabi, English, Japanese (can read a little, cannot converse)
|
||||
- *Hobbies*: Home server/lab, Writing, Philosophy, Music theory, Geopolitics
|
||||
| Languages | : | Hindi, Punjabi, English, Japanese (can read a little, cannot converse) |
|
||||
| Hobbies | : | Home server/lab, Writing, Philosophy, Music theory, Geopolitics |
|
||||
|
||||
|
||||
507
flake.lock
generated
507
flake.lock
generated
@@ -1,27 +1,512 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"HTTP": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1691464053,
|
||||
"narHash": "sha256-D21ctOBjr2Y3vOFRXKRoFr6uNBvE8q5jC4RrMxRZXTM=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "844ffa82bbe2a2779c86ab3a72ff1b4176cec467",
|
||||
"lastModified": 1451647621,
|
||||
"narHash": "sha256-oHIyw3x0iKBexEo49YeUDV1k74ZtyYKGR2gNJXXRxts=",
|
||||
"owner": "phadej",
|
||||
"repo": "HTTP",
|
||||
"rev": "9bc0996d412fef1787449d841277ef663ad9a915",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"owner": "phadej",
|
||||
"repo": "HTTP",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"cabal-32": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1603716527,
|
||||
"narHash": "sha256-X0TFfdD4KZpwl0Zr6x+PLxUt/VyKQfX7ylXHdmZIL+w=",
|
||||
"owner": "haskell",
|
||||
"repo": "cabal",
|
||||
"rev": "48bf10787e27364730dd37a42b603cee8d6af7ee",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "haskell",
|
||||
"ref": "3.2",
|
||||
"repo": "cabal",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"cabal-34": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1645834128,
|
||||
"narHash": "sha256-wG3d+dOt14z8+ydz4SL7pwGfe7SiimxcD/LOuPCV6xM=",
|
||||
"owner": "haskell",
|
||||
"repo": "cabal",
|
||||
"rev": "5ff598c67f53f7c4f48e31d722ba37172230c462",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "haskell",
|
||||
"ref": "3.4",
|
||||
"repo": "cabal",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"cabal-36": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1669081697,
|
||||
"narHash": "sha256-I5or+V7LZvMxfbYgZATU4awzkicBwwok4mVoje+sGmU=",
|
||||
"owner": "haskell",
|
||||
"repo": "cabal",
|
||||
"rev": "8fd619e33d34924a94e691c5fea2c42f0fc7f144",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "haskell",
|
||||
"ref": "3.6",
|
||||
"repo": "cabal",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"cardano-shell": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1608537748,
|
||||
"narHash": "sha256-PulY1GfiMgKVnBci3ex4ptk2UNYMXqGjJOxcPy2KYT4=",
|
||||
"owner": "input-output-hk",
|
||||
"repo": "cardano-shell",
|
||||
"rev": "9392c75087cb9a3d453998f4230930dea3a95725",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "input-output-hk",
|
||||
"repo": "cardano-shell",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1672831974,
|
||||
"narHash": "sha256-z9k3MfslLjWQfnjBtEtJZdq3H7kyi2kQtUThfTgdRk0=",
|
||||
"owner": "input-output-hk",
|
||||
"repo": "flake-compat",
|
||||
"rev": "45f2638735f8cdc40fe302742b79f248d23eb368",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "input-output-hk",
|
||||
"ref": "hkm/gitlab-fix",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1679360468,
|
||||
"narHash": "sha256-LGnza3cfXF10Biw3ZTg0u9o9t7s680Ww200t5KkHTh8=",
|
||||
"owner": "hamishmack",
|
||||
"repo": "flake-utils",
|
||||
"rev": "e1ea268ff47ad475443dbabcd54744b4e5b9d4f5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hamishmack",
|
||||
"ref": "hkm/nested-hydraJobs",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"ghc-8.6.5-iohk": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1600920045,
|
||||
"narHash": "sha256-DO6kxJz248djebZLpSzTGD6s8WRpNI9BTwUeOf5RwY8=",
|
||||
"owner": "input-output-hk",
|
||||
"repo": "ghc",
|
||||
"rev": "95713a6ecce4551240da7c96b6176f980af75cae",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "input-output-hk",
|
||||
"ref": "release/8.6.5-iohk",
|
||||
"repo": "ghc",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hackage": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1693009291,
|
||||
"narHash": "sha256-ZPP8JRkfItcy8XrT7bbGOdttNFwxjioZskCnt3QwKRc=",
|
||||
"owner": "input-output-hk",
|
||||
"repo": "hackage.nix",
|
||||
"rev": "f8f672afbd7bcfd270db8541f1b10cc2b0d1c3f7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "input-output-hk",
|
||||
"repo": "hackage.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hls-1.10": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1680000865,
|
||||
"narHash": "sha256-rc7iiUAcrHxwRM/s0ErEsSPxOR3u8t7DvFeWlMycWgo=",
|
||||
"owner": "haskell",
|
||||
"repo": "haskell-language-server",
|
||||
"rev": "b08691db779f7a35ff322b71e72a12f6e3376fd9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "haskell",
|
||||
"ref": "1.10.0.0",
|
||||
"repo": "haskell-language-server",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hls-2.0": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1687698105,
|
||||
"narHash": "sha256-OHXlgRzs/kuJH8q7Sxh507H+0Rb8b7VOiPAjcY9sM1k=",
|
||||
"owner": "haskell",
|
||||
"repo": "haskell-language-server",
|
||||
"rev": "783905f211ac63edf982dd1889c671653327e441",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "haskell",
|
||||
"ref": "2.0.0.1",
|
||||
"repo": "haskell-language-server",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hnix": {
|
||||
"inputs": {
|
||||
"HTTP": "HTTP",
|
||||
"cabal-32": "cabal-32",
|
||||
"cabal-34": "cabal-34",
|
||||
"cabal-36": "cabal-36",
|
||||
"cardano-shell": "cardano-shell",
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"ghc-8.6.5-iohk": "ghc-8.6.5-iohk",
|
||||
"hackage": "hackage",
|
||||
"hls-1.10": "hls-1.10",
|
||||
"hls-2.0": "hls-2.0",
|
||||
"hpc-coveralls": "hpc-coveralls",
|
||||
"hydra": "hydra",
|
||||
"iserv-proxy": "iserv-proxy",
|
||||
"nixpkgs": [
|
||||
"hnix",
|
||||
"nixpkgs-unstable"
|
||||
],
|
||||
"nixpkgs-2003": "nixpkgs-2003",
|
||||
"nixpkgs-2105": "nixpkgs-2105",
|
||||
"nixpkgs-2111": "nixpkgs-2111",
|
||||
"nixpkgs-2205": "nixpkgs-2205",
|
||||
"nixpkgs-2211": "nixpkgs-2211",
|
||||
"nixpkgs-2305": "nixpkgs-2305",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"old-ghc-nix": "old-ghc-nix",
|
||||
"stackage": "stackage"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1693011011,
|
||||
"narHash": "sha256-+n/L5Omk4hR19jgEVlnO29ePNVAF1zefN1ift7LoKl8=",
|
||||
"owner": "input-output-hk",
|
||||
"repo": "haskell.nix",
|
||||
"rev": "deeec55d699fc848aaa9e9e8095e114d46e79b76",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "input-output-hk",
|
||||
"repo": "haskell.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hpc-coveralls": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1607498076,
|
||||
"narHash": "sha256-8uqsEtivphgZWYeUo5RDUhp6bO9j2vaaProQxHBltQk=",
|
||||
"owner": "sevanspowell",
|
||||
"repo": "hpc-coveralls",
|
||||
"rev": "14df0f7d229f4cd2e79f8eabb1a740097fdfa430",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "sevanspowell",
|
||||
"repo": "hpc-coveralls",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hydra": {
|
||||
"inputs": {
|
||||
"nix": "nix",
|
||||
"nixpkgs": [
|
||||
"hnix",
|
||||
"hydra",
|
||||
"nix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1671755331,
|
||||
"narHash": "sha256-hXsgJj0Cy0ZiCiYdW2OdBz5WmFyOMKuw4zyxKpgUKm4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "hydra",
|
||||
"rev": "f48f00ee6d5727ae3e488cbf9ce157460853fea8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "hydra",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"iserv-proxy": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1688517130,
|
||||
"narHash": "sha256-hUqfxSlo+ffqVdkSZ1EDoB7/ILCL25eYkcCXW9/P3Wc=",
|
||||
"ref": "hkm/remote-iserv",
|
||||
"rev": "9151db2a9a61d7f5fe52ff8836f18bbd0fd8933c",
|
||||
"revCount": 13,
|
||||
"type": "git",
|
||||
"url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git"
|
||||
},
|
||||
"original": {
|
||||
"ref": "hkm/remote-iserv",
|
||||
"type": "git",
|
||||
"url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git"
|
||||
}
|
||||
},
|
||||
"lowdown-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1633514407,
|
||||
"narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=",
|
||||
"owner": "kristapsdz",
|
||||
"repo": "lowdown",
|
||||
"rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "kristapsdz",
|
||||
"repo": "lowdown",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix": {
|
||||
"inputs": {
|
||||
"lowdown-src": "lowdown-src",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-regression": "nixpkgs-regression"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1661606874,
|
||||
"narHash": "sha256-9+rpYzI+SmxJn+EbYxjGv68Ucp22bdFUSy/4LkHkkDQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nix",
|
||||
"rev": "11e45768b34fdafdcf019ddbd337afa16127ff0f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "2.11.0",
|
||||
"repo": "nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1657693803,
|
||||
"narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "365e1b3a859281cf11b94f87231adeabbdd878a2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-22.05-small",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-2003": {
|
||||
"locked": {
|
||||
"lastModified": 1620055814,
|
||||
"narHash": "sha256-8LEHoYSJiL901bTMVatq+rf8y7QtWuZhwwpKE2fyaRY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1db42b7fe3878f3f5f7a4f2dc210772fd080e205",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-20.03-darwin",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-2105": {
|
||||
"locked": {
|
||||
"lastModified": 1659914493,
|
||||
"narHash": "sha256-lkA5X3VNMKirvA+SUzvEhfA7XquWLci+CGi505YFAIs=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "022caabb5f2265ad4006c1fa5b1ebe69fb0c3faf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-21.05-darwin",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-2111": {
|
||||
"locked": {
|
||||
"lastModified": 1659446231,
|
||||
"narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "eabc38219184cc3e04a974fe31857d8e0eac098d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-21.11-darwin",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-2205": {
|
||||
"locked": {
|
||||
"lastModified": 1685573264,
|
||||
"narHash": "sha256-Zffu01pONhs/pqH07cjlF10NnMDLok8ix5Uk4rhOnZQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "380be19fbd2d9079f677978361792cb25e8a3635",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-22.05-darwin",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-2211": {
|
||||
"locked": {
|
||||
"lastModified": 1688392541,
|
||||
"narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-22.11-darwin",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-2305": {
|
||||
"locked": {
|
||||
"lastModified": 1690680713,
|
||||
"narHash": "sha256-NXCWA8N+GfSQyoN7ZNiOgq/nDJKOp5/BHEpiZP8sUZw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b81af66deb21f73a70c67e5ea189568af53b1e8c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-23.05-darwin",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-regression": {
|
||||
"locked": {
|
||||
"lastModified": 1643052045,
|
||||
"narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1690720142,
|
||||
"narHash": "sha256-GywuiZjBKfFkntQwpNQfL+Ksa2iGjPprBGL0/psgRZM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "3acb5c4264c490e7714d503c7166a3fde0c51324",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"old-ghc-nix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1631092763,
|
||||
"narHash": "sha256-sIKgO+z7tj4lw3u6oBZxqIhDrzSkvpHtv0Kki+lh9Fg=",
|
||||
"owner": "angerman",
|
||||
"repo": "old-ghc-nix",
|
||||
"rev": "af48a7a7353e418119b6dfe3cd1463a657f342b8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "angerman",
|
||||
"ref": "master",
|
||||
"repo": "old-ghc-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"hnix": "hnix",
|
||||
"nixpkgs": [
|
||||
"hnix",
|
||||
"nixpkgs"
|
||||
],
|
||||
"utils": "utils"
|
||||
}
|
||||
},
|
||||
"stackage": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1693008524,
|
||||
"narHash": "sha256-NycZzY3rP9kaueS5z01SUN0R6j6oJCxpoD4K2FodPdE=",
|
||||
"owner": "input-output-hk",
|
||||
"repo": "stackage.nix",
|
||||
"rev": "497c668dbdf24119e5b1c7d4b988013aa03c12df",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "input-output-hk",
|
||||
"repo": "stackage.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
@@ -42,11 +527,11 @@
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1689068808,
|
||||
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
|
||||
"lastModified": 1692799911,
|
||||
"narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
|
||||
"rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
62
flake.nix
62
flake.nix
@@ -2,49 +2,38 @@
|
||||
description = "My personal website";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = github:nixos/nixpkgs/nixpkgs-unstable;
|
||||
nixpkgs.follows = "hnix/nixpkgs";
|
||||
hnix.url = github:input-output-hk/haskell.nix;
|
||||
utils.url = github:numtide/flake-utils;
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, utils }:
|
||||
outputs = { self, nixpkgs, utils, hnix }:
|
||||
utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let
|
||||
overlays = [
|
||||
hnix.overlay
|
||||
];
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
inherit system overlays;
|
||||
inherit (hnix) config;
|
||||
};
|
||||
|
||||
inherit (pkgs.lib.sources) cleanSource;
|
||||
|
||||
vars = pkgs.lib.mapAttrsToList (n: v: "export ${n}=${v}") {
|
||||
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
||||
LANG = "en_US.UTF-8";
|
||||
nattopages = pkgs.haskell-nix.hix.project {
|
||||
src = ./src;
|
||||
compiler-nix-name = "ghc928";
|
||||
};
|
||||
|
||||
site = pkgs.haskellPackages.developPackage {
|
||||
name = "nattopages-site";
|
||||
root = ./src;
|
||||
};
|
||||
|
||||
nattopages = pkgs.stdenv.mkDerivation {
|
||||
name = "nattopages";
|
||||
src = cleanSource ./.;
|
||||
phases = "unpackPhase buildPhase";
|
||||
nativeBuildInputs = [ site ];
|
||||
buildPhase = (pkgs.lib.concatStringsSep "\n" vars) + "\n" +
|
||||
''
|
||||
site build
|
||||
mkdir -p $out
|
||||
cp -r _site/* $out
|
||||
'';
|
||||
};
|
||||
flake = nattopages.flake { };
|
||||
in
|
||||
rec {
|
||||
devShell = with pkgs; with haskellPackages; shellFor {
|
||||
packages = _: [ site ];
|
||||
withHoogle = true;
|
||||
buildInputs = [
|
||||
flake // rec {
|
||||
packages.default = flake.packages."nattopages:exe:site";
|
||||
devShells.default = with pkgs; mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
cabal-install
|
||||
haskellPackages.fourmolu
|
||||
|
||||
(texlive.combine {
|
||||
inherit (texlive)
|
||||
scheme-small
|
||||
@@ -53,19 +42,14 @@
|
||||
parskip
|
||||
hyperref
|
||||
standalone
|
||||
relsize
|
||||
titlesec;
|
||||
})
|
||||
haskell-language-server
|
||||
ghcid
|
||||
site
|
||||
|
||||
packages.default
|
||||
];
|
||||
SSHTARGET = "bat@weirdnatto.in:/var/lib/site/";
|
||||
SSHTARGETPORT = 22002;
|
||||
};
|
||||
packages = {
|
||||
inherit nattopages site;
|
||||
};
|
||||
defaultPackage = packages.nattopages;
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
245
src/Main.hs
Normal file
245
src/Main.hs
Normal file
@@ -0,0 +1,245 @@
|
||||
--------------------------------------------------------------------------------
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
import Data.Functor.Identity (runIdentity)
|
||||
import Data.Maybe (isJust)
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import Hakyll
|
||||
import System.Environment (getEnv)
|
||||
import System.FilePath (replaceDirectory, replaceExtension, takeDirectory)
|
||||
import System.IO.Unsafe (unsafePerformIO)
|
||||
import qualified System.Process as Process
|
||||
import Text.Pandoc (
|
||||
WriterOptions (
|
||||
writerHighlightStyle,
|
||||
writerNumberSections,
|
||||
writerTOCDepth,
|
||||
writerTableOfContents,
|
||||
writerTemplate
|
||||
),
|
||||
)
|
||||
import qualified Text.Pandoc as Pandoc
|
||||
import Text.Pandoc.Templates (Template, compileTemplate)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
main :: IO ()
|
||||
main = hakyllWith config $ do
|
||||
let individualPatterns = fromList ["about.org", "contact.org", "links.org", "documents/cv.org"]
|
||||
let copyPatterns = fromList ["images/**", "fonts/*", "documents/*"]
|
||||
|
||||
match "images/**" $ do
|
||||
route idRoute
|
||||
compile copyFileCompiler
|
||||
|
||||
match "fonts/*" $ do
|
||||
route idRoute
|
||||
compile copyFileCompiler
|
||||
|
||||
match "css/*" $ do
|
||||
route idRoute
|
||||
compile compressCssCompiler
|
||||
|
||||
match "*pdf" $ do
|
||||
route idRoute
|
||||
|
||||
match individualPatterns $ do
|
||||
route $ setExtension "html"
|
||||
compile $
|
||||
pandocCompiler
|
||||
>>= loadAndApplyTemplate "templates/default.html" defaultCtx
|
||||
>>= relativizeUrls
|
||||
|
||||
-- kindly stolen from https://github.com/jaspervdj/jaspervdj/blob/b2a9a34cd2195c6e216b922e152c42266dded99d/src/Main.hs#L163-L169
|
||||
-- also see helper functions writeXetex and xelatex
|
||||
match "documents/cv.org" $
|
||||
version "pdf" $ do
|
||||
route $ setExtension "pdf"
|
||||
compile $
|
||||
getResourceBody
|
||||
>>= readPandoc
|
||||
>>= writeXeTex
|
||||
>>= loadAndApplyTemplate "templates/cv.tex" defaultCtx
|
||||
>>= xelatex
|
||||
|
||||
tags <- buildTags "posts/*" (fromCapture "archive/tags/*.html")
|
||||
|
||||
tagsRules tags $ \tag pattern -> do
|
||||
let title = "Posts tagged \"" ++ tag ++ "\""
|
||||
route idRoute
|
||||
compile $ do
|
||||
posts <- recentFirst =<< loadAll pattern
|
||||
let tagCtx =
|
||||
constField "title" title
|
||||
<> constField "tag" tag
|
||||
<> listField "posts" (postCtx tags) (return posts)
|
||||
<> defaultCtx
|
||||
|
||||
makeItem ""
|
||||
>>= loadAndApplyTemplate "templates/tag.html" tagCtx
|
||||
>>= loadAndApplyTemplate "templates/default.html" tagCtx
|
||||
>>= relativizeUrls
|
||||
|
||||
match "posts/*org" $ do
|
||||
route $ setExtension "html"
|
||||
compile $ do
|
||||
identifier <- getUnderlying
|
||||
toc <- getMetadataField identifier "enabletoc"
|
||||
numbering <- getMetadataField identifier "enablenumbering"
|
||||
let writerOptions' = maybe defaultHakyllWriterOptions (const $ writerOptions $ isJust numbering) toc
|
||||
pandocCompilerWith defaultHakyllReaderOptions writerOptions'
|
||||
>>= saveSnapshot "content"
|
||||
>>= loadAndApplyTemplate "templates/post.html" (postCtx tags)
|
||||
>>= loadAndApplyTemplate "templates/default.html" (postCtx tags)
|
||||
>>= relativizeUrls
|
||||
|
||||
create ["archive.html"] $ do
|
||||
route idRoute
|
||||
compile $ do
|
||||
posts <- recentFirst =<< loadAll "posts/*"
|
||||
let archiveCtx =
|
||||
listField "posts" (postCtx tags) (return posts)
|
||||
<> constField "title" "Archives"
|
||||
<> field "tags" (\_ -> renderTagList tags)
|
||||
<> defaultCtx
|
||||
|
||||
makeItem ""
|
||||
>>= loadAndApplyTemplate "templates/archive.html" archiveCtx
|
||||
>>= loadAndApplyTemplate "templates/default.html" archiveCtx
|
||||
>>= relativizeUrls
|
||||
|
||||
match "index.html" $ do
|
||||
route idRoute
|
||||
compile $ do
|
||||
let indexCtx = defaultCtx
|
||||
|
||||
getResourceBody
|
||||
>>= applyAsTemplate indexCtx
|
||||
>>= loadAndApplyTemplate "templates/default.html" indexCtx
|
||||
>>= relativizeUrls
|
||||
|
||||
create ["rss.xml"] $ do
|
||||
route idRoute
|
||||
compile $ do
|
||||
let feedCtx = postCtx tags <> bodyField "description"
|
||||
posts <- fmap (take 10) . recentFirst =<< loadAllSnapshots "posts/*" "content"
|
||||
renderRss rssFeedConfiguration feedCtx posts
|
||||
|
||||
-- https://robertwpearce.com/hakyll-pt-2-generating-a-sitemap-xml-file.html
|
||||
create ["sitemap.xml"] $ do
|
||||
route idRoute
|
||||
compile $ do
|
||||
posts <- recentFirst =<< loadAll "posts/*"
|
||||
individualPages <- loadAll individualPatterns
|
||||
let pages = posts <> individualPages
|
||||
sitemapCtx =
|
||||
listField "pages" (postCtx tags) (return pages)
|
||||
<> defaultCtx
|
||||
makeItem ""
|
||||
>>= loadAndApplyTemplate "templates/sitemap.xml" sitemapCtx
|
||||
|
||||
match "templates/*" $ compile templateBodyCompiler
|
||||
where
|
||||
-- https://github.com/jaspervdj/jaspervdj/blob/b2a9a34cd2195c6e216b922e152c42266dded99d/src/Main.hs#L214-L218
|
||||
writeXeTex :: Item Pandoc.Pandoc -> Compiler (Item String)
|
||||
writeXeTex = traverse $ \pandoc ->
|
||||
case Pandoc.runPure (Pandoc.writeLaTeX Pandoc.def pandoc) of
|
||||
Left err -> fail $ show err
|
||||
Right x -> return (T.unpack x)
|
||||
|
||||
-- https://github.com/jaspervdj/jaspervdj/blob/b2a9a34cd2195c6e216b922e152c42266dded99d/src/Main.hs#L280-L292
|
||||
-- but even more hacky
|
||||
xelatex :: Item String -> Compiler (Item TmpFile)
|
||||
xelatex item = do
|
||||
TmpFile texPath <- newTmpFile "xelatex.tex"
|
||||
let tmpDir = takeDirectory texPath
|
||||
pdfPath = replaceExtension texPath "pdf"
|
||||
|
||||
unsafeCompiler $ do
|
||||
writeFile texPath $ itemBody item
|
||||
let x = itemBody item
|
||||
_ <-
|
||||
Process.system $
|
||||
unwords
|
||||
[ "xelatex"
|
||||
, "-halt-on-error"
|
||||
, "-output-directory"
|
||||
, tmpDir
|
||||
, texPath
|
||||
, ">/dev/null"
|
||||
, "2>&1"
|
||||
]
|
||||
return ()
|
||||
|
||||
makeItem $ TmpFile pdfPath
|
||||
|
||||
rssFeedConfiguration :: FeedConfiguration
|
||||
rssFeedConfiguration =
|
||||
FeedConfiguration
|
||||
{ feedTitle = "nattopages"
|
||||
, feedDescription = "Pages by natto"
|
||||
, feedAuthorName = "Amneesh Singh"
|
||||
, feedAuthorEmail = "natto@weirdnatto.in"
|
||||
, feedRoot = "https://weirdnatto.in"
|
||||
}
|
||||
|
||||
config :: Configuration
|
||||
config =
|
||||
defaultConfiguration
|
||||
{ deployCommand = "rsync --checksum -ave 'ssh -p" ++ sshTargetPort ++ "' _site/* " ++ sshTarget
|
||||
, previewPort = 3333
|
||||
}
|
||||
where
|
||||
{-# NOINLINE sshTarget #-}
|
||||
sshTarget = unsafePerformIO $ getEnv "SSHTARGET"
|
||||
{-# NOINLINE sshTargetPort #-}
|
||||
sshTargetPort = unsafePerformIO $ getEnv "SSHTARGETPORT"
|
||||
|
||||
postCtx :: Tags -> Context String
|
||||
postCtx tags =
|
||||
tagsField "tags" tags
|
||||
-- <> teaserFieldWithSeparator "((.tease.))" "teaser" "content"
|
||||
<> dateField "date" "%B %e, %Y"
|
||||
<> dateField "altdate" "%Y-%m-%d"
|
||||
<> teaserField "teaser" "content"
|
||||
<> defaultCtx
|
||||
|
||||
defaultCtx :: Context String
|
||||
defaultCtx =
|
||||
listField "subdomains" subCtx (return subdomains)
|
||||
<> domainCtx
|
||||
<> defaultContext
|
||||
where
|
||||
domain :: String
|
||||
domain = "weirdnatto.in"
|
||||
subCtx :: Context String
|
||||
subCtx =
|
||||
field "name" (return . itemBody)
|
||||
<> domainCtx
|
||||
domainCtx :: Context String
|
||||
domainCtx = constField "domain" domain
|
||||
subdomains :: [Item String]
|
||||
subdomains = map mkItem ["git", "radio", "f"]
|
||||
where
|
||||
mkItem :: a -> Item a
|
||||
mkItem a = Item{itemIdentifier = "subdomain", itemBody = a}
|
||||
|
||||
writerOptions :: Bool -> WriterOptions
|
||||
writerOptions withNumbering =
|
||||
defaultHakyllWriterOptions
|
||||
{ writerNumberSections = withNumbering
|
||||
, writerTableOfContents = True
|
||||
, writerTOCDepth = 2
|
||||
, writerTemplate = Just tocTemplate
|
||||
}
|
||||
|
||||
tocTemplate :: Text.Pandoc.Templates.Template Text
|
||||
tocTemplate =
|
||||
either error id . runIdentity . compileTemplate "" $
|
||||
T.unlines
|
||||
[ "<div class=\"toc\"><div class=\"toc-header\">Table of Contents</div>"
|
||||
, "$toc$"
|
||||
, "</div>"
|
||||
, "$body$"
|
||||
]
|
||||
7
src/cabal.project
Normal file
7
src/cabal.project
Normal file
@@ -0,0 +1,7 @@
|
||||
packages: .
|
||||
|
||||
source-repository-package
|
||||
type: git
|
||||
location: https://github.com/natto1784/pandoc.git
|
||||
tag: b30124ce3e835cdb7b35fafd88c86d0841dcfaa9
|
||||
--sha256: sha256-tHUhx+RBGFN+Km0qulSrD9NSsMIAjIhOU+6CxGPmwZ8=
|
||||
@@ -5,12 +5,12 @@ license: MIT
|
||||
cabal-version: >= 1.10
|
||||
|
||||
executable site
|
||||
main-is: site.hs
|
||||
main-is: Main.hs
|
||||
build-depends: base == 4.*
|
||||
, filepath == 1.4.*
|
||||
, hakyll == 4.15.*
|
||||
, pandoc == 2.*
|
||||
, hakyll == 4.16.*
|
||||
, pandoc == 3.1.6.2
|
||||
, process == 1.6.*
|
||||
, text == 1.*
|
||||
, text == 2.*
|
||||
ghc-options: -threaded -rtsopts -with-rtsopts=-N
|
||||
default-language: Haskell2010
|
||||
|
||||
245
src/site.hs
245
src/site.hs
@@ -1,245 +0,0 @@
|
||||
--------------------------------------------------------------------------------
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
import Data.Functor.Identity (runIdentity)
|
||||
import Data.Maybe (isJust)
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import Hakyll
|
||||
import System.FilePath (replaceDirectory, replaceExtension, takeDirectory)
|
||||
import qualified System.Process as Process
|
||||
import Text.Pandoc
|
||||
( WriterOptions
|
||||
( writerHighlightStyle,
|
||||
writerNumberSections,
|
||||
writerTOCDepth,
|
||||
writerTableOfContents,
|
||||
writerTemplate
|
||||
),
|
||||
)
|
||||
import qualified Text.Pandoc as Pandoc
|
||||
import Text.Pandoc.Templates (Template, compileTemplate)
|
||||
import System.Environment (getEnv)
|
||||
import System.IO.Unsafe (unsafePerformIO)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
main :: IO ()
|
||||
main = hakyllWith config $ do
|
||||
let individualPatterns = fromList ["about.org", "contact.org", "links.org", "documents/cv.org"]
|
||||
let copyPatterns = fromList ["images/**", "fonts/*", "documents/*"]
|
||||
|
||||
match "images/**" $ do
|
||||
route idRoute
|
||||
compile copyFileCompiler
|
||||
|
||||
match "fonts/*" $ do
|
||||
route idRoute
|
||||
compile copyFileCompiler
|
||||
|
||||
match "css/*" $ do
|
||||
route idRoute
|
||||
compile compressCssCompiler
|
||||
|
||||
match "*pdf" $ do
|
||||
route idRoute
|
||||
|
||||
match individualPatterns $ do
|
||||
route $ setExtension "html"
|
||||
compile $
|
||||
pandocCompiler
|
||||
>>= loadAndApplyTemplate "templates/default.html" defaultCtx
|
||||
>>= relativizeUrls
|
||||
|
||||
-- kindly stolen from https://github.com/jaspervdj/jaspervdj/blob/b2a9a34cd2195c6e216b922e152c42266dded99d/src/Main.hs#L163-L169
|
||||
-- also see helper functions writeXetex and xelatex
|
||||
match "documents/cv.org" $
|
||||
version "pdf" $ do
|
||||
route $ setExtension "pdf"
|
||||
compile $
|
||||
getResourceBody
|
||||
>>= readPandoc
|
||||
>>= writeXeTex
|
||||
>>= loadAndApplyTemplate "templates/cv.tex" defaultCtx
|
||||
>>= xelatex
|
||||
|
||||
tags <- buildTags "posts/*" (fromCapture "archive/tags/*.html")
|
||||
|
||||
tagsRules tags $ \tag pattern -> do
|
||||
let title = "Posts tagged \"" ++ tag ++ "\""
|
||||
route idRoute
|
||||
compile $ do
|
||||
posts <- recentFirst =<< loadAll pattern
|
||||
let tagCtx =
|
||||
constField "title" title
|
||||
<> constField "tag" tag
|
||||
<> listField "posts" (postCtx tags) (return posts)
|
||||
<> defaultCtx
|
||||
|
||||
makeItem ""
|
||||
>>= loadAndApplyTemplate "templates/tag.html" tagCtx
|
||||
>>= loadAndApplyTemplate "templates/default.html" tagCtx
|
||||
>>= relativizeUrls
|
||||
|
||||
match "posts/*org" $ do
|
||||
route $ setExtension "html"
|
||||
compile $ do
|
||||
identifier <- getUnderlying
|
||||
toc <- getMetadataField identifier "enabletoc"
|
||||
numbering <- getMetadataField identifier "enablenumbering"
|
||||
let writerOptions' = maybe defaultHakyllWriterOptions (const $ writerOptions $ isJust numbering) toc
|
||||
pandocCompilerWith defaultHakyllReaderOptions writerOptions'
|
||||
>>= saveSnapshot "content"
|
||||
>>= loadAndApplyTemplate "templates/post.html" (postCtx tags)
|
||||
>>= loadAndApplyTemplate "templates/default.html" (postCtx tags)
|
||||
>>= relativizeUrls
|
||||
|
||||
create ["archive.html"] $ do
|
||||
route idRoute
|
||||
compile $ do
|
||||
posts <- recentFirst =<< loadAll "posts/*"
|
||||
let archiveCtx =
|
||||
listField "posts" (postCtx tags) (return posts)
|
||||
<> constField "title" "Archives"
|
||||
<> field "tags" (\_ -> renderTagList tags)
|
||||
<> defaultCtx
|
||||
|
||||
makeItem ""
|
||||
>>= loadAndApplyTemplate "templates/archive.html" archiveCtx
|
||||
>>= loadAndApplyTemplate "templates/default.html" archiveCtx
|
||||
>>= relativizeUrls
|
||||
|
||||
match "index.html" $ do
|
||||
route idRoute
|
||||
compile $ do
|
||||
let indexCtx = defaultCtx
|
||||
|
||||
getResourceBody
|
||||
>>= applyAsTemplate indexCtx
|
||||
>>= loadAndApplyTemplate "templates/default.html" indexCtx
|
||||
>>= relativizeUrls
|
||||
|
||||
create ["rss.xml"] $ do
|
||||
route idRoute
|
||||
compile $ do
|
||||
let feedCtx = postCtx tags <> bodyField "description"
|
||||
posts <- fmap (take 10) . recentFirst =<< loadAllSnapshots "posts/*" "content"
|
||||
renderRss rssFeedConfiguration feedCtx posts
|
||||
|
||||
-- https://robertwpearce.com/hakyll-pt-2-generating-a-sitemap-xml-file.html
|
||||
create ["sitemap.xml"] $ do
|
||||
route idRoute
|
||||
compile $ do
|
||||
posts <- recentFirst =<< loadAll "posts/*"
|
||||
individualPages <- loadAll individualPatterns
|
||||
let pages = posts <> individualPages
|
||||
sitemapCtx =
|
||||
listField "pages" (postCtx tags) (return pages)
|
||||
<> defaultCtx
|
||||
makeItem ""
|
||||
>>= loadAndApplyTemplate "templates/sitemap.xml" sitemapCtx
|
||||
|
||||
match "templates/*" $ compile templateBodyCompiler
|
||||
where
|
||||
-- https://github.com/jaspervdj/jaspervdj/blob/b2a9a34cd2195c6e216b922e152c42266dded99d/src/Main.hs#L214-L218
|
||||
writeXeTex :: Item Pandoc.Pandoc -> Compiler (Item String)
|
||||
writeXeTex = traverse $ \pandoc ->
|
||||
case Pandoc.runPure (Pandoc.writeLaTeX Pandoc.def pandoc) of
|
||||
Left err -> fail $ show err
|
||||
Right x -> return (T.unpack x)
|
||||
|
||||
-- https://github.com/jaspervdj/jaspervdj/blob/b2a9a34cd2195c6e216b922e152c42266dded99d/src/Main.hs#L280-L292
|
||||
-- but even more hacky
|
||||
xelatex :: Item String -> Compiler (Item TmpFile)
|
||||
xelatex item = do
|
||||
TmpFile texPath <- newTmpFile "xelatex.tex"
|
||||
let tmpDir = takeDirectory texPath
|
||||
pdfPath = replaceExtension texPath "pdf"
|
||||
|
||||
unsafeCompiler $ do
|
||||
writeFile texPath $ itemBody item
|
||||
let x = itemBody item
|
||||
_ <-
|
||||
Process.system $
|
||||
unwords
|
||||
[ "xelatex",
|
||||
"-halt-on-error",
|
||||
"-output-directory",
|
||||
tmpDir,
|
||||
texPath,
|
||||
">/dev/null",
|
||||
"2>&1"
|
||||
]
|
||||
return ()
|
||||
|
||||
makeItem $ TmpFile pdfPath
|
||||
|
||||
rssFeedConfiguration :: FeedConfiguration
|
||||
rssFeedConfiguration =
|
||||
FeedConfiguration
|
||||
{ feedTitle = "nattopages",
|
||||
feedDescription = "Pages by natto",
|
||||
feedAuthorName = "Amneesh Singh",
|
||||
feedAuthorEmail = "natto@weirdnatto.in",
|
||||
feedRoot = "https://weirdnatto.in"
|
||||
}
|
||||
|
||||
config :: Configuration
|
||||
config =
|
||||
defaultConfiguration
|
||||
{ deployCommand = "rsync --checksum -ave 'ssh -p" ++ sshTargetPort ++"' _site/* " ++ sshTarget,
|
||||
previewPort = 3333
|
||||
}
|
||||
where
|
||||
{-# NOINLINE sshTarget#-}
|
||||
sshTarget = unsafePerformIO $ getEnv "SSHTARGET"
|
||||
{-# NOINLINE sshTargetPort#-}
|
||||
sshTargetPort = unsafePerformIO $ getEnv "SSHTARGETPORT"
|
||||
|
||||
postCtx :: Tags -> Context String
|
||||
postCtx tags =
|
||||
tagsField "tags" tags
|
||||
-- <> teaserFieldWithSeparator "((.tease.))" "teaser" "content"
|
||||
<> dateField "date" "%B %e, %Y"
|
||||
<> dateField "altdate" "%Y-%m-%d"
|
||||
<> teaserField "teaser" "content"
|
||||
<> defaultCtx
|
||||
|
||||
defaultCtx :: Context String
|
||||
defaultCtx =
|
||||
listField "subdomains" subCtx (return subdomains)
|
||||
<> domainCtx
|
||||
<> defaultContext
|
||||
where
|
||||
domain :: String
|
||||
domain = "weirdnatto.in"
|
||||
subCtx :: Context String
|
||||
subCtx =
|
||||
field "name" (return . itemBody)
|
||||
<> domainCtx
|
||||
domainCtx :: Context String
|
||||
domainCtx = constField "domain" domain
|
||||
subdomains :: [Item String]
|
||||
subdomains = map mkItem ["git", "radio", "f"]
|
||||
where
|
||||
mkItem :: a -> Item a
|
||||
mkItem a = Item {itemIdentifier = "subdomain", itemBody = a}
|
||||
|
||||
writerOptions :: Bool -> WriterOptions
|
||||
writerOptions withNumbering =
|
||||
defaultHakyllWriterOptions
|
||||
{ writerNumberSections = withNumbering,
|
||||
writerTableOfContents = True,
|
||||
writerTOCDepth = 2,
|
||||
writerTemplate = Just tocTemplate
|
||||
}
|
||||
|
||||
tocTemplate :: Text.Pandoc.Templates.Template Text
|
||||
tocTemplate =
|
||||
either error id . runIdentity . compileTemplate "" $
|
||||
T.unlines
|
||||
[ "<div class=\"toc\"><div class=\"toc-header\">Table of Contents</div>",
|
||||
"$toc$",
|
||||
"</div>",
|
||||
"$body$"
|
||||
]
|
||||
@@ -1,31 +1,13 @@
|
||||
\documentclass[a4paper, 10pt]{article}
|
||||
\documentclass[a4paper,11pt]{article}
|
||||
|
||||
|
||||
\usepackage[margin=0.5in]{geometry}
|
||||
\usepackage[colorlinks=true]{hyperref}
|
||||
\usepackage{longtable}
|
||||
\usepackage{booktabs}
|
||||
|
||||
\usepackage{fontspec}
|
||||
\setmainfont[
|
||||
Path = fonts/,
|
||||
Extension = .ttf,
|
||||
UprightFont = *-Regular,
|
||||
ItalicFont = *-Italic,
|
||||
BoldFont = *-Bold,
|
||||
BoldItalicFont = *-BoldItalic
|
||||
]{Arvo}
|
||||
|
||||
\setsansfont[
|
||||
Path = fonts/,
|
||||
Extension = .ttf,
|
||||
UprightFont = *-Regular,
|
||||
ItalicFont = *-Italic,
|
||||
BoldFont = *-Bold,
|
||||
BoldItalicFont = *-BoldItalic
|
||||
]{Lato}
|
||||
|
||||
\usepackage{enumitem}
|
||||
\setlist[itemize]{leftmargin=*}
|
||||
\setlist[itemize]{leftmargin=*, partopsep=-4pt }
|
||||
|
||||
\usepackage{parskip}
|
||||
\setlength{\parindent}{0em}
|
||||
@@ -34,16 +16,28 @@
|
||||
|
||||
\def\tightlist{}
|
||||
\usepackage{ulem}
|
||||
\normalem
|
||||
|
||||
\usepackage{titlesec}
|
||||
\titleformat{\section}[hang]{\normalfont\Large}{\thesection}{1em}{}[{\titlerule[0.8pt]}]
|
||||
\titleformat{\subsection}[hang]{\normalfont\normalsize\bfseries}{\thesubsection}{1em}{}
|
||||
\titleformat{\subsubsection}[hang]{\normalfont\normalsize\itshape}{\thesubsubsection}{1em}{}
|
||||
\titleformat{\section}{
|
||||
\vspace{-5pt}\scshape\raggedright\large
|
||||
}{}{0em}{}[\vspace{-5pt}]
|
||||
|
||||
\titleformat{\subsection}{
|
||||
\vspace{-2pt}\raggedright\normalsize\bfseries
|
||||
}{}{0em}{}[\vspace{-5pt}]
|
||||
|
||||
\titlespacing{\subsection}{0pt}{8pt}{5pt}
|
||||
|
||||
\let\OldRule\rule
|
||||
\renewcommand{\rule}[2]{\OldRule{\linewidth}{#2}}
|
||||
|
||||
\setlength{\LTleft}{0pt}
|
||||
\setlength{\LTpre}{3pt}
|
||||
\setlength{\LTpost}{0pt}
|
||||
|
||||
\usepackage{relsize}
|
||||
|
||||
\titlespacing\section{0pt}{12pt plus 4pt minus 2pt}{6pt plus 2pt minus 2pt}
|
||||
\titlespacing\subsection{0pt}{8pt plus 4pt minus 2pt}{4pt plus 2pt minus 2pt}
|
||||
\titlespacing\subsubsection{0pt}{6pt plus 4pt minus 2pt}{4pt plus 2pt minus 2pt}
|
||||
\setlength{\LTleft}{0pt}
|
||||
\begin{document}
|
||||
$body$
|
||||
\end{document}
|
||||
|
||||
Reference in New Issue
Block a user