Skip to content

Commit f25a9e7

Browse files
author
BirdeeHub
committed
Rewrite everything!
On branch main Your branch is behind 'origin/main' by 1 commit, and can be fast-forwarded. (use "git pull" to update your local branch) Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: .github/workflows/deploy-website.yml modified: .github/workflows/test.yml new file: .gitignore new file: CONTRIBUTING.md modified: README.md new file: checks/all-modules-have-maintainers.nix modified: checks/apply.nix modified: checks/args-direct.nix renamed: checks/module-filesToExclude.nix -> checks/filesToExclude-module.nix modified: checks/flags-equals-separator.nix modified: checks/flags-list.nix modified: checks/flags-module.nix modified: checks/flags-null-false.nix modified: checks/flags-space-separator.nix new file: checks/no-module-prefix-in-checks.nix new file: checks/types-file.nix modified: default.nix new file: docs/.gitignore new file: docs/book.toml new file: docs/collect.nix new file: docs/flake.lock new file: docs/flake.nix new file: docs/helper-modules.md new file: docs/wrapper-modules.md modified: flake.lock modified: flake.nix deleted: lib.nix new file: lib/dag.nix new file: lib/default.nix new file: lib/evalModules.nix deleted: modules.nix new file: modules/a/alacritty/module.nix new file: modules/a/default.nix deleted: modules/alacritty/module.nix new file: modules/b/default.nix new file: modules/c/default.nix new file: modules/d/default.nix new file: modules/default.nix new file: modules/e/default.nix new file: modules/f/default.nix new file: modules/f/foot/module.nix new file: modules/f/fuzzel/module.nix deleted: modules/foot/module.nix deleted: modules/fuzzel/module.nix new file: modules/g/default.nix new file: modules/h/default.nix renamed: modules/helix/check.nix -> modules/h/helix/check.nix new file: modules/h/helix/module.nix deleted: modules/helix/module.nix new file: modules/i/default.nix new file: modules/j/default.nix new file: modules/j/jujutsu/check.nix new file: modules/j/jujutsu/module.nix new file: modules/k/default.nix new file: modules/l/default.nix new file: modules/m/default.nix new file: modules/m/makeWrapper.nix new file: modules/m/makeWrapperBase.nix new file: modules/m/mako/module.nix renamed: modules/mpv/check.nix -> modules/m/mpv/check.nix new file: modules/m/mpv/module.nix deleted: modules/mpv/module.nix new file: modules/n/default.nix renamed: modules/notmuch/check.nix -> modules/n/notmuch/check.nix new file: modules/n/notmuch/module.nix renamed: modules/nushell/check.nix -> modules/n/nushell/check.nix new file: modules/n/nushell/module.nix deleted: modules/notmuch/module.nix deleted: modules/nushell/module.nix new file: modules/o/default.nix new file: modules/other/default.nix new file: modules/p/default.nix new file: modules/q/default.nix new file: modules/r/default.nix new file: modules/r/rofi/check.nix new file: modules/r/rofi/module.nix new file: modules/s/default.nix new file: modules/s/symlinkScript.nix new file: modules/t/default.nix new file: modules/t/tealdeer/module.nix new file: modules/t/tmux/module.nix new file: modules/u/default.nix new file: modules/v/default.nix new file: modules/w/default.nix new file: modules/w/wezterm/check.nix new file: modules/w/wezterm/module.nix new file: modules/x/default.nix new file: modules/y/default.nix new file: modules/z/default.nix
1 parent 68d911e commit f25a9e7

Some content is hidden

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

94 files changed

+4631
-1123
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: update-website
2+
on:
3+
workflow_dispatch: # allows manual triggering
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v5
14+
- name: Setup Pages
15+
uses: actions/configure-pages@v5
16+
- name: Install Nix
17+
uses: DeterminateSystems/nix-installer-action@main
18+
- name: Update Site
19+
run: |
20+
mkdir -p ./_site
21+
nix run --show-trace ./docs -- ./_site
22+
- name: Upload artifact
23+
uses: actions/upload-pages-artifact@v4
24+
with:
25+
path: ./_site
26+
27+
# Deployment job
28+
deploy:
29+
environment:
30+
name: github-pages
31+
url: ${{ steps.deployment.outputs.page_url }}
32+
runs-on: ubuntu-latest
33+
needs: build
34+
permissions:
35+
id-token: write
36+
contents: read
37+
steps:
38+
- name: Deploy to GitHub Pages
39+
id: deployment
40+
uses: actions/deploy-pages@v4
41+
with:
42+
token: ${{ secrets.PAT }}

.github/workflows/test.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ jobs:
1414
runs-on: ${{ matrix.os }}
1515
steps:
1616
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Merge main into PR branch
21+
if: github.event_name == 'pull_request'
22+
run: |
23+
git config user.name "GitHub Actions"
24+
git config user.email "actions@github.com"
25+
git fetch origin main
26+
if ! git merge origin/main; then
27+
echo "Merge failed due to conflicts. Please rebase your branch on main."
28+
exit 1
29+
fi
1730
1831
- name: Install Nix
1932
uses: DeterminateSystems/nix-installer-action@main

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/result
2+
**/result-*
3+
**/repl-result-*

CONTRIBUTING.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Adding modules!
2+
3+
Please add some modules to the `modules/` directory to help everyone out!
4+
5+
That way, your module can be available for others to enjoy as well!
6+
7+
When making one, you must define a `modules/<first_letter>/<your_package_name>/module.nix` file
8+
9+
It must contain a single, unevaluated module.
10+
11+
All options must have descriptions, so that documentation can be generated and people can know how to use it!
12+
13+
All modules must have a `meta.maintainers = [];` entry.
14+
15+
## Guidelines:
16+
17+
When making options for your module, if you are able, please provide both nix-generated, and `wlib.types.file` or `lib.types.lines` options
18+
19+
If you are not able to provide both, default to `wlib.types.file` unless it is `JSON` or something else which does not append nicely, but do try to provide both options.
20+
21+
When you provide a `wlib.types.file` option, you should try to name it as close to the filename as possible, if that makes sense.
22+
23+
Example:
24+
25+
```nix
26+
{
27+
config,
28+
lib,
29+
wlib,
30+
...
31+
}:
32+
{
33+
imports = [ wlib.modules.default ];
34+
options = {
35+
"wezterm.lua" = lib.mkOption {
36+
type = wlib.types.file config.pkgs;
37+
default.content = "return require('nix-info')";
38+
description = "The wezterm config file. provide `.content`, or `.path`";
39+
};
40+
luaInfo = lib.mkOption {
41+
type = lib.types.attrsOf lib.types.raw;
42+
default = { };
43+
description = ''
44+
anything other than uncalled nix functions can be put into this option,
45+
within your `"wezterm.lua"`, you will be able to call `require('nix-info')`
46+
and get the values as lua values
47+
48+
the default `"wezterm.lua"` value is `return require('nix-info')`
49+
50+
This means, by default, this will act like your wezterm config file, unless you want to add some lua in between there.
51+
'';
52+
};
53+
};
54+
55+
config.flagSeparator = "=";
56+
config.flags = {
57+
"--config-file" = config.pkgs.writeText "wezterm.lua" ''
58+
local wezterm = require 'wezterm'
59+
package.preload["nix-info"] = function() return ${
60+
lib.generators.toLua { } config.luaInfo
61+
} end
62+
return dofile(${builtins.toJSON config."wezterm.lua".path})
63+
'';
64+
};
65+
66+
config.package = lib.mkDefault config.pkgs.wezterm;
67+
68+
config.meta.maintainers = [ lib.maintainers.birdee ];
69+
}
70+
```
71+
72+
# Formatting
73+
74+
`nix fmt`
75+
76+
# Tests
77+
78+
`nix flake check -Lv .`
79+
80+
# Writing tests
81+
82+
You may also include a `check.nix` file in your module's directory.
83+
84+
It will be provided with the flake `self` value and `pkgs`
85+
86+
Example:
87+
88+
```nix
89+
{
90+
pkgs,
91+
self,
92+
}:
93+
let
94+
weztermWrapped = self.wrapperModules.wezterm.wrap (
95+
{ lib, ... }:
96+
{
97+
inherit pkgs;
98+
luaInfo = {
99+
keys = [
100+
{
101+
key = "F12";
102+
mods = "SUPER|CTRL|ALT|SHIFT";
103+
action = lib.generators.mkLuaInline "wezterm.action.Nop";
104+
}
105+
];
106+
};
107+
"wezterm.lua".content = # lua
108+
''
109+
local wezterm = require 'wezterm'
110+
local config = require 'nix-info'
111+
config.keys[2] = {
112+
key = 'F13',
113+
mods = 'SUPER|CTRL|ALT|SHIFT',
114+
action = wezterm.action.Nop,
115+
}
116+
return config
117+
'';
118+
}
119+
);
120+
in
121+
pkgs.runCommand "wezterm-test" { } ''
122+
res=$("${weztermWrapped}/bin/wezterm" show-keys)
123+
if ! echo "$res" | grep -q "SHIFT | ALT | CTRL | SUPER F12"; then
124+
echo "Wezterm doesn't see custom keybind 1"
125+
touch $out
126+
exit 1
127+
fi
128+
if ! echo "$res" | grep -q "SHIFT | ALT | CTRL | SUPER F13"; then
129+
echo "Wezterm doesn't see custom keybind 2"
130+
touch $out
131+
exit 1
132+
fi
133+
touch $out
134+
''
135+
```
136+
137+
# Questions?
138+
139+
The github discussions board is open and a great place to find help!

0 commit comments

Comments
 (0)