218 current 1970-01-01 01:00:00 24.05.20240303.b8697e5 6.6.19 *
This commit is contained in:
parent
3b22026126
commit
d3871dd3a5
@ -152,6 +152,14 @@
|
|||||||
randomizedDelaySec = "45min";
|
randomizedDelaySec = "45min";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nix.gc = {
|
||||||
|
automatic = true;
|
||||||
|
dates = "10:00";
|
||||||
|
randomizedDelaySec = "45min";
|
||||||
|
options = "--delete-older-than 14d";
|
||||||
|
};
|
||||||
|
nix.settings.auto-optimise-store = true;
|
||||||
|
|
||||||
# This value determines the NixOS release from which the default
|
# This value determines the NixOS release from which the default
|
||||||
# settings for stateful data, like file locations and database versions
|
# settings for stateful data, like file locations and database versions
|
||||||
# on your system were taken. It‘s perfectly fine and recommended to leave
|
# on your system were taken. It‘s perfectly fine and recommended to leave
|
||||||
|
@ -1,45 +1,40 @@
|
|||||||
{pkgs, ...}: let
|
{pkgs, ...}: let
|
||||||
# script for rebuilding nixos
|
# script for rebuilding nixos
|
||||||
rebuild = pkgs.writeTextFile {
|
rebuild = pkgs.writeShellScriptBin "rebuild" ''
|
||||||
name = "rebuild";
|
# A rebuild script that commits on a successful build
|
||||||
destination = "/bin/rebuild";
|
set -e
|
||||||
executable = true;
|
|
||||||
text = ''
|
|
||||||
#!${pkgs.bash}/bin/bash
|
|
||||||
|
|
||||||
# A rebuild script that commits on a successful build
|
# cd to your config dir
|
||||||
set -e
|
pushd ~/dotfiles/nixos
|
||||||
|
|
||||||
# cd to your config dir
|
# Edit your config
|
||||||
pushd ~/dotfiles/nixos
|
$EDITOR
|
||||||
|
|
||||||
# Edit your config
|
# Autoformat your nix files
|
||||||
$EDITOR
|
${pkgs.alejandra}/bin/alejandra . #&>/dev/null
|
||||||
|
|
||||||
# Autoformat your nix files
|
# Shows your changes
|
||||||
${pkgs.alejandra}/bin/alejandra . #&>/dev/null
|
${pkgs.git}/bin/git diff -U0 *.nix
|
||||||
|
|
||||||
# Shows your changes
|
echo "NixOS Rebuilding..."
|
||||||
${pkgs.git}/bin/git diff -U0 *.nix
|
|
||||||
|
|
||||||
echo "NixOS Rebuilding..."
|
# echo using sudo so we get feedback after unlocking
|
||||||
|
sudo echo "Beginning rebuild"
|
||||||
|
# Rebuild, output simplified errors, log trackebacks
|
||||||
|
sudo nixos-rebuild switch &>nixos-switch.log || (${pkgs.coreutils}/bin/cat nixos-switch.log | ${pkgs.gnugrep}/bin/grep --color error && false)
|
||||||
|
|
||||||
# Rebuild, output simplified errors, log trackebacks
|
# Get current generation metadata
|
||||||
sudo nixos-rebuild switch &>nixos-switch.log || (${pkgs.coreutils}/bin/cat nixos-switch.log | ${pkgs.gnugrep}/bin/grep --color error && false)
|
current=$(nixos-rebuild list-generations | ${pkgs.gnugrep}/bin/grep current)
|
||||||
|
|
||||||
# Get current generation metadata
|
# Commit all changes with the gereation metadata
|
||||||
current=$(nixos-rebuild list-generations | ${pkgs.gnugrep}/bin/grep current)
|
${pkgs.git}/bin/git commit -am "$current"
|
||||||
|
|
||||||
# Commit all changes with the gereation metadata
|
# Back to where you were
|
||||||
${pkgs.git}/bin/git commit -am "$current"
|
popd
|
||||||
|
|
||||||
# Back to where you were
|
# Notify all OK!
|
||||||
popd
|
${pkgs.libnotify}/bin/notify-send -e "NixOS Rebuilt OK!" --icon=software-update-available
|
||||||
|
'';
|
||||||
# Notify all OK!
|
|
||||||
${pkgs.libnotify}/bin/notify-send -e "NixOS Rebuilt OK!" --icon=software-update-available
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
in {
|
in {
|
||||||
environment.systemPackages = [rebuild];
|
environment.systemPackages = [rebuild];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user