changed and added scripts

This commit is contained in:
ISnortPennies 2022-08-11 22:03:14 -04:00
parent 7ce7d951f7
commit 92a800c118
6 changed files with 45 additions and 16 deletions

View file

@ -10,8 +10,13 @@
};
nix = {
package = pkgs.nixFlakes;
settings.auto-optimise-store = true;
settings = {
auto-optimise-store = true;
cores = 0;
};
extraOptions = ''
keep-outputs = false
keep-derivations = false
experimental-features = nix-command flakes
'';
};

View file

@ -1,7 +1,7 @@
{
description = "my personal configurations";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixkpkgs.follows = "nixpkgs";

View file

@ -2,7 +2,7 @@
{
programs.git = {
enable = true;
package = pkgs.gitFull;
package = pkgs.git;
userName = "ISnortPennies";
userEmail = "ISnortPennies@protonmail.com";
};

View file

@ -3,8 +3,7 @@
hardware = {
nvidia = {
nvidiaPersistenced = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
nvidiaSettings = false;
modesetting.enable = true;
};
opengl = {

View file

@ -42,5 +42,7 @@ environment.systemPackages = with pkgs; [
polkit_fix
#for thunar root
qsudo
nix-tree
];
}

View file

@ -2,36 +2,59 @@
let
update-system = pkgs.writeScriptBin "update-system" ''
#!${pkgs.stdenv.shell}
#!/bin/sh
if ! [ $(id -u) = 0 ]; then
echo "RUN AS ROOT"
exit 1
fi
nix flake update /etc/nixos/#
'';
clean-store = pkgs.writeScriptBin "clean-store" ''
#!${pkgs.stdenv.shell}
sudo nix-collect-garbage -d
sudo nix-store --optimise
sudo -u gerg nix-collect-garbage -d
#!/bin/sh
if ! [ $(id -u) = 0 ]; then
echo "RUN AS ROOT"
exit 1
fi
rm /nix/var/nix/gcroots/auto/*
nix-collect-garbage -d
sudo -u gerg nix-collect-garbage -d
'';
apply-users = pkgs.writeScriptBin "apply-users" ''
#!${pkgs.stdenv.shell}
#!/bin/sh
home-manager switch --flake /etc/nixos/#$(whoami)
'';
apply-system = pkgs.writeScriptBin "apply-system" ''
#!${pkgs.stdenv.shell}
nixos-rebuild switch --flake /etc/nixos/#${config.networking.hostName}
#!/bin/sh
if ! [ $(id -u) = 0 ]; then
echo "RUN AS ROOT"
exit 1
fi
nixos-rebuild switch --flake /etc/nixos/#${config.networking.hostName}
'';
polybar-tray = pkgs.writeScriptBin "polybar-tray" ''
#!${pkgs.stdenv.shell}
#!/bin/sh
u=$(xprop -name "Polybar tray window" _NET_WM_PID | awk '{print $3}')
if [ $u -Z ]
then polybar tray &
else kill $u
fi
'';
full-upgrade = pkgs.writeScriptBin "full-upgrade" ''
#!/bin/sh
if ! [ $(id -u) = 0 ]; then
echo "RUN AS ROOT"
exit 1
fi
update-system
apply-system
apply-users
sudo -u gerg apply-users
clean-store
'';
in {
environment.systemPackages = [ update-system clean-store apply-users apply-system polybar-tray ];
environment.systemPackages = [ update-system clean-store apply-users apply-system polybar-tray full-upgrade];
}