|
1 | 1 | # Test that keybindings.json is created correctly. |
2 | | -{ pkgs, lib, ... }: |
| 2 | +package: |
| 3 | + |
| 4 | +{ |
| 5 | + config, |
| 6 | + pkgs, |
| 7 | + lib, |
| 8 | + ... |
| 9 | +}: |
3 | 10 |
|
4 | 11 | let |
| 12 | + cfg = config.programs.vscode; |
| 13 | + willUseIfd = package.pname != "vscode"; |
| 14 | + |
5 | 15 | bindings = [ |
6 | 16 | { |
7 | 17 | key = "ctrl+c"; |
|
30 | 40 | keybindingsPath = |
31 | 41 | name: |
32 | 42 | if pkgs.stdenv.hostPlatform.isDarwin then |
33 | | - "Library/Application Support/Code/User/${ |
| 43 | + "Library/Application Support/${cfg.nameShort}/User/${ |
34 | 44 | lib.optionalString (name != "default") "profiles/${name}/" |
35 | 45 | }keybindings.json" |
36 | 46 | else |
37 | | - ".config/Code/User/${lib.optionalString (name != "default") "profiles/${name}/"}keybindings.json"; |
| 47 | + ".config/${cfg.nameShort}/User/${ |
| 48 | + lib.optionalString (name != "default") "profiles/${name}/" |
| 49 | + }keybindings.json"; |
38 | 50 |
|
39 | 51 | settingsPath = |
40 | 52 | name: |
41 | 53 | if pkgs.stdenv.hostPlatform.isDarwin then |
42 | | - "Library/Application Support/Code/User/${ |
| 54 | + "Library/Application Support/${cfg.nameShort}/User/${ |
43 | 55 | lib.optionalString (name != "default") "profiles/${name}/" |
44 | 56 | }settings.json" |
45 | 57 | else |
46 | | - ".config/Code/User/${lib.optionalString (name != "default") "profiles/${name}/"}settings.json"; |
| 58 | + ".config/${cfg.nameShort}/User/${ |
| 59 | + lib.optionalString (name != "default") "profiles/${name}/" |
| 60 | + }settings.json"; |
47 | 61 |
|
48 | 62 | content = '' |
49 | 63 | [ |
@@ -109,20 +123,17 @@ let |
109 | 123 | ''; |
110 | 124 |
|
111 | 125 | expectedCustomKeybindings = pkgs.writeText "custom-expected.json" content; |
112 | | - |
113 | 126 | in |
114 | | -{ |
| 127 | + |
| 128 | +lib.mkIf (willUseIfd -> config.test.enableLegacyIfd) { |
115 | 129 | programs.vscode = { |
116 | 130 | enable = true; |
117 | 131 | profiles = { |
118 | 132 | default.keybindings = bindings; |
119 | 133 | test.keybindings = bindings; |
120 | 134 | custom.keybindings = customBindingsPath; |
121 | 135 | }; |
122 | | - package = pkgs.writeScriptBin "vscode" "" // { |
123 | | - pname = "vscode"; |
124 | | - version = "1.75.0"; |
125 | | - }; |
| 136 | + inherit package; |
126 | 137 | }; |
127 | 138 |
|
128 | 139 | nmt.script = '' |
|
0 commit comments