Skip to content

Commit

Permalink
feat!: move docs to website (#170)
Browse files Browse the repository at this point in the history
* feat!: move docs to website

* feat: flesh out docs site

* docs: add changelog to website

* docs: fix `npins add` command snippet

* docs: remove broken declarations

* ci: remove local docgen

* docs: update site FAQ
  • Loading branch information
getchoo authored May 21, 2024
1 parent 57e8376 commit 1f11b0a
Show file tree
Hide file tree
Showing 24 changed files with 1,624 additions and 2,825 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ trim_trailing_whitespace = false
# windows shell scripts
[*.{cmd,bat,ps1}]
end_of_line = crlf

# npins
[.sources/sources.json]
trim_trailing_whitespace = false
61 changes: 61 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build & deploy website

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

jobs:
build:
name: Build site

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Nix
uses: cachix/install-nix-action@v26

- name: Setup cache
uses: DeterminateSystems/magic-nix-cache-action@v6

- name: Run build
run: |
nix build \
--print-build-logs \
--show-trace \
'./dev#site'
- name: Get artifact directory
id: find-path
run: |
# exit if no `result` from `nix build`
[ ! -L result ] && exit 1
echo "path=$(readlink -f result)" >> "$GITHUB_OUTPUT"
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ steps.find-path.outputs.path }}

deploy:
name: Deploy website
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'

runs-on: ubuntu-latest

environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}

permissions:
id-token: write
pages: write

steps:
- name: Deploy to GitHub Pages
id: deploy
uses: actions/deploy-pages@v4
49 changes: 0 additions & 49 deletions .github/workflows/update-docs.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# mdbook artifacts
**/book

# nix artifacts
result
result-*
repl-result-*

47 changes: 31 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

## Usage

You will probably want to see our [Getting started guide](http://nix.catppuccin.com/getting-started/index.html), but as a TLDR:

1. Import the [NixOS](https://nixos.org) and [home-manager](https://github.com/nix-community/home-manager) modules

<details>
Expand All @@ -44,26 +46,26 @@
```nix
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-22.11";
nixpkgs.url = "nixpkgs/nixos-unstable";
catppuccin.url = "github:catppuccin/nix";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, catppuccin, home-manager }: let
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
in {
outputs = { nixpkgs, catppuccin, home-manager }: {
# for nixos module home-manager installations
nixosConfigurations.host = pkgs.lib.nixosSystem {
inherit system;
nixosConfigurations.pepperjacksComputer = pkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
catppuccin.nixosModules.catppuccin
# if you use home-manager
home-manager.nixosModules.home-manager
{
home-manager.users.user = {
# if you use home-manager
home-manager.users.pepperjack = {
imports = [
./home.nix
catppuccin.homeManagerModules.catppuccin
Expand All @@ -74,9 +76,10 @@
};
# for standalone home-manager installations
homeConfigurations.user = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
homeConfigurations.pepperjack = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [
./home.nix
catppuccin.homeManagerModules.catppuccin
];
};
Expand All @@ -100,11 +103,13 @@ For [NixOS module installations](https://nix-community.github.io/home-manager/in
```nix
{
imports = [
<home-manager/nixos>
<catppuccin/modules/nixos>
# if you use home-manager
<home-manager/nixos>
];
home-manager.users.user = {
# if you use home-manager
home-manager.users.pepperjack = {
imports = [
<catppuccin/modules/home-manager>
];
Expand All @@ -121,8 +126,7 @@ For [standalone installations](https://nix-community.github.io/home-manager/inde
<catppuccin/modules/home-manager>
];
home.username = "user";
home.homeDirectory = "user";
home.username = "pepperjack";
programs.home-manager.enable = true;
}
```
Expand All @@ -148,11 +152,22 @@ For [standalone installations](https://nix-community.github.io/home-manager/inde
}
```

4. Enable for all available programs you're using!

```nix
{
catppuccin.enable = true;
}
```

## 🙋 FAQ

- Q: **"How do I know what programs are supported?"**\
A: You can find programs supported through home-manager [here](https://github.com/catppuccin/nix/tree/main/modules/home-manager),
and NixOS modules [here](https://github.com/catppuccin/nix/tree/main/modules/nixos)
A: You can find programs supported through home-manager [here](https://nix.catppuccin.com/options/home-manager-options.html),
and NixOS modules [here](https://nix.catppuccin.com/options/nixos-options.html)

- Q: **"How do I set `catppuccin.enable` for everything I use?"**\
A: You can set `catppuccin.enable` [globally](options/nixos-options.md#catppuccinenable)

- Q: **"What versions of NixOS and home-manager are supported?"**\
A: We primarily support the `unstable` branch, but try our best to support the current stable release.
Expand Down
9 changes: 0 additions & 9 deletions default.nix

This file was deleted.

34 changes: 30 additions & 4 deletions dev/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
forAllSystems = fn: nixpkgs.lib.genAttrs systems (system: fn nixpkgsFor.${system}.unstable);
in
{
apps = forAllSystems ({ lib, pkgs, ... }: {
apps = forAllSystems ({ lib, pkgs, system, ... }: {
add-source = {
type = "app";
program = lib.getExe (
Expand All @@ -49,6 +49,11 @@
''
);
};

serve = {
type = "app";
program = lib.getExe self.packages.${system}.site.serve;
};
});

checks = forAllSystems ({ lib, pkgs, system, ... }: lib.optionalAttrs pkgs.stdenv.isLinux {
Expand All @@ -60,21 +65,42 @@

formatter = forAllSystems (pkgs: pkgs.nixpkgs-fmt);

packages = forAllSystems (pkgs:
packages = forAllSystems ({ lib, pkgs, system, ... }:
let
version = self.shortRev or self.dirtyShortRev or "unknown";
mkOptionDoc = args: (pkgs.callPackage ./option-doc.nix { }) (args // { inherit version; });
mkOptionDoc = pkgs.callPackage ../docs/options-doc.nix { };
mkSite = pkgs.callPackage ../docs/mk-site.nix { };
packages' = self.packages.${system};
in
{
nixos-doc = mkOptionDoc {
inherit version;
modules = [ ../modules/nixos ];
};

home-manager-doc = mkOptionDoc {
inherit version;
modules = [ ../modules/home-manager ];
};

default = self.packages.${pkgs.system}.home-manager-doc;
site = mkSite {
pname = "catppuccin-nix-website";
inherit version;

src = lib.fileset.toSource {
root = ../docs;
fileset = lib.fileset.unions [
../docs/src
../docs/book.toml
../docs/theme
];
};

nixosDoc = packages'.nixos-doc;
homeManagerDoc = packages'.home-manager-doc;
};

default = packages'.site;
});
};
}
29 changes: 0 additions & 29 deletions dev/option-doc.nix

This file was deleted.

16 changes: 16 additions & 0 deletions docs/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[book]
title = "catppuccin/nix"
authors = ["getchoo"]
description = "Soothing pastel theme for Nix"
language = "en"
multilingual = false
src = "src"

[output.html]
default-theme = "mocha"
preferred-dark-theme = "mocha"
additional-css = ["./theme/catppuccin.css"]
no-section-label = true
git-repository-url = "https://github.com/catppuccin/nix"
git-repository-icon = "fa-github"
cname = "nix.catppuccin.com"
Loading

0 comments on commit 1f11b0a

Please sign in to comment.