nix fmt
This commit is contained in:
@@ -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 ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user