From b3d61ef94ecb51ff6feb5c48c856a39e5bd224d8 Mon Sep 17 00:00:00 2001 From: kurogeek Date: Wed, 10 Dec 2025 11:08:12 +0700 Subject: [PATCH] nix fmt --- inventories/default.nix | 2 +- machines/neptune/configuration.nix | 26 +++--- modules/clan/jukebox/default.nix | 117 +++++++++++++++----------- modules/clan/phonebox/default.nix | 5 +- modules/clan/pulse-stream/default.nix | 5 +- 5 files changed, 91 insertions(+), 64 deletions(-) diff --git a/inventories/default.nix b/inventories/default.nix index e1297ed..ab53b9a 100644 --- a/inventories/default.nix +++ b/inventories/default.nix @@ -190,7 +190,7 @@ binds = [ "wlp1s0" ]; disks.m3 = { uuid = "105D-319E"; - mountOptions = ["utf8"]; + mountOptions = [ "utf8" ]; }; }; }; diff --git a/machines/neptune/configuration.nix b/machines/neptune/configuration.nix index 6fd0346..5579956 100644 --- a/machines/neptune/configuration.nix +++ b/machines/neptune/configuration.nix @@ -30,20 +30,24 @@ ''; }; - networking.wireless = let - credentials = config.clan.core.vars.generators.wireless-credentials.files; - in { - enable = true; - secretsFile = credentials.psk.path; - networks.${credentials.essid.value}.pskRaw = "ext:psk"; - }; + networking.wireless = + let + credentials = config.clan.core.vars.generators.wireless-credentials.files; + in + { + enable = true; + secretsFile = credentials.psk.path; + networks.${credentials.essid.value}.pskRaw = "ext:psk"; + }; networking.interfaces.wlp1s0 = { useDHCP = false; - ipv4.addresses = [{ - address = "10.0.0.9"; - prefixLength = 24; - }]; + ipv4.addresses = [ + { + address = "10.0.0.9"; + prefixLength = 24; + } + ]; }; services.yggdrasil.settings.Peers = lib.mkForce [ diff --git a/modules/clan/jukebox/default.nix b/modules/clan/jukebox/default.nix index 4895bc5..7a3fe18 100644 --- a/modules/clan/jukebox/default.nix +++ b/modules/clan/jukebox/default.nix @@ -16,25 +16,32 @@ }; binds = lib.mkOption { type = with lib.types; listOf str; - default = []; + default = [ ]; }; disks = lib.mkOption { - type = with lib.types; attrsOf (submodule ({name, ... }: { - options = { - name = lib.mkOption { - type = str; - default = name; - }; - uuid = lib.mkOption { - type = str; - }; - mountOptions = lib.mkOption { - type = listOf str; - default = []; - }; - }; - })); - default = {}; + type = + with lib.types; + attrsOf ( + submodule ( + { name, ... }: + { + options = { + name = lib.mkOption { + type = str; + default = name; + }; + uuid = lib.mkOption { + type = str; + }; + mountOptions = lib.mkOption { + type = listOf str; + default = [ ]; + }; + }; + } + ) + ); + default = { }; description = "disks comprising library"; }; }; @@ -46,14 +53,19 @@ }: { nixosModule = - { config, lib, pkgs, ... }: + { + config, + lib, + pkgs, + ... + }: { services.pulseaudio.enable = true; # workaround cookie permissions services.pulseaudio.tcp.enable = true; services.pulseaudio.tcp.anonymousClients = { - allowedIpRanges = ["127.0.0.1"]; + allowedIpRanges = [ "127.0.0.1" ]; allowAll = true; }; @@ -61,33 +73,41 @@ "d ${settings.baseDir} 0755 root root" ]; - fileSystems = let - disk2fs = - { name, uuid, mountOptions, ... }: - lib.nameValuePair "${settings.baseDir}/${name}" { - device = "/dev/disk/by-uuid/${uuid}"; - fsType = "auto"; - options = ["noauto" "nofail"] ++ mountOptions; - }; - in lib.listToAttrs - (lib.mapAttrsToList (_: disk2fs) settings.disks); + fileSystems = + let + disk2fs = + { + name, + uuid, + mountOptions, + ... + }: + lib.nameValuePair "${settings.baseDir}/${name}" { + device = "/dev/disk/by-uuid/${uuid}"; + fsType = "auto"; + options = [ + "noauto" + "nofail" + ] + ++ mountOptions; + }; + in + lib.listToAttrs (lib.mapAttrsToList (_: disk2fs) settings.disks); - services.udev.extraRules = let - translate-prefix = path: - (lib.removePrefix "-" - (lib.replaceStrings ["/"] ["-"] path)); - mount-name = name: - "${translate-prefix settings.baseDir}-${name}.mount"; - disk2rule = - { name, uuid, ... }: - lib.concatStringsSep ", " [ - ''ACTION=="add"'' - ''SUBSYSTEM=="block"'' - ''ENV{DEVLINKS}=="*/dev/disk/by-uuid/${uuid}*"'' - ''ENV{SYSTEMD_WANTS}="${mount-name name}"'' - ]; - in lib.concatMapStringsSep "\n" disk2rule - (lib.attrValues settings.disks); + services.udev.extraRules = + let + translate-prefix = path: (lib.removePrefix "-" (lib.replaceStrings [ "/" ] [ "-" ] path)); + mount-name = name: "${translate-prefix settings.baseDir}-${name}.mount"; + disk2rule = + { name, uuid, ... }: + lib.concatStringsSep ", " [ + ''ACTION=="add"'' + ''SUBSYSTEM=="block"'' + ''ENV{DEVLINKS}=="*/dev/disk/by-uuid/${uuid}*"'' + ''ENV{SYSTEMD_WANTS}="${mount-name name}"'' + ]; + in + lib.concatMapStringsSep "\n" disk2rule (lib.attrValues settings.disks); services.mpd = { enable = true; @@ -102,10 +122,11 @@ ''; }; - networking.firewall.interfaces = lib.genAttrs settings.binds - (_: { allowedTCPPorts = [config.services.mpd.network.port]; }); + networking.firewall.interfaces = lib.genAttrs settings.binds (_: { + allowedTCPPorts = [ config.services.mpd.network.port ]; + }); - environment.systemPackages = [pkgs.mpc]; + environment.systemPackages = [ pkgs.mpc ]; }; }; }; diff --git a/modules/clan/phonebox/default.nix b/modules/clan/phonebox/default.nix index 88a9a53..d596d78 100644 --- a/modules/clan/phonebox/default.nix +++ b/modules/clan/phonebox/default.nix @@ -325,7 +325,10 @@ requires = [ "asterisk.service" ]; after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; - path = with pkgs; [ inotify-tools asterisk ]; + path = with pkgs; [ + inotify-tools + asterisk + ]; script = '' inotifywait -m -e move /etc/asterisk | while read path action file; do diff --git a/modules/clan/pulse-stream/default.nix b/modules/clan/pulse-stream/default.nix index 399dd64..4425f18 100644 --- a/modules/clan/pulse-stream/default.nix +++ b/modules/clan/pulse-stream/default.nix @@ -12,7 +12,7 @@ options.client-ip-ranges = lib.mkOption { type = lib.types.listOf lib.types.str; description = "ip subnets permitted to stream to the server"; - default = []; + default = [ ]; }; }; perInstance = @@ -30,8 +30,7 @@ systemWide = true; tcp = { enable = true; - anonymousClients.allowedIpRanges = - settings.client-ip-ranges; + anonymousClients.allowedIpRanges = settings.client-ip-ranges; anonymousClients.allowAll = true; }; zeroconf.publish.enable = true;