workhorse done and nixpkgs-fmt

This commit is contained in:
Ingolf Wagner 2021-11-01 09:20:42 +01:00
parent 87be340dfa
commit fc33e57a54
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
124 changed files with 3142 additions and 2590 deletions

View file

@ -41,7 +41,8 @@ let
cfg = config.system.custom.audio;
in {
in
{
options.system.custom.audio = {
enable = mkEnableOption "use PluseAudio";

View file

@ -4,7 +4,8 @@ let
cfg = config.system.custom.bluetooth;
in {
in
{
options.system.custom.bluetooth.enable =
lib.mkEnableOption "enable bluetooth support";

View file

@ -6,7 +6,8 @@ let
cfg = config.system.custom.fonts;
in {
in
{
options.system.custom.fonts = {
enable = mkEnableOption "enable fonts";

View file

@ -9,12 +9,14 @@ let
dockerGroup =
if (config.virtualisation.docker.enable) then [ "docker" ] else [ ];
vboxGroup = if (config.virtualisation.virtualbox.host.enable) then
[ "vboxusers" ]
else
[ ];
vboxGroup =
if (config.virtualisation.virtualbox.host.enable) then
[ "vboxusers" ]
else
[ ];
in {
in
{
options.system.custom.mainUser = {

View file

@ -55,7 +55,8 @@ let
${cfg.url}
'';
in {
in
{
options.on-failure = api;

View file

@ -6,7 +6,8 @@ let
cfg = config.system.permown;
nameGenerator = path: "permown.${replaceStrings [ "/" ] [ "_" ] path}";
in {
in
{
options.system.permown = mkOption {
default = { };
@ -45,51 +46,54 @@ in {
}));
};
config = let plans = lib.attrValues cfg;
config =
let plans = lib.attrValues cfg;
in mkIf (plans != [ ]) {
in mkIf (plans != [ ]) {
system.activationScripts.permown = let
mkdir = { path, ... }: ''
${pkgs.coreutils}/bin/mkdir -p ${path}
'';
in concatMapStrings mkdir plans;
system.activationScripts.permown =
let
mkdir = { path, ... }: ''
${pkgs.coreutils}/bin/mkdir -p ${path}
'';
in
concatMapStrings mkdir plans;
systemd.services = listToAttrs (flip map plans
({ path, directory-mode, file-mode, owner, group, umask, ... }: {
systemd.services = listToAttrs (flip map plans
({ path, directory-mode, file-mode, owner, group, umask, ... }: {
name = nameGenerator path;
value = {
environment = {
DIR_MODE = directory-mode;
FILE_MODE = file-mode;
OWNER_GROUP = "${owner}:${group}";
ROOT_PATH = path;
};
path = [ pkgs.coreutils pkgs.findutils pkgs.inotifyTools ];
serviceConfig = {
ExecStart = pkgs.writers.writeDash "permown" ''
set -efu
find "$ROOT_PATH" -exec chown -h "$OWNER_GROUP" {} +
find "$ROOT_PATH" -type d -exec chmod "$DIR_MODE" {} +
find "$ROOT_PATH" -type f -exec chmod "$FILE_MODE" {} +
'';
PrivateTmp = true;
Restart = "always";
RestartSec = 10;
UMask = umask;
};
wantedBy = [ "multi-user.target" ];
};
}));
systemd.timers = listToAttrs (flip map plans ({ path, timer, ... }: {
name = nameGenerator path;
value = {
environment = {
DIR_MODE = directory-mode;
FILE_MODE = file-mode;
OWNER_GROUP = "${owner}:${group}";
ROOT_PATH = path;
};
path = [ pkgs.coreutils pkgs.findutils pkgs.inotifyTools ];
serviceConfig = {
ExecStart = pkgs.writers.writeDash "permown" ''
set -efu
find "$ROOT_PATH" -exec chown -h "$OWNER_GROUP" {} +
find "$ROOT_PATH" -type d -exec chmod "$DIR_MODE" {} +
find "$ROOT_PATH" -type f -exec chmod "$FILE_MODE" {} +
'';
PrivateTmp = true;
Restart = "always";
RestartSec = 10;
UMask = umask;
};
wantedBy = [ "multi-user.target" ];
timerConfig.OnCalendar = timer;
};
}));
systemd.timers = listToAttrs (flip map plans ({ path, timer, ... }: {
name = nameGenerator path;
value = {
wantedBy = [ "multi-user.target" ];
timerConfig.OnCalendar = timer;
};
}));
};
};
}

View file

@ -6,7 +6,8 @@ let
cfg = config.system.custom.wifi;
in {
in
{
options.system.custom.wifi = {
enable = mkEnableOption "enable wifi";

View file

@ -6,7 +6,8 @@ let
cfg = config.system.custom.x11;
in {
in
{
options.system.custom.x11 = {
enable = mkEnableOption "enable x11";