Added nix package that build site from org mode

This commit is contained in:
Aleksandr Lebedev 2025-10-22 17:59:54 +02:00
parent 631e7c2237
commit 94ab268ab9
6 changed files with 110 additions and 66 deletions

27
flake.lock generated Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1760878510,
"narHash": "sha256-K5Osef2qexezUfs0alLvZ7nQFTGS9DL2oTVsIXsqLgs=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "5e2a59a5b1a82f89f2c7e598302a9cacebb72a67",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

13
flake.nix Normal file
View file

@ -0,0 +1,13 @@
{
description = "A flake to build my website";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs = {self, ...} @ inputs: let
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
in {
packages.x86_64-linux.website = pkgs.callPackage ./package.nix {};
};
}

View file

@ -1,66 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="authorization_endpoint" href="https://indieauth.com/auth">
<link rel="token_endpoint" href="https://tokens.indieauth.com/token">
<!-- To use social readers via microsub, follow these steps.
(Details: https://indieweb.org/Microsub#Getting_Started)
1. After publishing this to your domain, sign in to https://aperture.p3k.io/login with your domain
2. You will see a <link> tag displayed on your dashboard that looks like:
<link rel="microsub" href="https://aperture.p3k.io/microsub/000">
3. Copy that <link> tag and paste it after this HTML comment.
4. Publish the updated page!
-->
<title>Aleksandr Lebedev</title>
<style>
@media (prefers-color-scheme: dark) {
html { background-color: #111111; color: #fbfbfb; }
a { color: #ca8465; }
}
body {
line-height: 1.6;
font-family: system-ui, -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
text-align: center;
margin: 1rem auto;
min-height: 90vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
img.u-photo { border-radius: 50%; }
ul { padding: 0; list-style: none; }
</style>
</head>
<body>
<!-- Reference for representative h-card properties: https://microformats.org/wiki/h-card -->
<main class="h-card" rel="author">
<!-- Uncomment and add __your_image__ to display a photo!
<img class="u-photo" alt="My profile photo" src="__your_image__" />
-->
<h1>
I'm <span class="p-name">Sasha</span>.
</h1>
<p class="p-note">
...and I am a human on the Internet.
</p>
<ul>
<!-- Replace __this_page__ with your domain -->
<li><a class="u-uid u-url" href="aleksandrlebedev.com">My New Website</a></li>
<!-- Update or remove the below links! -->
<!-- Replace _mygithubid_ with your GitHub username in both places on the next line: -->
<li>Github: <a class="u-url" href="https://github.com/KyleKrein" rel="me">@_mygithubid_</a></li>
</ul>
</main>
</body>
</html>

7
index.org Normal file
View file

@ -0,0 +1,7 @@
#+title: Aleksandr Lebedev
Hi! Welcome to my new [[https://alexanderlebedev.com][website]]!
* How to find me:
- [[https://git.kylekrein.com/kylekrein][Forgejo (Git)]]

46
package.nix Normal file
View file

@ -0,0 +1,46 @@
{
stdenvNoCC,
writeText,
emacs,
}: let
src = ./.;
buildScript = writeText "build-site.el" ''
;; Load the publishing system
(require 'ox-publish)
;; Define the publishing project
(setq org-publish-project-alist
(list
(list "kylekrein's website"
:recursive t
:base-directory "${src}"
:publishing-directory "./public"
:publishing-function 'org-html-publish-to-html
:with-author nil ;; Don't include author name
:with-creator t ;; Include Emacs and Org versions in footer
:with-toc nil ;; Include a table of contents
:section-numbers nil ;; Don't include section numbers
:time-stamp-file nil))) ;; Don't include time stamp in file
;; Customize the HTML output
(setq org-html-validation-link nil ;; Don't show validation link
org-html-head-include-scripts nil ;; Use our own scripts
org-html-head-include-default-style nil ;; Use our own styles
org-html-head "<link rel=\"stylesheet\" href=\"${./style.css}\" />")
;; Generate the site output
(org-publish-all t)
(message "Build complete!")
'';
in
stdenvNoCC.mkDerivation {
name = "KyleKrein's Website";
inherit src;
buildPhase = ''
HOME=$(pwd) ${emacs}/bin/emacs -Q --script ${buildScript}
'';
installPhase = ''
mkdir -p $out
cd public
cp -r . $out/
'';
}

17
style.css Normal file
View file

@ -0,0 +1,17 @@
@media (prefers-color-scheme: dark) {
html { background-color: #111111; color: #fbfbfb; }
a { color: #ca8465; }
}
body {
line-height: 1.6;
font-family: system-ui, -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
text-align: center;
margin: 1rem auto;
min-height: 90vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
img.u-photo { border-radius: 50%; }
ul { padding: 0; list-style: none; }