Skip to content

Commit

Permalink
Port docs to Emanote (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
srid authored Jan 23, 2024
1 parent f2e467d commit 5f4e66f
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 89 deletions.
10 changes: 0 additions & 10 deletions doc/examples.md

This file was deleted.

9 changes: 0 additions & 9 deletions doc/guide/_category_.json

This file was deleted.

58 changes: 0 additions & 58 deletions doc/guide/templates.md

This file was deleted.

10 changes: 8 additions & 2 deletions doc/index.md → doc/nixos-flake.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
---
slug: /nixos-flake
sidebar_label: Systems
short-title: nixos-flake ❄️
template:
sidebar:
collapsed: true
emanote:
folder-folgezettel: false
---

# Managing OS and home configurations using `nixos-flake`

[nixos-flake](https://github.com/srid/nixos-flake) a [flake-parts](https://flake.parts/) module to unify [NixOS](https://nixos.org/manual/nixos/stable/) + [nix-darwin](https://github.com/LnL7/nix-darwin) + [home-manager] configuration in a single flake, while providing a consistent interface (and enabling common modules) for both Linux and macOS.

See: [[start]]# and [[guide]]#. For examples, see [[examples]]#

[home-manager]: https://github.com/nix-community/home-manager

24 changes: 24 additions & 0 deletions doc/nixos-flake.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# For documentation and available settings, see
# https://github.com/srid/emanote/blob/master/emanote/default/index.yaml

page:
siteTitle: nixos-flake
headHtml: |
<snippet var="js.highlightjs" />
template:
# You can add your own variables here, like editBaseUrl.
# See after-note.tpl to see where editBaseUrl gets used.
editBaseUrl: https://github.com/srid/nixos-flake/edit/master/doc

# Uncomment this to get neuron-style pages
# name: /templates/layouts/note
# layout:
# note:
# containerClass: container mx-auto max-w-screen-lg

sidebar:
collapsed: false

# If you are hosting on GitLab Pages, you may want to remove this.
urlStrategy: pretty
9 changes: 9 additions & 0 deletions doc/nixos-flake/examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
order: 10
---

# Examples

- https://github.com/srid/nixos-config (using `#both` [[templates|template]])
- https://github.com/hkmangla/nixos (using `#linux` [[templates|template]])
- https://github.com/juspay/nix-dev-home (using `#home` [[templates|template]])
5 changes: 5 additions & 0 deletions doc/nixos-flake/guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

# Guide

- [[templates]]#
- [[module-outputs]]#
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
slug: /nixos-flake/module-outputs
---

# Module outputs

Importing the `nixos-flake` flake-parts module will autowire the following flake outputs in your flake:
Expand Down
11 changes: 5 additions & 6 deletions doc/start.md → doc/nixos-flake/start.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
sidebar_position: -10
slug: /nixos-flake/start
order: -10
---

# Getting Started
Expand All @@ -16,17 +15,17 @@ For a more automated way to install NixOS, see [nixos-anywhere](https://github.c
1. [Install NixOS](https://nixos.org/download.html)
1. [Enable Flakes](https://nixos.wiki/wiki/Flakes#Enable_flakes)
1. Flakify your `/etc/nixos/configuration.nix`: https://nixos.wiki/wiki/Flakes#Using_nix_flakes_with_NixOS
1. Convert your `flake.nix` to using `nixos-flake` using the [NixOS only template](/nixos-flake/templates) as reference.
1. Convert your `flake.nix` to using `nixos-flake` using the [[templates|NixOS only template]] as reference.

## non-NixOS Linux

1. [Install Nix](https://nixos.asia/en/install)
1. Use the [HOME only template](/nixos-flake/templates)
1. Use the [[templates|HOME only template]]

## macOS

1. [Install Nix](https://nixos.asia/en/install)
1. [Install nix-darwin](https://github.com/LnL7/nix-darwin)
1. Use the [macOS only template](/nixos-flake/templates)[^both]
1. Use the [[templates|macOS only template]][^both]

[^both]: Alternatively, use the "Both platforms" [template](/nixos-flake/templates) if you are sharing your configuration with the other platform as well.
[^both]: Alternatively, use the "Both platforms" [[templates|template]] if you are sharing your configuration with the other platform as well.
50 changes: 50 additions & 0 deletions doc/nixos-flake/templates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Flake Templates

We provide four templates, depending on your needs:

## Available templates

{#both}
### Both platforms

NixOS, nix-darwin, [home-manager] configuration combined, with common modules.

```bash
nix flake init -t github:srid/nixos-flake
```

{#nixos}
### NixOS only

NixOS configuration only, with [home-manager]

```sh
nix flake init -t github:srid/nixos-flake#linux
```

{#macos}
### macOS only

nix-darwin configuration only, with [home-manager]

```sh
nix flake init -t github:srid/nixos-flake#macos
```

{#home}
### Home only

[home-manager] configuration only (useful if you use other Linux distros or do not have admin access to the machine)

```bash
nix flake init -t github:srid/nixos-flake#home
```

## After initializing the template

1. open the generated `flake.nix` and change the user (from "john") as well as hostname (from "example1") to match that of your environment (Run `echo $USER` and `hostname -s` to determine the new values).[^intel]
2. Then run `nix run .#activate` (`nix run .#activate-home` if you are using the 4th template) to activate the configuration.

[^intel]: If you are on an Intel Mac, change `mkARMMacosSystem` to `mkIntelMacosSystem`.

[home-manager]: https://github.com/nix-community/home-manager

0 comments on commit 5f4e66f

Please sign in to comment.