Skip to content

Commit 0a4d897

Browse files
authored
Merge branch 'nix-darwin:master' into master
2 parents 5b470a3 + b8c7ac0 commit 0a4d897

File tree

9 files changed

+385
-38
lines changed

9 files changed

+385
-38
lines changed

modules/networking/applicationFirewall.nix

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ in
1313
{
1414
meta.maintainers = [
1515
(lib.maintainers.prince213 or "prince213")
16+
(lib.maintainers.ryanccn or "ryanccn")
1617
];
1718

1819
options.networking.applicationFirewall = {
@@ -22,27 +23,51 @@ in
2223
example = true;
2324
description = "Whether to enable application firewall.";
2425
};
25-
blockAllIncoming = lib.mkEnableOption "blocking all incoming connections";
26-
allowSigned = lib.mkEnableOption "built-in software to receive incoming connections" // {
27-
default = true;
26+
27+
blockAllIncoming = lib.mkOption {
28+
type = lib.types.nullOr lib.types.bool;
29+
default = null;
30+
example = true;
31+
description = "Whether to block all incoming connections.";
32+
};
33+
34+
allowSigned = lib.mkOption {
35+
type = lib.types.nullOr lib.types.bool;
36+
default = null;
37+
example = true;
38+
description = "Whether to allow built-in software to receive incoming connections.";
39+
};
40+
41+
allowSignedApp = lib.mkOption {
42+
type = lib.types.nullOr lib.types.bool;
43+
default = null;
44+
example = true;
45+
description = "Whether to allow downloaded signed software to receive incoming connections.";
46+
};
47+
48+
enableStealthMode = lib.mkOption {
49+
type = lib.types.nullOr lib.types.bool;
50+
default = null;
51+
example = true;
52+
description = "Whether to enable stealth mode.";
2853
};
29-
allowSignedApp =
30-
lib.mkEnableOption "downloaded signed software to receive incoming connections"
31-
// {
32-
default = true;
33-
};
34-
enableStealthMode = lib.mkEnableOption "stealth mode";
3554
};
3655

3756
config = {
3857
system.activationScripts.networking.text = ''
3958
echo "configuring application firewall..." >&2
4059
4160
${lib.optionalString (cfg.enable != null) (socketfilterfw "setglobalstate" cfg.enable)}
42-
${lib.optionalString (cfg.enable == true) (socketfilterfw "setblockall" cfg.blockAllIncoming)}
43-
${socketfilterfw "setallowsigned" cfg.allowSigned}
44-
${socketfilterfw "setallowsignedapp" cfg.allowSignedApp}
45-
${socketfilterfw "setstealthmode" cfg.enableStealthMode}
61+
${lib.optionalString (cfg.blockAllIncoming != null) (
62+
socketfilterfw "setblockall" cfg.blockAllIncoming
63+
)}
64+
${lib.optionalString (cfg.allowSigned != null) (socketfilterfw "setallowsigned" cfg.allowSigned)}
65+
${lib.optionalString (cfg.allowSignedApp != null) (
66+
socketfilterfw "setallowsignedapp" cfg.allowSignedApp
67+
)}
68+
${lib.optionalString (cfg.enableStealthMode != null) (
69+
socketfilterfw "setstealthmode" cfg.enableStealthMode
70+
)}
4671
'';
4772
};
4873
}

modules/programs/vim.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ in
7777
config = mkIf cfg.enable {
7878

7979
environment.systemPackages =
80-
[ # Include vim_configurable package.
80+
[ # Include vim-full package.
8181
cfg.package
8282
];
8383

@@ -92,7 +92,7 @@ in
9292
endif
9393
'';
9494

95-
programs.vim.package = pkgs.vim_configurable.customize {
95+
programs.vim.package = pkgs.vim-full.customize {
9696
name = "vim";
9797
vimrcConfig.customRC = config.environment.etc."vimrc".text;
9898
vimrcConfig.vam = {

modules/services/dnsmasq.nix

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ in
6969
environment.systemPackages = [ cfg.package ];
7070

7171
launchd.daemons.dnsmasq = {
72-
serviceConfig.ProgramArguments = [
73-
"${cfg.package}/bin/dnsmasq"
74-
"--listen-address=${cfg.bind}"
75-
"--port=${toString cfg.port}"
76-
"--keep-in-foreground"
77-
] ++ (mapA (domain: addr: "--address=/${domain}/${addr}") cfg.addresses)
78-
++ (map (server: "--server=${server}") cfg.servers);
72+
command = let
73+
args = [
74+
"--listen-address=${cfg.bind}"
75+
"--port=${toString cfg.port}"
76+
"--keep-in-foreground"
77+
] ++ (mapA (domain: addr: "--address=/${domain}/${addr}") cfg.addresses)
78+
++ (map (server: "--server=${server}") cfg.servers);
79+
in
80+
"${cfg.package}/bin/dnsmasq ${concatStringsSep " " args}";
7981

8082
serviceConfig.KeepAlive = true;
8183
serviceConfig.RunAtLoad = true;

modules/system/defaults/dock.nix

Lines changed: 117 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,16 +197,93 @@ in {
197197
};
198198

199199
system.defaults.dock.persistent-others = mkOption {
200-
type = types.nullOr (types.listOf (types.either types.path types.str));
200+
type = let
201+
folderType = types.submodule {
202+
options.path = mkOption {
203+
description = "Path to a folder to be added to the dock.";
204+
type = types.str;
205+
};
206+
options.arrangement = mkOption {
207+
description = "Sort order for files in folder when clicked.";
208+
type = types.enum ["name" "date-added" "date-modified" "date-created" "kind"];
209+
default = "name";
210+
};
211+
options.displayas = mkOption {
212+
description = "How to display the folder before clicked. stack: Stack of file previews. folder: A folder icon";
213+
type = types.enum ["stack" "folder"];
214+
default = "stack";
215+
};
216+
options.showas = mkOption {
217+
description = "Effect to show files when clicked. fan: fan-out effect, grid: box, list: list";
218+
type = types.enum ["automatic" "fan" "grid" "list"];
219+
default = "automatic";
220+
};
221+
};
222+
taggedType = types.attrTag {
223+
file = mkOption {
224+
description = "A file to be added to the dock.";
225+
type = types.str;
226+
};
227+
folder = mkOption {
228+
description = "A folder to be added to the dock.";
229+
type = types.coercedTo types.str (str: { path = str; }) folderType;
230+
};
231+
};
232+
simpleType = types.either types.str types.path;
233+
# Below to NOT break exisiting config
234+
toTagged = _path: let path = builtins.toString _path; in if strings.hasInfix "." (last (splitString "/" path)) then { file = path; } else { folder = path; };
235+
# toTagged = path: { folder = path; }; # or this to be consistent with persistent-apps
236+
in
237+
types.nullOr (types.listOf (types.coercedTo simpleType toTagged taggedType));
201238
default = null;
202-
example = [ "~/Documents" "~/Downloads" ];
239+
example = lib.literalExpression ''
240+
[
241+
./flake.nix
242+
"/Volumes"
243+
{ folder = "/Users/@username@/Downloads"; }
244+
{ folder = { path = "/Users/@username@/.emacs.d"; showas = "grid"; }; }
245+
{ file = "/Users/@username@/Desktop/this_is_a_file"; }
246+
]'';
203247
description = ''
204-
Persistent folders in the dock.
248+
Persistent files, and folders in the dock.
205249
'';
206-
apply = value:
207-
if !(isList value)
208-
then value
209-
else map (folder: { tile-data = { file-data = { _CFURLString = "file://" + folder; _CFURLStringType = 15; }; }; tile-type = if strings.hasInfix "." (last (splitString "/" folder)) then "file-tile" else "directory-tile"; }) value;
250+
apply = let
251+
arrangementMap = {
252+
name = 1;
253+
date-added = 2;
254+
date-modified = 3;
255+
date-created = 4;
256+
kind = 5;
257+
};
258+
displayasMap = {
259+
stack = 0;
260+
folder = 1;
261+
};
262+
showasMap = {
263+
automatic = 0;
264+
fan = 1;
265+
grid = 2;
266+
list = 3;
267+
};
268+
parseFolder = (folder:
269+
builtins.mapAttrs (name: val:
270+
if name == "arrangement" then arrangementMap.${val}
271+
else if name == "displayas" then displayasMap.${val}
272+
else if name == "showas" then showasMap.${val}
273+
else val
274+
) folder
275+
);
276+
toTile = item: {
277+
tile-data = {
278+
file-data = {
279+
_CFURLString = "file://" + (if item ? folder then item.folder.path else item.file);
280+
_CFURLStringType = 15;
281+
};
282+
} // (if item ? folder then {inherit (parseFolder item.folder) arrangement displayas showas;} else {});
283+
tile-type = if item ? folder then "directory-tile" else "file-tile";
284+
};
285+
in
286+
value: if value == null then null else map toTile value;
210287
};
211288

212289
system.defaults.dock.scroll-to-open = mkOption {
@@ -217,6 +294,38 @@ in {
217294
'';
218295
};
219296

297+
system.defaults.dock.showAppExposeGestureEnabled = mkOption {
298+
type = types.nullOr types.bool;
299+
default = null;
300+
description = ''
301+
Whether to enable trackpad gestures (three- or four-finger vertical swipe) to show App Exposé. The default is false. This feature interacts with `system.defaults.trackpad.TrackpadFourFingerVertSwipeGesture` and `system.defaults.trackpad.TrackpadThreeFingerVertSwipeGesture` to determine which gesture triggers App Exposé.
302+
'';
303+
};
304+
305+
system.defaults.dock.showDesktopGestureEnabled = mkOption {
306+
type = types.nullOr types.bool;
307+
default = null;
308+
description = ''
309+
Whether to enable four-finger spread gesture to show the Desktop. The default is false.
310+
'';
311+
};
312+
313+
system.defaults.dock.showLaunchpadGestureEnabled = mkOption {
314+
type = types.nullOr types.bool;
315+
default = null;
316+
description = ''
317+
Whether to enable four-finger pinch gesture to show the Launchpad. The default is false.
318+
'';
319+
};
320+
321+
system.defaults.dock.showMissionControlGestureEnabled = mkOption {
322+
type = types.nullOr types.bool;
323+
default = null;
324+
description = ''
325+
Whether to enable trackpad gestures (three- or four-finger vertical swipe) to show Mission Control. The default is false. This feature interacts with `system.defaults.trackpad.TrackpadFourFingerVertSwipeGesture` and `system.defaults.trackpad.TrackpadThreeFingerVertSwipeGesture` to determine which gesture triggers Mission Control.
326+
'';
327+
};
328+
220329
system.defaults.dock.show-process-indicators = mkOption {
221330
type = types.nullOr types.bool;
222331
default = null;
@@ -367,3 +476,4 @@ in {
367476

368477
};
369478
}
479+

0 commit comments

Comments
 (0)