Compare commits
2 Commits
911f3589a2
...
4b3eef4150
| Author | SHA1 | Date | |
|---|---|---|---|
| 4b3eef4150 | |||
| 857f0daa95 |
26
AGENTS.md
Normal file
26
AGENTS.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# AGENTS.md
|
||||
|
||||
This document outlines the development conventions for this NixOS-based infrastructure repository.
|
||||
|
||||
## Build & Deployment
|
||||
|
||||
- **Build/Deploy:** Use `nixos-rebuild switch --flake .#<hostname>` to build and deploy the configuration for a specific host.
|
||||
- **Development Shell:** Activate the development environment with `nix develop`.
|
||||
|
||||
## Linting & Formatting
|
||||
|
||||
- **Formatting:** This project uses `nixpkgs-fmt` for automatic formatting. Ensure it is run before committing changes.
|
||||
- `nixpkgs-fmt .`
|
||||
- **Linting:** No specific linter is configured, but adhere to standard Nix language conventions.
|
||||
|
||||
## Testing
|
||||
|
||||
- No automated testing suite is configured. Manually verify changes by deploying to a non-critical host.
|
||||
|
||||
## Code Style & Conventions
|
||||
|
||||
- **Imports:** Keep module imports clean and organized at the top of files.
|
||||
- **Naming:** Follow Nix community conventions for variable and function names (e.g., `camelCase` for variables, `kebab-case` for package names).
|
||||
- **Secrets:** Secrets are managed with `agenix`. Edit encrypted files with `agenix -e <file>`.
|
||||
- **Modularity:** Structure configurations into logical, reusable modules under `modules/`. New modules should be registered in `modules/nixos/default.nix` to be available to all hosts.
|
||||
- **Error Handling:** Ensure Nix expressions are robust and handle potential evaluation errors gracefully.
|
||||
@@ -5,5 +5,6 @@
|
||||
# ./programs
|
||||
./services
|
||||
./filesystem
|
||||
./services/systemd
|
||||
];
|
||||
}
|
||||
|
||||
37
modules/nixos/services/systemd/fancontrol.nix
Normal file
37
modules/nixos/services/systemd/fancontrol.nix
Normal file
@@ -0,0 +1,37 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.systemd-fancon;
|
||||
in
|
||||
{
|
||||
options.services.systemd-fancon = {
|
||||
enable = mkEnableOption "systemd-fancon service for fan control";
|
||||
config = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = "Configuration for systemd-fancon.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
systemd-fancon
|
||||
lm_sensors
|
||||
];
|
||||
|
||||
boot.kernelModules = [ "amdgpu" ];
|
||||
|
||||
systemd.services.systemd-fancon = {
|
||||
description = "systemd-fancon service";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.systemd-fancon}/bin/systemd-fancon -c ${cfg.configFile}";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
configFile = pkgs.writeText "systemd-fancon.conf" cfg.config;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -16,8 +16,8 @@ in
|
||||
|
||||
systemd.services.network_stack = {
|
||||
description = "Traefik + DDNS updater via Docker Compose";
|
||||
after = [ "network.target" "docker.service" ];
|
||||
requires = [ "network.target" "docker.service" ];
|
||||
after = [ "network-online.target" "docker.service" ];
|
||||
wants = [ "network-online.target" "docker.service" ];
|
||||
serviceConfig = {
|
||||
WorkingDirectory = "${network_compose_dir}";
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ in
|
||||
# Stop left over container by the same name
|
||||
ExecStartPre = "${pkgs.bash}/bin/bash -c '${pkgs.docker-compose}/bin/docker-compose down || true'";
|
||||
|
||||
# Démarrer les conteneurs avec Docker Compose
|
||||
# Start the services using Docker Compose
|
||||
ExecStart = "${pkgs.docker-compose}/bin/docker-compose up -d";
|
||||
|
||||
# Arrêter et supprimer les conteneurs à l’arrêt
|
||||
# Stop and remove containers on shutdown
|
||||
ExecStop = "${pkgs.docker-compose}/bin/docker-compose down";
|
||||
|
||||
RemainAfterExit = true;
|
||||
|
||||
@@ -24,10 +24,10 @@ in
|
||||
# Stop left over container by the same name
|
||||
ExecStartPre = "${pkgs.bash}/bin/bash -c '${pkgs.docker-compose}/bin/docker-compose down || true'";
|
||||
|
||||
# Démarrer les conteneurs avec Docker Compose
|
||||
# Start the services using Docker Compose
|
||||
ExecStart = "${pkgs.docker-compose}/bin/docker-compose up -d";
|
||||
|
||||
# Arrêter et supprimer les conteneurs à l’arrêt
|
||||
# Stop and remove containers on shutdown
|
||||
ExecStop = "${pkgs.docker-compose}/bin/docker-compose down";
|
||||
|
||||
RemainAfterExit = true;
|
||||
|
||||
Reference in New Issue
Block a user