Skip to content

Commit 9e6982f

Browse files
authored
chore: format code via prettier (#125)
1 parent af650be commit 9e6982f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+313
-397
lines changed

.github/FUNDING.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# open_collective: nixos-and-flakes-book
22
patreon: ryan4yin
3-
custom: ['https://buymeacoffee.com/ryan4yin', 'https://afdian.net/a/ryan4yin']
3+
custom: ["https://buymeacoffee.com/ryan4yin", "https://afdian.net/a/ryan4yin"]

.github/ISSUE_TEMPLATE/bug_report.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
4+
title: ""
5+
labels: ""
6+
assignees: ""
87
---
98

109
**Describe the bug**
1110
A clear and concise description of what the bug is.
1211

1312
**To Reproduce**
1413
Steps to reproduce the behavior:
14+
1515
1. Go to '...'
1616
2. Click on '....'
1717
3. Scroll down to '....'
@@ -24,8 +24,9 @@ A clear and concise description of what you expected to happen.
2424
If applicable, add screenshots to help explain your problem.
2525

2626
**Environment (please complete the following information):**
27-
- NixOS Version: [e.g. 23.11]
28-
- Nix version: [e.g. 2.18]
27+
28+
- NixOS Version: [e.g. 23.11]
29+
- Nix version: [e.g. 2.18]
2930

3031
**Additional context**
3132
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/custom.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
---
22
name: Custom issue template
33
about: Describe this issue template's purpose here.
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
4+
title: ""
5+
labels: ""
6+
assignees: ""
87
---
9-
10-

.github/ISSUE_TEMPLATE/feature_request.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
4+
title: ""
5+
labels: ""
6+
assignees: ""
87
---
98

109
**Is your feature request related to a problem? Please describe.**

.github/workflows/release-pdf.yml

+39-39
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,43 @@ jobs:
88
generate-pdf:
99
runs-on: ubuntu-latest
1010
steps:
11-
- name: Checkout repository
12-
uses: actions/checkout@v4
13-
- name: Install nix
14-
uses: cachix/install-nix-action@v23
15-
with:
16-
nix_path: "nixpkgs=channel:nixpkgs-unstable"
17-
extra_nix_config: |
18-
experimental-features = nix-command flakes
19-
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
20-
- name: Show nixpkgs version
21-
run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
22-
- name: Run a command with nix develop
23-
run: |
24-
nix develop .#export-pdf --ignore-environment --command bash -c '
25-
pnpm install
26-
pnpm export-pdf
27-
'
28-
# # For debugging, upload the pdfs as artifacts
29-
# - uses: actions/upload-artifact@v3
30-
# with:
31-
# name: pdf
32-
# path: '*.pdf'
33-
- name: Generate changelog
34-
run: |
35-
# Get the previous tag
36-
git fetch --tags
37-
PREVIOUS_TAG=$(git tag --sort=-creatordate | head -n 2 | tail -n 1)
38-
# Generate the changelog
39-
git log --pretty=format:"%h %s" $PREVIOUS_TAG..HEAD > CHANGELOG
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
- name: Install nix
14+
uses: cachix/install-nix-action@v23
15+
with:
16+
nix_path: "nixpkgs=channel:nixpkgs-unstable"
17+
extra_nix_config: |
18+
experimental-features = nix-command flakes
19+
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
20+
- name: Show nixpkgs version
21+
run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
22+
- name: Run a command with nix develop
23+
run: |
24+
nix develop .#export-pdf --ignore-environment --command bash -c '
25+
pnpm install
26+
pnpm export-pdf
27+
'
28+
# # For debugging, upload the pdfs as artifacts
29+
# - uses: actions/upload-artifact@v3
30+
# with:
31+
# name: pdf
32+
# path: '*.pdf'
33+
- name: Generate changelog
34+
run: |
35+
# Get the previous tag
36+
git fetch --tags
37+
PREVIOUS_TAG=$(git tag --sort=-creatordate | head -n 2 | tail -n 1)
38+
# Generate the changelog
39+
git log --pretty=format:"%h %s" $PREVIOUS_TAG..HEAD > CHANGELOG
4040
41-
echo "Changelog from $PREVIOUS_TAG to HEAD:"
42-
cat CHANGELOG
43-
- name: Release PDF
44-
uses: softprops/action-gh-release@v1
45-
if: startsWith(github.ref, 'refs/tags/')
46-
with:
47-
generate_release_notes: true
48-
body_path: CHANGELOG
49-
files: |
50-
nixos-and-flakes-book.pdf
41+
echo "Changelog from $PREVIOUS_TAG to HEAD:"
42+
cat CHANGELOG
43+
- name: Release PDF
44+
uses: softprops/action-gh-release@v1
45+
if: startsWith(github.ref, 'refs/tags/')
46+
with:
47+
generate_release_notes: true
48+
body_path: CHANGELOG
49+
files: |
50+
nixos-and-flakes-book.pdf

docs/.vitepress/config.ts

+20-18
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { createRequire } from "module";
2-
import { generateSitemap as sitemap } from "sitemap-ts";
3-
import { PageData, defineConfig } from "vitepress";
1+
import { createRequire } from "module"
2+
import { generateSitemap as sitemap } from "sitemap-ts"
3+
import { PageData, defineConfig } from "vitepress"
44

5-
const require = createRequire(import.meta.url);
5+
const require = createRequire(import.meta.url)
66

77
// https://vitepress.dev/reference/site-config
88
export default defineConfig({
@@ -18,7 +18,7 @@ export default defineConfig({
1818
hostname: "https://nixos-and-flakes.thiscute.world/",
1919
outDir: outDir,
2020
generateRobotsTxt: true,
21-
});
21+
})
2222
},
2323

2424
// SEO Improvement - JSON-LD
@@ -30,7 +30,7 @@ export default defineConfig({
3030
["script", { type: "application/ld+json" }, getJSONLD(pageData)],
3131
],
3232
},
33-
};
33+
}
3434
},
3535

3636
head: [
@@ -78,14 +78,16 @@ export default defineConfig({
7878

7979
config: (md) => {
8080
// add support for footnote
81-
md.use(require("markdown-it-footnote"));
81+
md.use(require("markdown-it-footnote"))
8282
},
8383
},
8484

8585
themeConfig: {
8686
footer: {
87-
message: 'Licensed under <a href="http://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1" target="_blank">CC BY-SA 4.0</a>',
88-
copyright: 'Copyright © 2023-present <a href="https://github.com/ryan4yin" target="_blank">Ryan Yin</a>',
87+
message:
88+
'Licensed under <a href="http://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1" target="_blank">CC BY-SA 4.0</a>',
89+
copyright:
90+
'Copyright © 2023-present <a href="https://github.com/ryan4yin" target="_blank">Ryan Yin</a>',
8991
},
9092

9193
search: {
@@ -115,7 +117,7 @@ export default defineConfig({
115117
root: themeConfigEnglish(),
116118
zh: themeConfigChinese(),
117119
},
118-
});
120+
})
119121

120122
function themeConfigEnglish() {
121123
return {
@@ -311,7 +313,7 @@ function themeConfigEnglish() {
311313
},
312314
],
313315
},
314-
};
316+
}
315317
}
316318

317319
function themeConfigChinese() {
@@ -401,7 +403,7 @@ function themeConfigChinese() {
401403
items: [
402404
{ text: "简介", link: "/zh/nixpkgs/intro.md" },
403405
{ text: "callPackage", link: "/zh/nixpkgs/callpackage.md" },
404-
{ text: "Overridding", link: "/zh/nixpkgs/overriding.md" },
406+
{ text: "Overriding", link: "/zh/nixpkgs/overriding.md" },
405407
{ text: "Overlays", link: "/zh/nixpkgs/overlays.md" },
406408
{
407409
text: "多 Nixpkgs 实例",
@@ -506,7 +508,7 @@ function themeConfigChinese() {
506508
},
507509
],
508510
},
509-
};
511+
}
510512
}
511513

512514
function getJSONLD(pageData: PageData) {
@@ -518,7 +520,7 @@ function getJSONLD(pageData: PageData) {
518520
"inLanguage":"en",
519521
"description":"An unofficial and opinionated book for beginners",
520522
"name":"${pageData.title}"
521-
}`;
523+
}`
522524
} else if (pageData.relativePath === "zh/index.md") {
523525
return `{
524526
"@context":"http://schema.org",
@@ -527,12 +529,12 @@ function getJSONLD(pageData: PageData) {
527529
"inLanguage":"zh-CN",
528530
"description":"一份非官方的新手指南",
529531
"name":"${pageData.title}"
530-
}`;
532+
}`
531533
} else {
532-
let lang = pageData.relativePath.startsWith("zh/") ? "zh-CN" : "en";
534+
let lang = pageData.relativePath.startsWith("zh/") ? "zh-CN" : "en"
533535
let url = `https:\/\/nixos-and-flakes.thiscute.world\/${pageData.relativePath
534536
.replace(/\.md$/, "")
535-
.replace(/\/index\$/, "/")}`;
537+
.replace(/\/index\$/, "/")}`
536538
return `{
537539
"@context":"http://schema.org",
538540
"@type":"TechArticle",
@@ -544,6 +546,6 @@ function getJSONLD(pageData: PageData) {
544546
},
545547
"keywords":"NixOS, Nix, Flakes, Linux, Tutorial",
546548
"url":"${url}"
547-
}`;
549+
}`
548550
}
549551
}

docs/.vitepress/style/print.css

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@media print {
2-
.VPNav,
3-
.VPLocalNav,
4-
.VPDocFooter {
5-
display: none !important;
6-
}
2+
.VPNav,
3+
.VPLocalNav,
4+
.VPDocFooter {
5+
display: none !important;
6+
}
77
}

docs/.vitepress/theme/index.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
// .vitepress/theme/index.ts
2-
import DefaultTheme from "vitepress/theme";
3-
import giscusTalk from "vitepress-plugin-comment-with-giscus";
4-
import { useData, useRoute } from "vitepress";
2+
import DefaultTheme from "vitepress/theme"
3+
import giscusTalk from "vitepress-plugin-comment-with-giscus"
4+
import { useData, useRoute } from "vitepress"
55

66
// custom CSS
7-
import "../style/print.css";
7+
import "../style/print.css"
88

99
export default {
1010
// Extending the Default Theme
1111
...DefaultTheme,
1212
enhanceApp(ctx) {
13-
DefaultTheme.enhanceApp(ctx);
13+
DefaultTheme.enhanceApp(ctx)
1414
// ...
1515
},
1616
setup() {
1717
// Get frontmatter and route
18-
const { frontmatter } = useData();
19-
const route = useRoute();
18+
const { frontmatter } = useData()
19+
const route = useRoute()
2020

2121
// Obtain configuration from: https://giscus.app/
2222
giscusTalk(
@@ -41,7 +41,7 @@ export default {
4141
// The default is true, which means enabled, this parameter can be ignored;
4242
// If it is false, it means it is not enabled.
4343
// You can use `comment: true` preface to enable it separately on the page.
44-
true,
45-
);
44+
true
45+
)
4646
},
47-
};
47+
}
+18-19
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
1-
import { defineUserConfig } from "vitepress-export-pdf";
2-
import config from './config'
3-
1+
import { defineUserConfig } from "vitepress-export-pdf"
2+
import config from "./config"
43

54
// convert `config.themeConfig?.sidebar` to a list of routes
6-
let routeOrder = [];
7-
const sidebar = config.locales.root.themeConfig?.sidebar;
5+
let routeOrder = []
6+
const sidebar = config.locales.root.themeConfig?.sidebar
87
if (sidebar) {
98
sidebar.forEach((it) => {
109
if (it.items) {
1110
it.items.forEach((subItem) => {
12-
routeOrder.push(subItem.link.replace(/\.md$/, ""));
13-
});
11+
routeOrder.push(subItem.link.replace(/\.md$/, ""))
12+
})
1413
}
15-
});
14+
})
1615
}
1716

1817
// print routeOrder in terminal
19-
console.log("routeOrder: ", routeOrder);
18+
console.log("routeOrder: ", routeOrder)
2019

2120
export default defineUserConfig({
22-
routePatterns: ["!/zh/**"], // exclude zh-CN pages
23-
sorter: (pageA, pageB) => {
24-
const aIndex = routeOrder.findIndex(route => route === pageA.path);
25-
const bIndex = routeOrder.findIndex(route => route === pageB.path);
26-
const index = aIndex - bIndex;
27-
// console.log(`sorter: ${pageA.path} vs ${pageB.path} = ${index}`);
28-
return index;
29-
},
30-
urlOrigin: "https://nixos-and-flakes.thiscute.world/",
31-
});
21+
routePatterns: ["!/zh/**"], // exclude zh-CN pages
22+
sorter: (pageA, pageB) => {
23+
const aIndex = routeOrder.findIndex((route) => route === pageA.path)
24+
const bIndex = routeOrder.findIndex((route) => route === pageB.path)
25+
const index = aIndex - bIndex
26+
// console.log(`sorter: ${pageA.path} vs ${pageB.path} = ${index}`);
27+
return index
28+
},
29+
urlOrigin: "https://nixos-and-flakes.thiscute.world/",
30+
})

docs/advanced-topics/index.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ Once you have become familiar with NixOS, you can explore advanced topics and di
55
## Community
66

77
- [Nix Official - Community](https://nixos.org/community/): Contains information about the Nix community, forums, realtime chat, meetups, RFCs, the official team architecture, etc.
8-
- [Nix Channel Status](https://status.nixos.org/): The build status of each Nix channel.
8+
- [Nix Channel Status](https://status.nixos.org/): The build status of each Nix channel.
99
- [nix-community/NUR](https://github.com/nix-community/NUR): Although Nixpkgs contains a large number of packages, some packages are not included in Nixpkgs due to reasons such as review speed and licensing agreements. NUR is a decentralized Nix package repository where anyone can create their own Nix repository and add it to NUR for others to use. If you want to use a package that is not in Nixpkgs, you can try to find it here. If you want to share your own Nix package with others, you can create and share your own Nix repository according to the README of NUR.
1010

1111
## Documentation and Videos
1212

13-
- [Eelco Dolstra - The Purely Functional Software Deployment Model - 2006](https://edolstra.github.io/pubs/phd-thesis.pdf): Eelco Dolstra's seminal PhD thesis about the Nix package manager,
13+
- [Eelco Dolstra - The Purely Functional Software Deployment Model - 2006](https://edolstra.github.io/pubs/phd-thesis.pdf): Eelco Dolstra's seminal PhD thesis about the Nix package manager,
1414
- [Nix Reference Manual](https://nixos.org/manual/nix/stable/package-management/profiles.html): A comprehensive guide to the Nix package manager, covering its design and usage from the command line.
1515
- [nixpkgs Manual](https://nixos.org/manual/nixpkgs/unstable/): The manual for nixpkgs, which introduces its parameters, explains how to use, modify, and package Nix packages.
1616
- [NixOS Manual](https://nixos.org/manual/nixos/unstable/): A user manual for NixOS, providing configuration instructions for system-level components such as Wayland/X11 and GPU.
@@ -22,7 +22,6 @@ And there are many official videos on the [NixOS Foundation](https://www.youtube
2222
- [Summer of Nix 2022 — Public Lecture Series](https://www.youtube.com/playlist?list=PLt4-_lkyRrOMWyp5G-m_d1wtTcbBaOxZk): A series of public lectures hosted by the NixOS Foundation, presented by core members of the Nix community such as Eelco Dolstra and Armijn Hemel. The content covers the development history of Nix, the history of NixOS, and the future of Nix, among other topics.
2323
- [Summer of Nix 2023 — Nix Developer Dialogues](https://www.youtube.com/playlist?list=PLt4-_lkyRrOPcBuz_tjm6ZQb-6rJjU3cf): A series of dialogues between core members of the Nix community in 2023. The content includes the evolution and architectural challenges of Nixpkgs, exploration of Nix's module system, discussion of the Nix ecosystem, AI applications in Nixpkgs, and the application of Nix in the commercial field and open source economics.
2424

25-
2625
## Advanced Techniques and Community Projects
2726

2827
Once you are comfortable with Flakes, you can explore more advanced techniques and community projects. Here are some popular ones to try out:

0 commit comments

Comments
 (0)