24 current 2024-04-17 17:19:51 23.11.20240405.72da83d 6.1.84 *
This commit is contained in:
parent
ebedd90923
commit
df2b89632c
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.log
|
||||
@ -11,6 +11,7 @@
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
../../modules/bin/nix-scripts.nix
|
||||
../../modules/hardware/bluetooth.nix
|
||||
../../modules/hardware/printing.nix
|
||||
../../modules/hardware/sound.nix
|
||||
|
||||
25
modules/bin/nix-scripts.nix
Normal file
25
modules/bin/nix-scripts.nix
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
rebuild =
|
||||
pkgs.writeShellScriptBin ".nixos-rebuild"
|
||||
''
|
||||
set -e
|
||||
pushd ~/.nixos/
|
||||
${pkgs.alejandra}/bin/alejandra . &>/dev/null
|
||||
${pkgs.git}/bin/git diff -U0 *.nix
|
||||
echo "NixOS Rebuilding..."
|
||||
sudo nixos-rebuild switch --flake . &>nixos-switch.log || (
|
||||
${pkgs.coreutils-full}/bin/cat nixos-switch.log | ${pkgs.gnugrep}/bin/grep --color error && false)
|
||||
gen=$(nixos-rebuild list-generations | ${pkgs.gnugrep}/bin/grep current)
|
||||
${pkgs.git}/bin/git commit -am "$gen"
|
||||
popd
|
||||
'';
|
||||
in {
|
||||
environment.systemPackages = [
|
||||
pkgs.bash
|
||||
rebuild
|
||||
];
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user