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