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 = { nix = {
package = pkgs.nixFlakes; package = pkgs.nixFlakes;
settings.auto-optimise-store = true; settings = {
auto-optimise-store = true;
cores = 0;
};
extraOptions = '' extraOptions = ''
keep-outputs = false
keep-derivations = false
experimental-features = nix-command flakes experimental-features = nix-command flakes
''; '';
}; };

View file

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

View file

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

View file

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

View file

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

View file

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