From 457a5d99529818fdbcf3af17b3604a8ab778bc0b Mon Sep 17 00:00:00 2001 From: Ricardo Pinto Date: Mon, 8 Apr 2024 14:09:25 +0100 Subject: Add persistent others to dock --- .../system-defaults-write/activate-user.txt | 30 ++++++++++++++++++++++ tests/system-defaults-write.nix | 1 + 2 files changed, 31 insertions(+) (limited to 'tests') diff --git a/tests/fixtures/system-defaults-write/activate-user.txt b/tests/fixtures/system-defaults-write/activate-user.txt index 1021ab3..5fa5952 100644 --- a/tests/fixtures/system-defaults-write/activate-user.txt +++ b/tests/fixtures/system-defaults-write/activate-user.txt @@ -255,6 +255,36 @@ defaults write com.apple.dock 'persistent-apps' $' ' +defaults write com.apple.dock 'persistent-others' $' + + + + + tile-data + + file-data + + _CFURLString + ~/Documents + _CFURLStringType + 15 + + + + + tile-data + + file-data + + _CFURLString + ~/Downloads + _CFURLStringType + 15 + + + + +' diff --git a/tests/system-defaults-write.nix b/tests/system-defaults-write.nix index 9840298..e17d950 100644 --- a/tests/system-defaults-write.nix +++ b/tests/system-defaults-write.nix @@ -47,6 +47,7 @@ system.defaults.dock.autohide-delay = 0.24; system.defaults.dock.orientation = "left"; system.defaults.dock.persistent-apps = ["MyApp.app" "Cool.app"]; + system.defaults.dock.persistent-others = ["~/Documents" "~/Downloads"]; system.defaults.screencapture.location = "/tmp"; system.defaults.screensaver.askForPassword = true; system.defaults.screensaver.askForPasswordDelay = 5; -- cgit v1.2.3 From 93913d14a310efc40fc84d58d278b96c73c37c65 Mon Sep 17 00:00:00 2001 From: Ricardo Pinto Date: Wed, 15 May 2024 07:49:00 +0100 Subject: Add file or directory tile to Dock persistent others --- tests/fixtures/system-defaults-write/activate-user.txt | 8 ++++++-- tests/system-defaults-write.nix | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/fixtures/system-defaults-write/activate-user.txt b/tests/fixtures/system-defaults-write/activate-user.txt index 5fa5952..1650e21 100644 --- a/tests/fixtures/system-defaults-write/activate-user.txt +++ b/tests/fixtures/system-defaults-write/activate-user.txt @@ -265,11 +265,13 @@ defaults write com.apple.dock 'persistent-others' $'file-data _CFURLString - ~/Documents + file://~/Documents _CFURLStringType 15 + tile-type + directory-tile tile-data @@ -277,11 +279,13 @@ defaults write com.apple.dock 'persistent-others' $'file-data _CFURLString - ~/Downloads + file://~/Downloads/file.txt _CFURLStringType 15 + tile-type + file-tile ' diff --git a/tests/system-defaults-write.nix b/tests/system-defaults-write.nix index e17d950..7624bba 100644 --- a/tests/system-defaults-write.nix +++ b/tests/system-defaults-write.nix @@ -47,7 +47,7 @@ system.defaults.dock.autohide-delay = 0.24; system.defaults.dock.orientation = "left"; system.defaults.dock.persistent-apps = ["MyApp.app" "Cool.app"]; - system.defaults.dock.persistent-others = ["~/Documents" "~/Downloads"]; + system.defaults.dock.persistent-others = ["~/Documents" "~/Downloads/file.txt"]; system.defaults.screencapture.location = "/tmp"; system.defaults.screensaver.askForPassword = true; system.defaults.screensaver.askForPasswordDelay = 5; -- cgit v1.2.3 From 9b6f77200f8a88c8b5e5da47e90b73f86aab27b9 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Wed, 22 May 2024 13:34:01 -0400 Subject: environment: Rework test to assert against full $PATH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s deterministic after all, so test against the full thing for greater flexibility in testing and confidence in lack of unexpected changes to previously-untested parts of the default $PATH. Do this in a subshell to avoid polluting the test script’s environment. --- tests/environment-path.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/environment-path.nix b/tests/environment-path.nix index 7d2f46d..5ddaf9c 100644 --- a/tests/environment-path.nix +++ b/tests/environment-path.nix @@ -4,10 +4,18 @@ with lib; { test = '' - echo checking /run/current-system/sw/bin in environment >&2 - grep 'export PATH=.*:/run/current-system/sw/bin' ${config.system.build.setEnvironment} + echo 'checking PATH' >&2 + env_path=$(bash -c 'source ${config.system.build.setEnvironment}; echo $PATH') - echo checking /bin and /sbin in environment >&2 - grep 'export PATH=.*:/usr/bin:/usr/sbin:/bin:/sbin' ${config.system.build.setEnvironment} + test "$env_path" = "${builtins.concatStringsSep ":" [ + "/homeless-shelter/.nix-profile/bin" + "/run/current-system/sw/bin" + "/nix/var/nix/profiles/default/bin" + "/usr/local/bin" + "/usr/bin" + "/usr/sbin" + "/bin" + "/sbin" + ]}" ''; } -- cgit v1.2.3 From bd0ed8599fd4871e79543e09075dac2c2c25ff2a Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Wed, 22 May 2024 13:43:33 -0400 Subject: environment: Test how order of systemPath and profiles manifests --- tests/environment-path.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') diff --git a/tests/environment-path.nix b/tests/environment-path.nix index 5ddaf9c..0bb9a05 100644 --- a/tests/environment-path.nix +++ b/tests/environment-path.nix @@ -3,19 +3,37 @@ with lib; { + environment.systemPath = mkMerge [ + (mkBefore [ "beforePath" ]) + [ "myPath" ] + (mkAfter [ "afterPath" ]) + ]; + + environment.profiles = mkMerge [ + (mkBefore [ "beforeProfile" ]) + [ "myProfile" ] + (mkAfter [ "afterProfile" ]) + ]; + test = '' echo 'checking PATH' >&2 env_path=$(bash -c 'source ${config.system.build.setEnvironment}; echo $PATH') test "$env_path" = "${builtins.concatStringsSep ":" [ + "beforePath" + "myPath" + "beforeProfile/bin" "/homeless-shelter/.nix-profile/bin" + "myProfile/bin" "/run/current-system/sw/bin" "/nix/var/nix/profiles/default/bin" + "afterProfile/bin" "/usr/local/bin" "/usr/bin" "/usr/sbin" "/bin" "/sbin" + "afterPath" ]}" ''; } -- cgit v1.2.3 From eb2f62d0de9997b2f73b409a2843ac5968e1a6f3 Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 3 Aug 2023 02:11:40 +0100 Subject: fonts: use non-standard path in test Ensure that #665 works correctly. --- tests/fonts.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/fonts.nix b/tests/fonts.nix index acd1b13..e92b3bc 100644 --- a/tests/fonts.nix +++ b/tests/fonts.nix @@ -2,8 +2,8 @@ let font = pkgs.runCommand "font-0.0.0" {} '' - mkdir -p $out/share/fonts - touch $out/share/fonts/Font.ttf + mkdir -p $out + touch $out/Font.ttf ''; in -- cgit v1.2.3 From adf578e398445f981a36ad919928f23a1dd5ee12 Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 3 Aug 2023 02:11:40 +0100 Subject: fonts: reimplement and rename to `fonts.packages` Fixes: #120 Fixes: #722 Fixes: #752 Closes: #692 --- tests/fonts.nix | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/fonts.nix b/tests/fonts.nix index e92b3bc..57d61dc 100644 --- a/tests/fonts.nix +++ b/tests/fonts.nix @@ -9,15 +9,13 @@ in { fonts.fontDir.enable = true; - fonts.fonts = [ font ]; + fonts.packages = [ font ]; test = '' - echo "checking fonts in /Library/Fonts" >&2 - test -e ${config.out}/Library/Fonts/Font.ttf + echo "checking fonts in /Library/Fonts/Nix Fonts" >&2 + test -e "${config.out}/Library/Fonts/Nix Fonts"/*/Font.ttf echo "checking activation of fonts in /activate" >&2 - grep "fontrestore default -n 2>&1" ${config.out}/activate - grep 'ln -fn ".*" /Library/Fonts' ${config.out}/activate || grep 'rsync -az --inplace ".*" /Library/Fonts' ${config.out}/activate - grep 'rm "/Library/Fonts/.*"' ${config.out}/activate + grep '/Library/Fonts/Nix Fonts' ${config.out}/activate ''; } -- cgit v1.2.3 From 7d4f8672101536674ca5d75d91161474739a83e2 Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 3 Aug 2023 02:11:40 +0100 Subject: fonts: remove `fonts.fontDir.enable` As far as I can tell, this isn't required to get fonts to work on NixOS, so we shouldn't require it on nix-darwin either, even if the implementations are superficially similar. --- tests/fonts.nix | 1 - 1 file changed, 1 deletion(-) (limited to 'tests') diff --git a/tests/fonts.nix b/tests/fonts.nix index 57d61dc..d60979c 100644 --- a/tests/fonts.nix +++ b/tests/fonts.nix @@ -8,7 +8,6 @@ let in { - fonts.fontDir.enable = true; fonts.packages = [ font ]; test = '' -- cgit v1.2.3 From b833d4a32d965e6393a63b2c91b46eca2a5030d8 Mon Sep 17 00:00:00 2001 From: Emily Date: Sun, 16 Jul 2023 16:59:43 +0100 Subject: ssh: use symlinks for `authorizedKeys` options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As explained in the changelog and activation check, the previous implementation had a nasty security bug that made removing a user’s authorized keys effectively a no‐op. --- tests/programs-ssh.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/programs-ssh.nix b/tests/programs-ssh.nix index ad4f7ab..427f71b 100644 --- a/tests/programs-ssh.nix +++ b/tests/programs-ssh.nix @@ -12,9 +12,9 @@ echo >&2 "checking for github.com in /etc/ssh/ssh_known_hosts" grep 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' ${config.out}/etc/ssh/ssh_known_hosts - echo >&2 "checking for authorized keys for foo in /etc/ssh/authorized_keys.d/foo" - grep 'ssh-ed25519 AAAA...' ${config.out}/etc/ssh/authorized_keys.d/foo - echo >&2 "checking for authorized keys' path in /etc/ssh/sshd_config.d/101-authorized-keys.conf" - grep 'AuthorizedKeysFile %h/.ssh/authorized_keys /etc/ssh/authorized_keys.d/%u' ${config.out}/etc/ssh/sshd_config.d/101-authorized-keys.conf + echo >&2 "checking for authorized keys for foo in /etc/ssh/nix_authorized_keys.d/foo" + grep 'ssh-ed25519 AAAA...' ${config.out}/etc/ssh/nix_authorized_keys.d/foo + echo >&2 "checking for authorized keys command in /etc/ssh/sshd_config.d/101-authorized-keys.conf" + grep 'AuthorizedKeysCommand /bin/cat /etc/ssh/nix_authorized_keys.d/%u' ${config.out}/etc/ssh/sshd_config.d/101-authorized-keys.conf ''; } -- cgit v1.2.3 From e2a85731a071811457c151d2da385f9bb4ea5cdb Mon Sep 17 00:00:00 2001 From: Henrique Goncalves Date: Mon, 8 Jul 2024 16:36:31 -0300 Subject: nextdns: fix argument handling --- tests/services-nextdns.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/services-nextdns.nix b/tests/services-nextdns.nix index 4d6224f..02ce1a5 100644 --- a/tests/services-nextdns.nix +++ b/tests/services-nextdns.nix @@ -12,6 +12,7 @@ in { echo >&2 "checking nextdns service in ~/Library/LaunchDaemons" grep "org.nixos.nextdns" ${config.out}/Library/LaunchDaemons/org.nixos.nextdns.plist grep "/bin/nextdns" ${config.out}/Library/LaunchDaemons/org.nixos.nextdns.plist - grep "'-config' '10.0.3.0/24=abcdef'" ${config.out}/Library/LaunchDaemons/org.nixos.nextdns.plist + grep -- "-config" ${config.out}/Library/LaunchDaemons/org.nixos.nextdns.plist + grep "10.0.3.0/24=abcdef" ${config.out}/Library/LaunchDaemons/org.nixos.nextdns.plist ''; } -- cgit v1.2.3 From fa0d64721ff8dec9fe61544fea812f9a85e7c0b1 Mon Sep 17 00:00:00 2001 From: Prav!n <50878560+amsynist@users.noreply.github.com> Date: Wed, 12 Jun 2024 00:02:21 +0530 Subject: module: add jankyborders service - Added the jankyborders service. - Introduced changes for whitelist and blacklist options and assertions. - emoved path reference from launchd argument. - Corrected missing trailing newline in default.nix. --- tests/services-jankyborders.nix | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/services-jankyborders.nix (limited to 'tests') diff --git a/tests/services-jankyborders.nix b/tests/services-jankyborders.nix new file mode 100644 index 0000000..1f6adff --- /dev/null +++ b/tests/services-jankyborders.nix @@ -0,0 +1,29 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + jankyborders = pkgs.runCommand "borders-0.0.0" {} "mkdir $out"; +in + +{ + services.jankyborders.enable = true; + services.jankyborders.package = jankyborders; + services.jankyborders.width = 5.0; + services.jankyborders.hidpi = true; + services.jankyborders.active_color = "0xFFFFFFFF"; + + + + test = '' + echo >&2 "checking jankyborders service in ~/Library/LaunchAgents" + grep "org.nixos.jankyborders" ${config.out}/user/Library/LaunchAgents/org.nixos.jankyborders.plist + grep "${jankyborders}/bin/borders" ${config.out}/user/Library/LaunchAgents/org.nixos.jankyborders.plist + + echo >&2 "checking jankyborders config arguments" + grep "width=5.000000" ${config.out}/user/Library/LaunchAgents/org.nixos.jankyborders.plist + grep "hidpi=on" ${config.out}/user/Library/LaunchAgents/org.nixos.jankyborders.plist + grep "active_color=0xFFFFFFFF" ${config.out}/user/Library/LaunchAgents/org.nixos.jankyborders.plist + + ''; +} -- cgit v1.2.3 From be14a2add172621f1d02b0457e50a6a96fd9b73b Mon Sep 17 00:00:00 2001 From: 347Online | Katie Janzen Date: Sat, 8 Jun 2024 10:10:29 -0500 Subject: Add inline prediction option mirroring the capitalization option --- tests/fixtures/system-defaults-write/activate-user.txt | 5 +++++ tests/system-defaults-write.nix | 1 + 2 files changed, 6 insertions(+) (limited to 'tests') diff --git a/tests/fixtures/system-defaults-write/activate-user.txt b/tests/fixtures/system-defaults-write/activate-user.txt index 1650e21..d324a8d 100644 --- a/tests/fixtures/system-defaults-write/activate-user.txt +++ b/tests/fixtures/system-defaults-write/activate-user.txt @@ -73,6 +73,11 @@ defaults write -g 'NSAutomaticDashSubstitutionEnabled' $' ' +defaults write -g 'NSAutomaticInlinePredictionEnabled' $' + + + +' defaults write -g 'NSAutomaticPeriodSubstitutionEnabled' $' diff --git a/tests/system-defaults-write.nix b/tests/system-defaults-write.nix index 7624bba..6a95b55 100644 --- a/tests/system-defaults-write.nix +++ b/tests/system-defaults-write.nix @@ -12,6 +12,7 @@ system.defaults.NSGlobalDomain.AppleShowScrollBars = "Always"; system.defaults.NSGlobalDomain.AppleScrollerPagingBehavior = true; system.defaults.NSGlobalDomain.NSAutomaticCapitalizationEnabled = false; + system.defaults.NSGlobalDomain.NSAutomaticInlinePredictionEnabled = false; system.defaults.NSGlobalDomain.NSAutomaticDashSubstitutionEnabled = false; system.defaults.NSGlobalDomain.NSAutomaticPeriodSubstitutionEnabled = false; system.defaults.NSGlobalDomain.NSAutomaticQuoteSubstitutionEnabled = false; -- cgit v1.2.3 From 3dd14e466c78e1a5e90ffeff5cf37b40c3a82a53 Mon Sep 17 00:00:00 2001 From: Maxime Daffis Date: Thu, 11 Jul 2024 14:56:29 +0200 Subject: (feature) Add Stage Manager (com.apple.WindowManager) settings as system.defaults.windowmanager All credits go to @AlexOwl. Their [PR](https://github.com/LnL7/nix-darwin/pull/505) looked abandonned so I reported their changes and addressed the change requests. --- .../system-defaults-write/activate-user.txt | 40 ++++++++++++++++++++++ tests/system-defaults-write.nix | 8 +++++ 2 files changed, 48 insertions(+) (limited to 'tests') diff --git a/tests/fixtures/system-defaults-write/activate-user.txt b/tests/fixtures/system-defaults-write/activate-user.txt index d324a8d..4824a11 100644 --- a/tests/fixtures/system-defaults-write/activate-user.txt +++ b/tests/fixtures/system-defaults-write/activate-user.txt @@ -375,3 +375,43 @@ defaults write com.apple.Safari 'com.apple.Safari.ContentPageGroupIdentifier.Web ' +defaults write com.apple.WindowManager 'AppWindowGroupingBehavior' $' + + + +' +defaults write com.apple.WindowManager 'AutoHide' $' + + + +' +defaults write com.apple.WindowManager 'EnableStandardClickToShowDesktop' $' + + + +' +defaults write com.apple.WindowManager 'GloballyEnabled' $' + + + +' +defaults write com.apple.WindowManager 'HideDesktop' $' + + + +' +defaults write com.apple.WindowManager 'StageManagerHideWidgets' $' + + + +' +defaults write com.apple.WindowManager 'StandardHideDesktopIcons' $' + + + +' +defaults write com.apple.WindowManager 'StandardHideWidgets' $' + + + +' diff --git a/tests/system-defaults-write.nix b/tests/system-defaults-write.nix index 6a95b55..f91aabe 100644 --- a/tests/system-defaults-write.nix +++ b/tests/system-defaults-write.nix @@ -64,6 +64,14 @@ system.defaults.ActivityMonitor.SortColumn = "CPUUsage"; system.defaults.ActivityMonitor.SortDirection = 0; system.defaults.ActivityMonitor.OpenMainWindow = true; + system.defaults.WindowManager.GloballyEnabled = false; + system.defaults.WindowManager.EnableStandardClickToShowDesktop = false; + system.defaults.WindowManager.AutoHide = false; + system.defaults.WindowManager.AppWindowGroupingBehavior = true; + system.defaults.WindowManager.StandardHideDesktopIcons = false; + system.defaults.WindowManager.HideDesktop = false; + system.defaults.WindowManager.StandardHideWidgets = true; + system.defaults.WindowManager.StageManagerHideWidgets = true; system.defaults.CustomUserPreferences = { "NSGlobalDomain" = { "TISRomanSwitchState" = 1; }; "com.apple.Safari" = { -- cgit v1.2.3 From 636d1a09d8a4fc2306aee0c8a33dac21bd9e201a Mon Sep 17 00:00:00 2001 From: Maxime Daffis Date: Tue, 2 Jul 2024 14:22:37 +0200 Subject: (feature) Add swapLeftCtrlAndFn Use this and never find yourself again hitting fn because of muscle memory! (you can even physically swap the keycaps, at least on M series) Keycodes have been pulled from https://hidutil-generator.netlify.app/ and the hex value has been converted to a base 10 int. --- tests/system-keyboard-mapping.nix | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests') diff --git a/tests/system-keyboard-mapping.nix b/tests/system-keyboard-mapping.nix index b75efbd..654ca0c 100644 --- a/tests/system-keyboard-mapping.nix +++ b/tests/system-keyboard-mapping.nix @@ -6,6 +6,7 @@ system.keyboard.remapCapsLockToEscape = true; system.keyboard.nonUS.remapTilde = true; system.keyboard.swapLeftCommandAndLeftAlt = true; + system.keyboard.swapLeftCtrlAndFn = true; test = '' echo checking keyboard mappings in /activate >&2 @@ -17,5 +18,7 @@ grep "\"HIDKeyboardModifierMappingDst\":30064771296" ${config.out}/activate grep "\"HIDKeyboardModifierMappingDst\":30064771298" ${config.out}/activate grep "\"HIDKeyboardModifierMappingDst\":30064771299" ${config.out}/activate + grep "\"HIDKeyboardModifierMappingDst\":30064771296" ${config.out}/activate + grep "\"HIDKeyboardModifierMappingDst\":1095216660483" ${config.out}/activate ''; } -- cgit v1.2.3 From dea497f67a641d2d85f5673c3695f0fe43d46f64 Mon Sep 17 00:00:00 2001 From: Emily Date: Tue, 10 Sep 2024 22:10:38 +0100 Subject: tests/networking-hostname: update for `lib.escapeShellArg` change --- tests/networking-hostname.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/networking-hostname.nix b/tests/networking-hostname.nix index 3793958..9e8c6fd 100644 --- a/tests/networking-hostname.nix +++ b/tests/networking-hostname.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ lib, config, pkgs, ... }: { networking.hostName = "EVE"; @@ -7,8 +7,8 @@ test = '' echo checking hostname in /activate >&2 grep "scutil --set ComputerName 'EVE’s MacBook Pro'" ${config.out}/activate - grep "scutil --set LocalHostName 'EVE'" ${config.out}/activate - grep "scutil --set HostName 'EVE'" ${config.out}/activate + grep "scutil --set LocalHostName ${lib.escapeShellArg "EVE"}" ${config.out}/activate + grep "scutil --set HostName ${lib.escapeShellArg "EVE"}" ${config.out}/activate echo checking defaults write in ${config.out}/activate-user >&2 ''; } -- cgit v1.2.3 From 95f063ea069e1752ddede8c9823a1b75ddd7858a Mon Sep 17 00:00:00 2001 From: Emily Date: Tue, 10 Sep 2024 22:32:11 +0100 Subject: tests/users-groups: update for `lib.escapeShellArg` change --- tests/users-groups.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/users-groups.nix b/tests/users-groups.nix index cefb1ad..feaaf2b 100644 --- a/tests/users-groups.nix +++ b/tests/users-groups.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ lib, config, pkgs, ... }: { users.knownGroups = [ "foo" "created.group" "deleted.group" ]; @@ -46,9 +46,9 @@ grep "dscl . -create '/Users/foo' IsHidden 0" ${config.out}/activate grep "dscl . -create '/Users/foo' RealName 'Foo user'" ${config.out}/activate grep "dscl . -create '/Users/foo' NFSHomeDirectory '/Users/foo'" ${config.out}/activate - grep "dscl . -create '/Users/foo' UserShell '/run/current-system/sw/bin/bash'" ${config.out}/activate + grep "dscl . -create '/Users/foo' UserShell ${lib.escapeShellArg "/run/current-system/sw/bin/bash"}" ${config.out}/activate grep "dscl . -create '/Users/created.user' UniqueID 42001" ${config.out}/activate - grep "dscl . -create '/Users/created.user' UserShell '/sbin/nologin'" ${config.out}/activate + grep "dscl . -create '/Users/created.user' UserShell ${lib.escapeShellArg "/sbin/nologin"}" ${config.out}/activate grep "createhomedir -cu 'foo'" ${config.out}/activate grep -qv "dscl . -delete '/Groups/created.user'" ${config.out}/activate -- cgit v1.2.3 From 953d02ba5958df017d9682f727d10a75cb8a0391 Mon Sep 17 00:00:00 2001 From: Antoine Cotten Date: Thu, 12 Sep 2024 17:37:56 +0000 Subject: {bash,zsh}: remove nix-shell early return in /etc/{bashrc,zshenv} The condition does not match the comment, and therefore not the original intention. It currently returns early in *any* type of Nix shell, not just pure ones, including 'nix develop'. Besides being unnecessary, this check prevents Nix shells from functioning properly. For instance, it causes the initialization of the Zsh fpath to be skipped, which is critical. The fact that the user is unable to opt out of this behaviour makes this an ever bigger problem since /etc/zshenv is being loaded unconditionally by Zsh. For reference, NixOS does not perform such check, and apparently never did. --- tests/programs-zsh.nix | 2 -- 1 file changed, 2 deletions(-) (limited to 'tests') diff --git a/tests/programs-zsh.nix b/tests/programs-zsh.nix index dd5f6e9..9c98c33 100644 --- a/tests/programs-zsh.nix +++ b/tests/programs-zsh.nix @@ -22,8 +22,6 @@ echo >&2 "checking setEnvironment in /etc/zshenv" fgrep '. ${config.system.build.setEnvironment}' ${config.out}/etc/zshenv - echo >&2 "checking nix-shell return /etc/zshenv" - grep 'if test -n "$IN_NIX_SHELL"; then return; fi' ${config.out}/etc/zshenv echo >&2 "checking zshenv.d in /etc/zshenv" grep 'source /etc/zshenv.d/\*.conf' ${config.out}/etc/zshenv -- cgit v1.2.3 From 3b087efcbdb72f89e0c80a3ebdf4e091b7a48e41 Mon Sep 17 00:00:00 2001 From: Niklas Ravnsborg Date: Wed, 4 Sep 2024 23:03:14 +0200 Subject: add `NSGlobalDomain.AppleSpacesSwitchOnActivate` option --- tests/fixtures/system-defaults-write/activate-user.txt | 5 +++++ tests/system-defaults-write.nix | 1 + 2 files changed, 6 insertions(+) (limited to 'tests') diff --git a/tests/fixtures/system-defaults-write/activate-user.txt b/tests/fixtures/system-defaults-write/activate-user.txt index 4824a11..ff05d68 100644 --- a/tests/fixtures/system-defaults-write/activate-user.txt +++ b/tests/fixtures/system-defaults-write/activate-user.txt @@ -48,6 +48,11 @@ defaults write -g 'AppleShowScrollBars' $' Always ' +defaults write -g 'AppleSpacesSwitchOnActivate' $' + + + +' defaults write -g 'AppleWindowTabbingMode' $' diff --git a/tests/system-defaults-write.nix b/tests/system-defaults-write.nix index f91aabe..35750b4 100644 --- a/tests/system-defaults-write.nix +++ b/tests/system-defaults-write.nix @@ -11,6 +11,7 @@ system.defaults.NSGlobalDomain.AppleShowAllExtensions = true; system.defaults.NSGlobalDomain.AppleShowScrollBars = "Always"; system.defaults.NSGlobalDomain.AppleScrollerPagingBehavior = true; + system.defaults.NSGlobalDomain.AppleSpacesSwitchOnActivate = false; system.defaults.NSGlobalDomain.NSAutomaticCapitalizationEnabled = false; system.defaults.NSGlobalDomain.NSAutomaticInlinePredictionEnabled = false; system.defaults.NSGlobalDomain.NSAutomaticDashSubstitutionEnabled = false; -- cgit v1.2.3 From e92cc01524b68028d449e9dbb56a8a644ede3ab4 Mon Sep 17 00:00:00 2001 From: Niklas Ravnsborg Date: Wed, 18 Sep 2024 09:57:48 +0200 Subject: add tests for finder options --- .../system-defaults-write/activate-user.txt | 56 +++++++++++++++++++++- tests/system-defaults-write.nix | 46 +++++++++++------- 2 files changed, 84 insertions(+), 18 deletions(-) (limited to 'tests') diff --git a/tests/fixtures/system-defaults-write/activate-user.txt b/tests/fixtures/system-defaults-write/activate-user.txt index ff05d68..f3e01a6 100644 --- a/tests/fixtures/system-defaults-write/activate-user.txt +++ b/tests/fixtures/system-defaults-write/activate-user.txt @@ -299,7 +299,61 @@ defaults write com.apple.dock 'persistent-others' $' ' - +defaults write com.apple.finder 'AppleShowAllExtensions' $' + + + +' +defaults write com.apple.finder 'AppleShowAllFiles' $' + + + +' +defaults write com.apple.finder 'CreateDesktop' $' + + + +' +defaults write com.apple.finder 'FXDefaultSearchScope' $' + + +SCcf +' +defaults write com.apple.finder 'FXEnableExtensionChangeWarning' $' + + + +' +defaults write com.apple.finder 'FXPreferredViewStyle' $' + + +Flwv +' +defaults write com.apple.finder 'QuitMenuItem' $' + + + +' +defaults write com.apple.finder 'ShowPathbar' $' + + + +' +defaults write com.apple.finder 'ShowStatusBar' $' + + + +' +defaults write com.apple.finder '_FXShowPosixPathInTitle' $' + + + +' +defaults write com.apple.finder '_FXSortFoldersFirst' $' + + + +' defaults write com.apple.screencapture 'location' $' diff --git a/tests/system-defaults-write.nix b/tests/system-defaults-write.nix index 35750b4..eae6199 100644 --- a/tests/system-defaults-write.nix +++ b/tests/system-defaults-write.nix @@ -50,6 +50,17 @@ system.defaults.dock.orientation = "left"; system.defaults.dock.persistent-apps = ["MyApp.app" "Cool.app"]; system.defaults.dock.persistent-others = ["~/Documents" "~/Downloads/file.txt"]; + system.defaults.finder.AppleShowAllFiles = true; + system.defaults.finder.ShowStatusBar = true; + system.defaults.finder.ShowPathbar = true; + system.defaults.finder.FXDefaultSearchScope = "SCcf"; + system.defaults.finder.FXPreferredViewStyle = "Flwv"; + system.defaults.finder.AppleShowAllExtensions = true; + system.defaults.finder.CreateDesktop = false; + system.defaults.finder.QuitMenuItem = true; + system.defaults.finder._FXShowPosixPathInTitle = true; + system.defaults.finder._FXSortFoldersFirst = true; + system.defaults.finder.FXEnableExtensionChangeWarning = false; system.defaults.screencapture.location = "/tmp"; system.defaults.screensaver.askForPassword = true; system.defaults.screensaver.askForPasswordDelay = 5; @@ -74,24 +85,25 @@ system.defaults.WindowManager.StandardHideWidgets = true; system.defaults.WindowManager.StageManagerHideWidgets = true; system.defaults.CustomUserPreferences = { - "NSGlobalDomain" = { "TISRomanSwitchState" = 1; }; - "com.apple.Safari" = { - "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" = - true; - }; + "NSGlobalDomain" = { "TISRomanSwitchState" = 1; }; + "com.apple.Safari" = { + "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" = + true; }; - test = lib.strings.concatMapStringsSep "\n" (x: '' - echo >&2 "checking defaults write in /${x}" - ${pkgs.python3}/bin/python3 <&2 "checking defaults write in /${x}" + ${pkgs.python3}/bin/python3 < Date: Sat, 31 Aug 2024 18:27:10 +1000 Subject: feat: use wait4path with script launchd option addresses https://github.com/LnL7/nix-darwin/issues/1043 fix: use exec in launchd daemon config fix: dont use a script thats in the nix store fix: remove manual wait4path in linux-builder fix: remove manual wait4path in karabiner elements fix: remove manual wait4path in nix-daemon fix: remove manual wait4path in nix-optimise fix: remove manual wait4path in tailscaled fix: autossh test Revert "fix: remove manual wait4path in nix-daemon" This reverts commit 6aec084fa5d095666e81676e78f7054c83703faa. fix: remove bad exec Reapply "fix: remove manual wait4path in nix-daemon" This reverts commit c8f136ecc555f803124af471324bc6ed1163d6dd. fix: update autossh test to reflect changes in f86e6133d957becb1958da638516b0860fbd7491 fix: services-activate-system-changed-label-prefix test fix: services-buildkite-agent test fix: services-activate-system test fix: escape ampersand fix: services-lorri test fix: services-nix-optimise test fix: services-nix-gc test refactor: use script rather than command in daemon fix: use config.command for clarity style: fix indentation fix: use lib.getExe rather than directly pointing to file revert: a87fc7bbbbdb7c25c5ad6721c93990ea035affdd - mistaken refactor meant that service waited for nix store and not the relevant path --- tests/autossh.nix | 16 ++++++++------ ...rvices-activate-system-changed-label-prefix.nix | 2 +- tests/services-activate-system.nix | 2 +- tests/services-buildkite-agent.nix | 4 ++-- tests/services-lorri.nix | 25 +++++++++++++++++----- tests/services-nix-gc.nix | 4 ++-- tests/services-nix-optimise.nix | 4 ++-- 7 files changed, 37 insertions(+), 20 deletions(-) (limited to 'tests') diff --git a/tests/autossh.nix b/tests/autossh.nix index d1aacd0..5279bf9 100644 --- a/tests/autossh.nix +++ b/tests/autossh.nix @@ -1,17 +1,19 @@ { config, pkgs, ... }: { - services.autossh.sessions = [ { - name = "foo"; - user = "jfelice"; - extraArguments = "-i /some/key -T -N bar.eraserhead.net"; - } ]; + services.autossh.sessions = [ + { + name = "foo"; + user = "jfelice"; + extraArguments = "-i /some/key -T -N bar.eraserhead.net"; + } + ]; test = '' plist=${config.out}/Library/LaunchDaemons/org.nixos.autossh-foo.plist test -f $plist - grep 'exec /nix/store/.*/bin/autossh ' $plist - grep 'exec.*-i /some/key ' $plist + grep '/bin/wait4path /nix/store && exec /nix/store/.*/bin/autossh ' $plist + grep '/bin/wait4path /nix/store && exec.*-i /some/key ' $plist tr -d '\n\t ' <$plist |grep 'KeepAlive' ''; } diff --git a/tests/services-activate-system-changed-label-prefix.nix b/tests/services-activate-system-changed-label-prefix.nix index 5ac9969..1ae2bcf 100644 --- a/tests/services-activate-system-changed-label-prefix.nix +++ b/tests/services-activate-system-changed-label-prefix.nix @@ -9,7 +9,7 @@ grep "org.nix-darwin.activate-system" ${config.out}/Library/LaunchDaemons/org.nix-darwin.activate-system.plist echo checking activation of /run/current-system >&2 - script=$(cat ${config.out}/Library/LaunchDaemons/org.nix-darwin.activate-system.plist | awk -F'[< ]' '$3 ~ "^/nix/store/.*" {print $3}') + script=$(cat ${config.out}/Library/LaunchDaemons/org.nix-darwin.activate-system.plist | awk -F'[< ]' '$6 ~ "^/nix/store/.*" {print $6}') grep "ln -sfn .* /run/current-system" "$script" ''; } diff --git a/tests/services-activate-system.nix b/tests/services-activate-system.nix index 02eaf3c..c519aa8 100644 --- a/tests/services-activate-system.nix +++ b/tests/services-activate-system.nix @@ -8,7 +8,7 @@ grep "org.nixos.activate-system" ${config.out}/Library/LaunchDaemons/org.nixos.activate-system.plist echo checking activation of /run/current-system >&2 - script=$(cat ${config.out}/Library/LaunchDaemons/org.nixos.activate-system.plist | awk -F'[< ]' '$3 ~ "^/nix/store/.*" {print $3}') + script=$(cat ${config.out}/Library/LaunchDaemons/org.nixos.activate-system.plist | awk -F'[< ]' '$6 ~ "^/nix/store/.*" {print $6}') grep "ln -sfn .* /run/current-system" "$script" ''; } diff --git a/tests/services-buildkite-agent.nix b/tests/services-buildkite-agent.nix index 557aad2..1d8d824 100644 --- a/tests/services-buildkite-agent.nix +++ b/tests/services-buildkite-agent.nix @@ -1,7 +1,7 @@ { config, pkgs, ... }: let - buildkite-agent = pkgs.runCommand "buildkite-agent-0.0.0" {} "mkdir $out"; + buildkite-agent = pkgs.runCommand "buildkite-agent-0.0.0" { } "mkdir $out"; tokenPath = pkgs.writeText "buildkite_token" "TEST_TOKEN"; in @@ -20,7 +20,7 @@ in grep "org.nixos.buildkite-agent-test" ${config.out}/Library/LaunchDaemons/org.nixos.buildkite-agent-test.plist echo "checking creation of buildkite-agent service config" >&2 - script=$(cat ${config.out}/Library/LaunchDaemons/org.nixos.buildkite-agent-test.plist | awk -F'[< ]' '$3 ~ "^/nix/store/.*" {print $3}') + script=$(cat ${config.out}/Library/LaunchDaemons/org.nixos.buildkite-agent-test.plist | awk -F'[< ]' '$6 ~ "^/nix/store/.*" {print $6}') grep "yolo=1" "$script" grep "${tokenPath}" "$script" diff --git a/tests/services-lorri.nix b/tests/services-lorri.nix index 52dcc91..7d30152 100644 --- a/tests/services-lorri.nix +++ b/tests/services-lorri.nix @@ -1,14 +1,29 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let plistPath = "${config.out}/user/Library/LaunchAgents/org.nixos.lorri.plist"; - expectedPath = "${lib.makeBinPath [config.nix.package pkgs.git pkgs.gnutar pkgs.gzip]}"; - expectedNixPath = "${"nixpkgs="+ toString pkgs.path}"; + expectedPath = "${lib.makeBinPath [ + config.nix.package + pkgs.git + pkgs.gnutar + pkgs.gzip + ]}"; + expectedNixPath = "${"nixpkgs=" + toString pkgs.path}"; in { services.lorri.enable = true; test = '' - PATH=${lib.makeBinPath [ pkgs.xcbuild pkgs.jq ]}:$PATH + PATH=${ + lib.makeBinPath [ + pkgs.xcbuild + pkgs.jq + ] + }:$PATH plutil -lint ${plistPath} plutil -convert json -o service.json ${plistPath} @@ -21,7 +36,7 @@ in &2 grep "org.nixos.nix-gc" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist - grep "exec ${nix}/bin/nix-collect-garbage --delete-older-than 30d" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist + grep "/bin/wait4path /nix/store && exec ${nix}/bin/nix-collect-garbage --delete-older-than 30d" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist grep "UserName" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist grep "nixuser" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist diff --git a/tests/services-nix-optimise.nix b/tests/services-nix-optimise.nix index b0ecf18..4108eb0 100644 --- a/tests/services-nix-optimise.nix +++ b/tests/services-nix-optimise.nix @@ -1,7 +1,7 @@ { config, pkgs, ... }: let - nix = pkgs.runCommand "nix-2.2" {} "mkdir -p $out"; + nix = pkgs.runCommand "nix-2.2" { } "mkdir -p $out"; in { @@ -13,7 +13,7 @@ in echo checking nix-optimise service in /Library/LaunchDaemons >&2 grep "org.nixos.nix-optimise" \ ${config.out}/Library/LaunchDaemons/org.nixos.nix-optimise.plist - grep "/bin/wait4path ${nix} && exec ${nix}/bin/nix-store --optimise" \ + grep "/bin/wait4path /nix/store && exec ${nix}/bin/nix-store --optimise" \ ${config.out}/Library/LaunchDaemons/org.nixos.nix-optimise.plist grep "UserName" ${config.out}/Library/LaunchDaemons/org.nixos.nix-optimise.plist grep "nixuser" ${config.out}/Library/LaunchDaemons/org.nixos.nix-optimise.plist -- cgit v1.2.3 From 2893a1bcf71891c1db934773bc3c7ed46b0a1448 Mon Sep 17 00:00:00 2001 From: aspauldingcode Date: Thu, 3 Oct 2024 08:01:15 -0600 Subject: push change to jankyborders test --- tests/services-jankyborders.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/services-jankyborders.nix b/tests/services-jankyborders.nix index 1f6adff..5bde078 100644 --- a/tests/services-jankyborders.nix +++ b/tests/services-jankyborders.nix @@ -12,8 +12,7 @@ in services.jankyborders.width = 5.0; services.jankyborders.hidpi = true; services.jankyborders.active_color = "0xFFFFFFFF"; - - + services.jankyborders.order = "below"; test = '' echo >&2 "checking jankyborders service in ~/Library/LaunchAgents" @@ -24,6 +23,6 @@ in grep "width=5.000000" ${config.out}/user/Library/LaunchAgents/org.nixos.jankyborders.plist grep "hidpi=on" ${config.out}/user/Library/LaunchAgents/org.nixos.jankyborders.plist grep "active_color=0xFFFFFFFF" ${config.out}/user/Library/LaunchAgents/org.nixos.jankyborders.plist - + grep "order=below" ${config.out}/user/Library/LaunchAgents/org.nixos.jankyborders.plist ''; } -- cgit v1.2.3 From 239d802869a30bb45d4403e8f63a57a61f6910d9 Mon Sep 17 00:00:00 2001 From: Rohit Singh Date: Thu, 3 Oct 2024 23:42:10 +0530 Subject: netdata: add netdata service in nix-darwin. --- tests/services-netdata.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/services-netdata.nix (limited to 'tests') diff --git a/tests/services-netdata.nix b/tests/services-netdata.nix new file mode 100644 index 0000000..6759677 --- /dev/null +++ b/tests/services-netdata.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + netdata = pkgs.runCommand "netdata-0.0.0" {} "mkdir $out"; +in +{ + services.netdata = { + enable = true; + package = netdata; + }; + + test = '' + echo >&2 "checking netdata service in launchd daemons" + grep "netdata" ${config.out}/Library/LaunchDaemons/netdata.plist + grep "${netdata}/bin/netdata" ${config.out}/Library/LaunchDaemons/netdata.plist + ''; +} -- cgit v1.2.3 From 72e93853c2d16d1ce04a5e8eee6695e2493ca80d Mon Sep 17 00:00:00 2001 From: Nick Hu Date: Sun, 13 Oct 2024 12:52:55 +0100 Subject: module: add aerospace service --- tests/services-aerospace.nix | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/services-aerospace.nix (limited to 'tests') diff --git a/tests/services-aerospace.nix b/tests/services-aerospace.nix new file mode 100644 index 0000000..7656caf --- /dev/null +++ b/tests/services-aerospace.nix @@ -0,0 +1,36 @@ +{ config, pkgs, ... }: + +let + aerospace = pkgs.runCommand "aerospace-0.0.0" { } "mkdir $out"; +in + +{ + services.aerospace.enable = true; + services.aerospace.package = aerospace; + services.aerospace.settings = { + gaps = { + outer.left = 8; + outer.bottom = 8; + outer.top = 8; + outer.right = 8; + }; + mode.main.binding = { + alt-h = "focus left"; + alt-j = "focus down"; + alt-k = "focus up"; + alt-l = "focus right"; + }; + }; + + test = '' + echo >&2 "checking aerospace service in ~/Library/LaunchAgents" + grep "org.nixos.aerospace" ${config.out}/user/Library/LaunchAgents/org.nixos.aerospace.plist + grep "${aerospace}/Applications/AeroSpace.app/Contents/MacOS/AeroSpace" ${config.out}/user/Library/LaunchAgents/org.nixos.aerospace.plist + + conf=`sed -En '/--config-path<\/string>/{n; s/\s+?<\/?string>//g; p;}' \ + ${config.out}/user/Library/LaunchAgents/org.nixos.aerospace.plist` + + echo >&2 "checking config in $conf" + if [ `cat $conf | wc -l` -eq "27" ]; then echo "aerospace.toml config correctly contains 27 lines"; else return 1; fi + ''; +} -- cgit v1.2.3 From 7ebf95a73e3b54e0f9c48f50fde29e96257417ac Mon Sep 17 00:00:00 2001 From: Nick Hu Date: Thu, 17 Oct 2024 23:30:31 +0100 Subject: style fixes --- tests/services-aerospace.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/services-aerospace.nix b/tests/services-aerospace.nix index 7656caf..8cbd292 100644 --- a/tests/services-aerospace.nix +++ b/tests/services-aerospace.nix @@ -27,7 +27,7 @@ in grep "org.nixos.aerospace" ${config.out}/user/Library/LaunchAgents/org.nixos.aerospace.plist grep "${aerospace}/Applications/AeroSpace.app/Contents/MacOS/AeroSpace" ${config.out}/user/Library/LaunchAgents/org.nixos.aerospace.plist - conf=`sed -En '/--config-path<\/string>/{n; s/\s+?<\/?string>//g; p;}' \ + conf=`sed -En 's/^[[:space:]]*.*--config-path (.*)<\/string>$/\1/p' \ ${config.out}/user/Library/LaunchAgents/org.nixos.aerospace.plist` echo >&2 "checking config in $conf" -- cgit v1.2.3 From 2788e4fa981566e34fa40938705cd7f595f05e74 Mon Sep 17 00:00:00 2001 From: Andrew Lubawy Date: Mon, 17 Jun 2024 11:56:58 -0700 Subject: Use `sysadminctl` instead of `dscl` Co-authored-by: Michael Hoang --- tests/users-groups.nix | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'tests') diff --git a/tests/users-groups.nix b/tests/users-groups.nix index feaaf2b..b619f9b 100644 --- a/tests/users-groups.nix +++ b/tests/users-groups.nix @@ -22,13 +22,15 @@ users.users."unknown.user".uid = 42002; test = '' - echo "checking group creation in /activate" >&2 + set -v + + # checking group creation in /activate grep "dscl . -create '/Groups/foo' PrimaryGroupID 42000" ${config.out}/activate grep "dscl . -create '/Groups/foo' RealName 'Foo group'" ${config.out}/activate grep "dscl . -create '/Groups/created.group' PrimaryGroupID 42001" ${config.out}/activate grep -qv "dscl . -delete '/Groups/created.group'" ${config.out}/activate - echo "checking group deletion in /activate" >&2 + # checking group deletion in /activate grep "dscl . -delete '/Groups/deleted.group'" ${config.out}/activate grep -qv "dscl . -create '/Groups/deleted.group'" ${config.out}/activate @@ -36,28 +38,28 @@ grep "dscl . -create '/Groups/foo' GroupMembership 'admin' 'foo'" ${config.out}/activate grep "dscl . -create '/Groups/created.group' GroupMembership" ${config.out}/activate - echo "checking unknown group in /activate" >&2 + # checking unknown group in /activate grep -qv "dscl . -create '/Groups/unknown.group'" ${config.out}/activate grep -qv "dscl . -delete '/Groups/unknown.group'" ${config.out}/activate - echo "checking user creation in /activate" >&2 - grep "dscl . -create '/Users/foo' UniqueID 42000" ${config.out}/activate - grep "dscl . -create '/Users/foo' PrimaryGroupID 42000" ${config.out}/activate - grep "dscl . -create '/Users/foo' IsHidden 0" ${config.out}/activate - grep "dscl . -create '/Users/foo' RealName 'Foo user'" ${config.out}/activate - grep "dscl . -create '/Users/foo' NFSHomeDirectory '/Users/foo'" ${config.out}/activate - grep "dscl . -create '/Users/foo' UserShell ${lib.escapeShellArg "/run/current-system/sw/bin/bash"}" ${config.out}/activate - grep "dscl . -create '/Users/created.user' UniqueID 42001" ${config.out}/activate - grep "dscl . -create '/Users/created.user' UserShell ${lib.escapeShellArg "/sbin/nologin"}" ${config.out}/activate + # checking user creation in /activate + grep -zoP "sysadminctl -addUser 'foo' (.|\n)* -UID 42000 (.|\n)* -GID 42000 (.|\n)* -fullName 'Foo user' (.|\n)* -home '/Users/foo' (.|\n)* -shell ${lib.escapeShellArg "/run/current-system/sw/bin/bash"}" ${config.out}/activate grep "createhomedir -cu 'foo'" ${config.out}/activate - grep -qv "dscl . -delete '/Groups/created.user'" ${config.out}/activate + grep -zoP "sysadminctl -addUser 'created.user' (.|\n)* -UID 42001 (.|\n)* -shell ${lib.escapeShellArg "/sbin/nologin"}" ${config.out}/activate + grep -qv "sysadminctl -deleteUser 'created.user'" ${config.out}/activate + grep -qv "sysadminctl -deleteUser 'created.user'" ${config.out}/activate + + # checking user properties always get updated in /activate + grep "dscl . -create '/Users/foo' UserShell ${lib.escapeShellArg "/run/current-system/sw/bin/bash"}" ${config.out}/activate + + # checking user deletion in /activate + grep "sysadminctl -deleteUser 'deleted.user'" ${config.out}/activate + grep -qv "sysadminctl -addUser 'deleted.user'" ${config.out}/activate - echo "checking user deletion in /activate" >&2 - grep "dscl . -delete '/Users/deleted.user'" ${config.out}/activate - grep -qv "dscl . -create '/Users/deleted.user'" ${config.out}/activate + # checking unknown user in /activate + grep -qv "sysadminctl -addUser 'unknown.user'" ${config.out}/activate + grep -qv "sysadminctl -deleteUser 'unknown.user'" ${config.out}/activate - echo "checking unknown user in /activate" >&2 - grep -qv "dscl . -create '/Users/unknown.user'" ${config.out}/activate - grep -qv "dscl . -delete '/Users/unknown.user'" ${config.out}/activate + set +v ''; } -- cgit v1.2.3 From cb2e5fa6c5d99c581f9669e66e61ac1585ab56ad Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Tue, 22 Oct 2024 07:05:10 +1100 Subject: users: use `lib.escapeShellArg` for `sysadminctl -deleteUser` --- tests/users-groups.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/users-groups.nix b/tests/users-groups.nix index b619f9b..a4aaf2a 100644 --- a/tests/users-groups.nix +++ b/tests/users-groups.nix @@ -46,19 +46,19 @@ grep -zoP "sysadminctl -addUser 'foo' (.|\n)* -UID 42000 (.|\n)* -GID 42000 (.|\n)* -fullName 'Foo user' (.|\n)* -home '/Users/foo' (.|\n)* -shell ${lib.escapeShellArg "/run/current-system/sw/bin/bash"}" ${config.out}/activate grep "createhomedir -cu 'foo'" ${config.out}/activate grep -zoP "sysadminctl -addUser 'created.user' (.|\n)* -UID 42001 (.|\n)* -shell ${lib.escapeShellArg "/sbin/nologin"}" ${config.out}/activate - grep -qv "sysadminctl -deleteUser 'created.user'" ${config.out}/activate - grep -qv "sysadminctl -deleteUser 'created.user'" ${config.out}/activate + grep -qv "sysadminctl -deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate + grep -qv "sysadminctl -deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate # checking user properties always get updated in /activate grep "dscl . -create '/Users/foo' UserShell ${lib.escapeShellArg "/run/current-system/sw/bin/bash"}" ${config.out}/activate # checking user deletion in /activate - grep "sysadminctl -deleteUser 'deleted.user'" ${config.out}/activate + grep "sysadminctl -deleteUser ${lib.escapeShellArg "deleted.user"}" ${config.out}/activate grep -qv "sysadminctl -addUser 'deleted.user'" ${config.out}/activate # checking unknown user in /activate grep -qv "sysadminctl -addUser 'unknown.user'" ${config.out}/activate - grep -qv "sysadminctl -deleteUser 'unknown.user'" ${config.out}/activate + grep -qv "sysadminctl -deleteUser ${lib.escapeShellArg "unknown.user"}" ${config.out}/activate set +v ''; -- cgit v1.2.3 From 26f7e45fb117171c9e8b27a34cfccb91ef50f068 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Tue, 22 Oct 2024 09:29:56 +1100 Subject: users: use `lib.escapeShellArgs` for `sysadminctl -addUser` --- tests/users-groups.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/users-groups.nix b/tests/users-groups.nix index a4aaf2a..bdbabe1 100644 --- a/tests/users-groups.nix +++ b/tests/users-groups.nix @@ -43,9 +43,9 @@ grep -qv "dscl . -delete '/Groups/unknown.group'" ${config.out}/activate # checking user creation in /activate - grep -zoP "sysadminctl -addUser 'foo' (.|\n)* -UID 42000 (.|\n)* -GID 42000 (.|\n)* -fullName 'Foo user' (.|\n)* -home '/Users/foo' (.|\n)* -shell ${lib.escapeShellArg "/run/current-system/sw/bin/bash"}" ${config.out}/activate + grep "sysadminctl -addUser ${lib.escapeShellArgs [ "foo" "-UID" 42000 "-GID" 42000 "-fullName" "Foo user" "-home" "/Users/foo" "-shell" "/run/current-system/sw/bin/bash" ]}" ${config.out}/activate grep "createhomedir -cu 'foo'" ${config.out}/activate - grep -zoP "sysadminctl -addUser 'created.user' (.|\n)* -UID 42001 (.|\n)* -shell ${lib.escapeShellArg "/sbin/nologin"}" ${config.out}/activate + grep "sysadminctl -addUser ${lib.escapeShellArgs [ "created.user" "-UID" 42001 ]} .* ${lib.escapeShellArgs [ "-shell" "/sbin/nologin" ]}" ${config.out}/activate grep -qv "sysadminctl -deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate grep -qv "sysadminctl -deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate @@ -54,10 +54,10 @@ # checking user deletion in /activate grep "sysadminctl -deleteUser ${lib.escapeShellArg "deleted.user"}" ${config.out}/activate - grep -qv "sysadminctl -addUser 'deleted.user'" ${config.out}/activate + grep -qv "sysadminctl -addUser ${lib.escapeShellArg "deleted.user"}" ${config.out}/activate # checking unknown user in /activate - grep -qv "sysadminctl -addUser 'unknown.user'" ${config.out}/activate + grep -qv "sysadminctl -addUser ${lib.escapeShellArg "unknown.user"}" ${config.out}/activate grep -qv "sysadminctl -deleteUser ${lib.escapeShellArg "unknown.user"}" ${config.out}/activate set +v -- cgit v1.2.3 From 7bb6366f40dd4ef6efe3223e6dffb3dd7f8dea66 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Tue, 22 Oct 2024 09:43:19 +1100 Subject: users: use `lib.escapeShellArgs` instead of custom version --- tests/users-groups.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/users-groups.nix b/tests/users-groups.nix index bdbabe1..17b8c0d 100644 --- a/tests/users-groups.nix +++ b/tests/users-groups.nix @@ -35,7 +35,7 @@ grep -qv "dscl . -create '/Groups/deleted.group'" ${config.out}/activate echo "checking group membership in /activate" >&2 - grep "dscl . -create '/Groups/foo' GroupMembership 'admin' 'foo'" ${config.out}/activate + grep "dscl . -create '/Groups/foo' GroupMembership ${lib.escapeShellArgs [ "admin" "foo" ]}" ${config.out}/activate grep "dscl . -create '/Groups/created.group' GroupMembership" ${config.out}/activate # checking unknown group in /activate -- cgit v1.2.3 From 7a3ec6459c4394767ebcc136c0da0bb0c73d76ed Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Tue, 22 Oct 2024 09:34:25 +1100 Subject: networking: use `lib.escapeShellArgs` instead of custom version --- tests/networking-networkservices.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/networking-networkservices.nix b/tests/networking-networkservices.nix index 4621317..a657342 100644 --- a/tests/networking-networkservices.nix +++ b/tests/networking-networkservices.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, lib, ... }: { networking.knownNetworkServices = [ "Wi-Fi" "Thunderbolt Ethernet" ]; @@ -6,10 +6,10 @@ test = '' echo checking dns settings in /activate >&2 - grep "networksetup -setdnsservers 'Wi-Fi' '8.8.8.8' '8.8.4.4'" ${config.out}/activate - grep "networksetup -setdnsservers 'Thunderbolt Ethernet' '8.8.8.8' '8.8.4.4'" ${config.out}/activate + grep "networksetup -setdnsservers ${lib.escapeShellArgs [ "Wi-Fi" "8.8.8.8" "8.8.4.4" ]}" ${config.out}/activate + grep "networksetup -setdnsservers ${lib.escapeShellArgs [ "Thunderbolt Ethernet" "8.8.8.8" "8.8.4.4" ]}" ${config.out}/activate echo checking empty searchdomain settings in /activate >&2 - grep "networksetup -setsearchdomains 'Wi-Fi' 'empty'" ${config.out}/activate - grep "networksetup -setsearchdomains 'Thunderbolt Ethernet' 'empty'" ${config.out}/activate + grep "networksetup -setsearchdomains ${lib.escapeShellArgs [ "Wi-Fi" "empty" ]}" ${config.out}/activate + grep "networksetup -setsearchdomains ${lib.escapeShellArgs [ "Thunderbolt Ethernet" "empty" ]}" ${config.out}/activate ''; } -- cgit v1.2.3 From 8451125cf8eab07056da090a4616ce46a1952ff9 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Tue, 22 Oct 2024 10:08:41 +1100 Subject: users: use `lib.escapeShellArg` for `dscl` paths --- tests/users-groups.nix | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/users-groups.nix b/tests/users-groups.nix index 17b8c0d..72c6e0c 100644 --- a/tests/users-groups.nix +++ b/tests/users-groups.nix @@ -25,22 +25,22 @@ set -v # checking group creation in /activate - grep "dscl . -create '/Groups/foo' PrimaryGroupID 42000" ${config.out}/activate - grep "dscl . -create '/Groups/foo' RealName 'Foo group'" ${config.out}/activate - grep "dscl . -create '/Groups/created.group' PrimaryGroupID 42001" ${config.out}/activate - grep -qv "dscl . -delete '/Groups/created.group'" ${config.out}/activate + grep "dscl . -create ${lib.escapeShellArg "/Groups/foo"} PrimaryGroupID 42000" ${config.out}/activate + grep "dscl . -create ${lib.escapeShellArg "/Groups/foo"} RealName 'Foo group'" ${config.out}/activate + grep "dscl . -create ${lib.escapeShellArg "/Groups/created.group"} PrimaryGroupID 42001" ${config.out}/activate + grep -qv "dscl . -delete ${lib.escapeShellArg "/Groups/created.group"}" ${config.out}/activate # checking group deletion in /activate - grep "dscl . -delete '/Groups/deleted.group'" ${config.out}/activate - grep -qv "dscl . -create '/Groups/deleted.group'" ${config.out}/activate + grep "dscl . -delete ${lib.escapeShellArg "/Groups/deleted.group"}" ${config.out}/activate + grep -qv "dscl . -create ${lib.escapeShellArg "/Groups/deleted.group"}" ${config.out}/activate echo "checking group membership in /activate" >&2 - grep "dscl . -create '/Groups/foo' GroupMembership ${lib.escapeShellArgs [ "admin" "foo" ]}" ${config.out}/activate - grep "dscl . -create '/Groups/created.group' GroupMembership" ${config.out}/activate + grep "dscl . -create ${lib.escapeShellArg "/Groups/foo"} GroupMembership ${lib.escapeShellArgs [ "admin" "foo" ]}" ${config.out}/activate + grep "dscl . -create ${lib.escapeShellArg "/Groups/created.group"} GroupMembership" ${config.out}/activate # checking unknown group in /activate - grep -qv "dscl . -create '/Groups/unknown.group'" ${config.out}/activate - grep -qv "dscl . -delete '/Groups/unknown.group'" ${config.out}/activate + grep -qv "dscl . -create ${lib.escapeShellArg "/Groups/unknown.group"}" ${config.out}/activate + grep -qv "dscl . -delete ${lib.escapeShellArg "/Groups/unknown.group"}" ${config.out}/activate # checking user creation in /activate grep "sysadminctl -addUser ${lib.escapeShellArgs [ "foo" "-UID" 42000 "-GID" 42000 "-fullName" "Foo user" "-home" "/Users/foo" "-shell" "/run/current-system/sw/bin/bash" ]}" ${config.out}/activate @@ -50,7 +50,7 @@ grep -qv "sysadminctl -deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate # checking user properties always get updated in /activate - grep "dscl . -create '/Users/foo' UserShell ${lib.escapeShellArg "/run/current-system/sw/bin/bash"}" ${config.out}/activate + grep "dscl . -create ${lib.escapeShellArg "/Users/foo"} UserShell ${lib.escapeShellArg "/run/current-system/sw/bin/bash"}" ${config.out}/activate # checking user deletion in /activate grep "sysadminctl -deleteUser ${lib.escapeShellArg "deleted.user"}" ${config.out}/activate -- cgit v1.2.3 From ea7e178ad4113c2134c5b734e3198ebbc591af0b Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Tue, 22 Oct 2024 10:20:43 +1100 Subject: users: use `lib.escapeShellArg` for `createhomedir` --- tests/users-groups.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/users-groups.nix b/tests/users-groups.nix index 72c6e0c..87babb3 100644 --- a/tests/users-groups.nix +++ b/tests/users-groups.nix @@ -44,7 +44,7 @@ # checking user creation in /activate grep "sysadminctl -addUser ${lib.escapeShellArgs [ "foo" "-UID" 42000 "-GID" 42000 "-fullName" "Foo user" "-home" "/Users/foo" "-shell" "/run/current-system/sw/bin/bash" ]}" ${config.out}/activate - grep "createhomedir -cu 'foo'" ${config.out}/activate + grep "createhomedir -cu ${lib.escapeShellArg "foo"}" ${config.out}/activate grep "sysadminctl -addUser ${lib.escapeShellArgs [ "created.user" "-UID" 42001 ]} .* ${lib.escapeShellArgs [ "-shell" "/sbin/nologin" ]}" ${config.out}/activate grep -qv "sysadminctl -deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate grep -qv "sysadminctl -deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate -- cgit v1.2.3 From ac7932f9de36b8126abcb9d4966d5d95fcadd807 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Tue, 22 Oct 2024 10:24:06 +1100 Subject: users: use `lib.escapeShellArg` for group description --- tests/users-groups.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/users-groups.nix b/tests/users-groups.nix index 87babb3..d15909b 100644 --- a/tests/users-groups.nix +++ b/tests/users-groups.nix @@ -26,7 +26,7 @@ # checking group creation in /activate grep "dscl . -create ${lib.escapeShellArg "/Groups/foo"} PrimaryGroupID 42000" ${config.out}/activate - grep "dscl . -create ${lib.escapeShellArg "/Groups/foo"} RealName 'Foo group'" ${config.out}/activate + grep "dscl . -create ${lib.escapeShellArg "/Groups/foo"} RealName ${lib.escapeShellArg "Foo group"}" ${config.out}/activate grep "dscl . -create ${lib.escapeShellArg "/Groups/created.group"} PrimaryGroupID 42001" ${config.out}/activate grep -qv "dscl . -delete ${lib.escapeShellArg "/Groups/created.group"}" ${config.out}/activate -- cgit v1.2.3 From 8c02940d702170feea7947f768aa807c11b65a41 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Tue, 22 Oct 2024 22:38:17 +1100 Subject: users: ensure Full Disk Access is granted before trying to delete users --- tests/users-groups.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/users-groups.nix b/tests/users-groups.nix index d15909b..7df92ba 100644 --- a/tests/users-groups.nix +++ b/tests/users-groups.nix @@ -46,19 +46,19 @@ grep "sysadminctl -addUser ${lib.escapeShellArgs [ "foo" "-UID" 42000 "-GID" 42000 "-fullName" "Foo user" "-home" "/Users/foo" "-shell" "/run/current-system/sw/bin/bash" ]}" ${config.out}/activate grep "createhomedir -cu ${lib.escapeShellArg "foo"}" ${config.out}/activate grep "sysadminctl -addUser ${lib.escapeShellArgs [ "created.user" "-UID" 42001 ]} .* ${lib.escapeShellArgs [ "-shell" "/sbin/nologin" ]}" ${config.out}/activate - grep -qv "sysadminctl -deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate - grep -qv "sysadminctl -deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate + grep -qv "deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate + grep -qv "deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate # checking user properties always get updated in /activate grep "dscl . -create ${lib.escapeShellArg "/Users/foo"} UserShell ${lib.escapeShellArg "/run/current-system/sw/bin/bash"}" ${config.out}/activate # checking user deletion in /activate - grep "sysadminctl -deleteUser ${lib.escapeShellArg "deleted.user"}" ${config.out}/activate + grep "deleteUser ${lib.escapeShellArg "deleted.user"}" ${config.out}/activate grep -qv "sysadminctl -addUser ${lib.escapeShellArg "deleted.user"}" ${config.out}/activate # checking unknown user in /activate grep -qv "sysadminctl -addUser ${lib.escapeShellArg "unknown.user"}" ${config.out}/activate - grep -qv "sysadminctl -deleteUser ${lib.escapeShellArg "unknown.user"}" ${config.out}/activate + grep -qv "deleteUser ${lib.escapeShellArg "unknown.user"}" ${config.out}/activate set +v ''; -- cgit v1.2.3 From 5907cbbb31d9de387349efb825864a9ee598e6ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20B=C3=B8rgesen?= Date: Sat, 18 Nov 2023 14:18:06 +0100 Subject: networking: Add wakeOnLan option --- tests/networking-wakeonlan.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/networking-wakeonlan.nix (limited to 'tests') diff --git a/tests/networking-wakeonlan.nix b/tests/networking-wakeonlan.nix new file mode 100644 index 0000000..745c39c --- /dev/null +++ b/tests/networking-wakeonlan.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + networking.wakeOnLan.enable = true; + + test = '' + echo checking wake on network access settings in /activate >&2 + grep "systemsetup -setWakeOnNetworkAccess 'on'" ${config.out}/activate + ''; +} -- cgit v1.2.3 From f737259769ef4722ed956bcaaab67509b96c23cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20B=C3=B8rgesen?= Date: Sun, 19 Nov 2023 00:52:02 +0100 Subject: power,sleep: Add options to control restart and sleep behavior --- tests/power-restart.nix | 12 ++++++++++++ tests/power-sleep.nix | 16 ++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/power-restart.nix create mode 100644 tests/power-sleep.nix (limited to 'tests') diff --git a/tests/power-restart.nix b/tests/power-restart.nix new file mode 100644 index 0000000..ade9851 --- /dev/null +++ b/tests/power-restart.nix @@ -0,0 +1,12 @@ +{ config, pkgs, ... }: + +{ + power.restartAfterPowerFailure = true; + power.restartAfterFreeze = true; + + test = '' + echo checking restart power settings in /activate >&2 + grep "systemsetup -setRestartPowerFailure 'on'" ${config.out}/activate + grep "systemsetup -setRestartFreeze 'on'" ${config.out}/activate + ''; +} diff --git a/tests/power-sleep.nix b/tests/power-sleep.nix new file mode 100644 index 0000000..5d779a6 --- /dev/null +++ b/tests/power-sleep.nix @@ -0,0 +1,16 @@ +{ config, pkgs, ... }: + +{ + power.sleep.computer = "never"; + power.sleep.display = 15; + power.sleep.harddisk = 5; + power.sleep.allowSleepByPowerButton = false; + + test = '' + echo checking power sleep settings in /activate >&2 + grep "systemsetup -setComputerSleep 'never'" ${config.out}/activate + grep "systemsetup -setDisplaySleep '15'" ${config.out}/activate + grep "systemsetup -setHardDiskSleep '5'" ${config.out}/activate + grep "systemsetup -setAllowPowerButtonToSleepComputer 'off'" ${config.out}/activate + ''; +} -- cgit v1.2.3 From fd6660cb9182fde5e593246e311dc3c2dd4b9d13 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Thu, 24 Oct 2024 23:55:25 +1100 Subject: tests: fix negative asserts with `grep` not working Using `grep -v` without `-z` will return 0 even if there is a match found as all the non-matching lines will be matched. Instead of using `grep -vqz`, `(! grep ...)` is more readable. The brackets are necessary as `! grep` will not trigger `set -e`[0], so we run it inside a subshell to use its non-zero exit code. [0]: https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#The-Set-Builtin --- tests/programs-zsh.nix | 2 +- tests/users-groups.nix | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/programs-zsh.nix b/tests/programs-zsh.nix index 9c98c33..18680a5 100644 --- a/tests/programs-zsh.nix +++ b/tests/programs-zsh.nix @@ -34,7 +34,7 @@ echo >&2 "checking compinit in /etc/zshrc" grep 'autoload -U compinit && compinit' ${config.out}/etc/zshrc echo >&2 "checking bashcompinit in /etc/zshrc" - grep -vq 'bashcompinit' ${config.out}/etc/zshrc + (! grep 'bashcompinit' ${config.out}/etc/zshrc) echo >&2 "checking zprofile.d in /etc/zprofile" grep 'source /etc/zprofile.d/\*.conf' ${config.out}/etc/zprofile diff --git a/tests/users-groups.nix b/tests/users-groups.nix index 7df92ba..5b4f1ae 100644 --- a/tests/users-groups.nix +++ b/tests/users-groups.nix @@ -28,37 +28,37 @@ grep "dscl . -create ${lib.escapeShellArg "/Groups/foo"} PrimaryGroupID 42000" ${config.out}/activate grep "dscl . -create ${lib.escapeShellArg "/Groups/foo"} RealName ${lib.escapeShellArg "Foo group"}" ${config.out}/activate grep "dscl . -create ${lib.escapeShellArg "/Groups/created.group"} PrimaryGroupID 42001" ${config.out}/activate - grep -qv "dscl . -delete ${lib.escapeShellArg "/Groups/created.group"}" ${config.out}/activate + (! grep "dscl . -delete ${lib.escapeShellArg "/Groups/created.group"}" ${config.out}/activate) # checking group deletion in /activate grep "dscl . -delete ${lib.escapeShellArg "/Groups/deleted.group"}" ${config.out}/activate - grep -qv "dscl . -create ${lib.escapeShellArg "/Groups/deleted.group"}" ${config.out}/activate + (! grep "dscl . -create ${lib.escapeShellArg "/Groups/deleted.group"}" ${config.out}/activate) echo "checking group membership in /activate" >&2 grep "dscl . -create ${lib.escapeShellArg "/Groups/foo"} GroupMembership ${lib.escapeShellArgs [ "admin" "foo" ]}" ${config.out}/activate grep "dscl . -create ${lib.escapeShellArg "/Groups/created.group"} GroupMembership" ${config.out}/activate # checking unknown group in /activate - grep -qv "dscl . -create ${lib.escapeShellArg "/Groups/unknown.group"}" ${config.out}/activate - grep -qv "dscl . -delete ${lib.escapeShellArg "/Groups/unknown.group"}" ${config.out}/activate + (! grep "dscl . -create ${lib.escapeShellArg "/Groups/unknown.group"}" ${config.out}/activate) + (! grep "dscl . -delete ${lib.escapeShellArg "/Groups/unknown.group"}" ${config.out}/activate) # checking user creation in /activate grep "sysadminctl -addUser ${lib.escapeShellArgs [ "foo" "-UID" 42000 "-GID" 42000 "-fullName" "Foo user" "-home" "/Users/foo" "-shell" "/run/current-system/sw/bin/bash" ]}" ${config.out}/activate grep "createhomedir -cu ${lib.escapeShellArg "foo"}" ${config.out}/activate grep "sysadminctl -addUser ${lib.escapeShellArgs [ "created.user" "-UID" 42001 ]} .* ${lib.escapeShellArgs [ "-shell" "/sbin/nologin" ]}" ${config.out}/activate - grep -qv "deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate - grep -qv "deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate + (! grep "deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate) + (! grep "deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate) # checking user properties always get updated in /activate grep "dscl . -create ${lib.escapeShellArg "/Users/foo"} UserShell ${lib.escapeShellArg "/run/current-system/sw/bin/bash"}" ${config.out}/activate # checking user deletion in /activate grep "deleteUser ${lib.escapeShellArg "deleted.user"}" ${config.out}/activate - grep -qv "sysadminctl -addUser ${lib.escapeShellArg "deleted.user"}" ${config.out}/activate + (! grep "sysadminctl -addUser ${lib.escapeShellArg "deleted.user"}" ${config.out}/activate) # checking unknown user in /activate - grep -qv "sysadminctl -addUser ${lib.escapeShellArg "unknown.user"}" ${config.out}/activate - grep -qv "deleteUser ${lib.escapeShellArg "unknown.user"}" ${config.out}/activate + (! grep "sysadminctl -addUser ${lib.escapeShellArg "unknown.user"}" ${config.out}/activate) + (! grep "deleteUser ${lib.escapeShellArg "unknown.user"}" ${config.out}/activate) set +v ''; -- cgit v1.2.3 From 13816f682d1f604271651fec193961ee76610670 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Fri, 25 Oct 2024 01:07:34 +1100 Subject: tests: fix old test getting messed up in refactor https://github.com/LnL7/nix-darwin/commit/2788e4fa981566e34fa40938705cd7f595f05e74#diff-0642dcb4e551dcf07032904ee7f6b7ea645db36939f159908ccb2b85a2bbd1b8L53 --- tests/users-groups.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/users-groups.nix b/tests/users-groups.nix index 5b4f1ae..fa6dcc3 100644 --- a/tests/users-groups.nix +++ b/tests/users-groups.nix @@ -47,7 +47,7 @@ grep "createhomedir -cu ${lib.escapeShellArg "foo"}" ${config.out}/activate grep "sysadminctl -addUser ${lib.escapeShellArgs [ "created.user" "-UID" 42001 ]} .* ${lib.escapeShellArgs [ "-shell" "/sbin/nologin" ]}" ${config.out}/activate (! grep "deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate) - (! grep "deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate) + (! grep "dscl . -delete ${lib.escapeShellArg "/Groups/created.user"}" ${config.out}/activate) # checking user properties always get updated in /activate grep "dscl . -create ${lib.escapeShellArg "/Users/foo"} UserShell ${lib.escapeShellArg "/run/current-system/sw/bin/bash"}" ${config.out}/activate -- cgit v1.2.3 From c9af5c2d1394d1bc34f4722998bcd51714ccd68c Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Thu, 24 Oct 2024 22:58:35 +1100 Subject: users: update properties on known users --- tests/users-groups.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/users-groups.nix b/tests/users-groups.nix index fa6dcc3..d06eedd 100644 --- a/tests/users-groups.nix +++ b/tests/users-groups.nix @@ -19,6 +19,8 @@ users.users.foo.shell = pkgs.bashInteractive; users.users."created.user".uid = 42001; + users.users."created.user".description = null; + users.users."unknown.user".uid = 42002; test = '' @@ -39,6 +41,7 @@ grep "dscl . -create ${lib.escapeShellArg "/Groups/created.group"} GroupMembership" ${config.out}/activate # checking unknown group in /activate + # checking groups not in knownGroups don't appear in /activate (! grep "dscl . -create ${lib.escapeShellArg "/Groups/unknown.group"}" ${config.out}/activate) (! grep "dscl . -delete ${lib.escapeShellArg "/Groups/unknown.group"}" ${config.out}/activate) @@ -50,15 +53,23 @@ (! grep "dscl . -delete ${lib.escapeShellArg "/Groups/created.user"}" ${config.out}/activate) # checking user properties always get updated in /activate + grep "dscl . -create ${lib.escapeShellArg "/Users/foo"} PrimaryGroupID 42000" ${config.out}/activate + grep "dscl . -create ${lib.escapeShellArg "/Users/foo"} RealName ${lib.escapeShellArg "Foo user"}" ${config.out}/activate + grep "createhomedir -cu ${lib.escapeShellArg "foo"}" ${config.out}/activate grep "dscl . -create ${lib.escapeShellArg "/Users/foo"} UserShell ${lib.escapeShellArg "/run/current-system/sw/bin/bash"}" ${config.out}/activate + grep "dscl . -create ${lib.escapeShellArg "/Users/foo"} IsHidden 0" ${config.out}/activate + + # checking user properties that are null don't get updated in /activate + (! grep "dscl . -create ${lib.escapeShellArg "/Users/created.user"} RealName" ${config.out}/activate) # checking user deletion in /activate grep "deleteUser ${lib.escapeShellArg "deleted.user"}" ${config.out}/activate (! grep "sysadminctl -addUser ${lib.escapeShellArg "deleted.user"}" ${config.out}/activate) - # checking unknown user in /activate + # checking that users not specified in knownUsers doesn't get changed in /activate (! grep "sysadminctl -addUser ${lib.escapeShellArg "unknown.user"}" ${config.out}/activate) (! grep "deleteUser ${lib.escapeShellArg "unknown.user"}" ${config.out}/activate) + (! grep "dscl . -create ${lib.escapeShellArg "/Users/unknown.user"}" ${config.out}/activate) set +v ''; -- cgit v1.2.3 From bd161d61d6f322e1c16543b67b1dbd13934e763c Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Thu, 24 Oct 2024 23:19:27 +1100 Subject: users: allow `home` to be managed by macOS --- tests/users-groups.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/users-groups.nix b/tests/users-groups.nix index d06eedd..8fc435a 100644 --- a/tests/users-groups.nix +++ b/tests/users-groups.nix @@ -20,6 +20,7 @@ users.users."created.user".uid = 42001; users.users."created.user".description = null; + users.users."created.user".home = null; users.users."unknown.user".uid = 42002; @@ -49,6 +50,7 @@ grep "sysadminctl -addUser ${lib.escapeShellArgs [ "foo" "-UID" 42000 "-GID" 42000 "-fullName" "Foo user" "-home" "/Users/foo" "-shell" "/run/current-system/sw/bin/bash" ]}" ${config.out}/activate grep "createhomedir -cu ${lib.escapeShellArg "foo"}" ${config.out}/activate grep "sysadminctl -addUser ${lib.escapeShellArgs [ "created.user" "-UID" 42001 ]} .* ${lib.escapeShellArgs [ "-shell" "/sbin/nologin" ]}" ${config.out}/activate + (! grep "sysadminctl -addUser ${lib.escapeShellArg "created.user"} .* -home" ${config.out}/activate) (! grep "deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate) (! grep "dscl . -delete ${lib.escapeShellArg "/Groups/created.user"}" ${config.out}/activate) -- cgit v1.2.3 From 3712ff78ccacd65c819435a310fe8b1a8a2de2ee Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Sat, 26 Oct 2024 11:35:34 +1100 Subject: users: change default shell to `/usr/bin/false` to match macOS --- tests/users-groups.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/users-groups.nix b/tests/users-groups.nix index 8fc435a..290b94b 100644 --- a/tests/users-groups.nix +++ b/tests/users-groups.nix @@ -49,7 +49,7 @@ # checking user creation in /activate grep "sysadminctl -addUser ${lib.escapeShellArgs [ "foo" "-UID" 42000 "-GID" 42000 "-fullName" "Foo user" "-home" "/Users/foo" "-shell" "/run/current-system/sw/bin/bash" ]}" ${config.out}/activate grep "createhomedir -cu ${lib.escapeShellArg "foo"}" ${config.out}/activate - grep "sysadminctl -addUser ${lib.escapeShellArgs [ "created.user" "-UID" 42001 ]} .* ${lib.escapeShellArgs [ "-shell" "/sbin/nologin" ]}" ${config.out}/activate + grep "sysadminctl -addUser ${lib.escapeShellArgs [ "created.user" "-UID" 42001 ]} .* ${lib.escapeShellArgs [ "-shell" "/usr/bin/false" ]}" ${config.out}/activate (! grep "sysadminctl -addUser ${lib.escapeShellArg "created.user"} .* -home" ${config.out}/activate) (! grep "deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate) (! grep "dscl . -delete ${lib.escapeShellArg "/Groups/created.user"}" ${config.out}/activate) -- cgit v1.2.3 From dc6f754fe5d3b0d1ee6b033495c87ec3199a7f68 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Fri, 25 Oct 2024 01:16:19 +1100 Subject: users: allow `shell` to be managed by macOS --- tests/users-groups.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/users-groups.nix b/tests/users-groups.nix index 290b94b..cf2f008 100644 --- a/tests/users-groups.nix +++ b/tests/users-groups.nix @@ -21,6 +21,7 @@ users.users."created.user".uid = 42001; users.users."created.user".description = null; users.users."created.user".home = null; + users.users."created.user".shell = null; users.users."unknown.user".uid = 42002; @@ -49,7 +50,7 @@ # checking user creation in /activate grep "sysadminctl -addUser ${lib.escapeShellArgs [ "foo" "-UID" 42000 "-GID" 42000 "-fullName" "Foo user" "-home" "/Users/foo" "-shell" "/run/current-system/sw/bin/bash" ]}" ${config.out}/activate grep "createhomedir -cu ${lib.escapeShellArg "foo"}" ${config.out}/activate - grep "sysadminctl -addUser ${lib.escapeShellArgs [ "created.user" "-UID" 42001 ]} .* ${lib.escapeShellArgs [ "-shell" "/usr/bin/false" ]}" ${config.out}/activate + grep "sysadminctl -addUser ${lib.escapeShellArgs [ "created.user" "-UID" 42001 ]} .* ${lib.escapeShellArgs [ "-shell" "/usr/bin/false" ] }" ${config.out}/activate (! grep "sysadminctl -addUser ${lib.escapeShellArg "created.user"} .* -home" ${config.out}/activate) (! grep "deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate) (! grep "dscl . -delete ${lib.escapeShellArg "/Groups/created.user"}" ${config.out}/activate) @@ -63,6 +64,7 @@ # checking user properties that are null don't get updated in /activate (! grep "dscl . -create ${lib.escapeShellArg "/Users/created.user"} RealName" ${config.out}/activate) + (! grep "dscl . -create ${lib.escapeShellArg "/Users/created.user"} UserShell" ${config.out}/activate) # checking user deletion in /activate grep "deleteUser ${lib.escapeShellArg "deleted.user"}" ${config.out}/activate -- cgit v1.2.3 From 32f0cf2140af6a852f8c8b6c8f15e4855d461b87 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Mon, 28 Oct 2024 00:37:55 +1100 Subject: users: replace FDA check with more fine grained permissions check --- tests/users-groups.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/users-groups.nix b/tests/users-groups.nix index cf2f008..34ee5c2 100644 --- a/tests/users-groups.nix +++ b/tests/users-groups.nix @@ -52,7 +52,7 @@ grep "createhomedir -cu ${lib.escapeShellArg "foo"}" ${config.out}/activate grep "sysadminctl -addUser ${lib.escapeShellArgs [ "created.user" "-UID" 42001 ]} .* ${lib.escapeShellArgs [ "-shell" "/usr/bin/false" ] }" ${config.out}/activate (! grep "sysadminctl -addUser ${lib.escapeShellArg "created.user"} .* -home" ${config.out}/activate) - (! grep "deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate) + (! grep "dscl . -delete ${lib.escapeShellArg "/Users/created.user"}" ${config.out}/activate) (! grep "dscl . -delete ${lib.escapeShellArg "/Groups/created.user"}" ${config.out}/activate) # checking user properties always get updated in /activate @@ -67,12 +67,12 @@ (! grep "dscl . -create ${lib.escapeShellArg "/Users/created.user"} UserShell" ${config.out}/activate) # checking user deletion in /activate - grep "deleteUser ${lib.escapeShellArg "deleted.user"}" ${config.out}/activate + grep "dscl . -delete ${lib.escapeShellArg "/Users/deleted.user"}" ${config.out}/activate (! grep "sysadminctl -addUser ${lib.escapeShellArg "deleted.user"}" ${config.out}/activate) # checking that users not specified in knownUsers doesn't get changed in /activate (! grep "sysadminctl -addUser ${lib.escapeShellArg "unknown.user"}" ${config.out}/activate) - (! grep "deleteUser ${lib.escapeShellArg "unknown.user"}" ${config.out}/activate) + (! grep "dscl . -delete ${lib.escapeShellArg "/Users/unknown.user"}" ${config.out}/activate) (! grep "dscl . -create ${lib.escapeShellArg "/Users/unknown.user"}" ${config.out}/activate) set +v -- cgit v1.2.3 From f380194f3dac82e63dc72db160490dcb58208534 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Mon, 28 Oct 2024 10:30:02 +1100 Subject: users: create users with home directory `/var/empty` by default --- tests/users-groups.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/users-groups.nix b/tests/users-groups.nix index 34ee5c2..8126105 100644 --- a/tests/users-groups.nix +++ b/tests/users-groups.nix @@ -51,7 +51,7 @@ grep "sysadminctl -addUser ${lib.escapeShellArgs [ "foo" "-UID" 42000 "-GID" 42000 "-fullName" "Foo user" "-home" "/Users/foo" "-shell" "/run/current-system/sw/bin/bash" ]}" ${config.out}/activate grep "createhomedir -cu ${lib.escapeShellArg "foo"}" ${config.out}/activate grep "sysadminctl -addUser ${lib.escapeShellArgs [ "created.user" "-UID" 42001 ]} .* ${lib.escapeShellArgs [ "-shell" "/usr/bin/false" ] }" ${config.out}/activate - (! grep "sysadminctl -addUser ${lib.escapeShellArg "created.user"} .* -home" ${config.out}/activate) + grep "sysadminctl -addUser ${lib.escapeShellArg "created.user"} .* ${lib.escapeShellArgs [ "-home" "/var/empty" ]}" ${config.out}/activate (! grep "dscl . -delete ${lib.escapeShellArg "/Users/created.user"}" ${config.out}/activate) (! grep "dscl . -delete ${lib.escapeShellArg "/Groups/created.user"}" ${config.out}/activate) -- cgit v1.2.3 From 0dacfdea635b664812b8065e6b5449c43bf1a586 Mon Sep 17 00:00:00 2001 From: April Schleck Date: Fri, 25 Oct 2024 13:21:56 -0700 Subject: Configure the folder that new Finder windows open --- tests/fixtures/system-defaults-write/activate-user.txt | 10 ++++++++++ tests/system-defaults-write.nix | 2 ++ 2 files changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/fixtures/system-defaults-write/activate-user.txt b/tests/fixtures/system-defaults-write/activate-user.txt index f3e01a6..11d3635 100644 --- a/tests/fixtures/system-defaults-write/activate-user.txt +++ b/tests/fixtures/system-defaults-write/activate-user.txt @@ -329,6 +329,16 @@ defaults write com.apple.finder 'FXPreferredViewStyle' $' Flwv ' +defaults write com.apple.finder 'NewWindowTarget' $' + + +PfLo +' +defaults write com.apple.finder 'NewWindowTargetPath' $' + + +file:///Library/Apple +' defaults write com.apple.finder 'QuitMenuItem' $' diff --git a/tests/system-defaults-write.nix b/tests/system-defaults-write.nix index eae6199..8da9f4e 100644 --- a/tests/system-defaults-write.nix +++ b/tests/system-defaults-write.nix @@ -57,6 +57,8 @@ system.defaults.finder.FXPreferredViewStyle = "Flwv"; system.defaults.finder.AppleShowAllExtensions = true; system.defaults.finder.CreateDesktop = false; + system.defaults.finder.NewWindowTarget = "Other"; + system.defaults.finder.NewWindowTargetPath = "file:///Library/Apple"; system.defaults.finder.QuitMenuItem = true; system.defaults.finder._FXShowPosixPathInTitle = true; system.defaults.finder._FXSortFoldersFirst = true; -- cgit v1.2.3 From 21809c4261a421eb06b2d7b3ccd18ebadd921f96 Mon Sep 17 00:00:00 2001 From: April Schleck Date: Sun, 27 Oct 2024 23:37:08 -0700 Subject: Allow configuring the fn key action --- tests/fixtures/system-defaults-write/activate-user.txt | 5 +++++ tests/system-defaults-write.nix | 1 + 2 files changed, 6 insertions(+) (limited to 'tests') diff --git a/tests/fixtures/system-defaults-write/activate-user.txt b/tests/fixtures/system-defaults-write/activate-user.txt index f3e01a6..34ff728 100644 --- a/tests/fixtures/system-defaults-write/activate-user.txt +++ b/tests/fixtures/system-defaults-write/activate-user.txt @@ -354,6 +354,11 @@ defaults write com.apple.finder '_FXSortFoldersFirst' $' ' +defaults write com.apple.HIToolbox 'AppleFnUsageType' $' + + +2 +' defaults write com.apple.screencapture 'location' $' diff --git a/tests/system-defaults-write.nix b/tests/system-defaults-write.nix index eae6199..d5e0d08 100644 --- a/tests/system-defaults-write.nix +++ b/tests/system-defaults-write.nix @@ -61,6 +61,7 @@ system.defaults.finder._FXShowPosixPathInTitle = true; system.defaults.finder._FXSortFoldersFirst = true; system.defaults.finder.FXEnableExtensionChangeWarning = false; + system.defaults.hitoolbox.AppleFnUsageType = "Show Emoji & Symbols"; system.defaults.screencapture.location = "/tmp"; system.defaults.screensaver.askForPassword = true; system.defaults.screensaver.askForPasswordDelay = 5; -- cgit v1.2.3 From d71aa30b41bac3b2e38bd4b8f49e12811cd27ec1 Mon Sep 17 00:00:00 2001 From: Lucas Mendes Loureiro Date: Sun, 10 Nov 2024 23:12:44 +0000 Subject: feat(defaults): adding support to control center --- .../system-defaults-write/activate-user.txt | 35 ++++++++++++++++++++++ tests/system-defaults-write.nix | 7 +++++ 2 files changed, 42 insertions(+) (limited to 'tests') diff --git a/tests/fixtures/system-defaults-write/activate-user.txt b/tests/fixtures/system-defaults-write/activate-user.txt index 51b7574..57cfe67 100644 --- a/tests/fixtures/system-defaults-write/activate-user.txt +++ b/tests/fixtures/system-defaults-write/activate-user.txt @@ -489,3 +489,38 @@ defaults write com.apple.WindowManager 'StandardHideWidgets' $' ' +defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter 'AirDrop' $' + + +18 +' +defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter 'BatteryShowPercentage' $' + + + +' +defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter 'Bluetooth' $' + + +18 +' +defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter 'Display' $' + + +24 +' +defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter 'FocusModes' $' + + +24 +' +defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter 'NowPlaying' $' + + +18 +' +defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter 'Sound' $' + + +24 +' \ No newline at end of file diff --git a/tests/system-defaults-write.nix b/tests/system-defaults-write.nix index ab26ef1..c5c9b75 100644 --- a/tests/system-defaults-write.nix +++ b/tests/system-defaults-write.nix @@ -94,6 +94,13 @@ true; }; }; + system.defaults.controlcenter.BatteryShowPercentage = true; + system.defaults.controlcenter.Sound = false; + system.defaults.controlcenter.Bluetooth = true; + system.defaults.controlcenter.AirDrop = true; + system.defaults.controlcenter.Display = false; + system.defaults.controlcenter.FocusModes = false; + system.defaults.controlcenter.NowPlaying = true; test = lib.strings.concatMapStringsSep "\n" (x: '' echo >&2 "checking defaults write in /${x}" -- cgit v1.2.3 From 32df51bf2b82dab724b845f4ad2d45bc1a0d0b9e Mon Sep 17 00:00:00 2001 From: Lucas Mendes Loureiro Date: Tue, 12 Nov 2024 01:24:22 +0000 Subject: fix(defaults): fixing #1107 --- .../system-defaults-write/activate-user.txt | 45 ++++++++++++++++++++++ tests/system-defaults-write.nix | 9 +++++ 2 files changed, 54 insertions(+) (limited to 'tests') diff --git a/tests/fixtures/system-defaults-write/activate-user.txt b/tests/fixtures/system-defaults-write/activate-user.txt index 57cfe67..f6e9bba 100644 --- a/tests/fixtures/system-defaults-write/activate-user.txt +++ b/tests/fixtures/system-defaults-write/activate-user.txt @@ -205,6 +205,11 @@ defaults write .GlobalPreferences 'com.apple.sound.beep.sound' $'/System/Library/Sounds/Funk.aiff ' +defaults write com.apple.menuextra.clock 'FlashDateSeparators' $' + + + +' defaults write com.apple.menuextra.clock 'Show24Hour' $' @@ -299,6 +304,11 @@ defaults write com.apple.dock 'persistent-others' $' ' +defaults write com.apple.dock 'scroll-to-open' $' + + + +' defaults write com.apple.finder 'AppleShowAllExtensions' $' @@ -329,6 +339,11 @@ defaults write com.apple.finder 'FXPreferredViewStyle' $' Flwv ' +defaults write com.apple.finder 'FXRemoveOldTrashItems' $' + + + +' defaults write com.apple.finder 'NewWindowTarget' $' @@ -344,11 +359,31 @@ defaults write com.apple.finder 'QuitMenuItem' $' ' +defaults write com.apple.finder 'ShowExternalHardDrivesOnDesktop' $' + + + +' +defaults write com.apple.finder 'ShowHardDrivesOnDesktop' $' + + + +' +defaults write com.apple.finder 'ShowMountedServersOnDesktop' $' + + + +' defaults write com.apple.finder 'ShowPathbar' $' ' +defaults write com.apple.finder 'ShowRemovableMediaOnDesktop' $' + + + +' defaults write com.apple.finder 'ShowStatusBar' $' @@ -364,6 +399,11 @@ defaults write com.apple.finder '_FXSortFoldersFirst' $' ' +defaults write com.apple.finder '_FXSortFoldersFirstOnDesktop' $' + + + +' defaults write com.apple.HIToolbox 'AppleFnUsageType' $' @@ -371,6 +411,11 @@ defaults write com.apple.HIToolbox 'AppleFnUsageType' $'' +defaults write com.apple.screencapture 'include-date' $' + + + +' defaults write com.apple.screencapture 'location' $' diff --git a/tests/system-defaults-write.nix b/tests/system-defaults-write.nix index c5c9b75..078cf82 100644 --- a/tests/system-defaults-write.nix +++ b/tests/system-defaults-write.nix @@ -42,6 +42,7 @@ system.defaults.NSGlobalDomain."com.apple.springing.delay" = 0.0; system.defaults.NSGlobalDomain."com.apple.swipescrolldirection" = true; system.defaults.".GlobalPreferences"."com.apple.sound.beep.sound" = "/System/Library/Sounds/Funk.aiff"; + system.defaults.menuExtraClock.FlashDateSeparators = false; system.defaults.menuExtraClock.Show24Hour = false; system.defaults.menuExtraClock.ShowDayOfWeek = true; system.defaults.menuExtraClock.ShowDate = 2; @@ -50,11 +51,13 @@ system.defaults.dock.orientation = "left"; system.defaults.dock.persistent-apps = ["MyApp.app" "Cool.app"]; system.defaults.dock.persistent-others = ["~/Documents" "~/Downloads/file.txt"]; + system.defaults.dock.scroll-to-open = false; system.defaults.finder.AppleShowAllFiles = true; system.defaults.finder.ShowStatusBar = true; system.defaults.finder.ShowPathbar = true; system.defaults.finder.FXDefaultSearchScope = "SCcf"; system.defaults.finder.FXPreferredViewStyle = "Flwv"; + system.defaults.finder.FXRemoveOldTrashItems = false; system.defaults.finder.AppleShowAllExtensions = true; system.defaults.finder.CreateDesktop = false; system.defaults.finder.NewWindowTarget = "Other"; @@ -62,9 +65,15 @@ system.defaults.finder.QuitMenuItem = true; system.defaults.finder._FXShowPosixPathInTitle = true; system.defaults.finder._FXSortFoldersFirst = true; + system.defaults.finder._FXSortFoldersFirstOnDesktop = false; system.defaults.finder.FXEnableExtensionChangeWarning = false; + system.defaults.finder.ShowExternalHardDrivesOnDesktop = false; + system.defaults.finder.ShowHardDrivesOnDesktop = false; + system.defaults.finder.ShowMountedServersOnDesktop = false; + system.defaults.finder.ShowRemovableMediaOnDesktop = false; system.defaults.hitoolbox.AppleFnUsageType = "Show Emoji & Symbols"; system.defaults.screencapture.location = "/tmp"; + system.defaults.screencapture.include-date = true; system.defaults.screensaver.askForPassword = true; system.defaults.screensaver.askForPasswordDelay = 5; system.defaults.smb.NetBIOSName = "IMAC-000000"; -- cgit v1.2.3 From dae702993d18c608f07e9d320ccba816e9bce064 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Fri, 15 Nov 2024 14:03:43 +1100 Subject: activate-system: remove `enable` option Disabling this is not supported as `/run` gets cleared out on every reboot so it is necessary for ensuring that the `/run/current-system` symlink exists. --- tests/services-activate-system-changed-label-prefix.nix | 1 - tests/services-activate-system.nix | 2 -- 2 files changed, 3 deletions(-) (limited to 'tests') diff --git a/tests/services-activate-system-changed-label-prefix.nix b/tests/services-activate-system-changed-label-prefix.nix index 1ae2bcf..2c2f603 100644 --- a/tests/services-activate-system-changed-label-prefix.nix +++ b/tests/services-activate-system-changed-label-prefix.nix @@ -1,7 +1,6 @@ { config, pkgs, ... }: { - services.activate-system.enable = true; launchd.labelPrefix = "org.nix-darwin"; test = '' diff --git a/tests/services-activate-system.nix b/tests/services-activate-system.nix index c519aa8..702bb26 100644 --- a/tests/services-activate-system.nix +++ b/tests/services-activate-system.nix @@ -1,8 +1,6 @@ { config, pkgs, ... }: { - services.activate-system.enable = true; - test = '' echo checking activation service in /Library/LaunchDaemons >&2 grep "org.nixos.activate-system" ${config.out}/Library/LaunchDaemons/org.nixos.activate-system.plist -- cgit v1.2.3 From 09e5dfb67ee27355d78d35a4f4ab747c230cb9b8 Mon Sep 17 00:00:00 2001 From: Beta-Computer <67995456+Beta-Computer@users.noreply.github.com> Date: Thu, 14 Nov 2024 10:44:14 +1300 Subject: defaults: add `EnableTiledWindowMargins` option Co-authored-by: Michael Hoang --- tests/fixtures/system-defaults-write/activate-user.txt | 5 +++++ tests/system-defaults-write.nix | 1 + 2 files changed, 6 insertions(+) (limited to 'tests') diff --git a/tests/fixtures/system-defaults-write/activate-user.txt b/tests/fixtures/system-defaults-write/activate-user.txt index f6e9bba..5b88301 100644 --- a/tests/fixtures/system-defaults-write/activate-user.txt +++ b/tests/fixtures/system-defaults-write/activate-user.txt @@ -509,6 +509,11 @@ defaults write com.apple.WindowManager 'EnableStandardClickToShowDesktop' $' ' +defaults write com.apple.WindowManager 'EnableTiledWindowMargins' $' + + + +' defaults write com.apple.WindowManager 'GloballyEnabled' $' diff --git a/tests/system-defaults-write.nix b/tests/system-defaults-write.nix index 078cf82..435d138 100644 --- a/tests/system-defaults-write.nix +++ b/tests/system-defaults-write.nix @@ -94,6 +94,7 @@ system.defaults.WindowManager.AppWindowGroupingBehavior = true; system.defaults.WindowManager.StandardHideDesktopIcons = false; system.defaults.WindowManager.HideDesktop = false; + system.defaults.WindowManager.EnableTiledWindowMargins = true; system.defaults.WindowManager.StandardHideWidgets = true; system.defaults.WindowManager.StageManagerHideWidgets = true; system.defaults.CustomUserPreferences = { -- cgit v1.2.3 From 567bae1e17fdd10eccc9d5c6ec20e3d98d498de7 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Thu, 21 Nov 2024 21:40:11 -0600 Subject: defaults: expose-group-by-app -> expose-group-apps Default was renamed in previous macOS release. --- tests/fixtures/system-defaults-write/activate-user.txt | 7 ++++++- tests/system-defaults-write.nix | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/fixtures/system-defaults-write/activate-user.txt b/tests/fixtures/system-defaults-write/activate-user.txt index 5b88301..e09f689 100644 --- a/tests/fixtures/system-defaults-write/activate-user.txt +++ b/tests/fixtures/system-defaults-write/activate-user.txt @@ -235,6 +235,11 @@ defaults write com.apple.dock 'autohide-delay' $' 0.240000 ' +defaults write com.apple.dock 'expose-group-apps' $' + + + +' defaults write com.apple.dock 'orientation' $' @@ -573,4 +578,4 @@ defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter 'Sound' $' 24 -' \ No newline at end of file +' diff --git a/tests/system-defaults-write.nix b/tests/system-defaults-write.nix index 435d138..fae08de 100644 --- a/tests/system-defaults-write.nix +++ b/tests/system-defaults-write.nix @@ -46,6 +46,7 @@ system.defaults.menuExtraClock.Show24Hour = false; system.defaults.menuExtraClock.ShowDayOfWeek = true; system.defaults.menuExtraClock.ShowDate = 2; + system.defaults.dock.expose-group-apps = true; system.defaults.dock.appswitcher-all-displays = false; system.defaults.dock.autohide-delay = 0.24; system.defaults.dock.orientation = "left"; -- cgit v1.2.3 From 55d46b8997e16e52d8a05232f4444124e04ba686 Mon Sep 17 00:00:00 2001 From: z0al <12673605+z0al@users.noreply.github.com> Date: Wed, 4 Dec 2024 21:58:31 +0000 Subject: test(aerospace): assert config values --- tests/services-aerospace.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/services-aerospace.nix b/tests/services-aerospace.nix index 8cbd292..28688c4 100644 --- a/tests/services-aerospace.nix +++ b/tests/services-aerospace.nix @@ -8,6 +8,7 @@ in services.aerospace.enable = true; services.aerospace.package = aerospace; services.aerospace.settings = { + after-startup-command = [ "layout tiles" ]; gaps = { outer.left = 8; outer.bottom = 8; @@ -31,6 +32,16 @@ in ${config.out}/user/Library/LaunchAgents/org.nixos.aerospace.plist` echo >&2 "checking config in $conf" - if [ `cat $conf | wc -l` -eq "27" ]; then echo "aerospace.toml config correctly contains 27 lines"; else return 1; fi + grep 'after-startup-command = \["layout tiles"\]' $conf + + grep 'bottom = 8' $conf + grep 'left = 8' $conf + grep 'right = 8' $conf + grep 'top = 8' $conf + + grep 'alt-h = "focus left"' $conf + grep 'alt-j = "focus down"' $conf + grep 'alt-k = "focus up"' $conf + grep 'alt-l = "focus right"' $conf ''; } -- cgit v1.2.3 From 19bc0d6cbeacb20c5ca865d06c274152c42ffd22 Mon Sep 17 00:00:00 2001 From: Filip Kania Date: Sun, 29 Dec 2024 00:14:48 +0100 Subject: tests: add screencapture.target test case --- tests/fixtures/system-defaults-write/activate-user.txt | 5 +++++ tests/system-defaults-write.nix | 1 + 2 files changed, 6 insertions(+) (limited to 'tests') diff --git a/tests/fixtures/system-defaults-write/activate-user.txt b/tests/fixtures/system-defaults-write/activate-user.txt index e09f689..3656a47 100644 --- a/tests/fixtures/system-defaults-write/activate-user.txt +++ b/tests/fixtures/system-defaults-write/activate-user.txt @@ -426,6 +426,11 @@ defaults write com.apple.screencapture 'location' $' /tmp ' +defaults write com.apple.screencapture 'target' $' + + +file +' defaults write com.apple.screensaver 'askForPassword' $' diff --git a/tests/system-defaults-write.nix b/tests/system-defaults-write.nix index fae08de..1a29aa2 100644 --- a/tests/system-defaults-write.nix +++ b/tests/system-defaults-write.nix @@ -74,6 +74,7 @@ system.defaults.finder.ShowRemovableMediaOnDesktop = false; system.defaults.hitoolbox.AppleFnUsageType = "Show Emoji & Symbols"; system.defaults.screencapture.location = "/tmp"; + system.defaults.screencapture.target = "file"; system.defaults.screencapture.include-date = true; system.defaults.screensaver.askForPassword = true; system.defaults.screensaver.askForPasswordDelay = 5; -- cgit v1.2.3 From aefd56bb562b26ae799e261b1ead27682bf0d8ff Mon Sep 17 00:00:00 2001 From: thuvasooriya Date: Mon, 2 Dec 2024 07:06:09 +0530 Subject: aerospace: add workspace-to-monitor-force-assignment option and fix on-window-detected type #1208 trying to fix #1142 testing requested changes adding workspace to monitor force assignment remove formatting tests pass proper tests undo formatting tests for on-window-detected and workspace-to-monitor-force-assignment testing submodules cleanup n if fiz checking final toml null field aerospace callback issue custom null filter for submodule list check for no presense of window-regex and if.workspace config check aerospace: add workspace-to-monitor-force-assignment option and fix on-window-detected type #1208 trying to fix #1142 testing requested changes adding workspace to monitor force assignment remove formatting tests pass proper tests undo formatting tests for on-window-detected and workspace-to-monitor-force-assignment testing submodules cleanup n if fiz checking final toml null field aerospace callback issue custom null filter for submodule list check for no presense of window-regex and if.workspace config check error formatting mishap space left small fix formatting mishaps --- tests/services-aerospace.nix | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'tests') diff --git a/tests/services-aerospace.nix b/tests/services-aerospace.nix index 28688c4..088c92d 100644 --- a/tests/services-aerospace.nix +++ b/tests/services-aerospace.nix @@ -21,6 +21,32 @@ in alt-k = "focus up"; alt-l = "focus right"; }; + on-window-detected = [ + { + "if" = { + app-id = "Another.Cool.App"; + during-aerospace-startup = false; + }; + check-further-callbacks = false; + run = "move-node-to-workspace m"; + } + { + "if".app-name-regex-substring = "finder|calendar"; + run = "layout floating"; + } + { + "if".workspace = "1"; + run = "layout h_accordion"; + } + ]; + workspace-to-monitor-force-assignment = { + "1" = 1; + "2" = "main"; + "3" = "secondary"; + "4" = "built-in"; + "5" = "^built-in retina display$"; + "6" = [ "secondary" "dell" ]; + }; }; test = '' @@ -43,5 +69,24 @@ in grep 'alt-j = "focus down"' $conf grep 'alt-k = "focus up"' $conf grep 'alt-l = "focus right"' $conf + + grep 'check-further-callbacks = false' $conf + grep 'run = "move-node-to-workspace m"' $conf + grep 'app-id = "Another.Cool.App"' $conf + grep 'during-aerospace-startup = false' $conf + + grep 'run = "layout floating"' $conf + grep 'app-name-regex-substring = "finder|calendar"' $conf + (! grep 'window-title-regex-substring' $conf) + + grep 'workspace = "1"' $conf + grep 'run = "layout h_accordion"' $conf + + grep '1 = 1' $conf + grep '2 = "main"' $conf + grep '3 = "secondary"' $conf + grep '4 = "built-in"' $conf + grep '5 = "^built-in retina display$"' $conf + grep '6 = \["secondary", "dell"\]' $conf ''; } -- cgit v1.2.3