-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zsh: add
initContents
option for custom .zshrc
content insertion
- Users can add content anywhere by using `lib.mkOrder`, `lib.mkBefore` and `lib.mkAfter` custom configurations. - Add test cases to verify the insertion of content before and after existing configurations in `.zshrc`. Signed-off-by: Qiming Chu <[email protected]>
- Loading branch information
Showing
4 changed files
with
163 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
tests/modules/programs/zsh/zshrc-contents-insert-after.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ lib, ... }: { | ||
programs.zsh = { | ||
enable = true; | ||
initContents = lib.mkAfter '' | ||
# Custom contents | ||
echo "Custom contents" | ||
''; | ||
}; | ||
|
||
nmt.script = '' | ||
assertFileExists home-files/.zshrc | ||
assertFileRegex home-files/.zshrc $'# Custom contents\necho "Custom contents"$' | ||
''; | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/modules/programs/zsh/zshrc-contents-insert-before.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ lib, ... }: { | ||
programs.zsh = { | ||
enable = true; | ||
initContents = lib.mkBefore '' | ||
# Custom contents | ||
echo "Custom contents" | ||
''; | ||
}; | ||
|
||
nmt.script = '' | ||
assertFileExists home-files/.zshrc | ||
assertFileRegex home-files/.zshrc $'^# Custom contents\necho "Custom contents"' | ||
''; | ||
} |