mirror of
https://github.com/RichieCahill/dotfiles.git
synced 2026-04-21 14:49:10 -04:00
Compare commits
396 Commits
updating-b
...
feature/te
| Author | SHA1 | Date | |
|---|---|---|---|
| 5417d255fd | |||
| 868086b449 | |||
|
|
1cd4084ec8 | ||
|
|
e65b4b696a | ||
|
|
20a4a8c2fc | ||
| f4348c2ab5 | |||
| 6eab8497ba | |||
|
|
da5cdb8f05 | ||
| 8aa9eea322 | |||
| febe7c7e53 | |||
| b1ca58b2f4 | |||
|
|
7ad4ccd5ca | ||
| c936501afb | |||
| 239d7833f6 | |||
| 8fb6ae41b9 | |||
| 80e0b03463 | |||
| 747e2700ed | |||
| 472f11e5b6 | |||
| d75493997e | |||
| d711983ac7 | |||
| 1aabb2b112 | |||
|
|
8c09b8a78f | ||
| 0fe99d9d4e | |||
| 148722be43 | |||
| be2421e3dc | |||
| 2eb6c43b49 | |||
| 897e06f622 | |||
| 4e99c54c12 | |||
| 3abd04ec5e | |||
| a6a0fd0727 | |||
| f23d381895 | |||
| 65335d1d38 | |||
|
|
7b318e038a | ||
| 2fe3ad1f68 | |||
| fa27adb4fe | |||
| ac7aec4efd | |||
| 87bebda02e | |||
| 43276a693a | |||
| 84504c68b7 | |||
|
|
45267b5c59 | ||
|
|
bd964a8390 | ||
|
|
86e90440c4 | ||
|
|
2b743fa1b8 | ||
| eb69646603 | |||
| ccfde41209 | |||
| eb90251671 | |||
| a5ccedbb5d | |||
| 7dbf67a2d3 | |||
| c349af60ce | |||
| 3fcc3447b1 | |||
| fc166e9c1a | |||
| e902608c6c | |||
| 59a794169e | |||
| fa618f8849 | |||
| 84e469897e | |||
| 4694d75a62 | |||
| ca2081bf93 | |||
| fa3f14785c | |||
| aa2836c452 | |||
| 5b750043ce | |||
| da721a32f3 | |||
| fd172638ec | |||
| 9dd32c7c06 | |||
|
|
96ce4ccb4a | ||
|
|
f448da92c7 | ||
| 8d14e85a5e | |||
| 171dcb6273 | |||
| 8576cb2113 | |||
| d0077f00f5 | |||
| 0ea628ddb7 | |||
| 4feba720fc | |||
| 81ffea08e3 | |||
| 61db4659dd | |||
| 0a50d94af4 | |||
| 27c59192c8 | |||
|
|
5a1078fec0 | ||
| 39ed05a73a | |||
|
|
68202fdd15 | ||
| 9a64d9cbfb | |||
| 1d0d46d22d | |||
| 1d1bfae8ee | |||
|
|
8d6328ce57 | ||
| 02db3d2eb5 | |||
| bdf9d267e8 | |||
| 4db29ae280 | |||
| 1b97fa7dda | |||
| 9248337e55 | |||
| f77c341e2b | |||
| f7f0d02ef9 | |||
| e723ab9e86 | |||
| 5182bf18bc | |||
| 11883f981e | |||
| 6d41287eec | |||
| 433c52309b | |||
| e1bbadfcba | |||
| 868f782523 | |||
| 434c80adac | |||
| 6c15bbe0a3 | |||
| cbdefc0c52 | |||
| 3fc9d9d614 | |||
| aa4a11c0c3 | |||
| 300aa1f032 | |||
| c12bd0c7ca | |||
| f43a34f37c | |||
| 33c2718d40 | |||
| 78500e6122 | |||
| 9459d4797e | |||
| bfbcb70327 | |||
| b95e553093 | |||
| 8668603404 | |||
| 60c3e3db20 | |||
| d3aa49f9e4 | |||
| f691015920 | |||
| 81ab03f3f1 | |||
| ba1170720c | |||
| 4316c8a52e | |||
| a036467131 | |||
| 62c26b351c | |||
| cd5ad0dcae | |||
| fa38cc6321 | |||
| e8d971340b | |||
| 30f2af87be | |||
| 8522b77285 | |||
| f1a48819a5 | |||
| eff58f08ad | |||
| a24c4fd756 | |||
| f10ab4a9af | |||
| 7cc831a2d0 | |||
| 91690734ba | |||
|
|
b97e81e96e | ||
| 0d680dc68d | |||
| 81867eb312 | |||
| 00852c019d | |||
|
|
b53f4ec8d8 | ||
| 64a4223560 | |||
| 88d3d6311f | |||
|
|
bccc569650 | ||
| 633a48af7b | |||
| 799794ebe5 | |||
| 7b07266c44 | |||
| 60ce45a08d | |||
| 12b6c1e279 | |||
| 12b4fe92da | |||
| d076183777 | |||
| 7a454ca740 | |||
| 8dd892a88f | |||
| 7f3bb43d39 | |||
| 793d06683e | |||
| bb1d92252f | |||
| f7a95f32cd | |||
| ea24fb9865 | |||
| c39f8c4a7e | |||
| d7fd0796ea | |||
| 01d2bd04b2 | |||
| 040a44b608 | |||
|
|
a3a132b41c | ||
| c0a97c6ed8 | |||
| 83dad24351 | |||
| 1a1cc41265 | |||
| 0457265bd7 | |||
| 3c2476336b | |||
| 27ec9d9204 | |||
| 0f094bfacb | |||
| 14a312dd0f | |||
| c87e653ad7 | |||
| e88fc08d91 | |||
| 2e26035693 | |||
| f877b15d35 | |||
| 7736c36eee | |||
| 78159e1d90 | |||
| a39d3f0c51 | |||
| 7995d383ca | |||
| a7e8494d8a | |||
|
|
17599aea9d | ||
| ae5981dcfa | |||
| 1770cb87d3 | |||
| 61b548e11c | |||
| 76da8cd379 | |||
| 0e4cb002c8 | |||
| ce27dcfa39 | |||
|
|
6dae76c51e | ||
| 92a87c01d3 | |||
| bca98cfadb | |||
| 91ebec054c | |||
| 6ae6bc0dd6 | |||
| 0a1e517468 | |||
| f852d9b9fb | |||
| 7ad195ff24 | |||
| 4cadc374b1 | |||
| 56456ab375 | |||
| 17b19967e8 | |||
| 9ff57ba6f3 | |||
| 573031e4c9 | |||
| 6e2703f852 | |||
|
|
a6b6d66b9f | ||
| bdfe36f919 | |||
| b3be9dd2c8 | |||
| d991f94d7e | |||
| 2a12b80dfa | |||
| d783b0d03d | |||
| 4ae7b9ab4d | |||
| 0f788a1901 | |||
| 20ed83e80a | |||
| 1ea95f9518 | |||
| b1e3ce2afa | |||
| 71e6fa377c | |||
| 15234fa2bb | |||
| cdf26994a3 | |||
| abd7101062 | |||
|
|
14b229a354 | ||
| 02084080d2 | |||
| 4a348041c4 | |||
| 9a245fb8c2 | |||
| be342d9ae8 | |||
| 74d61236b6 | |||
|
|
40f51d9934 | ||
| 3bb8873e7d | |||
| fe53feed59 | |||
|
|
e7231d2bd1 | ||
| cbec4e6deb | |||
| 60478dd979 | |||
| 1490b31bb9 | |||
|
|
6e0a402d26 | ||
| db60b2f1a9 | |||
| 5e68283ef8 | |||
| 9400d75176 | |||
| fb38c4e4bc | |||
| 7325332d11 | |||
| 95c0f2cbb7 | |||
| 40c0927d6c | |||
| 34e756e5a8 | |||
|
|
cc43883400 | ||
| d5ad93e6a9 | |||
| 2b1ad2a2b7 | |||
| 1e46071754 | |||
| 66771e32d3 | |||
| 467a42b5cf | |||
| 350667786d | |||
| 3d54a3eefd | |||
|
|
90d22b05cc | ||
| 0a65d204a0 | |||
| cdacebfbd5 | |||
| 327c9b4181 | |||
| 234d32b678 | |||
| c902ab7e6e | |||
| 03a0f4ead7 | |||
| 6daea826b8 | |||
| 361e5c296d | |||
| f57029c32f | |||
| 9403241342 | |||
| 3f6f652caf | |||
| 03b177ddfb | |||
| a0f488a017 | |||
| c63a0b1367 | |||
| 8380d53405 | |||
| d6253da3a5 | |||
| 18742349eb | |||
| 740908e42e | |||
| 54cf268ec8 | |||
| 5b088efecb | |||
| a85746629d | |||
| 09b1f36488 | |||
| 32ffe18495 | |||
| 06f8d2e4e1 | |||
| a6ae422e92 | |||
| b40051f5d0 | |||
| a83ca2afb0 | |||
| ea0fd25c19 | |||
| 52ff8beb28 | |||
| 539dc78bcc | |||
| 529c54d71a | |||
| f878f2d5d5 | |||
| 6ef5507bf8 | |||
| 9fa3ab6758 | |||
| 515f8163d3 | |||
| 8ecc9b2358 | |||
| 3582f3c50b | |||
| 8af120b6cf | |||
| 1de57f8251 | |||
| 967e0c8622 | |||
| e6a8c32622 | |||
| 043b3a2810 | |||
| b8e46ee341 | |||
| 89fdac6abf | |||
| 33e6afb24a | |||
| 554a94d010 | |||
| 304e257a66 | |||
| a318ee74fe | |||
| 9430bc96f8 | |||
| fe13af644d | |||
| 3783b21416 | |||
| 65804cf07c | |||
| a0fea7c972 | |||
| 5044a71b70 | |||
| f004c7fc25 | |||
| 55197d599c | |||
| f492e3a613 | |||
| 1c3ea5f270 | |||
| 0874e79ac7 | |||
| 0d97c77ad9 | |||
| 75b19254aa | |||
| 6c760d4f84 | |||
| 9dde857047 | |||
| dea58e0413 | |||
| af71cb796e | |||
| 9869f88a3e | |||
| 2d0c2baee4 | |||
| 436b9e7efd | |||
| 4c22c3e764 | |||
| f887375c8d | |||
| 2d5fbb8555 | |||
| 88fd69ab9f | |||
| 86025d17c4 | |||
| 151e444a07 | |||
| 0f03542255 | |||
| 10277825eb | |||
| c1c0c28a13 | |||
| c72934fb3c | |||
| d99bf1b27b | |||
| 47e01ac591 | |||
| d706ca8fb3 | |||
| 366f7f2a7b | |||
| 5eb99e11a3 | |||
| e88d017014 | |||
| f706463500 | |||
| 84ad676d17 | |||
| b08db3057b | |||
| 2992847913 | |||
| 152ca85dbf | |||
| 68d629ec5c | |||
| d174873bf5 | |||
| 8e846543e4 | |||
| ac7bc3ee1b | |||
| 51fe1f673b | |||
| 3351efa8a5 | |||
| 22a5e1b06b | |||
| c49a39fb64 | |||
| b727f67c2d | |||
| 4bd0c21202 | |||
| 7d8c973b71 | |||
| bb90cb306e | |||
| 49cfa77bb8 | |||
| 3718980379 | |||
| 468c38044d | |||
| f5007927ef | |||
| d765ac6959 | |||
| 133af1854b | |||
| 5c8a55c420 | |||
| d670af616a | |||
| ad770612e1 | |||
| ee72ea2cee | |||
| 14b6f14532 | |||
| a4a73264c3 | |||
| d27ce41ab9 | |||
| bb589662d2 | |||
| 025ad362f2 | |||
| b97bb50ee4 | |||
| a3fb414ef7 | |||
| 6700faff43 | |||
| 6c8380946e | |||
| 81e0bd8517 | |||
| fd407de917 | |||
| 68a116ca86 | |||
| 74d2b971a8 | |||
| 3df8f729fc | |||
| 16b68b5ad3 | |||
| b6afb05e03 | |||
| 922fdfe586 | |||
| edde8fa713 | |||
| 4bffd7adfb | |||
| 86dd410cc8 | |||
| d9c3f36341 | |||
| ff2f07739e | |||
| 4276d03209 | |||
| 2f28ea983e | |||
| 847f26e006 | |||
| 9aaec0f1f8 | |||
| 0799e7b0b4 | |||
| 5558f041e8 | |||
| 87109b1fdc | |||
| c749bf3f12 | |||
| fa40a200b4 | |||
| 85f84fea57 | |||
| 0d5933246e | |||
| a289560ffc | |||
| 4294512d93 | |||
| 5479f4398b | |||
| c3ba9a7e78 | |||
| 9e7c595e35 | |||
| 5dc572af76 | |||
| f2588e210b | |||
| d142dfdbad | |||
| ad79fcfea2 | |||
| 0b74a1d054 | |||
| 334c30709a | |||
| e94d4cc685 |
27
.github/workflows/build_systems.yml
vendored
Normal file
27
.github/workflows/build_systems.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
name: build_systems
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
merge_group:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
schedule:
|
||||||
|
- cron: "0 22 * * *"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: build-${{ matrix.system }}
|
||||||
|
runs-on: self-hosted
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
system:
|
||||||
|
- "bob"
|
||||||
|
- "jeeves"
|
||||||
|
- "rhapsody-in-green"
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Build default package
|
||||||
|
run: "nixos-rebuild build --flake ./#${{ matrix.system }}"
|
||||||
|
- name: copy to nix-cache
|
||||||
|
run: nix copy --to ssh://jeeves .#nixosConfigurations.${{ matrix.system }}.config.system.build.toplevel
|
||||||
|
|
||||||
29
.github/workflows/merge_flake_lock_update.yml
vendored
Normal file
29
.github/workflows/merge_flake_lock_update.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
name: merge_flake_lock_update
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 2 * * 6"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
merge:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: merge_flake_lock_update
|
||||||
|
run: |
|
||||||
|
pr_number=$(gh pr list --state open --author RichieCahill --label flake_lock_update --json number --jq '.[0].number')
|
||||||
|
echo "pr_number=$pr_number" >> $GITHUB_ENV
|
||||||
|
if [ -n "$pr_number" ]; then
|
||||||
|
gh pr merge "$pr_number" --rebase
|
||||||
|
else
|
||||||
|
echo "No open PR found with label flake_lock_update"
|
||||||
|
fi
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
|
||||||
16
.github/workflows/treefmt.yml
vendored
Normal file
16
.github/workflows/treefmt.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
name: treefmt
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
merge_group:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
treefmt:
|
||||||
|
name: nix fmt
|
||||||
|
runs-on: self-hosted
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: runs treefmt
|
||||||
|
run: "treefmt --ci"
|
||||||
23
.github/workflows/update-flake-lock.yml
vendored
Normal file
23
.github/workflows/update-flake-lock.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
name: update-flake-lock
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 0 * * 6"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lockfile:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
- name: Update flake.lock
|
||||||
|
uses: DeterminateSystems/update-flake-lock@main
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
|
||||||
|
pr-title: "Update flake.lock"
|
||||||
|
pr-labels: |
|
||||||
|
dependencies
|
||||||
|
automated
|
||||||
|
flake_lock_update
|
||||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -160,3 +160,8 @@ cython_debug/
|
|||||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
|
|
||||||
|
test.*
|
||||||
|
|
||||||
|
# syncthing
|
||||||
|
.stfolder
|
||||||
|
|||||||
17
.sops.yaml
Normal file
17
.sops.yaml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
keys:
|
||||||
|
- &admin_richie age1u8zj599elqqvcmhxn8zuwrufsz8w8w366d3ayrljjejljt2q45kq8mxw9c # cspell:disable-line
|
||||||
|
|
||||||
|
- &system_bob age1q47vup0tjhulkg7d6xwmdsgrw64h4ax3la3evzqpxyy4adsmk9fs56qz3y # cspell:disable-line
|
||||||
|
- &system_jeeves age13lmqgc3jvkyah5e3vcwmj4s5wsc2akctcga0lpc0x8v8du3fxprqp4ldkv # cspell:disable-line
|
||||||
|
- &system_router age1xzxryqq63x65yuza9lmmkud7crjjxpnkdew070yhx6xn7xe4tdws5twxsv # cspell:disable-line
|
||||||
|
- &system_rhapsody age1ufnewppysaq2wwcl4ugngjz8pfzc5a35yg7luq0qmuqvctajcycs5lf6k4 # cspell:disable-line
|
||||||
|
|
||||||
|
creation_rules:
|
||||||
|
- path_regex: users/secrets\.yaml$
|
||||||
|
key_groups:
|
||||||
|
- age:
|
||||||
|
- *admin_richie
|
||||||
|
- *system_bob
|
||||||
|
- *system_jeeves
|
||||||
|
- *system_router
|
||||||
|
- *system_rhapsody
|
||||||
139
.vscode/settings.json
vendored
139
.vscode/settings.json
vendored
@@ -1,123 +1,238 @@
|
|||||||
{
|
{
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"aboutwelcome",
|
"aboutwelcome",
|
||||||
|
"acltype",
|
||||||
|
"addstr",
|
||||||
|
"advplyr",
|
||||||
"ahci",
|
"ahci",
|
||||||
|
"aioesphomeapi",
|
||||||
|
"aiounifi",
|
||||||
"alsa",
|
"alsa",
|
||||||
|
"apiclient",
|
||||||
|
"archlinux",
|
||||||
|
"ashift",
|
||||||
"asrouter",
|
"asrouter",
|
||||||
|
"attroff",
|
||||||
|
"attron",
|
||||||
|
"audiobooks",
|
||||||
|
"audiobookshelf",
|
||||||
"auditd",
|
"auditd",
|
||||||
"autofetch",
|
"autofetch",
|
||||||
|
"autologin",
|
||||||
|
"automations",
|
||||||
"autopull",
|
"autopull",
|
||||||
|
"autotrim",
|
||||||
|
"autoupdate",
|
||||||
"azuretools",
|
"azuretools",
|
||||||
"bantime",
|
"bantime",
|
||||||
|
"bazarr",
|
||||||
|
"bgwriter",
|
||||||
|
"binhex",
|
||||||
"bitwarden",
|
"bitwarden",
|
||||||
|
"blkdiscard",
|
||||||
"breakpad",
|
"breakpad",
|
||||||
"btop",
|
"btop",
|
||||||
"cachix",
|
"cachix",
|
||||||
|
"canmount",
|
||||||
"captivedetect",
|
"captivedetect",
|
||||||
"cgroupdriver",
|
"cgroupdriver",
|
||||||
"charliermarsh",
|
"charliermarsh",
|
||||||
|
"Checkpointing",
|
||||||
|
"cloudflared",
|
||||||
|
"codellama",
|
||||||
"codezombiech",
|
"codezombiech",
|
||||||
"compactmode",
|
"compactmode",
|
||||||
"Compat",
|
"Compat",
|
||||||
"contentblocking",
|
"contentblocking",
|
||||||
"cookiebanners",
|
"cookiebanners",
|
||||||
|
"createdb",
|
||||||
|
"createrole",
|
||||||
"crlite",
|
"crlite",
|
||||||
|
"cryptsetup",
|
||||||
|
"cuda",
|
||||||
"darkreader",
|
"darkreader",
|
||||||
|
"datagrip",
|
||||||
"datareporting",
|
"datareporting",
|
||||||
"davidanson",
|
"davidanson",
|
||||||
"dconf",
|
"dconf",
|
||||||
"dearrow",
|
"dearrow",
|
||||||
"debugpy",
|
"debugpy",
|
||||||
|
"deepseek",
|
||||||
"dialout",
|
"dialout",
|
||||||
"diffie",
|
"diffie",
|
||||||
"direnv",
|
"direnv",
|
||||||
"dmask",
|
"dmask",
|
||||||
|
"dnodesize",
|
||||||
"dotfiles",
|
"dotfiles",
|
||||||
"drawio",
|
"drawio",
|
||||||
|
"duckdns",
|
||||||
"eamodio",
|
"eamodio",
|
||||||
|
"ehci",
|
||||||
|
"emerg",
|
||||||
"endlessh",
|
"endlessh",
|
||||||
"errorlens",
|
"errorlens",
|
||||||
"esbenp",
|
"esbenp",
|
||||||
|
"esphome",
|
||||||
"extest",
|
"extest",
|
||||||
|
"fadvise",
|
||||||
"fastforwardteam",
|
"fastforwardteam",
|
||||||
"FASTFOX",
|
"FASTFOX",
|
||||||
|
"ffmpegthumbnailer",
|
||||||
|
"filebot",
|
||||||
|
"filebrowser",
|
||||||
"fileroller",
|
"fileroller",
|
||||||
"findbar",
|
"findbar",
|
||||||
|
"Fira",
|
||||||
"fmask",
|
"fmask",
|
||||||
|
"fontconfig",
|
||||||
"formfill",
|
"formfill",
|
||||||
|
"forwardfor",
|
||||||
"foxundermoon",
|
"foxundermoon",
|
||||||
"FULLSCREEN",
|
"FULLSCREEN",
|
||||||
|
"fwupd",
|
||||||
"fxaccounts",
|
"fxaccounts",
|
||||||
"gamemode",
|
"gamemode",
|
||||||
"gamescope",
|
"gamescope",
|
||||||
|
"getch",
|
||||||
|
"getmaxyx",
|
||||||
"ghdeploy",
|
"ghdeploy",
|
||||||
"globalprivacycontrol",
|
"globalprivacycontrol",
|
||||||
"gparted",
|
"gparted",
|
||||||
|
"gtts",
|
||||||
|
"gutenprint",
|
||||||
|
"hass",
|
||||||
"healthreport",
|
"healthreport",
|
||||||
"Heatsink",
|
"Heatsink",
|
||||||
"hediet",
|
"hediet",
|
||||||
"hexeditor",
|
"hexeditor",
|
||||||
"hicolor",
|
"hicolor",
|
||||||
"hmac",
|
"hmac",
|
||||||
|
"homeassistant",
|
||||||
"HPKP",
|
"HPKP",
|
||||||
|
"hplip",
|
||||||
"htmlaboutaddons",
|
"htmlaboutaddons",
|
||||||
|
"httpchk",
|
||||||
|
"hurlenko",
|
||||||
"hwloc",
|
"hwloc",
|
||||||
|
"INITDB",
|
||||||
|
"iocharset",
|
||||||
|
"ioit",
|
||||||
"iperf",
|
"iperf",
|
||||||
|
"isal",
|
||||||
|
"jellyfin",
|
||||||
"jnoortheen",
|
"jnoortheen",
|
||||||
"jsbc",
|
"jsbc",
|
||||||
|
"kagi",
|
||||||
|
"kuma",
|
||||||
|
"lazer",
|
||||||
|
"levelname",
|
||||||
"libglvnd",
|
"libglvnd",
|
||||||
"libmysqlclient",
|
"libmysqlclient",
|
||||||
"libsodium",
|
"libsodium",
|
||||||
"libssh",
|
"libssh",
|
||||||
"libvirtd",
|
"libvirtd",
|
||||||
|
"llms",
|
||||||
|
"localtime",
|
||||||
|
"louislam",
|
||||||
|
"lsnew",
|
||||||
"luks",
|
"luks",
|
||||||
"lynis",
|
"lynis",
|
||||||
"mangohud",
|
"mangohud",
|
||||||
"markdownlint",
|
"markdownlint",
|
||||||
|
"maxconn",
|
||||||
|
"maxpages",
|
||||||
"maxretry",
|
"maxretry",
|
||||||
"maxtime",
|
"maxtime",
|
||||||
"mechatroner",
|
"mechatroner",
|
||||||
"mediainfo",
|
"mediainfo",
|
||||||
|
"mixtral",
|
||||||
|
"mklabel",
|
||||||
|
"mkpart",
|
||||||
"modesetting",
|
"modesetting",
|
||||||
|
"mountpoint",
|
||||||
|
"mountpoints",
|
||||||
"mousewheel",
|
"mousewheel",
|
||||||
"mtxr",
|
"mtxr",
|
||||||
"ncdu",
|
"ncdu",
|
||||||
"nemo",
|
"nemo",
|
||||||
"neofetch",
|
"neofetch",
|
||||||
|
"nerdfonts",
|
||||||
|
"netdev",
|
||||||
|
"netdevs",
|
||||||
|
"Networkd",
|
||||||
"networkmanager",
|
"networkmanager",
|
||||||
"newtabpage",
|
"newtabpage",
|
||||||
|
"nixfmt",
|
||||||
"nixos",
|
"nixos",
|
||||||
"nixpkgs",
|
"nixpkgs",
|
||||||
"nmap",
|
"nmap",
|
||||||
|
"noauto",
|
||||||
|
"nodev",
|
||||||
|
"noecho",
|
||||||
"nonsponsored",
|
"nonsponsored",
|
||||||
|
"Noto",
|
||||||
|
"nprt",
|
||||||
"nvme",
|
"nvme",
|
||||||
"OCSP",
|
"OCSP",
|
||||||
"oderwat",
|
"oderwat",
|
||||||
|
"ollama",
|
||||||
|
"ondemand",
|
||||||
|
"oneshot",
|
||||||
|
"openwakeword",
|
||||||
"optimise",
|
"optimise",
|
||||||
"optoutstudies",
|
"optoutstudies",
|
||||||
"overalljails",
|
"overalljails",
|
||||||
"overscroll",
|
"overscroll",
|
||||||
|
"overseerr",
|
||||||
|
"partitionwise",
|
||||||
"pbmode",
|
"pbmode",
|
||||||
"pciutils",
|
"pciutils",
|
||||||
|
"pcscd",
|
||||||
"pdfjs",
|
"pdfjs",
|
||||||
"peerconnection",
|
"peerconnection",
|
||||||
"PESKYFOX",
|
"PESKYFOX",
|
||||||
|
"PGID",
|
||||||
"pipewire",
|
"pipewire",
|
||||||
"pkgs",
|
"pkgs",
|
||||||
"plugdev",
|
"plugdev",
|
||||||
|
"poppler",
|
||||||
|
"posixacl",
|
||||||
|
"powertop",
|
||||||
|
"primarycache",
|
||||||
|
"prismlauncher",
|
||||||
"privatebrowsing",
|
"privatebrowsing",
|
||||||
|
"PRIVOXY",
|
||||||
|
"protontricks",
|
||||||
|
"prowlarr",
|
||||||
"proxychains",
|
"proxychains",
|
||||||
"prusa",
|
"prusa",
|
||||||
|
"psycopg",
|
||||||
|
"PUID",
|
||||||
"pulseaudio",
|
"pulseaudio",
|
||||||
"punycode",
|
"punycode",
|
||||||
|
"pychromecast",
|
||||||
"pylance",
|
"pylance",
|
||||||
|
"pymetno",
|
||||||
|
"pyownet",
|
||||||
|
"qbit",
|
||||||
|
"qbittorrent",
|
||||||
|
"qbittorrentvpn",
|
||||||
|
"qbitvpn",
|
||||||
"quicksuggest",
|
"quicksuggest",
|
||||||
|
"radarr",
|
||||||
"readahead",
|
"readahead",
|
||||||
|
"receiveencrypted",
|
||||||
|
"recordsize",
|
||||||
"Redistributable",
|
"Redistributable",
|
||||||
"referer",
|
"referer",
|
||||||
"REFERERS",
|
"REFERERS",
|
||||||
|
"relatime",
|
||||||
"Rhosts",
|
"Rhosts",
|
||||||
"ripgrep",
|
"ripgrep",
|
||||||
|
"roboto",
|
||||||
|
"rokuecp",
|
||||||
|
"routable",
|
||||||
|
"rspace",
|
||||||
"rtkit",
|
"rtkit",
|
||||||
"rycee",
|
"rycee",
|
||||||
"safebrowsing",
|
"safebrowsing",
|
||||||
@@ -129,44 +244,68 @@
|
|||||||
"signon",
|
"signon",
|
||||||
"Signons",
|
"Signons",
|
||||||
"skia",
|
"skia",
|
||||||
|
"smartd",
|
||||||
"smartmontools",
|
"smartmontools",
|
||||||
"SMOOTHFOX",
|
"SMOOTHFOX",
|
||||||
"socialtracking",
|
"socialtracking",
|
||||||
|
"sonarr",
|
||||||
"sponsorblock",
|
"sponsorblock",
|
||||||
"sqltools",
|
"sqltools",
|
||||||
|
"ssdp",
|
||||||
|
"SSHOPTS",
|
||||||
"stdenv",
|
"stdenv",
|
||||||
"subresource",
|
"subresource",
|
||||||
"substituters",
|
"substituters",
|
||||||
"supermaven",
|
"supermaven",
|
||||||
|
"sysstat",
|
||||||
"tabmanager",
|
"tabmanager",
|
||||||
"tamasfe",
|
"tamasfe",
|
||||||
|
"TCPIP",
|
||||||
"tiktok",
|
"tiktok",
|
||||||
"timonwong",
|
"timonwong",
|
||||||
|
"titlebar",
|
||||||
|
"tmmworkshop",
|
||||||
|
"Tmpfs",
|
||||||
"topsites",
|
"topsites",
|
||||||
"topstories",
|
"topstories",
|
||||||
|
"treefmt",
|
||||||
"twimg",
|
"twimg",
|
||||||
"uaccess",
|
"uaccess",
|
||||||
"ublock",
|
"ublock",
|
||||||
|
"uiprotect",
|
||||||
"uitour",
|
"uitour",
|
||||||
|
"unrar",
|
||||||
"unsubmitted",
|
"unsubmitted",
|
||||||
|
"uptimekuma",
|
||||||
"urlbar",
|
"urlbar",
|
||||||
"urlclassifier",
|
"urlclassifier",
|
||||||
"usbhid",
|
"usbhid",
|
||||||
"usbutils",
|
"usbutils",
|
||||||
|
"useragent",
|
||||||
"usernamehw",
|
"usernamehw",
|
||||||
"userprefs",
|
"userprefs",
|
||||||
"vfat",
|
"vfat",
|
||||||
"virt",
|
"virt",
|
||||||
"virtualisation",
|
"virtualisation",
|
||||||
"vpnpromourl",
|
"vpnpromourl",
|
||||||
|
"wakeonlan",
|
||||||
"webchannel",
|
"webchannel",
|
||||||
"WEBRTC",
|
"WEBRTC",
|
||||||
|
"WEBUI",
|
||||||
|
"wireplumber",
|
||||||
"wireshark",
|
"wireshark",
|
||||||
|
"Workqueues",
|
||||||
|
"xattr",
|
||||||
"xhci",
|
"xhci",
|
||||||
|
"yazi",
|
||||||
|
"yubikey",
|
||||||
|
"yubioath",
|
||||||
"yzhang",
|
"yzhang",
|
||||||
|
"zeroconf",
|
||||||
"zerotier",
|
"zerotier",
|
||||||
"zerotierone",
|
"zerotierone",
|
||||||
"zoxide",
|
"zoxide",
|
||||||
|
"zram",
|
||||||
"zstd"
|
"zstd"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
74
common/global/default.nix
Normal file
74
common/global/default.nix
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
{
|
||||||
|
inputs,
|
||||||
|
lib,
|
||||||
|
outputs,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
inputs.home-manager.nixosModules.home-manager
|
||||||
|
inputs.sops-nix.nixosModules.sops
|
||||||
|
./fail2ban.nix
|
||||||
|
./fonts.nix
|
||||||
|
./libs.nix
|
||||||
|
./locale.nix
|
||||||
|
./nh.nix
|
||||||
|
./nix.nix
|
||||||
|
./programs.nix
|
||||||
|
./ssh.nix
|
||||||
|
./snapshot_manager.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
boot = {
|
||||||
|
tmp.useTmpfs = true;
|
||||||
|
kernelPackages = lib.mkDefault pkgs.linuxPackages_6_12;
|
||||||
|
zfs.package = lib.mkDefault pkgs.zfs_2_3;
|
||||||
|
};
|
||||||
|
|
||||||
|
hardware.enableRedistributableFirmware = true;
|
||||||
|
|
||||||
|
home-manager = {
|
||||||
|
useGlobalPkgs = true;
|
||||||
|
useUserPackages = true;
|
||||||
|
extraSpecialArgs = { inherit inputs outputs; };
|
||||||
|
backupFileExtension = "backup";
|
||||||
|
};
|
||||||
|
|
||||||
|
nixpkgs = {
|
||||||
|
overlays = builtins.attrValues outputs.overlays;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
# firmware update
|
||||||
|
fwupd.enable = true;
|
||||||
|
|
||||||
|
snapshot_manager.enable = lib.mkDefault true;
|
||||||
|
|
||||||
|
zfs = {
|
||||||
|
trim.enable = lib.mkDefault true;
|
||||||
|
autoScrub.enable = lib.mkDefault true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
powerManagement.powertop.enable = lib.mkDefault true;
|
||||||
|
|
||||||
|
programs.zsh.enable = true;
|
||||||
|
|
||||||
|
security = {
|
||||||
|
auditd.enable = lib.mkDefault true;
|
||||||
|
sudo-rs = {
|
||||||
|
enable = true;
|
||||||
|
execWheelOnly = true;
|
||||||
|
};
|
||||||
|
sudo.enable = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
users.mutableUsers = lib.mkDefault false;
|
||||||
|
|
||||||
|
zramSwap = {
|
||||||
|
enable = lib.mkDefault true;
|
||||||
|
priority = 1000;
|
||||||
|
};
|
||||||
|
}
|
||||||
12
common/global/fonts.nix
Normal file
12
common/global/fonts.nix
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
fonts = {
|
||||||
|
fontconfig.enable = true;
|
||||||
|
enableDefaultPackages = true;
|
||||||
|
packages = with pkgs; [
|
||||||
|
nerd-fonts.roboto-mono
|
||||||
|
nerd-fonts.intone-mono
|
||||||
|
nerd-fonts.symbols-only
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -4,8 +4,7 @@
|
|||||||
console.keyMap = lib.mkDefault "us";
|
console.keyMap = lib.mkDefault "us";
|
||||||
|
|
||||||
i18n = {
|
i18n = {
|
||||||
defaultLocale = lib.mkDefault "en_US.utf8";
|
defaultLocale = lib.mkDefault "en_US.UTF-8";
|
||||||
supportedLocales = lib.mkDefault [ "en_US.UTF-8/UTF-8" ];
|
|
||||||
extraLocaleSettings = lib.mkDefault {
|
extraLocaleSettings = lib.mkDefault {
|
||||||
LC_ADDRESS = "en_US.UTF-8";
|
LC_ADDRESS = "en_US.UTF-8";
|
||||||
LC_IDENTIFICATION = "en_US.UTF-8";
|
LC_IDENTIFICATION = "en_US.UTF-8";
|
||||||
42
common/global/nix.nix
Normal file
42
common/global/nix.nix
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
inputs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
nix = {
|
||||||
|
settings = {
|
||||||
|
trusted-users = [
|
||||||
|
"root"
|
||||||
|
"@wheel"
|
||||||
|
];
|
||||||
|
trusted-substituters = [
|
||||||
|
"https://cache.nixos.org"
|
||||||
|
"https://nix-community.cachix.org"
|
||||||
|
];
|
||||||
|
substituters = [
|
||||||
|
"https://cache.nixos.org/?priority=2&want-mass-query=true"
|
||||||
|
"https://nix-community.cachix.org/?priority=10&want-mass-query=true"
|
||||||
|
];
|
||||||
|
trusted-public-keys = [
|
||||||
|
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
||||||
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||||
|
];
|
||||||
|
auto-optimise-store = lib.mkDefault true;
|
||||||
|
experimental-features = [
|
||||||
|
"nix-command"
|
||||||
|
"flakes"
|
||||||
|
"ca-derivations"
|
||||||
|
];
|
||||||
|
warn-dirty = false;
|
||||||
|
flake-registry = ""; # disable global flake registries
|
||||||
|
};
|
||||||
|
|
||||||
|
# Add each flake input as a registry and nix_path
|
||||||
|
registry = lib.mapAttrs (_: flake: { inherit flake; }) flakeInputs;
|
||||||
|
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -2,6 +2,6 @@
|
|||||||
{
|
{
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
git
|
git
|
||||||
python312
|
python313
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
29
common/global/snapshot_config.toml
Normal file
29
common/global/snapshot_config.toml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
["default"]
|
||||||
|
15_min = 8
|
||||||
|
hourly = 24
|
||||||
|
daily = 0
|
||||||
|
monthly = 0
|
||||||
|
|
||||||
|
["root_pool/home"]
|
||||||
|
15_min = 8
|
||||||
|
hourly = 12
|
||||||
|
daily = 1
|
||||||
|
monthly = 0
|
||||||
|
|
||||||
|
["root_pool/root"]
|
||||||
|
15_min = 8
|
||||||
|
hourly = 24
|
||||||
|
daily = 0
|
||||||
|
monthly = 0
|
||||||
|
|
||||||
|
["root_pool/nix"]
|
||||||
|
15_min = 4
|
||||||
|
hourly = 0
|
||||||
|
daily = 0
|
||||||
|
monthly = 0
|
||||||
|
|
||||||
|
["root_pool/var"]
|
||||||
|
15_min = 8
|
||||||
|
hourly = 24
|
||||||
|
daily = 30
|
||||||
|
monthly = 6
|
||||||
50
common/global/snapshot_manager.nix
Normal file
50
common/global/snapshot_manager.nix
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
inputs,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.services.snapshot_manager;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
services.snapshot_manager = {
|
||||||
|
enable = lib.mkOption {
|
||||||
|
default = true;
|
||||||
|
example = true;
|
||||||
|
description = "Whether to enable k3s-net.";
|
||||||
|
type = lib.types.bool;
|
||||||
|
};
|
||||||
|
path = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
description = "Path that needs to be updated via git pull";
|
||||||
|
default = ./snapshot_config.toml;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
systemd = {
|
||||||
|
services."snapshot_manager" = {
|
||||||
|
description = "ZFS Snapshot Manager";
|
||||||
|
requires = [ "zfs-import.target" ];
|
||||||
|
after = [ "zfs-import.target" ];
|
||||||
|
path = [ pkgs.zfs ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "${inputs.system_tools.packages.x86_64-linux.default}/bin/snapshot_manager --config-file='${cfg.path}'";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
timers."snapshot_manager" = {
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig = {
|
||||||
|
OnBootSec = "15m";
|
||||||
|
OnUnitActiveSec = "15m";
|
||||||
|
Unit = "snapshot_manager.service";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -67,5 +67,5 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 22 ];
|
networking.firewall.allowedTCPPorts = [ 22 ];
|
||||||
}
|
}
|
||||||
42
common/optional/desktop.nix
Normal file
42
common/optional/desktop.nix
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
boot = {
|
||||||
|
kernelPackages = pkgs.linuxPackages_6_15;
|
||||||
|
zfs.package = pkgs.zfs_2_3;
|
||||||
|
};
|
||||||
|
|
||||||
|
hardware.bluetooth = {
|
||||||
|
enable = true;
|
||||||
|
powerOnBoot = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# rtkit is optional but recommended for pipewire
|
||||||
|
security.rtkit.enable = true;
|
||||||
|
|
||||||
|
services = {
|
||||||
|
displayManager.sddm = {
|
||||||
|
enable = true;
|
||||||
|
wayland.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
desktopManager.plasma6.enable = true;
|
||||||
|
|
||||||
|
xserver = {
|
||||||
|
enable = true;
|
||||||
|
xkb = {
|
||||||
|
layout = "us";
|
||||||
|
variant = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
pulseaudio.enable = false;
|
||||||
|
|
||||||
|
pipewire = {
|
||||||
|
enable = true;
|
||||||
|
alsa.enable = true;
|
||||||
|
alsa.support32Bit = true;
|
||||||
|
pulse.enable = true;
|
||||||
|
wireplumber.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
|
nixpkgs.config.cudaSupport = true;
|
||||||
|
|
||||||
services.xserver.videoDrivers = [ "nvidia" ];
|
services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
hardware = {
|
hardware = {
|
||||||
nvidia = {
|
nvidia = {
|
||||||
modesetting.enable = true;
|
modesetting.enable = true;
|
||||||
powerManagement.enable = true;
|
powerManagement.enable = true;
|
||||||
package = config.boot.kernelPackages.nvidiaPackages.production;
|
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
||||||
nvidiaSettings = true;
|
nvidiaSettings = true;
|
||||||
|
open = true;
|
||||||
};
|
};
|
||||||
nvidia-container-toolkit.enable = true;
|
nvidia-container-toolkit.enable = true;
|
||||||
};
|
};
|
||||||
10
common/optional/printing.nix
Normal file
10
common/optional/printing.nix
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.printing = {
|
||||||
|
enable = true;
|
||||||
|
drivers = with pkgs; [
|
||||||
|
gutenprint
|
||||||
|
hplip
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
6
common/optional/scanner.nix
Normal file
6
common/optional/scanner.nix
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
hardware.sane = {
|
||||||
|
enable = true;
|
||||||
|
drivers.scanSnap.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
environment.systemPackages = with pkgs; [mangohud steam-run];
|
environment.systemPackages = with pkgs; [
|
||||||
|
mangohud
|
||||||
|
steam-run
|
||||||
|
];
|
||||||
hardware.steam-hardware.enable = true;
|
hardware.steam-hardware.enable = true;
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
@@ -10,8 +13,13 @@
|
|||||||
gamescopeSession.enable = true;
|
gamescopeSession.enable = true;
|
||||||
remotePlay.openFirewall = true;
|
remotePlay.openFirewall = true;
|
||||||
localNetworkGameTransfers.openFirewall = true;
|
localNetworkGameTransfers.openFirewall = true;
|
||||||
extraCompatPackages = with pkgs; [proton-ge-bin];
|
protontricks.enable = true;
|
||||||
|
extraCompatPackages = with pkgs; [ proton-ge-bin ];
|
||||||
extest.enable = true;
|
extest.enable = true;
|
||||||
};
|
};
|
||||||
|
gamescope = {
|
||||||
|
enable = true;
|
||||||
|
capSysNice = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
18
common/optional/syncthing_base.nix
Normal file
18
common/optional/syncthing_base.nix
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
services.syncthing = {
|
||||||
|
enable = true;
|
||||||
|
user = "richie";
|
||||||
|
overrideDevices = true;
|
||||||
|
overrideFolders = lib.mkDefault true;
|
||||||
|
dataDir = "/home/richie/Syncthing";
|
||||||
|
configDir = "/home/richie/.config/syncthing";
|
||||||
|
settings.devices = {
|
||||||
|
phone.id = "TBRULKD-7DZPGGZ-F6LLB7J-MSO54AY-7KLPBIN-QOFK6PX-W2HBEWI-PHM2CQI"; # cspell:disable-line
|
||||||
|
jeeves.id = "ICRHXZW-ECYJCUZ-I4CZ64R-3XRK7CG-LL2HAAK-FGOHD22-BQA4AI6-5OAL6AG"; # cspell:disable-line
|
||||||
|
ipad.id = "KI76T3X-SFUGV2L-VSNYTKR-TSIUV5L-SHWD3HE-GQRGRCN-GY4UFMD-CW6Z6AX"; # cspell:disable-line
|
||||||
|
bob.id = "CJIAPEJ-VO74RR4-F75VU6M-QNZAMYG-FYUJG7Y-6AT62HJ-355PRPL-PJFETAZ"; # cspell:disable-line
|
||||||
|
rhapsody-in-green.id = "ASL3KC4-3XEN6PA-7BQBRKE-A7JXLI6-DJT43BY-Q4WPOER-7UALUAZ-VTPQ6Q4"; # cspell:disable-line
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
7
common/optional/tmmworkshop_cache.nix
Normal file
7
common/optional/tmmworkshop_cache.nix
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
nix.settings = {
|
||||||
|
trusted-substituters = [ "http://cache.tmmworkshop.com" ];
|
||||||
|
substituters = [ "http://cache.tmmworkshop.com/?priority=1&want-mass-query=true" ];
|
||||||
|
trusted-public-keys = [ "cache.tmmworkshop.com:jHffkpgbmEdstQPoihJPYW9TQe6jnQbWR2LqkNGV3iA=" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
11
common/optional/update.nix
Normal file
11
common/optional/update.nix
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
system.autoUpgrade = {
|
||||||
|
enable = true;
|
||||||
|
flags = [ "--accept-flake-config" ];
|
||||||
|
randomizedDelaySec = "1h";
|
||||||
|
persistent = true;
|
||||||
|
flake = "github:RichieCahill/dotfiles";
|
||||||
|
allowReboot = true;
|
||||||
|
dates = "Sat *-*-* 06:00:00";
|
||||||
|
};
|
||||||
|
}
|
||||||
6
common/optional/yubikey.nix
Normal file
6
common/optional/yubikey.nix
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.pcscd.enable = true;
|
||||||
|
|
||||||
|
environment.systemPackages = [ pkgs.yubioath-flutter ];
|
||||||
|
}
|
||||||
11
common/optional/zerotier.nix
Normal file
11
common/optional/zerotier.nix
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
services.zerotierone = {
|
||||||
|
enable = true;
|
||||||
|
joinNetworks = [ "e4da7455b2ae64ca" ];
|
||||||
|
};
|
||||||
|
nix.settings = {
|
||||||
|
trusted-substituters = [ "http://192.168.90.40:5000" ];
|
||||||
|
substituters = [ "http://192.168.90.40:5000/?priority=1&want-mass-query=true" ];
|
||||||
|
trusted-public-keys = [ "cache.tmmworkshop.com:jHffkpgbmEdstQPoihJPYW9TQe6jnQbWR2LqkNGV3iA=" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
362
flake.lock
generated
362
flake.lock
generated
@@ -2,18 +2,17 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"firefox-addons": {
|
"firefox-addons": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "pkgs/firefox-addons",
|
"dir": "pkgs/firefox-addons",
|
||||||
"lastModified": 1725940994,
|
"lastModified": 1752811437,
|
||||||
"narHash": "sha256-PCj5WMvCMg2g8gBNf3izt4rPu5b5Mi/7zxmXHit3N3U=",
|
"narHash": "sha256-TVWYBcNpeQ3fEloryVP9N2yJnC3vuPpoZF1RqFFWFt0=",
|
||||||
"owner": "rycee",
|
"owner": "rycee",
|
||||||
"repo": "nur-expressions",
|
"repo": "nur-expressions",
|
||||||
"rev": "93857a3619db67e72f5012ce3cb001e402b86dbe",
|
"rev": "369dccacc0a8214600773b3bbbf68d98a19b74e8",
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -23,77 +22,6 @@
|
|||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-compat": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1717312683,
|
|
||||||
"narHash": "sha256-FrlieJH50AuvagamEvWMIE6D2OAnERuDboFDYAED/dE=",
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"rev": "38fd3954cf65ce6faf3d0d45cd26059e059f07ea",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-parts": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs-lib": [
|
|
||||||
"nixos-cosmic",
|
|
||||||
"nix-update",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1719994518,
|
|
||||||
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "flake-parts",
|
|
||||||
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "flake-parts",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1629284811,
|
|
||||||
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "c5d161cc0af116a2e17f54316f0bf43f0819785c",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils_2": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1710146030,
|
|
||||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"home-manager": {
|
"home-manager": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
@@ -101,11 +29,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725948275,
|
"lastModified": 1752814804,
|
||||||
"narHash": "sha256-4QOPemDQ9VRLQaAdWuvdDBhh+lEUOAnSMHhdr4nS1mk=",
|
"narHash": "sha256-irfg7lnfEpJY+3Cffkluzp2MTVw1Uq9QGxFp6qadcXI=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "e5fa72bad0c6f533e8d558182529ee2acc9454fe",
|
"rev": "d0300c8808e41da81d6edfc202f3d3833c157daf",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -114,82 +42,13 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nix-github-actions": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"system_tools",
|
|
||||||
"poetry2nix",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1703863825,
|
|
||||||
"narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=",
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "nix-github-actions",
|
|
||||||
"rev": "5163432afc817cf8bd1f031418d1869e4c9d5547",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "nix-github-actions",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nix-update": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-parts": "flake-parts",
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixos-cosmic",
|
|
||||||
"nixpkgs"
|
|
||||||
],
|
|
||||||
"treefmt-nix": "treefmt-nix"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1725635983,
|
|
||||||
"narHash": "sha256-haSfwdurfltqQ/7YEmDcmWLnWwvAgelIHnXsHG34P1k=",
|
|
||||||
"owner": "lilyinstarlight",
|
|
||||||
"repo": "nix-update",
|
|
||||||
"rev": "ed54a7546affb3f8c9c3e10a6fa6fdb21756ec8f",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "lilyinstarlight",
|
|
||||||
"repo": "nix-update",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixos-cosmic": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-compat": "flake-compat",
|
|
||||||
"nix-update": "nix-update",
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
],
|
|
||||||
"nixpkgs-stable": "nixpkgs-stable",
|
|
||||||
"rust-overlay": "rust-overlay"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1725932078,
|
|
||||||
"narHash": "sha256-IATccCX01KHY3QDYmpCMu70WRWxJH4V7z9vp71RlSAs=",
|
|
||||||
"owner": "lilyinstarlight",
|
|
||||||
"repo": "nixos-cosmic",
|
|
||||||
"rev": "0452cc841e9b30160ae48db636164fb7a6d6bb72",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "lilyinstarlight",
|
|
||||||
"repo": "nixos-cosmic",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixos-hardware": {
|
"nixos-hardware": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725885300,
|
"lastModified": 1752666637,
|
||||||
"narHash": "sha256-5RLEnou1/GJQl+Wd+Bxaj7QY7FFQ9wjnFq1VNEaxTmc=",
|
"narHash": "sha256-P8J72psdc/rWliIvp8jUpoQ6qRDlVzgSDDlgkaXQ0Fw=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixos-hardware",
|
"repo": "nixos-hardware",
|
||||||
"rev": "166dee4f88a7e3ba1b7a243edb1aca822f00680e",
|
"rev": "d1bfa8f6ccfb5c383e1eba609c1eb67ca24ed153",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -201,11 +60,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725634671,
|
"lastModified": 1752687322,
|
||||||
"narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=",
|
"narHash": "sha256-RKwfXA4OZROjBTQAl9WOZQFm7L8Bo93FQwSJpAiSRvo=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c",
|
"rev": "6e987485eb2c77e5dcc5af4e3c70843711ef9251",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -215,29 +74,29 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs-master": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1752884127,
|
||||||
|
"narHash": "sha256-ppPL0jXpeeFtyP9I01o807u3iVADQ3YkqpN2lUZk4LY=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "cda03d762aa4d6930f41c2a60b946e0f8a743630",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "master",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs-stable": {
|
"nixpkgs-stable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725826545,
|
"lastModified": 1735563628,
|
||||||
"narHash": "sha256-L64N1rpLlXdc94H+F6scnrbuEu+utC03cDDVvvJGOME=",
|
"narHash": "sha256-OnSAY7XDSx7CtDoqNh8jwVwh4xNL/2HaJxGjryLWzX8=",
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "f4c846aee8e1e29062aa8514d5e0ab270f4ec2f9",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixos-24.05",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs-stable_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1725826545,
|
|
||||||
"narHash": "sha256-L64N1rpLlXdc94H+F6scnrbuEu+utC03cDDVvvJGOME=",
|
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "f4c846aee8e1e29062aa8514d5e0ab270f4ec2f9",
|
"rev": "b134951a4c9f3c995fd7be05f3243f8ecd65d798",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -247,31 +106,53 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"poetry2nix": {
|
"pyproject-build-systems": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": [
|
|
||||||
"system_tools",
|
|
||||||
"flake-utils"
|
|
||||||
],
|
|
||||||
"nix-github-actions": "nix-github-actions",
|
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"system_tools",
|
"system_tools",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
"systems": "systems_2",
|
"pyproject-nix": [
|
||||||
"treefmt-nix": "treefmt-nix_2"
|
"system_tools",
|
||||||
|
"pyproject-nix"
|
||||||
|
],
|
||||||
|
"uv2nix": [
|
||||||
|
"system_tools",
|
||||||
|
"uv2nix"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1723343306,
|
"lastModified": 1744599653,
|
||||||
"narHash": "sha256-/6sRkPq7/5weX2y0V8sQ29Sz35nt8kyj+BsFtkhgbJE=",
|
"narHash": "sha256-nysSwVVjG4hKoOjhjvE6U5lIKA8sEr1d1QzEfZsannU=",
|
||||||
"owner": "nix-community",
|
"owner": "pyproject-nix",
|
||||||
"repo": "poetry2nix",
|
"repo": "build-system-pkgs",
|
||||||
"rev": "4a1c112ff0c67f496573dc345bd0b2247818fc29",
|
"rev": "7dba6dbc73120e15b558754c26024f6c93015dd7",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nix-community",
|
"owner": "pyproject-nix",
|
||||||
"repo": "poetry2nix",
|
"repo": "build-system-pkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pyproject-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"system_tools",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1746540146,
|
||||||
|
"narHash": "sha256-QxdHGNpbicIrw5t6U3x+ZxeY/7IEJ6lYbvsjXmcxFIM=",
|
||||||
|
"owner": "pyproject-nix",
|
||||||
|
"repo": "pyproject.nix",
|
||||||
|
"rev": "e09c10c24ebb955125fda449939bfba664c467fd",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "pyproject-nix",
|
||||||
|
"repo": "pyproject.nix",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -279,49 +160,50 @@
|
|||||||
"inputs": {
|
"inputs": {
|
||||||
"firefox-addons": "firefox-addons",
|
"firefox-addons": "firefox-addons",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"nixos-cosmic": "nixos-cosmic",
|
|
||||||
"nixos-hardware": "nixos-hardware",
|
"nixos-hardware": "nixos-hardware",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nixpkgs-stable": "nixpkgs-stable_2",
|
"nixpkgs-master": "nixpkgs-master",
|
||||||
|
"nixpkgs-stable": "nixpkgs-stable",
|
||||||
|
"sops-nix": "sops-nix",
|
||||||
"system_tools": "system_tools",
|
"system_tools": "system_tools",
|
||||||
"systems": "systems_3"
|
"systems": "systems"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-overlay": {
|
"sops-nix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixos-cosmic",
|
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725848835,
|
"lastModified": 1752544651,
|
||||||
"narHash": "sha256-u4lCr+tOEWhsFiww5G04U5jUNzaQJi0/ZMIDGiLeT14=",
|
"narHash": "sha256-GllP7cmQu7zLZTs9z0J2gIL42IZHa9CBEXwBY9szT0U=",
|
||||||
"owner": "oxalica",
|
"owner": "Mic92",
|
||||||
"repo": "rust-overlay",
|
"repo": "sops-nix",
|
||||||
"rev": "2ef910a6276a2f34513d18f2f826a8dea72c3b3f",
|
"rev": "2c8def626f54708a9c38a5861866660395bb3461",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "oxalica",
|
"owner": "Mic92",
|
||||||
"repo": "rust-overlay",
|
"repo": "sops-nix",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"system_tools": {
|
"system_tools": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils_2",
|
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
"poetry2nix": "poetry2nix"
|
"pyproject-build-systems": "pyproject-build-systems",
|
||||||
|
"pyproject-nix": "pyproject-nix",
|
||||||
|
"uv2nix": "uv2nix"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725312414,
|
"lastModified": 1747501237,
|
||||||
"narHash": "sha256-IWztoUBuZjqw5Mti/CJvvPvAHNpCfnZVS/gGNMdQUhQ=",
|
"narHash": "sha256-woyaUwmZurfNTXBEFM6M7ueSd/Udixs+4DUInhL835c=",
|
||||||
"owner": "RichieCahill",
|
"owner": "RichieCahill",
|
||||||
"repo": "system_tools",
|
"repo": "system_tools",
|
||||||
"rev": "632a465087f5b9ab7d6efc125bebfe6af57c1d58",
|
"rev": "68ab5d1c17ac3fe2487f73dbbb4848bd2291139e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -331,35 +213,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"id": "systems",
|
|
||||||
"type": "indirect"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems_3": {
|
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1689347949,
|
"lastModified": 1689347949,
|
||||||
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
|
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
|
||||||
@@ -374,47 +227,28 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"treefmt-nix": {
|
"uv2nix": {
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixos-cosmic",
|
|
||||||
"nix-update",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1719887753,
|
|
||||||
"narHash": "sha256-p0B2r98UtZzRDM5miGRafL4h7TwGRC4DII+XXHDHqek=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "treefmt-nix",
|
|
||||||
"rev": "bdb6355009562d8f9313d9460c0d3860f525bc6c",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "treefmt-nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"treefmt-nix_2": {
|
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"system_tools",
|
"system_tools",
|
||||||
"poetry2nix",
|
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"pyproject-nix": [
|
||||||
|
"system_tools",
|
||||||
|
"pyproject-nix"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1719749022,
|
"lastModified": 1747441483,
|
||||||
"narHash": "sha256-ddPKHcqaKCIFSFc/cvxS14goUhCOAwsM1PbMr0ZtHMg=",
|
"narHash": "sha256-W8BFXk5R0TuJcjIhcGoMpSOaIufGXpizK0pm+uTqynA=",
|
||||||
"owner": "numtide",
|
"owner": "pyproject-nix",
|
||||||
"repo": "treefmt-nix",
|
"repo": "uv2nix",
|
||||||
"rev": "8df5ff62195d4e67e2264df0b7f5e8c9995fd0bd",
|
"rev": "582024dc64663e9f88d467c2f7f7b20d278349de",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "numtide",
|
"owner": "pyproject-nix",
|
||||||
"repo": "treefmt-nix",
|
"repo": "uv2nix",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
82
flake.nix
82
flake.nix
@@ -3,19 +3,20 @@
|
|||||||
|
|
||||||
nixConfig = {
|
nixConfig = {
|
||||||
extra-substituters = [
|
extra-substituters = [
|
||||||
"https://cache.nixos.org/?priority=1&want-mass-query=true"
|
"https://cache.nixos.org/?priority=2&want-mass-query=true"
|
||||||
"https://nix-community.cachix.org/?priority=10&want-mass-query=true"
|
"https://nix-community.cachix.org/?priority=10&want-mass-query=true"
|
||||||
];
|
];
|
||||||
extra-trusted-public-keys = [
|
extra-trusted-public-keys = [
|
||||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" # cspell:disable-line
|
||||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" # cspell:disable-line
|
||||||
"cache-nix-dot:Od9KN34LXc6Lu7y1ozzV1kIXZa8coClozgth/SYE7dU="
|
"cache-nix-dot:Od9KN34LXc6Lu7y1ozzV1kIXZa8coClozgth/SYE7dU=" # cspell:disable-line
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
|
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
|
||||||
|
nixpkgs-master.url = "github:nixos/nixpkgs/master";
|
||||||
systems.url = "github:nix-systems/default-linux";
|
systems.url = "github:nix-systems/default-linux";
|
||||||
|
|
||||||
nixos-hardware.url = "github:nixos/nixos-hardware/master";
|
nixos-hardware.url = "github:nixos/nixos-hardware/master";
|
||||||
@@ -35,46 +36,59 @@
|
|||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
nixos-cosmic = {
|
sops-nix = {
|
||||||
url = "github:lilyinstarlight/nixos-cosmic";
|
url = "github:Mic92/sops-nix";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs =
|
||||||
self,
|
{
|
||||||
nixpkgs,
|
self,
|
||||||
home-manager,
|
nixpkgs,
|
||||||
systems,
|
home-manager,
|
||||||
nixos-cosmic,
|
systems,
|
||||||
...
|
sops-nix,
|
||||||
} @ inputs: let
|
...
|
||||||
inherit (self) outputs;
|
}@inputs:
|
||||||
lib = nixpkgs.lib // home-manager.lib;
|
let
|
||||||
forEachSystem = f: lib.genAttrs (import systems) (system: f pkgsFor.${system});
|
inherit (self) outputs;
|
||||||
pkgsFor = lib.genAttrs (import systems) (
|
lib = nixpkgs.lib // home-manager.lib;
|
||||||
system:
|
forEachSystem = f: lib.genAttrs (import systems) (system: f pkgsFor.${system});
|
||||||
|
pkgsFor = lib.genAttrs (import systems) (
|
||||||
|
system:
|
||||||
import nixpkgs {
|
import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
config.allowUnfree = true;
|
config.allowUnfree = true;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in {
|
in
|
||||||
inherit lib;
|
{
|
||||||
overlays = import ./overlays {inherit inputs outputs;};
|
inherit lib;
|
||||||
|
overlays = import ./overlays { inherit inputs outputs; };
|
||||||
|
|
||||||
devShells = forEachSystem (pkgs: import ./shell.nix {inherit pkgs;});
|
devShells = forEachSystem (pkgs: import ./shell.nix { inherit pkgs; });
|
||||||
formatter = forEachSystem (pkgs: pkgs.alejandra);
|
formatter = forEachSystem (pkgs: pkgs.treefmt);
|
||||||
|
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
bob = lib.nixosSystem {
|
bob = lib.nixosSystem {
|
||||||
modules = [./systems/bob];
|
modules = [
|
||||||
specialArgs = {inherit inputs outputs;};
|
./systems/bob
|
||||||
};
|
];
|
||||||
jeeves = lib.nixosSystem {
|
specialArgs = { inherit inputs outputs; };
|
||||||
modules = [./systems/jeeves];
|
};
|
||||||
specialArgs = {inherit inputs outputs;};
|
jeeves = lib.nixosSystem {
|
||||||
|
modules = [
|
||||||
|
./systems/jeeves
|
||||||
|
];
|
||||||
|
specialArgs = { inherit inputs outputs; };
|
||||||
|
};
|
||||||
|
rhapsody-in-green = lib.nixosSystem {
|
||||||
|
modules = [
|
||||||
|
./systems/rhapsody-in-green
|
||||||
|
];
|
||||||
|
specialArgs = { inherit inputs outputs; };
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{inputs, ...}: {
|
{ inputs, ... }:
|
||||||
|
{
|
||||||
# When applied, the stable nixpkgs set (declared in the flake inputs) will be accessible through 'pkgs.stable'
|
# When applied, the stable nixpkgs set (declared in the flake inputs) will be accessible through 'pkgs.stable'
|
||||||
stable = final: _prev: {
|
stable = final: _prev: {
|
||||||
stable = import inputs.nixpkgs-stable {
|
stable = import inputs.nixpkgs-stable {
|
||||||
@@ -6,4 +7,11 @@
|
|||||||
config.allowUnfree = true;
|
config.allowUnfree = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
# When applied, the master nixpkgs set (declared in the flake inputs) will be accessible through 'pkgs.master'
|
||||||
|
master = final: _prev: {
|
||||||
|
master = import inputs.nixpkgs-master {
|
||||||
|
system = final.system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
{pkgs ? import <nixpkgs> {}, ...}: {
|
{
|
||||||
|
pkgs ? import <nixpkgs> { },
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
NIX_CONFIG = "extra-experimental-features = nix-command flakes ca-derivations";
|
NIX_CONFIG = "extra-experimental-features = nix-command flakes ca-derivations";
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
|
|||||||
@@ -1,103 +1,44 @@
|
|||||||
{
|
|
||||||
inputs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
inputs.nixos-hardware.nixosModules.framework-13-7040-amd
|
|
||||||
../../users/richie
|
../../users/richie
|
||||||
../common/global
|
../../users/gaming
|
||||||
../common/optional/desktop.nix
|
../../common/global
|
||||||
../common/optional/steam.nix
|
../../common/optional/desktop.nix
|
||||||
../common/optional/syncthing_base.nix
|
../../common/optional/docker.nix
|
||||||
../common/optional/systemd-boot.nix
|
../../common/optional/scanner.nix
|
||||||
../common/optional/zerotier.nix
|
../../common/optional/steam.nix
|
||||||
|
../../common/optional/syncthing_base.nix
|
||||||
|
../../common/optional/systemd-boot.nix
|
||||||
|
../../common/optional/update.nix
|
||||||
|
../../common/optional/yubikey.nix
|
||||||
|
../../common/optional/zerotier.nix
|
||||||
|
../../common/optional/nvidia.nix
|
||||||
./hardware.nix
|
./hardware.nix
|
||||||
./nvidia.nix
|
./syncthing.nix
|
||||||
|
./games.nix
|
||||||
|
./llms.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "bob";
|
hostName = "bob";
|
||||||
networkmanager.enable = true;
|
|
||||||
hostId = "7c678a41";
|
hostId = "7c678a41";
|
||||||
|
firewall.enable = true;
|
||||||
|
networkmanager.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
hardware = {
|
|
||||||
pulseaudio.enable = false;
|
|
||||||
bluetooth = {
|
|
||||||
enable = true;
|
|
||||||
powerOnBoot = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
security.rtkit.enable = true;
|
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
|
displayManager = {
|
||||||
displayManager.sddm.enable = true;
|
enable = true;
|
||||||
|
autoLogin = {
|
||||||
|
user = "gaming";
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
defaultSession = "plasma";
|
||||||
|
};
|
||||||
|
|
||||||
openssh.ports = [ 262 ];
|
openssh.ports = [ 262 ];
|
||||||
|
|
||||||
printing.enable = true;
|
snapshot_manager.path = ./snapshot_config.toml;
|
||||||
|
|
||||||
pipewire = {
|
|
||||||
enable = true;
|
|
||||||
alsa.enable = true;
|
|
||||||
alsa.support32Bit = true;
|
|
||||||
pulse.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
syncthing.settings.folders = {
|
|
||||||
"notes" = {
|
|
||||||
id = "l62ul-lpweo"; # cspell:disable-line
|
|
||||||
path = "/home/richie/notes";
|
|
||||||
devices = [
|
|
||||||
"jeeves"
|
|
||||||
];
|
|
||||||
fsWatcherEnabled = true;
|
|
||||||
};
|
|
||||||
"books" = {
|
|
||||||
id = "6uppx-vadmy"; # cspell:disable-line
|
|
||||||
path = "/home/richie/books";
|
|
||||||
devices = [
|
|
||||||
"phone"
|
|
||||||
"jeeves"
|
|
||||||
];
|
|
||||||
fsWatcherEnabled = true;
|
|
||||||
};
|
|
||||||
"important" = {
|
|
||||||
id = "4ckma-gtshs"; # cspell:disable-line
|
|
||||||
path = "/home/richie/important";
|
|
||||||
devices = [
|
|
||||||
"phone"
|
|
||||||
"jeeves"
|
|
||||||
];
|
|
||||||
fsWatcherEnabled = true;
|
|
||||||
};
|
|
||||||
"music" = {
|
|
||||||
id = "vprc5-3azqc"; # cspell:disable-line
|
|
||||||
path = "/home/richie/music";
|
|
||||||
devices = [
|
|
||||||
"ipad"
|
|
||||||
"phone"
|
|
||||||
"jeeves"
|
|
||||||
];
|
|
||||||
fsWatcherEnabled = true;
|
|
||||||
};
|
|
||||||
"projects" = {
|
|
||||||
id = "vyma6-lqqrz"; # cspell:disable-line
|
|
||||||
path = "/home/richie/projects";
|
|
||||||
devices = [
|
|
||||||
"jeeves"
|
|
||||||
];
|
|
||||||
fsWatcherEnabled = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
zfs = {
|
|
||||||
trim.enable = true;
|
|
||||||
autoScrub.enable = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
system.stateVersion = "24.05";
|
system.stateVersion = "24.05";
|
||||||
|
|||||||
7
systems/bob/games.nix
Normal file
7
systems/bob/games.nix
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
osu-lazer-bin
|
||||||
|
jellyfin-media-player
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -22,8 +22,13 @@
|
|||||||
"sd_mod"
|
"sd_mod"
|
||||||
];
|
];
|
||||||
kernelModules = [ ];
|
kernelModules = [ ];
|
||||||
luks.devices = {
|
luks.devices."luks-root-pool-nvme-Samsung_SSD_990_PRO_with_Heatsink_1TB_S73JNJ0X114418B-part2" = {
|
||||||
"luks-root-pool-nvme-Samsung_SSD_990_PRO_with_Heatsink_1TB_S73JNJ0X114418B-part2".device = "/dev/disk/by-id/nvme-Samsung_SSD_990_PRO_with_Heatsink_1TB_S73JNJ0X114418B-part2";
|
device = "/dev/disk/by-id/nvme-Samsung_SSD_990_PRO_with_Heatsink_1TB_S73JNJ0X114418B-part2";
|
||||||
|
bypassWorkqueues = true;
|
||||||
|
allowDiscards = true;
|
||||||
|
keyFileSize = 4096;
|
||||||
|
keyFile = "/dev/disk/by-id/usb-Samsung_Flash_Drive_FIT_0374620080067131-0:0";
|
||||||
|
fallbackToPassword = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
kernelModules = [ "kvm-amd" ];
|
kernelModules = [ "kvm-amd" ];
|
||||||
@@ -46,6 +51,11 @@
|
|||||||
fsType = "zfs";
|
fsType = "zfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
"/zfs/models" = {
|
||||||
|
device = "root_pool/models";
|
||||||
|
fsType = "zfs";
|
||||||
|
};
|
||||||
|
|
||||||
"/boot" = {
|
"/boot" = {
|
||||||
device = "/dev/disk/by-uuid/609D-FF29";
|
device = "/dev/disk/by-uuid/609D-FF29";
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
|
|||||||
28
systems/bob/llms.nix
Normal file
28
systems/bob/llms.nix
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
services = {
|
||||||
|
ollama = {
|
||||||
|
user = "ollama";
|
||||||
|
enable = true;
|
||||||
|
loadModels = [
|
||||||
|
"codellama:7b"
|
||||||
|
"deepseek-r1:8b"
|
||||||
|
"deepseek-r1:14b"
|
||||||
|
"deepseek-r1:32b"
|
||||||
|
"llama3.2:3b"
|
||||||
|
"llama2-uncensored:7b"
|
||||||
|
"mistral-nemo:12b"
|
||||||
|
"dolphin-mixtral:8x7b"
|
||||||
|
"qwq:32b"
|
||||||
|
"Qihoo360-Light-R1-32B"
|
||||||
|
];
|
||||||
|
models = "/zfs/models";
|
||||||
|
acceleration = "cuda";
|
||||||
|
openFirewall = true;
|
||||||
|
};
|
||||||
|
# open-webui = {
|
||||||
|
# enable = true;
|
||||||
|
# openFirewall = true;
|
||||||
|
# host = "0.0.0.0";
|
||||||
|
# };
|
||||||
|
};
|
||||||
|
}
|
||||||
29
systems/bob/snapshot_config.toml
Normal file
29
systems/bob/snapshot_config.toml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
["default"]
|
||||||
|
15_min = 8
|
||||||
|
hourly = 24
|
||||||
|
daily = 0
|
||||||
|
monthly = 0
|
||||||
|
|
||||||
|
["root_pool/home"]
|
||||||
|
15_min = 8
|
||||||
|
hourly = 12
|
||||||
|
daily = 1
|
||||||
|
monthly = 0
|
||||||
|
|
||||||
|
["root_pool/root"]
|
||||||
|
15_min = 8
|
||||||
|
hourly = 24
|
||||||
|
daily = 0
|
||||||
|
monthly = 0
|
||||||
|
|
||||||
|
["root_pool/nix"]
|
||||||
|
15_min = 4
|
||||||
|
hourly = 0
|
||||||
|
daily = 0
|
||||||
|
monthly = 0
|
||||||
|
|
||||||
|
["root_pool/models"]
|
||||||
|
15_min = 4
|
||||||
|
hourly = 24
|
||||||
|
daily = 0
|
||||||
|
monthly = 0
|
||||||
33
systems/bob/syncthing.nix
Normal file
33
systems/bob/syncthing.nix
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
services.syncthing.settings.folders = {
|
||||||
|
"dotfiles" = {
|
||||||
|
path = "/home/richie/dotfiles";
|
||||||
|
devices = [
|
||||||
|
"jeeves"
|
||||||
|
"rhapsody-in-green"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
};
|
||||||
|
"important" = {
|
||||||
|
id = "4ckma-gtshs"; # cspell:disable-line
|
||||||
|
path = "/home/richie/important";
|
||||||
|
devices = [
|
||||||
|
"phone"
|
||||||
|
"jeeves"
|
||||||
|
"rhapsody-in-green"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
};
|
||||||
|
"music" = {
|
||||||
|
id = "vprc5-3azqc"; # cspell:disable-line
|
||||||
|
path = "/home/richie/music";
|
||||||
|
devices = [
|
||||||
|
"ipad"
|
||||||
|
"phone"
|
||||||
|
"jeeves"
|
||||||
|
"rhapsody-in-green"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
inputs,
|
|
||||||
outputs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
inputs.home-manager.nixosModules.home-manager
|
|
||||||
./docker.nix
|
|
||||||
./fail2ban.nix
|
|
||||||
./libs.nix
|
|
||||||
./locale.nix
|
|
||||||
./nh.nix
|
|
||||||
./nix.nix
|
|
||||||
./programs.nix
|
|
||||||
./ssh.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
|
|
||||||
|
|
||||||
security.auditd.enable = lib.mkDefault true;
|
|
||||||
|
|
||||||
programs = {
|
|
||||||
zsh.enable = true;
|
|
||||||
fish.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
users.mutableUsers = lib.mkDefault true;
|
|
||||||
|
|
||||||
home-manager = {
|
|
||||||
useGlobalPkgs = true;
|
|
||||||
useUserPackages = true;
|
|
||||||
extraSpecialArgs = {inherit inputs outputs;};
|
|
||||||
};
|
|
||||||
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
|
||||||
|
|
||||||
hardware.enableRedistributableFirmware = true;
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
{
|
|
||||||
inputs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
|
|
||||||
in {
|
|
||||||
nix = {
|
|
||||||
settings = {
|
|
||||||
trusted-users = [
|
|
||||||
"root"
|
|
||||||
"@wheel"
|
|
||||||
];
|
|
||||||
auto-optimise-store = lib.mkDefault true;
|
|
||||||
experimental-features = [
|
|
||||||
"nix-command"
|
|
||||||
"flakes"
|
|
||||||
"ca-derivations"
|
|
||||||
];
|
|
||||||
warn-dirty = false;
|
|
||||||
flake-registry = ""; # disable global flake registries
|
|
||||||
};
|
|
||||||
|
|
||||||
# Add each flake input as a registry and nix_path
|
|
||||||
registry = lib.mapAttrs (_: flake: {inherit flake;}) flakeInputs;
|
|
||||||
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
services = {
|
|
||||||
desktopManager.plasma6.enable = true;
|
|
||||||
xserver = {
|
|
||||||
enable = true;
|
|
||||||
xkb = {
|
|
||||||
layout = "us";
|
|
||||||
variant = "";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
services.syncthing = {
|
|
||||||
enable = true;
|
|
||||||
user = "richie";
|
|
||||||
overrideDevices = true;
|
|
||||||
overrideFolders = true;
|
|
||||||
dataDir = "/home/richie/Syncthing";
|
|
||||||
configDir = "/home/richie/.config/syncthing";
|
|
||||||
settings = {
|
|
||||||
devices = {
|
|
||||||
phone.id = "LTGPLAE-M4ZDJTM-TZ3DJGY-SLLAVWF-CQDVEVS-RGCS75T-GAPZYK3-KUM6LA5"; # cspell:disable-line
|
|
||||||
jeeves.id = "RCDU465-AIQRBEJ-VWC4EZF-2AMXABC-F3S4NFW-QA4ZUAQ-OVNUBLI-BUJJTA2"; # cspell:disable-line
|
|
||||||
ipad.id = "KI76T3X-SFUGV2L-VSNYTKR-TSIUV5L-SHWD3HE-GQRGRCN-GY4UFMD-CW6Z6AX"; # cspell:disable-line
|
|
||||||
bob.id = "CJIAPEJ-VO74RR4-F75VU6M-QNZAMYG-FYUJG7Y-6AT62HJ-355PRPL-PJFETAZ"; # cspell:disable-line
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{ lib, ... }:
|
|
||||||
{
|
|
||||||
services.autopull = {
|
|
||||||
enable = lib.mkDefault true;
|
|
||||||
repo.dotfiles = {
|
|
||||||
enable = lib.mkDefault true;
|
|
||||||
ssh-key = lib.mkDefault "/root/.ssh/id_ed25519_ghdeploy";
|
|
||||||
path = lib.mkDefault /root/dotfiles;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
system.autoUpgrade = {
|
|
||||||
enable = lib.mkDefault true;
|
|
||||||
flags = [ "--accept-flake-config" ];
|
|
||||||
randomizedDelaySec = "1h";
|
|
||||||
persistent = true;
|
|
||||||
flake = "github:RAD-Development/nix-dotfiles";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
services.zerotierone = {
|
|
||||||
enable = true;
|
|
||||||
joinNetworks = [ "e4da7455b2ae64ca" ];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
{ inputs, pkgs, ... }:
|
|
||||||
let
|
|
||||||
vars = import ./vars.nix;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
virtualisation.oci-containers.containers.arch_mirror = {
|
|
||||||
image = "ubuntu/apache2:latest";
|
|
||||||
volumes = [
|
|
||||||
"${../common/docker_templates}/file_server/sites/:/etc/apache2/sites-enabled/"
|
|
||||||
"${vars.media_mirror}:/data"
|
|
||||||
];
|
|
||||||
ports = [ "800:80" ];
|
|
||||||
extraOptions = [ "--network=web" ];
|
|
||||||
autoStart = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services.sync_mirror = {
|
|
||||||
requires = [ "network-online.target" ];
|
|
||||||
after = [ "network-online.target" ];
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
description = "validates startup";
|
|
||||||
path = [ pkgs.rsync ];
|
|
||||||
serviceConfig = {
|
|
||||||
Environment = "MIRROR_DIR=${vars.media_mirror}/archlinux/";
|
|
||||||
Type = "simple";
|
|
||||||
ExecStart = "${inputs.system_tools.packages.x86_64-linux.default}/bin/sync_mirror";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,115 +1,29 @@
|
|||||||
{ config, pkgs, ... }:
|
|
||||||
let
|
|
||||||
vars = import ./vars.nix;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../users/richie
|
../../users/richie
|
||||||
../common/global
|
../../common/global
|
||||||
../common/optional/ssh_decrypt.nix
|
../../common/optional/docker.nix
|
||||||
../common/optional/syncthing_base.nix
|
../../common/optional/ssh_decrypt.nix
|
||||||
../common/optional/systemd-boot.nix
|
../../common/optional/syncthing_base.nix
|
||||||
../common/optional/zerotier.nix
|
../../common/optional/update.nix
|
||||||
./arch_mirror.nix
|
../../common/optional/zerotier.nix
|
||||||
./docker
|
./docker
|
||||||
|
./services
|
||||||
./hardware.nix
|
./hardware.nix
|
||||||
./networking.nix
|
./networking.nix
|
||||||
|
./nvidia.nix
|
||||||
./programs.nix
|
./programs.nix
|
||||||
./services.nix
|
./runners
|
||||||
];
|
./syncthing.nix
|
||||||
|
|
||||||
boot.zfs.extraPools = [
|
|
||||||
"media"
|
|
||||||
"storage"
|
|
||||||
"torrenting"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
openssh.ports = [ 629 ];
|
openssh.ports = [ 629 ];
|
||||||
|
|
||||||
plex = {
|
|
||||||
enable = true;
|
|
||||||
dataDir = vars.media_plex;
|
|
||||||
};
|
|
||||||
|
|
||||||
smartd.enable = true;
|
smartd.enable = true;
|
||||||
|
|
||||||
sysstat.enable = true;
|
snapshot_manager.path = ./snapshot_config.toml;
|
||||||
|
|
||||||
syncthing.guiAddress = "192.168.90.40:8384";
|
|
||||||
syncthing.settings.folders = {
|
|
||||||
"notes" = {
|
|
||||||
id = "l62ul-lpweo"; # cspell:disable-line
|
|
||||||
path = vars.media_notes;
|
|
||||||
devices = [
|
|
||||||
"bob"
|
|
||||||
];
|
|
||||||
fsWatcherEnabled = true;
|
|
||||||
};
|
|
||||||
"books" = {
|
|
||||||
id = "6uppx-vadmy"; # cspell:disable-line
|
|
||||||
path = "${vars.storage_syncthing}/books";
|
|
||||||
devices = [
|
|
||||||
"bob"
|
|
||||||
"phone"
|
|
||||||
];
|
|
||||||
fsWatcherEnabled = true;
|
|
||||||
};
|
|
||||||
"important" = {
|
|
||||||
id = "4ckma-gtshs"; # cspell:disable-line
|
|
||||||
path = "${vars.storage_syncthing}/important";
|
|
||||||
devices = [
|
|
||||||
"bob"
|
|
||||||
"phone"
|
|
||||||
];
|
|
||||||
fsWatcherEnabled = true;
|
|
||||||
};
|
|
||||||
"music" = {
|
|
||||||
id = "vprc5-3azqc"; # cspell:disable-line
|
|
||||||
path = "${vars.storage_syncthing}/music";
|
|
||||||
devices = [
|
|
||||||
"bob"
|
|
||||||
"ipad"
|
|
||||||
"phone"
|
|
||||||
];
|
|
||||||
fsWatcherEnabled = true;
|
|
||||||
};
|
|
||||||
"projects" = {
|
|
||||||
id = "vyma6-lqqrz"; # cspell:disable-line
|
|
||||||
path = "${vars.storage_syncthing}/projects";
|
|
||||||
devices = [
|
|
||||||
"bob"
|
|
||||||
];
|
|
||||||
fsWatcherEnabled = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
zfs = {
|
|
||||||
trim.enable = true;
|
|
||||||
autoScrub.enable = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
systemd = {
|
|
||||||
services."snapshot_manager" = {
|
|
||||||
description = "ZFS Snapshot Manager";
|
|
||||||
requires = [ "zfs-import.target" ];
|
|
||||||
after = [ "zfs-import.target" ];
|
|
||||||
serviceConfig = {
|
|
||||||
Environment = "ZFS_BIN=${pkgs.zfs}/bin/zfs";
|
|
||||||
Type = "oneshot";
|
|
||||||
ExecStart = "${pkgs.python3}/bin/python3 ${vars.media_scripts}/ZFS/snapshot_manager.py --config-file='${./snapshot_config.toml}'";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
timers."snapshot_manager" = {
|
|
||||||
wantedBy = [ "timers.target" ];
|
|
||||||
timerConfig = {
|
|
||||||
OnBootSec = "15m";
|
|
||||||
OnUnitActiveSec = "15m";
|
|
||||||
Unit = "snapshot_manager.service";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
system.stateVersion = "24.05";
|
system.stateVersion = "24.05";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
let
|
|
||||||
vars = import ../vars.nix;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
virtualisation.oci-containers.containers.filebrowser = {
|
|
||||||
image = "hurlenko/filebrowser:latest";
|
|
||||||
extraOptions = [ "--network=web" ];
|
|
||||||
volumes = [
|
|
||||||
"/zfs:/data"
|
|
||||||
"${vars.media_docker_configs}/filebrowser:/config"
|
|
||||||
];
|
|
||||||
autoStart = true;
|
|
||||||
user = "1000:users";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
61
systems/jeeves/docker/great_cloud_of_witnesses.nix
Normal file
61
systems/jeeves/docker/great_cloud_of_witnesses.nix
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
vars = import ../vars.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
|
||||||
|
# environment.systemPackages = with pkgs; [ php.withExtensions ({ all, ... }: [ all.pdo_pgsql ]) ];
|
||||||
|
|
||||||
|
services.httpd = {
|
||||||
|
enable = true;
|
||||||
|
adminAddr = "webmaster@localhost";
|
||||||
|
|
||||||
|
enablePHP = true;
|
||||||
|
phpPackage = pkgs.php.withExtensions (
|
||||||
|
{ enabled, all }:
|
||||||
|
enabled
|
||||||
|
++ [
|
||||||
|
all.pdo
|
||||||
|
all.pdo_pgsql
|
||||||
|
]
|
||||||
|
);
|
||||||
|
extraModules = [ "rewrite" ];
|
||||||
|
virtualHosts.great_cloud_of_witnesses = {
|
||||||
|
hostName = "localhost";
|
||||||
|
listen = [
|
||||||
|
{
|
||||||
|
ip = "*";
|
||||||
|
port = 8092;
|
||||||
|
}
|
||||||
|
|
||||||
|
];
|
||||||
|
documentRoot = "${vars.services}/great_cloud_of_witnesses";
|
||||||
|
extraConfig = ''
|
||||||
|
<Directory "${vars.services}/great_cloud_of_witnesses">
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
sops.secrets.gcw_password = {
|
||||||
|
sopsFile = ../../../users/secrets.yaml;
|
||||||
|
neededForUsers = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
users = {
|
||||||
|
users.gcw = {
|
||||||
|
isSystemUser = true;
|
||||||
|
hashedPasswordFile = config.sops.secrets.gcw_password.path;
|
||||||
|
group = "gcw";
|
||||||
|
};
|
||||||
|
groups.gcw = { };
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
global
|
|
||||||
log stdout format raw local0
|
|
||||||
# stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
|
|
||||||
stats timeout 30s
|
|
||||||
|
|
||||||
defaults
|
|
||||||
log global
|
|
||||||
mode http
|
|
||||||
retries 3
|
|
||||||
maxconn 2000
|
|
||||||
timeout connect 5s
|
|
||||||
timeout client 50s
|
|
||||||
timeout server 50s
|
|
||||||
timeout http-request 10s
|
|
||||||
timeout http-keep-alive 2s
|
|
||||||
timeout queue 5s
|
|
||||||
timeout tunnel 2m
|
|
||||||
timeout client-fin 1s
|
|
||||||
timeout server-fin 1s
|
|
||||||
|
|
||||||
|
|
||||||
#Application Setup
|
|
||||||
frontend ContentSwitching
|
|
||||||
bind *:80
|
|
||||||
bind *:443 ssl crt /etc/ssl/certs/cloudflare.pem
|
|
||||||
mode http
|
|
||||||
# tmmworkshop.com
|
|
||||||
acl host_mirror hdr(host) -i mirror.tmmworkshop.com
|
|
||||||
acl host_dndrules hdr(host) -i dndrules.tmmworkshop.com
|
|
||||||
acl host_grafana hdr(host) -i grafana.tmmworkshop.com
|
|
||||||
acl host_filebrowser hdr(host) -i filebrowser.tmmworkshop.com
|
|
||||||
acl host_uptime_kuma hdr(host) -i uptimekuma-jeeves.tmmworkshop.com
|
|
||||||
acl host_overseerr hdr(host) -i overseerr.tmmworkshop.com
|
|
||||||
|
|
||||||
use_backend mirror_nodes if host_mirror
|
|
||||||
use_backend dndrules_nodes if host_dndrules
|
|
||||||
use_backend grafana_nodes if host_grafana
|
|
||||||
use_backend filebrowser_nodes if host_filebrowser
|
|
||||||
use_backend uptime_kuma_nodes if host_uptime_kuma
|
|
||||||
use_backend overseerr_nodes if host_overseerr
|
|
||||||
|
|
||||||
backend mirror_nodes
|
|
||||||
mode http
|
|
||||||
server server arch_mirror:80
|
|
||||||
|
|
||||||
backend mirror_rsync
|
|
||||||
mode http
|
|
||||||
server server arch_mirror:873
|
|
||||||
|
|
||||||
backend grafana_nodes
|
|
||||||
mode http
|
|
||||||
server server grafana:3000
|
|
||||||
|
|
||||||
backend dndrules_nodes
|
|
||||||
mode http
|
|
||||||
server server dnd_file_server:80
|
|
||||||
|
|
||||||
backend filebrowser_nodes
|
|
||||||
mode http
|
|
||||||
server server filebrowser:8080
|
|
||||||
|
|
||||||
backend uptime_kuma_nodes
|
|
||||||
mode http
|
|
||||||
server server uptime_kuma:3001
|
|
||||||
|
|
||||||
backend overseerr_nodes
|
|
||||||
mode http
|
|
||||||
server server overseerr:5055
|
|
||||||
@@ -1,144 +0,0 @@
|
|||||||
let
|
|
||||||
vars = import ../vars.nix;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
virtualisation.oci-containers.containers = {
|
|
||||||
qbit = {
|
|
||||||
image = "ghcr.io/linuxserver/qbittorrent:latest";
|
|
||||||
ports = [
|
|
||||||
"6881:6881"
|
|
||||||
"6881:6881/udp"
|
|
||||||
"8082:8082"
|
|
||||||
"29432:29432"
|
|
||||||
];
|
|
||||||
volumes = [
|
|
||||||
"${vars.media_docker_configs}/qbit:/config"
|
|
||||||
"${vars.torrenting_qbit}:/data"
|
|
||||||
];
|
|
||||||
environment = {
|
|
||||||
PUID = "600";
|
|
||||||
PGID = "100";
|
|
||||||
TZ = "America/New_York";
|
|
||||||
WEBUI_PORT = "8082";
|
|
||||||
};
|
|
||||||
autoStart = true;
|
|
||||||
};
|
|
||||||
qbitvpn = {
|
|
||||||
image = "binhex/arch-qbittorrentvpn:latest";
|
|
||||||
extraOptions = [ "--cap-add=NET_ADMIN" ];
|
|
||||||
ports = [
|
|
||||||
"6882:6881"
|
|
||||||
"6882:6881/udp"
|
|
||||||
"8081:8081"
|
|
||||||
"8118:8118"
|
|
||||||
];
|
|
||||||
volumes = [
|
|
||||||
"${vars.media_docker_configs}/qbitvpn:/config"
|
|
||||||
"${vars.torrenting_qbitvpn}:/data"
|
|
||||||
"/etc/localtime:/etc/localtime:ro"
|
|
||||||
];
|
|
||||||
environment = {
|
|
||||||
WEBUI_PORT = "8081";
|
|
||||||
PUID = "600";
|
|
||||||
PGID = "100";
|
|
||||||
VPN_ENABLED = "yes";
|
|
||||||
VPN_CLIENT = "openvpn";
|
|
||||||
STRICT_PORT_FORWARD = "yes";
|
|
||||||
ENABLE_PRIVOXY = "yes";
|
|
||||||
LAN_NETWORK = "192.168.90.0/24";
|
|
||||||
NAME_SERVERS = "1.1.1.1,1.0.0.1";
|
|
||||||
UMASK = "000";
|
|
||||||
DEBUG = "false";
|
|
||||||
DELUGE_DAEMON_LOG_LEVEL = "debug";
|
|
||||||
DELUGE_WEB_LOG_LEVEL = "debug";
|
|
||||||
};
|
|
||||||
environmentFiles = [/root/secrets/docker/qbitvpn];
|
|
||||||
autoStart = true;
|
|
||||||
};
|
|
||||||
bazarr = {
|
|
||||||
image = "ghcr.io/linuxserver/bazarr:latest";
|
|
||||||
ports = [ "6767:6767" ];
|
|
||||||
environment = {
|
|
||||||
PUID = "600";
|
|
||||||
PGID = "100";
|
|
||||||
TZ = "America/New_York";
|
|
||||||
};
|
|
||||||
volumes = [
|
|
||||||
"${vars.media_docker_configs}/bazarr:/config"
|
|
||||||
"${vars.storage_plex}/movies:/movies"
|
|
||||||
"${vars.storage_plex}/tv:/tv"
|
|
||||||
];
|
|
||||||
autoStart = true;
|
|
||||||
};
|
|
||||||
prowlarr = {
|
|
||||||
image = "ghcr.io/linuxserver/prowlarr:latest";
|
|
||||||
ports = [ "9696:9696" ];
|
|
||||||
environment = {
|
|
||||||
PUID = "600";
|
|
||||||
PGID = "100";
|
|
||||||
TZ = "America/New_York";
|
|
||||||
};
|
|
||||||
volumes = [ "${vars.media_docker_configs}/prowlarr:/config" ];
|
|
||||||
autoStart = true;
|
|
||||||
};
|
|
||||||
radarr = {
|
|
||||||
image = "ghcr.io/linuxserver/radarr:latest";
|
|
||||||
ports = [ "7878:7878" ];
|
|
||||||
environment = {
|
|
||||||
PUID = "600";
|
|
||||||
PGID = "100";
|
|
||||||
TZ = "America/New_York";
|
|
||||||
};
|
|
||||||
volumes = [
|
|
||||||
"${vars.media_docker_configs}/radarr:/config"
|
|
||||||
"${vars.storage_plex}/movies:/movies"
|
|
||||||
"${vars.torrenting_qbitvpn}:/data"
|
|
||||||
];
|
|
||||||
autoStart = true;
|
|
||||||
};
|
|
||||||
sonarr = {
|
|
||||||
image = "ghcr.io/linuxserver/sonarr:latest";
|
|
||||||
ports = [ "8989:8989" ];
|
|
||||||
environment = {
|
|
||||||
PUID = "600";
|
|
||||||
PGID = "100";
|
|
||||||
TZ = "America/New_York";
|
|
||||||
};
|
|
||||||
volumes = [
|
|
||||||
"${vars.media_docker_configs}/sonarr:/config"
|
|
||||||
"${vars.storage_plex}/tv:/tv"
|
|
||||||
"${vars.torrenting_qbitvpn}:/data"
|
|
||||||
];
|
|
||||||
autoStart = true;
|
|
||||||
};
|
|
||||||
overseerr = {
|
|
||||||
image = "ghcr.io/linuxserver/overseerr";
|
|
||||||
environment = {
|
|
||||||
PUID = "600";
|
|
||||||
PGID = "100";
|
|
||||||
TZ = "America/New_York";
|
|
||||||
};
|
|
||||||
volumes = [ "${vars.media_docker_configs}/overseerr:/config" ];
|
|
||||||
dependsOn = [
|
|
||||||
"radarr"
|
|
||||||
"sonarr"
|
|
||||||
];
|
|
||||||
extraOptions = [ "--network=web" ];
|
|
||||||
autoStart = true;
|
|
||||||
};
|
|
||||||
whisper = {
|
|
||||||
image = "ghcr.io/linuxserver/faster-whisper:latest";
|
|
||||||
ports = [ "10300:10300" ];
|
|
||||||
environment = {
|
|
||||||
PUID = "600";
|
|
||||||
PGID = "100";
|
|
||||||
TZ = "America/New_York";
|
|
||||||
WHISPER_MODEL = "tiny-int8";
|
|
||||||
WHISPER_LANG = "en";
|
|
||||||
WHISPER_BEAM = "1";
|
|
||||||
};
|
|
||||||
volumes = [ "${vars.media_docker_configs}/whisper:/config" ];
|
|
||||||
autoStart = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
let
|
|
||||||
vars = import ../vars.nix;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
users = {
|
|
||||||
users.postgres = {
|
|
||||||
isSystemUser = true;
|
|
||||||
group = "postgres";
|
|
||||||
uid = 999;
|
|
||||||
};
|
|
||||||
groups.postgres = {
|
|
||||||
gid = 999;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
virtualisation.oci-containers.containers = {
|
|
||||||
postgres = {
|
|
||||||
image = "postgres:16";
|
|
||||||
ports = [ "5432:5432" ];
|
|
||||||
volumes = [ "${vars.media_database}/postgres:/var/lib/postgresql/data" ];
|
|
||||||
environment = {
|
|
||||||
POSTGRES_USER = "admin";
|
|
||||||
POSTGRES_DB = "archive";
|
|
||||||
POSTGRES_INITDB_ARGS = "--auth-host=scram-sha-256";
|
|
||||||
};
|
|
||||||
environmentFiles = [/root/secrets/docker/postgres];
|
|
||||||
autoStart = true;
|
|
||||||
user = "postgres:postgres";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
47
systems/jeeves/docker/qbitvpn.nix
Normal file
47
systems/jeeves/docker/qbitvpn.nix
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
let
|
||||||
|
vars = import ../vars.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
networking.firewall = {
|
||||||
|
allowedTCPPorts = [
|
||||||
|
6882
|
||||||
|
8081
|
||||||
|
8118
|
||||||
|
];
|
||||||
|
allowedUDPPorts = [ 6882 ];
|
||||||
|
};
|
||||||
|
virtualisation.oci-containers.containers.qbitvpn = {
|
||||||
|
image = "binhex/arch-qbittorrentvpn:5.0.3-1-01";
|
||||||
|
devices = [ "/dev/net/tun:/dev/net/tun" ];
|
||||||
|
extraOptions = [ "--cap-add=NET_ADMIN" ];
|
||||||
|
ports = [
|
||||||
|
"6882:6881"
|
||||||
|
"6882:6881/udp"
|
||||||
|
"8081:8081"
|
||||||
|
"8118:8118"
|
||||||
|
];
|
||||||
|
volumes = [
|
||||||
|
"${vars.docker_configs}/qbitvpn:/config"
|
||||||
|
"${vars.qbitvpn}:/data"
|
||||||
|
"${vars.qbitvpn_scratch}:/data/incomplete"
|
||||||
|
"/etc/localtime:/etc/localtime:ro"
|
||||||
|
];
|
||||||
|
environment = {
|
||||||
|
WEBUI_PORT = "8081";
|
||||||
|
PUID = "600";
|
||||||
|
PGID = "100";
|
||||||
|
VPN_ENABLED = "yes";
|
||||||
|
VPN_CLIENT = "openvpn";
|
||||||
|
STRICT_PORT_FORWARD = "yes";
|
||||||
|
ENABLE_PRIVOXY = "yes";
|
||||||
|
LAN_NETWORK = "192.168.90.0/24";
|
||||||
|
NAME_SERVERS = "1.1.1.1,1.0.0.1";
|
||||||
|
UMASK = "000";
|
||||||
|
DEBUG = "false";
|
||||||
|
DELUGE_DAEMON_LOG_LEVEL = "debug";
|
||||||
|
DELUGE_WEB_LOG_LEVEL = "debug";
|
||||||
|
};
|
||||||
|
environmentFiles = [ "${vars.secrets}/docker/qbitvpn" ];
|
||||||
|
autoStart = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
15
systems/jeeves/docker/share.nix
Normal file
15
systems/jeeves/docker/share.nix
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
let
|
||||||
|
vars = import ../vars.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
virtualisation.oci-containers.containers.share = {
|
||||||
|
image = "ubuntu/apache2:2.4-22.04_beta";
|
||||||
|
ports = [ "8091:80" ];
|
||||||
|
volumes = [
|
||||||
|
"${../../../common/docker_templates}/file_server/sites/:/etc/apache2/sites-enabled/"
|
||||||
|
"${vars.share}:/data"
|
||||||
|
];
|
||||||
|
extraOptions = [ "--network=web" ];
|
||||||
|
autoStart = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
let
|
|
||||||
vars = import ../vars.nix;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
virtualisation.oci-containers.containers = {
|
|
||||||
uptime_kuma = {
|
|
||||||
image = "louislam/uptime-kuma:latest";
|
|
||||||
volumes = [
|
|
||||||
"${vars.media_docker_configs}/uptime_kuma:/app/data"
|
|
||||||
"/var/run/docker.sock:/var/run/docker.sock"
|
|
||||||
];
|
|
||||||
extraOptions = [ "--network=web" ];
|
|
||||||
autoStart = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
let
|
|
||||||
vars = import ../vars.nix;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
virtualisation.oci-containers.containers = {
|
|
||||||
grafana = {
|
|
||||||
image = "grafana/grafana-enterprise:latest";
|
|
||||||
volumes = [ "${vars.media_docker_configs}/grafana:/var/lib/grafana" ];
|
|
||||||
user = "600:600";
|
|
||||||
extraOptions = [ "--network=web" ];
|
|
||||||
autoStart = true;
|
|
||||||
};
|
|
||||||
dnd_file_server = {
|
|
||||||
image = "ubuntu/apache2:latest";
|
|
||||||
volumes = [
|
|
||||||
"${../../common/docker_templates}/file_server/sites/:/etc/apache2/sites-enabled/"
|
|
||||||
"${vars.storage_main}/Table_Top/:/data"
|
|
||||||
];
|
|
||||||
extraOptions = [ "--network=web" ];
|
|
||||||
autoStart = true;
|
|
||||||
};
|
|
||||||
haproxy = {
|
|
||||||
image = "haproxy:latest";
|
|
||||||
user = "600:600";
|
|
||||||
environment = {
|
|
||||||
TZ = "Etc/EST";
|
|
||||||
};
|
|
||||||
volumes = [
|
|
||||||
"/root/secrets/docker/cloudflare.pem:/etc/ssl/certs/cloudflare.pem"
|
|
||||||
"${./haproxy.cfg}:/usr/local/etc/haproxy/haproxy.cfg"
|
|
||||||
];
|
|
||||||
dependsOn = [
|
|
||||||
"arch_mirror"
|
|
||||||
"dnd_file_server"
|
|
||||||
"filebrowser"
|
|
||||||
"grafana"
|
|
||||||
"overseerr"
|
|
||||||
"uptime_kuma"
|
|
||||||
];
|
|
||||||
extraOptions = [ "--network=web" ];
|
|
||||||
autoStart = true;
|
|
||||||
};
|
|
||||||
cloud_flare_tunnel = {
|
|
||||||
image = "cloudflare/cloudflared:latest";
|
|
||||||
user = "600:600";
|
|
||||||
cmd = [
|
|
||||||
"tunnel"
|
|
||||||
"run"
|
|
||||||
];
|
|
||||||
environmentFiles = [/root/secrets/docker/cloud_flare_tunnel];
|
|
||||||
dependsOn = [ "haproxy" ];
|
|
||||||
extraOptions = [ "--network=web" ];
|
|
||||||
autoStart = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,46 @@
|
|||||||
{ config, lib, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
imports =[ (modulesPath + "/installer/scan/not-detected.nix") ];
|
config,
|
||||||
|
lib,
|
||||||
|
modulesPath,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
makeLuksDevice = device: {
|
||||||
|
inherit device;
|
||||||
|
keyFileSize = 4096;
|
||||||
|
keyFile = "/dev/disk/by-id/usb-XIAO_USB_Drive_24587CE29074-0:0";
|
||||||
|
fallbackToPassword = true;
|
||||||
|
};
|
||||||
|
makeLuksSSD =
|
||||||
|
device:
|
||||||
|
(makeLuksDevice device)
|
||||||
|
// {
|
||||||
|
bypassWorkqueues = true;
|
||||||
|
allowDiscards = true;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
|
loader = {
|
||||||
|
grub = {
|
||||||
|
enable = true;
|
||||||
|
zfsSupport = true;
|
||||||
|
efiSupport = true;
|
||||||
|
mirroredBoots = [
|
||||||
|
{
|
||||||
|
devices = [ "nodev" ];
|
||||||
|
path = "/boot0";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
devices = [ "nodev" ];
|
||||||
|
path = "/boot1";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
efi.canTouchEfiVariables = true;
|
||||||
|
};
|
||||||
initrd = {
|
initrd = {
|
||||||
availableKernelModules = [
|
availableKernelModules = [
|
||||||
"ahci"
|
"ahci"
|
||||||
@@ -17,10 +54,53 @@
|
|||||||
];
|
];
|
||||||
kernelModules = [ ];
|
kernelModules = [ ];
|
||||||
luks.devices = {
|
luks.devices = {
|
||||||
"luks-root-pool-wwn-0x500a0751e6c3c01e-part2".device = "/dev/disk/by-id/wwn-0x500a0751e6c3c01e-part2";
|
# cspell:disable
|
||||||
"luks-root-pool-wwn-0x500a0751e6c3c01c-part2".device = "/dev/disk/by-id/wwn-0x500a0751e6c3c01c-part2";
|
# Root pool
|
||||||
|
"luks-root-pool-wwn-0x55cd2e4150f01519-part2" =
|
||||||
|
makeLuksSSD "/dev/disk/by-id/wwn-0x55cd2e4150f01519-part2";
|
||||||
|
"luks-root-pool-wwn-0x55cd2e4150f01556-part2" =
|
||||||
|
makeLuksSSD "/dev/disk/by-id/wwn-0x55cd2e4150f01556-part2";
|
||||||
|
|
||||||
|
# Media pool
|
||||||
|
"luks-media_pool-nvme-INTEL_SSDPEK1A118GA_BTOC14120V2J118B-part1" =
|
||||||
|
makeLuksSSD "/dev/disk/by-id/nvme-INTEL_SSDPEK1A118GA_BTOC14120V2J118B-part1";
|
||||||
|
"luks-media_pool-nvme-INTEL_SSDPEK1A118GA_BTOC14120WAG118B-part1" =
|
||||||
|
makeLuksSSD "/dev/disk/by-id/nvme-INTEL_SSDPEK1A118GA_BTOC14120WAG118B-part1";
|
||||||
|
"luks-media_pool-nvme-INTEL_SSDPE2ME012T4_CVMD5130000G1P2HGN-part1" =
|
||||||
|
makeLuksSSD "/dev/disk/by-id/nvme-INTEL_SSDPE2ME012T4_CVMD5130000G1P2HGN-part1";
|
||||||
|
"luks-media_pool-nvme-INTEL_SSDPE2ME012T4_CVMD5130000U1P2HGN-part1" =
|
||||||
|
makeLuksSSD "/dev/disk/by-id/nvme-INTEL_SSDPE2ME012T4_CVMD5130000U1P2HGN-part1";
|
||||||
|
|
||||||
|
# Scratch pool
|
||||||
|
"luks-scratch-pool-ata-CT480BX500SSD1_2314E6C3C01C-part1" =
|
||||||
|
makeLuksSSD "/dev/disk/by-id/ata-CT480BX500SSD1_2314E6C3C01C-part1";
|
||||||
|
"luks-scratch-pool-ata-CT480BX500SSD1_2314E6C3C01E-part1" =
|
||||||
|
makeLuksSSD "/dev/disk/by-id/ata-CT480BX500SSD1_2314E6C3C01E-part1";
|
||||||
|
|
||||||
|
# Storage pool
|
||||||
|
"luks-storage_pool-nvme-Samsung_SSD_970_EVO_Plus_2TB_S6S2NS0T834822N-part1" =
|
||||||
|
makeLuksSSD "/dev/disk/by-id/nvme-Samsung_SSD_970_EVO_Plus_2TB_S6S2NS0T834822N-part1";
|
||||||
|
"luks-storage_pool-nvme-Samsung_SSD_970_EVO_Plus_2TB_S6S2NS0T834817F-part1" =
|
||||||
|
makeLuksSSD "/dev/disk/by-id/nvme-Samsung_SSD_970_EVO_Plus_2TB_S6S2NS0T834817F-part1";
|
||||||
|
"luks-storage_pool-nvme-INTEL_MEMPEK1W016GA_PHBT828104DF016D-part1" =
|
||||||
|
makeLuksSSD "/dev/disk/by-id/nvme-INTEL_MEMPEK1W016GA_PHBT828104DF016D-part1";
|
||||||
|
"luks-storage_pool-nvme-INTEL_MEMPEK1W016GA_PHBT828105A8016D-part1" =
|
||||||
|
makeLuksSSD "/dev/disk/by-id/nvme-INTEL_MEMPEK1W016GA_PHBT828105A8016D-part1";
|
||||||
|
"luks-storage_pool-wwn-0x5000cca23bc438dd-part1" =
|
||||||
|
makeLuksDevice "/dev/disk/by-id/wwn-0x5000cca23bc438dd-part1";
|
||||||
|
"luks-storage_pool-wwn-0x5000cca23bd035f5-part1" =
|
||||||
|
makeLuksDevice "/dev/disk/by-id/wwn-0x5000cca23bd035f5-part1";
|
||||||
|
"luks-storage_pool-wwn-0x5000cca23bd00ad6-part1" =
|
||||||
|
makeLuksDevice "/dev/disk/by-id/wwn-0x5000cca23bd00ad6-part1";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
zfs.extraPools = [
|
||||||
|
"media"
|
||||||
|
"scratch"
|
||||||
|
"storage"
|
||||||
|
];
|
||||||
|
|
||||||
kernelModules = [ "kvm-amd" ];
|
kernelModules = [ "kvm-amd" ];
|
||||||
extraModulePackages = [ ];
|
extraModulePackages = [ ];
|
||||||
};
|
};
|
||||||
@@ -36,13 +116,26 @@
|
|||||||
fsType = "zfs";
|
fsType = "zfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
"/nix" = {
|
||||||
|
device = "root_pool/nix";
|
||||||
|
fsType = "zfs";
|
||||||
|
};
|
||||||
|
|
||||||
"/var" = {
|
"/var" = {
|
||||||
device = "root_pool/var";
|
device = "root_pool/var";
|
||||||
fsType = "zfs";
|
fsType = "zfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
"/boot" = {
|
"/boot0" = {
|
||||||
device = "/dev/disk/by-id/wwn-0x500a0751e6c3c01e-part1";
|
device = "/dev/disk/by-id/wwn-0x55cd2e4150f01556-part1";
|
||||||
|
fsType = "vfat";
|
||||||
|
options = [
|
||||||
|
"fmask=0077"
|
||||||
|
"dmask=0077"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
"/boot1" = {
|
||||||
|
device = "/dev/disk/by-id/wwn-0x55cd2e4150f01519-part1";
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
options = [
|
options = [
|
||||||
"fmask=0077"
|
"fmask=0077"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
networking = {
|
networking = {
|
||||||
hostName = "jeeves";
|
hostName = "jeeves";
|
||||||
hostId = "0e15ce35";
|
hostId = "0e15ce35";
|
||||||
firewall.enable = false;
|
firewall.enable = true;
|
||||||
useNetworkd = true;
|
useNetworkd = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -11,32 +11,23 @@
|
|||||||
networks = {
|
networks = {
|
||||||
"10-1GB_Primary" = {
|
"10-1GB_Primary" = {
|
||||||
matchConfig.Name = "enp98s0f0";
|
matchConfig.Name = "enp98s0f0";
|
||||||
DHCP = "yes";
|
address = [ "192.168.99.14/24" ];
|
||||||
|
routes = [ { Gateway = "192.168.99.1"; } ];
|
||||||
|
linkConfig.RequiredForOnline = "routable";
|
||||||
};
|
};
|
||||||
};
|
|
||||||
networks = {
|
|
||||||
"10-1GB_Secondary" = {
|
"10-1GB_Secondary" = {
|
||||||
matchConfig.Name = "enp98s0f1";
|
matchConfig.Name = "enp98s0f1";
|
||||||
DHCP = "yes";
|
DHCP = "yes";
|
||||||
};
|
};
|
||||||
};
|
|
||||||
networks = {
|
|
||||||
"10-10GB_Primary" = {
|
"10-10GB_Primary" = {
|
||||||
matchConfig.Name = "enp97s0f0np0";
|
matchConfig.Name = "enp97s0f0np0";
|
||||||
DHCP = "yes";
|
DHCP = "yes";
|
||||||
linkConfig.RequiredForOnline = "routable";
|
linkConfig.RequiredForOnline = "routable";
|
||||||
};
|
};
|
||||||
};
|
|
||||||
networks = {
|
|
||||||
"10-10GB_Secondary" = {
|
"10-10GB_Secondary" = {
|
||||||
matchConfig.Name = "enp97s0f1np1";
|
matchConfig.Name = "enp97s0f1np1";
|
||||||
DHCP = "yes";
|
DHCP = "yes";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.zerotierone = {
|
|
||||||
enable = true;
|
|
||||||
joinNetworks = [ "e4da7455b2ae64ca" ];
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
16
systems/jeeves/nvidia.nix
Normal file
16
systems/jeeves/nvidia.nix
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
nixpkgs.config.cudaSupport = true;
|
||||||
|
|
||||||
|
services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
|
hardware = {
|
||||||
|
nvidia = {
|
||||||
|
modesetting.enable = true;
|
||||||
|
powerManagement.enable = true;
|
||||||
|
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
||||||
|
nvidiaSettings = true;
|
||||||
|
open = false;
|
||||||
|
};
|
||||||
|
nvidia-container-toolkit.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
26
systems/jeeves/runners/default.nix
Normal file
26
systems/jeeves/runners/default.nix
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
imports = [ ./nix_builder.nix ];
|
||||||
|
|
||||||
|
users = {
|
||||||
|
users.github-runners = {
|
||||||
|
shell = pkgs.bash;
|
||||||
|
isSystemUser = true;
|
||||||
|
group = "github-runners";
|
||||||
|
uid = 601;
|
||||||
|
openssh.authorizedKeys.keys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA/S8i+BNX/12JNKg+5EKGX7Aqimt5KM+ve3wt/SyWuO github-runners" # cspell:disable-line
|
||||||
|
];
|
||||||
|
};
|
||||||
|
groups.github-runners.gid = 601;
|
||||||
|
};
|
||||||
|
|
||||||
|
services.nix_builder.containers = {
|
||||||
|
nix-builder-0.enable = true;
|
||||||
|
nix-builder-1.enable = true;
|
||||||
|
nix-builder-2.enable = true;
|
||||||
|
nix-builder-3.enable = true;
|
||||||
|
nix-builder-4.enable = true;
|
||||||
|
nix-builder-5.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
101
systems/jeeves/runners/nix_builder.nix
Normal file
101
systems/jeeves/runners/nix_builder.nix
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
vars = import ../vars.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.nix_builder.containers = mkOption {
|
||||||
|
type = types.attrsOf (
|
||||||
|
types.submodule (
|
||||||
|
{ name, ... }:
|
||||||
|
{
|
||||||
|
options.enable = mkEnableOption "GitHub runner container";
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
default = { };
|
||||||
|
description = "GitHub runner container configurations";
|
||||||
|
};
|
||||||
|
|
||||||
|
config.containers = mapAttrs (
|
||||||
|
name: cfg:
|
||||||
|
mkIf cfg.enable {
|
||||||
|
autoStart = true;
|
||||||
|
bindMounts = {
|
||||||
|
"/storage" = {
|
||||||
|
mountPoint = "/zfs/media/github-runners/${name}";
|
||||||
|
isReadOnly = false;
|
||||||
|
};
|
||||||
|
"/secrets".mountPoint = "${vars.secrets}/services/github-runners/${name}";
|
||||||
|
"ssh-keys".mountPoint = "${vars.secrets}/services/github-runners/id_ed25519_github-runners";
|
||||||
|
};
|
||||||
|
config =
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
nix.settings = {
|
||||||
|
trusted-substituters = [
|
||||||
|
"https://cache.nixos.org"
|
||||||
|
"https://cache.tmmworkshop.com"
|
||||||
|
"https://nix-community.cachix.org"
|
||||||
|
];
|
||||||
|
substituters = [
|
||||||
|
"https://cache.nixos.org/?priority=2&want-mass-query=true"
|
||||||
|
"https://cache.tmmworkshop.com/?priority=2&want-mass-query=true"
|
||||||
|
"https://nix-community.cachix.org/?priority=10&want-mass-query=true"
|
||||||
|
];
|
||||||
|
trusted-public-keys = [
|
||||||
|
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
||||||
|
"cache.tmmworkshop.com:jHffkpgbmEdstQPoihJPYW9TQe6jnQbWR2LqkNGV3iA="
|
||||||
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||||
|
];
|
||||||
|
experimental-features = [
|
||||||
|
"flakes"
|
||||||
|
"nix-command"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
programs.ssh.extraConfig = ''
|
||||||
|
Host jeeves
|
||||||
|
Port 629
|
||||||
|
User github-runners
|
||||||
|
HostName 192.168.99.14
|
||||||
|
IdentityFile ${vars.secrets}/services/github-runners/id_ed25519_github-runners
|
||||||
|
StrictHostKeyChecking no
|
||||||
|
UserKnownHostsFile /dev/null
|
||||||
|
'';
|
||||||
|
services.github-runners.${name} = {
|
||||||
|
enable = true;
|
||||||
|
replace = true;
|
||||||
|
workDir = "/zfs/media/github-runners/${name}";
|
||||||
|
url = "https://github.com/RichieCahill/dotfiles";
|
||||||
|
extraLabels = [ "nixos" ];
|
||||||
|
tokenFile = "${vars.secrets}/services/github-runners/${name}";
|
||||||
|
user = "github-runners";
|
||||||
|
group = "github-runners";
|
||||||
|
extraPackages = with pkgs; [
|
||||||
|
nixfmt-rfc-style
|
||||||
|
nixos-rebuild
|
||||||
|
openssh
|
||||||
|
treefmt
|
||||||
|
];
|
||||||
|
};
|
||||||
|
users = {
|
||||||
|
users.github-runners = {
|
||||||
|
shell = pkgs.bash;
|
||||||
|
isSystemUser = true;
|
||||||
|
group = "github-runners";
|
||||||
|
uid = 601;
|
||||||
|
};
|
||||||
|
groups.github-runners.gid = 601;
|
||||||
|
};
|
||||||
|
system.stateVersion = "24.11";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
) config.services.nix_builder.containers;
|
||||||
|
}
|
||||||
40
systems/jeeves/scripts/zfs.sh
Normal file
40
systems/jeeves/scripts/zfs.sh
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# zpools
|
||||||
|
|
||||||
|
# media
|
||||||
|
sudo zpool create -o ashift=12 -O acltype=posixacl -O atime=off -O dnodesize=auto -O xattr=sa -O compression=zstd -m /zfs/media media mirror
|
||||||
|
sudo zpool add media -o ashift=12 special mirror
|
||||||
|
|
||||||
|
# storage
|
||||||
|
sudo zpool create -o ashift=12 -O acltype=posixacl -O atime=off -O dnodesize=auto -O xattr=sa -O compression=zstd -m /zfs/storage storage
|
||||||
|
sudo zpool add storage -o ashift=12 special mirror
|
||||||
|
sudo zpool add storage -o ashift=12 logs mirror
|
||||||
|
|
||||||
|
# scratch
|
||||||
|
sudo zpool create -o ashift=12 -O acltype=posixacl -O atime=off -O dnodesize=auto -O xattr=sa -O compression=zstd -m /zfs/scratch scratch
|
||||||
|
|
||||||
|
# media datasets
|
||||||
|
sudo zfs create -o compression=zstd-9 media/docker
|
||||||
|
sudo zfs create -o compression=zstd-9 -o sync=disabled media/github-runners
|
||||||
|
sudo zfs create -o copies=3 media/notes
|
||||||
|
sudo zfs create -o compression=zstd-9 media/plex
|
||||||
|
sudo zfs create -o compression=zstd-9 media/services
|
||||||
|
sudo zfs create -o compression=zstd-19 media/home_assistant
|
||||||
|
sudo zfs create -o exec=off media/share
|
||||||
|
sudo zfs create -o recordsize=16k -o primarycache=metadata -o mountpoint=/zfs/media/database/postgres media/postgres
|
||||||
|
|
||||||
|
# scratch datasets
|
||||||
|
sudo zfs create -o recordsize=16k -o sync=disabled scratch/qbitvpn
|
||||||
|
sudo zfs create -o recordsize=16k -o sync=disabled scratch/transmission
|
||||||
|
|
||||||
|
# storage datasets
|
||||||
|
sudo zfs create -o recordsize=1M -o compression=zstd-19 storage/archive
|
||||||
|
sudo zfs create -o compression=zstd-19 storage/main
|
||||||
|
sudo zfs create -o recordsize=16K -o compression=zstd-19 -o copies=2 storage/photos
|
||||||
|
sudo zfs create -o recordsize=1M -o compression=zstd-19 storage/plex
|
||||||
|
sudo zfs create -o compression=zstd-19 -o copies=3 storage/secrets
|
||||||
|
sudo zfs create -o compression=zstd-19 storage/syncthing
|
||||||
|
sudo zfs create -o recordsize=1M -o compression=zstd-9 -o exec=off -o sync=disabled storage/qbitvpn
|
||||||
|
sudo zfs create -o recordsize=1M -o compression=zstd-9 -o exec=off -o sync=disabled storage/transmission
|
||||||
|
sudo zfs create -o recordsize=1M -o compression=zstd-19 storage/library
|
||||||
10
systems/jeeves/services/audiobookshelf.nix
Normal file
10
systems/jeeves/services/audiobookshelf.nix
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
vars = import ../vars.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.audiobookshelf.enable = true;
|
||||||
|
systemd.services.audiobookshelf.serviceConfig.WorkingDirectory =
|
||||||
|
lib.mkForce "${vars.docker_configs}/audiobookshelf";
|
||||||
|
users.users.audiobookshelf.home = lib.mkForce "${vars.docker_configs}/audiobookshelf";
|
||||||
|
}
|
||||||
17
systems/jeeves/services/cloud_flare_tunnel.nix
Normal file
17
systems/jeeves/services/cloud_flare_tunnel.nix
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
vars = import ../vars.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
systemd.services.cloud_flare_tunnel = {
|
||||||
|
description = "cloud_flare_tunnel proxy's traffic through cloudflare";
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
EnvironmentFile = "${vars.secrets}/docker/cloud_flare_tunnel";
|
||||||
|
ExecStart = "${pkgs.cloudflared}/bin/cloudflared --no-autoupdate tunnel run";
|
||||||
|
Restart = "on-failure";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
9
systems/jeeves/services/default.nix
Normal file
9
systems/jeeves/services/default.nix
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
let
|
||||||
|
files = builtins.attrNames (builtins.readDir ./.);
|
||||||
|
nixFiles = builtins.filter (name: lib.hasSuffix ".nix" name && name != "default.nix") files;
|
||||||
|
in
|
||||||
|
map (file: ./. + "/${file}") nixFiles;
|
||||||
|
}
|
||||||
21
systems/jeeves/services/filebrowser.nix
Normal file
21
systems/jeeves/services/filebrowser.nix
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
vars = import ../vars.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
systemd.services.filebrowser = {
|
||||||
|
description = "filebrowser";
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
User = "richie";
|
||||||
|
Group = "users";
|
||||||
|
ExecStart = "${pkgs.filebrowser}/bin/filebrowser --root=/zfs --address=0.0.0.0 --database=${vars.docker_configs}/filebrowser/filebrowser.db";
|
||||||
|
Restart = "on-failure";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
73
systems/jeeves/services/haproxy.cfg
Normal file
73
systems/jeeves/services/haproxy.cfg
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
global
|
||||||
|
log stdout format raw local0
|
||||||
|
# stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
|
||||||
|
stats timeout 30s
|
||||||
|
|
||||||
|
defaults
|
||||||
|
log global
|
||||||
|
mode http
|
||||||
|
retries 3
|
||||||
|
maxconn 2000
|
||||||
|
timeout connect 5s
|
||||||
|
timeout client 50s
|
||||||
|
timeout server 50s
|
||||||
|
timeout http-request 10s
|
||||||
|
timeout http-keep-alive 2s
|
||||||
|
timeout queue 5s
|
||||||
|
timeout tunnel 2m
|
||||||
|
timeout client-fin 1s
|
||||||
|
timeout server-fin 1s
|
||||||
|
|
||||||
|
|
||||||
|
#Application Setup
|
||||||
|
frontend ContentSwitching
|
||||||
|
bind *:80 v4v6
|
||||||
|
bind *:443 v4v6 ssl crt /zfs/storage/secrets/docker/cloudflare.pem
|
||||||
|
mode http
|
||||||
|
# tmmworkshop.com
|
||||||
|
acl host_audiobookshelf hdr(host) -i audiobookshelf.tmmworkshop.com
|
||||||
|
acl host_cache hdr(host) -i cache.tmmworkshop.com
|
||||||
|
acl host_filebrowser hdr(host) -i filebrowser.tmmworkshop.com
|
||||||
|
acl host_homeassistant hdr(host) -i homeassistant.tmmworkshop.com
|
||||||
|
acl host_jellyfin hdr(host) -i jellyfin.tmmworkshop.com
|
||||||
|
acl host_share hdr(host) -i share.tmmworkshop.com
|
||||||
|
acl host_gcw hdr(host) -i gcw.tmmworkshop.com
|
||||||
|
|
||||||
|
use_backend audiobookshelf_nodes if host_audiobookshelf
|
||||||
|
use_backend cache_nodes if host_cache
|
||||||
|
use_backend filebrowser_nodes if host_filebrowser
|
||||||
|
use_backend homeassistant_nodes if host_homeassistant
|
||||||
|
use_backend jellyfin if host_jellyfin
|
||||||
|
use_backend share_nodes if host_share
|
||||||
|
use_backend gcw_nodes if host_gcw
|
||||||
|
|
||||||
|
backend audiobookshelf_nodes
|
||||||
|
mode http
|
||||||
|
server server 127.0.0.1:8000
|
||||||
|
|
||||||
|
backend cache_nodes
|
||||||
|
mode http
|
||||||
|
server server 127.0.0.1:5000
|
||||||
|
|
||||||
|
backend filebrowser_nodes
|
||||||
|
mode http
|
||||||
|
server server 127.0.0.1:8080
|
||||||
|
|
||||||
|
backend homeassistant_nodes
|
||||||
|
mode http
|
||||||
|
server server 127.0.0.1:8123
|
||||||
|
|
||||||
|
backend jellyfin
|
||||||
|
option httpchk
|
||||||
|
option forwardfor
|
||||||
|
http-check send meth GET uri /health
|
||||||
|
http-check expect string Healthy
|
||||||
|
server jellyfin 127.0.0.1:8096
|
||||||
|
|
||||||
|
backend share_nodes
|
||||||
|
mode http
|
||||||
|
server server 127.0.0.1:8091
|
||||||
|
|
||||||
|
backend gcw_nodes
|
||||||
|
mode http
|
||||||
|
server server 127.0.0.1:8092
|
||||||
11
systems/jeeves/services/haproxy.nix
Normal file
11
systems/jeeves/services/haproxy.nix
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
networking.firewall.allowedTCPPorts = [
|
||||||
|
80
|
||||||
|
443
|
||||||
|
];
|
||||||
|
|
||||||
|
services.haproxy = {
|
||||||
|
enable = true;
|
||||||
|
config = builtins.readFile ./haproxy.cfg;
|
||||||
|
};
|
||||||
|
}
|
||||||
84
systems/jeeves/services/home_assistant.nix
Normal file
84
systems/jeeves/services/home_assistant.nix
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
let
|
||||||
|
vars = import ../vars.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
users = {
|
||||||
|
users.hass = {
|
||||||
|
isSystemUser = true;
|
||||||
|
group = "hass";
|
||||||
|
};
|
||||||
|
groups.hass = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
home-assistant = {
|
||||||
|
enable = true;
|
||||||
|
openFirewall = true;
|
||||||
|
configDir = vars.home_assistant;
|
||||||
|
config = {
|
||||||
|
http = {
|
||||||
|
server_port = 8123;
|
||||||
|
server_host = [
|
||||||
|
"192.168.99.14"
|
||||||
|
"192.168.90.40"
|
||||||
|
"127.0.0.1"
|
||||||
|
];
|
||||||
|
use_x_forwarded_for = true;
|
||||||
|
trusted_proxies = "127.0.0.1";
|
||||||
|
};
|
||||||
|
homeassistant = {
|
||||||
|
time_zone = "America/New_York";
|
||||||
|
unit_system = "us_customary";
|
||||||
|
temperature_unit = "F";
|
||||||
|
};
|
||||||
|
recorder = {
|
||||||
|
db_url = "postgresql://@/hass";
|
||||||
|
auto_purge = true;
|
||||||
|
purge_keep_days = 3650;
|
||||||
|
db_retry_wait = 15;
|
||||||
|
};
|
||||||
|
assist_pipeline = { };
|
||||||
|
backup = { };
|
||||||
|
bluetooth = { };
|
||||||
|
config = { };
|
||||||
|
dhcp = { };
|
||||||
|
energy = { };
|
||||||
|
history = { };
|
||||||
|
homeassistant_alerts = { };
|
||||||
|
image_upload = { };
|
||||||
|
logbook = { };
|
||||||
|
media_source = { };
|
||||||
|
mobile_app = { };
|
||||||
|
ssdp = { };
|
||||||
|
sun = { };
|
||||||
|
webhook = { };
|
||||||
|
zeroconf = { };
|
||||||
|
automation = "!include automations.yaml";
|
||||||
|
script = "!include scripts.yaml";
|
||||||
|
scene = "!include scenes.yaml";
|
||||||
|
group = "!include groups.yaml";
|
||||||
|
};
|
||||||
|
extraPackages =
|
||||||
|
python3Packages: with python3Packages; [
|
||||||
|
aioesphomeapi
|
||||||
|
aiounifi
|
||||||
|
bleak-esphome
|
||||||
|
esphome-dashboard-api
|
||||||
|
gtts
|
||||||
|
jellyfin-apiclient-python
|
||||||
|
psycopg2
|
||||||
|
pymetno
|
||||||
|
pyownet
|
||||||
|
rokuecp
|
||||||
|
uiprotect
|
||||||
|
wakeonlan
|
||||||
|
];
|
||||||
|
extraComponents = [ "isal" ];
|
||||||
|
};
|
||||||
|
esphome = {
|
||||||
|
enable = true;
|
||||||
|
openFirewall = true;
|
||||||
|
address = "192.168.90.40";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
10
systems/jeeves/services/jellyfin.nix
Normal file
10
systems/jeeves/services/jellyfin.nix
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
let
|
||||||
|
vars = import ../vars.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.jellyfin = {
|
||||||
|
enable = true;
|
||||||
|
openFirewall = true;
|
||||||
|
dataDir = "${vars.services}/jellyfin";
|
||||||
|
};
|
||||||
|
}
|
||||||
10
systems/jeeves/services/nix_serve.nix
Normal file
10
systems/jeeves/services/nix_serve.nix
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
let
|
||||||
|
vars = import ../vars.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.nix-serve = {
|
||||||
|
enable = true;
|
||||||
|
secretKeyFile = "${vars.secrets}/services/nix-cache/cache-priv-key.pem";
|
||||||
|
openFirewall = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
192
systems/jeeves/services/postgress.nix
Normal file
192
systems/jeeves/services/postgress.nix
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
vars = import ../vars.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
networking.firewall.allowedTCPPorts = [ 5432 ];
|
||||||
|
|
||||||
|
services.postgresql = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.postgresql_17_jit;
|
||||||
|
enableTCPIP = true;
|
||||||
|
enableJIT = true;
|
||||||
|
dataDir = "${vars.database}/postgres";
|
||||||
|
|
||||||
|
authentication = pkgs.lib.mkOverride 10 ''
|
||||||
|
|
||||||
|
# admins
|
||||||
|
local all postgres trust
|
||||||
|
host all postgres 127.0.0.1/32 trust
|
||||||
|
host all postgres ::1/128 trust
|
||||||
|
|
||||||
|
local all richie trust
|
||||||
|
host all richie 127.0.0.1/32 trust
|
||||||
|
host all richie ::1/128 trust
|
||||||
|
host all richie 192.168.90.1/24 trust
|
||||||
|
host all richie 192.168.99.1/24 trust
|
||||||
|
|
||||||
|
|
||||||
|
#type database DBuser origin-address auth-method
|
||||||
|
local hass hass trust
|
||||||
|
|
||||||
|
# ipv4
|
||||||
|
host hass hass 192.168.90.1/24 trust
|
||||||
|
host hass hass 127.0.0.1/32 trust
|
||||||
|
|
||||||
|
# ipv6
|
||||||
|
host hass hass ::1/128 trust
|
||||||
|
|
||||||
|
# megan
|
||||||
|
host megan megan 192.168.90.1/24 trust
|
||||||
|
host megan megan 127.0.0.1/32 trust
|
||||||
|
|
||||||
|
host gcw megan 192.168.90.1/24 trust
|
||||||
|
host gcw megan 127.0.0.1/32 trust
|
||||||
|
|
||||||
|
# gcw
|
||||||
|
local gcw gcw trust
|
||||||
|
host gcw gcw 192.168.90.1/24 trust
|
||||||
|
host gcw gcw 127.0.0.1/32 trust
|
||||||
|
|
||||||
|
'';
|
||||||
|
|
||||||
|
identMap = ''
|
||||||
|
# ArbitraryMapName systemUser DBUser
|
||||||
|
superuser_map root postgres
|
||||||
|
superuser_map postgres postgres
|
||||||
|
# Let other names login as themselves
|
||||||
|
superuser_map richie postgres
|
||||||
|
superuser_map hass hass
|
||||||
|
'';
|
||||||
|
ensureUsers = [
|
||||||
|
{
|
||||||
|
name = "postgres";
|
||||||
|
ensureClauses = {
|
||||||
|
superuser = true;
|
||||||
|
login = true;
|
||||||
|
createrole = true;
|
||||||
|
createdb = true;
|
||||||
|
replication = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "richie";
|
||||||
|
ensureDBOwnership = true;
|
||||||
|
ensureClauses = {
|
||||||
|
superuser = true;
|
||||||
|
login = true;
|
||||||
|
createrole = true;
|
||||||
|
createdb = true;
|
||||||
|
replication = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "hass";
|
||||||
|
ensureDBOwnership = true;
|
||||||
|
ensureClauses = {
|
||||||
|
login = true;
|
||||||
|
createrole = true;
|
||||||
|
createdb = true;
|
||||||
|
replication = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "megan";
|
||||||
|
ensureDBOwnership = true;
|
||||||
|
ensureClauses = {
|
||||||
|
login = true;
|
||||||
|
createrole = true;
|
||||||
|
createdb = true;
|
||||||
|
replication = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "gcw";
|
||||||
|
ensureDBOwnership = true;
|
||||||
|
ensureClauses = {
|
||||||
|
login = true;
|
||||||
|
createrole = true;
|
||||||
|
createdb = true;
|
||||||
|
replication = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
ensureDatabases = [
|
||||||
|
"gcw"
|
||||||
|
"hass"
|
||||||
|
"megan"
|
||||||
|
"mxr_dev"
|
||||||
|
"mxr_prod"
|
||||||
|
"richie"
|
||||||
|
];
|
||||||
|
# Thank you NotAShelf
|
||||||
|
# https://github.com/NotAShelf/nyx/blob/d407b4d6e5ab7f60350af61a3d73a62a5e9ac660/modules/core/roles/server/system/services/databases/postgresql.nix#L74
|
||||||
|
settings = {
|
||||||
|
# Connectivity;
|
||||||
|
max_connections = 100;
|
||||||
|
superuser_reserved_connections = 3;
|
||||||
|
|
||||||
|
# Memory Settings;
|
||||||
|
shared_buffers = "1024 MB";
|
||||||
|
work_mem = "32 MB";
|
||||||
|
maintenance_work_mem = "320 MB";
|
||||||
|
huge_pages = "off";
|
||||||
|
effective_cache_size = "2 GB";
|
||||||
|
effective_io_concurrency = 100; # concurrent IO only really activated if OS supports posix_fadvise function;
|
||||||
|
random_page_cost = 1.25; # speed of random disk access relative to sequential access (1.0);
|
||||||
|
|
||||||
|
# Monitoring;
|
||||||
|
shared_preload_libraries = "pg_stat_statements,auto_explain"; # per statement resource usage stats & log explain statements for slow queries
|
||||||
|
track_io_timing = "on"; # measure exact block IO times;
|
||||||
|
track_functions = "pl"; # track execution times of pl-language procedures if any;
|
||||||
|
# Replication;
|
||||||
|
wal_level = "replica"; # consider using at least "replica";
|
||||||
|
max_wal_senders = 0;
|
||||||
|
synchronous_commit = "on";
|
||||||
|
|
||||||
|
# Checkpointing: ;
|
||||||
|
checkpoint_timeout = "15 min";
|
||||||
|
checkpoint_completion_target = 0.9;
|
||||||
|
max_wal_size = "1024 MB";
|
||||||
|
min_wal_size = "512 MB";
|
||||||
|
|
||||||
|
# WAL writing;
|
||||||
|
wal_compression = "on";
|
||||||
|
wal_buffers = -1; # auto-tuned by Postgres till maximum of segment size (16MB by default);
|
||||||
|
wal_writer_delay = "200ms";
|
||||||
|
wal_writer_flush_after = "1MB";
|
||||||
|
|
||||||
|
# Background writer;
|
||||||
|
bgwriter_delay = "200ms";
|
||||||
|
bgwriter_lru_maxpages = 100;
|
||||||
|
bgwriter_lru_multiplier = 2.0;
|
||||||
|
bgwriter_flush_after = 0;
|
||||||
|
|
||||||
|
# Parallel queries: ;
|
||||||
|
max_worker_processes = 6;
|
||||||
|
max_parallel_workers_per_gather = 3;
|
||||||
|
max_parallel_maintenance_workers = 3;
|
||||||
|
max_parallel_workers = 6;
|
||||||
|
parallel_leader_participation = "on";
|
||||||
|
|
||||||
|
# Advanced features ;
|
||||||
|
enable_partitionwise_join = "on";
|
||||||
|
enable_partitionwise_aggregate = "on";
|
||||||
|
jit = "on";
|
||||||
|
|
||||||
|
jit_above_cost = 100000;
|
||||||
|
jit_inline_above_cost = 150000;
|
||||||
|
jit_optimize_above_cost = 500000;
|
||||||
|
|
||||||
|
# log slow queries
|
||||||
|
log_min_duration_statement = 100;
|
||||||
|
"auto_explain.log_min_duration" = 100;
|
||||||
|
|
||||||
|
# logging configuration
|
||||||
|
log_connections = true;
|
||||||
|
log_statement = "all";
|
||||||
|
logging_collector = true;
|
||||||
|
log_disconnections = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -3,6 +3,9 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
vars = import ../vars.nix;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
systemd = {
|
systemd = {
|
||||||
services = {
|
services = {
|
||||||
@@ -10,7 +13,7 @@
|
|||||||
description = "maintains /zfs/storage/plex permissions";
|
description = "maintains /zfs/storage/plex permissions";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
ExecStart = "${pkgs.bash}/bin/bash ${./scripts/plex_permission.sh}";
|
ExecStart = "${pkgs.bash}/bin/bash ${../scripts/plex_permission.sh}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
startup_validation = {
|
startup_validation = {
|
||||||
@@ -20,9 +23,9 @@
|
|||||||
description = "validates startup";
|
description = "validates startup";
|
||||||
path = [ pkgs.zfs ];
|
path = [ pkgs.zfs ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
EnvironmentFile = "/root/secrets/services/server-validation";
|
EnvironmentFile = "${vars.secrets}/services/server-validation";
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
ExecStart = "${inputs.system_tools.packages.x86_64-linux.default}/bin/validate_jeeves";
|
ExecStart = "${inputs.system_tools.packages.x86_64-linux.default}/bin/validate_system --config-file='${./validate_system.toml}'";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
32
systems/jeeves/services/transmission.nix
Normal file
32
systems/jeeves/services/transmission.nix
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
vars = import ../vars.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.transmission = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.transmission_4;
|
||||||
|
webHome = pkgs.flood-for-transmission;
|
||||||
|
home = "${vars.services}/transmission";
|
||||||
|
openPeerPorts = true;
|
||||||
|
openRPCPort = true;
|
||||||
|
downloadDirPermissions = "770";
|
||||||
|
settings = {
|
||||||
|
bind-address-ipv4 = "192.168.99.14";
|
||||||
|
cache-size-mb = 0;
|
||||||
|
download-dir = "${vars.transmission}/complete";
|
||||||
|
download-queue-enabled = false;
|
||||||
|
incomplete-dir = "${vars.transmission_scratch}/incomplete";
|
||||||
|
incomplete-dir-enabled = true;
|
||||||
|
message-level = 3;
|
||||||
|
peer-port = 51413;
|
||||||
|
rpc-bind-address = "0.0.0.0";
|
||||||
|
rpc-host-whitelist = "127.0.0.1,192.168.90.40";
|
||||||
|
rpc-host-whitelist-enabled = true;
|
||||||
|
rpc-port = 9091;
|
||||||
|
rpc-whitelist-enabled = true;
|
||||||
|
rpc-whitelist = "127.0.0.1,192.168.90.49";
|
||||||
|
seed-queue-enabled = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
11
systems/jeeves/services/validate_system.toml
Normal file
11
systems/jeeves/services/validate_system.toml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
zpool = ["root_pool", "storage", "media"]
|
||||||
|
services = [
|
||||||
|
"audiobookshelf",
|
||||||
|
"cloud_flare_tunnel",
|
||||||
|
"haproxy",
|
||||||
|
"docker-qbitvpn",
|
||||||
|
"docker",
|
||||||
|
"filebrowser",
|
||||||
|
"home-assistant",
|
||||||
|
"jellyfin",
|
||||||
|
]
|
||||||
@@ -1,8 +1,32 @@
|
|||||||
["media/Notes"]
|
["default"]
|
||||||
|
15_min = 8
|
||||||
|
hourly = 24
|
||||||
|
daily = 0
|
||||||
|
monthly = 0
|
||||||
|
|
||||||
|
["root_pool/home"]
|
||||||
|
15_min = 8
|
||||||
|
hourly = 24
|
||||||
|
daily = 14
|
||||||
|
monthly = 0
|
||||||
|
|
||||||
|
["root_pool/root"]
|
||||||
|
15_min = 8
|
||||||
|
hourly = 24
|
||||||
|
daily = 0
|
||||||
|
monthly = 0
|
||||||
|
|
||||||
|
["root_pool/nix"]
|
||||||
|
15_min = 4
|
||||||
|
hourly = 0
|
||||||
|
daily = 0
|
||||||
|
monthly = 0
|
||||||
|
|
||||||
|
["root_pool/var"]
|
||||||
15_min = 8
|
15_min = 8
|
||||||
hourly = 24
|
hourly = 24
|
||||||
daily = 30
|
daily = 30
|
||||||
monthly = 12
|
monthly = 6
|
||||||
|
|
||||||
["storage/plex"]
|
["storage/plex"]
|
||||||
15_min = 6
|
15_min = 6
|
||||||
|
|||||||
130
systems/jeeves/syncthing.nix
Normal file
130
systems/jeeves/syncthing.nix
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
let
|
||||||
|
vars = import ./vars.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
networking.firewall.allowedTCPPorts = [ 8384 ];
|
||||||
|
|
||||||
|
services.syncthing = {
|
||||||
|
overrideFolders = false;
|
||||||
|
guiAddress = "192.168.90.40:8384";
|
||||||
|
settings = {
|
||||||
|
devices.davids-server.id = "7GXTDGR-AOXFW2O-K6J7NM3-XYZNRRW-AKHAFWM-GBOWUPQ-OA6JIWD-ER7RDQL"; # cspell:disable-line
|
||||||
|
folders = {
|
||||||
|
"dotfiles" = {
|
||||||
|
path = "/home/richie/dotfiles";
|
||||||
|
devices = [
|
||||||
|
"bob"
|
||||||
|
"rhapsody-in-green"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
};
|
||||||
|
"notes" = {
|
||||||
|
id = "l62ul-lpweo"; # cspell:disable-line
|
||||||
|
path = vars.notes;
|
||||||
|
devices = [
|
||||||
|
"rhapsody-in-green"
|
||||||
|
"davids-server"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
};
|
||||||
|
"important" = {
|
||||||
|
id = "4ckma-gtshs"; # cspell:disable-line
|
||||||
|
path = "${vars.syncthing}/important";
|
||||||
|
devices = [
|
||||||
|
"bob"
|
||||||
|
"rhapsody-in-green"
|
||||||
|
"phone"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
};
|
||||||
|
"music" = {
|
||||||
|
id = "vprc5-3azqc"; # cspell:disable-line
|
||||||
|
path = "${vars.syncthing}/music";
|
||||||
|
devices = [
|
||||||
|
"bob"
|
||||||
|
"rhapsody-in-green"
|
||||||
|
"ipad"
|
||||||
|
"phone"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
};
|
||||||
|
"projects" = {
|
||||||
|
id = "vyma6-lqqrz"; # cspell:disable-line
|
||||||
|
path = "${vars.syncthing}/projects";
|
||||||
|
devices = [
|
||||||
|
"rhapsody-in-green"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
};
|
||||||
|
"rhapsody-in-green_temp" = {
|
||||||
|
path = "${vars.syncthing}/rhapsody-in-green_temp";
|
||||||
|
devices = [
|
||||||
|
"rhapsody-in-green"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
};
|
||||||
|
"vault" = {
|
||||||
|
path = "/home/richie/vault";
|
||||||
|
devices = [
|
||||||
|
"rhapsody-in-green"
|
||||||
|
"davids-server"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
};
|
||||||
|
"backup" = {
|
||||||
|
path = "${vars.syncthing}/backup";
|
||||||
|
devices = [
|
||||||
|
"davids-server"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
};
|
||||||
|
#
|
||||||
|
"davids-backup1" = {
|
||||||
|
id = "8229p-8z3tm"; # cspell:disable-line
|
||||||
|
path = "${vars.syncthing}/davids_backups/1";
|
||||||
|
devices = [
|
||||||
|
"davids-server"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
type = "receiveencrypted";
|
||||||
|
};
|
||||||
|
"davids-backup2" = {
|
||||||
|
id = "iciw3-dp6ao"; # cspell:disable-line
|
||||||
|
path = "${vars.syncthing}/davids_backups/2";
|
||||||
|
devices = [
|
||||||
|
"davids-server"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
type = "receiveencrypted";
|
||||||
|
};
|
||||||
|
"davids-backup3" = {
|
||||||
|
id = "9si6m-bnkjb"; # cspell:disable-line
|
||||||
|
path = "${vars.syncthing}/davids_backups/3";
|
||||||
|
devices = [
|
||||||
|
"davids-server"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
type = "receiveencrypted";
|
||||||
|
};
|
||||||
|
"davids-backup4" = {
|
||||||
|
id = "qjyfy-uupj4"; # cspell:disable-line
|
||||||
|
path = "${vars.syncthing}/davids_backups/4";
|
||||||
|
devices = [
|
||||||
|
"davids-server"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
type = "receiveencrypted";
|
||||||
|
};
|
||||||
|
"davids-backup5" = {
|
||||||
|
id = "fm4h5-emsu2"; # cspell:disable-line
|
||||||
|
path = "${vars.syncthing}/davids_backups/5";
|
||||||
|
devices = [
|
||||||
|
"davids-server"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
type = "receiveencrypted";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,23 +1,21 @@
|
|||||||
let
|
let
|
||||||
zfs_media = "/zfs/media";
|
zfs_media = "/zfs/media";
|
||||||
zfs_storage = "/zfs/storage";
|
zfs_storage = "/zfs/storage";
|
||||||
zfs_torrenting = "/zfs/torrenting";
|
zfs_scratch = "/zfs/scratch";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit zfs_media zfs_storage zfs_torrenting;
|
inherit zfs_media zfs_storage zfs_scratch;
|
||||||
# media
|
database = "${zfs_media}/database";
|
||||||
media_database = "${zfs_media}/syncthing/database";
|
docker = "${zfs_media}/docker";
|
||||||
media_docker = "${zfs_media}/docker";
|
docker_configs = "${zfs_media}/docker/configs";
|
||||||
media_docker_configs = "${zfs_media}/docker/configs";
|
home_assistant = "${zfs_media}/home_assistant";
|
||||||
media_mirror = "${zfs_media}/mirror";
|
notes = "${zfs_media}/notes";
|
||||||
media_notes = "${zfs_media}/notes";
|
qbitvpn = "${zfs_storage}/qbitvpn";
|
||||||
media_plex = "${zfs_media}/plex/";
|
qbitvpn_scratch = "${zfs_scratch}/qbitvpn";
|
||||||
media_scripts = "${zfs_media}/scripts";
|
secrets = "${zfs_storage}/secrets";
|
||||||
# storage
|
services = "${zfs_media}/services";
|
||||||
storage_main = "${zfs_storage}/main";
|
share = "${zfs_media}/share";
|
||||||
storage_plex = "${zfs_storage}/plex";
|
syncthing = "${zfs_storage}/syncthing";
|
||||||
storage_syncthing = "${zfs_storage}/syncthing";
|
transmission = "${zfs_storage}/transmission";
|
||||||
# torrenting
|
transmission_scratch = "${zfs_scratch}/transmission";
|
||||||
torrenting_qbit = "${zfs_torrenting}/qbit";
|
|
||||||
torrenting_qbitvpn = "${zfs_torrenting}/qbitvpn";
|
|
||||||
}
|
}
|
||||||
|
|||||||
30
systems/rhapsody-in-green/default.nix
Normal file
30
systems/rhapsody-in-green/default.nix
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{ inputs, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
../../users/richie
|
||||||
|
../../common/global
|
||||||
|
../../common/optional/desktop.nix
|
||||||
|
../../common/optional/docker.nix
|
||||||
|
../../common/optional/steam.nix
|
||||||
|
../../common/optional/syncthing_base.nix
|
||||||
|
../../common/optional/systemd-boot.nix
|
||||||
|
../../common/optional/yubikey.nix
|
||||||
|
../../common/optional/zerotier.nix
|
||||||
|
./hardware.nix
|
||||||
|
./syncthing.nix
|
||||||
|
inputs.nixos-hardware.nixosModules.framework-13-7040-amd
|
||||||
|
];
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
hostName = "rhapsody-in-green";
|
||||||
|
hostId = "6404140d";
|
||||||
|
firewall.enable = true;
|
||||||
|
networkmanager.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
openssh.ports = [ 922 ];
|
||||||
|
};
|
||||||
|
|
||||||
|
system.stateVersion = "24.05";
|
||||||
|
}
|
||||||
61
systems/rhapsody-in-green/hardware.nix
Normal file
61
systems/rhapsody-in-green/hardware.nix
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
modulesPath,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||||
|
|
||||||
|
boot = {
|
||||||
|
initrd = {
|
||||||
|
availableKernelModules = [
|
||||||
|
"nvme"
|
||||||
|
"xhci_pci"
|
||||||
|
"thunderbolt"
|
||||||
|
"usb_storage"
|
||||||
|
"sd_mod"
|
||||||
|
];
|
||||||
|
kernelModules = [ ];
|
||||||
|
luks.devices = {
|
||||||
|
"luks-root-pool-nvme-Samsung_SSD_980_PRO_1TB_S5P2NU0X403203E-part2" = {
|
||||||
|
device = "/dev/disk/by-id/nvme-Samsung_SSD_980_PRO_1TB_S5P2NU0X403203E-part2";
|
||||||
|
bypassWorkqueues = true;
|
||||||
|
allowDiscards = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
kernelModules = [ "kvm-amd" ];
|
||||||
|
extraModulePackages = [ ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems = {
|
||||||
|
"/" = lib.mkDefault {
|
||||||
|
device = "root_pool/root";
|
||||||
|
fsType = "zfs";
|
||||||
|
};
|
||||||
|
"/home" = {
|
||||||
|
device = "root_pool/home";
|
||||||
|
fsType = "zfs";
|
||||||
|
};
|
||||||
|
"/var" = {
|
||||||
|
device = "root_pool/var";
|
||||||
|
fsType = "zfs";
|
||||||
|
};
|
||||||
|
"/boot" = {
|
||||||
|
device = "/dev/disk/by-uuid/12CE-A600";
|
||||||
|
fsType = "vfat";
|
||||||
|
options = [
|
||||||
|
"fmask=0077"
|
||||||
|
"dmask=0077"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
swapDevices = [ ];
|
||||||
|
|
||||||
|
networking.useDHCP = lib.mkDefault true;
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
|
}
|
||||||
64
systems/rhapsody-in-green/syncthing.nix
Normal file
64
systems/rhapsody-in-green/syncthing.nix
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
services.syncthing.settings.folders = {
|
||||||
|
"dotfiles" = {
|
||||||
|
path = "/home/richie/dotfiles";
|
||||||
|
devices = [
|
||||||
|
"jeeves"
|
||||||
|
"bob"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
};
|
||||||
|
"notes" = {
|
||||||
|
id = "l62ul-lpweo"; # cspell:disable-line
|
||||||
|
path = "/home/richie/notes";
|
||||||
|
devices = [
|
||||||
|
"jeeves"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
};
|
||||||
|
"important" = {
|
||||||
|
id = "4ckma-gtshs"; # cspell:disable-line
|
||||||
|
path = "/home/richie/important";
|
||||||
|
devices = [
|
||||||
|
"bob"
|
||||||
|
"jeeves"
|
||||||
|
"phone"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
};
|
||||||
|
"music" = {
|
||||||
|
id = "vprc5-3azqc"; # cspell:disable-line
|
||||||
|
path = "/home/richie/music";
|
||||||
|
devices = [
|
||||||
|
"bob"
|
||||||
|
"ipad"
|
||||||
|
"jeeves"
|
||||||
|
"phone"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
};
|
||||||
|
"projects" = {
|
||||||
|
id = "vyma6-lqqrz"; # cspell:disable-line
|
||||||
|
path = "/home/richie/projects";
|
||||||
|
devices = [
|
||||||
|
"jeeves"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
};
|
||||||
|
rhapsody-in-temp = {
|
||||||
|
id = "rhapsody-in-green_temp";
|
||||||
|
path = "/home/richie/temp";
|
||||||
|
devices = [
|
||||||
|
"jeeves"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
};
|
||||||
|
"vault" = {
|
||||||
|
path = "/home/richie/vault";
|
||||||
|
devices = [
|
||||||
|
"jeeves"
|
||||||
|
];
|
||||||
|
fsWatcherEnabled = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
682
tools/installer.py
Normal file
682
tools/installer.py
Normal file
@@ -0,0 +1,682 @@
|
|||||||
|
"""Install NixOS on a ZFS pool."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import curses
|
||||||
|
import logging
|
||||||
|
import sys
|
||||||
|
from collections import defaultdict
|
||||||
|
from os import getenv
|
||||||
|
from pathlib import Path
|
||||||
|
from random import getrandbits
|
||||||
|
from subprocess import PIPE, Popen, run
|
||||||
|
from time import sleep
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Sequence
|
||||||
|
|
||||||
|
|
||||||
|
def configure_logger(level: str = "INFO") -> None:
|
||||||
|
"""Configure the logger.
|
||||||
|
Args:
|
||||||
|
level (str, optional): The logging level. Defaults to "INFO".
|
||||||
|
"""
|
||||||
|
logging.basicConfig(
|
||||||
|
level=level,
|
||||||
|
datefmt="%Y-%m-%dT%H:%M:%S%z",
|
||||||
|
format="%(asctime)s %(levelname)s %(filename)s:%(lineno)d - %(message)s",
|
||||||
|
handlers=[logging.StreamHandler(sys.stdout)],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def bash_wrapper(command: str) -> str:
|
||||||
|
"""Execute a bash command and capture the output.
|
||||||
|
Args:
|
||||||
|
command (str): The bash command to be executed.
|
||||||
|
Returns:
|
||||||
|
Tuple[str, int]: A tuple containing the output of the command (stdout) as a string,
|
||||||
|
the error output (stderr) as a string (optional), and the return code as an integer.
|
||||||
|
"""
|
||||||
|
logging.debug(f"running {command=}")
|
||||||
|
# This is a acceptable risk
|
||||||
|
process = Popen(command.split(), stdout=PIPE, stderr=PIPE) # noqa: S603
|
||||||
|
output, _ = process.communicate()
|
||||||
|
if process.returncode != 0:
|
||||||
|
error = f"Failed to run command {command=} return code {process.returncode=}"
|
||||||
|
raise RuntimeError(error)
|
||||||
|
|
||||||
|
return output.decode()
|
||||||
|
|
||||||
|
|
||||||
|
def partition_disk(disk: str, swap_size: int, reserve: int = 0) -> None:
|
||||||
|
"""Partition a disk.
|
||||||
|
Args:
|
||||||
|
disk (str): The disk to partition.
|
||||||
|
swap_size (int): The size of the swap partition in GB.
|
||||||
|
minimum value is 1.
|
||||||
|
reserve (int, optional): The size of the reserve partition in GB. Defaults to 0.
|
||||||
|
minimum value is 0.
|
||||||
|
"""
|
||||||
|
logging.info(f"partitioning {disk=}")
|
||||||
|
swap_size = max(swap_size, 1)
|
||||||
|
reserve = max(reserve, 0)
|
||||||
|
|
||||||
|
bash_wrapper(f"blkdiscard -f {disk}")
|
||||||
|
|
||||||
|
if reserve > 0:
|
||||||
|
msg = f"Creating swap partition on {disk=} with size {swap_size=}GiB and reserve {reserve=}GiB"
|
||||||
|
logging.info(msg)
|
||||||
|
|
||||||
|
swap_start = swap_size + reserve
|
||||||
|
swap_partition = f"mkpart swap -{swap_start}GiB -{reserve}GiB "
|
||||||
|
else:
|
||||||
|
logging.info(f"Creating swap partition on {disk=} with size {swap_size=}GiB")
|
||||||
|
swap_start = swap_size
|
||||||
|
swap_partition = f"mkpart swap -{swap_start}GiB 100% "
|
||||||
|
|
||||||
|
logging.debug(f"{swap_partition=}")
|
||||||
|
|
||||||
|
create_partitions = (
|
||||||
|
f"parted --script --align=optimal {disk} -- "
|
||||||
|
"mklabel gpt "
|
||||||
|
"mkpart EFI 1MiB 4GiB "
|
||||||
|
f"mkpart root_pool 4GiB -{swap_start}GiB "
|
||||||
|
f"{swap_partition}"
|
||||||
|
"set 1 esp on"
|
||||||
|
)
|
||||||
|
bash_wrapper(create_partitions)
|
||||||
|
|
||||||
|
logging.info(f"{disk=} successfully partitioned")
|
||||||
|
|
||||||
|
|
||||||
|
def create_zfs_pool(pool_disks: Sequence[str], mnt_dir: str) -> None:
|
||||||
|
"""Create a ZFS pool.
|
||||||
|
Args:
|
||||||
|
disks (Sequence[str]): A tuple of disks to use for the pool.
|
||||||
|
mnt_dir (str): The mount directory.
|
||||||
|
"""
|
||||||
|
if len(pool_disks) <= 0:
|
||||||
|
error = "disks must be a tuple of at least length 1"
|
||||||
|
raise ValueError(error)
|
||||||
|
|
||||||
|
zpool_create = (
|
||||||
|
"zpool create "
|
||||||
|
"-o ashift=12 "
|
||||||
|
"-o autotrim=on "
|
||||||
|
f"-R {mnt_dir} "
|
||||||
|
"-O acltype=posixacl "
|
||||||
|
"-O canmount=off "
|
||||||
|
"-O dnodesize=auto "
|
||||||
|
"-O normalization=formD "
|
||||||
|
"-O relatime=on "
|
||||||
|
"-O xattr=sa "
|
||||||
|
"-O mountpoint=legacy "
|
||||||
|
"-O compression=zstd "
|
||||||
|
"-O atime=off "
|
||||||
|
"root_pool "
|
||||||
|
)
|
||||||
|
if len(pool_disks) == 1:
|
||||||
|
zpool_create += pool_disks[0]
|
||||||
|
else:
|
||||||
|
zpool_create += "mirror "
|
||||||
|
zpool_create += " ".join(pool_disks)
|
||||||
|
|
||||||
|
bash_wrapper(zpool_create)
|
||||||
|
zpools = bash_wrapper("zpool list -o name")
|
||||||
|
if "root_pool" not in zpools.splitlines():
|
||||||
|
logging.critical("Failed to create root_pool")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
def create_zfs_datasets() -> None:
|
||||||
|
"""Create ZFS datasets."""
|
||||||
|
|
||||||
|
bash_wrapper("zfs create -o canmount=noauto -o reservation=10G root_pool/root")
|
||||||
|
bash_wrapper("zfs create root_pool/home")
|
||||||
|
bash_wrapper("zfs create root_pool/var -o reservation=1G")
|
||||||
|
bash_wrapper("zfs create -o compression=zstd-9 -o reservation=10G root_pool/nix")
|
||||||
|
datasets = bash_wrapper("zfs list -o name")
|
||||||
|
|
||||||
|
expected_datasets = {
|
||||||
|
"root_pool/root",
|
||||||
|
"root_pool/home",
|
||||||
|
"root_pool/var",
|
||||||
|
"root_pool/nix",
|
||||||
|
}
|
||||||
|
missing_datasets = expected_datasets.difference(datasets.splitlines())
|
||||||
|
if missing_datasets:
|
||||||
|
logging.critical(f"Failed to create pools {missing_datasets}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
def get_cpu_manufacturer() -> str:
|
||||||
|
"""Get the CPU manufacturer."""
|
||||||
|
output = bash_wrapper("cat /proc/cpuinfo")
|
||||||
|
|
||||||
|
id_vendor = {"AuthenticAMD": "amd", "GenuineIntel": "intel"}
|
||||||
|
|
||||||
|
for line in output.splitlines():
|
||||||
|
if "vendor_id" in line:
|
||||||
|
return id_vendor[line.split(": ")[1].strip()]
|
||||||
|
|
||||||
|
|
||||||
|
def get_boot_drive_id(disk: str) -> str:
|
||||||
|
"""Get the boot drive ID."""
|
||||||
|
output = bash_wrapper(f"lsblk -o UUID {disk}-part1")
|
||||||
|
return output.splitlines()[1]
|
||||||
|
|
||||||
|
|
||||||
|
def create_nix_hardware_file(mnt_dir: str, disks: Sequence[str], encrypt: bool) -> None:
|
||||||
|
"""Create a NixOS hardware file."""
|
||||||
|
|
||||||
|
cpu_manufacturer = get_cpu_manufacturer()
|
||||||
|
|
||||||
|
devices = ""
|
||||||
|
if encrypt:
|
||||||
|
disk = disks[0]
|
||||||
|
|
||||||
|
devices = (
|
||||||
|
f' luks.devices."luks-root-pool-{disk.split("/")[-1]}-part2"'
|
||||||
|
"= {\n"
|
||||||
|
f' device = "{disk}-part2";\n'
|
||||||
|
" bypassWorkqueues = true;\n"
|
||||||
|
" allowDiscards = true;\n"
|
||||||
|
" };\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
host_id = format(getrandbits(32), "08x")
|
||||||
|
|
||||||
|
nix_hardware = (
|
||||||
|
"{ config, lib, modulesPath, ... }:\n"
|
||||||
|
"{\n"
|
||||||
|
' imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];\n\n'
|
||||||
|
" boot = {\n"
|
||||||
|
" initrd = {\n"
|
||||||
|
' availableKernelModules = [ \n "ahci"\n "ehci_pci"\n "nvme"\n "sd_mod"\n "usb_storage"\n "usbhid"\n "xhci_pci"\n ];\n'
|
||||||
|
" kernelModules = [ ];\n"
|
||||||
|
f" {devices}"
|
||||||
|
" };\n"
|
||||||
|
f' kernelModules = [ "kvm-{cpu_manufacturer}" ];\n'
|
||||||
|
" extraModulePackages = [ ];\n"
|
||||||
|
" };\n\n"
|
||||||
|
" fileSystems = {\n"
|
||||||
|
' "/" = lib.mkDefault {\n device = "root_pool/root";\n fsType = "zfs";\n };\n\n'
|
||||||
|
' "/home" = {\n device = "root_pool/home";\n fsType = "zfs";\n };\n\n'
|
||||||
|
' "/var" = {\n device = "root_pool/var";\n fsType = "zfs";\n };\n\n'
|
||||||
|
' "/nix" = {\n device = "root_pool/nix";\n fsType = "zfs";\n };\n\n'
|
||||||
|
' "/boot" = {\n'
|
||||||
|
f' device = "/dev/disk/by-uuid/{get_boot_drive_id(disks[0])}";\n'
|
||||||
|
' fsType = "vfat";\n options = [\n "fmask=0077"\n "dmask=0077"\n ];\n };\n };\n\n'
|
||||||
|
" swapDevices = [ ];\n\n"
|
||||||
|
" networking.useDHCP = lib.mkDefault true;\n\n"
|
||||||
|
' nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";\n'
|
||||||
|
f" hardware.cpu.{cpu_manufacturer}.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;\n"
|
||||||
|
f' networking.hostId = "{host_id}";\n'
|
||||||
|
"}\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
Path(f"{mnt_dir}/etc/nixos/hardware-configuration.nix").write_text(nix_hardware)
|
||||||
|
|
||||||
|
|
||||||
|
def install_nixos(mnt_dir: str, disks: Sequence[str], encrypt: bool) -> None:
|
||||||
|
"""Install NixOS."""
|
||||||
|
bash_wrapper(f"mount -o X-mount.mkdir -t zfs root_pool/root {mnt_dir}")
|
||||||
|
bash_wrapper(f"mount -o X-mount.mkdir -t zfs root_pool/home {mnt_dir}/home")
|
||||||
|
bash_wrapper(f"mount -o X-mount.mkdir -t zfs root_pool/var {mnt_dir}/var")
|
||||||
|
bash_wrapper(f"mount -o X-mount.mkdir -t zfs root_pool/nix {mnt_dir}/nix")
|
||||||
|
|
||||||
|
for disk in disks:
|
||||||
|
bash_wrapper(f"mkfs.vfat -n EFI {disk}-part1")
|
||||||
|
|
||||||
|
# set up mirroring afterwards if more than one disk
|
||||||
|
boot_partition = f"mount -t vfat -o fmask=0077,dmask=0077,iocharset=iso8859-1,X-mount.mkdir {disks[0]}-part1 {mnt_dir}/boot"
|
||||||
|
bash_wrapper(boot_partition)
|
||||||
|
|
||||||
|
bash_wrapper(f"nixos-generate-config --root {mnt_dir}")
|
||||||
|
|
||||||
|
create_nix_hardware_file(mnt_dir, disks, encrypt)
|
||||||
|
|
||||||
|
run(("nixos-install", "--root", mnt_dir), check=True) # noqa: S603
|
||||||
|
|
||||||
|
|
||||||
|
def installer(
|
||||||
|
disks: set[str],
|
||||||
|
swap_size: int,
|
||||||
|
reserve: int,
|
||||||
|
encrypt_key: str | None,
|
||||||
|
) -> None:
|
||||||
|
"""Main."""
|
||||||
|
logging.info("Starting installation")
|
||||||
|
|
||||||
|
for disk in disks:
|
||||||
|
partition_disk(disk, swap_size, reserve)
|
||||||
|
|
||||||
|
if encrypt_key:
|
||||||
|
sleep(1)
|
||||||
|
for command in (
|
||||||
|
f'printf "{encrypt_key}" | cryptsetup luksFormat --type luks2 {disk}-part2 -',
|
||||||
|
f'printf "{encrypt_key}" | cryptsetup luksOpen {disk}-part2 luks-root-pool-{disk.split("/")[-1]}-part2 -',
|
||||||
|
):
|
||||||
|
run(command, shell=True, check=True)
|
||||||
|
|
||||||
|
mnt_dir = "/tmp/nix_install" # noqa: S108
|
||||||
|
|
||||||
|
Path(mnt_dir).mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
if encrypt_key:
|
||||||
|
pool_disks = [
|
||||||
|
f"/dev/mapper/luks-root-pool-{disk.split('/')[-1]}-part2" for disk in disks
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
pool_disks = [f"{disk}-part2" for disk in disks]
|
||||||
|
|
||||||
|
create_zfs_pool(pool_disks, mnt_dir)
|
||||||
|
|
||||||
|
create_zfs_datasets()
|
||||||
|
|
||||||
|
install_nixos(mnt_dir, disks, encrypt_key)
|
||||||
|
|
||||||
|
logging.info("Installation complete")
|
||||||
|
|
||||||
|
|
||||||
|
class Cursor:
|
||||||
|
def __init__(self):
|
||||||
|
self.x_position = 0
|
||||||
|
self.y_position = 0
|
||||||
|
self.height = 0
|
||||||
|
self.width = 0
|
||||||
|
|
||||||
|
def set_height(self, height: int):
|
||||||
|
self.height = height
|
||||||
|
|
||||||
|
def set_width(self, width: int):
|
||||||
|
self.width = width
|
||||||
|
|
||||||
|
def x_bounce_check(self, cursor: int) -> int:
|
||||||
|
cursor = max(0, cursor)
|
||||||
|
return min(self.width - 1, cursor)
|
||||||
|
|
||||||
|
def y_bounce_check(self, cursor: int) -> int:
|
||||||
|
cursor = max(0, cursor)
|
||||||
|
return min(self.height - 1, cursor)
|
||||||
|
|
||||||
|
def set_x(self, x: int):
|
||||||
|
self.x_position = self.x_bounce_check(x)
|
||||||
|
|
||||||
|
def set_y(self, y: int):
|
||||||
|
self.y_position = self.y_bounce_check(y)
|
||||||
|
|
||||||
|
def get_x(self) -> int:
|
||||||
|
return self.x_position
|
||||||
|
|
||||||
|
def get_y(self) -> int:
|
||||||
|
return self.y_position
|
||||||
|
|
||||||
|
def move_up(self):
|
||||||
|
self.set_y(self.y_position - 1)
|
||||||
|
|
||||||
|
def move_down(self):
|
||||||
|
self.set_y(self.y_position + 1)
|
||||||
|
|
||||||
|
def move_left(self):
|
||||||
|
self.set_x(self.x_position - 1)
|
||||||
|
|
||||||
|
def move_right(self):
|
||||||
|
self.set_x(self.x_position + 1)
|
||||||
|
|
||||||
|
def navigation(self, key: int) -> None:
|
||||||
|
action = {
|
||||||
|
curses.KEY_DOWN: self.move_down,
|
||||||
|
curses.KEY_UP: self.move_up,
|
||||||
|
curses.KEY_RIGHT: self.move_right,
|
||||||
|
curses.KEY_LEFT: self.move_left,
|
||||||
|
}
|
||||||
|
|
||||||
|
action.get(key, lambda: None)()
|
||||||
|
|
||||||
|
|
||||||
|
class State:
|
||||||
|
"""State class to store the state of the program."""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.key = 0
|
||||||
|
self.cursor = Cursor()
|
||||||
|
|
||||||
|
self.swap_size = 0
|
||||||
|
self.show_swap_input = False
|
||||||
|
|
||||||
|
self.reserve_size = 0
|
||||||
|
self.show_reserve_input = False
|
||||||
|
|
||||||
|
self.selected_device_ids = set()
|
||||||
|
|
||||||
|
def get_selected_devices(self) -> tuple[str]:
|
||||||
|
"""Get selected devices."""
|
||||||
|
return tuple(self.selected_device_ids)
|
||||||
|
|
||||||
|
|
||||||
|
def get_device(raw_device: str) -> dict[str, str]:
|
||||||
|
raw_device_components = raw_device.split(" ")
|
||||||
|
return {
|
||||||
|
thing.split("=")[0].lower(): thing.split("=")[1].strip('"')
|
||||||
|
for thing in raw_device_components
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def get_devices() -> list[dict[str, str]]:
|
||||||
|
"""Get a list of devices."""
|
||||||
|
# --bytes
|
||||||
|
raw_devices = bash_wrapper("lsblk --paths --pairs").splitlines()
|
||||||
|
return [get_device(raw_device) for raw_device in raw_devices]
|
||||||
|
|
||||||
|
|
||||||
|
def get_device_id_mapping() -> dict[str, set[str]]:
|
||||||
|
"""Get a list of device ids.
|
||||||
|
Returns:
|
||||||
|
list[str]: the list of device ids
|
||||||
|
"""
|
||||||
|
device_ids = bash_wrapper("find /dev/disk/by-id -type l").splitlines()
|
||||||
|
|
||||||
|
device_id_mapping: dict[str, set[str]] = defaultdict(set)
|
||||||
|
|
||||||
|
for device_id in device_ids:
|
||||||
|
device = bash_wrapper(f"readlink -f {device_id}").strip()
|
||||||
|
device_id_mapping[device].add(device_id)
|
||||||
|
|
||||||
|
return device_id_mapping
|
||||||
|
|
||||||
|
|
||||||
|
def calculate_device_menu_padding(
|
||||||
|
devices: list[dict[str, str]], column: str, padding: int = 0
|
||||||
|
) -> int:
|
||||||
|
return max(len(device[column]) for device in devices) + padding
|
||||||
|
|
||||||
|
|
||||||
|
def draw_device_ids(
|
||||||
|
state: State,
|
||||||
|
row_number: int,
|
||||||
|
menu_start_x: int,
|
||||||
|
std_screen: curses.window,
|
||||||
|
menu_width: list[int],
|
||||||
|
device_ids: set[str],
|
||||||
|
) -> tuple[State, int]:
|
||||||
|
for device_id in sorted(device_ids):
|
||||||
|
row_number = row_number + 1
|
||||||
|
if row_number == state.cursor.get_y() and state.cursor.get_x() in menu_width:
|
||||||
|
std_screen.attron(curses.A_BOLD)
|
||||||
|
if state.key == ord(" "):
|
||||||
|
if device_id not in state.selected_device_ids:
|
||||||
|
state.selected_device_ids.add(device_id)
|
||||||
|
else:
|
||||||
|
state.selected_device_ids.remove(device_id)
|
||||||
|
|
||||||
|
if device_id in state.selected_device_ids:
|
||||||
|
std_screen.attron(curses.color_pair(7))
|
||||||
|
|
||||||
|
std_screen.addstr(row_number, menu_start_x, f" {device_id}")
|
||||||
|
|
||||||
|
std_screen.attroff(curses.color_pair(7))
|
||||||
|
std_screen.attroff(curses.A_BOLD)
|
||||||
|
|
||||||
|
return state, row_number
|
||||||
|
|
||||||
|
|
||||||
|
def draw_device_menu(
|
||||||
|
std_screen: curses.window,
|
||||||
|
devices: list[dict[str, str]],
|
||||||
|
device_id_mapping: dict[str, set[str]],
|
||||||
|
state: State,
|
||||||
|
menu_start_y: int = 0,
|
||||||
|
menu_start_x: int = 0,
|
||||||
|
) -> State:
|
||||||
|
"""draw the device menu and handle user input
|
||||||
|
Args:
|
||||||
|
std_screen (curses.window): the curses window to draw on
|
||||||
|
devices (list[dict[str, str]]): the list of devices to draw
|
||||||
|
device_id_mapping (dict[str, set[str]]): the list of device ids to draw
|
||||||
|
state (State): the state object to update
|
||||||
|
menu_start_y (int, optional): the y position to start drawing the menu. Defaults to 0.
|
||||||
|
menu_start_x (int, optional): the x position to start drawing the menu. Defaults to 0.
|
||||||
|
Returns:
|
||||||
|
State: the updated state object
|
||||||
|
"""
|
||||||
|
padding = 2
|
||||||
|
|
||||||
|
name_padding = calculate_device_menu_padding(devices, "name", padding)
|
||||||
|
size_padding = calculate_device_menu_padding(devices, "size", padding)
|
||||||
|
type_padding = calculate_device_menu_padding(devices, "type", padding)
|
||||||
|
mountpoints_padding = calculate_device_menu_padding(devices, "mountpoints", padding)
|
||||||
|
|
||||||
|
device_header = f"{'Name':{name_padding}}{'Size':{size_padding}}{'Type':{type_padding}}{'Mountpoints':{mountpoints_padding}}"
|
||||||
|
|
||||||
|
menu_width = range(menu_start_x, len(device_header) + menu_start_x)
|
||||||
|
|
||||||
|
std_screen.addstr(menu_start_y, menu_start_x, device_header, curses.color_pair(5))
|
||||||
|
devises_list_start = menu_start_y + 1
|
||||||
|
|
||||||
|
row_number = devises_list_start
|
||||||
|
|
||||||
|
for device in devices:
|
||||||
|
row_number = row_number + 1
|
||||||
|
device_name = device["name"]
|
||||||
|
device_row = (
|
||||||
|
f"{device_name:{name_padding}}"
|
||||||
|
f"{device['size']:{size_padding}}"
|
||||||
|
f"{device['type']:{type_padding}}"
|
||||||
|
f"{device['mountpoints']:{mountpoints_padding}}"
|
||||||
|
)
|
||||||
|
std_screen.addstr(row_number, menu_start_x, device_row)
|
||||||
|
|
||||||
|
state, row_number = draw_device_ids(
|
||||||
|
state=state,
|
||||||
|
row_number=row_number,
|
||||||
|
menu_start_x=menu_start_x,
|
||||||
|
std_screen=std_screen,
|
||||||
|
menu_width=menu_width,
|
||||||
|
device_ids=device_id_mapping[device_name],
|
||||||
|
)
|
||||||
|
|
||||||
|
return state, row_number
|
||||||
|
|
||||||
|
|
||||||
|
def debug_menu(std_screen: curses.window, key: int) -> None:
|
||||||
|
height, width = std_screen.getmaxyx()
|
||||||
|
width_height = "Width: {}, Height: {}".format(width, height)
|
||||||
|
std_screen.addstr(height - 4, 0, width_height, curses.color_pair(5))
|
||||||
|
|
||||||
|
key_pressed = f"Last key pressed: {key}"[: width - 1]
|
||||||
|
if key == 0:
|
||||||
|
key_pressed = "No key press detected..."[: width - 1]
|
||||||
|
std_screen.addstr(height - 3, 0, key_pressed)
|
||||||
|
|
||||||
|
for i in range(0, 8):
|
||||||
|
std_screen.addstr(height - 2, i * 3, f"{i}██", curses.color_pair(i))
|
||||||
|
|
||||||
|
|
||||||
|
def status_bar(
|
||||||
|
std_screen: curses.window,
|
||||||
|
cursor: Cursor,
|
||||||
|
width: int,
|
||||||
|
height: int,
|
||||||
|
) -> None:
|
||||||
|
std_screen.attron(curses.A_REVERSE)
|
||||||
|
std_screen.attron(curses.color_pair(3))
|
||||||
|
|
||||||
|
status_bar = (
|
||||||
|
f"Press 'q' to exit | STATUS BAR | Pos: {cursor.get_x()}, {cursor.get_y()}"
|
||||||
|
)
|
||||||
|
std_screen.addstr(height - 1, 0, status_bar)
|
||||||
|
std_screen.addstr(height - 1, len(status_bar), " " * (width - len(status_bar) - 1))
|
||||||
|
|
||||||
|
std_screen.attroff(curses.color_pair(3))
|
||||||
|
std_screen.attroff(curses.A_REVERSE)
|
||||||
|
|
||||||
|
|
||||||
|
def set_color() -> None:
|
||||||
|
curses.start_color()
|
||||||
|
curses.use_default_colors()
|
||||||
|
for i in range(0, curses.COLORS):
|
||||||
|
curses.init_pair(i + 1, i, -1)
|
||||||
|
|
||||||
|
|
||||||
|
def get_text_input(std_screen: curses.window, prompt: str, y: int, x: int) -> str:
|
||||||
|
curses.echo()
|
||||||
|
std_screen.addstr(y, x, prompt)
|
||||||
|
input_str = ""
|
||||||
|
while True:
|
||||||
|
key = std_screen.getch()
|
||||||
|
if key == ord("\n"):
|
||||||
|
break
|
||||||
|
elif key == 27: # ESC key
|
||||||
|
input_str = ""
|
||||||
|
break
|
||||||
|
elif key in (curses.KEY_BACKSPACE, ord("\b"), 127):
|
||||||
|
input_str = input_str[:-1]
|
||||||
|
std_screen.addstr(y, x + len(prompt), input_str + " ")
|
||||||
|
else:
|
||||||
|
input_str += chr(key)
|
||||||
|
std_screen.refresh()
|
||||||
|
curses.noecho()
|
||||||
|
return input_str
|
||||||
|
|
||||||
|
|
||||||
|
def swap_size_input(
|
||||||
|
std_screen: curses.window,
|
||||||
|
state: State,
|
||||||
|
swap_offset: int,
|
||||||
|
) -> State:
|
||||||
|
swap_size_text = "Swap size (GB): "
|
||||||
|
std_screen.addstr(swap_offset, 0, f"{swap_size_text}{state.swap_size}")
|
||||||
|
if state.key == ord("\n") and state.cursor.get_y() == swap_offset:
|
||||||
|
state.show_swap_input = True
|
||||||
|
|
||||||
|
if state.show_swap_input:
|
||||||
|
swap_size_str = get_text_input(std_screen, swap_size_text, swap_offset, 0)
|
||||||
|
try:
|
||||||
|
state.swap_size = int(swap_size_str)
|
||||||
|
state.show_swap_input = False
|
||||||
|
except ValueError:
|
||||||
|
std_screen.addstr(
|
||||||
|
swap_offset, 0, "Invalid input. Press any key to continue."
|
||||||
|
)
|
||||||
|
std_screen.getch()
|
||||||
|
state.show_swap_input = False
|
||||||
|
|
||||||
|
return state
|
||||||
|
|
||||||
|
|
||||||
|
def reserve_size_input(
|
||||||
|
std_screen: curses.window,
|
||||||
|
state: State,
|
||||||
|
reserve_offset: int,
|
||||||
|
) -> State:
|
||||||
|
reserve_size_text = "reserve size (GB): "
|
||||||
|
std_screen.addstr(reserve_offset, 0, f"{reserve_size_text}{state.reserve_size}")
|
||||||
|
if state.key == ord("\n") and state.cursor.get_y() == reserve_offset:
|
||||||
|
state.show_reserve_input = True
|
||||||
|
|
||||||
|
if state.show_reserve_input:
|
||||||
|
reserve_size_str = get_text_input(
|
||||||
|
std_screen, reserve_size_text, reserve_offset, 0
|
||||||
|
)
|
||||||
|
try:
|
||||||
|
state.reserve_size = int(reserve_size_str)
|
||||||
|
state.show_reserve_input = False
|
||||||
|
except ValueError:
|
||||||
|
std_screen.addstr(
|
||||||
|
reserve_offset, 0, "Invalid input. Press any key to continue."
|
||||||
|
)
|
||||||
|
std_screen.getch()
|
||||||
|
state.show_reserve_input = False
|
||||||
|
|
||||||
|
return state
|
||||||
|
|
||||||
|
|
||||||
|
def draw_menu(std_screen: curses.window) -> State:
|
||||||
|
"""draw the menu and handle user input
|
||||||
|
Args:
|
||||||
|
std_screen (curses.window): the curses window to draw on
|
||||||
|
Returns:
|
||||||
|
State: the state object
|
||||||
|
"""
|
||||||
|
# Clear and refresh the screen for a blank canvas
|
||||||
|
std_screen.clear()
|
||||||
|
std_screen.refresh()
|
||||||
|
|
||||||
|
set_color()
|
||||||
|
|
||||||
|
state = State()
|
||||||
|
|
||||||
|
devices = get_devices()
|
||||||
|
|
||||||
|
device_id_mapping = get_device_id_mapping()
|
||||||
|
|
||||||
|
# Loop where k is the last character pressed
|
||||||
|
while state.key != ord("q"):
|
||||||
|
std_screen.clear()
|
||||||
|
height, width = std_screen.getmaxyx()
|
||||||
|
|
||||||
|
state.cursor.set_height(height)
|
||||||
|
state.cursor.set_width(width)
|
||||||
|
|
||||||
|
state.cursor.navigation(state.key)
|
||||||
|
|
||||||
|
state, device_menu_size = draw_device_menu(
|
||||||
|
std_screen=std_screen,
|
||||||
|
state=state,
|
||||||
|
devices=devices,
|
||||||
|
device_id_mapping=device_id_mapping,
|
||||||
|
)
|
||||||
|
|
||||||
|
swap_offset = device_menu_size + 2
|
||||||
|
|
||||||
|
swap_size_input(
|
||||||
|
std_screen=std_screen,
|
||||||
|
state=state,
|
||||||
|
swap_offset=swap_offset,
|
||||||
|
)
|
||||||
|
reserve_size_input(
|
||||||
|
std_screen=std_screen,
|
||||||
|
state=state,
|
||||||
|
reserve_offset=swap_offset + 1,
|
||||||
|
)
|
||||||
|
|
||||||
|
status_bar(std_screen, state.cursor, width, height)
|
||||||
|
|
||||||
|
debug_menu(std_screen, state.key)
|
||||||
|
|
||||||
|
std_screen.move(state.cursor.get_y(), state.cursor.get_x())
|
||||||
|
|
||||||
|
std_screen.refresh()
|
||||||
|
|
||||||
|
state.key = std_screen.getch()
|
||||||
|
|
||||||
|
return state
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
configure_logger("DEBUG")
|
||||||
|
|
||||||
|
state = curses.wrapper(draw_menu)
|
||||||
|
|
||||||
|
encrypt_key = getenv("ENCRYPT_KEY")
|
||||||
|
|
||||||
|
logging.info("installing_nixos")
|
||||||
|
logging.info(f"disks: {state.selected_device_ids}")
|
||||||
|
logging.info(f"swap_size: {state.swap_size}")
|
||||||
|
logging.info(f"reserve: {state.reserve_size}")
|
||||||
|
logging.info(f"encrypted: {bool(encrypt_key)}")
|
||||||
|
|
||||||
|
sleep(3)
|
||||||
|
|
||||||
|
installer(
|
||||||
|
disks=state.get_selected_devices(),
|
||||||
|
swap_size=state.swap_size,
|
||||||
|
reserve=state.reserve_size,
|
||||||
|
encrypt_key=encrypt_key,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
14
treefmt.toml
Normal file
14
treefmt.toml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# One CLI to format the code tree - https://github.com/numtide/treefmt
|
||||||
|
|
||||||
|
[global]
|
||||||
|
# Glob patterns of files to exclude
|
||||||
|
excludes = [".git/"]
|
||||||
|
|
||||||
|
|
||||||
|
[formatter.nixfmt]
|
||||||
|
# Formatter to run
|
||||||
|
command = "nixfmt"
|
||||||
|
# Command-line arguments for the command
|
||||||
|
#options = []
|
||||||
|
# Glob pattern of files to include
|
||||||
|
includes = ["*.nix"]
|
||||||
30
users/gaming/default.nix
Normal file
30
users/gaming/default.nix
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
sops.secrets.gaming_password = {
|
||||||
|
sopsFile = ../secrets.yaml;
|
||||||
|
neededForUsers = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
users = {
|
||||||
|
users.gaming = {
|
||||||
|
isNormalUser = true;
|
||||||
|
hashedPasswordFile = "${config.sops.secrets.gaming_password.path}";
|
||||||
|
|
||||||
|
shell = pkgs.zsh;
|
||||||
|
group = "gaming";
|
||||||
|
extraGroups = [
|
||||||
|
"audio"
|
||||||
|
"video"
|
||||||
|
"users"
|
||||||
|
];
|
||||||
|
uid = 1100;
|
||||||
|
};
|
||||||
|
|
||||||
|
groups.gaming.gid = 1100;
|
||||||
|
};
|
||||||
|
home-manager.users.gaming = import ./systems/${config.networking.hostName}.nix;
|
||||||
|
}
|
||||||
17
users/gaming/home/global.nix
Normal file
17
users/gaming/home/global.nix
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./programs.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
home-manager.enable = true;
|
||||||
|
git.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
home = {
|
||||||
|
username = "gaming";
|
||||||
|
homeDirectory = "/home/${config.home.username}";
|
||||||
|
stateVersion = "24.05";
|
||||||
|
};
|
||||||
|
}
|
||||||
8
users/gaming/home/programs.nix
Normal file
8
users/gaming/home/programs.nix
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
chromium
|
||||||
|
vscode
|
||||||
|
firefox
|
||||||
|
];
|
||||||
|
}
|
||||||
5
users/gaming/systems/bob.nix
Normal file
5
users/gaming/systems/bob.nix
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
imports = [
|
||||||
|
../home/global.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
30
users/megan/default.nix
Normal file
30
users/megan/default.nix
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
sops.secrets.megan_password = {
|
||||||
|
sopsFile = ../secrets.yaml;
|
||||||
|
neededForUsers = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
users = {
|
||||||
|
users.megan = {
|
||||||
|
isNormalUser = true;
|
||||||
|
hashedPasswordFile = "${config.sops.secrets.megan_password.path}";
|
||||||
|
|
||||||
|
shell = pkgs.zsh;
|
||||||
|
group = "megan";
|
||||||
|
extraGroups = [
|
||||||
|
"audio"
|
||||||
|
"video"
|
||||||
|
"users"
|
||||||
|
];
|
||||||
|
uid = 1101;
|
||||||
|
};
|
||||||
|
|
||||||
|
groups.megan.gid = 1101;
|
||||||
|
};
|
||||||
|
home-manager.users.megan = import ./systems/${config.networking.hostName}.nix;
|
||||||
|
}
|
||||||
9
users/megan/home/cli/default.nix
Normal file
9
users/megan/home/cli/default.nix
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./direnv.nix
|
||||||
|
./git.nix
|
||||||
|
./zsh.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.starship.enable = true;
|
||||||
|
}
|
||||||
8
users/megan/home/cli/direnv.nix
Normal file
8
users/megan/home/cli/direnv.nix
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
programs.direnv = {
|
||||||
|
enable = true;
|
||||||
|
enableZshIntegration = true;
|
||||||
|
nix-direnv.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
12
users/megan/home/cli/git.nix
Normal file
12
users/megan/home/cli/git.nix
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
programs.git = {
|
||||||
|
enable = true;
|
||||||
|
userEmail = "mousikos112@gmail.com";
|
||||||
|
userName = "megan";
|
||||||
|
extraConfig = {
|
||||||
|
pull.rebase = true;
|
||||||
|
color.ui = true;
|
||||||
|
};
|
||||||
|
lfs.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
31
users/megan/home/cli/zsh.nix
Normal file
31
users/megan/home/cli/zsh.nix
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
programs.zsh = {
|
||||||
|
enable = true;
|
||||||
|
syntaxHighlighting.enable = true;
|
||||||
|
history.size = 10000;
|
||||||
|
oh-my-zsh = {
|
||||||
|
enable = true;
|
||||||
|
plugins = [
|
||||||
|
"git"
|
||||||
|
"docker"
|
||||||
|
"docker-compose"
|
||||||
|
"colored-man-pages"
|
||||||
|
"rust"
|
||||||
|
"systemd"
|
||||||
|
"tmux"
|
||||||
|
"ufw"
|
||||||
|
"z"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
shellAliases = {
|
||||||
|
"lrt" = "eza --icons -lsnew";
|
||||||
|
"ls" = "eza";
|
||||||
|
"ll" = "eza --long --group";
|
||||||
|
"la" = "eza --all";
|
||||||
|
|
||||||
|
"rspace" = "'for f in *\ *; do mv \"$f\" \"\${f// /_}\"; done'";
|
||||||
|
"rebuild" = "sudo nixos-rebuild switch --flake /home/richie/dotfiles#$HOST";
|
||||||
|
"nix-test" = "nixos-rebuild test --flake /home/richie/dotfiles";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
18
users/megan/home/global.nix
Normal file
18
users/megan/home/global.nix
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./cli
|
||||||
|
./programs.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
home-manager.enable = true;
|
||||||
|
git.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
home = {
|
||||||
|
username = "megan";
|
||||||
|
homeDirectory = "/home/${config.home.username}";
|
||||||
|
stateVersion = "24.05";
|
||||||
|
};
|
||||||
|
}
|
||||||
42
users/megan/home/programs.nix
Normal file
42
users/megan/home/programs.nix
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
# cli
|
||||||
|
bat
|
||||||
|
btop
|
||||||
|
eza
|
||||||
|
fd
|
||||||
|
ffmpegthumbnailer
|
||||||
|
fzf
|
||||||
|
git
|
||||||
|
gnupg
|
||||||
|
imagemagick
|
||||||
|
jq
|
||||||
|
ncdu
|
||||||
|
neofetch
|
||||||
|
ouch
|
||||||
|
p7zip
|
||||||
|
poppler
|
||||||
|
rar
|
||||||
|
ripgrep
|
||||||
|
starship
|
||||||
|
tmux
|
||||||
|
unzip
|
||||||
|
yazi
|
||||||
|
zoxide
|
||||||
|
# system info
|
||||||
|
hwloc
|
||||||
|
lynis
|
||||||
|
pciutils
|
||||||
|
smartmontools
|
||||||
|
usbutils
|
||||||
|
# networking
|
||||||
|
iperf3
|
||||||
|
nmap
|
||||||
|
wget
|
||||||
|
# python
|
||||||
|
poetry
|
||||||
|
python313
|
||||||
|
ruff
|
||||||
|
];
|
||||||
|
}
|
||||||
5
users/megan/systems/jeeves.nix
Normal file
5
users/megan/systems/jeeves.nix
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
imports = [
|
||||||
|
../home/global.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -2,30 +2,51 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups;
|
ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups;
|
||||||
in {
|
in
|
||||||
users.users.richie = {
|
{
|
||||||
isNormalUser = true;
|
|
||||||
shell = pkgs.zsh;
|
sops.secrets.richie_password = {
|
||||||
openssh.authorizedKeys.keys = [
|
sopsFile = ../secrets.yaml;
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIPtuYhiJHRTYhNaDmTcJOqJASk7D8mIn6u3F1IN5AFJ bob" # cspell:disable-line
|
neededForUsers = true;
|
||||||
];
|
};
|
||||||
extraGroups =
|
|
||||||
[
|
users = {
|
||||||
"audio"
|
users.richie = {
|
||||||
"video"
|
isNormalUser = true;
|
||||||
"wheel"
|
|
||||||
]
|
hashedPasswordFile = "${config.sops.secrets.richie_password.path}";
|
||||||
++ ifTheyExist [
|
|
||||||
"dialout"
|
shell = pkgs.zsh;
|
||||||
"docker"
|
group = "richie";
|
||||||
"libvirtd"
|
openssh.authorizedKeys.keys = [
|
||||||
"networkmanager"
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJYZFsc9CSH03ZUP7y81AHwSyjLwFmcshVFCyxDcYhBT rhapsody-in-green" # cspell:disable-line
|
||||||
"plugdev"
|
];
|
||||||
"uaccess"
|
extraGroups =
|
||||||
"wireshark"
|
[
|
||||||
];
|
"audio"
|
||||||
|
"video"
|
||||||
|
"wheel"
|
||||||
|
"users"
|
||||||
|
]
|
||||||
|
++ ifTheyExist [
|
||||||
|
"dialout"
|
||||||
|
"docker"
|
||||||
|
"hass"
|
||||||
|
"libvirtd"
|
||||||
|
"networkmanager"
|
||||||
|
"plugdev"
|
||||||
|
"scanner"
|
||||||
|
"transmission"
|
||||||
|
"uaccess"
|
||||||
|
"wireshark"
|
||||||
|
];
|
||||||
|
uid = 1000;
|
||||||
|
};
|
||||||
|
|
||||||
|
groups.richie.gid = 1000;
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager.users.richie = import ./systems/${config.networking.hostName}.nix;
|
home-manager.users.richie = import ./systems/${config.networking.hostName}.nix;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user