Skip to content

Commit

Permalink
Merge branch 'master' into nixos-install-manual-disko
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Feb 16, 2024
2 parents ad2ee18 + ff73f55 commit 7b9c605
Show file tree
Hide file tree
Showing 68 changed files with 1,010 additions and 579 deletions.
20 changes: 17 additions & 3 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

This website is built using [Emanote](https://emanote.srid.ca/).

To run it locally with live preview,
To run the English site locally with live preview,

```sh
nix run
nix run .#en # Or just: nix run
```

## Goals
Expand All @@ -23,7 +23,21 @@ Contents are stored in Markdown and can be edited using your favourite [text edi

### PR guidelines

To assist the reviewer, use `nix run github:nixos-asia/website/branch#preview -- -o /en/whatever` in the PR description to provide a handy command for previewing the changes in the PR. See example: https://github.com/nixos-asia/website/pull/12
To assist the reviewer, use `nix run github:nixos-asia/website/branch#preview` in the PR description to provide a handy command for previewing the changes in the PR. See example: https://github.com/nixos-asia/website/pull/12


### Content organization

This site is made of multiple Emanote layers:

- `./global`: Static files and HTML temlpates (common to all languages)
- If a note uses images, you should put them here.
- Language-specific content:
- `./en`: English content
- `./fr`: French content[^fr]

[^fr]: This is just a placeholder. See https://github.com/nixos-asia/website/issues/18


## Discussion

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./result/
cname: nixos.asia
3 changes: 1 addition & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
"svsool.markdown-memo",
"bierner.markdown-checkbox",
"houkanshan.vscode-markdown-footnote",
"bierner.emojisense",
"mdickin.markdown-shortcuts",
"mushan.vscode-paste-image",
"sean10.markless-sean10",
"gruntfuggly.todo-tree",
"bbenoist.nix"
]
}
}
10 changes: 5 additions & 5 deletions en/blog.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
order: 15
feed:
enable: true
enable: false
title: NixOS Asia Blog
---

# Blog

Recent posts:
>[!warning] WIP
> We don't have any posts yet. Checkout our [[tutorial]] in the meanwhile.
```query {.timeline}
children:.
```
An RSS feed will be made available soon (cf. [this bug](https://github.com/srid/emanote/issues/490)).
418 changes: 0 additions & 418 deletions en/blog/nixify-haskell-project-intro.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
slug: en/configuration-as-flake
---

# Convert `configuration.nix` to be a flake

A problem with the default NixOS `configuration.nix` generated by the official installer is that it is not "pure" and thus not reproducible (see [here](https://www.tweag.io/blog/2020-07-31-nixos-flakes/#what-problems-are-we-trying-to-solve)), as it still uses a mutable Nix channel (which is generally [discouraged](https://zero-to-nix.com/concepts/channels#the-problem-with-nix-channel)). For this reason (among others), it is recommended to immediately switch to using #[[flakes]] for our NixOS configuration. Doing this is pretty simple. Just add a `flake.nix` file in `/etc/nixos`:
Expand Down
3 changes: 3 additions & 0 deletions en/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

While package management is the key purpose of #[[nix]], its [[drv|derivations]] can also be used to produce non-package types, such as development environments (aka. "devShell").

![[why-dev]]

## Language support

- [[haskell]]#
- [[rust]]#

## Tools

Expand Down
6 changes: 3 additions & 3 deletions en/direnv.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# `direnv`: manage dev environments

`direnv` (along with [nix-direnv]) allows one to persist[^gc] nix #[[dev|devshell]] environments and share them seamlessly with text editors and IDEs. It obviates having to run `nix develop` manually every time you open a new terminal. The moment you `cd` into your project directory, the devshell is automatically activated, thanks to `direnv`.
`direnv` (along with [nix-direnv]) allows one to persist[^gc] nix #[[dev|development]] [[shell|shell]] environments and share them seamlessly with text editors and IDEs. It obviates having to run `nix develop` manually every time you open a new terminal. The moment you `cd` into your project directory, the devshell is automatically activated, thanks to `direnv`.

[^gc]: [nix-direnv] prevents garbage collection of the devshell, so you do not have to re-download things again. direnv also enables activating the devshell in your current shell, without needing to use a customized bash.

>[!tip] Starship
> It is recommended to use [**starship**](https://starship.rs/) along with nix-direnv, because it gives a visual indication of the current environment. For example, if you are in a `nix develop` shell, your terminal prompt automatically changes to something like this:
> It is recommended to use [**starship**](https://starship.rs/) along with nix-direnv, because it gives a visual indication of the current environment. For example, if you are in a [[shell]], your terminal prompt automatically changes to something like this:
>
> ```sh
> srid on nixos haskell-template on  master [!] via λ 9.2.6 via ❄️ impure (ghc-shell-for-haskell-template-0.1.0.0-0-env)
Expand Down Expand Up @@ -63,7 +63,7 @@ Now run `direnv allow` to authorize the current `.envrc` file. You can now `cd`

#### [[haskell]] - when `.cabal` files change

Since both [nixpkgs](https://community.flake.parts/haskell-flake/nixpkgs-haskell) and [haskell-flake](https://community.flake.parts/haskell-flake) use Nix expressions that read the `.cabal` file to get dependency information, you will want the devshell be recreated every time a `.cabal` file changes. This can be achieved using the `nix_direnv_watch_file` function. Modify your `.envrc` to contain:
Since both [[nixify-haskell-nixpkgs|nixpkgs]] and [haskell-flake](https://community.flake.parts/haskell-flake) use Nix expressions that read the `.cabal` file to get dependency information, you will want the devshell be recreated every time a `.cabal` file changes. This can be achieved using the `nix_direnv_watch_file` function. Modify your `.envrc` to contain:

```text title=".envrc"
nix_direnv_watch_file *.cabal
Expand Down
13 changes: 13 additions & 0 deletions en/event.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# Events

We host events to bring together the community. Our primary venue is in [Bangalore].

## Upcoming events

```query {.timeline}
children:.
```


[Bangalore]: https://en.wikipedia.org/wiki/Bangalore
9 changes: 9 additions & 0 deletions en/event.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
template:
sidebar:
enable: false
uptree:
enable: true
breadcrumbs:
enable: true
base:
containerClass: container mx-auto max-w-prose
24 changes: 24 additions & 0 deletions en/event/srid-nix-dev.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
date: 2023-01-23
author: srid
---

# Getting Started with Nix for Haskell & Rust

:::{.center}
| When | Where |
| ----------------------------------------------------- | ------------------------------------------------- |
| Tuesday, January 23, 2024 at 4PM | [IndiQube Garden, Bengaluru][map-indiqube-garden] |
:::

[Sridhar Ratnakumar][srid] will demonstrate the delights of using [[nix|Nix]] to [[dev|develop]] [[rust|Rust]] as well as [[haskell|Haskell]] projects without needing to do any manual global setup on your system. We'll start from a pristine [[macos|macOS]] machine as well as a pristine Linux machine to get our [[dev|development environment]] up and running in no time, all the way up to [LSP] support in VSCode

RSVP links:

- [The Bangalore Haskell User Group](https://www.meetup.com/the-bangalore-haskell-user-group/events/298349003)

![[vscode-haskell-template.png]]

[srid]: https://x.com/sridca
[map-indiqube-garden]: https://www.google.com/maps/place/12%C2%B056'12.0%22N+77%C2%B037'17.5%22E/@12.936661,77.62153,17z/data=!3m1!4b1!4m4!3m3!8m2!3d12.936661!4d77.62153?entry=ttu
[LSP]: https://langserver.org/
5 changes: 4 additions & 1 deletion en/flake-parts.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

# flake-parts

A #[[modules]] for #[[flakes]]. See https://flake.parts/ & https://community.flake.parts/
`flake-parts` brings the #[[modules|NixOS module system]] to #[[flakes|flakes]], thus providing a cleaner and simpler way to write otherwise complex flakes.

- Official site: https://flake.parts/
- Module documentation: https://community.flake.parts/
4 changes: 4 additions & 0 deletions en/flake-url.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# Flake URL

#[[flakes|Flakes]] are referred using an URL-like syntax that is documented [here](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#url-like-syntax).
2 changes: 1 addition & 1 deletion en/flakes.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Flakes

Flakes is a necessary abstraction of top of #[[nix]] that improves on usability and reproducibility.
Flakes is a necessary abstraction of top of #[[nix]] that improves on usability and reproducibility. Flakes is [production ready despite being marked as experimental](https://determinate.systems/posts/experimental-does-not-mean-unstable).

```query
children:.
Expand Down
10 changes: 8 additions & 2 deletions en/haskell.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@

# Haskell

For nixifying Haskell projects, see https://github.com/srid/haskell-flake
For nixifying Haskell projects, see our tutorial series [[nixify-haskell]]

For further details, https://nixos.wiki/wiki/Haskell
For a comprehensive list of ways to nixify Haskell projects, see https://nixos.wiki/wiki/Haskell

```query
children:.
```

[haskell-flake]: https://github.com/srid/haskell-flake
10 changes: 10 additions & 0 deletions en/hm-tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# home-manager Tutorial Series

![[tutorial-philosophy]]

A tutorial series on #[[home-manager]],

- [ ] Setting it up using https://github.com/juspay/nix-dev-home
- [ ] Basics (packages, dotfiles)
- [ ] Services (macOS and Ubuntu)
5 changes: 5 additions & 0 deletions en/ifd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Import From Derivation (IFD)

[[nix|Nix]] expressions are *evaluated* to produce #[[drv|derivations]] (among other values). These derivations when *realized* usually produce the compiled binary packages. Sometimes, realizing a derivation can produce a Nix expression representing another derivation. This generated Nix expression too needs to be *evaluated* to its derivation before it can be *realized*. This secondary evaluation is achieved by `import`ing from the derivation being evaluated, and is called "import from derivation" or IFD.

For detailed explanation, see [this blog post](https://blog.hercules-ci.com/2019/08/30/native-support-for-import-for-derivation/).
21 changes: 12 additions & 9 deletions en.md → en/index.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
---
emanote:
folder-folgezettel: false
---

# NixOS Asia

> [!tip] Welcome to NixOS Asia
> NixOS Asia is a community of [[nix]] and [[nixos]] users, promulgated initially from the Indian subcontinent. Talk to us on [Zulip](https://nixos.zulipchat.com/)!
> NixOS Asia is a community[^1]{.text-xs} of [[nix]] and [[nixos]] users, promulgated initially from the Indian subcontinent. Talk to us on [Zulip](https://nixos.zulipchat.com/)!

## Explore this website

Expand All @@ -24,7 +20,7 @@ sidebar navigation.
- Start from [[install|here]] if you are new to Nix.
- We have [[tutorial]]# and a [[blog]]#
- Topical entry points: [[nix]]#, [[nixos]]#
- Topical entry points: [[topics]]#
- You can browse the rest of the content in [the index](-/all).

## Community
Expand All @@ -34,9 +30,16 @@ You can participate in the community discussion through the following venues. Zu
- [Zulip](https://nixos.zulipchat.com/): Zulip is a hybrid of "chat" and "forum".
- [Matrix](https://matrix.to/#/#nixos-asia:matrix.org)
- [Twitter / X](https://twitter.com/nixos_asia): We'll post all announcements here.
- [GitHub](https://github.com/nixos-asia)

Also consider taking a look at our sister community, [Functional Programming India](https://functionalprogramming.in/).

## Upcoming
## Events

See [[event]].

:::{.text-xs}
---

- [ ] Meetups in Bangalore, starting from January 2024.
\[^1\]: We are emphatically unaffiliated with the NixOS Foundation or their core community.
:::
4 changes: 4 additions & 0 deletions en/index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
page:
lang: en
template:
editBaseUrl: https://github.com/nixos-asia/website/edit/master/en
11 changes: 7 additions & 4 deletions en/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,24 @@ Install #[[nix]] using [the unofficial installer](https://github.com/Determinate
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
```

After installing Nix, run the [Nix Health](https://github.com/juspay/nix-browser/tree/main/crates/nix_health) checks,
> [!tip] Graphical installer for [[macos]]
> The unofficial installer is also available as a graphical installer for [[macos]]. You can get get it [here](https://determinate.systems/posts/graphical-nix-installer).
After installing Nix, open a new terminal and run the [Nix Health](https://github.com/juspay/nix-browser/tree/main/crates/nix_health) checks,

```sh
nix run nixpkgs#nix-health
nix --accept-flake-config run github:juspay/nix-browser#nix-health
```

Expect to see all results in either green (or yellow).

## Next Steps

Checkout [[nix-rapid]] and
Checkout [[nix-first]] and

- [[dev]] if you are looking to use Nix for development.
- [[home-manager]] (and [[nix-darwin]] if you are on [[macos]]) if you would like to use Nix for more than packages and [[dev|devShells]].

[^official]: You *can* use [the official installer](https://nixos.org/download). However, there are a couple of manual steps necessary:
- As it [does not yet](https://discourse.nixos.org/t/anyone-up-for-picking-at-some-nix-onboarding-improvements/13152/4) include an uninstaller, you will have to manually uninstall Nix when the time comes ([[macos-upgrade|example]]).
- As it does not automatically enable [[flakes]], you will have to [manually enable it](https://nixos.wiki/wiki/Flakes).
- As it does not automatically enable [[flakes]], you will have to [manually enable it](https://nixos.wiki/wiki/Flakes).
12 changes: 7 additions & 5 deletions en/macos.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
---
order: 10
---

# macOS

[[nix]] is supported on macOS.

>[!warning] Darwin support in nixpkgs
> macOS support in [[nixpkgs]] is not of same quality and priority as Linux. See https://github.com/NixOS/nixpkgs/issues/145230 & https://github.com/NixOS/nixpkgs/issues/116341





```query
children:.
```
Loading

0 comments on commit 7b9c605

Please sign in to comment.