Compare commits
438 commits
Author | SHA1 | Date | |
---|---|---|---|
06d9119ded | |||
6f8940cfd0 | |||
2ae93bc6b8 | |||
07f8769ab1 | |||
3106a6b880 | |||
fd54cac952 | |||
9dee168383 | |||
e82b9d5306 | |||
d428ee9383 | |||
80a1a53705 | |||
16cfea7855 | |||
5d6ed1be6e | |||
86b7e0b1ec | |||
79e642451a | |||
e61ada3cd2 | |||
18d1178d85 | |||
72611337ab | |||
129aa3224e | |||
f0f4db1be0 | |||
928bded3fd | |||
20d2fc6b76 | |||
ccdfcd1912 | |||
e422f95bb4 | |||
520f7441d9 | |||
761e0487ee | |||
fe75a68081 | |||
0a003e14b5 | |||
e0795c6f43 | |||
aedeec6600 | |||
194c140dc1 | |||
b47c11362d | |||
1cbded50f0 | |||
1ad2610b01 | |||
265be6521c | |||
717196a4e5 | |||
42dcc63d9e | |||
c39d5435ee | |||
05f9729966 | |||
381a0359db | |||
037f59f415 | |||
1229c8034a | |||
4cd5cc98cc | |||
c70e585569 | |||
70d794c753 | |||
e76841b841 | |||
a592eb69dd | |||
9554dd40f4 | |||
40e8fb874a | |||
e79238f15f | |||
2b9805c47f | |||
9f93771440 | |||
821b36b8c2 | |||
0a1029e788 | |||
652cc7801f | |||
309ada567b | |||
e76a45b7ab | |||
6335bb3f46 | |||
9724f5f10e | |||
265a10660e | |||
d3919fce27 | |||
c14a7906c8 | |||
a2978995a3 | |||
6bcbadfdb1 | |||
f06b0d9c5b | |||
dafb2cf8ce | |||
c3fa6e92ee | |||
f98e61f5fe | |||
a4499f3cd4 | |||
0fa79307c1 | |||
9ea4b26421 | |||
c5c1dfe63b | |||
087dd2af15 | |||
94bd0d81f5 | |||
755ef78440 | |||
eba41259b4 | |||
8aa6f5b2b0 | |||
d8ef7d99ed | |||
c91c8e703e | |||
cf4cfa8b6a | |||
be865cc86f | |||
2861935ddd | |||
24aa4b9842 | |||
bc753eb285 | |||
fef7e37f17 | |||
e1dd7909e0 | |||
59675a6d1f | |||
1928a74e90 | |||
3e4486dc33 | |||
71058f3ea6 | |||
28615e8152 | |||
a79cb29aaf | |||
f0b721c12d | |||
be905e8d76 | |||
346fee51ca | |||
2487d2db64 | |||
04b8aba9e7 | |||
b04d77f43f | |||
85ce0e06f7 | |||
cc9cb421c8 | |||
dbc4e70900 | |||
ffb8b9f154 | |||
d4d98bba73 | |||
b09cceb259 | |||
d823b36559 | |||
8ebc6de43e | |||
a8a278202c | |||
8c8c62bb6e | |||
cfb4ab02f0 | |||
2c6bc8215d | |||
c7bf2a1b18 | |||
3923dcb604 | |||
85ff6af1bf | |||
aa979f0fe4 | |||
0a5c8d03bd | |||
aac17cff3e | |||
4173e8bef3 | |||
f33090798d | |||
4b7fa67767 | |||
59d2205e7a | |||
827bf6ba8c | |||
acd4ebc1e2 | |||
38019afcef | |||
18d42f406e | |||
5ad37a0439 | |||
92398d5cbf | |||
b307e7df13 | |||
3e1df66156 | |||
423dcaf7fa | |||
8a9516e5b1 | |||
c701e335d1 | |||
b3b65c1bd9 | |||
8e98d62921 | |||
998c952bab | |||
6af0cef436 | |||
44d56aab0f | |||
262bcedbd2 | |||
322aeebd45 | |||
60bc645ae0 | |||
970a380805 | |||
9c1f5c271c | |||
96067d726b | |||
f50ee16e0f | |||
092626a7db | |||
800eee46f2 | |||
690ff6498b | |||
2df8ab7e48 | |||
8f0ec20dcf | |||
628ccd1758 | |||
90e573a698 | |||
7941c8cf35 | |||
89ebaa520f | |||
cc2329ec67 | |||
c4095afd16 | |||
d13e984368 | |||
031a36acdd | |||
8af4a53238 | |||
cc57e70de5 | |||
d230f9fabe | |||
1bc2b60d6a | |||
640c3aec06 | |||
b05864573d | |||
dc1b120c50 | |||
fdea25896e | |||
13abafb1b2 | |||
f793e546f6 | |||
9c91d8634f | |||
7600d2f4cf | |||
b28f07d9db | |||
fc98b6020d | |||
3412b79c1b | |||
c6dea3b93d | |||
423553b292 | |||
de44eef38d | |||
7a78e34479 | |||
a29dd7f1d2 | |||
52242e645a | |||
2a8eb46b03 | |||
4fb8fab641 | |||
efb2ae0425 | |||
35645b93a6 | |||
79c293f29f | |||
23ee3bfab9 | |||
8242426c66 | |||
49aa21cf32 | |||
3a4100cb28 | |||
61b3fc2c75 | |||
04f5aa0f4b | |||
185ce55dbc | |||
ac15f698b0 | |||
4405ad4bf9 | |||
b1db2f2f85 | |||
9a7659814c | |||
ce25e44e57 | |||
128bad02f3 | |||
f4473b23b4 | |||
b063022753 | |||
011b80e760 | |||
2413c5b74f | |||
1bb3f8e5e1 | |||
a69f665865 | |||
d6998d84d0 | |||
5712f36177 | |||
16c948d70e | |||
aae39388b2 | |||
bf0eb1bb86 | |||
045eb7bb00 | |||
8319e4b87b | |||
7e7dde4c6f | |||
702f0a4d64 | |||
2ceaaeff76 | |||
724ced18f1 | |||
261efa8768 | |||
df6fc2d165 | |||
2789cbed33 | |||
4a2ba58cd4 | |||
e11914aa08 | |||
261f1f0f34 | |||
686d459f9c | |||
85a3c28438 | |||
c119757766 | |||
fc712b5223 | |||
c928cc2a86 | |||
eb36ad141b | |||
a504df00e9 | |||
27f1d01f31 | |||
a793ff8a13 | |||
22267e6c2e | |||
e581ce4582 | |||
4a396a28cc | |||
ba8c00497d | |||
3efa0d6230 | |||
917e5ae3fc | |||
beee9a7521 | |||
965466bf7e | |||
87d99ffbb2 | |||
1d0bc7a680 | |||
7c396e7615 | |||
b16a3b499c | |||
cb6a5f62f8 | |||
f9113c5334 | |||
8abca33123 | |||
dfcb1411fa | |||
32113a2b75 | |||
c98d947c26 | |||
09fa6eba73 | |||
b37246474c | |||
638957dbb5 | |||
1b22a41415 | |||
b94a738734 | |||
42d8107399 | |||
ecbabde0bd | |||
eea2b60b91 | |||
d17a69372a | |||
927a3fbfb1 | |||
8912b55ff9 | |||
8ea8963d9c | |||
e8e534a4ad | |||
6ddeafa403 | |||
edac66e017 | |||
b869da9668 | |||
31c3cd5f7d | |||
bde58a622d | |||
cab5bfa648 | |||
f08e17f51b | |||
158f0a6813 | |||
7ea031e84e | |||
ef22af1ee9 | |||
a51db7b00f | |||
fe7b03dd4a | |||
14081936af | |||
bfc7e894bf | |||
29bc56e749 | |||
b27ca31c71 | |||
5a1d50cece | |||
d11b941ead | |||
df78fafcb9 | |||
5faee0c1b4 | |||
7b7b451ab1 | |||
1230f92f70 | |||
55e49ea248 | |||
d1d36e28c6 | |||
|
906a6ddf84 | ||
3d367b0230 | |||
1471de3400 | |||
80ab476c80 | |||
6be9d173b6 | |||
7893d37df5 | |||
|
a72a054632 | ||
|
bd5b0dcec8 | ||
60de780156 | |||
|
2fd1f95b79 | ||
b70dcb797d | |||
6fd17209c7 | |||
67671e5568 | |||
|
4da31089e7 | ||
1e448f8ae2 | |||
ac16dde84e | |||
a44d11d20c | |||
a59961171a | |||
8667fbe805 | |||
9efff85115 | |||
5fb5e08ebd | |||
|
e502c23c02 | ||
cd6c33ce9a | |||
a6c90f335c | |||
66d8dc24b9 | |||
d896a0e3f3 | |||
e4384c5434 | |||
0861880a20 | |||
7a52fc6beb | |||
8acc916117 | |||
5f9dca81e1 | |||
684b8a5c9e | |||
638430a8e3 | |||
682db6c529 | |||
8d04980e50 | |||
31a3cfcaca | |||
9a57b0b425 | |||
86772cf04d | |||
1c67489caa | |||
8b561153bc | |||
8f08976322 | |||
9ee721e52f | |||
9102eccddf | |||
e3dc44a511 | |||
550870728f | |||
c1e0932486 | |||
2326ea6bb9 | |||
4f4b1e5140 | |||
5eeb29677d | |||
4f473a4248 | |||
cefaec73be | |||
c1e85636ae | |||
117c517810 | |||
6942e77ed3 | |||
71066fad02 | |||
068a005108 | |||
69f6134563 | |||
b0323e5fe1 | |||
39fb08bc48 | |||
4f81012634 | |||
0a3464bb12 | |||
b034a294cb | |||
064b6b07f9 | |||
5c7aca6b4a | |||
9b749922ea | |||
772374b0fd | |||
c8f8dc98e6 | |||
0667f0f4c9 | |||
9c9945523c | |||
8ccc90c9f3 | |||
8deffb3adb | |||
6753c39ccd | |||
a7c57a6501 | |||
691faaaec3 | |||
ac2b846662 | |||
3348300ab7 | |||
7691490e00 | |||
ac9aa96522 | |||
551880cc24 | |||
63be8a848c | |||
d649c7cee5 | |||
e56ccb5a97 | |||
23acd9ef5d | |||
06e12f7bb1 | |||
9a9cfc13f6 | |||
384e0c24b3 | |||
0665c3bfae | |||
177f8555a3 | |||
3b6033da4f | |||
107f3a0e3e | |||
85473011b2 | |||
ac29acb446 | |||
595e3996c3 | |||
c738d4137f | |||
5285b166b2 | |||
b01190a532 | |||
bc4be97591 | |||
315a06dbf2 | |||
dfa762d46e | |||
f4618c3271 | |||
5fd6448ba2 | |||
1ca52dc2ae | |||
f2710d1c19 | |||
585d764720 | |||
2caeb6f438 | |||
e1d746b0f5 | |||
b12b2e2911 | |||
534fb9d449 | |||
31c3dbb205 | |||
b7b25ea3cc | |||
d625b740be | |||
40ee4f048c | |||
6cf090e2f2 | |||
bc1efb0d25 | |||
99545ac48e | |||
731b85c948 | |||
b6c4957043 | |||
d31502f1da | |||
a8ec0fcfff | |||
2af97f6b5a | |||
a1400a2335 | |||
7f8b1e586c | |||
bc18bbcf82 | |||
ea9ed3f8dc | |||
32e5e90b16 | |||
354ad470f4 | |||
ab6e7efc1c | |||
8eaf865994 | |||
4dd98e97c1 | |||
3b32b5c302 | |||
4e1ad1c8f6 | |||
bab5698f39 | |||
94ce797784 | |||
d98290a6e4 | |||
27ff75260d | |||
a676406150 | |||
639a623db3 | |||
2216e1414d | |||
aa7b215055 | |||
244fd6daad | |||
c93185e9e8 | |||
45119487c3 | |||
dd7b67e811 | |||
6881d583b7 | |||
d232f20334 | |||
50b1565bf5 | |||
c6d7ffa4b6 | |||
4bc6445a4c | |||
820729a03d | |||
118fac38a8 | |||
29d5cf6844 | |||
555d1db3ba | |||
d2a2878c11 | |||
3d03229682 | |||
9994dadd6f | |||
b1162ce7a8 | |||
974d231027 |
549 changed files with 22644 additions and 18333 deletions
25
.gitignore
vendored
25
.gitignore
vendored
|
@ -1,9 +1,22 @@
|
||||||
|
# Python
|
||||||
*.egg-info
|
*.egg-info
|
||||||
*.temp
|
|
||||||
*node_modules/
|
# NPM
|
||||||
*types
|
*node_modules
|
||||||
*build/
|
*build/
|
||||||
result*
|
|
||||||
*config.js
|
# Direnv
|
||||||
*icons
|
|
||||||
*.direnv/
|
*.direnv/
|
||||||
|
|
||||||
|
# Generated by nix
|
||||||
|
result*
|
||||||
|
.nixd.json
|
||||||
|
|
||||||
|
## AGS
|
||||||
|
nixosModules/ags/config/ts/lockscreen/vars.ts
|
||||||
|
**/config.js
|
||||||
|
*icons
|
||||||
|
**/types
|
||||||
|
|
||||||
|
# Other
|
||||||
|
*.temp
|
||||||
|
|
33
README.md
33
README.md
|
@ -6,7 +6,7 @@ You might find it weird that most of my config is written in TypeScript.
|
||||||
That's because all my desktops run
|
That's because all my desktops run
|
||||||
[AGS](https://github.com/Aylur/ags)
|
[AGS](https://github.com/Aylur/ags)
|
||||||
for UI. Click on
|
for UI. Click on
|
||||||
[this](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/modules/ags)
|
[this](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/nixosModules/ags)
|
||||||
to see my configuration.
|
to see my configuration.
|
||||||
|
|
||||||
I'm also a victim of Stockholm syndrome at this point and make my scripts
|
I'm also a victim of Stockholm syndrome at this point and make my scripts
|
||||||
|
@ -17,10 +17,8 @@ in TypeScript because it's the scripting language I am most comfortable with.
|
||||||
### General
|
### General
|
||||||
|
|
||||||
This repo is the complete configuration of machines I own,
|
This repo is the complete configuration of machines I own,
|
||||||
running NixOS or Nix. I tend to mix Home-Manager and NixOS
|
running NixOS or Nix. Its structure is based on a flake's
|
||||||
a lot to make my custom modules by using my global vars system
|
[outputs](https://wiki.nixos.org/wiki/Flakes#Output_schema).
|
||||||
explained
|
|
||||||
[here](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/devices)
|
|
||||||
|
|
||||||
### Flake Location
|
### Flake Location
|
||||||
|
|
||||||
|
@ -44,12 +42,21 @@ sudo ln -sf /home/matt/.nix /etc/nixos
|
||||||
| ---------------------------------- | ----------- |
|
| ---------------------------------- | ----------- |
|
||||||
| `nixosConfigurations` | [devices](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/devices)' + ISO's configurations |
|
| `nixosConfigurations` | [devices](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/devices)' + ISO's configurations |
|
||||||
| `nixOnDroidConfigurations.default` | [Nix-On-Droid](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/devices/android)'s configuration |
|
| `nixOnDroidConfigurations.default` | [Nix-On-Droid](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/devices/android)'s configuration |
|
||||||
| `formatter` | I have yet to know if this has any uses but I format with [alejandra](https://github.com/kamadorueda/alejandra) |
|
| `packages` | Some custom [packages](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/packages) not available in nixpkgs or modified from it |
|
||||||
|
| `legacyPackages` | Some custom [package scopes](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/legacyPackages) not available in nixpkgs or modified from it |
|
||||||
|
| `apps` | Scripts ran from the flake defined [here](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/apps) |
|
||||||
|
| `homeManagerModules` | [Modules](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/homeManagerModules) made for home-manager |
|
||||||
|
| `homeManagerModules` | [Modules](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/nixosModules) made for NixOS systems |
|
||||||
|
| `formatter` | I format nix code with [alejandra](https://github.com/kamadorueda/alejandra) |
|
||||||
| `devShells.default` | A dev shell to build an ISO from the live-image nixosConfiguration |
|
| `devShells.default` | A dev shell to build an ISO from the live-image nixosConfiguration |
|
||||||
|
| `devShells.ags` | A dev shell to have a NodeJS env when I enter my AGS's config directory |
|
||||||
|
|
||||||
### Flake Inputs
|
### Flake Inputs
|
||||||
|
|
||||||
I prefer using a more descriptive format for my inputs like so:
|
To allow use of the full nix language for my inputs, I use [genflake](https://github.com/jorsn/flakegen).
|
||||||
|
Therefore, the flake I edit is located at `./outputs.nix`.
|
||||||
|
|
||||||
|
I also prefer using a more descriptive format for my inputs like so:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
nixpkgs = {
|
nixpkgs = {
|
||||||
|
@ -67,29 +74,23 @@ nixpkgs = {
|
||||||
|
|
||||||
to make it more clear what is what in the flake URI
|
to make it more clear what is what in the flake URI
|
||||||
|
|
||||||
I also have a long list of inputs with `flake = false;` because
|
|
||||||
it makes it easier to update non-flake custom packages or overlays
|
|
||||||
to have the latest git. I make sure to end the names of these inputs
|
|
||||||
with `src` to make it clear what they are.
|
|
||||||
|
|
||||||
### Secrets
|
### Secrets
|
||||||
|
|
||||||
All my secrets are in a private git repo that makes use of
|
All my secrets are in a private git repo that makes use of
|
||||||
[sops-nix](https://github.com/Mic92/sops-nix).
|
[sops-nix](https://github.com/Mic92/sops-nix).
|
||||||
I only use secrets stored in `JSON` and generate `.sops.yaml`
|
I generate `.sops.yaml` from `.sops.nix`:
|
||||||
from `.sops.nix`:
|
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
let
|
let
|
||||||
wim = "somekey";
|
wim = "somekey";
|
||||||
oksys = "somekey2";
|
binto = "somekey2";
|
||||||
in {
|
in {
|
||||||
creation_rules = [
|
creation_rules = [
|
||||||
{
|
{
|
||||||
path_regex = "secrets/[^/]+\\.(yaml|json|env|ini)$";
|
path_regex = "secrets/[^/]+\\.(yaml|json|env|ini)$";
|
||||||
key_groups = [
|
key_groups = [
|
||||||
{
|
{
|
||||||
age = [wim oksys];
|
age = [wim binto];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
14
apps/default.nix
Normal file
14
apps/default.nix
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
inputs,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (pkgs.lib) getExe;
|
||||||
|
|
||||||
|
mkApp = file: {
|
||||||
|
program = getExe (pkgs.callPackage file ({} // inputs));
|
||||||
|
type = "app";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
updateFlake = mkApp ./update;
|
||||||
|
}
|
1
apps/update/.envrc
Normal file
1
apps/update/.envrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
use flake $FLAKE#node
|
33
apps/update/default.nix
Normal file
33
apps/update/default.nix
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
buildNpmPackage,
|
||||||
|
callPackage,
|
||||||
|
makeWrapper,
|
||||||
|
nodejs_latest,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) concatMapStringsSep getBin;
|
||||||
|
inherit (builtins) readFile fromJSON;
|
||||||
|
|
||||||
|
packageJSON = fromJSON (readFile ./package.json);
|
||||||
|
in
|
||||||
|
buildNpmPackage rec {
|
||||||
|
pname = packageJSON.name;
|
||||||
|
inherit (packageJSON) version;
|
||||||
|
|
||||||
|
src = ./.;
|
||||||
|
npmDepsHash = "sha256-qpnQSJNl68LrsU8foJYxdBXpoFj7VKQahC9DFmleWTs=";
|
||||||
|
|
||||||
|
runtimeInputs = [
|
||||||
|
(callPackage ../../nixosModules/docker/updateImage.nix {})
|
||||||
|
];
|
||||||
|
nativeBuildInputs = [makeWrapper];
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
wrapProgram $out/bin/${pname} \
|
||||||
|
--prefix PATH : ${concatMapStringsSep ":" (p: getBin p) runtimeInputs}
|
||||||
|
'';
|
||||||
|
|
||||||
|
nodejs = nodejs_latest;
|
||||||
|
meta.mainProgram = pname;
|
||||||
|
}
|
464
apps/update/eslint.config.js
Normal file
464
apps/update/eslint.config.js
Normal file
|
@ -0,0 +1,464 @@
|
||||||
|
// TODO: switch to typescript https://github.com/eslint/eslint/pull/18134
|
||||||
|
|
||||||
|
import eslint from '@eslint/js';
|
||||||
|
import tseslint from 'typescript-eslint';
|
||||||
|
import stylistic from '@stylistic/eslint-plugin';
|
||||||
|
// import stylisticRules from '@stylistic/eslint-plugin/rule-options';
|
||||||
|
import jsdoc from 'eslint-plugin-jsdoc';
|
||||||
|
|
||||||
|
|
||||||
|
export default tseslint.config(
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
parserOptions: {
|
||||||
|
project: true,
|
||||||
|
tsconfigDirName: import.meta.dirname,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
plugins: {
|
||||||
|
jsdoc,
|
||||||
|
// @ts-expect-error this works
|
||||||
|
'@stylistic': stylistic, // as typeof stylisticRules,
|
||||||
|
},
|
||||||
|
|
||||||
|
extends: [
|
||||||
|
eslint.configs.recommended,
|
||||||
|
jsdoc.configs['flat/recommended-typescript'],
|
||||||
|
...tseslint.configs.recommended,
|
||||||
|
],
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
// JSDoc settings
|
||||||
|
'jsdoc/tag-lines': ['warn', 'any', { startLines: 1 }],
|
||||||
|
'jsdoc/check-line-alignment': ['warn', 'always', {
|
||||||
|
tags: ['param', 'arg', 'argument', 'property', 'prop'],
|
||||||
|
}],
|
||||||
|
|
||||||
|
// Newer settings
|
||||||
|
'@typescript-eslint/no-extraneous-class': ['off'],
|
||||||
|
'@typescript-eslint/no-implied-eval': ['off'],
|
||||||
|
|
||||||
|
// Pre-flat config
|
||||||
|
'@typescript-eslint/no-unused-vars': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
args: 'all',
|
||||||
|
argsIgnorePattern: '^_',
|
||||||
|
caughtErrors: 'all',
|
||||||
|
caughtErrorsIgnorePattern: '^_',
|
||||||
|
destructuredArrayIgnorePattern: '^_',
|
||||||
|
varsIgnorePattern: '^_',
|
||||||
|
ignoreRestSiblings: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
'array-callback-return': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
allowImplicit: true,
|
||||||
|
checkForEach: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'no-constructor-return': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'no-unreachable-loop': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
ignore: [
|
||||||
|
'ForInStatement',
|
||||||
|
'ForOfStatement',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'no-use-before-define': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
functions: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'block-scoped-var': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'class-methods-use-this': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'curly': [
|
||||||
|
'warn',
|
||||||
|
],
|
||||||
|
'default-case-last': [
|
||||||
|
'warn',
|
||||||
|
],
|
||||||
|
'default-param-last': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'eqeqeq': [
|
||||||
|
'error',
|
||||||
|
'smart',
|
||||||
|
],
|
||||||
|
'func-names': [
|
||||||
|
'warn',
|
||||||
|
'never',
|
||||||
|
],
|
||||||
|
'func-style': [
|
||||||
|
'warn',
|
||||||
|
'expression',
|
||||||
|
],
|
||||||
|
'logical-assignment-operators': [
|
||||||
|
'warn',
|
||||||
|
'always',
|
||||||
|
],
|
||||||
|
'no-array-constructor': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'no-empty-function': [
|
||||||
|
'warn',
|
||||||
|
],
|
||||||
|
'no-empty-static-block': [
|
||||||
|
'warn',
|
||||||
|
],
|
||||||
|
'no-extend-native': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'no-extra-bind': [
|
||||||
|
'warn',
|
||||||
|
],
|
||||||
|
'no-implicit-coercion': [
|
||||||
|
'warn',
|
||||||
|
],
|
||||||
|
'no-iterator': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'no-labels': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'no-lone-blocks': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'no-lonely-if': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'no-loop-func': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'no-magic-numbers': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
ignore: [
|
||||||
|
-1,
|
||||||
|
0.1,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
3,
|
||||||
|
4,
|
||||||
|
5,
|
||||||
|
10,
|
||||||
|
12,
|
||||||
|
33,
|
||||||
|
66,
|
||||||
|
100,
|
||||||
|
255,
|
||||||
|
360,
|
||||||
|
450,
|
||||||
|
500,
|
||||||
|
1000,
|
||||||
|
],
|
||||||
|
ignoreDefaultValues: true,
|
||||||
|
ignoreClassFieldInitialValues: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'no-multi-assign': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'no-new-wrappers': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'no-object-constructor': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'no-proto': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'no-return-assign': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'no-sequences': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'no-shadow': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
builtinGlobals: true,
|
||||||
|
allow: [
|
||||||
|
'Window',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'no-undef-init': [
|
||||||
|
'warn',
|
||||||
|
],
|
||||||
|
'no-undefined': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'no-useless-constructor': [
|
||||||
|
'warn',
|
||||||
|
],
|
||||||
|
'no-useless-escape': [
|
||||||
|
'off',
|
||||||
|
],
|
||||||
|
'no-useless-return': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'no-var': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'no-void': [
|
||||||
|
'off',
|
||||||
|
],
|
||||||
|
'no-with': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'object-shorthand': [
|
||||||
|
'error',
|
||||||
|
'always',
|
||||||
|
],
|
||||||
|
'one-var': [
|
||||||
|
'error',
|
||||||
|
'never',
|
||||||
|
],
|
||||||
|
'operator-assignment': [
|
||||||
|
'warn',
|
||||||
|
'always',
|
||||||
|
],
|
||||||
|
'prefer-arrow-callback': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'prefer-const': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'prefer-object-has-own': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'prefer-regex-literals': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'prefer-template': [
|
||||||
|
'warn',
|
||||||
|
],
|
||||||
|
'no-prototype-builtins': 'off',
|
||||||
|
'@typescript-eslint/no-var-requires': [
|
||||||
|
'off',
|
||||||
|
],
|
||||||
|
'@stylistic/array-bracket-newline': [
|
||||||
|
'warn',
|
||||||
|
'consistent',
|
||||||
|
],
|
||||||
|
'@stylistic/array-bracket-spacing': [
|
||||||
|
'warn',
|
||||||
|
'never',
|
||||||
|
],
|
||||||
|
'@stylistic/arrow-parens': [
|
||||||
|
'warn',
|
||||||
|
'always',
|
||||||
|
],
|
||||||
|
'@stylistic/brace-style': [
|
||||||
|
'warn',
|
||||||
|
'stroustrup',
|
||||||
|
],
|
||||||
|
'@stylistic/comma-dangle': [
|
||||||
|
'warn',
|
||||||
|
'always-multiline',
|
||||||
|
],
|
||||||
|
'@stylistic/comma-spacing': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
before: false,
|
||||||
|
after: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'@stylistic/comma-style': [
|
||||||
|
'error',
|
||||||
|
'last',
|
||||||
|
],
|
||||||
|
'@stylistic/dot-location': [
|
||||||
|
'error',
|
||||||
|
'property',
|
||||||
|
],
|
||||||
|
'@stylistic/function-call-argument-newline': [
|
||||||
|
'warn',
|
||||||
|
'consistent',
|
||||||
|
],
|
||||||
|
'@stylistic/function-paren-newline': [
|
||||||
|
'warn',
|
||||||
|
'consistent',
|
||||||
|
],
|
||||||
|
'@stylistic/indent': [
|
||||||
|
'warn',
|
||||||
|
4,
|
||||||
|
{
|
||||||
|
SwitchCase: 1,
|
||||||
|
ignoreComments: true,
|
||||||
|
ignoredNodes: ['TemplateLiteral > *'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'@stylistic/key-spacing': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
beforeColon: false,
|
||||||
|
afterColon: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'@stylistic/keyword-spacing': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
before: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'@stylistic/linebreak-style': [
|
||||||
|
'error',
|
||||||
|
'unix',
|
||||||
|
],
|
||||||
|
'@stylistic/lines-between-class-members': [
|
||||||
|
'warn',
|
||||||
|
'always',
|
||||||
|
{
|
||||||
|
exceptAfterSingleLine: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'@stylistic/max-len': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
code: 105,
|
||||||
|
ignoreComments: true,
|
||||||
|
ignoreTrailingComments: true,
|
||||||
|
ignoreUrls: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'@stylistic/multiline-ternary': [
|
||||||
|
'warn',
|
||||||
|
'always-multiline',
|
||||||
|
],
|
||||||
|
'@stylistic/new-parens': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'@stylistic/no-mixed-operators': [
|
||||||
|
'warn',
|
||||||
|
],
|
||||||
|
'@stylistic/no-mixed-spaces-and-tabs': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'@stylistic/no-multi-spaces': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'@stylistic/no-tabs': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'@stylistic/no-trailing-spaces': [
|
||||||
|
'error',
|
||||||
|
],
|
||||||
|
'@stylistic/no-whitespace-before-property': [
|
||||||
|
'warn',
|
||||||
|
],
|
||||||
|
'@stylistic/nonblock-statement-body-position': [
|
||||||
|
'error',
|
||||||
|
'below',
|
||||||
|
],
|
||||||
|
'@stylistic/object-curly-newline': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
consistent: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'@stylistic/object-curly-spacing': [
|
||||||
|
'warn',
|
||||||
|
'always',
|
||||||
|
],
|
||||||
|
'@stylistic/operator-linebreak': [
|
||||||
|
'warn',
|
||||||
|
'after',
|
||||||
|
],
|
||||||
|
'@stylistic/padded-blocks': [
|
||||||
|
'error',
|
||||||
|
'never',
|
||||||
|
],
|
||||||
|
'@stylistic/padding-line-between-statements': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
blankLine: 'always',
|
||||||
|
prev: '*',
|
||||||
|
next: 'return',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
blankLine: 'always',
|
||||||
|
prev: [
|
||||||
|
'const',
|
||||||
|
'let',
|
||||||
|
'var',
|
||||||
|
],
|
||||||
|
next: '*',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
blankLine: 'any',
|
||||||
|
prev: [
|
||||||
|
'const',
|
||||||
|
'let',
|
||||||
|
'var',
|
||||||
|
],
|
||||||
|
next: [
|
||||||
|
'const',
|
||||||
|
'let',
|
||||||
|
'var',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
blankLine: 'always',
|
||||||
|
prev: [
|
||||||
|
'case',
|
||||||
|
'default',
|
||||||
|
],
|
||||||
|
next: '*',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'@stylistic/quote-props': [
|
||||||
|
'error',
|
||||||
|
'consistent-as-needed',
|
||||||
|
],
|
||||||
|
'@stylistic/quotes': [
|
||||||
|
'error',
|
||||||
|
'single',
|
||||||
|
{
|
||||||
|
avoidEscape: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'@stylistic/semi': [
|
||||||
|
'error',
|
||||||
|
'always',
|
||||||
|
],
|
||||||
|
'@stylistic/semi-spacing': [
|
||||||
|
'warn',
|
||||||
|
],
|
||||||
|
'@stylistic/space-before-blocks': [
|
||||||
|
'warn',
|
||||||
|
],
|
||||||
|
'@stylistic/space-before-function-paren': [
|
||||||
|
'warn',
|
||||||
|
'never',
|
||||||
|
],
|
||||||
|
'@stylistic/space-infix-ops': [
|
||||||
|
'warn',
|
||||||
|
],
|
||||||
|
'@stylistic/spaced-comment': [
|
||||||
|
'warn',
|
||||||
|
'always',
|
||||||
|
],
|
||||||
|
'@stylistic/switch-colon-spacing': [
|
||||||
|
'warn',
|
||||||
|
],
|
||||||
|
'@stylistic/wrap-regex': [
|
||||||
|
'warn',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
2434
apps/update/package-lock.json
generated
Normal file
2434
apps/update/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
23
apps/update/package.json
Normal file
23
apps/update/package.json
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"name": "update-flake",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"bin": "out/bin/app.cjs",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"build": "node_ver=$(node -v); esbuild src/app.ts --bundle --platform=node --target=\"node${node_ver:1:2}\" --outfile=out/bin/app.cjs"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@eslint/js": "9.7.0",
|
||||||
|
"@stylistic/eslint-plugin": "2.3.0",
|
||||||
|
"@types/eslint__js": "8.42.3",
|
||||||
|
"@types/node": "20.14.11",
|
||||||
|
"esbuild": "0.23.0",
|
||||||
|
"eslint": "9.7.0",
|
||||||
|
"eslint-plugin-jsdoc": "48.7.0",
|
||||||
|
"typescript": "5.5.3",
|
||||||
|
"typescript-eslint": "7.16.1"
|
||||||
|
},
|
||||||
|
"overrides": {
|
||||||
|
"eslint": "$eslint"
|
||||||
|
}
|
||||||
|
}
|
70
apps/update/src/app.ts
Normal file
70
apps/update/src/app.ts
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
import { spawnSync } from 'node:child_process';
|
||||||
|
|
||||||
|
import { parseArgs } from './lib.ts';
|
||||||
|
import { updateFirefoxAddons } from '././firefox.ts';
|
||||||
|
import { updateDocker, updateFlakeInputs, updateVuetorrent } from './misc.ts';
|
||||||
|
|
||||||
|
|
||||||
|
/* Constants */
|
||||||
|
const FLAKE = process.env.FLAKE;
|
||||||
|
|
||||||
|
if (!FLAKE) {
|
||||||
|
console.error('Env var FLAKE not found');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const args = parseArgs();
|
||||||
|
|
||||||
|
if (args['d'] || args['docker']) {
|
||||||
|
console.log(updateDocker());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args['i'] || args['inputs']) {
|
||||||
|
console.log(updateFlakeInputs());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args['f'] || args['firefox']) {
|
||||||
|
console.log(updateFirefoxAddons());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args['v'] || args['vuetorrent']) {
|
||||||
|
console.log(updateVuetorrent());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args['a'] || args['all']) {
|
||||||
|
// Update this first because of nix run cmd
|
||||||
|
const firefoxOutput = updateFirefoxAddons();
|
||||||
|
|
||||||
|
console.log(firefoxOutput);
|
||||||
|
|
||||||
|
|
||||||
|
const flakeOutput = updateFlakeInputs();
|
||||||
|
|
||||||
|
console.log(flakeOutput);
|
||||||
|
|
||||||
|
|
||||||
|
const dockerOutput = updateDocker();
|
||||||
|
|
||||||
|
console.log(dockerOutput);
|
||||||
|
|
||||||
|
|
||||||
|
const vuetorrentOutput = updateVuetorrent();
|
||||||
|
|
||||||
|
console.log(vuetorrentOutput);
|
||||||
|
|
||||||
|
|
||||||
|
spawnSync('nix-fast-build', ['-f', `${FLAKE}#nixFastChecks`], {
|
||||||
|
shell: true,
|
||||||
|
stdio: [process.stdin, process.stdout, process.stderr],
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log([
|
||||||
|
'chore: update flake.lock',
|
||||||
|
`Flake Inputs:\n${flakeOutput}`,
|
||||||
|
`Docker Images:\n${dockerOutput}`,
|
||||||
|
`Firefox Addons:\n${firefoxOutput}`,
|
||||||
|
`Misc Sources:\n${vuetorrentOutput}`,
|
||||||
|
].join('\n\n'));
|
||||||
|
}
|
||||||
|
|
||||||
|
spawnSync('alejandra', ['-q', FLAKE], { shell: true });
|
76
apps/update/src/firefox.ts
Normal file
76
apps/update/src/firefox.ts
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
import { spawnSync } from 'node:child_process';
|
||||||
|
import { readFileSync } from 'node:fs';
|
||||||
|
|
||||||
|
import { parseFetchurl } from './lib.ts';
|
||||||
|
|
||||||
|
/* Constants */
|
||||||
|
const FLAKE = process.env.FLAKE;
|
||||||
|
|
||||||
|
|
||||||
|
const updateFFZ = () => {
|
||||||
|
const FILE = `${FLAKE}/legacyPackages/firefox-addons/default.nix`;
|
||||||
|
const URL = 'https://cdn.frankerfacez.com/script/frankerfacez-4.0-an+fx.xpi';
|
||||||
|
|
||||||
|
const HASH = parseFetchurl(URL);
|
||||||
|
|
||||||
|
spawnSync('sed', ['-i', `'s,url = .*,url = \"${URL}\";,'`, FILE], { shell: true });
|
||||||
|
spawnSync('sed', ['-i', `'s,sha256 = .*,sha256 = \"${HASH}\";,'`, FILE], { shell: true });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const updateFirefoxAddons = () => {
|
||||||
|
console.log('Updating FFZ addon');
|
||||||
|
updateFFZ();
|
||||||
|
|
||||||
|
console.log('Updating firefox addons using mozilla-addons-to-nix');
|
||||||
|
|
||||||
|
const DIR = `${FLAKE}/legacyPackages/firefox-addons`;
|
||||||
|
const GENERATED_FILE = `${DIR}/generated-firefox-addons.nix`;
|
||||||
|
const SLUGS = `${DIR}/addons.json`;
|
||||||
|
|
||||||
|
const nameMap = Object.fromEntries([...JSON.parse(readFileSync(SLUGS, 'utf-8'))]
|
||||||
|
.map((addon) => [addon.slug, addon.pname || addon.slug]));
|
||||||
|
|
||||||
|
const nixExpr = `'
|
||||||
|
x: let
|
||||||
|
inherit (builtins) attrValues filter hasAttr isAttrs map;
|
||||||
|
in
|
||||||
|
map (d: d.name) (filter (y:
|
||||||
|
isAttrs y &&
|
||||||
|
hasAttr "type" y &&
|
||||||
|
y.type == "derivation") (attrValues x))
|
||||||
|
'`;
|
||||||
|
|
||||||
|
const OLD_VERS = Object.fromEntries([...JSON.parse(spawnSync('nix', [
|
||||||
|
'eval',
|
||||||
|
'.#legacyPackages.x86_64-linux.firefoxAddons',
|
||||||
|
'--apply',
|
||||||
|
nixExpr,
|
||||||
|
'--json',
|
||||||
|
], { shell: true }).stdout.toString())]
|
||||||
|
.map((p) => {
|
||||||
|
const pname = p.replace(/-[0-9].*$/, '');
|
||||||
|
|
||||||
|
return [pname, p.replace(`${pname}-`, '')];
|
||||||
|
})
|
||||||
|
.filter((pinfo) => pinfo[0] !== 'frankerfacez'));
|
||||||
|
|
||||||
|
const NEW_VERS = Object.fromEntries(spawnSync(
|
||||||
|
'nix',
|
||||||
|
['run', 'sourcehut:~rycee/mozilla-addons-to-nix',
|
||||||
|
SLUGS, GENERATED_FILE],
|
||||||
|
{ shell: true },
|
||||||
|
).stdout
|
||||||
|
.toString()
|
||||||
|
.split('\n')
|
||||||
|
.map((p) => {
|
||||||
|
const pinfo = p.replace('Fetched ', '').split(' ');
|
||||||
|
|
||||||
|
return [nameMap[pinfo[0]], pinfo[2]];
|
||||||
|
}));
|
||||||
|
|
||||||
|
return Object.keys(OLD_VERS)
|
||||||
|
.sort()
|
||||||
|
.filter((pname) => OLD_VERS[pname] !== NEW_VERS[pname])
|
||||||
|
.map((pname) => `${pname}: ${OLD_VERS[pname]} -> ${NEW_VERS[pname]}`)
|
||||||
|
.join('\n');
|
||||||
|
};
|
30
apps/update/src/lib.ts
Normal file
30
apps/update/src/lib.ts
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
import { spawnSync } from 'node:child_process';
|
||||||
|
|
||||||
|
|
||||||
|
export const parseArgs = () => {
|
||||||
|
const args = {} as Record<string, unknown>;
|
||||||
|
let lastFlag: string | null = null;
|
||||||
|
|
||||||
|
for (let i = 2; i < process.argv.length; ++i) {
|
||||||
|
const arg = process.argv[i];
|
||||||
|
|
||||||
|
if (arg.toString().startsWith('-')) {
|
||||||
|
lastFlag = arg.toString().replace(/^-{1,2}/, '');
|
||||||
|
args[lastFlag] = true;
|
||||||
|
}
|
||||||
|
else if (lastFlag) {
|
||||||
|
args[lastFlag] = arg;
|
||||||
|
lastFlag = null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.error(`Could not parse args: ${arg.toString()}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return args;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const parseFetchurl = (url: string) => JSON.parse(spawnSync(
|
||||||
|
'nix', ['store', 'prefetch-file', '--refresh', '--json',
|
||||||
|
'--hash-type', 'sha256', url, '--name', '"escaped"'], { shell: true },
|
||||||
|
).stdout.toString()).hash;
|
75
apps/update/src/misc.ts
Normal file
75
apps/update/src/misc.ts
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
import { readdirSync, writeFileSync } from 'node:fs';
|
||||||
|
import { spawnSync } from 'node:child_process';
|
||||||
|
|
||||||
|
import { parseFetchurl } from './lib.ts';
|
||||||
|
|
||||||
|
|
||||||
|
/* Constants */
|
||||||
|
const FLAKE = process.env.FLAKE;
|
||||||
|
|
||||||
|
export const updateFlakeInputs = () => {
|
||||||
|
const output = spawnSync(
|
||||||
|
`git restore flake.lock &> /dev/null; nix flake update --flake ${FLAKE}` +
|
||||||
|
' |& grep -v "warning: updating lock file"',
|
||||||
|
[],
|
||||||
|
{ shell: true },
|
||||||
|
).stdout
|
||||||
|
.toString()
|
||||||
|
// Add an extra blank line between inputs
|
||||||
|
.split('\n•')
|
||||||
|
.join('\n\n•')
|
||||||
|
// Shorten git revs to help readability
|
||||||
|
.split('\n')
|
||||||
|
.map((l) => l
|
||||||
|
.replace(/.{33}\?narHash=sha256[^']*/, '')
|
||||||
|
.replace(/&rev=(.{7})[^'&]*/, (_, backref) => `&rev=${backref}`))
|
||||||
|
.join('\n');
|
||||||
|
|
||||||
|
return output;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const updateDocker = () => {
|
||||||
|
let updates = '';
|
||||||
|
|
||||||
|
const FILE = `${FLAKE}/devices/nos/modules/docker`;
|
||||||
|
|
||||||
|
readdirSync(FILE, { withFileTypes: true, recursive: true }).forEach((path) => {
|
||||||
|
if (path.name === 'compose.nix') {
|
||||||
|
console.log(`Updating ${path.parentPath.split('/').at(-1)} images`);
|
||||||
|
updates += spawnSync('updateImages', [path.parentPath], { shell: true })
|
||||||
|
.stdout.toString();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return updates;
|
||||||
|
};
|
||||||
|
|
||||||
|
const genVueText = (version: string, hash: string, url: string) =>
|
||||||
|
`# This file was autogenerated. DO NOT EDIT!
|
||||||
|
{
|
||||||
|
version = "${version}";
|
||||||
|
url = "${url}";
|
||||||
|
hash = "${hash}";
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const updateVuetorrent = () => {
|
||||||
|
const FILE = `${FLAKE}/devices/nos/modules/qbittorrent/vuetorrent.nix`;
|
||||||
|
|
||||||
|
const OLD_VERSION = JSON.parse(spawnSync('nix',
|
||||||
|
['eval', '-f', FILE, '--json'],
|
||||||
|
{ shell: true }).stdout.toString()).version;
|
||||||
|
|
||||||
|
const VERSION = JSON.parse(spawnSync('curl',
|
||||||
|
['-s', 'https://api.github.com/repos/VueTorrent/VueTorrent/releases/latest'],
|
||||||
|
{ shell: true }).stdout.toString()).tag_name.replace('v', '');
|
||||||
|
|
||||||
|
const URL = `https://github.com/VueTorrent/VueTorrent/releases/download/v${VERSION}/vuetorrent.zip`;
|
||||||
|
const HASH = parseFetchurl(URL);
|
||||||
|
|
||||||
|
const fileText = genVueText(VERSION, HASH, URL);
|
||||||
|
|
||||||
|
writeFileSync(FILE, fileText);
|
||||||
|
|
||||||
|
return OLD_VERSION !== VERSION ? `Vuetorrent: ${OLD_VERSION} -> ${VERSION}` : '';
|
||||||
|
};
|
31
apps/update/tsconfig.json
Normal file
31
apps/update/tsconfig.json
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
// Env
|
||||||
|
"target": "ESNext",
|
||||||
|
"lib": ["ESNext"],
|
||||||
|
// Module
|
||||||
|
"module": "nodenext",
|
||||||
|
"moduleResolution": "nodenext",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
// Emit
|
||||||
|
"noEmit": true,
|
||||||
|
"newLine": "LF",
|
||||||
|
// Interop
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
// Type Checking
|
||||||
|
"strict": true,
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"allowJs": true,
|
||||||
|
"checkJs": true
|
||||||
|
},
|
||||||
|
"includes": [
|
||||||
|
"*.ts",
|
||||||
|
"**/*.ts",
|
||||||
|
"*.js",
|
||||||
|
"**/*.js"
|
||||||
|
]
|
||||||
|
}
|
7
checks/default.nix
Normal file
7
checks/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
self,
|
||||||
|
}: let
|
||||||
|
nixosMachines = import ./machines.nix {inherit pkgs self;};
|
||||||
|
in
|
||||||
|
nixosMachines
|
10
checks/machines.nix
Normal file
10
checks/machines.nix
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# CI: https://github.com/Mic92/dotfiles/blob/c2f538934d67417941f83d8bb65b8263c43d32ca/flake.nix#L168
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
self,
|
||||||
|
}: let
|
||||||
|
inherit (pkgs.lib) filterAttrs mapAttrs' nameValuePair;
|
||||||
|
in
|
||||||
|
mapAttrs'
|
||||||
|
(name: config: nameValuePair "nixos-${name}" config.config.system.build.toplevel)
|
||||||
|
((filterAttrs (_: config: config.pkgs.system == pkgs.system)) self.nixosConfigurations)
|
|
@ -4,41 +4,33 @@
|
||||||
lib,
|
lib,
|
||||||
nh,
|
nh,
|
||||||
nix-melt,
|
nix-melt,
|
||||||
nur,
|
|
||||||
nurl,
|
nurl,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
self,
|
||||||
...
|
...
|
||||||
} @ inputs: {
|
}: {
|
||||||
imports = [
|
imports = [
|
||||||
./vars
|
./vars
|
||||||
|
|
||||||
./modules
|
./modules
|
||||||
./pkgs
|
./packages.nix
|
||||||
|
self.nixosModules.borgbackup
|
||||||
|
|
||||||
nur.nixosModules.nur
|
|
||||||
nh.nixosModules.default
|
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
|
|
||||||
../modules/arion
|
|
||||||
../modules/borgbackup
|
|
||||||
../modules/nvidia.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
nixpkgs = {
|
boot.tmp.useTmpfs = true;
|
||||||
config.allowUnfree = true;
|
|
||||||
overlays = import ./overlays inputs;
|
systemd.services.nix-daemon = {
|
||||||
|
environment.TMPDIR = "/home/nix-cache";
|
||||||
|
preStart = ''
|
||||||
|
mkdir -p ${config.systemd.services.nix-daemon.environment.TMPDIR}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
boot.tmp.cleanOnBoot = true;
|
|
||||||
|
|
||||||
nix = {
|
nix = {
|
||||||
# Allow deleting store files with '.' in the name
|
package = pkgs.nixVersions.nix_2_24;
|
||||||
package = pkgs.nix.overrideAttrs (o: {
|
|
||||||
patches =
|
|
||||||
(o.patches or [])
|
|
||||||
++ [
|
|
||||||
./overlays/nix/patch
|
|
||||||
];
|
|
||||||
});
|
|
||||||
# Edit nix.conf
|
# Edit nix.conf
|
||||||
settings = {
|
settings = {
|
||||||
# Store
|
# Store
|
||||||
|
@ -51,14 +43,17 @@
|
||||||
http-connections = 0; # unlimited for local cache
|
http-connections = 0; # unlimited for local cache
|
||||||
warn-dirty = false;
|
warn-dirty = false;
|
||||||
show-trace = true;
|
show-trace = true;
|
||||||
|
allow-import-from-derivation = true;
|
||||||
|
|
||||||
# remote building
|
# remote building
|
||||||
trusted-users = ["matt" "nixremote"];
|
trusted-users = ["matt" "nixremote"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nh = {
|
programs.nh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
package = nh.packages.${pkgs.system}.default;
|
||||||
|
|
||||||
# weekly cleanup
|
# weekly cleanup
|
||||||
clean = {
|
clean = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -75,51 +70,80 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
boot.supportedFilesystems = ["ext4" "xfs" "btrfs" "vfat" "ntfs"];
|
||||||
|
system.fsPackages = builtins.attrValues {
|
||||||
|
inherit
|
||||||
|
(pkgs)
|
||||||
|
btrfs-progs
|
||||||
|
nfs-utils
|
||||||
|
ntfs3g
|
||||||
|
xfsprogs
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.variables.NPM_CONFIG_GLOBALCONFIG = "/etc/npmrc";
|
||||||
|
environment.etc.npmrc.text = ''
|
||||||
|
fund = false
|
||||||
|
update-notifier = false
|
||||||
|
'';
|
||||||
|
|
||||||
|
environment.systemPackages =
|
||||||
|
(builtins.attrValues {
|
||||||
|
# Peripherals
|
||||||
|
inherit
|
||||||
|
(pkgs)
|
||||||
|
hdparm
|
||||||
|
pciutils
|
||||||
|
usbutils
|
||||||
|
rar
|
||||||
|
;
|
||||||
|
})
|
||||||
|
++ [
|
||||||
|
nix-melt.packages.${pkgs.system}.default
|
||||||
|
|
||||||
|
(nurl.packages.${pkgs.system}.default.override {
|
||||||
|
nix = config.nix.package;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
home-manager = let
|
home-manager = let
|
||||||
|
inherit (lib) mapAttrs' mkIf mkOption nameValuePair types;
|
||||||
inherit (config.vars) mainUser;
|
inherit (config.vars) mainUser;
|
||||||
mainUserConf = config.home-manager.users.${mainUser};
|
|
||||||
|
|
||||||
default = {
|
default = {
|
||||||
imports = [
|
imports = [
|
||||||
# Make the vars be the same on Nix and HM
|
# Make the vars be the same on Nix and HM
|
||||||
{
|
{
|
||||||
options.vars = lib.mkOption {
|
options.vars = mkOption {
|
||||||
type = lib.types.attrs;
|
type = types.attrs;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
default = config.vars;
|
default = config.vars;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
nur.hmModules.nur
|
{
|
||||||
|
programs.bash.sessionVariables = {
|
||||||
|
FLAKE = config.environment.variables.FLAKE;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
./home
|
./home
|
||||||
./home/trash-d
|
./home/trash-d
|
||||||
./pkgs
|
|
||||||
];
|
];
|
||||||
|
|
||||||
home.packages =
|
# Cache devShells
|
||||||
[
|
home.file = mapAttrs' (n: v:
|
||||||
nix-melt.packages.${pkgs.system}.default
|
nameValuePair ".cache/devShells/${n}" {
|
||||||
nurl.packages.${pkgs.system}.default
|
source = v;
|
||||||
]
|
})
|
||||||
++ (with config.nur.repos.rycee; [
|
self.devShells.${pkgs.system};
|
||||||
mozilla-addons-to-nix
|
|
||||||
]);
|
home.stateVersion = config.system.stateVersion;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
users = {
|
users = {
|
||||||
root =
|
root = default;
|
||||||
default
|
greeter = mkIf (config.services.greetd.enable) default;
|
||||||
// {
|
|
||||||
home.stateVersion = mainUserConf.home.stateVersion;
|
|
||||||
};
|
|
||||||
greeter =
|
|
||||||
lib.mkIf (config.services.greetd.enable)
|
|
||||||
(default
|
|
||||||
// {
|
|
||||||
home.stateVersion = mainUserConf.home.stateVersion;
|
|
||||||
});
|
|
||||||
|
|
||||||
${mainUser} = default;
|
${mainUser} = default;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -123,9 +123,7 @@ in {
|
||||||
#profileExtra = ''
|
#profileExtra = ''
|
||||||
#'';
|
#'';
|
||||||
bashrcExtra =
|
bashrcExtra =
|
||||||
/*
|
# bash
|
||||||
bash
|
|
||||||
*/
|
|
||||||
''
|
''
|
||||||
# Check if shell is interactive
|
# Check if shell is interactive
|
||||||
[[ $- == *i* ]] || return 0
|
[[ $- == *i* ]] || return 0
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
config,
|
config,
|
||||||
|
self,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
programs = {
|
programs = {
|
||||||
|
@ -41,18 +42,13 @@
|
||||||
|
|
||||||
bat = {
|
bat = {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = {
|
|
||||||
theme = "dracula-bat";
|
config.theme = "dracula-bat";
|
||||||
|
themes.dracula-bat.src = self.legacyPackages.${pkgs.system}.dracula.bat;
|
||||||
|
|
||||||
|
extraPackages = builtins.attrValues {
|
||||||
|
inherit (pkgs.bat-extras) batman;
|
||||||
};
|
};
|
||||||
themes = {
|
|
||||||
dracula-bat = {
|
|
||||||
src = pkgs.dracula-theme;
|
|
||||||
file = "bat";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
extraPackages = with pkgs.bat-extras; [
|
|
||||||
batman
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,5 @@
|
||||||
./neovim
|
./neovim
|
||||||
./nix-index
|
./nix-index
|
||||||
./tmux
|
./tmux
|
||||||
./packages.nix
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
programs.direnv = {
|
programs.direnv = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableBashIntegration = true;
|
enableBashIntegration = true;
|
||||||
|
|
||||||
nix-direnv = {
|
nix-direnv = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.nix-direnv-flakes;
|
package = pkgs.nix-direnv;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +1,36 @@
|
||||||
{pkgs, ...}: {
|
{
|
||||||
|
pkgs,
|
||||||
|
self,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
mkRemoteConf = remote: email: name: {
|
||||||
|
condition = "hasconfig:remote.*.url:${remote}:*/**";
|
||||||
|
contents.user = {inherit email name;};
|
||||||
|
};
|
||||||
|
mkDefaultRemote = remote: mkRemoteConf remote "matt@nelim.org" "matt1432";
|
||||||
|
in {
|
||||||
programs = {
|
programs = {
|
||||||
git = {
|
git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
package = pkgs.gitFull;
|
||||||
|
|
||||||
lfs.enable = true;
|
lfs.enable = true;
|
||||||
|
|
||||||
includes = [
|
includes = [
|
||||||
{path = "${pkgs.dracula-theme}/git-colors";}
|
{path = toString self.legacyPackages.${pkgs.system}.dracula.git;}
|
||||||
|
|
||||||
{
|
(mkDefaultRemote "https://github.com")
|
||||||
condition = "hasconfig:remote.*.url:git@github.com:*/**";
|
(mkDefaultRemote "git@github.com")
|
||||||
contents = {
|
(mkDefaultRemote "git@git.nelim.org")
|
||||||
user = {
|
|
||||||
email = "matt@nelim.org";
|
|
||||||
name = "matt1432";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
(mkRemoteConf "git@gitlab.info.uqam.ca" "gj591944@ens.uqam.ca" "Mathis Hurtubise")
|
||||||
condition = "hasconfig:remote.*.url:git@git.nelim.org:*/**";
|
|
||||||
contents = {
|
|
||||||
user = {
|
|
||||||
email = "matt@nelim.org";
|
|
||||||
name = "matt1432";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
condition = "hasconfig:remote.*.url:git@gitlab.info.uqam.ca:*/**";
|
|
||||||
contents = {
|
|
||||||
user = {
|
|
||||||
email = "gj591944@ens.uqam.ca";
|
|
||||||
name = "Mathis Hurtubise";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
delta = {
|
delta = {
|
||||||
enable = true;
|
enable = true;
|
||||||
options = {
|
options = {
|
||||||
side-by-side = true;
|
side-by-side = true;
|
||||||
line-numbers-zero-style = "#E6EDF3"; #BD93F9";
|
line-numbers-zero-style = "#E6EDF3";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -59,14 +47,22 @@
|
||||||
log = cmd;
|
log = cmd;
|
||||||
reflog = cmd;
|
reflog = cmd;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sendemail = {
|
||||||
|
smtpserver = "127.0.0.1";
|
||||||
|
smtpuser = "matt@nelim.org";
|
||||||
|
smtpencryption = "tls";
|
||||||
|
smtpserverport = 1025;
|
||||||
|
smtpsslcertpath = "";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = [
|
||||||
(writeShellApplication {
|
(pkgs.writeShellApplication {
|
||||||
name = "chore";
|
name = "chore";
|
||||||
runtimeInputs = [git];
|
runtimeInputs = [pkgs.git];
|
||||||
|
|
||||||
text = ''
|
text = ''
|
||||||
DIR=''${1:-"$FLAKE"}
|
DIR=''${1:-"$FLAKE"}
|
||||||
|
|
107
common/home/neovim/.editorconfig
Normal file
107
common/home/neovim/.editorconfig
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
# see https://github.com/CppCXY/EmmyLuaCodeStyle
|
||||||
|
[*.lua]
|
||||||
|
# [basic]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
quote_style = single
|
||||||
|
|
||||||
|
max_line_length = 120
|
||||||
|
end_of_line = lf
|
||||||
|
|
||||||
|
table_separator_style = comma
|
||||||
|
trailing_table_separator = smart
|
||||||
|
|
||||||
|
call_arg_parentheses = keep
|
||||||
|
|
||||||
|
# [space]
|
||||||
|
space_around_table_field_list = true
|
||||||
|
space_before_attribute = true
|
||||||
|
space_before_function_open_parenthesis = false
|
||||||
|
space_before_function_call_open_parenthesis = false
|
||||||
|
space_before_closure_open_parenthesis = false
|
||||||
|
space_before_function_call_single_arg = false
|
||||||
|
space_before_open_square_bracket = false
|
||||||
|
space_inside_function_call_parentheses = false
|
||||||
|
space_inside_function_param_list_parentheses = false
|
||||||
|
space_inside_square_brackets = false
|
||||||
|
|
||||||
|
# like t[#t+1] = 1
|
||||||
|
space_around_table_append_operator = false
|
||||||
|
ignore_spaces_inside_function_call = false
|
||||||
|
|
||||||
|
# detail number or 'keep'
|
||||||
|
space_before_inline_comment = 1
|
||||||
|
|
||||||
|
# convert '---' to '--- ' or '--' to '-- '
|
||||||
|
space_after_comment_dash = false
|
||||||
|
|
||||||
|
# [operator space]
|
||||||
|
space_around_math_operator = true
|
||||||
|
space_around_math_operator.exponent = false
|
||||||
|
space_around_concat_operator = true
|
||||||
|
space_around_logical_operator = true
|
||||||
|
space_around_assign_operator = true
|
||||||
|
|
||||||
|
space_after_comma = true
|
||||||
|
space_after_comma_in_for_statement = true
|
||||||
|
|
||||||
|
# [align]
|
||||||
|
align_call_args = false
|
||||||
|
align_function_params = true
|
||||||
|
align_continuous_assign_statement = true
|
||||||
|
align_continuous_rect_table_field = true
|
||||||
|
align_continuous_line_space = 2
|
||||||
|
align_if_branch = false
|
||||||
|
|
||||||
|
# option none / always / contain_curly/
|
||||||
|
align_array_table = true
|
||||||
|
|
||||||
|
align_continuous_similar_call_args = false
|
||||||
|
|
||||||
|
align_continuous_inline_comment = true
|
||||||
|
# option none / always / only_call_stmt
|
||||||
|
align_chain_expr = none
|
||||||
|
|
||||||
|
# [indent]
|
||||||
|
never_indent_before_if_condition = false
|
||||||
|
never_indent_comment_on_if_branch = false
|
||||||
|
keep_indents_on_empty_lines = false
|
||||||
|
allow_non_indented_comments = false
|
||||||
|
|
||||||
|
# [line space]
|
||||||
|
|
||||||
|
# The following configuration supports four expressions
|
||||||
|
# keep
|
||||||
|
# fixed(n)
|
||||||
|
# min(n)
|
||||||
|
# max(n)
|
||||||
|
# for eg. min(2)
|
||||||
|
|
||||||
|
line_space_after_if_statement = keep
|
||||||
|
|
||||||
|
line_space_after_do_statement = keep
|
||||||
|
|
||||||
|
line_space_after_while_statement = keep
|
||||||
|
|
||||||
|
line_space_after_repeat_statement = keep
|
||||||
|
|
||||||
|
line_space_after_for_statement = keep
|
||||||
|
|
||||||
|
line_space_after_local_or_assign_statement = keep
|
||||||
|
|
||||||
|
line_space_after_function_statement = fixed(2)
|
||||||
|
|
||||||
|
line_space_after_expression_statement = keep
|
||||||
|
|
||||||
|
line_space_after_comment = keep
|
||||||
|
|
||||||
|
line_space_around_block = fixed(1)
|
||||||
|
|
||||||
|
# [line break]
|
||||||
|
break_all_list_when_line_exceed = false
|
||||||
|
auto_collapse_lines = false
|
||||||
|
break_before_braces = false
|
||||||
|
|
||||||
|
# [preference]
|
||||||
|
ignore_space_after_colon = false
|
||||||
|
end_statement_with_semicolon = always
|
|
@ -1,2 +0,0 @@
|
||||||
-- Add `:Format` command to format current buffer
|
|
||||||
vim.api.nvim_create_user_command("Format", "call CocAction('format')", {})
|
|
|
@ -1,34 +0,0 @@
|
||||||
" by default, the indent is 2 spaces.
|
|
||||||
set smartindent
|
|
||||||
set expandtab
|
|
||||||
set shiftwidth=2
|
|
||||||
set softtabstop=2
|
|
||||||
set tabstop=2
|
|
||||||
|
|
||||||
" for html/rb files, 2 spaces
|
|
||||||
autocmd Filetype html setlocal ts=2 sw=2 expandtab
|
|
||||||
autocmd Filetype ruby setlocal ts=2 sw=2 expandtab
|
|
||||||
|
|
||||||
" for js/coffee/jade files, 4 spaces
|
|
||||||
autocmd Filetype javascript setlocal ts=4 sw=4 sts=0 expandtab
|
|
||||||
autocmd Filetype typescript setlocal ts=4 sw=4 sts=0 expandtab
|
|
||||||
autocmd Filetype java setlocal ts=4 sw=4 sts=0 expandtab
|
|
||||||
autocmd Filetype sh setlocal ts=4 sw=4 sts=0 expandtab
|
|
||||||
autocmd Filetype hyprlang setlocal ts=4 sw=4 sts=0 expandtab
|
|
||||||
|
|
||||||
" support scss @
|
|
||||||
autocmd FileType scss setl iskeyword+=@-@
|
|
||||||
|
|
||||||
set number
|
|
||||||
set relativenumber
|
|
||||||
|
|
||||||
" TODO: make this work for nix-on-droid
|
|
||||||
set undofile
|
|
||||||
set undodir=/home/matt/.cache/nvim/
|
|
||||||
|
|
||||||
" remove highlight on words
|
|
||||||
nnoremap <silent> <esc> :noh<cr><esc>
|
|
||||||
|
|
||||||
" Always show the signcolumn, otherwise it would shift the text each time
|
|
||||||
" diagnostics appear/become resolved
|
|
||||||
set signcolumn=yes
|
|
|
@ -1,340 +1,101 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
|
||||||
nvim-theme-src,
|
|
||||||
coc-stylelintplus,
|
|
||||||
vimplugin-riscv-src,
|
|
||||||
...
|
...
|
||||||
}: let
|
}: {
|
||||||
inherit (config.vars) neovimIde;
|
imports = [
|
||||||
inherit (lib) fileContents hasAttr optionalAttrs optionals;
|
./git.nix
|
||||||
|
./langs
|
||||||
javaSdk = pkgs.temurin-bin-17;
|
./theme.nix
|
||||||
coc-stylelintplus-flake = coc-stylelintplus.packages.${pkgs.system}.default;
|
./treesitter.nix
|
||||||
in {
|
];
|
||||||
home = optionalAttrs neovimIde {
|
|
||||||
packages = with pkgs; [
|
|
||||||
gradle
|
|
||||||
maven
|
|
||||||
alejandra
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
xdg.dataFile = optionalAttrs neovimIde {
|
|
||||||
".gradle/gradle.properties".text = ''
|
|
||||||
org.gradle.java.home = ${javaSdk}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
java = optionalAttrs neovimIde {
|
|
||||||
enable = true;
|
|
||||||
package = javaSdk;
|
|
||||||
};
|
|
||||||
|
|
||||||
# I love doing typos
|
|
||||||
bash.shellAliases = {
|
|
||||||
nivm = "nvim";
|
|
||||||
nivim = "nvim";
|
|
||||||
};
|
|
||||||
|
|
||||||
neovim = {
|
neovim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
withNodeJs = true;
|
|
||||||
withPython3 = true;
|
|
||||||
withRuby = false;
|
|
||||||
|
|
||||||
defaultEditor = true;
|
extraLuaConfig =
|
||||||
viAlias = true;
|
# lua
|
||||||
vimAlias = true;
|
''
|
||||||
|
-- by default, the indent is 2 spaces.
|
||||||
|
vim.opt.smartindent = true;
|
||||||
|
vim.opt.expandtab = true;
|
||||||
|
vim.opt.shiftwidth = 2;
|
||||||
|
vim.opt.softtabstop = 2;
|
||||||
|
vim.opt.tabstop = 2;
|
||||||
|
|
||||||
extraPackages = with pkgs; ([
|
vim.opt.number = true;
|
||||||
bat
|
vim.opt.relativenumber = true;
|
||||||
gcc
|
|
||||||
]
|
|
||||||
++ optionals neovimIde [
|
|
||||||
nodejs_latest
|
|
||||||
nodePackages.npm
|
|
||||||
nodePackages.neovim
|
|
||||||
gradle
|
|
||||||
nil
|
|
||||||
]);
|
|
||||||
|
|
||||||
extraPython3Packages = ps:
|
vim.opt.undofile = true;
|
||||||
optionals neovimIde [
|
vim.opt.undodir = '${config.xdg.cacheHome}/nvim/';
|
||||||
ps.pylint
|
|
||||||
];
|
|
||||||
|
|
||||||
coc = optionalAttrs neovimIde {
|
-- Always show the signcolumn, otherwise it would shift
|
||||||
enable = true;
|
-- the text each time diagnostics appear/become resolved
|
||||||
settings = {
|
vim.opt.signcolumn = 'yes';
|
||||||
# General
|
|
||||||
colors.enable = true;
|
|
||||||
coc.preferences.formatOnType = true;
|
|
||||||
diagnostic.checkCurrentLine = true;
|
|
||||||
inlayHint.enable = false;
|
|
||||||
|
|
||||||
# ESLint
|
-- remove highlight on words
|
||||||
eslint = {
|
vim.keymap.set('n', '<esc>', ':noh<cr><esc>', {
|
||||||
format.enable = true;
|
noremap = true,
|
||||||
autoFixOnSave = true;
|
silent = true,
|
||||||
};
|
});
|
||||||
|
|
||||||
# Stylelint
|
-- Get rid of deprecated messages
|
||||||
stylelintplus = {
|
vim.tbl_add_reverse_lookup = function(tbl)
|
||||||
enable = true;
|
for k, v in pairs(tbl) do
|
||||||
cssInJs = true;
|
tbl[v] = k;
|
||||||
autoFixOnSave = true;
|
end
|
||||||
autoFixOnFormat = true;
|
end;
|
||||||
};
|
vim.tbl_islist = function(tbl)
|
||||||
css.validate = false;
|
return vim.islist(tbl);
|
||||||
less.validate = false;
|
end;
|
||||||
scss.validate = false;
|
vim.diagnostic.is_disabled = function()
|
||||||
wxss.validate = false;
|
return not vim.diagnostic.is_enabled();
|
||||||
|
end;
|
||||||
|
vim.lsp.buf_get_clients = function()
|
||||||
|
return vim.lsp.get_clients();
|
||||||
|
end;
|
||||||
|
vim.lsp.get_active_clients = function()
|
||||||
|
return vim.lsp.get_clients();
|
||||||
|
end;
|
||||||
|
'';
|
||||||
|
|
||||||
# Lua
|
plugins = [
|
||||||
Lua = {
|
pkgs.vimPlugins.fzfWrapper
|
||||||
misc.parameters = [
|
pkgs.vimPlugins.fzf-vim
|
||||||
"--metapath"
|
|
||||||
"~/.cache/sumneko_lua/meta"
|
|
||||||
"--logpath"
|
|
||||||
"~/.cache/sumneko_lua/log"
|
|
||||||
];
|
|
||||||
workspace.library = [
|
|
||||||
"$\{3rd\}/luv/library"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
sumneko-lua = {
|
|
||||||
serverDir = "${pkgs.lua-language-server}/share/lua-language-server";
|
|
||||||
enableNvimLuaDev = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
languageserver = {
|
{
|
||||||
# Nix
|
plugin = pkgs.vimPlugins.todo-comments-nvim;
|
||||||
nix = {
|
type = "lua";
|
||||||
command = "nil";
|
config =
|
||||||
filetypes = ["nix"];
|
# lua
|
||||||
rootPatterns = ["flake.nix"];
|
''
|
||||||
settings = {
|
require('todo-comments').setup();
|
||||||
nil = {
|
'';
|
||||||
formatting.command = ["alejandra"];
|
}
|
||||||
|
{
|
||||||
|
plugin = pkgs.vimPlugins.mini-nvim;
|
||||||
|
type = "lua";
|
||||||
|
config =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
-- TODO: see how this works
|
||||||
|
local ts_input = require('mini.surround').gen_spec.input.treesitter;
|
||||||
|
|
||||||
nix = {
|
require('mini.surround').setup({
|
||||||
maxMemoryMB = 2560;
|
custom_surroundings = {
|
||||||
flake.autoArchive = hasAttr "sops" config;
|
-- Use tree-sitter to search for function call
|
||||||
};
|
f = {
|
||||||
};
|
input = ts_input({
|
||||||
};
|
outer = '@call.outer',
|
||||||
};
|
inner = '@call.inner',
|
||||||
};
|
});
|
||||||
|
},
|
||||||
# Java
|
},
|
||||||
java = {
|
});
|
||||||
maven.downloadSources = true;
|
'';
|
||||||
eclipse.downloadSources = true;
|
}
|
||||||
|
];
|
||||||
format.settings.url = "eclipse-formatter.xml";
|
|
||||||
|
|
||||||
jdt.ls = {
|
|
||||||
java.home = "${javaSdk}";
|
|
||||||
statusIcons = {
|
|
||||||
"busy" = "Busy";
|
|
||||||
"ready" = "OK";
|
|
||||||
"warning" = "Warning";
|
|
||||||
"error" = "Error";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Bash
|
|
||||||
bashIde.shellcheckPath = "${pkgs.shellcheck}/bin/shellcheck";
|
|
||||||
|
|
||||||
markdownlint.config = {
|
|
||||||
no-trailing-spaces = true;
|
|
||||||
no-multiple-blanks = false;
|
|
||||||
no-duplicate-heading = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
extraConfig = fileContents ./base.vim;
|
|
||||||
extraLuaConfig = fileContents ./base.lua;
|
|
||||||
|
|
||||||
plugins = with pkgs.vimPlugins;
|
|
||||||
([
|
|
||||||
fzfWrapper
|
|
||||||
fzf-vim
|
|
||||||
fugitive
|
|
||||||
|
|
||||||
{
|
|
||||||
plugin = dracula-nvim.overrideAttrs {
|
|
||||||
src = nvim-theme-src;
|
|
||||||
};
|
|
||||||
type = "viml";
|
|
||||||
config = fileContents ./plugins/dracula.vim;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
plugin = todo-comments-nvim;
|
|
||||||
type = "lua";
|
|
||||||
config =
|
|
||||||
/*
|
|
||||||
lua
|
|
||||||
*/
|
|
||||||
''require('todo-comments').setup()'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
plugin = gitsigns-nvim;
|
|
||||||
type = "lua";
|
|
||||||
config = fileContents ./plugins/gitsigns.lua;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
plugin = indent-blankline-nvim;
|
|
||||||
type = "lua";
|
|
||||||
config = fileContents ./plugins/indent.lua;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
plugin = mini-nvim;
|
|
||||||
type = "lua";
|
|
||||||
config = fileContents ./plugins/mini.lua;
|
|
||||||
}
|
|
||||||
]
|
|
||||||
++ optionals neovimIde [
|
|
||||||
markdown-preview-nvim
|
|
||||||
|
|
||||||
# Coc configured
|
|
||||||
coc-css
|
|
||||||
coc-eslint
|
|
||||||
coc-java
|
|
||||||
coc-sh
|
|
||||||
coc-stylelintplus-flake
|
|
||||||
{
|
|
||||||
plugin = coc-snippets;
|
|
||||||
type = "viml";
|
|
||||||
config = fileContents ./plugins/snippets.vim;
|
|
||||||
}
|
|
||||||
|
|
||||||
## Lua
|
|
||||||
coc-sumneko-lua
|
|
||||||
neodev-nvim
|
|
||||||
|
|
||||||
## Fzf
|
|
||||||
coc-fzf
|
|
||||||
|
|
||||||
coc-highlight
|
|
||||||
coc-json
|
|
||||||
coc-pyright
|
|
||||||
coc-vimlsp
|
|
||||||
coc-yaml
|
|
||||||
coc-toml
|
|
||||||
coc-markdownlint
|
|
||||||
coc-tsserver
|
|
||||||
|
|
||||||
{
|
|
||||||
plugin = nvim-autopairs;
|
|
||||||
type = "lua";
|
|
||||||
config = fileContents ./plugins/autopairs.lua;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
plugin = lualine-nvim;
|
|
||||||
type = "lua";
|
|
||||||
config = fileContents ./plugins/lualine.lua;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
plugin = neo-tree-nvim;
|
|
||||||
type = "viml";
|
|
||||||
config = ''
|
|
||||||
${fileContents ./plugins/neotree.vim}
|
|
||||||
|
|
||||||
lua << EOF
|
|
||||||
${fileContents ./plugins/neotree.lua}
|
|
||||||
EOF
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
(pkgs.vimUtils.buildVimPlugin {
|
|
||||||
name = "riscv-asm";
|
|
||||||
src = vimplugin-riscv-src;
|
|
||||||
})
|
|
||||||
])
|
|
||||||
# Treesitter
|
|
||||||
++ (with pkgs.vimPlugins; [
|
|
||||||
nvim-treesitter-context
|
|
||||||
nvim-treesitter-textobjects
|
|
||||||
{
|
|
||||||
type = "viml";
|
|
||||||
config = fileContents ./plugins/treesitter.vim;
|
|
||||||
plugin = nvim-treesitter.withPlugins (p: [
|
|
||||||
p.awk
|
|
||||||
p.bash
|
|
||||||
p.c
|
|
||||||
p.c_sharp
|
|
||||||
p.cairo
|
|
||||||
p.cmake
|
|
||||||
p.comment
|
|
||||||
p.cpp
|
|
||||||
p.css
|
|
||||||
p.csv
|
|
||||||
p.cuda
|
|
||||||
p.diff
|
|
||||||
p.dockerfile
|
|
||||||
p.dot
|
|
||||||
p.git_config
|
|
||||||
p.git_rebase
|
|
||||||
p.gitattributes
|
|
||||||
p.gitcommit
|
|
||||||
p.gitignore
|
|
||||||
p.go
|
|
||||||
p.gomod
|
|
||||||
p.gosum
|
|
||||||
p.groovy
|
|
||||||
p.haskell
|
|
||||||
p.haskell_persistent
|
|
||||||
p.hyprlang
|
|
||||||
p.html
|
|
||||||
p.ini
|
|
||||||
p.java
|
|
||||||
p.javascript
|
|
||||||
p.jq
|
|
||||||
p.jsdoc
|
|
||||||
p.json
|
|
||||||
p.json5
|
|
||||||
p.jsonc
|
|
||||||
p.jsonnet
|
|
||||||
p.kotlin
|
|
||||||
p.latex
|
|
||||||
p.lua
|
|
||||||
p.luadoc
|
|
||||||
p.make
|
|
||||||
p.markdown
|
|
||||||
p.meson
|
|
||||||
p.ninja
|
|
||||||
p.nix
|
|
||||||
p.passwd
|
|
||||||
p.perl
|
|
||||||
p.php
|
|
||||||
p.phpdoc
|
|
||||||
p.properties
|
|
||||||
p.python
|
|
||||||
p.rasi
|
|
||||||
p.regex
|
|
||||||
p.requirements
|
|
||||||
p.ruby
|
|
||||||
p.rust
|
|
||||||
p.scss
|
|
||||||
p.sql
|
|
||||||
p.ssh_config
|
|
||||||
p.toml
|
|
||||||
p.todotxt
|
|
||||||
p.typescript
|
|
||||||
p.udev
|
|
||||||
p.vim
|
|
||||||
p.vimdoc
|
|
||||||
p.vue
|
|
||||||
p.xml
|
|
||||||
p.yaml
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
31
common/home/neovim/git.nix
Normal file
31
common/home/neovim/git.nix
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{pkgs, ...}: {
|
||||||
|
programs = {
|
||||||
|
neovim = {
|
||||||
|
plugins = [
|
||||||
|
pkgs.vimPlugins.fugitive
|
||||||
|
|
||||||
|
{
|
||||||
|
plugin = pkgs.vimPlugins.gitsigns-nvim;
|
||||||
|
type = "lua";
|
||||||
|
config =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
local gitsigns = require("gitsigns");
|
||||||
|
|
||||||
|
local function visual_stage()
|
||||||
|
local first_line = vim.fn.line('v');
|
||||||
|
local last_line = vim.fn.getpos('.')[2];
|
||||||
|
gitsigns.stage_hunk({ first_line, last_line });
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set("v", "gs", function()
|
||||||
|
visual_stage()
|
||||||
|
end);
|
||||||
|
|
||||||
|
gitsigns.setup();
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
48
common/home/neovim/langs/bash.nix
Normal file
48
common/home/neovim/langs/bash.nix
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) getExe mkIf;
|
||||||
|
inherit (config.vars) neovimIde;
|
||||||
|
in {
|
||||||
|
programs = {
|
||||||
|
# I love doing typos
|
||||||
|
bash.shellAliases = {
|
||||||
|
nivm = "nvim";
|
||||||
|
nivim = "nvim";
|
||||||
|
};
|
||||||
|
|
||||||
|
neovim = {
|
||||||
|
defaultEditor = true;
|
||||||
|
viAlias = true;
|
||||||
|
vimAlias = true;
|
||||||
|
|
||||||
|
extraPackages = mkIf neovimIde [
|
||||||
|
pkgs.nodePackages.bash-language-server
|
||||||
|
pkgs.shellcheck
|
||||||
|
];
|
||||||
|
|
||||||
|
extraLuaConfig =
|
||||||
|
mkIf neovimIde
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
pattern = 'sh',
|
||||||
|
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||||
|
});
|
||||||
|
|
||||||
|
require('lspconfig').bashls.setup({
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
bashIde = {
|
||||||
|
shellcheckPath = '${getExe pkgs.shellcheck}',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
52
common/home/neovim/langs/clang.nix
Normal file
52
common/home/neovim/langs/clang.nix
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
inherit (config.vars) neovimIde;
|
||||||
|
in
|
||||||
|
mkIf neovimIde {
|
||||||
|
programs = {
|
||||||
|
neovim = {
|
||||||
|
extraPackages = builtins.attrValues {
|
||||||
|
inherit
|
||||||
|
(pkgs)
|
||||||
|
gcc
|
||||||
|
clang-tools
|
||||||
|
cmake-language-server
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
|
extraLuaConfig =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
pattern = { 'cpp' , 'c'},
|
||||||
|
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||||
|
});
|
||||||
|
|
||||||
|
local lsp = require('lspconfig');
|
||||||
|
|
||||||
|
lsp.cmake.setup({
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
|
});
|
||||||
|
|
||||||
|
lsp.clangd.setup({
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
|
|
||||||
|
handlers = require('lsp-status').extensions.clangd.setup(),
|
||||||
|
on_attach = function(_, bufnr)
|
||||||
|
require("clangd_extensions.inlay_hints").setup_autocmd()
|
||||||
|
require("clangd_extensions.inlay_hints").set_inlay_hints()
|
||||||
|
end,
|
||||||
|
});
|
||||||
|
'';
|
||||||
|
|
||||||
|
plugins = builtins.attrValues {
|
||||||
|
inherit (pkgs.vimPlugins) clangd_extensions-nvim;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
103
common/home/neovim/langs/default.nix
Normal file
103
common/home/neovim/langs/default.nix
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) fileContents mkBefore mkIf;
|
||||||
|
inherit (config.vars) neovimIde;
|
||||||
|
in {
|
||||||
|
imports = [
|
||||||
|
./bash.nix
|
||||||
|
./clang.nix
|
||||||
|
./hyprlang.nix
|
||||||
|
./java.nix
|
||||||
|
./json.nix
|
||||||
|
./lua.nix
|
||||||
|
./markdown.nix
|
||||||
|
./nix.nix
|
||||||
|
./python.nix
|
||||||
|
./rust.nix
|
||||||
|
./web.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
programs = mkIf neovimIde {
|
||||||
|
neovim = {
|
||||||
|
extraLuaConfig =
|
||||||
|
mkBefore
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
-- Start completion / snippet stuff
|
||||||
|
vim.g.coq_settings = {
|
||||||
|
auto_start = 'shut-up',
|
||||||
|
keymap = {
|
||||||
|
recommended = false,
|
||||||
|
},
|
||||||
|
-- https://github.com/NixOS/nixpkgs/issues/168928#issuecomment-1109581739
|
||||||
|
xdg = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
-- Add formatting cmd
|
||||||
|
vim.api.nvim_create_user_command(
|
||||||
|
'Format',
|
||||||
|
function()
|
||||||
|
vim.lsp.buf.format({ async = true });
|
||||||
|
end,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
-- LSP-Status setup
|
||||||
|
local lsp_status = require('lsp-status');
|
||||||
|
lsp_status.register_progress();
|
||||||
|
|
||||||
|
-- Remove LSP highlighting to use Treesitter
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
callback = function(args)
|
||||||
|
local client = vim.lsp.get_client_by_id(args.data.client_id);
|
||||||
|
client.server_capabilities.semanticTokensProvider = nil;
|
||||||
|
lsp_status.on_attach(client);
|
||||||
|
end,
|
||||||
|
});
|
||||||
|
|
||||||
|
-- Disable virtual_text since it's redundant due to lsp_lines.
|
||||||
|
vim.diagnostic.config({
|
||||||
|
virtual_text = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
require('lsp_lines').setup();
|
||||||
|
'';
|
||||||
|
|
||||||
|
plugins =
|
||||||
|
(builtins.attrValues {
|
||||||
|
inherit
|
||||||
|
(pkgs.vimPlugins)
|
||||||
|
nvim-lspconfig
|
||||||
|
lsp-status-nvim
|
||||||
|
lsp_lines-nvim
|
||||||
|
cmp-buffer
|
||||||
|
cmp-nvim-lsp
|
||||||
|
cmp-path
|
||||||
|
cmp-spell
|
||||||
|
vim-vsnip
|
||||||
|
;
|
||||||
|
})
|
||||||
|
++ [
|
||||||
|
{
|
||||||
|
plugin = pkgs.vimPlugins.nvim-cmp;
|
||||||
|
type = "lua";
|
||||||
|
config = fileContents ../plugins/cmp.lua;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
plugin = pkgs.vimPlugins.nvim-autopairs;
|
||||||
|
type = "lua";
|
||||||
|
config =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
require('nvim-autopairs').setup({});
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
26
common/home/neovim/langs/hyprlang.nix
Normal file
26
common/home/neovim/langs/hyprlang.nix
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
inherit (config.vars) neovimIde;
|
||||||
|
in
|
||||||
|
mkIf neovimIde {
|
||||||
|
programs = {
|
||||||
|
neovim = {
|
||||||
|
extraLuaConfig =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
vim.filetype.add({
|
||||||
|
pattern = { ['.*/hypr/.*%.conf'] = 'hyprlang' },
|
||||||
|
});
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
pattern = 'hyprlang',
|
||||||
|
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||||
|
});
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
83
common/home/neovim/langs/java.nix
Normal file
83
common/home/neovim/langs/java.nix
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) getExe mkIf;
|
||||||
|
inherit (config.vars) neovimIde;
|
||||||
|
|
||||||
|
javaSdk = pkgs.temurin-bin-17;
|
||||||
|
javaPkgs = builtins.attrValues {inherit (pkgs) gradle maven;};
|
||||||
|
in
|
||||||
|
mkIf neovimIde {
|
||||||
|
home.packages = javaPkgs;
|
||||||
|
|
||||||
|
xdg.dataFile.".gradle/gradle.properties".text = ''
|
||||||
|
org.gradle.java.home = ${javaSdk}
|
||||||
|
'';
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
java = {
|
||||||
|
enable = true;
|
||||||
|
package = javaSdk;
|
||||||
|
};
|
||||||
|
|
||||||
|
neovim = {
|
||||||
|
extraPackages = javaPkgs;
|
||||||
|
|
||||||
|
extraLuaConfig =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
pattern = 'java',
|
||||||
|
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||||
|
});
|
||||||
|
'';
|
||||||
|
|
||||||
|
plugins = [
|
||||||
|
{
|
||||||
|
# TOOD: setup debugger https://github.com/mfussenegger/nvim-jdtls#debugger-via-nvim-dap
|
||||||
|
plugin = pkgs.vimPlugins.nvim-jdtls;
|
||||||
|
type = "lua";
|
||||||
|
config =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
--
|
||||||
|
local startJdtls = function()
|
||||||
|
local config = {
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
|
|
||||||
|
cmd = { '${getExe pkgs.jdt-language-server}' },
|
||||||
|
root_dir = vim.fs.dirname(vim.fs.find(
|
||||||
|
{ 'gradlew', '.git', 'mvnw', 'pom.xml' },
|
||||||
|
{ upward = true }
|
||||||
|
)[1]),
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
java = {
|
||||||
|
configuration = {
|
||||||
|
runtimes = {
|
||||||
|
{
|
||||||
|
name = 'JavaSE-17',
|
||||||
|
path = '${javaSdk}',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
require('jdtls').start_or_attach(config);
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
pattern = 'java',
|
||||||
|
callback = startJdtls,
|
||||||
|
});
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
55
common/home/neovim/langs/json.nix
Normal file
55
common/home/neovim/langs/json.nix
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
inherit (config.vars) neovimIde;
|
||||||
|
in
|
||||||
|
mkIf neovimIde {
|
||||||
|
programs = {
|
||||||
|
neovim = {
|
||||||
|
extraPackages = builtins.attrValues {
|
||||||
|
inherit
|
||||||
|
(pkgs)
|
||||||
|
vscode-langservers-extracted
|
||||||
|
yaml-language-server
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
|
extraLuaConfig =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
pattern = 'yaml',
|
||||||
|
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||||
|
});
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
pattern = 'json',
|
||||||
|
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||||
|
});
|
||||||
|
|
||||||
|
local lsp = require('lspconfig');
|
||||||
|
|
||||||
|
lsp.jsonls.setup({
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
|
});
|
||||||
|
|
||||||
|
lsp.yamlls.setup({
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
yaml = {
|
||||||
|
schemas = {
|
||||||
|
[
|
||||||
|
"https://json.schemastore.org/github-workflow.json"
|
||||||
|
] = "/.github/workflows/*",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
49
common/home/neovim/langs/lua.nix
Normal file
49
common/home/neovim/langs/lua.nix
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
inherit (config.vars) neovimIde;
|
||||||
|
|
||||||
|
flakeEnv = config.programs.bash.sessionVariables.FLAKE;
|
||||||
|
in
|
||||||
|
mkIf neovimIde {
|
||||||
|
programs = {
|
||||||
|
neovim = {
|
||||||
|
extraPackages = builtins.attrValues {
|
||||||
|
inherit (pkgs) lua-language-server;
|
||||||
|
};
|
||||||
|
|
||||||
|
plugins = [
|
||||||
|
{
|
||||||
|
plugin = pkgs.vimPlugins.neodev-nvim;
|
||||||
|
type = "lua";
|
||||||
|
config =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
pattern = 'lua',
|
||||||
|
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||||
|
});
|
||||||
|
|
||||||
|
-- IMPORTANT: make sure to setup neodev BEFORE lspconfig
|
||||||
|
require("neodev").setup({
|
||||||
|
override = function(root_dir, library)
|
||||||
|
if root_dir:find('${flakeEnv}', 1, true) == 1 then
|
||||||
|
library.enabled = true
|
||||||
|
library.plugins = true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
});
|
||||||
|
|
||||||
|
require('lspconfig').lua_ls.setup({
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
|
});
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
128
common/home/neovim/langs/markdown.nix
Normal file
128
common/home/neovim/langs/markdown.nix
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
self,
|
||||||
|
vimplugin-easytables-src,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
inherit (config.vars) neovimIde;
|
||||||
|
|
||||||
|
inherit (import "${self}/lib" {inherit pkgs;}) buildPlugin;
|
||||||
|
in
|
||||||
|
mkIf neovimIde {
|
||||||
|
programs = {
|
||||||
|
neovim = {
|
||||||
|
extraPackages = builtins.attrValues {
|
||||||
|
inherit
|
||||||
|
(pkgs)
|
||||||
|
pandoc
|
||||||
|
texlab
|
||||||
|
texliveFull
|
||||||
|
rubber
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
|
extraLuaConfig =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
local lsp = require('lspconfig');
|
||||||
|
|
||||||
|
lsp.texlab.setup({
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
texlab = {
|
||||||
|
formatterLineLength = 100,
|
||||||
|
latexFormatter = 'latexindent',
|
||||||
|
latexindent = {
|
||||||
|
modifyLineBreaks = false,
|
||||||
|
["local"] = '.indentconfig.yaml';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
'';
|
||||||
|
|
||||||
|
plugins = [
|
||||||
|
{
|
||||||
|
plugin = buildPlugin "easytables-nvim" vimplugin-easytables-src;
|
||||||
|
type = "lua";
|
||||||
|
config =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
require('easytables').setup();
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
plugin = pkgs.vimPlugins.knap;
|
||||||
|
type = "lua";
|
||||||
|
config =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
--
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
pattern = 'tex',
|
||||||
|
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||||
|
});
|
||||||
|
|
||||||
|
vim.g.knap_settings = {
|
||||||
|
-- HTML
|
||||||
|
htmloutputext = 'html',
|
||||||
|
htmltohtml = 'none',
|
||||||
|
htmltohtmlviewerlaunch = "",
|
||||||
|
htmltohtmlviewerrefresh = 'none',
|
||||||
|
|
||||||
|
-- Markdown
|
||||||
|
mdoutputext = 'html',
|
||||||
|
markdownoutputext = 'html',
|
||||||
|
|
||||||
|
-- Markdown to PDF
|
||||||
|
mdtopdf = 'pandoc %docroot% -o /tmp/%outputfile%',
|
||||||
|
markdowntopdf = 'pandoc %docroot% -o /tmp/%outputfile%',
|
||||||
|
mdtopdfviewerlaunch = 'sioyek /tmp/%outputfile%',
|
||||||
|
markdowntopdfviewerlaunch = 'sioyek /tmp/%outputfile%',
|
||||||
|
mdtopdfviewerrefresh = 'none',
|
||||||
|
markdowntopdfviewerrefresh = "none",
|
||||||
|
|
||||||
|
-- Markdown to HTML
|
||||||
|
mdtohtml = 'pandoc --standalone %docroot% -o /tmp/%outputfile%',
|
||||||
|
markdowntohtml = 'pandoc --standalone %docroot% -o /tmp/%outputfile%',
|
||||||
|
mdtohtmlviewerlaunch = 'firefox -new-window /tmp/%outputfile%',
|
||||||
|
markdowntohtmlviewerlaunch = 'firefox -new-window /tmp/%outputfile%',
|
||||||
|
mdtohtmlviewerrefresh = 'none',
|
||||||
|
markdowntohtmlviewerrefresh = 'none',
|
||||||
|
|
||||||
|
-- LaTeX
|
||||||
|
-- TODO: stop from polluting workspace
|
||||||
|
};
|
||||||
|
|
||||||
|
-- F4 processes the document once, and refreshes the view
|
||||||
|
vim.keymap.set({ 'n', 'v', 'i' }, '<F4>', function()
|
||||||
|
require('knap').process_once();
|
||||||
|
end);
|
||||||
|
|
||||||
|
-- F5 closes the viewer application, and
|
||||||
|
-- allows settings to be reset
|
||||||
|
vim.keymap.set({ 'n', 'v', 'i' }, '<F5>', function()
|
||||||
|
require('knap').close_viewer();
|
||||||
|
end);
|
||||||
|
|
||||||
|
-- F6 toggles the auto-processing on and off
|
||||||
|
vim.keymap.set({ 'n', 'v', 'i' }, '<F6>', function()
|
||||||
|
require('knap').toggle_autopreviewing();
|
||||||
|
end);
|
||||||
|
|
||||||
|
-- F7 invokes a SyncTeX forward search, or similar,
|
||||||
|
-- where appropriate
|
||||||
|
vim.keymap.set({ 'n', 'v', 'i' }, '<F7>', function()
|
||||||
|
require('knap').forward_jump();
|
||||||
|
end);
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
75
common/home/neovim/langs/nix.nix
Normal file
75
common/home/neovim/langs/nix.nix
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
nixd,
|
||||||
|
self,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) getExe hasPrefix mkIf removePrefix;
|
||||||
|
inherit (config.vars) hostName mainUser neovimIde;
|
||||||
|
|
||||||
|
defaultFormatter = self.formatter.${pkgs.system};
|
||||||
|
|
||||||
|
nixdPkg = nixd.packages.${pkgs.system}.default;
|
||||||
|
|
||||||
|
flakeEnv = config.programs.bash.sessionVariables.FLAKE;
|
||||||
|
flakeDir = "${removePrefix "/home/${mainUser}/" flakeEnv}";
|
||||||
|
in
|
||||||
|
mkIf neovimIde {
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion =
|
||||||
|
neovimIde
|
||||||
|
&& hasPrefix "/home/${mainUser}/" flakeEnv
|
||||||
|
|| !neovimIde;
|
||||||
|
message = ''
|
||||||
|
Your $FLAKE environment variable needs to point to a directory in
|
||||||
|
the main users' home to use the neovim module.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
home.packages = [
|
||||||
|
defaultFormatter
|
||||||
|
nixdPkg
|
||||||
|
];
|
||||||
|
|
||||||
|
# nixd by default kinda spams LspLog
|
||||||
|
home.sessionVariables.NIXD_FLAGS = "-log=error";
|
||||||
|
|
||||||
|
xdg.dataFile."${flakeDir}/.nixd.json".text = builtins.toJSON {
|
||||||
|
nixpkgs = {
|
||||||
|
expr = "import (builtins.getFlake \"${flakeDir}\").inputs.nixpkgs {}";
|
||||||
|
};
|
||||||
|
options.nixos = {
|
||||||
|
expr = "(builtins.getFlake \"${flakeDir}\").nixosConfigurations.${hostName}.options";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
neovim = {
|
||||||
|
extraPackages = [
|
||||||
|
nixdPkg
|
||||||
|
];
|
||||||
|
|
||||||
|
extraLuaConfig =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
require('lspconfig').nixd.setup({
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
|
|
||||||
|
filetypes = { 'nix', 'in.nix' },
|
||||||
|
settings = {
|
||||||
|
nixd = {
|
||||||
|
formatting = {
|
||||||
|
-- TODO: Try to find <flake>.formatter
|
||||||
|
command = { '${getExe defaultFormatter}' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
28
common/home/neovim/langs/python.nix
Normal file
28
common/home/neovim/langs/python.nix
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
inherit (config.vars) neovimIde;
|
||||||
|
in
|
||||||
|
mkIf neovimIde {
|
||||||
|
programs = {
|
||||||
|
neovim = {
|
||||||
|
withPython3 = true;
|
||||||
|
|
||||||
|
extraPackages = [
|
||||||
|
pkgs.basedpyright
|
||||||
|
];
|
||||||
|
|
||||||
|
extraLuaConfig =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
require('lspconfig').basedpyright.setup({
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
|
});
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
37
common/home/neovim/langs/rust.nix
Normal file
37
common/home/neovim/langs/rust.nix
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
inherit (config.vars) neovimIde;
|
||||||
|
in
|
||||||
|
mkIf neovimIde {
|
||||||
|
programs = {
|
||||||
|
neovim = {
|
||||||
|
extraPackages = builtins.attrValues {
|
||||||
|
inherit
|
||||||
|
(pkgs)
|
||||||
|
cargo
|
||||||
|
rustc
|
||||||
|
rust-analyzer
|
||||||
|
rustfmt
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
|
extraLuaConfig =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
pattern = { 'rust' },
|
||||||
|
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||||
|
});
|
||||||
|
|
||||||
|
require('lspconfig').rust_analyzer.setup({
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
|
});
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
157
common/home/neovim/langs/web.nix
Normal file
157
common/home/neovim/langs/web.nix
Normal file
|
@ -0,0 +1,157 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
self,
|
||||||
|
vimplugin-ts-error-translator-src,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
inherit (config.vars) neovimIde;
|
||||||
|
|
||||||
|
inherit (import "${self}/lib" {inherit pkgs;}) buildPlugin;
|
||||||
|
in
|
||||||
|
mkIf neovimIde {
|
||||||
|
programs = {
|
||||||
|
neovim = {
|
||||||
|
withNodeJs = true;
|
||||||
|
|
||||||
|
extraPackages = builtins.attrValues {
|
||||||
|
inherit
|
||||||
|
(pkgs)
|
||||||
|
nodejs_latest
|
||||||
|
vscode-langservers-extracted
|
||||||
|
;
|
||||||
|
|
||||||
|
inherit
|
||||||
|
(pkgs.nodePackages)
|
||||||
|
npm
|
||||||
|
neovim
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
|
extraLuaConfig =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
pattern = { 'javascript', 'typescript', 'css', 'scss' },
|
||||||
|
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||||
|
});
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
pattern = 'html',
|
||||||
|
command = 'setlocal ts=2 sw=2 expandtab',
|
||||||
|
});
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
pattern = 'scss',
|
||||||
|
command = 'setlocal iskeyword+=@-@',
|
||||||
|
});
|
||||||
|
|
||||||
|
local lsp = require('lspconfig');
|
||||||
|
local tsserver = require('typescript-tools');
|
||||||
|
|
||||||
|
tsserver.setup({
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
|
|
||||||
|
handlers = {
|
||||||
|
-- format error code with better error message
|
||||||
|
['textDocument/publishDiagnostics'] = function(err, result, ctx, config)
|
||||||
|
require('ts-error-translator').translate_diagnostics(err, result, ctx, config)
|
||||||
|
vim.lsp.diagnostic.on_publish_diagnostics(err, result, ctx, config)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
lsp.eslint.setup({
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
|
|
||||||
|
-- auto-save
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||||
|
buffer = bufnr,
|
||||||
|
command = 'EslintFixAll',
|
||||||
|
});
|
||||||
|
end,
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
validate = 'on',
|
||||||
|
packageManager = 'npm',
|
||||||
|
useESLintClass = true,
|
||||||
|
useFlatConfig = true,
|
||||||
|
experimental = {
|
||||||
|
useFlatConfig = true,
|
||||||
|
},
|
||||||
|
codeAction = {
|
||||||
|
disableRuleComment = {
|
||||||
|
enable = true,
|
||||||
|
location = 'separateLine'
|
||||||
|
},
|
||||||
|
showDocumentation = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
codeActionOnSave = {
|
||||||
|
mode = 'all',
|
||||||
|
rules = {},
|
||||||
|
},
|
||||||
|
format = true,
|
||||||
|
quiet = false,
|
||||||
|
onIgnoredFiles = 'off',
|
||||||
|
rulesCustomizations = {},
|
||||||
|
run = 'onType',
|
||||||
|
problems = {
|
||||||
|
shortenToSingleLine = false,
|
||||||
|
},
|
||||||
|
nodePath = "",
|
||||||
|
workingDirectory = {
|
||||||
|
mode = 'location',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
lsp.cssls.setup({
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
css = {
|
||||||
|
validate = false,
|
||||||
|
},
|
||||||
|
less = {
|
||||||
|
validate = false,
|
||||||
|
},
|
||||||
|
scss = {
|
||||||
|
validate = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
'';
|
||||||
|
|
||||||
|
plugins = [
|
||||||
|
pkgs.vimPlugins.typescript-tools-nvim
|
||||||
|
(buildPlugin "ts-error-translator" vimplugin-ts-error-translator-src)
|
||||||
|
|
||||||
|
{
|
||||||
|
plugin = pkgs.vimPlugins.package-info-nvim;
|
||||||
|
type = "lua";
|
||||||
|
config =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
local packageInfo = require('package-info');
|
||||||
|
packageInfo.setup({
|
||||||
|
hide_up_to_date = true,
|
||||||
|
package_manager = 'npm',
|
||||||
|
});
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
|
||||||
|
pattern = { 'package.json' },
|
||||||
|
callback = function()
|
||||||
|
packageInfo.show({ force = true });
|
||||||
|
end,
|
||||||
|
});
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,16 +0,0 @@
|
||||||
-- Auto indent when pressing Enter between brackets
|
|
||||||
local remap = vim.api.nvim_set_keymap
|
|
||||||
local npairs = require('nvim-autopairs')
|
|
||||||
npairs.setup({map_cr=false})
|
|
||||||
|
|
||||||
_G.MUtils= {}
|
|
||||||
|
|
||||||
MUtils.completion_confirm=function()
|
|
||||||
if vim.fn["coc#pum#visible"]() ~= 0 then
|
|
||||||
return vim.fn["coc#pum#confirm"]()
|
|
||||||
else
|
|
||||||
return npairs.autopairs_cr()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
remap('i' , '<CR>','v:lua.MUtils.completion_confirm()', {expr = true , noremap = true})
|
|
50
common/home/neovim/plugins/cmp.lua
Normal file
50
common/home/neovim/plugins/cmp.lua
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
local cmp = require('cmp');
|
||||||
|
local cmp_autopairs = require('nvim-autopairs.completion.cmp');
|
||||||
|
|
||||||
|
cmp.event:on(
|
||||||
|
'confirm_done',
|
||||||
|
cmp_autopairs.on_confirm_done()
|
||||||
|
);
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
sources = {
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'buffer' },
|
||||||
|
{ name = 'path' },
|
||||||
|
},
|
||||||
|
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
vim.fn['vsnip#anonymous'](args.body);
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
mapping = {
|
||||||
|
-- Confirm selection
|
||||||
|
['<Right>'] = cmp.mapping.confirm({ select = true }),
|
||||||
|
|
||||||
|
-- Next selection
|
||||||
|
['<Down>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item();
|
||||||
|
else
|
||||||
|
fallback();
|
||||||
|
end;
|
||||||
|
end, {
|
||||||
|
'i',
|
||||||
|
's',
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- Previous selection
|
||||||
|
['<Up>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item();
|
||||||
|
else
|
||||||
|
fallback();
|
||||||
|
end;
|
||||||
|
end, {
|
||||||
|
'i',
|
||||||
|
's',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
});
|
|
@ -1,10 +0,0 @@
|
||||||
" set dot icon in place of trailing whitespaces
|
|
||||||
set list listchars=tab:\ \ ,nbsp:␣,trail:•,extends:⟩,precedes:⟨
|
|
||||||
|
|
||||||
|
|
||||||
lua << EOF
|
|
||||||
-- Add visual indicator for trailing whitespaces
|
|
||||||
vim.opt.fillchars = {eob = " "}
|
|
||||||
|
|
||||||
vim.cmd[[colorscheme dracula]]
|
|
||||||
EOF
|
|
|
@ -1,13 +0,0 @@
|
||||||
local gitsigns = require("gitsigns")
|
|
||||||
|
|
||||||
local function visual_stage()
|
|
||||||
local first_line = vim.fn.line('v')
|
|
||||||
local last_line = vim.fn.getpos('.')[2]
|
|
||||||
gitsigns.stage_hunk({ first_line, last_line })
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.keymap.set("v", "gs", function()
|
|
||||||
visual_stage()
|
|
||||||
end)
|
|
||||||
|
|
||||||
gitsigns.setup();
|
|
443
common/home/neovim/plugins/heirline.lua
Normal file
443
common/home/neovim/plugins/heirline.lua
Normal file
|
@ -0,0 +1,443 @@
|
||||||
|
-- Modified from https://github.com/lauranaujokat/nvim/blob/4102c789d05667f636107e3dae4ac589053ee88d/lua/setups/heirline.lua#L4
|
||||||
|
|
||||||
|
local conditions = require('heirline.conditions');
|
||||||
|
local utils = require('heirline.utils');
|
||||||
|
|
||||||
|
---@class Palette
|
||||||
|
---@field [string] any
|
||||||
|
local dracula = require('dracula').colors();
|
||||||
|
|
||||||
|
local colors = {
|
||||||
|
bright_bg = dracula.selection,
|
||||||
|
dark_bg = dracula.menu,
|
||||||
|
bright_fg = dracula.fg,
|
||||||
|
red = dracula.red,
|
||||||
|
dark_red = utils.get_highlight('DiffDelete').bg,
|
||||||
|
green = dracula.green,
|
||||||
|
blue = dracula.blue,
|
||||||
|
gray = utils.get_highlight('NonText').fg,
|
||||||
|
orange = utils.get_highlight('Constant').fg,
|
||||||
|
purple = utils.get_highlight('Statement').fg,
|
||||||
|
cyan = dracula.cyan,
|
||||||
|
diag_warn = utils.get_highlight('DiagnosticWarn').fg,
|
||||||
|
diag_error = utils.get_highlight('DiagnosticError').fg,
|
||||||
|
diag_hint = utils.get_highlight('DiagnosticHint').fg,
|
||||||
|
diag_info = utils.get_highlight('DiagnosticInfo').fg,
|
||||||
|
git_del = utils.get_highlight('GitSignsDelete').fg,
|
||||||
|
git_add = utils.get_highlight('GitSignsAdd').fg,
|
||||||
|
git_change = utils.get_highlight('GitSignsChange').fg,
|
||||||
|
};
|
||||||
|
|
||||||
|
require('heirline').load_colors(colors);
|
||||||
|
|
||||||
|
local ViMode = {
|
||||||
|
-- get vim current mode, this information will be required by the provider
|
||||||
|
-- and the highlight functions, so we compute it only once per component
|
||||||
|
-- evaluation and store it as a component attribute
|
||||||
|
init = function(self)
|
||||||
|
self.mode = vim.fn.mode(1);
|
||||||
|
|
||||||
|
-- execute this only once, this is required if you want the ViMode
|
||||||
|
-- component to be updated on operator pending mode
|
||||||
|
if not self.once then
|
||||||
|
vim.api.nvim_create_autocmd('ModeChanged', {
|
||||||
|
pattern = '*:*o',
|
||||||
|
command = 'redrawstatus',
|
||||||
|
});
|
||||||
|
self.once = true;
|
||||||
|
end;
|
||||||
|
end,
|
||||||
|
|
||||||
|
static = {
|
||||||
|
mode_names = {
|
||||||
|
n = 'N',
|
||||||
|
no = 'N?',
|
||||||
|
nov = 'N?',
|
||||||
|
noV = 'N?',
|
||||||
|
['no\22'] = 'N?',
|
||||||
|
niI = 'Ni',
|
||||||
|
niR = 'Nr',
|
||||||
|
niV = 'Nv',
|
||||||
|
nt = 'Nt',
|
||||||
|
v = 'V',
|
||||||
|
vs = 'Vs',
|
||||||
|
V = 'V_',
|
||||||
|
Vs = 'Vs',
|
||||||
|
['\22'] = '^V',
|
||||||
|
['\22s'] = '^V',
|
||||||
|
s = 'S',
|
||||||
|
S = 'S_',
|
||||||
|
['\19'] = '^S',
|
||||||
|
i = 'I',
|
||||||
|
ic = 'Ic',
|
||||||
|
ix = 'Ix',
|
||||||
|
R = 'R',
|
||||||
|
Rc = 'Rc',
|
||||||
|
Rx = 'Rx',
|
||||||
|
Rv = 'Rv',
|
||||||
|
Rvc = 'Rv',
|
||||||
|
Rvx = 'Rv',
|
||||||
|
c = 'C',
|
||||||
|
cv = 'Ex',
|
||||||
|
r = '...',
|
||||||
|
rm = 'M',
|
||||||
|
['r?'] = '?',
|
||||||
|
['!'] = '!',
|
||||||
|
t = 'T',
|
||||||
|
},
|
||||||
|
|
||||||
|
mode_colors = {
|
||||||
|
n = 'red',
|
||||||
|
i = 'green',
|
||||||
|
v = 'cyan',
|
||||||
|
V = 'cyan',
|
||||||
|
['\22'] = 'cyan',
|
||||||
|
c = 'orange',
|
||||||
|
s = 'purple',
|
||||||
|
S = 'purple',
|
||||||
|
['\19'] = 'purple',
|
||||||
|
R = 'orange',
|
||||||
|
r = 'orange',
|
||||||
|
['!'] = 'red',
|
||||||
|
t = 'red',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- To be extra meticulous, we can also add some vim statusline syntax to
|
||||||
|
-- control the padding and make sure our string is always at least 2
|
||||||
|
-- characters long. Plus a nice Icon.
|
||||||
|
provider = function(self)
|
||||||
|
return ' ' .. self.mode_names[self.mode] .. '%)';
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- Same goes for the highlight. Now the foreground will change according to the current mode.
|
||||||
|
hl = function(self)
|
||||||
|
local mode = self.mode:sub(1, 1); -- get only the first mode character
|
||||||
|
return { fg = self.mode_colors[mode], bold = true };
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- Re-evaluate the component only on ModeChanged event
|
||||||
|
update = {
|
||||||
|
'ModeChanged',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
local FileNameBlock = {
|
||||||
|
init = function(self)
|
||||||
|
self.filename = vim.api.nvim_buf_get_name(0);
|
||||||
|
end,
|
||||||
|
};
|
||||||
|
|
||||||
|
-- FileNameBlock children
|
||||||
|
local FileIcon = {
|
||||||
|
init = function(self)
|
||||||
|
local filename = self.filename;
|
||||||
|
local extension = vim.fn.fnamemodify(filename, ':e');
|
||||||
|
self.icon, self.icon_color =
|
||||||
|
require('nvim-web-devicons').get_icon_color(filename, extension, { default = true });
|
||||||
|
end,
|
||||||
|
|
||||||
|
provider = function(self)
|
||||||
|
return self.icon and (self.icon .. ' ');
|
||||||
|
end,
|
||||||
|
|
||||||
|
hl = function(self)
|
||||||
|
return { fg = self.icon_color };
|
||||||
|
end,
|
||||||
|
};
|
||||||
|
|
||||||
|
local FileName = {
|
||||||
|
provider = function(self)
|
||||||
|
-- first, trim the pattern relative to the current directory. For other
|
||||||
|
-- options, see :h filename-modifers
|
||||||
|
local filename = vim.fn.fnamemodify(self.filename, ':.');
|
||||||
|
if filename == '' then
|
||||||
|
return '[No Name]';
|
||||||
|
end;
|
||||||
|
-- now, if the filename would occupy more than 1/4th of the available
|
||||||
|
-- space, we trim the file path to its initials
|
||||||
|
-- See Flexible Components section below for dynamic truncation
|
||||||
|
if not conditions.width_percent_below(#filename, 0.25) then
|
||||||
|
filename = vim.fn.pathshorten(filename);
|
||||||
|
end;
|
||||||
|
return filename;
|
||||||
|
end,
|
||||||
|
|
||||||
|
hl = { fg = utils.get_highlight('Directory').fg },
|
||||||
|
};
|
||||||
|
|
||||||
|
local FileFlags = {
|
||||||
|
{
|
||||||
|
condition = function()
|
||||||
|
return vim.bo.modified;
|
||||||
|
end,
|
||||||
|
provider = '[+]',
|
||||||
|
hl = { fg = 'green' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
condition = function()
|
||||||
|
return not vim.bo.modifiable or vim.bo.readonly;
|
||||||
|
end,
|
||||||
|
provider = '',
|
||||||
|
hl = { fg = 'orange' },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
local FileNameModifer = {
|
||||||
|
hl = function()
|
||||||
|
if vim.bo.modified then
|
||||||
|
-- use `force` because we need to override the child's hl foreground
|
||||||
|
return { fg = 'cyan', bold = true, force = true };
|
||||||
|
end;
|
||||||
|
end,
|
||||||
|
};
|
||||||
|
|
||||||
|
-- let's add the children to our FileNameBlock component
|
||||||
|
FileNameBlock = utils.insert(
|
||||||
|
FileNameBlock,
|
||||||
|
FileIcon,
|
||||||
|
utils.insert(FileNameModifer, FileName), -- a new table where FileName is a child of FileNameModifier
|
||||||
|
unpack(FileFlags), -- A small optimisation, since their parent does nothing
|
||||||
|
{ provider = '%<' } -- this means that the statusline is cut here when there's not enough space
|
||||||
|
);
|
||||||
|
|
||||||
|
local Ruler = {
|
||||||
|
provider = ' line: %l col: %c',
|
||||||
|
hl = { fg = 'green', bold = false },
|
||||||
|
};
|
||||||
|
|
||||||
|
local ScrollRuler = {
|
||||||
|
-- %l = current line number
|
||||||
|
-- %L = number of lines in the buffer
|
||||||
|
-- %c = column number
|
||||||
|
-- %P = percentage through file of displayed window
|
||||||
|
provider = '%P',
|
||||||
|
};
|
||||||
|
|
||||||
|
local ScrollBar = {
|
||||||
|
static = {
|
||||||
|
sbar = { '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█' },
|
||||||
|
-- sbar = { '🭶', '🭷', '🭸', '🭹', '🭺', '🭻' }
|
||||||
|
},
|
||||||
|
|
||||||
|
provider = function(self)
|
||||||
|
local curr_line = vim.api.nvim_win_get_cursor(0)[1];
|
||||||
|
local lines = vim.api.nvim_buf_line_count(0);
|
||||||
|
local i = math.floor((curr_line - 1) / lines * #self.sbar) + 1;
|
||||||
|
return string.rep(self.sbar[i], 2);
|
||||||
|
end,
|
||||||
|
|
||||||
|
hl = { fg = 'cyan', bg = 'bright_bg' },
|
||||||
|
};
|
||||||
|
|
||||||
|
local LSPActive = {
|
||||||
|
condition = conditions.lsp_attached,
|
||||||
|
update = { 'LspAttach', 'LspDetach' },
|
||||||
|
|
||||||
|
provider = function()
|
||||||
|
local names = {};
|
||||||
|
for _, server in pairs(vim.lsp.get_clients()) do
|
||||||
|
table.insert(names, server.name);
|
||||||
|
end;
|
||||||
|
return ' [' .. table.concat(names, ' ') .. '] ';
|
||||||
|
end,
|
||||||
|
|
||||||
|
hl = { fg = 'green', bold = false },
|
||||||
|
};
|
||||||
|
|
||||||
|
local spinner_frames = { '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏' };
|
||||||
|
|
||||||
|
-- From https://github.com/mhartington/dotfiles/blob/5961460e3a492f7815259a692fca5ca2a1df924a/config/nvim/lua/mh/statusline/lsp_status.lua#L4
|
||||||
|
local function get_lsp_progress()
|
||||||
|
local messages = require('lsp-status/messaging').messages;
|
||||||
|
local buf_messages = messages();
|
||||||
|
local msgs = {};
|
||||||
|
|
||||||
|
for _, msg in ipairs(buf_messages) do
|
||||||
|
local contents;
|
||||||
|
|
||||||
|
if msg.progress then
|
||||||
|
contents = msg.title;
|
||||||
|
|
||||||
|
if msg.spinner then
|
||||||
|
contents = spinner_frames[(msg.spinner % #spinner_frames) + 1] .. ' ' .. contents;
|
||||||
|
end;
|
||||||
|
elseif msg.status then
|
||||||
|
contents = msg.content;
|
||||||
|
|
||||||
|
if msg.uri then
|
||||||
|
local space = math.min(60, math.floor(0.6 * vim.fn.winwidth(0)));
|
||||||
|
local filename = vim.uri_to_fname(msg.uri);
|
||||||
|
|
||||||
|
filename = vim.fn.fnamemodify(filename, ':~:.');
|
||||||
|
|
||||||
|
if #filename > space then
|
||||||
|
filename = vim.fn.pathshorten(filename);
|
||||||
|
end;
|
||||||
|
|
||||||
|
contents = '(' .. filename .. ') ' .. contents;
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
contents = msg.content;
|
||||||
|
end;
|
||||||
|
|
||||||
|
table.insert(msgs, contents);
|
||||||
|
end;
|
||||||
|
|
||||||
|
return table.concat(msgs, ' ');
|
||||||
|
end;
|
||||||
|
|
||||||
|
local LSPMessages = {
|
||||||
|
provider = function()
|
||||||
|
local progress = get_lsp_progress();
|
||||||
|
|
||||||
|
if progress == '' then
|
||||||
|
return '';
|
||||||
|
else
|
||||||
|
return ' ' .. progress;
|
||||||
|
end;
|
||||||
|
end,
|
||||||
|
hl = { fg = 'purple' },
|
||||||
|
};
|
||||||
|
|
||||||
|
local Diagnostics = {
|
||||||
|
condition = conditions.has_diagnostics,
|
||||||
|
|
||||||
|
static = {
|
||||||
|
error_icon = ' ',
|
||||||
|
warn_icon = ' ',
|
||||||
|
info_icon = ' ',
|
||||||
|
hint_icon = ' ',
|
||||||
|
},
|
||||||
|
|
||||||
|
init = function(self)
|
||||||
|
self.errors = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR });
|
||||||
|
self.warnings = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN });
|
||||||
|
self.hints = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT });
|
||||||
|
self.info = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO });
|
||||||
|
end,
|
||||||
|
|
||||||
|
update = { 'DiagnosticChanged', 'BufEnter' },
|
||||||
|
|
||||||
|
{
|
||||||
|
provider = function(self)
|
||||||
|
-- 0 is just another output, we can decide to print it or not!
|
||||||
|
return self.errors > 0 and (self.error_icon .. self.errors);
|
||||||
|
end,
|
||||||
|
hl = { fg = 'diag_error' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provider = function(self)
|
||||||
|
return self.warnings > 0 and (self.warn_icon .. self.warnings);
|
||||||
|
end,
|
||||||
|
hl = { fg = 'diag_warn' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provider = function(self)
|
||||||
|
return self.info > 0 and (self.info_icon .. self.info);
|
||||||
|
end,
|
||||||
|
hl = { fg = 'diag_info' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provider = function(self)
|
||||||
|
return self.hints > 0 and (self.hint_icon .. self.hints);
|
||||||
|
end,
|
||||||
|
hl = { fg = 'diag_hint' },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
local Git = {
|
||||||
|
condition = conditions.is_git_repo,
|
||||||
|
|
||||||
|
init = function(self)
|
||||||
|
self.status_dict = vim.b.gitsigns_status_dict;
|
||||||
|
self.has_changes = self.status_dict.added ~= 0 or
|
||||||
|
self.status_dict.removed ~= 0 or
|
||||||
|
self.status_dict.changed ~= 0;
|
||||||
|
end,
|
||||||
|
|
||||||
|
hl = { fg = 'orange' },
|
||||||
|
|
||||||
|
{ -- git branch name
|
||||||
|
provider = function(self)
|
||||||
|
return ' ' .. self.status_dict.head;
|
||||||
|
end,
|
||||||
|
hl = { bold = true },
|
||||||
|
},
|
||||||
|
-- You could handle delimiters, icons and counts similar to Diagnostics
|
||||||
|
{
|
||||||
|
condition = function(self)
|
||||||
|
return self.has_changes;
|
||||||
|
end,
|
||||||
|
provider = '(',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provider = function(self)
|
||||||
|
local count = self.status_dict.added or 0;
|
||||||
|
return count > 0 and ('+' .. count);
|
||||||
|
end,
|
||||||
|
hl = { fg = 'git_add' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provider = function(self)
|
||||||
|
local count = self.status_dict.removed or 0;
|
||||||
|
return count > 0 and ('-' .. count);
|
||||||
|
end,
|
||||||
|
hl = { fg = 'git_del' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provider = function(self)
|
||||||
|
local count = self.status_dict.changed or 0;
|
||||||
|
return count > 0 and ('~' .. count);
|
||||||
|
end,
|
||||||
|
hl = { fg = 'git_change' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
condition = function(self)
|
||||||
|
return self.has_changes;
|
||||||
|
end,
|
||||||
|
provider = ')',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
local Align = { provider = '%=' };
|
||||||
|
local Space = { provider = ' ' };
|
||||||
|
|
||||||
|
Left = utils.surround({ '', '' }, 'bright_bg', { ViMode, Diagnostics, LSPMessages });
|
||||||
|
Middle = utils.surround({ '', '' }, 'bright_bg', { LSPActive, FileNameBlock, Ruler });
|
||||||
|
Right = utils.surround({ '', '' }, 'bright_bg', { Git, Space, ScrollRuler, Space, ScrollBar });
|
||||||
|
|
||||||
|
local DefaultStatusline = {
|
||||||
|
hl = { bg = 'dark_bg' },
|
||||||
|
condition = function()
|
||||||
|
return true;
|
||||||
|
end,
|
||||||
|
Left,
|
||||||
|
Align,
|
||||||
|
Middle,
|
||||||
|
Align,
|
||||||
|
Right,
|
||||||
|
};
|
||||||
|
|
||||||
|
local StatusLines = {
|
||||||
|
hl = function()
|
||||||
|
if conditions.is_active() then
|
||||||
|
return 'StatusLine';
|
||||||
|
else
|
||||||
|
return 'StatusLineNC';
|
||||||
|
end;
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- the first statusline with no condition, or which condition returns true is used.
|
||||||
|
-- think of it as a switch case with breaks to stop fallthrough.
|
||||||
|
fallthrough = false,
|
||||||
|
|
||||||
|
DefaultStatusline,
|
||||||
|
};
|
||||||
|
|
||||||
|
-- Make it global
|
||||||
|
vim.opt.laststatus = 3;
|
||||||
|
|
||||||
|
require('heirline').setup({
|
||||||
|
statusline = StatusLines,
|
||||||
|
});
|
|
@ -1,26 +0,0 @@
|
||||||
local highlight = {
|
|
||||||
"RainbowRed",
|
|
||||||
"RainbowYellow",
|
|
||||||
"RainbowBlue",
|
|
||||||
"RainbowOrange",
|
|
||||||
"RainbowGreen",
|
|
||||||
"RainbowViolet",
|
|
||||||
"RainbowCyan",
|
|
||||||
}
|
|
||||||
local hooks = require('ibl.hooks')
|
|
||||||
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
|
|
||||||
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
|
|
||||||
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
|
|
||||||
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
|
|
||||||
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
|
|
||||||
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
|
|
||||||
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
|
|
||||||
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
|
|
||||||
end)
|
|
||||||
|
|
||||||
require('ibl').setup({
|
|
||||||
indent = {
|
|
||||||
highlight = highlight,
|
|
||||||
char = "▏",
|
|
||||||
},
|
|
||||||
})
|
|
|
@ -1,9 +0,0 @@
|
||||||
require('lualine').setup({
|
|
||||||
options = {
|
|
||||||
theme = 'dracula',
|
|
||||||
globalstatus = true,
|
|
||||||
},
|
|
||||||
sections = {
|
|
||||||
lualine_x = {'g:coc_status', 'bo:filetype'},
|
|
||||||
}
|
|
||||||
})
|
|
|
@ -1,23 +0,0 @@
|
||||||
local map = require('mini.map')
|
|
||||||
map.setup({
|
|
||||||
integrations = {
|
|
||||||
map.gen_integration.builtin_search(),
|
|
||||||
map.gen_integration.gitsigns(),
|
|
||||||
map.gen_integration.diagnostic(),
|
|
||||||
},
|
|
||||||
window = {
|
|
||||||
focusable = false,
|
|
||||||
width = 7,
|
|
||||||
winblend = 75,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
local ts_input = require('mini.surround').gen_spec.input.treesitter
|
|
||||||
require('mini.surround').setup({
|
|
||||||
custom_surroundings = {
|
|
||||||
-- Use tree-sitter to search for function call
|
|
||||||
f = {
|
|
||||||
input = ts_input({ outer = '@call.outer', inner = '@call.inner' })
|
|
||||||
},
|
|
||||||
}
|
|
||||||
})
|
|
|
@ -1,38 +1,63 @@
|
||||||
-- Override netrw
|
-- Override netrw
|
||||||
vim.g.loaded_netrw = 0
|
vim.g.loaded_netrw = 0;
|
||||||
vim.g.loaded_netrwPlugin = 0
|
vim.g.loaded_netrwPlugin = 0;
|
||||||
|
|
||||||
require('neo-tree').setup({
|
require('neo-tree').setup({
|
||||||
close_if_last_window = true,
|
close_if_last_window = true,
|
||||||
enable_refresh_on_write = true,
|
enable_refresh_on_write = true,
|
||||||
|
|
||||||
window = {
|
window = {
|
||||||
width = 22,
|
width = 22,
|
||||||
},
|
|
||||||
|
|
||||||
filesystem = {
|
|
||||||
use_libuv_file_watcher = true,
|
|
||||||
group_empty_dirs = true,
|
|
||||||
|
|
||||||
filtered_items = {
|
|
||||||
visible = false,
|
|
||||||
hide_dotfiles = false,
|
|
||||||
hide_gitignored = true,
|
|
||||||
hide_by_name = {},
|
|
||||||
hide_by_pattern = {},
|
|
||||||
always_show = {},
|
|
||||||
never_show = {},
|
|
||||||
never_show_by_pattern = {},
|
|
||||||
},
|
},
|
||||||
},
|
|
||||||
|
|
||||||
source_selector = {
|
filesystem = {
|
||||||
winbar = true,
|
use_libuv_file_watcher = true,
|
||||||
statusline = false
|
group_empty_dirs = true,
|
||||||
},
|
|
||||||
|
|
||||||
follow_current_file = {
|
filtered_items = {
|
||||||
enabled = true,
|
visible = false,
|
||||||
leave_dirs_open = true,
|
hide_dotfiles = false,
|
||||||
}
|
hide_gitignored = false,
|
||||||
})
|
hide_by_name = {},
|
||||||
|
hide_by_pattern = {},
|
||||||
|
always_show = {},
|
||||||
|
never_show = {},
|
||||||
|
never_show_by_pattern = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
source_selector = {
|
||||||
|
winbar = true,
|
||||||
|
statusline = false,
|
||||||
|
},
|
||||||
|
|
||||||
|
follow_current_file = {
|
||||||
|
enabled = true,
|
||||||
|
leave_dirs_open = true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
local function is_neotree_open()
|
||||||
|
local manager = require('neo-tree.sources.manager');
|
||||||
|
local renderer = require('neo-tree.ui.renderer');
|
||||||
|
local state = manager.get_state('filesystem');
|
||||||
|
return renderer.window_exists(state);
|
||||||
|
end;
|
||||||
|
|
||||||
|
-- Auto open Neo-Tree on big enough window
|
||||||
|
vim.api.nvim_create_autocmd({ 'VimEnter', 'VimResized' }, {
|
||||||
|
pattern = '*',
|
||||||
|
callback = function()
|
||||||
|
if vim.api.nvim_eval([[&columns]]) > 100 then
|
||||||
|
if is_neotree_open() == false then
|
||||||
|
vim.cmd[[Neotree show]];
|
||||||
|
vim.cmd[[Neotree close]];
|
||||||
|
vim.cmd[[Neotree show]];
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
if is_neotree_open() then
|
||||||
|
vim.cmd[[Neotree close]];
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end,
|
||||||
|
});
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
" Auto open Neo-Tree on big enough window
|
|
||||||
function! OpenTree() abort
|
|
||||||
if &columns > 100
|
|
||||||
Neotree show
|
|
||||||
Neotree close
|
|
||||||
Neotree show
|
|
||||||
endif
|
|
||||||
lua MiniMap.open()
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
autocmd VimEnter * call OpenTree()
|
|
|
@ -1,13 +0,0 @@
|
||||||
" use vscode keybinds for snippets completion
|
|
||||||
inoremap <silent><expr> <TAB>
|
|
||||||
\ coc#pum#visible() ? coc#_select_confirm() :
|
|
||||||
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
|
|
||||||
\ CheckBackspace() ? "\<TAB>" :
|
|
||||||
\ coc#refresh()
|
|
||||||
|
|
||||||
function! CheckBackspace() abort
|
|
||||||
let col = col('.') - 1
|
|
||||||
return !col || getline('.')[col - 1] =~# '\s'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
let g:coc_snippet_next = '<tab>'
|
|
|
@ -1,21 +0,0 @@
|
||||||
lua << EOF
|
|
||||||
|
|
||||||
require('nvim-treesitter.configs').setup({
|
|
||||||
highlight = { enable = true },
|
|
||||||
indent = { enable = true },
|
|
||||||
})
|
|
||||||
|
|
||||||
require('treesitter-context').setup({
|
|
||||||
enable = true,
|
|
||||||
max_lines = 3,
|
|
||||||
min_window_height = 20,
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.filetype.add({
|
|
||||||
pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
|
|
||||||
})
|
|
||||||
|
|
||||||
EOF
|
|
||||||
|
|
||||||
" Add line under context
|
|
||||||
hi TreesitterContextBottom gui=underline guisp=Grey
|
|
166
common/home/neovim/theme.nix
Normal file
166
common/home/neovim/theme.nix
Normal file
|
@ -0,0 +1,166 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
nvim-theme-src,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) fileContents optionals;
|
||||||
|
inherit (config.vars) neovimIde;
|
||||||
|
in {
|
||||||
|
programs = {
|
||||||
|
neovim = {
|
||||||
|
extraPackages = builtins.attrValues {
|
||||||
|
inherit (pkgs) bat;
|
||||||
|
};
|
||||||
|
|
||||||
|
plugins =
|
||||||
|
[
|
||||||
|
{
|
||||||
|
plugin = pkgs.vimPlugins.dracula-nvim.overrideAttrs {
|
||||||
|
src = nvim-theme-src;
|
||||||
|
};
|
||||||
|
type = "lua";
|
||||||
|
config =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
-- set dot icon in place of trailing whitespaces
|
||||||
|
vim.opt.listchars = {
|
||||||
|
tab = '→ ',
|
||||||
|
trail = '•',
|
||||||
|
extends = '⟩',
|
||||||
|
precedes = '⟨',
|
||||||
|
nbsp = '␣',
|
||||||
|
};
|
||||||
|
vim.opt.list = true;
|
||||||
|
|
||||||
|
-- Add visual indicator for trailing whitespaces
|
||||||
|
vim.opt.fillchars = { eob = " " };
|
||||||
|
vim.fn.matchadd('errorMsg', [[\s\+$]]);
|
||||||
|
|
||||||
|
vim.cmd.colorscheme('dracula');
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
plugin = pkgs.vimPlugins.indent-blankline-nvim;
|
||||||
|
type = "lua";
|
||||||
|
config =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
--
|
||||||
|
local highlight = {
|
||||||
|
"RainbowRed",
|
||||||
|
"RainbowYellow",
|
||||||
|
"RainbowBlue",
|
||||||
|
"RainbowOrange",
|
||||||
|
"RainbowGreen",
|
||||||
|
"RainbowViolet",
|
||||||
|
"RainbowCyan",
|
||||||
|
};
|
||||||
|
|
||||||
|
local hooks = require('ibl.hooks');
|
||||||
|
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" });
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" });
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" });
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" });
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" });
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" });
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" });
|
||||||
|
end);
|
||||||
|
|
||||||
|
require('ibl').setup({
|
||||||
|
indent = {
|
||||||
|
highlight = highlight,
|
||||||
|
char = "▏",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
# Deps of heirline config
|
||||||
|
pkgs.vimPlugins.nvim-web-devicons
|
||||||
|
{
|
||||||
|
plugin = pkgs.vimPlugins.heirline-nvim;
|
||||||
|
type = "lua";
|
||||||
|
config = fileContents ./plugins/heirline.lua;
|
||||||
|
}
|
||||||
|
]
|
||||||
|
++ optionals neovimIde [
|
||||||
|
{
|
||||||
|
plugin = pkgs.vimPlugins.neo-tree-nvim;
|
||||||
|
type = "lua";
|
||||||
|
config = fileContents ./plugins/neotree.lua;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
plugin = pkgs.vimPlugins.codewindow-nvim;
|
||||||
|
type = "lua";
|
||||||
|
config =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
--
|
||||||
|
local codewindow = require('codewindow');
|
||||||
|
|
||||||
|
codewindow.setup({
|
||||||
|
auto_enable = false,
|
||||||
|
minimap_width = 8,
|
||||||
|
relative = 'editor',
|
||||||
|
window_border = 'none',
|
||||||
|
exclude_filetypes = { 'help' },
|
||||||
|
});
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({ 'VimEnter', 'VimResized' }, {
|
||||||
|
pattern = '*',
|
||||||
|
callback = function()
|
||||||
|
if vim.api.nvim_win_get_width(0) < 88 then
|
||||||
|
codewindow.close_minimap();
|
||||||
|
else
|
||||||
|
codewindow.open_minimap();
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
});
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
plugin = pkgs.vimPlugins.transparent-nvim;
|
||||||
|
type = "lua";
|
||||||
|
config =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
require('transparent').setup({
|
||||||
|
groups = {
|
||||||
|
'Normal',
|
||||||
|
'NormalNC',
|
||||||
|
'Comment',
|
||||||
|
'Constant',
|
||||||
|
'Special',
|
||||||
|
'Identifier',
|
||||||
|
'Statement',
|
||||||
|
'PreProc',
|
||||||
|
'Type',
|
||||||
|
'Underlined',
|
||||||
|
'Todo',
|
||||||
|
'String',
|
||||||
|
'Function',
|
||||||
|
'Conditional',
|
||||||
|
'Repeat',
|
||||||
|
'Operator',
|
||||||
|
'Structure',
|
||||||
|
'LineNr',
|
||||||
|
'NonText',
|
||||||
|
'SignColumn',
|
||||||
|
'CursorLine',
|
||||||
|
'CursorLineNr',
|
||||||
|
'StatusLine',
|
||||||
|
'StatusLineNC',
|
||||||
|
'EndOfBuffer',
|
||||||
|
},
|
||||||
|
extra_groups = {},
|
||||||
|
exclude_groups = {},
|
||||||
|
});
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
34
common/home/neovim/treesitter.nix
Normal file
34
common/home/neovim/treesitter.nix
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{pkgs, ...}: {
|
||||||
|
programs.neovim.plugins = [
|
||||||
|
{
|
||||||
|
plugin = pkgs.vimPlugins.nvim-treesitter-context;
|
||||||
|
type = "lua";
|
||||||
|
config =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
require('treesitter-context').setup({
|
||||||
|
enable = true,
|
||||||
|
max_lines = 3,
|
||||||
|
min_window_height = 20,
|
||||||
|
});
|
||||||
|
|
||||||
|
vim.cmd.hi('TreesitterContextBottom', 'gui=underline guisp=Grey');
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
pkgs.vimPlugins.nvim-treesitter-textobjects
|
||||||
|
|
||||||
|
{
|
||||||
|
plugin = pkgs.vimPlugins.nvim-treesitter.withAllGrammars;
|
||||||
|
type = "lua";
|
||||||
|
config =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
require('nvim-treesitter.configs').setup({
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true },
|
||||||
|
});
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
|
@ -1,30 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
home.packages =
|
|
||||||
(with config.customPkgs; [
|
|
||||||
pokemon-colorscripts
|
|
||||||
repl
|
|
||||||
])
|
|
||||||
++ (with pkgs.nodePackages; [
|
|
||||||
undollar
|
|
||||||
])
|
|
||||||
++ (with pkgs; [
|
|
||||||
dracula-theme
|
|
||||||
neofetch
|
|
||||||
progress
|
|
||||||
wget
|
|
||||||
tree
|
|
||||||
openssh
|
|
||||||
mosh
|
|
||||||
rsync
|
|
||||||
killall
|
|
||||||
imagemagick
|
|
||||||
usbutils
|
|
||||||
zip
|
|
||||||
unzip
|
|
||||||
dig.dnsutils
|
|
||||||
]);
|
|
||||||
}
|
|
|
@ -11,12 +11,12 @@
|
||||||
newSession = true;
|
newSession = true;
|
||||||
historyLimit = 30000;
|
historyLimit = 30000;
|
||||||
|
|
||||||
plugins = with pkgs.tmuxPlugins; [dracula];
|
plugins = builtins.attrValues {
|
||||||
|
inherit (pkgs.tmuxPlugins) dracula;
|
||||||
|
};
|
||||||
|
|
||||||
extraConfig =
|
extraConfig =
|
||||||
/*
|
# bash
|
||||||
bash
|
|
||||||
*/
|
|
||||||
''
|
''
|
||||||
bind-key -n Home send Escape "OH"
|
bind-key -n Home send Escape "OH"
|
||||||
bind-key -n End send Escape "OF"
|
bind-key -n End send Escape "OF"
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
{pkgs, ...} @ inputs: let
|
{
|
||||||
trash = pkgs.callPackage ./trash-d.nix inputs;
|
pkgs,
|
||||||
in {
|
self,
|
||||||
home.packages = [trash];
|
...
|
||||||
|
}: {
|
||||||
|
home.packages = [self.packages.${pkgs.system}.trash-d];
|
||||||
|
|
||||||
programs.bash.shellAliases.rm = "trash";
|
programs.bash.shellAliases.rm = "trash";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
{
|
|
||||||
trash-d-src,
|
|
||||||
stdenv,
|
|
||||||
dmd,
|
|
||||||
dub,
|
|
||||||
ronn,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
name = "trash";
|
|
||||||
version = trash-d-src.shortRev;
|
|
||||||
|
|
||||||
src = trash-d-src;
|
|
||||||
|
|
||||||
buildInputs = [dub dmd ronn];
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
# https://github.com/svanderburg/node2nix/issues/217#issuecomment-751311272
|
|
||||||
export HOME=$(mktemp -d)
|
|
||||||
|
|
||||||
dub build
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out/bin $out/man/man1
|
|
||||||
|
|
||||||
cp -a ./build/trash $out/bin/
|
|
||||||
|
|
||||||
ronn --roff --pipe MANUAL.md > $out/man/man1/trash.1
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -1,12 +1,22 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
environment.systemPackages = with pkgs; [
|
inherit (lib) foldl isList mergeAttrsWithFunc optionals unique;
|
||||||
(writeShellApplication {
|
|
||||||
|
mergeAttrsList = list:
|
||||||
|
foldl (mergeAttrsWithFunc (a: b:
|
||||||
|
if isList a && isList b
|
||||||
|
then unique (a ++ b)
|
||||||
|
else b)) {}
|
||||||
|
list;
|
||||||
|
in {
|
||||||
|
environment.systemPackages = [
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
name = "rebuild-no-cache";
|
name = "rebuild-no-cache";
|
||||||
runtimeInputs = [config.nh.package];
|
runtimeInputs = [config.programs.nh.package];
|
||||||
text = ''
|
text = ''
|
||||||
nh os switch -- --option binary-caches "https://cache.nixos.org" "$@"
|
nh os switch -- --option binary-caches "https://cache.nixos.org" "$@"
|
||||||
'';
|
'';
|
||||||
|
@ -14,38 +24,22 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
nix = {
|
nix = {
|
||||||
settings = {
|
settings = let
|
||||||
substituters = [
|
mkSubstituterConf = url: key: {
|
||||||
"https://hyprland.cachix.org"
|
substituters = [url];
|
||||||
"https://nix-gaming.cachix.org"
|
trusted-public-keys = optionals (key != null) [key];
|
||||||
# Nixpkgs-Wayland
|
};
|
||||||
"https://cache.nixos.org"
|
in
|
||||||
"https://nixpkgs-wayland.cachix.org"
|
mergeAttrsList ([
|
||||||
"https://nix-community.cachix.org"
|
(mkSubstituterConf "https://cache.nixos.org" "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=")
|
||||||
# Nix-community
|
(mkSubstituterConf "https://hyprland.cachix.org" "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=")
|
||||||
"https://nix-community.cachix.org"
|
(mkSubstituterConf "https://nix-gaming.cachix.org" "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=")
|
||||||
# Nh
|
(mkSubstituterConf "https://nixpkgs-wayland.cachix.org" "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA=")
|
||||||
"https://viperml.cachix.org"
|
(mkSubstituterConf "https://nix-community.cachix.org" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=")
|
||||||
# Caddy
|
(mkSubstituterConf "https://viperml.cachix.org" "viperml.cachix.org-1:qZhKBMTfmcLL+OG6fj/hzsMEedgKvZVFRRAhq7j8Vh8=")
|
||||||
"https://caddycf.cachix.org"
|
]
|
||||||
# Personal config cache
|
++ optionals (!config.services.nix-serve.enable) [
|
||||||
"https://cache.nelim.org"
|
(mkSubstituterConf "https://cache.nelim.org" "cache.nelim.org:JmFqkUdH11EA9EZOFAGVHuRYp7EbsdJDHvTQzG2pPyY=")
|
||||||
];
|
]);
|
||||||
trusted-public-keys = [
|
|
||||||
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
|
|
||||||
"nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
|
|
||||||
# Nixpkgs-Wayland
|
|
||||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
|
||||||
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
|
|
||||||
# Nix-community
|
|
||||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
|
||||||
# Nh
|
|
||||||
"viperml.cachix.org-1:qZhKBMTfmcLL+OG6fj/hzsMEedgKvZVFRRAhq7j8Vh8="
|
|
||||||
# Caddy
|
|
||||||
"caddycf.cachix.org-1:6vbQaeiec/zKv9XfEwi9yWVCe7opbeJMu6w81UEXugY="
|
|
||||||
# Personal config cache
|
|
||||||
"cache.nelim.org:JmFqkUdH11EA9EZOFAGVHuRYp7EbsdJDHvTQzG2pPyY="
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,33 +4,39 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
defaultFonts = {
|
defaultFonts = {
|
||||||
emoji = ["Noto Color Emoji"];
|
emoji = ["Noto Color Emoji"];
|
||||||
monospace = ["Noto Nerd Font"];
|
monospace = ["JetBrainsMono Nerd Font"];
|
||||||
sansSerif = ["Noto Nerd Font"];
|
sansSerif = ["Noto Nerd Font"];
|
||||||
serif = ["Noto Nerd Font"];
|
serif = ["Noto Nerd Font"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = with pkgs; [
|
packages =
|
||||||
(nerdfonts.override {
|
[
|
||||||
fonts = [
|
(pkgs.nerdfonts.override {
|
||||||
"JetBrainsMono"
|
fonts = [
|
||||||
"Go-Mono"
|
"JetBrainsMono"
|
||||||
"Iosevka"
|
"Go-Mono"
|
||||||
"NerdFontsSymbolsOnly"
|
"Iosevka"
|
||||||
"SpaceMono"
|
"NerdFontsSymbolsOnly"
|
||||||
"Ubuntu"
|
"SpaceMono"
|
||||||
"Noto"
|
"Ubuntu"
|
||||||
];
|
"Noto"
|
||||||
})
|
];
|
||||||
noto-fonts
|
})
|
||||||
noto-fonts-cjk
|
]
|
||||||
noto-fonts-emoji
|
++ (builtins.attrValues {
|
||||||
liberation_ttf
|
inherit
|
||||||
font-awesome
|
(pkgs)
|
||||||
meslo-lgs-nf
|
noto-fonts
|
||||||
jetbrains-mono
|
noto-fonts-cjk
|
||||||
ubuntu_font_family
|
noto-fonts-emoji
|
||||||
];
|
liberation_ttf
|
||||||
|
font-awesome
|
||||||
|
meslo-lgs-nf
|
||||||
|
jetbrains-mono
|
||||||
|
ubuntu_font_family
|
||||||
|
;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
# Select internationalisation properties.
|
# Select internationalisation properties.
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
nur,
|
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
imports = [
|
imports = [
|
||||||
./vars
|
./vars
|
||||||
./pkgs
|
|
||||||
./modules/global.nix
|
./modules/global.nix
|
||||||
nur.nixosModules.nur
|
./packages.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
nix = {
|
nix = {
|
||||||
|
@ -23,16 +21,10 @@
|
||||||
substituters = [
|
substituters = [
|
||||||
# Nix-community
|
# Nix-community
|
||||||
"https://nix-community.cachix.org"
|
"https://nix-community.cachix.org"
|
||||||
|
|
||||||
# FIXME: cache doesn't work
|
|
||||||
# Personal config cache
|
|
||||||
# "https://cache.nelim.org"
|
|
||||||
];
|
];
|
||||||
trustedPublicKeys = [
|
trustedPublicKeys = [
|
||||||
# Nix-community
|
# Nix-community
|
||||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||||
# Personal config cache
|
|
||||||
# "cache.nelim.org:JmFqkUdH11EA9EZOFAGVHuRYp7EbsdJDHvTQzG2pPyY="
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -48,10 +40,7 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
nur.hmModules.nur
|
|
||||||
|
|
||||||
./home
|
./home
|
||||||
./pkgs
|
|
||||||
|
|
||||||
{
|
{
|
||||||
programs.bash.sessionVariables = {
|
programs.bash.sessionVariables = {
|
||||||
|
@ -73,6 +62,9 @@
|
||||||
# Experimenting server
|
# Experimenting server
|
||||||
servivi = "ssh -t matt@100.64.0.7 'tmux -2u new -At phone'";
|
servivi = "ssh -t matt@100.64.0.7 'tmux -2u new -At phone'";
|
||||||
|
|
||||||
|
# Home-assistant
|
||||||
|
homie = "ssh -t matt@100.64.0.10 'tmux -2u new -At phone'";
|
||||||
|
|
||||||
# Cluster nodes
|
# Cluster nodes
|
||||||
thingone = "ssh -t matt@100.64.0.8 'tmux -2u new -At phone'";
|
thingone = "ssh -t matt@100.64.0.8 'tmux -2u new -At phone'";
|
||||||
thingtwo = "ssh -t matt@100.64.0.9 'tmux -2u new -At phone'";
|
thingtwo = "ssh -t matt@100.64.0.9 'tmux -2u new -At phone'";
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
{nixpkgs-wayland, ...} @ inputs: [
|
|
||||||
(import ./dracula-theme inputs)
|
|
||||||
|
|
||||||
nixpkgs-wayland.overlay
|
|
||||||
]
|
|
|
@ -1,46 +0,0 @@
|
||||||
{
|
|
||||||
bat-theme-src,
|
|
||||||
gtk-theme-src,
|
|
||||||
xresources-theme-src,
|
|
||||||
...
|
|
||||||
} @ inputs: (final: prev: {
|
|
||||||
dracula-theme = prev.dracula-theme.overrideAttrs (oldAttrs: let
|
|
||||||
git-colors = prev.callPackage ./git.nix inputs;
|
|
||||||
plymouth = prev.callPackage ./plymouth.nix inputs;
|
|
||||||
wallpaper = prev.fetchurl (import ./wallpaper.nix);
|
|
||||||
in {
|
|
||||||
version = gtk-theme-src.shortRev;
|
|
||||||
src = gtk-theme-src;
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
runHook preInstall
|
|
||||||
|
|
||||||
mkdir -p $out/share/plymouth/themes $out/wallpapers
|
|
||||||
cp -a ${wallpaper} $out/wallpapers/waves.png
|
|
||||||
|
|
||||||
cp -a ${bat-theme-src}/Dracula.tmTheme $out/bat
|
|
||||||
cp -a ${git-colors}/git-colors $out/git-colors
|
|
||||||
cp -a ${plymouth}/share/plymouth/themes/dracula $out/share/plymouth/themes/
|
|
||||||
cp -a ${xresources-theme-src}/Xresources $out/xres
|
|
||||||
|
|
||||||
# -------------------------------------------
|
|
||||||
mkdir -p $out/share/themes/Dracula
|
|
||||||
cp -a {assets,cinnamon,gnome-shell,gtk-2.0,gtk-3.0,gtk-3.20,gtk-4.0,index.theme,metacity-1,unity,xfwm4} $out/share/themes/Dracula
|
|
||||||
|
|
||||||
cp -a kde/{color-schemes,plasma} $out/share/
|
|
||||||
cp -a kde/kvantum $out/share/Kvantum
|
|
||||||
|
|
||||||
mkdir -p $out/share/aurorae/themes
|
|
||||||
cp -a kde/aurorae/* $out/share/aurorae/themes/
|
|
||||||
|
|
||||||
mkdir -p $out/share/sddm/themes
|
|
||||||
cp -a kde/sddm/* $out/share/sddm/themes/
|
|
||||||
|
|
||||||
mkdir -p $out/share/icons/Dracula-cursors
|
|
||||||
mv kde/cursors/Dracula-cursors/index.theme $out/share/icons/Dracula-cursors/cursor.theme
|
|
||||||
mv kde/cursors/Dracula-cursors/cursors $out/share/icons/Dracula-cursors/cursors
|
|
||||||
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
});
|
|
||||||
})
|
|
|
@ -1,23 +0,0 @@
|
||||||
{
|
|
||||||
stdenv,
|
|
||||||
git-theme-src,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
name = "dracula-git";
|
|
||||||
version = git-theme-src.shortRev;
|
|
||||||
|
|
||||||
src = git-theme-src;
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
# Git colors
|
|
||||||
cp -a ./config/gitconfig ./git-colors
|
|
||||||
chmod 777 ./git-colors
|
|
||||||
|
|
||||||
line=$(grep -n 'Dracula Dark Theme' ./git-colors | cut -d: -f1)
|
|
||||||
sed -i "1,$((line-1))d" ./git-colors
|
|
||||||
|
|
||||||
mkdir $out
|
|
||||||
cp -a ./git-colors $out
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
url = "https://raw.githubusercontent.com/aynp/dracula-wallpapers/main/Art/4k/Waves%201.png";
|
|
||||||
hash = "sha256-f9FwSOSvqTeDj4bOjYUQ6TM+/carCD9o5dhg/MnP/lk=";
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
diff --git a/src/libstore/path.cc b/src/libstore/path.cc
|
|
||||||
index e642abcd5..0e584ef33 100644
|
|
||||||
--- a/src/libstore/path.cc
|
|
||||||
+++ b/src/libstore/path.cc
|
|
||||||
@@ -12,7 +12,7 @@ static void checkName(std::string_view path, std::string_view name)
|
|
||||||
if (!((c >= '0' && c <= '9')
|
|
||||||
|| (c >= 'a' && c <= 'z')
|
|
||||||
|| (c >= 'A' && c <= 'Z')
|
|
||||||
- || c == '+' || c == '-' || c == '.' || c == '_' || c == '?' || c == '='))
|
|
||||||
+ || c == '+' || c == '-' || c == '.' || c == '_' || c == '?' || c == '=' || c == '!'))
|
|
||||||
throw BadStorePath("store path '%s' contains illegal character '%s'", path, c);
|
|
||||||
}
|
|
100
common/packages.nix
Normal file
100
common/packages.nix
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
self,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
environment.systemPackages =
|
||||||
|
(builtins.attrValues {
|
||||||
|
inherit
|
||||||
|
(self.packages.${pkgs.system})
|
||||||
|
pokemon-colorscripts
|
||||||
|
repl
|
||||||
|
;
|
||||||
|
|
||||||
|
inherit
|
||||||
|
(pkgs.nodePackages)
|
||||||
|
undollar
|
||||||
|
;
|
||||||
|
|
||||||
|
inherit (pkgs) alejandra;
|
||||||
|
|
||||||
|
# Archiving
|
||||||
|
inherit
|
||||||
|
(pkgs)
|
||||||
|
zip
|
||||||
|
unzip
|
||||||
|
p7zip
|
||||||
|
bzip2
|
||||||
|
gzip
|
||||||
|
gnutar
|
||||||
|
xz
|
||||||
|
;
|
||||||
|
|
||||||
|
# File management
|
||||||
|
inherit
|
||||||
|
(pkgs)
|
||||||
|
findutils
|
||||||
|
diffutils
|
||||||
|
utillinux
|
||||||
|
which
|
||||||
|
imagemagick
|
||||||
|
;
|
||||||
|
|
||||||
|
# Networking
|
||||||
|
inherit (pkgs.dig) dnsutils;
|
||||||
|
inherit
|
||||||
|
(pkgs)
|
||||||
|
openssh
|
||||||
|
rsync
|
||||||
|
wget
|
||||||
|
gnupg
|
||||||
|
;
|
||||||
|
|
||||||
|
# Misc CLI stuff
|
||||||
|
inherit
|
||||||
|
(pkgs)
|
||||||
|
killall
|
||||||
|
nix-output-monitor
|
||||||
|
progress
|
||||||
|
tree
|
||||||
|
gnugrep
|
||||||
|
gnused
|
||||||
|
;
|
||||||
|
|
||||||
|
# Expected Stuff
|
||||||
|
inherit
|
||||||
|
(pkgs)
|
||||||
|
hostname
|
||||||
|
man
|
||||||
|
perl
|
||||||
|
tzdata
|
||||||
|
;
|
||||||
|
})
|
||||||
|
++ [
|
||||||
|
# This could help as well: nix derivation show -r /run/current-system
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = "listDerivs";
|
||||||
|
text = ''
|
||||||
|
nix-store --query --requisites /run/current-system | cut -d- -f2- | sort -u
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = "from";
|
||||||
|
|
||||||
|
runtimeInputs = builtins.attrValues {
|
||||||
|
inherit
|
||||||
|
(pkgs)
|
||||||
|
coreutils
|
||||||
|
which
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
|
text = ''
|
||||||
|
for var do
|
||||||
|
realpath "$(which "$var")"
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
|
@ -1,19 +0,0 @@
|
||||||
{python3Packages, ...}:
|
|
||||||
python3Packages.buildPythonPackage {
|
|
||||||
pname = "coloryou";
|
|
||||||
version = "0.0.1";
|
|
||||||
|
|
||||||
src = ./.;
|
|
||||||
|
|
||||||
propagatedBuildInputs = with python3Packages; [utils material-color-utilities];
|
|
||||||
|
|
||||||
postInstall = ''
|
|
||||||
mv -v $out/bin/coloryou.py $out/bin/coloryou
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = {
|
|
||||||
description = ''
|
|
||||||
Get Material You colors from an image.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
with import <nixpkgs> {};
|
|
||||||
with pkgs.python311Packages;
|
|
||||||
buildPythonPackage {
|
|
||||||
name = "coloryou";
|
|
||||||
src = ./.;
|
|
||||||
propagatedBuildInputs = [material-color-utilities utils];
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
buildGoModule,
|
|
||||||
curseforge-server-downloader-src,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
buildGoModule {
|
|
||||||
pname = "curseforge-server-downloader";
|
|
||||||
version = "unstable";
|
|
||||||
|
|
||||||
src = curseforge-server-downloader-src;
|
|
||||||
doCheck = false;
|
|
||||||
vendorHash = null;
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
} @ inputs: let
|
|
||||||
inherit (lib) concatMapAttrs filterAttrs mkOption pathExists types;
|
|
||||||
|
|
||||||
mkPackage = name: v: {
|
|
||||||
${name} = pkgs.callPackage ./${name} inputs;
|
|
||||||
};
|
|
||||||
|
|
||||||
rmNotPackage = name: value:
|
|
||||||
value
|
|
||||||
== "directory"
|
|
||||||
&& pathExists ./${name}/default.nix;
|
|
||||||
|
|
||||||
packages = filterAttrs rmNotPackage (builtins.readDir ./.);
|
|
||||||
|
|
||||||
pkgSet = concatMapAttrs mkPackage packages;
|
|
||||||
in {
|
|
||||||
options.customPkgs = mkOption {
|
|
||||||
type = types.attrs;
|
|
||||||
};
|
|
||||||
|
|
||||||
config.customPkgs = pkgSet;
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
{
|
|
||||||
stdenv,
|
|
||||||
meson,
|
|
||||||
ninja,
|
|
||||||
pkg-config,
|
|
||||||
glib,
|
|
||||||
libfprint,
|
|
||||||
polkit,
|
|
||||||
dbus,
|
|
||||||
systemd,
|
|
||||||
pam,
|
|
||||||
libpam-wrapper,
|
|
||||||
pam-fprint-grosshack-src,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
name = "pam-fprint-grosshack";
|
|
||||||
version = pam-fprint-grosshack-src.shortRev;
|
|
||||||
|
|
||||||
src = pam-fprint-grosshack-src;
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
|
||||||
meson
|
|
||||||
ninja
|
|
||||||
pkg-config
|
|
||||||
glib
|
|
||||||
libfprint
|
|
||||||
polkit
|
|
||||||
dbus
|
|
||||||
systemd
|
|
||||||
pam
|
|
||||||
libpam-wrapper
|
|
||||||
];
|
|
||||||
|
|
||||||
mesonFlags = [
|
|
||||||
"-Dpam_modules_dir=${placeholder "out"}/lib/security"
|
|
||||||
"-Dsysconfdir=${placeholder "out"}/etc"
|
|
||||||
"-Ddbus_service_dir=${placeholder "out"}/share/dbus-1/system-services"
|
|
||||||
"-Dsystemd_system_unit_dir=${placeholder "out"}/lib/systemd/system"
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -1,110 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
writeShellApplication,
|
|
||||||
stdenvNoCC,
|
|
||||||
jre,
|
|
||||||
fetchFromGitHub,
|
|
||||||
fetchurl,
|
|
||||||
makeWrapper,
|
|
||||||
makeDesktopItem,
|
|
||||||
rsync,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
stdenvNoCC.mkDerivation rec {
|
|
||||||
name = "rars-flatlaf";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "privat";
|
|
||||||
repo = "rars";
|
|
||||||
rev = "fd34014efd65b3cb5a52f1729c3b8240cae0c332";
|
|
||||||
hash = "sha256-D8X/cr+fnq/OOFYfMG9aPss95J8Z2yiROuF9kmHkK40=";
|
|
||||||
fetchSubmodules = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
desktopItem = let
|
|
||||||
hyprland = config.home-manager.users.${config.vars.mainUser}.wayland.windowManager.hyprland.finalPackage;
|
|
||||||
execScript = writeShellApplication {
|
|
||||||
name = "execScript";
|
|
||||||
runtimeInputs = [hyprland];
|
|
||||||
text = "(sleep 1; hyprctl dispatch togglefloating) & ${name}";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
makeDesktopItem {
|
|
||||||
name = "RARS";
|
|
||||||
desktopName = "RARS";
|
|
||||||
exec = "${execScript}/bin/execScript";
|
|
||||||
icon = name;
|
|
||||||
};
|
|
||||||
|
|
||||||
nativeBuildInputs = [makeWrapper rsync jre];
|
|
||||||
|
|
||||||
installPhase = let
|
|
||||||
flatlaf = fetchurl {
|
|
||||||
url = "https://repo1.maven.org/maven2/com/formdev/flatlaf/3.2/flatlaf-3.2.jar";
|
|
||||||
hash = "sha256-HAG+G9undDXWtySokKl7lkIUCFI7lEBduu+UgSVaxAA=";
|
|
||||||
};
|
|
||||||
icon = fetchurl {
|
|
||||||
url = "https://riscv.or.jp/wp-content/uploads/2019/06/cropped-RISC-V-logo-figonly-mod-2.png";
|
|
||||||
hash = "sha256-e1/iVmadVzyO77ikBr1cdXsJdDj8TiXh3Oyjek9GwqM=";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
/*
|
|
||||||
bash
|
|
||||||
*/
|
|
||||||
''
|
|
||||||
# ./build-jar.sh
|
|
||||||
mkdir -p build
|
|
||||||
find src -name "*.java" | xargs javac --release 8 -d build
|
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
||||||
find src -type f -not -name "*.java" -exec rsync -R {} build \;
|
|
||||||
else
|
|
||||||
find src -type f -not -name "*.java" -exec cp --parents {} build \;
|
|
||||||
fi
|
|
||||||
cp -rf build/src/* build
|
|
||||||
rm -r build/src
|
|
||||||
cp README.md License.txt build
|
|
||||||
cd build
|
|
||||||
jar cfm ../rars.jar ./META-INF/MANIFEST.MF *
|
|
||||||
chmod +x ../rars.jar
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
# ./build-jar-flatlaf.sh
|
|
||||||
mkdir -p build-flatlaf/
|
|
||||||
cd build-flatlaf/
|
|
||||||
|
|
||||||
cp ${flatlaf} ../flatlaf.jar
|
|
||||||
|
|
||||||
jar x < ../rars.jar
|
|
||||||
jar x < "../flatlaf.jar"
|
|
||||||
|
|
||||||
cat > META-INF/MANIFEST.MF <<EOF
|
|
||||||
Manifest-Version: 1.0
|
|
||||||
Implementation-Version: 3.1.1
|
|
||||||
Multi-Release: true
|
|
||||||
Main-Class: rars.Launch
|
|
||||||
EOF
|
|
||||||
|
|
||||||
jar cfm ../rars-flatlaf.jar META-INF/MANIFEST.MF *
|
|
||||||
chmod +x ../rars-flatlaf.jar
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
# InstallPhase
|
|
||||||
runHook preInstall
|
|
||||||
|
|
||||||
cat > ./rars.desktop <<EOF
|
|
||||||
EOF
|
|
||||||
|
|
||||||
mkdir -p "$out/share/pixmaps"
|
|
||||||
cp "${icon}" "$out/share/pixmaps/${name}.png"
|
|
||||||
install -D $desktopItem/share/applications/* $out/share/applications/rars.desktop
|
|
||||||
|
|
||||||
export JAR=$out/share/java/${name}/${name}.jar
|
|
||||||
install -D ./${name}.jar $JAR
|
|
||||||
makeWrapper ${jre}/bin/java $out/bin/${name} \
|
|
||||||
--add-flags "-jar $JAR"
|
|
||||||
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -3,7 +3,7 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkOption types;
|
inherit (lib) mkDefault mkOption types;
|
||||||
flakeDir = config.environment.variables.FLAKE;
|
flakeDir = config.environment.variables.FLAKE;
|
||||||
cfg = config.vars;
|
cfg = config.vars;
|
||||||
in {
|
in {
|
||||||
|
@ -23,7 +23,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
promptMainColor = mkOption {
|
promptMainColor = mkOption {
|
||||||
type = types.enum ["red" "green" "blue" "purple" "orange" "yellow" "cyan" "pink"];
|
type = types.enum (import ./prompt-schemes.nix {});
|
||||||
default = "purple";
|
default = "purple";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -32,19 +32,20 @@ in {
|
||||||
Colors used in starship prompt
|
Colors used in starship prompt
|
||||||
'';
|
'';
|
||||||
|
|
||||||
default = import ./prompt-schemes.nix cfg.promptMainColor;
|
default = import ./prompt-schemes.nix {color = cfg.promptMainColor;};
|
||||||
|
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
type = with types;
|
type = types.submodule {
|
||||||
submodule {
|
options = let
|
||||||
options = {
|
inherit (types) str;
|
||||||
textColor = mkOption {type = str;};
|
in {
|
||||||
firstColor = mkOption {type = str;};
|
textColor = mkOption {type = str;};
|
||||||
secondColor = mkOption {type = str;};
|
firstColor = mkOption {type = str;};
|
||||||
thirdColor = mkOption {type = str;};
|
secondColor = mkOption {type = str;};
|
||||||
fourthColor = mkOption {type = str;};
|
thirdColor = mkOption {type = str;};
|
||||||
};
|
fourthColor = mkOption {type = str;};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
configDir = mkOption {
|
configDir = mkOption {
|
||||||
|
@ -55,28 +56,6 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
mainMonitor = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = ''
|
|
||||||
The name of the main monitor used for Hyprland
|
|
||||||
and Regreet which also uses Hyprland
|
|
||||||
'';
|
|
||||||
# This is to allow a bash script to know whether this value exists
|
|
||||||
default = "null";
|
|
||||||
};
|
|
||||||
|
|
||||||
greetdDupe = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
description = ''
|
|
||||||
If we should duplicate regreet on all monitors
|
|
||||||
'';
|
|
||||||
default = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
fontSize = mkOption {
|
|
||||||
type = types.nullOr types.float;
|
|
||||||
};
|
|
||||||
|
|
||||||
neovimIde = mkOption {
|
neovimIde = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
|
@ -84,6 +63,6 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
environment.variables.FLAKE = lib.mkDefault "/home/${cfg.mainUser}/.nix";
|
environment.variables.FLAKE = mkDefault "/home/${cfg.mainUser}/.nix";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
color: let
|
{color ? null}: let
|
||||||
|
inherit (builtins) attrNames removeAttrs;
|
||||||
|
|
||||||
schemes = {
|
schemes = {
|
||||||
"purple" = {
|
"purple" = {
|
||||||
textColor = "#090c0c";
|
textColor = "#090c0c";
|
||||||
|
@ -74,4 +76,6 @@ color: let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
schemes.${color}
|
if ! isNull color
|
||||||
|
then schemes.${color}
|
||||||
|
else attrNames (removeAttrs schemes ["color"])
|
||||||
|
|
|
@ -4,15 +4,16 @@ This directory encompasses every device's main configuration file.
|
||||||
|
|
||||||
## List of my Devices
|
## List of my Devices
|
||||||
|
|
||||||
| Name | Description |
|
| Name | Description |
|
||||||
| ---------- | ------------------------------------------------------------------------------------------------------- |
|
| ----------- | ------------------------------------------------------------------------------------------------------- |
|
||||||
| `android` | My [Nix-On-Droid](https://github.com/nix-community/nix-on-droid) configuration for my OnePlus 9 Pro |
|
| `android` | My [Nix-On-Droid](https://github.com/nix-community/nix-on-droid) configuration for my OnePlus 9 Pro |
|
||||||
| `binto` | My desktop PC with a multi-monitor setup and an NVIDIA (cringe) 3070 |
|
| `bbsteamie` | My wife's SteamDeck that has a pink case |
|
||||||
| `cluster` | Two Lenovo mini PCs that make use of [NixOS-pcsd](https://github.com/matt1432/nixos-pcsd) to form a cluster |
|
| `binto` | My desktop PC with a multi-monitor setup and an NVIDIA (cringe) 3070 |
|
||||||
| `nos` | My custom built NAS |
|
| `cluster` | Two Lenovo mini PCs that make use of [NixOS-pcsd](https://github.com/matt1432/nixos-pcsd) to form a cluster |
|
||||||
| `oksys` | A very old Acer laptop that went from sailing the seas for years to becoming my web server and VPN host. It is now retired indefinitely. |
|
| `homie` | My Lenovo mini PC that will serve as a Home-assistant server |
|
||||||
| `servivi` | A gaming PC in a previous life, it is now used to experiment and do heavier stuff |
|
| `nos` | My custom built NAS |
|
||||||
| `wim` | My 2-1 Lenovo Laptop that I use for uni |
|
| `servivi` | A gaming PC in a previous life, it is now used as a build farm and hosts game servers |
|
||||||
|
| `wim` | My 2-1 Lenovo Laptop that I use for uni |
|
||||||
|
|
||||||
## Global Vars
|
## Global Vars
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,58 @@
|
||||||
{
|
{
|
||||||
home-manager,
|
config,
|
||||||
nixpkgs,
|
lib,
|
||||||
|
pkgs,
|
||||||
...
|
...
|
||||||
} @ inputs: rec {
|
}: {
|
||||||
extraSpecialArgs = inputs;
|
vars = {
|
||||||
home-manager-path = home-manager.outPath;
|
mainUser = "nix-on-droid";
|
||||||
pkgs = import nixpkgs {
|
hostName = "localhost";
|
||||||
system = "aarch64-linux";
|
neovimIde = false;
|
||||||
overlays = import ../../common/overlays inputs;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
modules = [
|
environment.variables.FLAKE = "/data/data/com.termux.nix/files/home/.nix";
|
||||||
{
|
|
||||||
options = with pkgs.lib; {
|
terminal.font = "${(pkgs.nerdfonts.override {
|
||||||
environment.variables.FLAKE = mkOption {
|
fonts = [
|
||||||
type = with types; nullOr str;
|
"JetBrainsMono"
|
||||||
};
|
];
|
||||||
|
})}/share/fonts/truetype/NerdFonts/JetBrainsMonoNerdFontMono-Regular.ttf";
|
||||||
|
|
||||||
|
environment.packages = [
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = "switch";
|
||||||
|
runtimeInputs = builtins.attrValues {
|
||||||
|
inherit
|
||||||
|
(pkgs)
|
||||||
|
coreutils
|
||||||
|
nix-output-monitor
|
||||||
|
nvd
|
||||||
|
;
|
||||||
};
|
};
|
||||||
}
|
text = ''
|
||||||
{home-manager.extraSpecialArgs = inputs;}
|
oldProfile=$(realpath /nix/var/nix/profiles/per-user/nix-on-droid/profile)
|
||||||
../../common/nix-on-droid.nix
|
|
||||||
./nix-on-droid.nix
|
nix-on-droid ${lib.concatStringsSep " " [
|
||||||
|
"switch"
|
||||||
|
"--flake ${config.environment.variables.FLAKE}"
|
||||||
|
"--builders ssh-ng://matt@100.64.0.7"
|
||||||
|
''"$@"''
|
||||||
|
"|&"
|
||||||
|
"nom"
|
||||||
|
]} &&
|
||||||
|
|
||||||
|
nvd diff "$oldProfile" "$(realpath /nix/var/nix/profiles/per-user/nix-on-droid/profile)"
|
||||||
|
'';
|
||||||
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
|
environment.etcBackupExtension = ".bak";
|
||||||
|
environment.motd = null;
|
||||||
|
home-manager.backupFileExtension = "hm-bak";
|
||||||
|
|
||||||
|
# Set your time zone.
|
||||||
|
time.timeZone = "America/Montreal";
|
||||||
|
|
||||||
|
# No touchy
|
||||||
|
system.stateVersion = "23.05";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
{pkgs, ...}: {
|
|
||||||
vars = {
|
|
||||||
mainUser = "nix-on-droid";
|
|
||||||
hostName = "localhost";
|
|
||||||
neovimIde = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
environment.variables.FLAKE = "/data/data/com.termux.nix/files/home/.nix";
|
|
||||||
|
|
||||||
terminal.font = "${(pkgs.nerdfonts.override {
|
|
||||||
fonts = [
|
|
||||||
"JetBrainsMono"
|
|
||||||
];
|
|
||||||
})}/share/fonts/truetype/NerdFonts/JetBrainsMonoNerdFontMono-Regular.ttf";
|
|
||||||
|
|
||||||
environment.packages = with pkgs; [
|
|
||||||
diffutils
|
|
||||||
findutils
|
|
||||||
utillinux
|
|
||||||
tzdata
|
|
||||||
hostname
|
|
||||||
man
|
|
||||||
gnugrep
|
|
||||||
ripgrep
|
|
||||||
gnupg
|
|
||||||
gnused
|
|
||||||
gnutar
|
|
||||||
bzip2
|
|
||||||
gzip
|
|
||||||
xz
|
|
||||||
zip
|
|
||||||
unzip
|
|
||||||
openssh
|
|
||||||
perl
|
|
||||||
alejandra
|
|
||||||
];
|
|
||||||
|
|
||||||
environment.etcBackupExtension = ".bak";
|
|
||||||
environment.motd = null;
|
|
||||||
home-manager.backupFileExtension = "hm-bak";
|
|
||||||
|
|
||||||
# Set your time zone.
|
|
||||||
time.timeZone = "America/Montreal";
|
|
||||||
|
|
||||||
# No touchy
|
|
||||||
system.stateVersion = "23.05";
|
|
||||||
}
|
|
62
devices/bbsteamie/default.nix
Normal file
62
devices/bbsteamie/default.nix
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
self,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (config.vars) mainUser hostName;
|
||||||
|
in {
|
||||||
|
# ------------------------------------------------
|
||||||
|
# Imports
|
||||||
|
# ------------------------------------------------
|
||||||
|
imports = [
|
||||||
|
./hardware-configuration.nix
|
||||||
|
|
||||||
|
./modules
|
||||||
|
|
||||||
|
self.nixosModules.kmscon
|
||||||
|
self.nixosModules.plymouth
|
||||||
|
self.nixosModules.server
|
||||||
|
];
|
||||||
|
|
||||||
|
# State Version: DO NOT CHANGE
|
||||||
|
system.stateVersion = "24.11";
|
||||||
|
|
||||||
|
# ------------------------------------------------
|
||||||
|
# User Settings
|
||||||
|
# ------------------------------------------------
|
||||||
|
vars = {
|
||||||
|
mainUser = "mariah";
|
||||||
|
hostName = "bbsteamie";
|
||||||
|
promptMainColor = "pink";
|
||||||
|
};
|
||||||
|
|
||||||
|
users.users.${mainUser} = {
|
||||||
|
isNormalUser = true;
|
||||||
|
extraGroups = [
|
||||||
|
"wheel"
|
||||||
|
"adm"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
inherit hostName;
|
||||||
|
networkmanager.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
time.timeZone = "America/Montreal";
|
||||||
|
|
||||||
|
# ------------------------------------------------
|
||||||
|
# `Self` Modules configuration
|
||||||
|
# ------------------------------------------------
|
||||||
|
roles.server = {
|
||||||
|
user = mainUser;
|
||||||
|
sshd.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
boot.plymouth = {
|
||||||
|
enable = true;
|
||||||
|
theme = "bgrt";
|
||||||
|
};
|
||||||
|
|
||||||
|
services.kmscon.enable = true;
|
||||||
|
}
|
65
devices/bbsteamie/hardware-configuration.nix
Normal file
65
devices/bbsteamie/hardware-configuration.nix
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
jovian,
|
||||||
|
modulesPath,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
nixpkgs.hostPlatform = "x86_64-linux";
|
||||||
|
imports = [
|
||||||
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
jovian.nixosModules.default
|
||||||
|
];
|
||||||
|
|
||||||
|
jovian = {
|
||||||
|
steamos.useSteamOSConfig = true;
|
||||||
|
|
||||||
|
devices.steamdeck = {
|
||||||
|
enable = true;
|
||||||
|
enableGyroDsuService = true;
|
||||||
|
};
|
||||||
|
hardware.has.amd.gpu = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
boot = {
|
||||||
|
kernelModules = ["kvm-amd"];
|
||||||
|
initrd.availableKernelModules = ["nvme" "xhci_pci" "usbhid" "sdhci_pci"];
|
||||||
|
|
||||||
|
loader = {
|
||||||
|
efi.canTouchEfiVariables = true;
|
||||||
|
|
||||||
|
systemd-boot = {
|
||||||
|
enable = true;
|
||||||
|
configurationLimit = 30;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
virtualisation.waydroid.enable = true;
|
||||||
|
|
||||||
|
fileSystems = {
|
||||||
|
"/" = {
|
||||||
|
device = "/dev/disk/by-label/NIXROOT";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
"/boot" = {
|
||||||
|
device = "/dev/disk/by-label/NIXBOOT";
|
||||||
|
fsType = "vfat";
|
||||||
|
options = ["fmask=0022" "dmask=0022"];
|
||||||
|
};
|
||||||
|
|
||||||
|
"/run/media/mariah/SDCARD" = {
|
||||||
|
device = "/dev/disk/by-label/SDCARD";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
swapDevices = [
|
||||||
|
{
|
||||||
|
device = "/.swapfile";
|
||||||
|
size = 16 * 1024; # 16GB
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
hardware.cpu.amd.updateMicrocode = config.hardware.enableRedistributableFirmware;
|
||||||
|
}
|
5
devices/bbsteamie/modules/default.nix
Normal file
5
devices/bbsteamie/modules/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{...}: {
|
||||||
|
imports = [
|
||||||
|
./desktop
|
||||||
|
];
|
||||||
|
}
|
40
devices/bbsteamie/modules/desktop/default.nix
Normal file
40
devices/bbsteamie/modules/desktop/default.nix
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{pkgs, ...}: let
|
||||||
|
defaultSession = "plasma";
|
||||||
|
in {
|
||||||
|
imports = [
|
||||||
|
(import ./session-switching.nix defaultSession)
|
||||||
|
(import ./steam.nix defaultSession)
|
||||||
|
];
|
||||||
|
|
||||||
|
services.desktopManager.plasma6.enable = true;
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
kdeconnect.enable = true;
|
||||||
|
xwayland.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Flatpak support for Discover
|
||||||
|
services.flatpak.enable = true;
|
||||||
|
services.packagekit.enable = true;
|
||||||
|
|
||||||
|
# Wayland env vars
|
||||||
|
environment.variables = {
|
||||||
|
NIXOS_OZONE_WL = "1";
|
||||||
|
ELECTRON_OZONE_PLATFORM_HINT = "auto";
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = builtins.attrValues {
|
||||||
|
inherit
|
||||||
|
(pkgs)
|
||||||
|
firefox
|
||||||
|
wl-clipboard
|
||||||
|
xclip
|
||||||
|
;
|
||||||
|
|
||||||
|
inherit
|
||||||
|
(pkgs.kdePackages)
|
||||||
|
discover
|
||||||
|
krfb
|
||||||
|
;
|
||||||
|
};
|
||||||
|
}
|
81
devices/bbsteamie/modules/desktop/install_palia_map.md
Executable file
81
devices/bbsteamie/modules/desktop/install_palia_map.md
Executable file
|
@ -0,0 +1,81 @@
|
||||||
|
# How to install Palia Map and Overwolf on Linux
|
||||||
|
|
||||||
|
Dependencies:
|
||||||
|
- latest GE-Proton: https://github.com/GloriousEggroll/proton-ge-custom
|
||||||
|
- protontricks: https://github.com/Matoking/protontricks
|
||||||
|
- protonhax: https://github.com/jcnils/protonhax
|
||||||
|
|
||||||
|
|
||||||
|
## First Step: Install and run Palia at least once
|
||||||
|
|
||||||
|
|
||||||
|
## Second Step: Setup Palia WINEPREFIX with latest GE-Proton
|
||||||
|
|
||||||
|
1. Delete prefix at /home/"$USER"/.steam/steam/steamapps/compatdata/2707930/pfx
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rm -r /home/"$USER"/.steam/steam/steamapps/compatdata/2707930/pfx
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Launch Palia with GE-Proton by going to game properties -> Compatibility -> Force the use ... -> Select GE-Proton...
|
||||||
|
|
||||||
|
3. Install dotnet48 and other Windows deps to allow for Overwolf installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Force proton version of protontricks
|
||||||
|
export PROTON_VERSION="GE-Proton9-10"
|
||||||
|
protontricks 2707930 dotnet48
|
||||||
|
|
||||||
|
# If VC is needed
|
||||||
|
protontricks 2707930 vcrun2010
|
||||||
|
protontricks 2707930 vcrun2012
|
||||||
|
protontricks 2707930 vcrun2013
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Third Step: Install Overwolf
|
||||||
|
|
||||||
|
1. Get this older version that worked for me here: https://overwolf.en.uptodown.com/windows/download/4714215
|
||||||
|
|
||||||
|
2. Install it with protontricks. Follow the GUI installer as if you were on Windows
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export PROTON_VERSION="GE-Proton9-10"
|
||||||
|
protontricks-launch --appid 2707930 Downloads/overwolf-0-195-0-18.exe
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Fourth Step: Install Palia Map
|
||||||
|
|
||||||
|
1. Get the installer from here: https://www.overwolf.com/app/Leon_Machens-Palia_Map
|
||||||
|
|
||||||
|
2. Install it with protontricks.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export PROTON_VERSION="GE-Proton9-10"
|
||||||
|
protontricks-launch --appid 2707930 Downloads/Palia\ Map\ -\ Installer.exe
|
||||||
|
```
|
||||||
|
|
||||||
|
3. An error should popup saying `Installation failed` or something along those lines.
|
||||||
|
Close it and wait. You should see the Overwolf overlay on the left side of your screen
|
||||||
|
with the Palia Map icon saying `Installing` and then when it's done: `Palia Map`.
|
||||||
|
|
||||||
|
If nothing happens, try rebooting your PC and retrying the above shell commands until it works.
|
||||||
|
|
||||||
|
|
||||||
|
## Final Step: Setting it up in Steam
|
||||||
|
|
||||||
|
1. Add this line to Palia launch options
|
||||||
|
```bash
|
||||||
|
protonhax init %command%
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Add random non-steam game to your library and then edit its properties:
|
||||||
|
|
||||||
|
Change the name to `Palia Map` or anything you like
|
||||||
|
|
||||||
|
Change the target to this command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
protonhax run 2707930 "/home/$USER/.local/share/Steam/steamapps/compatdata/2707930/pfx/drive_c/users/steamuser/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Overwolf/Palia Map.lnk"
|
||||||
|
```
|
115
devices/bbsteamie/modules/desktop/session-switching.nix
Normal file
115
devices/bbsteamie/modules/desktop/session-switching.nix
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
defaultSession: {
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
config = let
|
||||||
|
inherit (lib) findFirst getExe mkForce;
|
||||||
|
|
||||||
|
inherit (config.vars) mainUser;
|
||||||
|
|
||||||
|
switch-session = pkgs.writeShellApplication {
|
||||||
|
name = "switch-session";
|
||||||
|
|
||||||
|
text = ''
|
||||||
|
mkdir -p /etc/sddm.conf.d
|
||||||
|
|
||||||
|
cat <<EOF | tee /etc/sddm.conf.d/autologin.conf
|
||||||
|
[Autologin]
|
||||||
|
User=${mainUser}
|
||||||
|
Session=$1
|
||||||
|
Relogin=true
|
||||||
|
EOF
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
gaming-mode = pkgs.writeShellScriptBin "gaming-mode" ''
|
||||||
|
sudo ${pkgs.systemd}/bin/systemctl start to-gaming-mode.service
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
services.displayManager.sddm = {
|
||||||
|
enable = true;
|
||||||
|
autoLogin.relogin = true;
|
||||||
|
|
||||||
|
wayland = {
|
||||||
|
enable = true;
|
||||||
|
compositorCommand = "kwin";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Sets the default session at launch
|
||||||
|
systemd.services."set-session" = {
|
||||||
|
wantedBy = ["multi-user.target"];
|
||||||
|
before = ["display-manager.service"];
|
||||||
|
|
||||||
|
path = [switch-session];
|
||||||
|
|
||||||
|
script = ''
|
||||||
|
switch-session "${defaultSession}"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Allows switching to gaming mode
|
||||||
|
systemd.services."to-gaming-mode" = {
|
||||||
|
wantedBy = mkForce [];
|
||||||
|
|
||||||
|
path = [switch-session];
|
||||||
|
|
||||||
|
script = ''
|
||||||
|
switch-session "gamescope-wayland"
|
||||||
|
systemctl restart display-manager
|
||||||
|
sleep 10
|
||||||
|
switch-session "${defaultSession}"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Make it so we don't need root to switch to gaming mode
|
||||||
|
security.sudo.extraRules = [
|
||||||
|
{
|
||||||
|
users = [mainUser];
|
||||||
|
groups = [100];
|
||||||
|
commands = [
|
||||||
|
{
|
||||||
|
command = "${pkgs.systemd}/bin/systemctl start to-gaming-mode.service";
|
||||||
|
options = ["SETENV" "NOPASSWD"];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
home-manager.users.${mainUser} = {
|
||||||
|
# Add desktop entry to make it GUI friendly
|
||||||
|
xdg.desktopEntries."Gaming Mode" = {
|
||||||
|
name = "Gaming Mode";
|
||||||
|
exec = getExe gaming-mode;
|
||||||
|
icon = "steam";
|
||||||
|
terminal = false;
|
||||||
|
type = "Application";
|
||||||
|
};
|
||||||
|
|
||||||
|
home.file."Desktop/Gaming Mode.desktop".source =
|
||||||
|
(
|
||||||
|
findFirst
|
||||||
|
(x: x.meta.name == "Gaming Mode.desktop") {}
|
||||||
|
config.home-manager.users.mariah.home.packages
|
||||||
|
)
|
||||||
|
+ "/share/applications/Gaming Mode.desktop";
|
||||||
|
|
||||||
|
# Fix remote control prompt showing up everytime
|
||||||
|
xdg.configFile = let
|
||||||
|
mkAutostart = name: flags: {
|
||||||
|
"autostart/${name}.desktop".text = "[Desktop Entry]\nType=Application\nExec=${name} ${flags}";
|
||||||
|
};
|
||||||
|
in (
|
||||||
|
# Needs xdg-desktop-portal-kde patch provided by `self.overlays.xdg-desktop-portal-kde`
|
||||||
|
{"plasmaremotedesktoprc".text = "[Sharing]\nUnattended=true";}
|
||||||
|
// (mkAutostart "krfb" "--nodialog %c")
|
||||||
|
// (mkAutostart "steam" "-silent %U")
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# For accurate stack trace
|
||||||
|
_file = ./session-switching.nix;
|
||||||
|
}
|
82
devices/bbsteamie/modules/desktop/steam.nix
Normal file
82
devices/bbsteamie/modules/desktop/steam.nix
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
defaultSession: {
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
self,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
config = let
|
||||||
|
inherit (config.vars) mainUser;
|
||||||
|
|
||||||
|
cfg = config.programs.steam;
|
||||||
|
in {
|
||||||
|
# Normal Steam Stuff
|
||||||
|
programs.steam = {
|
||||||
|
enable = true;
|
||||||
|
protontricks.enable = true;
|
||||||
|
|
||||||
|
remotePlay.openFirewall = true;
|
||||||
|
extraCompatPackages = [
|
||||||
|
self.packages.${pkgs.system}.proton-ge-latest
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Jovian Steam settings
|
||||||
|
jovian.steam = {
|
||||||
|
# Steam > Settings > System > Enable Developer Mode
|
||||||
|
# Steam > Developer > CEF Remote Debugging
|
||||||
|
enable = true;
|
||||||
|
user = mainUser;
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
STEAM_EXTRA_COMPAT_TOOLS_PATHS =
|
||||||
|
lib.makeSearchPathOutput
|
||||||
|
"steamcompattool"
|
||||||
|
""
|
||||||
|
cfg.extraCompatPackages;
|
||||||
|
};
|
||||||
|
|
||||||
|
desktopSession = defaultSession;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Decky settings
|
||||||
|
jovian.decky-loader = {
|
||||||
|
enable = true;
|
||||||
|
user = mainUser;
|
||||||
|
stateDir = "/home/${mainUser}/.local/share/decky"; # Keep scoped to user
|
||||||
|
# https://github.com/Jovian-Experiments/Jovian-NixOS/blob/1171169117f63f1de9ef2ea36efd8dcf377c6d5a/modules/decky-loader.nix#L80-L84
|
||||||
|
|
||||||
|
extraPackages = builtins.attrValues {
|
||||||
|
inherit
|
||||||
|
(pkgs)
|
||||||
|
curl
|
||||||
|
unzip
|
||||||
|
util-linux
|
||||||
|
gnugrep
|
||||||
|
readline
|
||||||
|
procps
|
||||||
|
pciutils
|
||||||
|
libpulseaudio
|
||||||
|
;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Takes way too long to shutdown
|
||||||
|
systemd.services."decky-loader".serviceConfig.TimeoutStopSec = "5";
|
||||||
|
|
||||||
|
# Misc Packages
|
||||||
|
environment.systemPackages = [
|
||||||
|
pkgs.steam-rom-manager
|
||||||
|
pkgs.r2modman
|
||||||
|
self.packages.${pkgs.system}.protonhax
|
||||||
|
|
||||||
|
# FIXME:Ryujinx ACNH crashes on OpenGL AND Vulkan
|
||||||
|
# https://github.com/Ryujinx/Ryujinx/issues/6993
|
||||||
|
# https://github.com/Ryujinx/Ryujinx/issues/6708
|
||||||
|
self.packages.${pkgs.system}.yuzu
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# For accurate stack trace
|
||||||
|
_file = ./steam.nix;
|
||||||
|
}
|
|
@ -1,29 +1,38 @@
|
||||||
{config, ...}: let
|
{
|
||||||
|
config,
|
||||||
|
self,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
inherit (config.vars) mainUser hostName;
|
inherit (config.vars) mainUser hostName;
|
||||||
in {
|
in {
|
||||||
|
# ------------------------------------------------
|
||||||
|
# Imports
|
||||||
|
# ------------------------------------------------
|
||||||
imports = [
|
imports = [
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
|
||||||
../../modules/ags
|
./modules
|
||||||
../../modules/audio.nix
|
|
||||||
../../modules/hyprland
|
|
||||||
../../modules/kmscon.nix
|
|
||||||
../../modules/printer.nix
|
|
||||||
../../modules/razer.nix
|
|
||||||
../../modules/sshd.nix
|
|
||||||
../../modules/tailscale.nix
|
|
||||||
|
|
||||||
./modules/gpu-replay.nix
|
self.nixosModules.adb
|
||||||
./modules/nix-gaming.nix
|
self.nixosModules.desktop
|
||||||
|
self.nixosModules.kmscon
|
||||||
|
self.nixosModules.server
|
||||||
];
|
];
|
||||||
|
|
||||||
|
home-manager.users.${mainUser}.imports = [
|
||||||
|
self.homeManagerModules.firefox
|
||||||
|
];
|
||||||
|
|
||||||
|
# State Version: DO NOT CHANGE
|
||||||
|
system.stateVersion = "23.11";
|
||||||
|
|
||||||
|
# ------------------------------------------------
|
||||||
|
# User Settings
|
||||||
|
# ------------------------------------------------
|
||||||
vars = {
|
vars = {
|
||||||
mainUser = "matt";
|
mainUser = "matt";
|
||||||
hostName = "binto";
|
hostName = "binto";
|
||||||
promptMainColor = "purple";
|
promptMainColor = "purple";
|
||||||
mainMonitor = "desc:GIGA-BYTE TECHNOLOGY CO. LTD. G27QC 0x00000B1D";
|
|
||||||
greetdDupe = false;
|
|
||||||
fontSize = 12.5;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
users.users.${mainUser} = {
|
users.users.${mainUser} = {
|
||||||
|
@ -37,16 +46,6 @@ in {
|
||||||
"libvirtd"
|
"libvirtd"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
home-manager.users.${mainUser} = {
|
|
||||||
imports = [
|
|
||||||
../../home/firefox
|
|
||||||
|
|
||||||
./home/packages.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
# No touchy
|
|
||||||
home.stateVersion = "23.11";
|
|
||||||
};
|
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
inherit hostName;
|
inherit hostName;
|
||||||
|
@ -54,9 +53,31 @@ in {
|
||||||
firewall.enable = false;
|
firewall.enable = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Set your time zone.
|
|
||||||
time.timeZone = "America/Montreal";
|
time.timeZone = "America/Montreal";
|
||||||
|
|
||||||
# No touchy
|
# ------------------------------------------------
|
||||||
system.stateVersion = "23.11";
|
# `Self` Modules configuration
|
||||||
|
# ------------------------------------------------
|
||||||
|
roles.desktop = {
|
||||||
|
user = mainUser;
|
||||||
|
|
||||||
|
ags.enable = true;
|
||||||
|
mainMonitor = "desc:GIGA-BYTE TECHNOLOGY CO. LTD. G27QC 0x00000B1D";
|
||||||
|
displayManager.duplicateScreen = false;
|
||||||
|
|
||||||
|
fontSize = 12.5;
|
||||||
|
};
|
||||||
|
|
||||||
|
roles.server = {
|
||||||
|
user = mainUser;
|
||||||
|
tailscale.enable = true;
|
||||||
|
sshd.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.adb = {
|
||||||
|
enable = true;
|
||||||
|
user = mainUser;
|
||||||
|
};
|
||||||
|
|
||||||
|
services.kmscon.enable = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
|
||||||
modulesPath,
|
modulesPath,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
|
@ -15,10 +14,13 @@
|
||||||
kernelModules = ["kvm-amd"];
|
kernelModules = ["kvm-amd"];
|
||||||
|
|
||||||
# Zenpower for ryzen cpu monitoring
|
# Zenpower for ryzen cpu monitoring
|
||||||
extraModulePackages = with config.boot.kernelPackages; [
|
extraModulePackages = builtins.attrValues {
|
||||||
v4l2loopback
|
inherit
|
||||||
zenpower
|
(config.boot.kernelPackages)
|
||||||
];
|
v4l2loopback
|
||||||
|
zenpower
|
||||||
|
;
|
||||||
|
};
|
||||||
blacklistedKernelModules = ["k10temp"];
|
blacklistedKernelModules = ["k10temp"];
|
||||||
|
|
||||||
supportedFilesystems = ["ntfs"];
|
supportedFilesystems = ["ntfs"];
|
||||||
|
@ -45,13 +47,20 @@
|
||||||
|
|
||||||
fileSystems = {
|
fileSystems = {
|
||||||
"/" = {
|
"/" = {
|
||||||
device = "/dev/disk/by-uuid/560976b6-85e0-44ca-bb73-e15a78e9c449";
|
device = "/dev/disk/by-label/NIXROOT";
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
options = ["subvol=@"];
|
};
|
||||||
|
|
||||||
|
# sudo btrfs subvolume create /@swap
|
||||||
|
"/swap" = {
|
||||||
|
device = "/dev/disk/by-label/NIXROOT";
|
||||||
|
fsType = "btrfs";
|
||||||
|
# Idk why this is the subvol
|
||||||
|
options = ["subvol=@/@swap"];
|
||||||
};
|
};
|
||||||
|
|
||||||
"/boot" = {
|
"/boot" = {
|
||||||
device = "/dev/disk/by-uuid/1407-A10C";
|
device = "/dev/disk/by-label/NIXBOOT";
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,9 +70,17 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
swapDevices = [
|
||||||
|
{
|
||||||
|
device = "/swap/swapfile";
|
||||||
|
size = 16 * 1024;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
zramSwap.enable = true;
|
zramSwap.enable = true;
|
||||||
|
|
||||||
hardware = {
|
hardware = {
|
||||||
cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
cpu.amd.updateMicrocode = config.hardware.enableRedistributableFirmware;
|
||||||
uinput.enable = true;
|
uinput.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -71,10 +88,13 @@
|
||||||
libvirtd.enable = true;
|
libvirtd.enable = true;
|
||||||
spiceUSBRedirection.enable = true;
|
spiceUSBRedirection.enable = true;
|
||||||
};
|
};
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = builtins.attrValues {
|
||||||
qemu
|
inherit
|
||||||
virtiofsd
|
(pkgs)
|
||||||
];
|
qemu
|
||||||
|
virtiofsd
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
nvidia = {
|
nvidia = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
{...}: {
|
|
||||||
xdg.desktopEntries."com.github.iwalton3.jellyfin-media-player" = {
|
|
||||||
name = "Jellyfin Media Player";
|
|
||||||
comment = "Desktop client for Jellyfin";
|
|
||||||
exec = "jellyfinmediaplayer --platform xcb";
|
|
||||||
icon = "com.github.iwalton3.jellyfin-media-player";
|
|
||||||
terminal = false;
|
|
||||||
type = "Application";
|
|
||||||
categories = ["AudioVideo" "Video" "Player" "TV"];
|
|
||||||
settings = {
|
|
||||||
Version = "1.0";
|
|
||||||
StartupWMClass = "jellyfin-media-player";
|
|
||||||
};
|
|
||||||
actions = {
|
|
||||||
"DesktopF" = {
|
|
||||||
name = "Desktop [Fullscreen]";
|
|
||||||
exec = "jellyfinmediaplayer --fullscreen --desktop --platform xcb";
|
|
||||||
};
|
|
||||||
"DesktopW" = {
|
|
||||||
name = "Desktop [Windowed]";
|
|
||||||
exec = "jellyfinmediaplayer --windowed --desktop --platform xcb";
|
|
||||||
};
|
|
||||||
"TVF" = {
|
|
||||||
name = "TV [Fullscreen]";
|
|
||||||
exec = "jellyfinmediaplayer --fullscreen --tv --platform xcb";
|
|
||||||
};
|
|
||||||
"TVW" = {
|
|
||||||
name = "TV [Windowed]";
|
|
||||||
exec = "jellyfinmediaplayer --windowed --tv --platform xcb";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
6
devices/binto/modules/default.nix
Normal file
6
devices/binto/modules/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{...}: {
|
||||||
|
imports = [
|
||||||
|
./gpu-replay.nix
|
||||||
|
./nix-gaming.nix
|
||||||
|
];
|
||||||
|
}
|
|
@ -1,53 +1,18 @@
|
||||||
{
|
{
|
||||||
pkgs,
|
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
gpu-screen-recorder-src,
|
pkgs,
|
||||||
|
self,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (config.vars) mainUser mainMonitor;
|
|
||||||
inherit (lib) concatStringsSep removePrefix;
|
inherit (lib) concatStringsSep removePrefix;
|
||||||
|
|
||||||
|
inherit (config.vars) mainUser;
|
||||||
|
|
||||||
|
cfgDesktop = config.roles.desktop;
|
||||||
|
|
||||||
|
gsr = self.packages.${pkgs.system}.gpu-screen-recorder;
|
||||||
hyprPkgs = config.home-manager.users.${mainUser}.wayland.windowManager.hyprland.finalPackage;
|
hyprPkgs = config.home-manager.users.${mainUser}.wayland.windowManager.hyprland.finalPackage;
|
||||||
|
|
||||||
gsr = pkgs.stdenv.mkDerivation {
|
|
||||||
name = "gpu-screen-recorder";
|
|
||||||
version = gpu-screen-recorder-src.shortRev;
|
|
||||||
|
|
||||||
src = gpu-screen-recorder-src;
|
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [
|
|
||||||
pkg-config
|
|
||||||
makeWrapper
|
|
||||||
];
|
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
|
||||||
libpulseaudio
|
|
||||||
ffmpeg
|
|
||||||
wayland
|
|
||||||
libdrm
|
|
||||||
libva
|
|
||||||
xorg.libXcomposite
|
|
||||||
xorg.libXrandr
|
|
||||||
];
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
./build.sh
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
strip gsr-kms-server
|
|
||||||
strip gpu-screen-recorder
|
|
||||||
|
|
||||||
install -Dm755 "gsr-kms-server" "$out/bin/gsr-kms-server"
|
|
||||||
install -Dm755 "gpu-screen-recorder" "$out/bin/gpu-screen-recorder"
|
|
||||||
#install -Dm644 "extra/gpu-screen-recorder.service" "$out/lib/systemd/user/gpu-screen-recorder.service"
|
|
||||||
|
|
||||||
wrapProgram $out/bin/gpu-screen-recorder --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [
|
|
||||||
pkgs.addOpenGLRunpath.driverLink
|
|
||||||
pkgs.libglvnd
|
|
||||||
]}"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
in {
|
in {
|
||||||
security.wrappers = {
|
security.wrappers = {
|
||||||
gpu-screen-recorder = {
|
gpu-screen-recorder = {
|
||||||
|
@ -66,22 +31,22 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager.users.${mainUser} = {
|
home-manager.users.${mainUser} = {
|
||||||
home.packages = with pkgs; [
|
home.packages = [
|
||||||
gsr
|
gsr
|
||||||
|
|
||||||
(writeShellApplication {
|
(pkgs.writeShellApplication {
|
||||||
name = "gpu-save-replay";
|
name = "gpu-save-replay";
|
||||||
runtimeInputs = [procps];
|
runtimeInputs = [pkgs.procps];
|
||||||
text = ''
|
text = ''
|
||||||
pkill --signal SIGUSR1 -f gpu-screen-recorder
|
pkill --signal SIGUSR1 -f gpu-screen-recorder
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
||||||
(writeShellApplication {
|
(pkgs.writeShellApplication {
|
||||||
name = "gsr-start";
|
name = "gsr-start";
|
||||||
runtimeInputs = [pulseaudio hyprPkgs xorg.xrandr];
|
runtimeInputs = [pkgs.pulseaudio hyprPkgs pkgs.xorg.xrandr];
|
||||||
text = ''
|
text = ''
|
||||||
main="${removePrefix "desc:" mainMonitor}"
|
main="${removePrefix "desc:" cfgDesktop.mainMonitor}"
|
||||||
WINDOW=$(hyprctl -j monitors | jq '.[] |= (.description |= gsub(","; ""))' | jq -r ".[] | select(.description | test(\"$main\")) | .name")
|
WINDOW=$(hyprctl -j monitors | jq '.[] |= (.description |= gsub(","; ""))' | jq -r ".[] | select(.description | test(\"$main\")) | .name")
|
||||||
|
|
||||||
# Fix fullscreen game resolution
|
# Fix fullscreen game resolution
|
||||||
|
|
|
@ -1,28 +1,37 @@
|
||||||
{
|
{
|
||||||
nix-gaming,
|
nix-gaming,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
self,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
|
imports = [
|
||||||
|
nix-gaming.nixosModules.platformOptimizations
|
||||||
|
];
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
steam = {
|
steam = {
|
||||||
# Disable HW accel to fix flickers
|
|
||||||
enable = true;
|
enable = true;
|
||||||
remotePlay.openFirewall = true;
|
remotePlay.openFirewall = true;
|
||||||
|
|
||||||
extraCompatPackages = with pkgs; [
|
extraCompatPackages = [
|
||||||
proton-ge-bin
|
self.packages.${pkgs.system}.proton-ge-latest
|
||||||
];
|
];
|
||||||
|
|
||||||
|
platformOptimizations.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = [
|
||||||
(lutris.override {
|
(pkgs.lutris.override {
|
||||||
extraLibraries = pkgs: [
|
extraLibraries = pkgs: [
|
||||||
# List library dependencies here
|
# List library dependencies here
|
||||||
];
|
];
|
||||||
extraPkgs = pkgs: [
|
extraPkgs = pkgs: [
|
||||||
nix-gaming.packages.${pkgs.system}.wine-ge
|
# List extra packages available to lutris here
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
|
|
||||||
|
pkgs.r2modman
|
||||||
|
pkgs.ryujinx
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,30 @@
|
||||||
deviceName: {config, ...}: let
|
deviceName: {
|
||||||
|
config,
|
||||||
|
self,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
inherit (config.vars) mainUser hostName;
|
inherit (config.vars) mainUser hostName;
|
||||||
|
|
||||||
clusterIP = config.services.pcsd.virtualIps.caddy-vip.ip;
|
clusterIP = config.services.pcsd.virtualIps.caddy-vip.ip;
|
||||||
in {
|
in {
|
||||||
|
# ------------------------------------------------
|
||||||
|
# Imports
|
||||||
|
# ------------------------------------------------
|
||||||
imports = [
|
imports = [
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
|
||||||
../../modules/kmscon.nix
|
./modules
|
||||||
../../modules/sshd.nix
|
|
||||||
../../modules/tailscale.nix
|
|
||||||
|
|
||||||
./modules/pcsd.nix
|
self.nixosModules.kmscon
|
||||||
|
self.nixosModules.server
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# State Version: DO NOT CHANGE
|
||||||
|
system.stateVersion = "24.05";
|
||||||
|
|
||||||
|
# ------------------------------------------------
|
||||||
|
# User Settings
|
||||||
|
# ------------------------------------------------
|
||||||
vars = {
|
vars = {
|
||||||
mainUser = "matt";
|
mainUser = "matt";
|
||||||
hostName = deviceName;
|
hostName = deviceName;
|
||||||
|
@ -32,13 +44,6 @@ in {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager.users.${mainUser} = {
|
|
||||||
imports = [];
|
|
||||||
|
|
||||||
# No touchy
|
|
||||||
home.stateVersion = "24.05";
|
|
||||||
};
|
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
inherit hostName;
|
inherit hostName;
|
||||||
resolvconf.enable = true;
|
resolvconf.enable = true;
|
||||||
|
@ -53,9 +58,16 @@ in {
|
||||||
firewall.enable = false;
|
firewall.enable = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Set your time zone.
|
|
||||||
time.timeZone = "America/Montreal";
|
time.timeZone = "America/Montreal";
|
||||||
|
|
||||||
# No touchy
|
# ------------------------------------------------
|
||||||
system.stateVersion = "24.05";
|
# `Self` Modules configuration
|
||||||
|
# ------------------------------------------------
|
||||||
|
roles.server = {
|
||||||
|
user = mainUser;
|
||||||
|
tailscale.enable = true;
|
||||||
|
sshd.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
services.kmscon.enable = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,13 @@
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# sudo btrfs subvolume create /@swap
|
||||||
|
"/swap" = {
|
||||||
|
device = "/dev/disk/by-label/NIXROOT";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = ["subvol=@swap"];
|
||||||
|
};
|
||||||
|
|
||||||
"/boot" = {
|
"/boot" = {
|
||||||
device = "/dev/disk/by-label/NIXBOOT";
|
device = "/dev/disk/by-label/NIXBOOT";
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
|
@ -41,7 +48,7 @@
|
||||||
|
|
||||||
swapDevices = [
|
swapDevices = [
|
||||||
{
|
{
|
||||||
device = "/var/lib/swapfile";
|
device = "/swap/swapfile";
|
||||||
size = 16 * 1024;
|
size = 16 * 1024;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (config.vars) mainUser;
|
inherit (config.vars) hostName mainUser;
|
||||||
inherit (config.sops) secrets;
|
inherit (config.sops) secrets;
|
||||||
|
|
||||||
caddy = caddy-plugins.packages.${pkgs.system}.default;
|
caddy = caddy-plugins.packages.${pkgs.system}.default;
|
||||||
|
@ -15,6 +15,8 @@ in {
|
||||||
environment.systemPackages = [caddy];
|
environment.systemPackages = [caddy];
|
||||||
users.users.${mainUser}.extraGroups = ["caddy"];
|
users.users.${mainUser}.extraGroups = ["caddy"];
|
||||||
|
|
||||||
|
boot.kernel.sysctl."net.ipv4.ip_nonlocal_bind" = 1;
|
||||||
|
|
||||||
systemd.services.caddy.serviceConfig = {
|
systemd.services.caddy.serviceConfig = {
|
||||||
EnvironmentFile = secrets.caddy-cloudflare.path;
|
EnvironmentFile = secrets.caddy-cloudflare.path;
|
||||||
|
|
||||||
|
@ -33,22 +35,72 @@ in {
|
||||||
clusterIP = config.services.pcsd.virtualIps.caddy-vip.ip;
|
clusterIP = config.services.pcsd.virtualIps.caddy-vip.ip;
|
||||||
nosIP = "10.0.0.121";
|
nosIP = "10.0.0.121";
|
||||||
serviviIP = "10.0.0.249";
|
serviviIP = "10.0.0.249";
|
||||||
|
homieIP = "100.64.0.10";
|
||||||
|
|
||||||
|
tlsConf = ''
|
||||||
|
tls {
|
||||||
|
dns cloudflare {$CLOUDFLARE_API_TOKEN}
|
||||||
|
resolvers 1.0.0.1
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
mkPublicReverseProxy = subdomain: ip: extraConf:
|
||||||
|
{
|
||||||
|
hostName = "${subdomain}.nelim.org";
|
||||||
|
reverseProxy = ip;
|
||||||
|
listenAddresses = [clusterIP];
|
||||||
|
extraConfig = tlsConf + (extraConf.extraConfig or "");
|
||||||
|
}
|
||||||
|
// (builtins.removeAttrs extraConf ["extraConfig"]);
|
||||||
in {
|
in {
|
||||||
|
# Public
|
||||||
|
"Home-Assistant" = mkPublicReverseProxy "homie" "${homieIP}:8123" {};
|
||||||
|
"Vaultwarden" = mkPublicReverseProxy "vault" "${nosIP}:8781" {};
|
||||||
|
"Hauk" = mkPublicReverseProxy "hauk" "${nosIP}:3003" {};
|
||||||
|
"Headscale" = mkPublicReverseProxy "headscale" "${clusterIP}:8085" {};
|
||||||
|
|
||||||
|
"Jellyfin" = mkPublicReverseProxy "jelly" "${nosIP}:8096" {
|
||||||
|
subDirectories.jfa-go = {
|
||||||
|
subDirName = "accounts";
|
||||||
|
reverseProxy = "${nosIP}:8056";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"Jellyseer" = mkPublicReverseProxy "seerr" "${nosIP}:5055" {};
|
||||||
|
|
||||||
|
"Gameyfin" = mkPublicReverseProxy "games" "${nosIP}:8074" {};
|
||||||
|
|
||||||
|
"Forgejo" = mkPublicReverseProxy "git" "${nosIP}:3000" {};
|
||||||
|
|
||||||
|
"Nextcloud" = mkPublicReverseProxy "cloud" "${nosIP}:8042" {
|
||||||
|
extraConfig = ''
|
||||||
|
redir /.well-known/carddav /remote.php/dav 301
|
||||||
|
redir /.well-known/caldav /remote.php/dav 301
|
||||||
|
redir /.well-known/webfinger /index.php/.well-known/webfinger 301
|
||||||
|
redir /.well-known/nodeinfo /index.php/.well-known/nodeinfo 301
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
"OnlyOffice" = mkPublicReverseProxy "office" "http://${nosIP}:8055" {};
|
||||||
|
|
||||||
|
"Immich" = mkPublicReverseProxy "photos" "${nosIP}:2283" {};
|
||||||
|
|
||||||
|
"Binary Cache" = mkPublicReverseProxy "cache" "${serviviIP}:5000" {};
|
||||||
|
|
||||||
|
# Private
|
||||||
"nelim.org" = {
|
"nelim.org" = {
|
||||||
serverAliases = ["*.nelim.org"];
|
serverAliases = ["*.nelim.org"];
|
||||||
extraConfig = ''
|
extraConfig = tlsConf;
|
||||||
tls {
|
listenAddresses = [
|
||||||
dns cloudflare {$CLOUDFLARE_API_TOKEN}
|
(
|
||||||
resolvers 1.0.0.1
|
if hostName == "thingone"
|
||||||
}
|
then "100.64.0.8"
|
||||||
'';
|
else "100.64.0.9"
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
subDomains = {
|
subDomains = {
|
||||||
# Misc one-liners
|
esphome.reverseProxy = "${homieIP}:6052";
|
||||||
vault.reverseProxy = "${nosIP}:8781";
|
pr-tracker.reverseProxy = "${serviviIP}:3000";
|
||||||
hauk.reverseProxy = "${nosIP}:3003";
|
|
||||||
headscale.reverseProxy = "${clusterIP}:8085";
|
|
||||||
jelly.reverseProxy = "${nosIP}:8097";
|
|
||||||
|
|
||||||
pcsd = {
|
pcsd = {
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
|
@ -64,39 +116,6 @@ in {
|
||||||
resume.reverseProxy = "${nosIP}:3060";
|
resume.reverseProxy = "${nosIP}:3060";
|
||||||
resauth.reverseProxy = "${nosIP}:3100";
|
resauth.reverseProxy = "${nosIP}:3100";
|
||||||
|
|
||||||
# Nextcloud & Co
|
|
||||||
office.reverseProxy = "http://${nosIP}:8055";
|
|
||||||
nextcloud = {
|
|
||||||
subDomainName = "cloud";
|
|
||||||
extraConfig = ''
|
|
||||||
redir /.well-known/carddav /remote.php/dav 301
|
|
||||||
redir /.well-known/caldav /remote.php/dav 301
|
|
||||||
redir /.well-known/webfinger /index.php/.well-known/webfinger 301
|
|
||||||
redir /.well-known/nodeinfo /index.php/.well-known/nodeinfo 301
|
|
||||||
'';
|
|
||||||
reverseProxy = "${nosIP}:8042";
|
|
||||||
};
|
|
||||||
|
|
||||||
forgejo = {
|
|
||||||
subDomainName = "git";
|
|
||||||
reverseProxy = "${nosIP}:3000";
|
|
||||||
};
|
|
||||||
|
|
||||||
nix-binary-cache = {
|
|
||||||
subDomainName = "cache";
|
|
||||||
reverseProxy = "${serviviIP}:5000";
|
|
||||||
};
|
|
||||||
|
|
||||||
calibre = {
|
|
||||||
subDomainName = "books";
|
|
||||||
reverseProxy = "${nosIP}:8083";
|
|
||||||
};
|
|
||||||
|
|
||||||
immich = {
|
|
||||||
subDomainName = "photos";
|
|
||||||
reverseProxy = "${nosIP}:2283";
|
|
||||||
};
|
|
||||||
|
|
||||||
# FreshRSS & Co
|
# FreshRSS & Co
|
||||||
bridge.reverseProxy = "${nosIP}:3006";
|
bridge.reverseProxy = "${nosIP}:3006";
|
||||||
drss.reverseProxy = "${nosIP}:3007";
|
drss.reverseProxy = "${nosIP}:3007";
|
||||||
|
@ -105,16 +124,6 @@ in {
|
||||||
reverseProxy = "${nosIP}:2800";
|
reverseProxy = "${nosIP}:2800";
|
||||||
};
|
};
|
||||||
|
|
||||||
jellyseer = {
|
|
||||||
subDomainName = "seerr";
|
|
||||||
reverseProxy = "${nosIP}:5055";
|
|
||||||
};
|
|
||||||
|
|
||||||
gameyfin = {
|
|
||||||
subDomainName = "games";
|
|
||||||
reverseProxy = "${nosIP}:8074";
|
|
||||||
};
|
|
||||||
|
|
||||||
wgui.reverseProxy = "${nosIP}:51821";
|
wgui.reverseProxy = "${nosIP}:51821";
|
||||||
|
|
||||||
lan = {
|
lan = {
|
||||||
|
@ -125,16 +134,10 @@ in {
|
||||||
|
|
||||||
subDirectories = {
|
subDirectories = {
|
||||||
bazarr.reverseProxy = "${nosIP}:6767";
|
bazarr.reverseProxy = "${nosIP}:6767";
|
||||||
bazarr-french = {
|
|
||||||
subDirName = "bafrr";
|
|
||||||
reverseProxy = "${nosIP}:6766";
|
|
||||||
};
|
|
||||||
|
|
||||||
prowlarr.reverseProxy = "${nosIP}:9696";
|
prowlarr.reverseProxy = "${nosIP}:9696";
|
||||||
radarr.reverseProxy = "${nosIP}:7878";
|
radarr.reverseProxy = "${nosIP}:7878";
|
||||||
sabnzbd.reverseProxy = "${nosIP}:8382";
|
sabnzbd.reverseProxy = "${nosIP}:8382";
|
||||||
sonarr.reverseProxy = "${nosIP}:8989";
|
sonarr.reverseProxy = "${nosIP}:8989";
|
||||||
calibre.reverseProxy = "${nosIP}:8580";
|
|
||||||
|
|
||||||
qbittorent = {
|
qbittorent = {
|
||||||
subDirName = "qbt";
|
subDirName = "qbt";
|
||||||
|
|
10
devices/cluster/modules/default.nix
Normal file
10
devices/cluster/modules/default.nix
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{...}: {
|
||||||
|
imports = [
|
||||||
|
./blocky.nix
|
||||||
|
./caddy.nix
|
||||||
|
./headscale
|
||||||
|
./nfs-client.nix
|
||||||
|
./pcsd.nix
|
||||||
|
./unbound.nix
|
||||||
|
];
|
||||||
|
}
|
|
@ -2,7 +2,9 @@
|
||||||
# NFS client setup
|
# NFS client setup
|
||||||
services.rpcbind.enable = true;
|
services.rpcbind.enable = true;
|
||||||
boot.supportedFilesystems = ["nfs"];
|
boot.supportedFilesystems = ["nfs"];
|
||||||
environment.systemPackages = with pkgs; [nfs-utils];
|
environment.systemPackages = builtins.attrValues {
|
||||||
|
inherit (pkgs) nfs-utils;
|
||||||
|
};
|
||||||
|
|
||||||
systemd.mounts = let
|
systemd.mounts = let
|
||||||
host = "10.0.0.249";
|
host = "10.0.0.249";
|
||||||
|
|
|
@ -5,15 +5,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (config.sops) secrets;
|
inherit (config.sops) secrets;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [pcsd.nixosModules.default];
|
||||||
pcsd.nixosModules.default
|
|
||||||
|
|
||||||
./blocky.nix
|
|
||||||
./caddy.nix
|
|
||||||
./headscale
|
|
||||||
./nfs-client.nix
|
|
||||||
./unbound.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
services.pcsd = {
|
services.pcsd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -1,5 +1,23 @@
|
||||||
{config, ...}: let
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) foldl isList mapAttrsToList mergeAttrsWithFunc remove unique;
|
||||||
|
mergeAttrsList = list:
|
||||||
|
foldl (mergeAttrsWithFunc (a: b:
|
||||||
|
if isList a && isList b
|
||||||
|
then unique (a ++ b)
|
||||||
|
else b)) {}
|
||||||
|
list;
|
||||||
|
|
||||||
inherit (config.vars) mainUser hostName;
|
inherit (config.vars) mainUser hostName;
|
||||||
|
|
||||||
|
serviviIP = "100.64.0.7";
|
||||||
|
caddyIp =
|
||||||
|
if hostName == "thingone"
|
||||||
|
then "100.64.0.8"
|
||||||
|
else "100.64.0.9";
|
||||||
in {
|
in {
|
||||||
# https://github.com/MatthewVance/unbound-docker-rpi/issues/4#issuecomment-1001879602
|
# https://github.com/MatthewVance/unbound-docker-rpi/issues/4#issuecomment-1001879602
|
||||||
boot.kernel.sysctl."net.core.rmem_max" = 1048576;
|
boot.kernel.sysctl."net.core.rmem_max" = 1048576;
|
||||||
|
@ -12,70 +30,66 @@ in {
|
||||||
resolveLocalQueries = false;
|
resolveLocalQueries = false;
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
server = {
|
server = let
|
||||||
interface = ["127.0.0.1"];
|
mkLocalEntry = domain: ip: {
|
||||||
port = 5335;
|
local-zone = ["${domain} redirect"];
|
||||||
|
local-data = ["\"${domain} IN A ${ip}\""];
|
||||||
|
};
|
||||||
|
|
||||||
# Custom DNS
|
mkMinecraftEntry = domain: port: {
|
||||||
local-zone = [
|
local-zone = ["${domain} transparent"];
|
||||||
"headscale.nelim.org redirect"
|
local-data = [
|
||||||
"git.nelim.org redirect"
|
"\"${domain} IN A ${serviviIP}\""
|
||||||
"mc.nelim.org transparent"
|
"\"_minecraft._tcp.${domain}. 180 IN SRV 0 0 ${toString port} ${domain}.\""
|
||||||
"cv.nelim.org transparent"
|
];
|
||||||
"mc2.nelim.org transparent"
|
};
|
||||||
"ota.nelim.org redirect"
|
|
||||||
"nelim.org redirect"
|
|
||||||
];
|
|
||||||
local-data = let
|
|
||||||
wanIP = "166.62.179.208";
|
|
||||||
caddyIp =
|
|
||||||
if hostName == "thingone"
|
|
||||||
then "100.64.0.8"
|
|
||||||
else "100.64.0.9";
|
|
||||||
in [
|
|
||||||
"\"headscale.nelim.org. IN A ${wanIP}\""
|
|
||||||
|
|
||||||
"\"git.nelim.org. IN A ${wanIP}\""
|
forceResolveEntry = domain: {
|
||||||
|
local-zone = ["${domain} always_transparent"];
|
||||||
|
};
|
||||||
|
|
||||||
"\"mc.nelim.org IN A 100.64.0.7\""
|
publicApps = remove "nelim.org" (mapAttrsToList (n: v: v.hostName) config.services.caddy.virtualHosts);
|
||||||
"\"_minecraft._tcp.mc.nelim.org. 180 IN SRV 0 0 25569 mc.nelim.org.\""
|
in
|
||||||
|
mergeAttrsList (
|
||||||
|
(map forceResolveEntry publicApps)
|
||||||
|
++ [
|
||||||
|
(mkMinecraftEntry "mc.nelim.org" 25569)
|
||||||
|
(mkMinecraftEntry "mc2.nelim.org" 25560)
|
||||||
|
(mkMinecraftEntry "cv.nelim.org" 25566)
|
||||||
|
|
||||||
"\"cv.nelim.org IN A 100.64.0.7\""
|
(mkLocalEntry "nelim.org" caddyIp)
|
||||||
"\"_minecraft._tcp.cv.nelim.org. 180 IN SRV 0 0 25566 cv.nelim.org.\""
|
|
||||||
|
|
||||||
"\"mc2.nelim.org IN A 100.64.0.7\""
|
{
|
||||||
"\"_minecraft._tcp.mc2.nelim.org. 180 IN SRV 0 0 25560 mc2.nelim.org.\""
|
interface = ["127.0.0.1"];
|
||||||
|
port = 5335;
|
||||||
|
|
||||||
"\"ota.nelim.org. IN A 100.64.0.5\""
|
do-ip4 = true;
|
||||||
|
do-ip6 = false;
|
||||||
|
prefer-ip6 = false;
|
||||||
|
do-udp = true;
|
||||||
|
do-tcp = true;
|
||||||
|
|
||||||
"\"nelim.org 0 A ${caddyIp}\""
|
# Performance
|
||||||
];
|
prefetch = true;
|
||||||
|
num-threads = 1;
|
||||||
|
|
||||||
do-ip4 = true;
|
private-address = [
|
||||||
do-ip6 = false;
|
"172.16.0.0/12"
|
||||||
prefer-ip6 = false;
|
"10.0.0.0/8"
|
||||||
do-udp = true;
|
"100.64.0.0/8"
|
||||||
do-tcp = true;
|
"fd00::/8"
|
||||||
|
"fe80::/10"
|
||||||
|
];
|
||||||
|
|
||||||
# Performance
|
# Default stuff
|
||||||
prefetch = true;
|
harden-glue = true;
|
||||||
num-threads = 1;
|
harden-dnssec-stripped = true;
|
||||||
|
use-caps-for-id = false;
|
||||||
private-address = [
|
edns-buffer-size = 1232;
|
||||||
"172.16.0.0/12"
|
so-rcvbuf = "1m";
|
||||||
"10.0.0.0/8"
|
}
|
||||||
"100.64.0.0/8"
|
]
|
||||||
"fd00::/8"
|
);
|
||||||
"fe80::/10"
|
|
||||||
];
|
|
||||||
|
|
||||||
# Default stuff
|
|
||||||
harden-glue = true;
|
|
||||||
harden-dnssec-stripped = true;
|
|
||||||
use-caps-for-id = false;
|
|
||||||
edns-buffer-size = 1232;
|
|
||||||
so-rcvbuf = "1m";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
59
devices/homie/default.nix
Normal file
59
devices/homie/default.nix
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
self,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (config.vars) mainUser hostName;
|
||||||
|
in {
|
||||||
|
# ------------------------------------------------
|
||||||
|
# Imports
|
||||||
|
# ------------------------------------------------
|
||||||
|
imports = [
|
||||||
|
./hardware-configuration.nix
|
||||||
|
|
||||||
|
./modules
|
||||||
|
|
||||||
|
self.nixosModules.docker
|
||||||
|
self.nixosModules.kmscon
|
||||||
|
self.nixosModules.server
|
||||||
|
];
|
||||||
|
|
||||||
|
# State Version: DO NOT CHANGE
|
||||||
|
system.stateVersion = "24.11";
|
||||||
|
|
||||||
|
# ------------------------------------------------
|
||||||
|
# User Settings
|
||||||
|
# ------------------------------------------------
|
||||||
|
vars = {
|
||||||
|
mainUser = "matt";
|
||||||
|
hostName = "homie";
|
||||||
|
promptMainColor = "yellow";
|
||||||
|
};
|
||||||
|
|
||||||
|
users.users.${mainUser} = {
|
||||||
|
isNormalUser = true;
|
||||||
|
extraGroups = [
|
||||||
|
"wheel"
|
||||||
|
"adm"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
inherit hostName;
|
||||||
|
resolvconf.enable = true;
|
||||||
|
firewall.enable = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
time.timeZone = "America/Montreal";
|
||||||
|
|
||||||
|
# ------------------------------------------------
|
||||||
|
# `Self` Modules configuration
|
||||||
|
# ------------------------------------------------
|
||||||
|
roles.server = {
|
||||||
|
user = mainUser;
|
||||||
|
tailscale.enable = true;
|
||||||
|
sshd.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
services.kmscon.enable = true;
|
||||||
|
}
|
|
@ -6,24 +6,22 @@
|
||||||
nixpkgs.hostPlatform = "x86_64-linux";
|
nixpkgs.hostPlatform = "x86_64-linux";
|
||||||
imports = [(modulesPath + "/installer/scan/not-detected.nix")];
|
imports = [(modulesPath + "/installer/scan/not-detected.nix")];
|
||||||
|
|
||||||
services.logind = {
|
|
||||||
lidSwitchDocked = "ignore";
|
|
||||||
lidSwitchExternalPower = "ignore";
|
|
||||||
};
|
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
loader = {
|
loader = {
|
||||||
|
efi.canTouchEfiVariables = true;
|
||||||
timeout = 2;
|
timeout = 2;
|
||||||
|
|
||||||
grub = {
|
systemd-boot = {
|
||||||
enable = true;
|
enable = true;
|
||||||
device = "/dev/sda";
|
consoleMode = "max";
|
||||||
|
configurationLimit = 30;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
initrd.availableKernelModules = [
|
initrd.availableKernelModules = [
|
||||||
"uhci_hcd"
|
"xhci_pci"
|
||||||
"ehci_pci"
|
|
||||||
"ahci"
|
"ahci"
|
||||||
|
"nvme"
|
||||||
"usbhid"
|
"usbhid"
|
||||||
"usb_storage"
|
"usb_storage"
|
||||||
"sd_mod"
|
"sd_mod"
|
||||||
|
@ -33,18 +31,26 @@
|
||||||
fileSystems = {
|
fileSystems = {
|
||||||
"/" = {
|
"/" = {
|
||||||
device = "/dev/disk/by-label/NIXROOT";
|
device = "/dev/disk/by-label/NIXROOT";
|
||||||
fsType = "ext4";
|
fsType = "btrfs";
|
||||||
|
};
|
||||||
|
|
||||||
|
# sudo btrfs subvolume create /@swap
|
||||||
|
"/swap" = {
|
||||||
|
device = "/dev/disk/by-label/NIXROOT";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = ["subvol=@swap"];
|
||||||
};
|
};
|
||||||
|
|
||||||
"/boot" = {
|
"/boot" = {
|
||||||
device = "/dev/disk/by-label/NIXBOOT";
|
device = "/dev/disk/by-label/NIXBOOT";
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
|
options = ["fmask=0022" "dmask=0022"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [
|
swapDevices = [
|
||||||
{
|
{
|
||||||
device = "/var/lib/swapfile";
|
device = "/swap/swapfile";
|
||||||
size = 16 * 1024;
|
size = 16 * 1024;
|
||||||
}
|
}
|
||||||
];
|
];
|
5
devices/homie/modules/default.nix
Normal file
5
devices/homie/modules/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{...}: {
|
||||||
|
imports = [
|
||||||
|
./home-assistant
|
||||||
|
];
|
||||||
|
}
|
69
devices/homie/modules/home-assistant/assist.nix
Normal file
69
devices/homie/modules/home-assistant/assist.nix
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
self,
|
||||||
|
wakewords-src,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
imports = [
|
||||||
|
self.nixosModules.esphome-plus
|
||||||
|
self.nixosModules.wyoming-plus
|
||||||
|
];
|
||||||
|
|
||||||
|
services = {
|
||||||
|
home-assistant = {
|
||||||
|
extraComponents = [
|
||||||
|
"esphome"
|
||||||
|
"ollama"
|
||||||
|
"wyoming"
|
||||||
|
];
|
||||||
|
|
||||||
|
customComponents = builtins.attrValues {
|
||||||
|
inherit (self.legacyPackages.${pkgs.system}.hass-components) home-llm;
|
||||||
|
# Home-llm prompt:
|
||||||
|
/*
|
||||||
|
You are 'Homie', a helpful AI Assistant that controls the devices in a house. Complete the following task as instructed.
|
||||||
|
|
||||||
|
The current time and date is {{ (as_timestamp(now()) | timestamp_custom("%I:%M %p on %A %B %d, %Y", "EST")) }}.
|
||||||
|
|
||||||
|
Services: {{ formatted_tools }}
|
||||||
|
Devices:
|
||||||
|
{{ formatted_devices }}
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
assist_pipeline = {};
|
||||||
|
conversation = {};
|
||||||
|
media_source = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
wyoming = {
|
||||||
|
piper.servers."en" = {
|
||||||
|
enable = true;
|
||||||
|
uri = "tcp://127.0.0.1:10200";
|
||||||
|
|
||||||
|
# see https://github.com/rhasspy/rhasspy3/blob/master/programs/tts/piper/script/download.py
|
||||||
|
voice = "en-us-ryan-low"; # using `hfc male (medium)` in GUI
|
||||||
|
speaker = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
openwakeword-docker = {
|
||||||
|
enable = true;
|
||||||
|
uri = "127.0.0.1:10400";
|
||||||
|
|
||||||
|
customModelsDirectories = ["${wakewords-src}/en/yo_homie"];
|
||||||
|
preloadModels = ["yo_homie"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
esphome = {
|
||||||
|
enable = true;
|
||||||
|
address = "100.64.0.10";
|
||||||
|
port = 6052;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# In case tailscale is down
|
||||||
|
boot.kernel.sysctl."net.ipv4.ip_nonlocal_bind" = 1;
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue