linting and formatting existing code

This commit is contained in:
Dennis Frieberg 2023-11-08 00:47:14 +01:00
parent f5b2ddaf11
commit 0d528669f1
Signed by: nerf
GPG key ID: 42DED0E2D8F04FB6
11 changed files with 202 additions and 182 deletions

View file

@ -1,20 +1,30 @@
# copied and adopted from maralorns config
# This automatically searches for nixos configs in ./machines/${name}/configuration.nix
# and exposes them as outputs.nixosConfigurations.${name}
{ withSystem, lib, inputs, ... }: {
{
withSystem,
lib,
inputs,
...
}: {
flake = {
nixosConfigurations = withSystem "x86_64-linux" ({ pkgs, ... }:
let
nixosConfigurations = withSystem "x86_64-linux" ({pkgs, ...}: let
machines = builtins.attrNames (builtins.readDir ./machines);
makeSystem = name:
makeSystem = name: let
importedConfig = import (./. + "/machines/${name}/configuration.nix");
systemConfig =
if lib.isFunction importedConfig
then x: importedConfig (x // {flake-inputs = inputs;})
else importedConfig;
in
pkgs.nixos {
imports = [
(import (./. + "/machines/${name}/configuration.nix") inputs)
systemConfig
inputs.sops-nix.nixosModules.sops
inputs.impermanence.nixosModules.impermanence
];
};
in lib.genAttrs machines makeSystem);
in
lib.genAttrs machines makeSystem);
};
}

View file

@ -1,6 +1,4 @@
flake-inputs:
{config, pkgs, lib, ... }: {
{
imports = [
./hardware-configuration.nix
../../modules/jitsi.nix

View file

@ -1,4 +1,4 @@
{config, lib, pkgs, modulesPath, ...}: {
{lib, ...}: {
imports = [];
fileSystems."/" = {
@ -22,8 +22,7 @@
options = ["subvol=nix"];
};
swapDevices =
[{ device = "/dev/disk/by-uuid/e6e3ba6b-c9f5-4960-b56d-f49760d76a4a"; }];
swapDevices = [{device = "/dev/disk/by-uuid/e6e3ba6b-c9f5-4960-b56d-f49760d76a4a";}];
nix.settings.max-jobs = lib.mkDefault 4;

View file

@ -4,12 +4,13 @@
{
imports = [];
networking = {
interfaces.enX0.ipv4.addresses = [ {
interfaces.enX0.ipv4.addresses = [
{
address = "192.168.0.25";
prefixLength = 16;
} ];
}
];
defaultGateway = "192.168.0.152";
nameservers = ["130.83.2.22" "130.83.56.60" "130.83.22.60" "130.82.22.63"];
};
}

View file

@ -1,16 +1,17 @@
{lib, config, ...} :
let
inherit (lib)
{
lib,
config,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
mkOption
types
;
cfg = config.impermanence;
in
{
in {
imports = [];
options.impermanence = {
@ -43,5 +44,4 @@ config = mkIf cfg.enable {
};
environment.etc.machine-id.source = "${cfg.storagePath}/machine-id";
};
}

View file

@ -1,14 +1,19 @@
{pkgs, config, lib, modulesPath, ...}:
let
inherit (lib)
{
config,
lib,
modulesPath,
...
}: let
inherit
(lib)
mkIf
mkEnableOption
mkOption
head;
head
;
inherit (lib.types) str;
cfg = config.services.mathebau-jitsi;
in
{
in {
imports = [(modulesPath + "/services/web-apps/jitsi-meet.nix")];
options.services.mathebau-jitsi = {
@ -23,18 +28,25 @@ in
};
config = mkIf cfg.enable {
services.jitsi-meet = {
services = {
jitsi-meet = {
enable = true;
hostName = cfg.hostName;
config = {
defaultLang = "de";
};
inherit (cfg) hostName;
};
services.jitsi-videobridge = {
jitsi-videobridge = {
openFirewall = true;
nat = {
publicAddress = "130.83.2.184";
localAddress = cfg.localAddress;
inherit (cfg) localAddress;
};
};
#We are behind a reverse proxy that handles TLS
nginx.virtualHosts."${cfg.hostName}" = {
enableACME = false;
forceSSL = false;
};
};
environment.persistence.${config.impermanence.name} = {
@ -43,12 +55,6 @@ in
"/var/lib/prosody"
];
};
#We are behind a reverse proxy that handles TLS
services.nginx.virtualHosts."${cfg.hostName}" = {
enableACME = false;
forceSSL = false;
};
#The network ports for HTTP(S) are not opened automatically
networking.firewall.allowedTCPPorts = [80 443];
};

View file

@ -1,26 +1,24 @@
{lib, ...}:
with lib;
let
with lib; let
admins = {
nerf = {
hashedPassword =
"$y$j9T$SJcjUIcs3JYuM5oyxfEQa/$tUBQT07FK4cb9xm.A6ZKVnFIPNOYMOKC6Dt6hadCuJ7";
hashedPassword = "$y$j9T$SJcjUIcs3JYuM5oyxfEQa/$tUBQT07FK4cb9xm.A6ZKVnFIPNOYMOKC6Dt6hadCuJ7";
keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEdA4LpEGUUmN8esFyrNZXFb2GiBID9/S6zzhcnofQuP nerf@nerflap2"
];
};
gonne = {
hashedPassword =
"$6$EtGpHEcFkOi0yUWp$slXf0CvIUrhdqaoCrQ5YwtYu2IVuE1RGGst4fnDPRLWVm.lYx0ruvSAF2/vw/sLbW37ORJjlb0NHQ.kSG7cVY/";
hashedPassword = "$6$EtGpHEcFkOi0yUWp$slXf0CvIUrhdqaoCrQ5YwtYu2IVuE1RGGst4fnDPRLWVm.lYx0ruvSAF2/vw/sLbW37ORJjlb0NHQ.kSG7cVY/";
keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFopCUadohY3wg9AoEup9TDRDMyEPSLsQoCnN4lsKCrr gonne@mathebau.de NixOS"
];
};
};
mkAdmin = name :
{hashedPassword, keys}: {
mkAdmin = name: {
hashedPassword,
keys,
}: {
"${name}" = {
isNormalUser = true;
createHome = true;
@ -31,7 +29,6 @@ let
inherit hashedPassword;
};
};
in {
users.users = mkMerge (mapAttrsToList mkAdmin admins);
}

View file

@ -1,5 +1,9 @@
{pkgs, config, lib, modulesPath, ...} : {
{
pkgs,
lib,
modulesPath,
...
}: {
imports = [
./admins.nix
./nix_keys.nix
@ -15,7 +19,8 @@ nix = {
};
networking = {
firewall = { # these shoud be default, but better make sure!
firewall = {
# these shoud be default, but better make sure!
enable = true;
allowPing = true;
};
@ -35,8 +40,13 @@ sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
environment = {
systemPackages = builtins.attrValues {
inherit (pkgs)
htop lsof tmux btop;
inherit
(pkgs)
htop
lsof
tmux
btop
;
};
};

View file

@ -1,5 +1,4 @@
{config, ...}:
{
{config, ...}: {
imports = [];
services.prometheus.exporters.node = {
enable = true;