17 current 2025-03-18 20:12:11 25.05.20250315.c80f6a7 6.12.19 *

This commit is contained in:
Gustav Bruhn 2025-03-18 20:12:47 +01:00
parent 0bad6fe50e
commit a91ed8f66d
3 changed files with 28 additions and 16 deletions

View File

@ -22,7 +22,7 @@
# The home.packages option allows you to install Nix packages into your
# environment.
home.packages = [
home.packages = with pkgs; [
# # Adds the 'hello' command to your environment. It prints a friendly
# # "Hello, world!" when run.
# pkgs.hello
@ -39,6 +39,7 @@
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
(writeShellScriptBin "updateNix" (builtins.readFile ../../update.sh))
];
programs.git = {
enable = true;

View File

@ -1,15 +0,0 @@
with import <nixpkgs> {};
writeShellScriptBin "nixUpdate" ''
set -e
pushd ~/nixos/
# if git diff --quiet '*.nix'; then
# echo "no changes"
# popd
# exit 0
# fi
''

26
update.sh Normal file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -e
pushd ~/nixos/
alejandra . &>/dev/null \
|| (alejandra . ; echo "formatting failed!" && exit 1)
echo "Rebuilding"
sudo nixos-rebuild switch --upgrade --flake .
current=$(nixos-rebuild list-generations | grep current)
if git diff --quiet '*.nix'; then
popd
notify-send -e "Nixos updated with no config changes" --icon=software-update-avaiable
fi
git commit -am "$current"
git push
popd
notify-send -e "Nixos updated and pushed to git" --icon=software-update-avaiable