Compare commits

...

27 Commits

Author SHA1 Message Date
Giulio De Pasquale
bd130216e8 chore: update lock 2024-11-17 20:31:50 +00:00
Giulio De Pasquale
5c7bbda59e feat(flake): add TeslaMate flake and import NixOS module
- Added `teslamate-flake` input to the flake configuration
- Imported TeslaMate's NixOS module in the system configuration
- Updated function signatures to remove unused `system` parameter where applicable
2024-11-17 20:31:45 +00:00
Giulio De Pasquale
38644cc57f feat(architect/options.nix): add recommendedProxySettings option
- Introduced `recommendedProxySettings` to force the use of recommended proxy configuration.
- Updated location configuration to include `recommendedProxySettings`.
2024-11-17 20:31:13 +00:00
Giulio De Pasquale
5d090a32bd fix(headscale.nix): update domain and package reference
- Updated `domain` to use a single string "vipienne.giugl.io"
- Changed `headscalePkg` to use the stable `pkgs.headscale` instead of `pkgs.unstablePkgs.headscale`
- Corrected `base_domain` in `dns_config` to use the updated `domain` variable
2024-11-17 20:30:42 +00:00
Giulio De Pasquale
15448ebc67 fix(nextcloud.nix): update Nextcloud package to version 30 2024-11-17 20:30:21 +00:00
Giulio De Pasquale
4cbf34f0bf feat(architect/default.nix): add teslamate and postgres services 2024-11-17 20:30:11 +00:00
Giulio De Pasquale
48f370d9a4 refactor(architect/llm.nix): comment out frontend vhost and container configurations
- Commented out the `frontendDomain` vhost configuration
- Updated backend port to use `ollamaPort`
- Added `recommendedProxySettings = false;` for backend vhost
- Commented out the entire OCI containers section for `ollama-webui`
2024-11-17 20:29:57 +00:00
Giulio De Pasquale
2602da324e refactor(matrix.nix): remove unused PostgreSQL configuration
- Removed the commented-out and unused `postgresql` service configuration from `matrix.nix`.
2024-11-17 20:29:37 +00:00
Giulio De Pasquale
3dc81c6c49 fix(nginx.nix): enable recommended proxy settings
- Enabled `recommendedProxySettings` in the Nginx configuration
2024-11-17 20:29:23 +00:00
Giulio De Pasquale
9f01055530 fix(postgres.nix): update configuration path to use services.postgresql
- Changed the configuration path from `postgresql` to `services.postgresql` for consistency and correctness.
2024-11-17 20:29:10 +00:00
Giulio De Pasquale
2dc8e1b1a3 factor(teslamate.nix): update domain, ports, and service configuration
- Updated domain to `tesla.giugl.io`
- Added separate ports for TeslaMate (`11234`) and Grafana (`11334`)
- Configured proxy settings for websockets in `/` and `/live/websocket` locations
- Added `/grafana` location with appropriate configuration
- Updated `services.teslamate` to include port, listen address, secrets file, virtual host, PostgreSQL server, and Grafana settings
2024-11-17 20:28:53 +00:00
Giulio De Pasquale
23ee309b8f refactor(home/aichat): update configuration and roles handling
- Removed inline `config` and `roles` definitions
- Used `lib.readFile` to load external files for configuration and roles
- Organized role files into separate markdown documents
2024-11-17 20:28:08 +00:00
Giulio De Pasquale
8b467e073e chore(commits.sh): remove unnecessary trailing newlines
- Removed two trailing newline characters at the end of the file
2024-11-17 20:16:14 +00:00
Giulio De Pasquale
227c289967 fix(home/zsh.nix): correct path for commitFunctions
- Updated the path to correctly place `commits.sh` inside the `bin` directory
2024-11-17 20:16:01 +00:00
Giulio De Pasquale
58e2b8dab7 feat(home/git.nix): enable Git LFS and add aliases
- Enabled Git Large File Storage (LFS)
- Added `ai` alias to generate diff with AI chat
2024-11-17 20:15:47 +00:00
Giulio De Pasquale
72167fd861 refactor(config.yaml): update client configuration for openai-compatible
- Updated `type` to `openai-compatible`
- Added `name` field for clarity
- Adjusted `api_base` URL to include `/v1`
- Simplified and updated model configurations for consistency
2024-11-17 20:15:18 +00:00
Giulio De Pasquale
bd9329a9ed Add files 2024-11-17 20:10:06 +00:00
Giulio De Pasquale
251d38d411 Merge branch 'master' of ssh://git.giugl.io/peperunas/nixos 2024-11-17 14:17:56 +00:00
Giulio De Pasquale
d9e6d1acd4 feat: load helix files from files 2024-11-17 14:15:29 +00:00
Giulio De Pasquale
71f4de2804 feat: teslamate 2024-11-16 13:19:23 +00:00
Giulio De Pasquale
60eccadaa8 Stabilize sunshine 2024-10-31 12:48:45 +00:00
Giulio De Pasquale
f7f1da25ed refactor: use sunshine service 2024-10-31 08:33:56 +00:00
Giulio De Pasquale
2487717aaf fix(ollama): DNS resolution in LAN 2024-10-07 13:05:45 +01:00
Giulio De Pasquale
777e32601d Update lock 2024-10-07 12:58:01 +01:00
Giulio De Pasquale
8f288db067 fix(prowlarr): enable websockets 2024-10-07 12:10:50 +01:00
Giulio De Pasquale
c6a0389845 fix(docker): use correct field after 24.05 2024-10-07 12:09:38 +01:00
Giulio De Pasquale
74efccbdb6 refactor(dns): simplify DNS config and associate architect domain to every interface 2024-10-07 12:09:12 +01:00
25 changed files with 1361 additions and 437 deletions

775
flake.lock generated
View File

@ -1,5 +1,317 @@
{
"nodes": {
"cachix": {
"inputs": {
"devenv": "devenv_2",
"flake-compat": [
"teslamate-flake",
"devenv",
"flake-compat"
],
"git-hooks": [
"teslamate-flake",
"devenv",
"pre-commit-hooks"
],
"nixpkgs": [
"teslamate-flake",
"devenv",
"nixpkgs"
]
},
"locked": {
"lastModified": 1726520618,
"narHash": "sha256-jOsaBmJ/EtX5t/vbylCdS7pWYcKGmWOKg4QKUzKr6dA=",
"owner": "cachix",
"repo": "cachix",
"rev": "695525f9086542dfb09fde0871dbf4174abbf634",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "cachix",
"type": "github"
}
},
"cachix_2": {
"inputs": {
"devenv": "devenv_3",
"flake-compat": [
"teslamate-flake",
"devenv",
"cachix",
"devenv",
"flake-compat"
],
"nixpkgs": [
"teslamate-flake",
"devenv",
"cachix",
"devenv",
"nixpkgs"
],
"pre-commit-hooks": [
"teslamate-flake",
"devenv",
"cachix",
"devenv",
"pre-commit-hooks"
]
},
"locked": {
"lastModified": 1712055811,
"narHash": "sha256-7FcfMm5A/f02yyzuavJe06zLa9hcMHsagE28ADcmQvk=",
"owner": "cachix",
"repo": "cachix",
"rev": "02e38da89851ec7fec3356a5c04bc8349cae0e30",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "cachix",
"type": "github"
}
},
"devenv": {
"inputs": {
"cachix": "cachix",
"flake-compat": "flake-compat_2",
"nix": "nix_3",
"nixpkgs": "nixpkgs_4",
"pre-commit-hooks": "pre-commit-hooks_2"
},
"locked": {
"lastModified": 1729445229,
"narHash": "sha256-3vhSEs2ufSvv2Oct8G9CWEPFI57c4NAZ2wR2accHELM=",
"owner": "cachix",
"repo": "devenv",
"rev": "006016cf4191c34c17cfdb6669e0690e24302ac0",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"devenv-root": {
"flake": false,
"locked": {
"narHash": "sha256-d6xi4mKdjkX2JFicDIv5niSzpyI0m/Hnm8GGAIU04kY=",
"type": "file",
"url": "file:///dev/null"
},
"original": {
"type": "file",
"url": "file:///dev/null"
}
},
"devenv_2": {
"inputs": {
"cachix": "cachix_2",
"flake-compat": [
"teslamate-flake",
"devenv",
"cachix",
"flake-compat"
],
"nix": "nix_2",
"nixpkgs": [
"teslamate-flake",
"devenv",
"cachix",
"nixpkgs"
],
"pre-commit-hooks": [
"teslamate-flake",
"devenv",
"cachix",
"git-hooks"
]
},
"locked": {
"lastModified": 1723156315,
"narHash": "sha256-0JrfahRMJ37Rf1i0iOOn+8Z4CLvbcGNwa2ChOAVrp/8=",
"owner": "cachix",
"repo": "devenv",
"rev": "ff5eb4f2accbcda963af67f1a1159e3f6c7f5f91",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"devenv_3": {
"inputs": {
"flake-compat": [
"teslamate-flake",
"devenv",
"cachix",
"devenv",
"cachix",
"flake-compat"
],
"nix": "nix",
"nixpkgs": "nixpkgs_2",
"poetry2nix": "poetry2nix",
"pre-commit-hooks": [
"teslamate-flake",
"devenv",
"cachix",
"devenv",
"cachix",
"pre-commit-hooks"
]
},
"locked": {
"lastModified": 1708704632,
"narHash": "sha256-w+dOIW60FKMaHI1q5714CSibk99JfYxm0CzTinYWr+Q=",
"owner": "cachix",
"repo": "devenv",
"rev": "2ee4450b0f4b95a1b90f2eb5ffea98b90e48c196",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "python-rewrite",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"teslamate-flake",
"devenv",
"nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1712014858,
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"teslamate-flake",
"nixpkgs"
]
},
"locked": {
"lastModified": 1727826117,
"narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"teslamate-flake",
"devenv",
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -7,11 +319,11 @@
]
},
"locked": {
"lastModified": 1725703823,
"narHash": "sha256-tDgM4d8mLK0Hd6YMB2w1BqMto1XBXADOzPEaLl10VI4=",
"lastModified": 1726989464,
"narHash": "sha256-Vl+WVTJwutXkimwGprnEtXc/s/s8sMuXzqXaspIGlwM=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "208df2e558b73b6a1f0faec98493cb59a25f62ba",
"rev": "2f23fa308a7c067e52dfcc30a0758f47043ec176",
"type": "github"
},
"original": {
@ -21,10 +333,26 @@
"type": "github"
}
},
"libgit2": {
"flake": false,
"locked": {
"lastModified": 1697646580,
"narHash": "sha256-oX4Z3S9WtJlwvj0uH9HlYcWv+x1hqp8mhXl7HsLu2f0=",
"owner": "libgit2",
"repo": "libgit2",
"rev": "45fd9ed7ae1a9b74b957ef4f337bc3c8b3df01b5",
"type": "github"
},
"original": {
"owner": "libgit2",
"repo": "libgit2",
"type": "github"
}
},
"local-unstable": {
"locked": {
"lastModified": 0,
"narHash": "sha256-xGb70My2Qaz8TBb1Qi8cG28r7QgEMaUgKmluvFLL3n0=",
"narHash": "sha256-9xAEU7FSzN5kEu+LGYSQwoYySauT7XmyxCTfkdS6eBs=",
"path": "/home/giulio/dev/nixpkgs",
"type": "path"
},
@ -33,13 +361,131 @@
"type": "path"
}
},
"nix": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": [
"teslamate-flake",
"devenv",
"cachix",
"devenv",
"cachix",
"devenv",
"nixpkgs"
],
"nixpkgs-regression": "nixpkgs-regression"
},
"locked": {
"lastModified": 1712911606,
"narHash": "sha256-BGvBhepCufsjcUkXnEEXhEVjwdJAwPglCC2+bInc794=",
"owner": "domenkozar",
"repo": "nix",
"rev": "b24a9318ea3f3600c1e24b4a00691ee912d4de12",
"type": "github"
},
"original": {
"owner": "domenkozar",
"ref": "devenv-2.21",
"repo": "nix",
"type": "github"
}
},
"nix-github-actions": {
"inputs": {
"nixpkgs": [
"teslamate-flake",
"devenv",
"cachix",
"devenv",
"cachix",
"devenv",
"poetry2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1688870561,
"narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=",
"owner": "nix-community",
"repo": "nix-github-actions",
"rev": "165b1650b753316aa7f1787f3005a8d2da0f5301",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nix-github-actions",
"type": "github"
}
},
"nix_2": {
"inputs": {
"flake-compat": [
"teslamate-flake",
"devenv",
"cachix",
"devenv",
"flake-compat"
],
"nixpkgs": [
"teslamate-flake",
"devenv",
"cachix",
"devenv",
"nixpkgs"
],
"nixpkgs-regression": "nixpkgs-regression_2"
},
"locked": {
"lastModified": 1712911606,
"narHash": "sha256-BGvBhepCufsjcUkXnEEXhEVjwdJAwPglCC2+bInc794=",
"owner": "domenkozar",
"repo": "nix",
"rev": "b24a9318ea3f3600c1e24b4a00691ee912d4de12",
"type": "github"
},
"original": {
"owner": "domenkozar",
"ref": "devenv-2.21",
"repo": "nix",
"type": "github"
}
},
"nix_3": {
"inputs": {
"flake-compat": [
"teslamate-flake",
"devenv",
"flake-compat"
],
"flake-parts": "flake-parts",
"libgit2": "libgit2",
"nixpkgs": "nixpkgs_3",
"nixpkgs-23-11": "nixpkgs-23-11",
"nixpkgs-regression": "nixpkgs-regression_3",
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1727438425,
"narHash": "sha256-X8ES7I1cfNhR9oKp06F6ir4Np70WGZU5sfCOuNBEwMg=",
"owner": "domenkozar",
"repo": "nix",
"rev": "f6c5ae4c1b2e411e6b1e6a8181cc84363d6a7546",
"type": "github"
},
"original": {
"owner": "domenkozar",
"ref": "devenv-2.24",
"repo": "nix",
"type": "github"
}
},
"nixos-unstable": {
"locked": {
"lastModified": 1726586287,
"narHash": "sha256-EVoe9a4gRtZRB4gSOVM9chM134ukbSdDga9U43PvE+M=",
"lastModified": 1731762464,
"narHash": "sha256-kr+46IEV/3hqO/IlXvucFeNpVkrNRvIhHFnEv/k381s=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e2f071fe687360ffff1af051e7914f8bcdf23762",
"rev": "0361bb03c0bad5f32e7d3010da3921cba20b3126",
"type": "github"
},
"original": {
@ -51,11 +497,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1726579655,
"narHash": "sha256-+ymZdG2IYqGrIksB1ryLlLK/8b6D2yFPcPAWuqZYOqk=",
"lastModified": 1731737433,
"narHash": "sha256-pT/lio7wmcXBZreoQ3xsPYd2wGvlFNKnottDYpwJSfs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6ce91ea69aaa9544a232cd006e21491bc0a44697",
"rev": "3c1c28c6d6691914707719d33f2e88b0feb7c58d",
"type": "github"
},
"original": {
@ -65,6 +511,150 @@
"type": "github"
}
},
"nixpkgs-23-11": {
"locked": {
"lastModified": 1717159533,
"narHash": "sha256-oamiKNfr2MS6yH64rUn99mIZjc45nGJlj9eGth/3Xuw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446",
"type": "github"
}
},
"nixpkgs-regression": {
"locked": {
"lastModified": 1643052045,
"narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "github"
}
},
"nixpkgs-regression_2": {
"locked": {
"lastModified": 1643052045,
"narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "github"
}
},
"nixpkgs-regression_3": {
"locked": {
"lastModified": 1643052045,
"narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1720386169,
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1692808169,
"narHash": "sha256-x9Opq06rIiwdwGeK2Ykj69dNc2IvUH1fY55Wm7atwrE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9201b5ff357e781bf014d0330d18555695df7ba8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1717432640,
"narHash": "sha256-+f9c4/ZX5MWDOuB1rKoWj+lBNm0z0rs4CK47HBLxy1o=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "88269ab3044128b7c2f4c7d68448b2fb50456870",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "release-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1716977621,
"narHash": "sha256-Q1UQzYcMJH4RscmpTkjlgqQDX5yi1tZL0O345Ri6vXQ=",
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "4267e705586473d3e5c8d50299e71503f16a6fb6",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "rolling",
"repo": "devenv-nixpkgs",
"type": "github"
}
},
"nixpkgs_5": {
"locked": {
"lastModified": 1728018373,
"narHash": "sha256-NOiTvBbRLIOe5F6RbHaAh6++BNjsb149fGZd1T4+KBg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bc947f541ae55e999ffdb4013441347d83b00feb",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nvidia-patch": {
"inputs": {
"nixpkgs": [
@ -73,11 +663,11 @@
"utils": "utils"
},
"locked": {
"lastModified": 1726045740,
"narHash": "sha256-JvPkJqh0ts3Pe94M2K2M/wqFvME/2mJu5PJw6wZENRU=",
"lastModified": 1730379167,
"narHash": "sha256-Nn6SuIg/cM0lh44wtK33jMDuHlR8P3sqyYesFi4mZ/k=",
"owner": "icewind1991",
"repo": "nvidia-patch-nixos",
"rev": "c329eaedabff3457a8cde74743c12b2bd87ceb14",
"rev": "f9a0039c9974b09673f98f16fc2da31d3d1ff384",
"type": "github"
},
"original": {
@ -86,13 +676,111 @@
"type": "github"
}
},
"poetry2nix": {
"inputs": {
"flake-utils": "flake-utils",
"nix-github-actions": "nix-github-actions",
"nixpkgs": [
"teslamate-flake",
"devenv",
"cachix",
"devenv",
"cachix",
"devenv",
"nixpkgs"
]
},
"locked": {
"lastModified": 1692876271,
"narHash": "sha256-IXfZEkI0Mal5y1jr6IRWMqK8GW2/f28xJenZIPQqkY0=",
"owner": "nix-community",
"repo": "poetry2nix",
"rev": "d5006be9c2c2417dafb2e2e5034d83fabd207ee3",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "poetry2nix",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": [
"teslamate-flake",
"devenv",
"nix"
],
"flake-utils": "flake-utils_2",
"gitignore": [
"teslamate-flake",
"devenv",
"nix"
],
"nixpkgs": [
"teslamate-flake",
"devenv",
"nix",
"nixpkgs"
],
"nixpkgs-stable": [
"teslamate-flake",
"devenv",
"nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1712897695,
"narHash": "sha256-nMirxrGteNAl9sWiOhoN5tIHyjBbVi5e2tgZUgZlK3Y=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "40e6053ecb65fcbf12863338a6dcefb3f55f1bf8",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"pre-commit-hooks_2": {
"inputs": {
"flake-compat": [
"teslamate-flake",
"devenv",
"flake-compat"
],
"gitignore": "gitignore",
"nixpkgs": [
"teslamate-flake",
"devenv",
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1726745158,
"narHash": "sha256-D5AegvGoEjt4rkKedmxlSEmC+nNLMBPWFxvmYnVLhjk=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "4e743a6920eab45e8ba0fbe49dc459f1423a4b74",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"local-unstable": "local-unstable",
"nixos-unstable": "nixos-unstable",
"nixpkgs": "nixpkgs",
"nvidia-patch": "nvidia-patch"
"nvidia-patch": "nvidia-patch",
"teslamate-flake": "teslamate-flake"
}
},
"systems": {
@ -110,6 +798,65 @@
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"teslamate-flake": {
"inputs": {
"devenv": "devenv",
"devenv-root": "devenv-root",
"flake-parts": "flake-parts_2",
"nixpkgs": "nixpkgs_5",
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1730224889,
"narHash": "sha256-Bw5pAXZPYgWMJRUeDINVRWDbVi4k5Gx0Wu6zsC0lXGg=",
"owner": "teslamate-org",
"repo": "teslamate",
"rev": "83f9de26a04c65f51dd78c1e3700e81c88ed635b",
"type": "github"
},
"original": {
"owner": "teslamate-org",
"ref": "v1.31.1",
"repo": "teslamate",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"teslamate-flake",
"nixpkgs"
]
},
"locked": {
"lastModified": 1729242555,
"narHash": "sha256-6jWSWxv2crIXmYSEb3LEVsFkCkyVHNllk61X4uhqfCs=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "d986489c1c757f6921a48c1439f19bfb9b8ecab5",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"

View File

@ -3,6 +3,7 @@
nixpkgs.url = "github:NixOS/nixpkgs/release-24.05";
nixos-unstable.url = "github:NixOS/nixpkgs/master";
local-unstable.url = "path:///home/giulio/dev/nixpkgs";
teslamate-flake.url = "github:teslamate-org/teslamate/v1.31.1";
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
@ -13,7 +14,7 @@
};
};
outputs = { self, nixpkgs, nixos-unstable, local-unstable, home-manager, nvidia-patch }:
outputs = { self, nixpkgs, nixos-unstable, local-unstable, home-manager, teslamate-flake, nvidia-patch }:
let
sysLinuxX64 = "x86_64-linux";
sysDarwin = "aarch64-darwin";
@ -44,13 +45,19 @@
overlays = extOverlays;
};
teslamatePkgs = import teslamate-flake {
inherit system config;
overlays = extOverlays;
};
overlays = [
(final: prev: { inherit unstablePkgs; })
(final: prev: { inherit localPkgs; })
(final: prev: { inherit teslamatePkgs; })
] ++ extOverlays;
};
wrapUtils = { pkgs, system }:
wrapUtils = { pkgs }:
let
inherit (pkgs.lib) makeScope;
inherit (pkgs) newScope;
@ -66,13 +73,13 @@
pkgsLinuxX64Cuda = wrapPkgsSystem { system = sysLinuxX64; };
utilsLinuxX64Cuda = wrapUtils { system = sysLinuxX64; pkgs = pkgsLinuxX64Cuda; };
utilsLinuxX64Cuda = wrapUtils { pkgs = pkgsLinuxX64Cuda; };
pkgsLinuxAarch = wrapPkgsSystem { system = sysLinuxAarch; };
utilsLinuxAarch = wrapUtils { system = sysLinuxAarch; pkgs = pkgsLinuxAarch; };
utilsLinuxAarch = wrapUtils { pkgs = pkgsLinuxAarch; };
pkgsDarwin = wrapPkgsSystem { system = sysDarwin; };
utilsDarwin = wrapUtils { system = sysDarwin; pkgs = pkgsDarwin; };
utilsDarwin = wrapUtils { pkgs = pkgsDarwin; };
in
{
nixosConfigurations = {
@ -82,6 +89,9 @@
user = "giulio";
roles = [ ];
}];
imports = [
teslamate-flake.nixosModules.default
];
};
};

View File

@ -47,6 +47,8 @@ in
# ./photoprism.nix
./sunshine.nix
./jellyseer.nix
./teslamate.nix
./postgres.nix
];
architect = {

View File

@ -1,43 +1,51 @@
{ config, lib, ... }:
let
# Function to generate CoreDNS config for a single vhost
generateCoreDNSConfigForVhost = domain: conf:
let
# Retrieve architect's IP on each interface
interfaceConfigs = builtins.map
(iface:
let
architectIP = config.architect.networks.${iface}.devices.architect.address;
interfaceNet = config.architect.networks.${iface}.net;
in
''
${domain} {
view ${iface} {
expr incidr(client_ip(), '${interfaceNet}')
}
with lib;
template IN A ${domain} {
answer "${domain}. 60 IN A ${architectIP}"
let
generateCoreDNSConfig = domains:
let
generateForDomain = domain: conf:
concatMapStrings
(iface:
let
architectIP = config.architect.networks.${iface}.devices.architect.address;
interfaceNet = config.architect.networks.${iface}.net;
in
''
${domain} {
view ${iface} {
expr incidr(client_ip(), '${interfaceNet}')
}
template IN A ${domain} {
answer "${domain}. 60 IN A ${architectIP}"
}
template IN HTTPS ${domain} {
answer "${domain}. 60 IN HTTPS 1 . ipv4hint=\"${architectIP}\""
}
cache
log
}
template IN HTTPS ${domain} {
answer "${domain}. 60 IN HTTPS 1 . ipv4hint=\"${architectIP}\""
}
cache
log
}
''
)
conf.dnsInterfaces;
''
)
conf.dnsInterfaces;
in
lib.concatStringsSep "\n" interfaceConfigs;
concatStrings (mapAttrsToList generateForDomain domains);
# Combine vhosts and the single domain
allDomains = config.architect.vhost // {
"architect.devs.giugl.io" = { dnsInterfaces = [ "lan" "tailscale" ]; };
};
in
{
services = {
coredns = {
enable = true;
config = ''
${lib.concatStringsSep "\n" (lib.mapAttrsToList generateCoreDNSConfigForVhost config.architect.vhost)}
${generateCoreDNSConfig allDomains}
. {
cache

View File

@ -6,6 +6,8 @@
net = "172.17.0.0/16";
};
hardware.nvidia-container-toolkit.enable = true;
virtualisation = {
oci-containers.backend = "docker";
@ -16,8 +18,8 @@
'';
enableOnBoot = false;
daemon.settings.iptables = false;
enableNvidia = true;
};
};
users.users.giulio.extraGroups = [ "docker" ];
}

View File

@ -1,9 +1,8 @@
{ config, pkgs, ... }:
let
baseDomain = "giugl.io";
domain = "vipienne.${baseDomain}";
headscalePkg = pkgs.unstablePkgs.headscale;
domain = "vipienne.giugl.io";
headscalePkg = pkgs.headscale;
in
{
environment.systemPackages = [ headscalePkg ];
@ -33,7 +32,7 @@ in
log.level = "debug";
dns_config = {
magic_dns = false;
base_domain = baseDomain;
base_domain = domain;
override_local_dns = true;
nameservers = [
config.architect.networks.tailscale.devices.architect.address

View File

@ -20,34 +20,35 @@ in
acceleration = "cuda";
package = ollamaPkg;
environmentVariables = {
OLLAMA_ORIGINS = "*";
# OLLAMA_ORIGINS = "10.0.0.0/24";
OLLAMA_FLASH_ATTENTION = "1";
OLLAMA_NUM_PARALLEL = "2";
};
};
architect.vhost.${frontendDomain} = {
dnsInterfaces = [ "tailscale" ];
# architect.vhost.${frontendDomain} = {
# dnsInterfaces = [ "tailscale" "lan" ];
locations."/" = {
host = "127.0.0.1";
port = frontendPort;
allowLan = true;
allowWAN = true;
extraConfig = ''
proxy_read_timeout 600s;
'';
};
};
# locations."/" = {
# host = "127.0.0.1";
# port = frontendPort;
# allowLan = true;
# allowWAN = true;
# extraConfig = ''
# proxy_read_timeout 600s;
# '';
# };
# };
architect.vhost.${backendDomain} = {
dnsInterfaces = [ "tailscale" ];
dnsInterfaces = [ "tailscale" "lan" ];
locations."/" = {
host = "127.0.0.1";
port = 11434;
port = ollamaPort;
allowLan = true;
allowWAN = true;
recommendedProxySettings = false;
extraConfig = ''
proxy_buffering off;
proxy_read_timeout 600s;
@ -56,27 +57,27 @@ in
};
};
virtualisation.oci-containers = {
containers = {
ollama-webui = {
image = "ghcr.io/open-webui/open-webui:main";
autoStart = true;
# virtualisation.oci-containers = {
# containers = {
# ollama-webui = {
# image = "ghcr.io/open-webui/open-webui:main";
# autoStart = true;
ports = [
"127.0.0.1:${toString frontendPort}:8080"
];
# ports = [
# "127.0.0.1:${toString frontendPort}:8080"
# ];
environment = {
OLLAMA_BASE_URL = "https://${backendDomain}";
};
# environment = {
# OLLAMA_BASE_URL = "https://${backendDomain}";
# };
extraOptions = [
"--pull=always"
];
volumes = [
"/var/lib/ollama-webui:/app/backend/data"
];
};
};
};
# extraOptions = [
# "--pull=always"
# ];
# volumes = [
# "/var/lib/ollama-webui:/app/backend/data"
# ];
# };
# };
# };
}

View File

@ -38,15 +38,6 @@ in
};
};
postgresql = {
enable = true;
package = pkgs.postgresql;
# ensureUsers = [{
# name = db_name;
# ensurePermissions = { "DATABASE \"${db_name}\"" = "ALL PRIVILEGES"; };
# }];
};
nginx.virtualHosts = {
# server
${domain} = {

View File

@ -47,7 +47,7 @@ in
enable = true;
hostName = domain;
https = true;
package = pkgs.nextcloud29;
package = pkgs.nextcloud30;
datadir = "/services/nextcloud";
configureRedis = true;
caching = {

View File

@ -10,7 +10,7 @@
package = pkgs.nginx;
recommendedGzipSettings = true;
recommendedOptimisation = true;
# recommendedProxySettings = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts."architect.devs.giugl.io" = {

View File

@ -101,6 +101,12 @@ with lib;
default = "";
};
recommendedProxySettings = mkOption {
type = types.bool;
default = true;
description = "Force the use of recommended proxy configuration.";
};
allowWAN = mkOption {
type = types.bool;
default = false;
@ -128,6 +134,7 @@ with lib;
(path: location: {
proxyPass = "http://${location.host}:${toString location.port}${location.path}";
proxyWebsockets = location.proxyWebsockets;
recommendedProxySettings = location.recommendedProxySettings;
extraConfig = ''
${concatMapStringsSep "\n" (allowCIDR: "allow ${allowCIDR};") location.allow}
${optionalString location.allowLan ''allow ${config.architect.networks."lan".net};''}

View File

@ -0,0 +1,8 @@
{ pkgs, lib, ... }:
{
services.postgresql = {
enable = true;
package = lib.mkForce pkgs.postgresql;
};
}

View File

@ -15,6 +15,7 @@ in
locations."/" = {
port = 9696;
allowLan = true;
proxyWebsockets=true;
allow = [
tailscale.net

View File

@ -30,49 +30,15 @@ let
executable = true;
destination = "/bin/resolution.sh";
};
configFile = pkgs.writeText "sunshine.conf"
''
capture=nvfbc
encoder=nvenc
wan_encryption_mode = 0
lan_encryption_mode = 0
origin_web_ui_allowed=lan
channels=2
min_threads=12
global_prep_cmd=[{"do":"${pkgs.bash}/bin/bash -c \"${resolutionScript}/bin/resolution.sh ''${SUNSHINE_CLIENT_WIDTH} ''${SUNSHINE_CLIENT_HEIGHT} ''${SUNSHINE_CLIENT_FPS}\""}]
'';
sunshinePkg = (pkgs.unstablePkgs.sunshine.override { cudaSupport = true; });
sunshinePkg = (pkgs.localPkgs.sunshine.override { cudaSupport = true; cudaPackages = pkgs.cudaPackages; boost = pkgs.unstablePkgs.boost186; });
in
{
boot.kernelModules = [ "uinput" ];
environment = {
systemPackages = with pkgs; [
sunshinePkg
xorg.xrandr
xorg.xorgserver
xorg.libxcvt
gamemode
];
variables = {
VDPAU_DRIVER = "nvidia";
LIBVA_DRIVER_NAME = "nvidia";
NVD_BACKEND = "direct";
__GL_SYNC_TO_VBLANK = "0";
__GL_VRR_ALLOWED = "0";
DXVK_ASYNC = "1";
};
};
environment.systemPackages = [ pkgs.unstablePkgs.gamemode ];
hardware = {
pulseaudio.enable = true;
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
nvidia = {
modesetting.enable = true;
@ -83,7 +49,10 @@ in
};
};
programs.steam.enable = true;
programs.steam = {
enable = true;
gamescopeSession.enable = true;
};
security = {
polkit.extraConfig = ''
@ -100,15 +69,50 @@ in
rtkit.enable = true;
};
services = {
avahi = {
enable = true;
publish.userServices = true;
systemd.user.services.sunshine = {
serviceConfig = {
Restart = pkgs.lib.mkForce "always";
};
};
udev.extraRules = ''
KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"
'';
services = {
sunshine = {
enable = true;
autoStart = true;
package = sunshinePkg;
settings = {
sunshine_name = "The Architect";
capture = "nvfbc";
encoder = "nvenc";
wan_encryption_mode = 0;
lan_encryption_mode = 0;
origin_web_ui_allowed = "lan";
min_threads = 12;
log_path = "sunshine.log";
};
applications = {
env = {
VDPAU_DRIVER = "nvidia";
LIBVA_DRIVER_NAME = "nvidia";
NVD_BACKEND = "direct";
__GL_SYNC_TO_VBLANK = "0";
__GL_VRR_ALLOWED = "0";
DXVK_ASYNC = "1";
};
apps = [
{
name = "Steam";
cmd = ''${pkgs.bash}/bin/bash -c "${pkgs.gamescope}/bin/gamescope -f --hdr-enabled -e -W ''${SUNSHINE_CLIENT_WIDTH} -H ''${SUNSHINE_CLIENT_HEIGHT} -r ''${SUNSHINE_CLIENT_FPS} -- ${pkgs.steam}/bin/steam"'';
prep-cmd = [
{
do = ''${pkgs.bash}/bin/bash -c "${resolutionScript}/bin/resolution.sh ''${SUNSHINE_CLIENT_WIDTH} ''${SUNSHINE_CLIENT_HEIGHT}" ''${SUNSHINE_CLIENT_FPS}"'';
undo = ''${pkgs.bash}/bin/bash -c "${pkgs.procps}/bin/pkill gamescope; ${pkgs.procps}/bin/pkill sunshine"'';
}
];
}
];
};
};
displayManager = {
sddm = {
@ -201,29 +205,11 @@ in
sound.enable = true;
systemd = {
targets = {
sleep.enable = false;
suspend.enable = false;
hibernate.enable = false;
hybrid-sleep.enable = false;
};
user.services.${user} = {
description = "Sunshine server";
wantedBy = [ "graphical-session.target" ];
startLimitIntervalSec = 500;
startLimitBurst = 5;
partOf = [ "graphical-session.target" ];
wants = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
path = with pkgs; [ resolutionScript gamemode ];
serviceConfig = {
ExecStart = "${sunshinePkg}/bin/sunshine ${configFile}";
Restart = "on-failure";
RestartSec = "5s";
};
};
systemd.targets = {
sleep.enable = false;
suspend.enable = false;
hibernate.enable = false;
hybrid-sleep.enable = false;
};
users = {

View File

@ -0,0 +1,51 @@
{ config, pkgs, ... }:
let
domain = "tesla.giugl.io";
teslamatePort = 11234;
grafanaPort = 11334;
allowLan = true;
allowWAN = false;
in
{
architect.vhost.${domain} = with config.architect.networks; {
dnsInterfaces = [ "lan" "tailscale" ];
locations = {
"/" = {
inherit allowLan allowWAN;
port = teslamatePort;
proxyWebsockets = true;
allow = [
tailscale.net
];
};
"/live/websocket" = {
inherit allowLan allowWAN;
port = teslamatePort;
proxyWebsockets = true;
allow = [
tailscale.net
];
};
"/grafana" = {
inherit allowLan allowWAN;
port = grafanaPort;
proxyWebsockets = true;
allow = [
tailscale.net
];
};
};
};
services.teslamate = {
enable = true;
port = teslamatePort;
listenAddress = "127.0.0.1";
secretsFile = "/secrets/teslamate/teslamate.env";
virtualHost = domain;
postgres.enable_server = true;
grafana = { enable = true; port = grafanaPort; listenAddress = "127.0.0.1"; urlPath = "/grafana"; };
};
}

View File

@ -1,212 +1,7 @@
{ pkgs, ... }:
let
lib = pkgs.lib;
configDir = "$HOME/.config/aichat";
config = ''
clients:
- type: ollama
api_base: https://ollama.giugl.io
models:
- name: mistral:7b-instruct-v0.3-fp16
max_input_tokens: 32000
max_output_tokens: 8192
- name: llama3:8b-instruct-fp16
max_input_tokens: 8192
max_output_tokens: 8192
- name: phi3:14b-medium-4k-instruct-q8_0
max_input_tokens: 128000
max_output_tokens: 8192
- name: pino-coder
max_input_tokens: 8192
max_output_tokens: 8192
- type: openai
api_key: null
api_base: https://api.openai.com/v1
'';
roles = ''
- name: commitmessage
prompt: |-
Your task is to generate a commit message for a given git diff. The commit message should follow the Conventional Commits specification, which includes a type, optional scope, and a brief description. The message should be concise, unambiguous, and capture the technical details of the changes made.
Commit Convention Format:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
Common types include:
- feat: A new feature
- fix: A bug fix
- docs: Documentation changes
- style: Code style/formatting changes (not affecting code logic)
- refactor: Code changes that neither fix a bug nor add a feature
- test: Adding or modifying tests
- chore: Changes to build process or auxiliary tools
- perf: Performance improvements
Here are some examples of well-formatted commit messages:
### INPUT :
diff --git a/src/utils/date-formatter.js b/src/utils/date-formatter.js
index 2345678..3456789 100644
--- a/src/utils/date-formatter.js
+++ b/src/utils/date-formatter.js
@@ -5,7 +5,7 @@ export function formatDate(date) {
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
- return `$${year}-$${month}-$${day}`;
+ return `$${year}/$${month}/$${day}`;
}
### OUTPUT:
fix(date-formatter): modified `formatDate()` to use '/' instead of '-' as the separator
### INPUT:
diff --git a/src/app.js b/src/app.js
index 83d2e7a..b6a1c3f 100644
--- a/src/app.js
+++ b/src/app.js
@@ -10,6 +10,10 @@ function initialize() {
setupEventListeners();
}
+// TODO: add other listeners
+// https://github.com/user/project/issue/123
+function setupEventListeners() {
+ document.getElementById('submit').addEventListener('click', handleSubmit);
+ document.getElementById('reset').addEventListener('click', handleReset);
+}
+
function handleSubmit(event) {
event.preventDefault();
const data = new FormData(event.target);
@@ -20,6 +24,10 @@ function handleSubmit(event) {
console.log('Form submitted:', data);
}
+function handleReset(event) {
+ event.preventDefault();
+ event.target.form.reset();
+ console.log('Form reset');
}
### OUTPUT:
feat(app): implement form event listeners
- Added `setupEventListeners()` to handle form interactions
- Implemented `handleReset()` for form reset functionality
- Added event listeners for submit and reset buttons
- Track TODO comment for future listener additions (https://github.com/user/project/issue/123)
### INPUT:
diff --git a/pkg/database/client.go b/pkg/database/client.go
index 003740f..6fc4861 100644
--- a/pkg/database/client.go
+++ b/pkg/database/client.go
@@ -24,9 +24,12 @@ var ErrNilDatabaseClient = errors.New("database client is nil after setup")
// InitDB initializes the database with the given application name and optional dbpath for SQLite.
func InitDB(appName string, dbpath ...string) error {
- cfg := config.New()
+ var (
+ psqlReadReplica string
+ err error
+ )
- var err error
+ cfg := config.New()
// Set up a new logger with your required configuration.
newLogger := logger.New(
@@ -38,9 +41,8 @@ func InitDB(appName string, dbpath ...string) error {
},
)
- // Load PostgreSQL configurations
- var psqlReadReplica string
psqlSource, err := cfg.Load(config.PSQL.String())
+
if err != nil {
log.Println("PSQL not set, using SQLite instead.")
} else {
### OUTPUT:
style(database/client): group together `psqlReadReplica` and `err` in function's prologue
### INPUT:
diff --git a/pkg/khttp/client.go b/pkg/khttp/client.go
index a53064c..3aff938 100644
--- a/pkg/khttp/client.go
+++ b/pkg/khttp/client.go
@@ -11,14 +11,17 @@ import (
"github.pie.apple.com/kerosene/Core/structs"
)
+// TODO: https://github.pie.apple.com/Kerosene/Core/issues/43
+// feat: Centralise and remove over use of os.Environment
const (
- // Environment variables and file names.
authFilesDirEnvVar = "WHISPER_AUTH_FILES_DIR"
keyName = "decrypted_key.pem"
certName = "cert.pem"
)
// Error for missing environment variable.
+// TODO: refactor: move errors into centralized errors.go files
+// https://github.pie.apple.com/Kerosene/Core/issues/57
var errMissingEnvironmentVariable = fmt.Errorf("%s environment variable is not set", authFilesDirEnvVar)
// AuthConfig holds authentication file paths.
@@ -31,9 +34,11 @@ type AuthConfig struct {
// NewAuthConfig creates an AuthConfig from environment variables.
func NewAuthConfig() (*AuthConfig, error) {
dir := os.Getenv(authFilesDirEnvVar)
+
if dir == "" {
return nil, errMissingEnvironmentVariable
}
+
return &AuthConfig{
Dir: dir,
CertFile: filepath.Join(dir, certName),
@@ -211,7 +216,7 @@ func setupMTLSOnlyTransport(certData string, keyData string) (*http.Transport, e
// Make scheme and Auth Type separate and load from DB.
func parseProxyURL(scheme string, routing structs.Routing) (*url.URL, error) {
- return url.Parse(fmt.Sprintf("%s://%s:%s", scheme, routing.Proxy, routing.Port))
+ return url.Parse(fmt.Sprintf("%s://%s:%d", scheme, routing.Proxy, routing.Port))
}
// loadX509KeyPair loads an X509 key pair from the specified cert and key files.
### OUTPUT:
fix/refactor(khttp/client): use correct format specifier for and add TODOs
- Parsed proxy URL using `fmt.Sprintf()` with correct format specifier for port
- Added TODOs to centralize errors and remove overuse of `os.Environment` (#43, #57)
- name: createpr
prompt: |-
Create a concise and informative PR message for a given code diff using the Conventional Commits format.
Include all significant changes, such as new environment variables, refactored functions, and added or removed TODOs.
Mention specific issue numbers for better trackability.
'';
in
{
home = {
@ -214,7 +9,9 @@ in
AICHAT_CONFIG_DIR = configDir;
};
packages = [ pkgs.unstablePkgs.aichat ];
file.".config/aichat/config.yaml".text = config;
file.".config/aichat/roles.yaml".text = roles;
file.".config/aichat/config.yaml".text = lib.readFile ./aichat/config.yaml;
file.".config/aichat/roles/commitmessage.md".text = lib.readFile ./aichat/roles/commitmessage.md;
file.".config/aichat/roles/createpr.md".text = lib.readFile ./aichat/roles/createpr.md;
};
}

View File

@ -0,0 +1,12 @@
clients:
- type: openai-compatible
name: ollama
api_base: https://ollama.giugl.io/v1
models:
- name: pino
max_input_tokens: 8192
max_output_tokens: 16000
- name: pino-coder
max_input_tokens: 8192
max_output_tokens: 16000

View File

@ -0,0 +1,175 @@
---
model: ollama:pino-coder
temperature: 0
---
Your task is to generate a commit message for a given git diff. The commit message should follow the Conventional Commits specification, which includes a type, optional scope, and a brief description. The message should be concise, unambiguous, and capture the technical details of the changes made.
Commit Convention Format:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
Common types include:
- feat: A new feature
- fix: A bug fix
- docs: Documentation changes
- style: Code style/formatting changes (not affecting code logic)
- refactor: Code changes that neither fix a bug nor add a feature
- test: Adding or modifying tests
- chore: Changes to build process or auxiliary tools
- perf: Performance improvements
Here are some examples of well-formatted commit messages:
### INPUT:
diff --git a/src/utils/date-formatter.js b/src/utils/date-formatter.js
index 2345678..3456789 100644
--- a/src/utils/date-formatter.js
+++ b/src/utils/date-formatter.js
@@ -5,7 +5,7 @@ export function formatDate(date) {
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
- return `$${year}-$${month}-$${day}`;
+ return `$${year}/$${month}/$${day}`;
}
### OUTPUT:
fix(date-formatter): modified `formatDate()` to use '/' instead of '-' as the separator
### INPUT:
diff --git a/src/app.js b/src/app.js
index 83d2e7a..b6a1c3f 100644
--- a/src/app.js
+++ b/src/app.js
@@ -10,6 +10,10 @@ function initialize() {
setupEventListeners();
}
+// TODO: add other listeners
+// https://github.com/user/project/issue/123
+function setupEventListeners() {
+ document.getElementById('submit').addEventListener('click', handleSubmit);
+ document.getElementById('reset').addEventListener('click', handleReset);
+}
+
function handleSubmit(event) {
event.preventDefault();
const data = new FormData(event.target);
@@ -20,6 +24,10 @@ function handleSubmit(event) {
console.log('Form submitted:', data);
}
+function handleReset(event) {
+ event.preventDefault();
+ event.target.form.reset();
+ console.log('Form reset');
}
### OUTPUT:
feat(app): implement form event listeners
- Added `setupEventListeners()` to handle form interactions
- Implemented `handleReset()` for form reset functionality
- Added event listeners for submit and reset buttons
- Track TODO comment for future listener additions (https://github.com/user/project/issue/123)
### INPUT:
diff --git a/pkg/database/client.go b/pkg/database/client.go
index 003740f..6fc4861 100644
--- a/pkg/database/client.go
+++ b/pkg/database/client.go
@@ -24,9 +24,12 @@ var ErrNilDatabaseClient = errors.New("database client is nil after setup")
// InitDB initializes the database with the given application name and optional dbpath for SQLite.
func InitDB(appName string, dbpath ...string) error {
- cfg := config.New()
+ var (
+ psqlReadReplica string
+ err error
+ )
- var err error
+ cfg := config.New()
// Set up a new logger with your required configuration.
newLogger := logger.New(
@@ -38,9 +41,8 @@ func InitDB(appName string, dbpath ...string) error {
},
)
- // Load PostgreSQL configurations
- var psqlReadReplica string
psqlSource, err := cfg.Load(config.PSQL.String())
+
if err != nil {
log.Println("PSQL not set, using SQLite instead.")
} else {
### OUTPUT:
style(database/client): group together `psqlReadReplica` and `err` in function's prologue
### INPUT:
diff --git a/pkg/khttp/client.go b/pkg/khttp/client.go
index a53064c..3aff938 100644
--- a/pkg/khttp/client.go
+++ b/pkg/khttp/client.go
@@ -11,14 +11,17 @@ import (
"github.pie.apple.com/kerosene/Core/structs"
)
+// TODO: https://github.pie.apple.com/Kerosene/Core/issues/43
+// feat: Centralise and remove over use of os.Environment
const (
- // Environment variables and file names.
authFilesDirEnvVar = "WHISPER_AUTH_FILES_DIR"
keyName = "decrypted_key.pem"
certName = "cert.pem"
)
// Error for missing environment variable.
+// TODO: refactor: move errors into centralized errors.go files
+// https://github.pie.apple.com/Kerosene/Core/issues/57
var errMissingEnvironmentVariable = fmt.Errorf("%s environment variable is not set", authFilesDirEnvVar)
// AuthConfig holds authentication file paths.
@@ -31,9 +34,11 @@ type AuthConfig struct {
// NewAuthConfig creates an AuthConfig from environment variables.
func NewAuthConfig() (*AuthConfig, error) {
dir := os.Getenv(authFilesDirEnvVar)
+
if dir == "" {
return nil, errMissingEnvironmentVariable
}
+
return &AuthConfig{
Dir: dir,
CertFile: filepath.Join(dir, certName),
@@ -211,7 +216,7 @@ func setupMTLSOnlyTransport(certData string, keyData string) (*http.Transport, e
// Make scheme and Auth Type separate and load from DB.
func parseProxyURL(scheme string, routing structs.Routing) (*url.URL, error) {
- return url.Parse(fmt.Sprintf("%s://%s:%s", scheme, routing.Proxy, routing.Port))
+ return url.Parse(fmt.Sprintf("%s://%s:%d", scheme, routing.Proxy, routing.Port))
}
// loadX509KeyPair loads an X509 key pair from the specified cert and key files.
### OUTPUT:
fix/refactor(khttp/client): use correct format specifier for and add TODOs
- Parsed proxy URL using `fmt.Sprintf()` with correct format specifier for port
- Added TODOs to centralize errors and remove overuse of `os.Environment` (#43, #57)

View File

@ -0,0 +1,8 @@
---
model: ollama:pino-coder
temperature: 0
---
Create a concise and informative PR message for a given code diff using the Conventional Commits format.
Include all significant changes, such as new environment variables, refactored functions, and added or removed TODOs.
Mention specific issue numbers for better trackability.

View File

@ -1,4 +1,4 @@
{ config, pkgs, lib, ... }: {
{ pkgs, ... }: {
programs.git = {
enable = true;
userName = "Giulio De Pasquale";
@ -12,6 +12,10 @@
};
};
delta.enable = true;
lfs.enable = true;
aliases = {
ai = ''! cd -- "''${GIT_PREFIX:-.}" && git diff HEAD -- "$@" | aichat -m ollama:pino-coder -r commitmessage #'';
};
};
home.packages = [ pkgs.git-lfs ];
}

View File

@ -2,6 +2,7 @@
let
actualPkgs = pkgs.unstablePkgs;
lib = actualPkgs.lib;
nodePkgs = with actualPkgs.nodePackages; [
vscode-langservers-extracted
@ -48,63 +49,8 @@ in
};
file = {
".config/helix/config.toml".text = ''
theme = "monokai_pro_spectrum"
[editor]
cursorline = true
true-color = true
gutters = ["diff", "diagnostics", "line-numbers", "spacer"]
[editor.cursor-shape]
insert = "bar"
normal = "block"
select = "underline"
[editor.lsp]
display-messages = true
[editor.indent-guides]
render = true
[editor.statusline]
left = ["mode", "spinner"]
center = ["file-name"]
'';
".config/helix/languages.toml".text = ''
[[language]]
name = "nix"
formatter = { command = "nixpkgs-fmt" }
language-servers = ["nixd"]
[language-server.nixd]
command = "nixd"
[language-server.pylsp.config.pylsp.plugins]
ruff = {enabled = true}
rope = {enabled = true}
mypy = {enabled = true}
rope_autoimport = {enabled = true}
[[language]]
name = "bash"
formatter = { command = "shfmt", args = ["-s", "-ci", "-sr"] }
[[language]]
name = "python"
formatter = { command = "black", args = ["-", "--quiet"] }
[[language]]
name = "go"
language-servers = ["gopls", "golangci-lint-langserver"]
[language-server.golangci-lint-langserver]
command = "golangci-lint-langserver"
[language-server.golangci-lint-langserver.config]
command = ["golangci-lint", "run", "--out-format", "json", "--issues-exit-code=1"]
'';
".config/helix/config.toml".text = lib.readFile ./helix/config.toml;
".config/helix/languages.toml".text = lib.readFile ./helix/languages.toml;
};
};
}

View File

@ -0,0 +1,21 @@
theme = "monokai_pro_spectrum"
[editor]
cursorline = true
true-color = true
gutters = ["diff", "diagnostics", "line-numbers", "spacer"]
[editor.cursor-shape]
insert = "bar"
normal = "block"
select = "underline"
[editor.lsp]
display-messages = true
[editor.indent-guides]
render = true
[editor.statusline]
left = ["mode", "spinner"]
center = ["file-name"]

View File

@ -0,0 +1,26 @@
[[language]]
name = "nix"
formatter = { command = "nixpkgs-fmt" }
language-servers = ["nixd"]
[language-server.nixd]
command = "nixd"
[language-server.pylsp.config.pylsp.plugins]
ruff = {enabled = true}
rope = {enabled = true}
mypy = {enabled = true}
[[language]]
name = "bash"
formatter = { command = "shfmt", args = ["-s", "-ci", "-sr"] }
[[language]]
name = "go"
language-servers = ["gopls", "golangci-lint-langserver"]
[language-server.golangci-lint-langserver]
command = "golangci-lint-langserver"
[language-server.golangci-lint-langserver.config]
command = ["golangci-lint", "run", "--out-format", "json", "--issues-exit-code=1"]

View File

@ -0,0 +1,122 @@
create_pr_from_files() {
local origin_branch="development"
local current_branch=$(git rev-parse --abbrev-ref HEAD)
local files=()
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
-b | --base)
origin_branch="$2"
shift 2
;;
*)
files+=("$1")
shift
;;
esac
done
if [ ${#files[@]} -eq 0 ]; then
echo "Usage: create_pr_from_files <file1> [<file2> ...] [-b <base-branch>]"
return 1
fi
# Checkout to the new branch and add the specified files
local commit_message=""
local new_branch="pr-$(date +%Y%m%d%H%M%S)"
git checkout -b "$new_branch"
git add "${files[@]}"
# Generate commit message using aichat
echo "Generating commit message..."
commit_message=$(git diff --staged | aichat -m ollama:pino-coder -r commitmessage)
if [ -z "$commit_message" ]; then
echo "Failed to generate commit message. Cleaning up."
git checkout -
git branch -D "$new_branch"
if $has_changes; then
echo "Restoring stashed changes..."
git stash pop
fi
git checkout "${current_branch}"
return 1
fi
# Extract title and body from the generated commit message
local commit_subject=$(echo "$commit_message" | head -n 1)
local commit_body=$(echo "$commit_message" | tail -n +2)
if ! git commit -m "$commit_subject"$'\n\n'"$commit_body"; then
echo "Committing changes failed. Cleaning up."
git checkout -
git branch -D "$new_branch"
if $has_changes; then
echo "Restoring stashed changes..."
git stash pop
fi
git checkout "${current_branch}"
return 1
fi
git push origin "$new_branch"
gh pr create --base "$origin_branch" --head "$new_branch" --title "$commit_subject" --body "$commit_body"
echo "Pull request created successfully."
git checkout "${current_branch}"
}
create_pr_from_commit() {
local commit_hash="$1"
local base_branch="${2:-development}"
if [ -z "$commit_hash" ]; then
echo "Usage: create_pr_from_commit <commit-hash> [<base-branch>]"
return 1
fi
# Check for uncommitted changes and stash them if any
local has_changes=false
if ! git diff --quiet || ! git diff --cached --quiet; then
echo "Stashing uncommitted changes..."
git stash push -u
has_changes=true
fi
# Create a new branch name based on the commit hash
local new_branch="pr-${commit_hash}"
# Checkout to the new branch and cherry-pick the commit
git checkout "$base_branch" && git checkout -b "$new_branch"
if ! git cherry-pick "$commit_hash"; then
echo "Cherry-picking failed. Cleaning up."
git checkout -
git branch -D "$new_branch"
if $has_changes; then
echo "Restoring stashed changes..."
git stash pop
fi
return 1
fi
git push origin "$new_branch"
local commit_message=$(git show -s --format=%B "$commit_hash")
local commit_subject=$(echo "$commit_message" | head -n 1)
local commit_body=$(echo "$commit_message" | tail -n +2)
gh pr create --base "$base_branch" --head "$new_branch" --title "$commit_subject" --body "$commit_body"
echo "Pull request created successfully."
if $has_changes; then
echo "Restoring stashed changes..."
git stash pop
fi
}

View File

@ -1,7 +1,7 @@
{ pkgs, lib, ... }:
{ pkgs, ... }:
let
commitFunctions = pkgs.writeTextDir "bin" (builtins.readFile ./scripts/commits.sh);
commitFunctions = pkgs.writeTextDir "bin/commits.sh" (builtins.readFile ./scripts/commits.sh);
in
{
home.packages = with pkgs; [ any-nix-shell ];