fix(lint): nixfmt the whole tree

This commit is contained in:
Antoine Viallon 2026-03-22 21:56:13 +01:00
parent 643b136863
commit bf219a30c2
Signed by: aviallon
GPG key ID: 186FC35EDEB25716
69 changed files with 2605 additions and 1726 deletions

View file

@ -1,4 +1,4 @@
{ config, pkgs, ...}:
{ config, pkgs, ... }:
{
imports = [
./jupyterhub.nix

View file

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
with lib;
let
cfg = config.aviallon.services;
@ -6,23 +11,28 @@ let
laptopCfg = config.aviallon.laptop;
generalCfg = config.aviallon.general;
journaldConfigValue = value:
if value == true then "true"
else if value == false then "false"
else if isList value then toString value
else generators.mkValueStringDefault { } value;
journaldConfigValue =
value:
if value == true then
"true"
else if value == false then
"false"
else if isList value then
toString value
else
generators.mkValueStringDefault { } value;
isNullOrEmpty = v: (v == null) ||
(isList v && (length v == 0));
isNullOrEmpty = v: (v == null) || (isList v && (length v == 0));
journaldConfig = settings: (generators.toKeyValue {
mkKeyValue = generators.mkKeyValueDefault {
mkValueString = journaldConfigValue;
} "=";
} (filterAttrs (n: v: !(isNullOrEmpty v))
settings)
);
in {
journaldConfig =
settings:
(generators.toKeyValue {
mkKeyValue = generators.mkKeyValueDefault {
mkValueString = journaldConfigValue;
} "=";
} (filterAttrs (n: v: !(isNullOrEmpty v)) settings));
in
{
options.aviallon.services = {
enable = mkOption {
@ -33,9 +43,15 @@ in {
};
journald.extraConfig = mkOption {
default = {};
example = {};
type = with types; attrsOf (oneOf [ bool int str ]);
default = { };
example = { };
type =
with types;
attrsOf (oneOf [
bool
int
str
]);
description = "Add extra config to journald with Nix language";
};
};
@ -64,28 +80,29 @@ in {
scriptArgs = "%I";
wantedBy = [ "sshd@.service" ];
};
programs.ssh.setXAuthLocation = config.services.xserver.enable;
programs.ssh.forwardX11 = mkDefault config.services.xserver.enable;
security.pam.services.sudo.forwardXAuth = mkDefault true; # Easier to start GUI programs as root
environment.systemPackages = with pkgs; [ waypipe ];
# Better reliability and performance
services.dbus.implementation = "broker";
networking.firewall.allowedTCPPorts = [ 22 ];
networking.firewall.allowedUDPPorts = [ 22 5353 ];
networking.firewall.allowedUDPPorts = [
22
5353
];
services.rsyncd.enable = !desktopCfg.enable;
services.fstrim.enable = true;
services.haveged.enable = (builtins.compareVersions config.boot.kernelPackages.kernel.version "5.6" < 0);
services.haveged.enable = (
builtins.compareVersions config.boot.kernelPackages.kernel.version "5.6" < 0
);
services.irqbalance.enable = true;
@ -103,23 +120,38 @@ in {
loglevel = "info";
cgroup_realtime_workaround = false;
};
services.ananicy.extraRules = concatStringsSep "\n" ( forEach [
{ name = "cp";
type = "BG_CPUIO"; }
{ name = "nix-build";
type = "BG_CPUIO"; }
{ name = "nix-store";
type = "BG_CPUIO"; }
{ name = "nix-collect-garbage";
type = "BG_CPUIO"; }
{ name = "nix";
type = "BG_CPUIO"; }
{ name = "X";
type = "LowLatency_RT"; }
{ name = "htop";
type = "LowLatency_RT"; }
] (x: builtins.toJSON x));
services.ananicy.extraRules = concatStringsSep "\n" (
forEach [
{
name = "cp";
type = "BG_CPUIO";
}
{
name = "nix-build";
type = "BG_CPUIO";
}
{
name = "nix-store";
type = "BG_CPUIO";
}
{
name = "nix-collect-garbage";
type = "BG_CPUIO";
}
{
name = "nix";
type = "BG_CPUIO";
}
{
name = "X";
type = "LowLatency_RT";
}
{
name = "htop";
type = "LowLatency_RT";
}
] (x: builtins.toJSON x)
);
# Enusre low-latency response for this time-critical service
systemd.services."hdapsd@" = {
@ -148,9 +180,9 @@ in {
hinfo = true; # Whether to register a mDNS HINFO record which contains information about the local operating system and CPU.
};
extraConfig = mkIf config.services.resolved.enable ''
[server]
enable-dbus=warn
#disallow-other-stacks=yes
[server]
enable-dbus=warn
#disallow-other-stacks=yes
'';
};
@ -158,7 +190,6 @@ in {
MulticastDNS = false;
};
services.nginx = {
recommendedProxySettings = true;
recommendedGzipSettings = true;

View file

@ -1,17 +1,23 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
with lib;
let
gpgNoTTY = pkgs.writeShellScriptBin "gpg-no-tty" ''
exec ${pkgs.gnupg}/bin/gpg --batch --no-tty "$@"
'';
pinentrySwitcher = pkgs.callPackage ../packages/pinentry.nix {};
in {
pinentrySwitcher = pkgs.callPackage ../packages/pinentry.nix { };
in
{
config = {
programs.gnupg = {
agent.enable = true;
dirmngr.enable = true;
agent.pinentryPackage = pkgs.pinentry-all;
agent.enableSSHSupport = true;
agent.enableExtraSocket = true;
@ -29,6 +35,6 @@ in {
environment.systemPackages = [
gpgNoTTY
];
};
}

View file

@ -1,4 +1,9 @@
{config, pkgs, lib, ...}:
{
config,
pkgs,
lib,
...
}:
with lib;
let
cfg = config.aviallon.services.jupyterhub;
@ -7,12 +12,15 @@ in
options.aviallon.services.jupyterhub = {
enable = mkEnableOption "Jupyterhub server with Python 3 kernel";
};
config = mkIf cfg.enable {
services.jupyterhub = {
enable = true;
kernels.python3 = let
env = (pkgs.python3.withPackages (pythonPackages: with pythonPackages; [
kernels.python3 =
let
env = (
pkgs.python3.withPackages (
pythonPackages: with pythonPackages; [
ipykernel
pandas
scikit-learn
@ -20,20 +28,23 @@ in
matplotlib
numpy
pip
]));
in {
displayName = "Python 3 for machine learning";
argv = [
"${env.interpreter}"
"-m"
"ipykernel_launcher"
"-f"
"{connection_file}"
];
language = "python";
logo32 = "${env}/${env.sitePackages}/ipykernel/resources/logo-32x32.png";
logo64 = "${env}/${env.sitePackages}/ipykernel/resources/logo-64x64.png";
};
]
)
);
in
{
displayName = "Python 3 for machine learning";
argv = [
"${env.interpreter}"
"-m"
"ipykernel_launcher"
"-f"
"{connection_file}"
];
language = "python";
logo32 = "${env}/${env.sitePackages}/ipykernel/resources/logo-32x32.png";
logo64 = "${env}/${env.sitePackages}/ipykernel/resources/logo-64x64.png";
};
};
services.nginx = {
@ -41,7 +52,12 @@ in
};
services.nginx.virtualHosts = {
"jupyterhub.localhost" = {
listen = [ { addr = "0.0.0.0"; port = 80; } ];
listen = [
{
addr = "0.0.0.0";
port = 80;
}
];
locations."/" = {
proxyPass = "http://localhost:${toString config.services.jupyterhub.port}";
proxyWebsockets = true;