From 00318550cfb691e3be7a7d74fd1da8d9c0f27565 Mon Sep 17 00:00:00 2001 From: William McKinnon Date: Wed, 5 Jun 2024 02:00:32 -0400 Subject: [PATCH] site-update --- app/globals.css | 18 ++++++------------ app/layout.tsx | 5 +++-- app/navbar.tsx | 13 ++++++++----- app/posts/[slug]/page.tsx | 9 ++++++--- contentlayer.config.js | 1 + posts/nixos-anywhere.md | 23 +++++++++++++++++++++++ posts/test.md | 9 --------- tailwind.config.ts | 9 ++------- 8 files changed, 49 insertions(+), 38 deletions(-) create mode 100644 posts/nixos-anywhere.md delete mode 100644 posts/test.md diff --git a/app/globals.css b/app/globals.css index fd81e88..228217b 100644 --- a/app/globals.css +++ b/app/globals.css @@ -3,25 +3,19 @@ @tailwind utilities; :root { - --foreground-rgb: 0, 0, 0; - --background-start-rgb: 214, 219, 220; - --background-end-rgb: 255, 255, 255; + --foreground-rgb: 68, 68, 68; + --background-rgb: 255, 255, 255; } @media (prefers-color-scheme: dark) { :root { - --foreground-rgb: 255, 255, 255; - --background-start-rgb: 0, 0, 0; - --background-end-rgb: 0, 0, 0; + --foreground-rgb: 187, 187, 187; + --background-rgb: 0, 0, 0; } } body { color: rgb(var(--foreground-rgb)); - background: linear-gradient( - to bottom, - transparent, - rgb(var(--background-end-rgb)) - ) - rgb(var(--background-start-rgb)); + background: rgb(var(--background-rgb)); } + diff --git a/app/layout.tsx b/app/layout.tsx index 7557ae2..95c1619 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -14,12 +14,13 @@ export const metadata: Metadata = { export default function RootLayout({children}: { children: React.ReactNode }) { return ( - + -
+
{children}
) } + diff --git a/app/navbar.tsx b/app/navbar.tsx index 598513a..19b8f23 100644 --- a/app/navbar.tsx +++ b/app/navbar.tsx @@ -5,8 +5,8 @@ import { allPosts, Post } from 'contentlayer/generated' function PostCard(post: Post) { return (
-

- +

+ {post.title}

@@ -18,9 +18,12 @@ export default function Navbar() { const posts = allPosts.sort((a, b) => compareDesc(new Date(a.date), new Date(b.date))) return ( -
-

Will McKinnon's Blog

-

Posts

+
+ +

Will

McKinnon

+ +
+

POSTS

{posts.map((post, idx) => ( ))} diff --git a/app/posts/[slug]/page.tsx b/app/posts/[slug]/page.tsx index d4438cf..7966e19 100644 --- a/app/posts/[slug]/page.tsx +++ b/app/posts/[slug]/page.tsx @@ -11,15 +11,18 @@ export const generateMetadata = ({ params }: { params: { slug: string } }) => { const PostLayout = ({ params }: { params: { slug: string } }) => { const post = allPosts.find((post) => post._raw.flattenedPath === params.slug) - if (!post) throw new Error(`Post not found for slug: ${params.slug}`) + if (!post) { + // TODO: 404 page + throw new Error(`Post not found for slug: ${params.slug}`) + } return ( -
+
+

{post.title}

-

{post.title}

diff --git a/contentlayer.config.js b/contentlayer.config.js index c6b69d7..6150d40 100644 --- a/contentlayer.config.js +++ b/contentlayer.config.js @@ -13,3 +13,4 @@ export const Post = defineDocumentType(() => ({ })) export default makeSource({ contentDirPath: 'posts', documentTypes: [Post] }) + diff --git a/posts/nixos-anywhere.md b/posts/nixos-anywhere.md new file mode 100644 index 0000000..3bef7d7 --- /dev/null +++ b/posts/nixos-anywhere.md @@ -0,0 +1,23 @@ +--- +title: Easily Install NixOS with nixos-anywhere +date: 2024-06-24 +--- + +If you enjoy NixOS as much as I do, you're probably starting to amass quite a large and complex config. Perhaps you have started to use secret management tools like [agenix](https://github.com/ryantm/agenix) or [sops-nix](https://github.com/Mic92/sops-nix), and maybe you even have your [root directory living in a tmpfs](https://grahamc.com/blog/erase-your-darlings/). + +If you fall under this category, you've surely came to a realisation: *adding a new machine to your config is a pain in the ass*. + +Fortunately for you, I've been there - and boy, do I have a great solution. Want to install your complex config, or onboard a new host, in as little as two steps, all remotely (or as remotely as you can get)? Read on. + +## Setup + +The nixos installation media is awesome! It provides a simple nixos instance from which you can install the operating system, but what if I told you it could be better? We can make our own version of the nixos-installation image, which includes the public keys of the machines in our config - allowing you to boot up the installation media, and then `ssh` into the host and perform the rest of the installation remotely. + +The config for the image is a simple 5 lines: +```nix +{ + system.activatable = false; + networking.hostName = "nixos-install"; + users.users.root.openssh.authorizedKeys.keys = [ ]; +} +``` diff --git a/posts/test.md b/posts/test.md deleted file mode 100644 index e2b5e44..0000000 --- a/posts/test.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Test title -date: 2021-12-24 ---- - -1. test list -2. test list - -test content diff --git a/tailwind.config.ts b/tailwind.config.ts index 1c738de..6ff021d 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -5,14 +5,9 @@ const config: Config = { './app/**/*.tsx', ], theme: { - extend: { - backgroundImage: { - 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))', - 'gradient-conic': - 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))', - }, - }, + extend: {}, }, plugins: [], } export default config +