fork/home-manager
git clone https://git.julia.blue/fork/home-manager
af715ed8
master
1# Test that keybindings.json is created correctly. 2{ pkgs , ...} : 3 4let 5bindings = [ 6{ 7key = "ctrl+c" ; 8command = "editor.action.clipboardCopyAction" ; 9when = "textInputFocus && false" ; 10} 11{ 12key = "ctrl+c" ; 13command = "deleteFile" ; 14when = "" ; 15} 16{ 17key = "d" ; 18command = "deleteFile" ; 19when = "explorerViewletVisible" ; 20} 21{ 22key = "ctrl+r" ; 23command = "run" ; 24args = { command = "echo file" ; }; 25} 26]; 27 28keybindingsPath = if pkgs . stdenv . hostPlatform . isDarwin then 29"Library/Application Support/Code/User/keybindings.json" 30else 31".config/Code/User/keybindings.json" ; 32 33settingsPath = if pkgs . stdenv . hostPlatform . isDarwin then 34"Library/Application Support/Code/User/settings.json" 35else 36".config/Code/User/settings.json" ; 37 38expectedKeybindings = pkgs . writeText "expected.json" '' 39[ 40{ 41"command": "editor.action.clipboardCopyAction", 42"key": "ctrl+c", 43"when": "textInputFocus && false" 44}, 45{ 46"command": "deleteFile", 47"key": "ctrl+c", 48"when": "" 49}, 50{ 51"command": "deleteFile", 52"key": "d", 53"when": "explorerViewletVisible" 54}, 55{ 56"args": { 57"command": "echo file" 58}, 59"command": "run", 60"key": "ctrl+r" 61} 62] 63'' ; 64 65in { 66programs . vscode = { 67enable = true ; 68keybindings = bindings ; 69package = pkgs . writeScriptBin "vscode" "" // { pname = "vscode" ; }; 70}; 71 72nmt . script = '' 73assertFileExists "home-files/ ${ keybindingsPath } " 74assertFileContent " home-files/ ${ keybindingsPath } " " ${ expectedKeybindings } " 75 76assertPathNotExists " home-files/ ${ settingsPath } " 77'' ; 78}