From 6100c826d40cd6b97ad8f3ddde4c2219c4ea637b Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 4 Nov 2019 14:35:56 +1000 Subject: [PATCH] adds com.apple.loginwindow --- modules/module-list.nix | 1 + modules/system/defaults-write.nix | 4 +- modules/system/defaults/loginwindow.nix | 106 ++++++++++++++++++++++++ 3 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 modules/system/defaults/loginwindow.nix diff --git a/modules/module-list.nix b/modules/module-list.nix index 0a777abe..f3019d25 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -15,6 +15,7 @@ ./system/defaults/finder.nix ./system/defaults/screencapture.nix ./system/defaults/alf.nix + ./system/defaults/loginwindow.nix ./system/defaults/smb.nix ./system/defaults/spaces.nix ./system/defaults/trackpad.nix diff --git a/modules/system/defaults-write.nix b/modules/system/defaults-write.nix index d413dc53..adbe9394 100644 --- a/modules/system/defaults-write.nix +++ b/modules/system/defaults-write.nix @@ -27,6 +27,7 @@ let dock = defaultsToList "com.apple.dock" cfg.dock; finder = defaultsToList "com.apple.finder" cfg.finder; alf = defaultsToList "/Library/Preferences/com.apple.alf" cfg.alf; + loginwindow = defaultsToList "/Library/Preferences/com.apple.loginwindow" cfg.loginwindow; smb = defaultsToList "/Library/Preferences/SystemConfiguration/com.apple.smb.server" cfg.smb; screencapture = defaultsToList "com.apple.screencapture" cfg.screencapture; spaces = defaultsToList "com.apple.spaces" cfg.spaces; @@ -39,11 +40,12 @@ in { config = { - system.activationScripts.defaults.text = mkIfAttrs [ alf smb ] + system.activationScripts.defaults.text = mkIfAttrs [ alf loginwindow smb ] '' # Set defaults echo >&2 "system defaults..." ${concatStringsSep "\n" alf} + ${concatStringsSep "\n" loginwindow} ${concatStringsSep "\n" smb} ''; diff --git a/modules/system/defaults/loginwindow.nix b/modules/system/defaults/loginwindow.nix new file mode 100644 index 00000000..f2400bd8 --- /dev/null +++ b/modules/system/defaults/loginwindow.nix @@ -0,0 +1,106 @@ +{ config, lib, ... }: + +with lib; + +{ + options = { + system.defaults.loginwindow.SHOWFULLNAME = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + # Apple menu > System Preferences > Users and Groups > Login Options + Displays login window as a name and password field instead of a list of users. + Default is false. + ''; + }; + + system.defaults.loginwindow.autoLoginUser = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + # Apple menu > System Preferences > Users and Groups > Login Options + Auto login the default user on boot. Default is false. + ''; + }; + + system.defaults.loginwindow.GuestEnabled = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + # Apple menu > System Preferences > Users and Groups > Login Options + Allow users to login to the machine as guests using the Guest account. Default is true. + ''; + }; + + system.defaults.loginwindow.LoginwindowText = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + Text to be shown on the login window. Default "\\U03bb". + ''; + }; + + system.defaults.loginwindow.ShutDownDisabled = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + # Apple menu > System Preferences > Users and Groups > Login Options + Hides the Shut Down button on the login screen. Default is false. + ''; + }; + + system.defaults.loginwindow.SleepDisabled = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + # Apple menu > System Preferences > Users and Groups > Login Options + Hides the Sleep button on the login screen. Default is false. + ''; + }; + + system.defaults.loginwindow.RestartDisabled = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + # Apple menu > System Preferences > Users and Groups > Login Options + Hides the Restart button on the login screen. Default is false. + ''; + }; + + system.defaults.loginwindow.ShutDownDisabledWhileLoggedIn = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + # Apple menu > System Preferences > Users and Groups > Login Options + Disables the "Shutdown" option when users are logged in. Default is false. + ''; + }; + + system.defaults.loginwindow.PowerOffDisabledWhileLoggedIn = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + # Apple menu > System Preferences > Users and Groups > Login Options + If set to true, the Power Off menu item will be disabled when the user is logged in. Default is false. + ''; + }; + + system.defaults.loginwindow.RestartDisabledWhileLoggedIn = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + # Apple menu > System Preferences > Users and Groups > Login Options + Disables the “Restart” option when users are logged in. Default is false. + ''; + }; + + system.defaults.loginwindow.DisableConsoleAccess = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + Disables the ability for a user to access the console by typing “>console” + for a username at the login window. Default is false. + ''; + }; + }; +}