mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
The current way to define a news entry in Home-Manager is error prone (since you need to type the date manually) and also it is common cause of conflicts after merges because all entries are defined in the same file. This commit fixes this: we can now create individual news entries for each new entry. A script `create-news-entry.sh` also helps to create it in the correct format (with the correct filenames and structure).
24 lines
636 B
Bash
Executable file
24 lines
636 B
Bash
Executable file
#!/usr/bin/env nix-shell
|
|
#! nix-shell -I https://github.com/NixOS/nixpkgs/archive/05f0934825c2a0750d4888c4735f9420c906b388.tar.gz -i bash -p coreutils
|
|
|
|
DATE="$(date --iso-8601=second --universal)"
|
|
FILENAME="$(date --date="$DATE" +"%Y-%m-%d_%H-%M-%S").nix"
|
|
DIRNAME="$(dirname -- "${BASH_SOURCE[0]}")"
|
|
|
|
cd "$DIRNAME" || {
|
|
>&2 echo "Failed to change to the script directory: $DIRNAME"
|
|
exit 1
|
|
}
|
|
|
|
cat - << EOF > "$FILENAME"
|
|
{
|
|
time = "$DATE";
|
|
condition = true;
|
|
message = ''
|
|
PLACEHOLDER
|
|
'';
|
|
}
|
|
EOF
|
|
|
|
echo "Successfully created a news file: $DIRNAME/$FILENAME"
|
|
echo "You can open the file above in your text editor and edit now."
|