adjusting some scripts and small configs
This commit is contained in:
		
							parent
							
								
									8bc16bd6f5
								
							
						
					
					
						commit
						fc209bda6d
					
				
					 18 changed files with 372 additions and 81 deletions
				
			
		
							
								
								
									
										62
									
								
								LightlyShaders-build/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								LightlyShaders-build/default.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,62 @@
 | 
			
		|||
{
 | 
			
		||||
  pkgs ? import <nixpkgs> {},
 | 
			
		||||
  stdenv ? pkgs.stdenv,
 | 
			
		||||
  lib ? pkgs.lib,
 | 
			
		||||
  fetchFromGitHub ? pkgs.fetchFromGitHub,
 | 
			
		||||
}:
 | 
			
		||||
 | 
			
		||||
stdenv.mkDerivation rec {
 | 
			
		||||
  pname = "LightlyShaders";
 | 
			
		||||
  version = "0.0.1";
 | 
			
		||||
 | 
			
		||||
  src = fetchFromGitHub {
 | 
			
		||||
    owner = "a-parhom";
 | 
			
		||||
    repo = "LightlyShaders";
 | 
			
		||||
    rev = "0da0587dc2cea4766290695d8f8e1a1d8835b1ba";
 | 
			
		||||
    sha256 = "MJk2pXRmyZDZX7KeZBHNKi0WQcQwqTM1nZWTWSxnvfc=";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  dontWrapQtApps = true;
 | 
			
		||||
 | 
			
		||||
  buildInputs = with pkgs; [
 | 
			
		||||
    qt5.qtbase
 | 
			
		||||
    qt5.qtx11extras
 | 
			
		||||
    qt5.qttools
 | 
			
		||||
    libsForQt5.kglobalaccel
 | 
			
		||||
    libsForQt5.kinit
 | 
			
		||||
    libsForQt5.kwin
 | 
			
		||||
    libsForQt5.kio
 | 
			
		||||
    libsForQt5.kguiaddons
 | 
			
		||||
    libsForQt5.kcoreaddons
 | 
			
		||||
    libsForQt5.systemsettings
 | 
			
		||||
    libsForQt5.plasma-framework
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  nativeBuildInputs = with pkgs; [
 | 
			
		||||
    stdenv
 | 
			
		||||
    cmake
 | 
			
		||||
    extra-cmake-modules
 | 
			
		||||
    clang
 | 
			
		||||
    libepoxy
 | 
			
		||||
    xorg.libXdmcp
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  preConfigure = ''
 | 
			
		||||
    local modulepath=$(kf5-config --install module)
 | 
			
		||||
    local datapath=$(kf5-config --install data)
 | 
			
		||||
    local servicepath=$(kf5-config --install services)
 | 
			
		||||
    substituteInPlace CMakeLists.txt \
 | 
			
		||||
      --replace "\''${MODULEPATH}" "$out/''${modulepath#/nix/store/*/}" \
 | 
			
		||||
      --replace "\''${DATAPATH}"   "$out/''${datapath#/nix/store/*/}" \
 | 
			
		||||
      --replace "\''${DATAPATH}"   "$out/''${servicepath#/nix/store/*/}"
 | 
			
		||||
  '';
 | 
			
		||||
 | 
			
		||||
  meta = with lib; {
 | 
			
		||||
    name = "LightlyShaders";
 | 
			
		||||
    description = "Round corners and outline effect for KWin.";
 | 
			
		||||
    homepage = "https://github.com/a-parhom/LightlyShaders";
 | 
			
		||||
    license = licenses.gpl3;
 | 
			
		||||
    maintainers = [ "chriscochrun" ];
 | 
			
		||||
    platforms = platforms.all;
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1
									
								
								LightlyShaders-build/result
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								LightlyShaders-build/result
									
										
									
									
									
										Symbolic link
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
/nix/store/536f45xscv3kn737xxkwby50nwcsi035-LightlyShaders-0.0.1
 | 
			
		||||
							
								
								
									
										48
									
								
								README.org
									
										
									
									
									
								
							
							
						
						
									
										48
									
								
								README.org
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -128,6 +128,22 @@ services.pipewire = {
 | 
			
		|||
programs.dconf.enable = true;
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
To make sure certain things are setup properly I'll modify the shells a bit.
 | 
			
		||||
#+NAME: shell
 | 
			
		||||
#+begin_src nix
 | 
			
		||||
# Set default shell to be dash for speed
 | 
			
		||||
# Apparently this is bad because a lot of nix relies on bash
 | 
			
		||||
# environment.binsh = "${pkgs.dash}/bin/dash";
 | 
			
		||||
environment.variables = {
 | 
			
		||||
  EDITOR = "emacsclient -t -a";
 | 
			
		||||
  VISUAL = "emacsclient -c -a";
 | 
			
		||||
};
 | 
			
		||||
environment.homeBinInPath = true;
 | 
			
		||||
programs.fish.enable = true;
 | 
			
		||||
programs.zsh.enable = true;
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
*** Packages
 | 
			
		||||
Here are a list of packages that I like to have on all machines.
 | 
			
		||||
#+NAME: general-packages
 | 
			
		||||
#+begin_src nix
 | 
			
		||||
| 
						 | 
				
			
			@ -161,6 +177,8 @@ sddm-kcm
 | 
			
		|||
ydotool
 | 
			
		||||
bottles
 | 
			
		||||
exa
 | 
			
		||||
imv
 | 
			
		||||
feh
 | 
			
		||||
mpv
 | 
			
		||||
yt-dlp
 | 
			
		||||
rofi-emoji
 | 
			
		||||
| 
						 | 
				
			
			@ -197,13 +215,19 @@ pulsemixer
 | 
			
		|||
any-nix-shell
 | 
			
		||||
wtype
 | 
			
		||||
xdotool
 | 
			
		||||
wmctrl
 | 
			
		||||
xcape
 | 
			
		||||
unclutter-xfixes
 | 
			
		||||
bluez-tools
 | 
			
		||||
networkmanager_dmenu
 | 
			
		||||
qt5ct
 | 
			
		||||
lxappearance
 | 
			
		||||
spotdl
 | 
			
		||||
kdenlive
 | 
			
		||||
ffmpeg
 | 
			
		||||
wlroots
 | 
			
		||||
picom-next
 | 
			
		||||
pamixer
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
Here are some dev tools that I often have on a few devices.
 | 
			
		||||
| 
						 | 
				
			
			@ -256,12 +280,13 @@ nixpkgs.overlays = [
 | 
			
		|||
];
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
*** Emacs
 | 
			
		||||
Emacs service
 | 
			
		||||
#+NAME: emacs
 | 
			
		||||
#+begin_src nix
 | 
			
		||||
services.emacs = {
 | 
			
		||||
  enable = true;
 | 
			
		||||
  package = with pkgs; ((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages (epkgs: [ epkgs.vterm epkgs.magit epkgs.pdf-tools ]));
 | 
			
		||||
  package = with pkgs; ((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages (epkgs: [ epkgs.vterm epkgs.magit epkgs.pdf-tools pkgs.mu ]));
 | 
			
		||||
};
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -300,14 +325,6 @@ Notice how I am including all of my software here. It may be a big file, but hav
 | 
			
		|||
  # Select internationalisation properties.
 | 
			
		||||
  i18n.defaultLocale = "en_US.UTF-8";
 | 
			
		||||
 | 
			
		||||
  # Set default shell to be dash for speed
 | 
			
		||||
  # Apparently this is bad because a lot of nix relies on bash
 | 
			
		||||
  # environment.binsh = "${pkgs.dash}/bin/dash";
 | 
			
		||||
  environment.variables = {
 | 
			
		||||
    EDITOR = "emacsclient -t";
 | 
			
		||||
    VISUAL = "emacsclient -c";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  hardware.uinput.enable = true;
 | 
			
		||||
 | 
			
		||||
  nixpkgs.config.packageOverrides = pkgs: {
 | 
			
		||||
| 
						 | 
				
			
			@ -365,8 +382,8 @@ Notice how I am including all of my software here. It may be a big file, but hav
 | 
			
		|||
  # Enable touchpad support (enabled default in most desktopManager).
 | 
			
		||||
  services.xserver.libinput.enable = true;
 | 
			
		||||
 | 
			
		||||
  programs.fish.enable = true;
 | 
			
		||||
  programs.zsh.enable = true;
 | 
			
		||||
  <<shell>>
 | 
			
		||||
 | 
			
		||||
  # Define a user account. Don't forget to set a password with ‘passwd’.
 | 
			
		||||
  users.users.chris = {
 | 
			
		||||
    isNormalUser = true;
 | 
			
		||||
| 
						 | 
				
			
			@ -390,8 +407,6 @@ Notice how I am including all of my software here. It may be a big file, but hav
 | 
			
		|||
    <<general-packages>>
 | 
			
		||||
    neofetch
 | 
			
		||||
    afetch
 | 
			
		||||
    uwufetch
 | 
			
		||||
    screenfetch
 | 
			
		||||
    yafetch
 | 
			
		||||
    freshfetch
 | 
			
		||||
    disfetch
 | 
			
		||||
| 
						 | 
				
			
			@ -556,8 +571,8 @@ Kaladin is my desktop machine. A powerhouse for the most part with a recent i7 a
 | 
			
		|||
  services.usbmuxd.enable = true;
 | 
			
		||||
  services.fstrim.enable = true;
 | 
			
		||||
 | 
			
		||||
  programs.fish.enable = true;
 | 
			
		||||
  programs.zsh.enable = true;
 | 
			
		||||
  <<shell>>
 | 
			
		||||
 | 
			
		||||
  # Define a user account. Don't forget to set a password with ‘passwd’.
 | 
			
		||||
  users.users.chris = {
 | 
			
		||||
    isNormalUser = true;
 | 
			
		||||
| 
						 | 
				
			
			@ -659,6 +674,9 @@ And here is it's hardware config.
 | 
			
		|||
 | 
			
		||||
Kaladin is still not fullly setup, so I'll be working on that more and more as time goes.
 | 
			
		||||
 | 
			
		||||
** Home
 | 
			
		||||
I also use home-manager for managing dotfiles. This means that everything is contained in this folder and then tangled out to their respective places when rebuilding the system.
 | 
			
		||||
 | 
			
		||||
* Thanks!
 | 
			
		||||
 | 
			
		||||
* EXTRA
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -357,7 +357,7 @@ colors:
 | 
			
		|||
#   - (Linux/BSD) user login shell
 | 
			
		||||
#   - (Windows) powershell
 | 
			
		||||
shell:
 | 
			
		||||
  program: /bin/fish
 | 
			
		||||
  program: fish
 | 
			
		||||
#  args:
 | 
			
		||||
#    - --login
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -755,15 +755,15 @@
 | 
			
		|||
 | 
			
		||||
(awful.spawn.once "picom --experimental-backend")
 | 
			
		||||
(awful.spawn.once "/usr/lib/polkit-kde-authentication-agent-1")
 | 
			
		||||
(awful.spawn.once "feh --bg-fill /home/chris/Pictures/wallpapers/darkb-minimal-cross.png")
 | 
			
		||||
(awful.spawn.once "feh --bg-fill /home/chris/Pictures/wallpapers/tech.jpg")
 | 
			
		||||
(awful.spawn.once "bluetoothctl power on")
 | 
			
		||||
;; (awful.spawn.once "nextcloud --background")
 | 
			
		||||
(awful.spawn.once "rbw-agent")
 | 
			
		||||
(awful.spawn.once "killall jellyfin-mpv-shim && jellyfin-mpv-shim")
 | 
			
		||||
(awful.spawn.once "xset r rate 220 90")
 | 
			
		||||
(awful.spawn.once "/usr/lib/kdeconnectd")
 | 
			
		||||
(awful.spawn.once "emacs --daemon")
 | 
			
		||||
(if laptop (awful.spawn.once "nm-applet"))
 | 
			
		||||
;; (awful.spawn.once "emacs --daemon")
 | 
			
		||||
;; (if laptop (awful.spawn.once "nm-applet"))
 | 
			
		||||
(awful.spawn.once "xcape -e 'Super_L=Super_L|Control_L|Escape'")
 | 
			
		||||
(awful.spawn.once "xcape -e 'Alt_L=Super_L|W'")
 | 
			
		||||
(awful.spawn.once "greenclip daemon")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
#!/usr/bin/env fish
 | 
			
		||||
 | 
			
		||||
set -U fish_user_paths $HOME/.local/bin $HOME/scripts $HOME/.doom-emacs/bin $HOME/.emacs.d/bin $HOME/.cargo/bin /opt/android-sdk/cmdline-tools/latest/bin
 | 
			
		||||
set -U fish_user_paths $HOME/.local/bin $HOME/scripts $HOME/bin $HOME/.doom-emacs/bin $HOME/.emacs.d/bin $HOME/.cargo/bin
 | 
			
		||||
set TERM "xterm-256color"
 | 
			
		||||
set EDITOR "emacsclient -c -a"
 | 
			
		||||
set VISUAL "emacsclient -c -a emacs"
 | 
			
		||||
| 
						 | 
				
			
			@ -17,8 +17,6 @@ function fish_greeting -d "what's up, fish?"
 | 
			
		|||
    # set_color normal
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
## Instead of using a fish prompt, I'm using the starship-rs cross shell prompt.
 | 
			
		||||
 | 
			
		||||
function fish_title
 | 
			
		||||
    if [ "$theme_display_virtualenv" = 'no' -o -z "$VIRTUAL_ENV" ]
 | 
			
		||||
        printf '(%s) %s' $_ (prompt_pwd)
 | 
			
		||||
| 
						 | 
				
			
			@ -229,6 +227,7 @@ if status is-login
 | 
			
		|||
end
 | 
			
		||||
 | 
			
		||||
macchina
 | 
			
		||||
# pfetch
 | 
			
		||||
### Start plasma wayland
 | 
			
		||||
# if status is-login
 | 
			
		||||
#     if test -z "$DISPLAY" -a "$XDG_VTNR" = 1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,37 +0,0 @@
 | 
			
		|||
# This file contains fish universal variable definitions.
 | 
			
		||||
# VERSION: 3.0
 | 
			
		||||
SETUVAR --export ANDROID_SDK_ROOT:/opt/android\x2dsdk
 | 
			
		||||
SETUVAR --export CHROME_EXECUTABLE:/usr/bin/qutebrowser
 | 
			
		||||
SETUVAR --export JAVA_HOME:/usr/lib/jvm/default
 | 
			
		||||
SETUVAR __fish_initialized:3400
 | 
			
		||||
SETUVAR fish_color_autosuggestion:555\x1ebrblack
 | 
			
		||||
SETUVAR fish_color_cancel:\x2dr
 | 
			
		||||
SETUVAR fish_color_command:005fd7
 | 
			
		||||
SETUVAR fish_color_comment:990000
 | 
			
		||||
SETUVAR fish_color_cwd:green
 | 
			
		||||
SETUVAR fish_color_cwd_root:red
 | 
			
		||||
SETUVAR fish_color_end:009900
 | 
			
		||||
SETUVAR fish_color_error:ff0000
 | 
			
		||||
SETUVAR fish_color_escape:00a6b2
 | 
			
		||||
SETUVAR fish_color_history_current:\x2d\x2dbold
 | 
			
		||||
SETUVAR fish_color_host:normal
 | 
			
		||||
SETUVAR fish_color_host_remote:yellow
 | 
			
		||||
SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue
 | 
			
		||||
SETUVAR fish_color_normal:normal
 | 
			
		||||
SETUVAR fish_color_operator:00a6b2
 | 
			
		||||
SETUVAR fish_color_param:00afff
 | 
			
		||||
SETUVAR fish_color_quote:999900
 | 
			
		||||
SETUVAR fish_color_redirection:00afff
 | 
			
		||||
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
 | 
			
		||||
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
 | 
			
		||||
SETUVAR fish_color_status:red
 | 
			
		||||
SETUVAR fish_color_user:brgreen
 | 
			
		||||
SETUVAR fish_color_valid_path:\x2d\x2dunderline
 | 
			
		||||
SETUVAR fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell\x0aType\x20\x60help\x60\x20for\x20instructions\x20on\x20how\x20to\x20use\x20fish
 | 
			
		||||
SETUVAR fish_key_bindings:fish_vi_key_bindings
 | 
			
		||||
SETUVAR fish_pager_color_completion:\x1d
 | 
			
		||||
SETUVAR fish_pager_color_description:B3A06D\x1eyellow
 | 
			
		||||
SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
 | 
			
		||||
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
 | 
			
		||||
SETUVAR fish_pager_color_selected_background:\x2dr
 | 
			
		||||
SETUVAR fish_user_paths:/home/chris/\x2elocal/bin\x1e/home/chris/scripts\x1e/home/chris/\x2edoom\x2demacs/bin\x1e/home/chris/\x2eemacs\x2ed/bin\x1e/home/chris/\x2ecargo/bin\x1e/opt/android\x2dsdk/cmdline\x2dtools/latest/bin
 | 
			
		||||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ geometry=90%:90%
 | 
			
		|||
hwdec=auto
 | 
			
		||||
rtsp-transport=udp
 | 
			
		||||
speed=1.95
 | 
			
		||||
gpu-context=wayland
 | 
			
		||||
# gpu-context=wayland
 | 
			
		||||
 | 
			
		||||
# ytdl-path=yt-dlp
 | 
			
		||||
ytdl-format=bestvideo[height<=?720][fps<=?30]+bestaudio/best
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										23
									
								
								networkmanager-dmenu/config.ini
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								networkmanager-dmenu/config.ini
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
[dmenu]
 | 
			
		||||
# dmenu_command = /usr/bin/dmenu
 | 
			
		||||
# # Note that dmenu_command can contain arguments as well like:
 | 
			
		||||
# # `dmenu_command = rofi -dmenu -i -theme nmdm`
 | 
			
		||||
# # `dmenu_command = rofi -dmenu -width 30 -i`
 | 
			
		||||
# # `dmenu_command = dmenu -i -l 25 -b -nb #909090 -nf #303030`
 | 
			
		||||
# rofi_highlight = <True or False> # (Default: False) use rofi highlighting instead of '=='
 | 
			
		||||
# compact = <True or False> # (Default: False). Remove extra spacing from display
 | 
			
		||||
# pinentry = <Pinentry command>  # (Default: None) e.g. `pinentry-gtk`
 | 
			
		||||
# wifi_chars = <string of 4 unicode characters representing 1-4 bars strength>
 | 
			
		||||
# wifi_chars = ▂▄▆█
 | 
			
		||||
# list_saved = <True or False> # (Default: False) list saved connections
 | 
			
		||||
 | 
			
		||||
[dmenu_passphrase]
 | 
			
		||||
# # Uses the -password flag for Rofi, -x for bemenu. For dmenu, sets -nb and
 | 
			
		||||
# # -nf to the same color or uses -P if the dmenu password patch is applied
 | 
			
		||||
# # https://tools.suckless.org/dmenu/patches/password/
 | 
			
		||||
# obscure = True
 | 
			
		||||
# obscure_color = #222222
 | 
			
		||||
 | 
			
		||||
[editor]
 | 
			
		||||
# terminal = <name of terminal program>
 | 
			
		||||
# gui_if_available = <True or False> (Default: True)
 | 
			
		||||
| 
						 | 
				
			
			@ -17,7 +17,7 @@ if [ $(pgrep -c emacsclient) -gt 0 ]; then
 | 
			
		|||
        fi
 | 
			
		||||
    else
 | 
			
		||||
        if [ $KDE_FULL_SESSION = "true" ]; then
 | 
			
		||||
            /home/chris/scripts/ww -f emacs -c emacsclient
 | 
			
		||||
            /home/chris/bin/ww -f emacs -c emacsclient
 | 
			
		||||
            exit
 | 
			
		||||
        else
 | 
			
		||||
            # WAYLAND
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
#!/bin/bash
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
# Get the percentage of used memory and print it
 | 
			
		||||
read used total <<< $(free -m | awk '/Mem/{printf $2" "$3}')
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										163
									
								
								scripts/ngtrim
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										163
									
								
								scripts/ngtrim
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,163 @@
 | 
			
		|||
#!/usr/bin/env bash
 | 
			
		||||
set -euo pipefail
 | 
			
		||||
 | 
			
		||||
## Defaults
 | 
			
		||||
keepGensDef=10; keepDaysDef=7
 | 
			
		||||
keepGens=$keepGensDef; keepDays=$keepDaysDef
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
usage () {
 | 
			
		||||
    printf "Usage:\n\t trim-generations.sh (defaults are: Keep-Gens=$keepGensDef Keep-Days=$keepDaysDef Profile=user)\n\n"
 | 
			
		||||
    printf "If you enter any parameters, you must enter all three.\n\n"
 | 
			
		||||
    printf "Example:\n\t trim-generations.sh 15 10 home-manager\n"
 | 
			
		||||
    printf "... this will work on the home-manager profile and keep all generations from the last 10 days, and keep at least 15 generations no matter how old.\n"
 | 
			
		||||
    printf "\nProfile choices available: \t user, home-manager, channels, system (root only)\n"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
## Handle parameters (and change if root)
 | 
			
		||||
if [[ $EUID -ne 0 ]]; then
 | 
			
		||||
    profile=$(readlink /home/$USER/.nix-profile)
 | 
			
		||||
else
 | 
			
		||||
    profile="/nix/var/nix/profiles/default"
 | 
			
		||||
fi
 | 
			
		||||
if (( $# < 1 )); then
 | 
			
		||||
    printf "Keeping default: 10 generations OR 7 days, whichever is more\n"
 | 
			
		||||
elif [[ $# -le 2 ]]; then
 | 
			
		||||
    printf "\nError: Not enough arguments.\n\n" >&2
 | 
			
		||||
    usage
 | 
			
		||||
    exit 1
 | 
			
		||||
elif (( $# > 4)); then
 | 
			
		||||
    printf "\nError: Too many arguments.\n\n" >&2
 | 
			
		||||
    usage
 | 
			
		||||
    exit 2
 | 
			
		||||
else
 | 
			
		||||
    keepGens=$1; keepDays=$2;
 | 
			
		||||
    (( keepGens < 1 )) && keepGens=1
 | 
			
		||||
    (( keepDays < 0 )) && keepDays=0
 | 
			
		||||
    if [[ $EUID -ne 0 ]]; then
 | 
			
		||||
        if [[ $3 == "user" ]] || [[ $3 == "default" ]]; then
 | 
			
		||||
            profile=$(readlink /home/$USER/.nix-profile)
 | 
			
		||||
        elif [[ $3 == "home-manager" ]]; then
 | 
			
		||||
            profile="/nix/var/nix/profiles/per-user/$USER/home-manager"
 | 
			
		||||
        elif [[ $3 == "channels" ]]; then
 | 
			
		||||
            profile="/nix/var/nix/profiles/per-user/$USER/channels"
 | 
			
		||||
        else
 | 
			
		||||
            printf "\nError: Do not understand your third argument. Should be one of: (user / home-manager/ channels)\n\n"
 | 
			
		||||
            usage
 | 
			
		||||
            exit 3
 | 
			
		||||
        fi
 | 
			
		||||
    else
 | 
			
		||||
        if [[ $3 == "system" ]]; then
 | 
			
		||||
            profile="/nix/var/nix/profiles/system"
 | 
			
		||||
        elif [[ $3 == "user" ]] || [[ $3 == "default" ]]; then
 | 
			
		||||
            profile="/nix/var/nix/profiles/default"
 | 
			
		||||
        else
 | 
			
		||||
            printf "\nError: Do not understand your third argument. Should be one of: (user / system)\n\n"
 | 
			
		||||
            usage
 | 
			
		||||
            exit 3
 | 
			
		||||
        fi
 | 
			
		||||
    fi
 | 
			
		||||
    printf "OK! \t Keep Gens = $keepGens \t Keep Days = $keepDays\n\n"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
printf "Operating on profile: \t $profile\n\n"
 | 
			
		||||
 | 
			
		||||
## Runs at the end, to decide whether to delete profiles that match chosen parameters.
 | 
			
		||||
choose () {
 | 
			
		||||
    local default="$1"
 | 
			
		||||
    local prompt="$2"
 | 
			
		||||
    local answer
 | 
			
		||||
 | 
			
		||||
    read -p "$prompt" answer
 | 
			
		||||
    [ -z "$answer" ] && answer="$default"
 | 
			
		||||
 | 
			
		||||
    case "$answer" in
 | 
			
		||||
        [yY1] ) #printf "answered yes!\n"
 | 
			
		||||
             nix-env --delete-generations -p $profile ${!gens[@]}
 | 
			
		||||
            exit 0
 | 
			
		||||
            ;;
 | 
			
		||||
        [nN0] ) printf "answered no! exiting\n"
 | 
			
		||||
            exit 6;
 | 
			
		||||
            ;;
 | 
			
		||||
        *     ) printf "%b" "Unexpected answer '$answer'!" >&2
 | 
			
		||||
            exit 7;
 | 
			
		||||
            ;;
 | 
			
		||||
    esac
 | 
			
		||||
} # end of function choose
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Query nix-env for generations list
 | 
			
		||||
IFS=$'\n' nixGens=( $(nix-env --list-generations -p $profile | sed 's:^\s*::; s:\s*$::' | tr '\t' ' ' | tr -s ' ') )
 | 
			
		||||
timeNow=$(date +%s)
 | 
			
		||||
 | 
			
		||||
## Get info on oldest generation
 | 
			
		||||
IFS=' ' read -r -a oldestGenArr <<< "${nixGens[0]}"
 | 
			
		||||
oldestGen=${oldestGenArr[0]}
 | 
			
		||||
oldestDate=${oldestGenArr[1]}
 | 
			
		||||
printf "%-30s %s\n" "oldest generation:" $oldestGen
 | 
			
		||||
#oldestDate=${nixGens[0]:3:19}
 | 
			
		||||
printf "%-30s %s\n" "oldest generation created:" $oldestDate
 | 
			
		||||
oldestTime=$(date -d "$oldestDate" +%s)
 | 
			
		||||
oldestElapsedSecs=$((timeNow-oldestTime))
 | 
			
		||||
oldestElapsedMins=$((oldestElapsedSecs/60))
 | 
			
		||||
oldestElapsedHours=$((oldestElapsedMins/60))
 | 
			
		||||
oldestElapsedDays=$((oldestElapsedHours/24))
 | 
			
		||||
printf "%-30s %s\n" "minutes before now:" $oldestElapsedMins
 | 
			
		||||
printf "%-30s %s\n" "hours before now:" $oldestElapsedHours
 | 
			
		||||
printf "%-30s %s\n\n" "days before now:" $oldestElapsedDays
 | 
			
		||||
 | 
			
		||||
## Get info on current generation
 | 
			
		||||
for i in "${nixGens[@]}"; do
 | 
			
		||||
    IFS=' ' read -r -a iGenArr <<< "$i"
 | 
			
		||||
    genNumber=${iGenArr[0]}
 | 
			
		||||
    genDate=${iGenArr[1]}
 | 
			
		||||
    if [[ "$i" =~ current ]]; then
 | 
			
		||||
        currentGen=$genNumber
 | 
			
		||||
        printf "%-30s %s\n" "current generation:" $currentGen
 | 
			
		||||
        currentDate=$genDate
 | 
			
		||||
        printf "%-30s %s\n" "current generation created:" $currentDate
 | 
			
		||||
        currentTime=$(date -d "$currentDate" +%s)
 | 
			
		||||
        currentElapsedSecs=$((timeNow-currentTime))
 | 
			
		||||
        currentElapsedMins=$((currentElapsedSecs/60))
 | 
			
		||||
        currentElapsedHours=$((currentElapsedMins/60))
 | 
			
		||||
        currentElapsedDays=$((currentElapsedHours/24))
 | 
			
		||||
        printf "%-30s %s\n" "minutes before now:" $currentElapsedMins
 | 
			
		||||
        printf "%-30s %s\n" "hours before now:" $currentElapsedHours
 | 
			
		||||
        printf "%-30s %s\n\n" "days before now:" $currentElapsedDays
 | 
			
		||||
    fi
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
## Compare oldest and current generations
 | 
			
		||||
timeBetweenOldestAndCurrent=$((currentTime-oldestTime))
 | 
			
		||||
elapsedDays=$((timeBetweenOldestAndCurrent/60/60/24))
 | 
			
		||||
generationsDiff=$((currentGen-oldestGen))
 | 
			
		||||
 | 
			
		||||
## Figure out what we should do, based on generations and options
 | 
			
		||||
if [[ elapsedDays -le keepDays ]]; then
 | 
			
		||||
    printf "All generations are no more than $keepDays days older than current generation. \nOldest gen days difference from current gen: $elapsedDays \n\n\tNothing to do!\n"
 | 
			
		||||
    exit 4;
 | 
			
		||||
elif [[ generationsDiff -lt keepGens ]]; then
 | 
			
		||||
    printf "Oldest generation ($oldestGen) is only $generationsDiff generations behind current ($currentGen). \n\n\t Nothing to do!\n"
 | 
			
		||||
    exit 5;
 | 
			
		||||
else
 | 
			
		||||
    printf "\tSomething to do...\n"
 | 
			
		||||
    declare -a gens
 | 
			
		||||
    for i in "${nixGens[@]}"; do
 | 
			
		||||
        IFS=' ' read -r -a iGenArr <<< "$i"
 | 
			
		||||
        genNumber=${iGenArr[0]}
 | 
			
		||||
        genDiff=$((currentGen-genNumber))
 | 
			
		||||
        genDate=${iGenArr[1]}
 | 
			
		||||
        genTime=$(date -d "$genDate" +%s)
 | 
			
		||||
        elapsedSecs=$((timeNow-genTime))
 | 
			
		||||
        genDaysOld=$((elapsedSecs/60/60/24))
 | 
			
		||||
        if [[ genDaysOld -gt keepDays ]] && [[ genDiff -ge keepGens ]]; then
 | 
			
		||||
            gens["$genNumber"]="$genDate, $genDaysOld day(s) old"
 | 
			
		||||
        fi
 | 
			
		||||
    done
 | 
			
		||||
    printf "\nFound the following generation(s) to delete:\n"
 | 
			
		||||
    for K in "${!gens[@]}"; do
 | 
			
		||||
        printf "generation $K \t ${gens[$K]}\n"
 | 
			
		||||
    done
 | 
			
		||||
    printf "\n"
 | 
			
		||||
    choose "y" "Do you want to delete these? [Y/n]: "
 | 
			
		||||
fi
 | 
			
		||||
| 
						 | 
				
			
			@ -20,7 +20,7 @@ if [ $(pgrep -c qutebrowser) -gt 0 ]; then
 | 
			
		|||
        fi
 | 
			
		||||
    else
 | 
			
		||||
        if [ $KDE_FULL_SESSION = "true" ]; then
 | 
			
		||||
            /home/chris/scripts/ww -f org.qutebrowser.qutebrowser -c qutebrowser
 | 
			
		||||
            /home/chris/bin/ww -f org.qutebrowser.qutebrowser -c qutebrowser
 | 
			
		||||
            exit
 | 
			
		||||
        else
 | 
			
		||||
            echo "other wayland"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,4 +2,4 @@
 | 
			
		|||
 | 
			
		||||
awesome-client "naughty.destroy_all_notifications()"
 | 
			
		||||
 | 
			
		||||
notify-send "$(date +"%h %d, %H:%M:%S %p")" --icon=time
 | 
			
		||||
notify-send "$(date +"%h %d, %I:%M:%S %p")" --icon=time
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -81,8 +81,17 @@
 | 
			
		|||
  services.usbmuxd.enable = true;
 | 
			
		||||
  services.fstrim.enable = true;
 | 
			
		||||
 | 
			
		||||
  # Set default shell to be dash for speed
 | 
			
		||||
  # Apparently this is bad because a lot of nix relies on bash
 | 
			
		||||
  # environment.binsh = "${pkgs.dash}/bin/dash";
 | 
			
		||||
  environment.variables = {
 | 
			
		||||
    EDITOR = "emacsclient -t -a";
 | 
			
		||||
    VISUAL = "emacsclient -c -a";
 | 
			
		||||
  };
 | 
			
		||||
  environment.homeBinInPath = true;
 | 
			
		||||
  programs.fish.enable = true;
 | 
			
		||||
  programs.zsh.enable = true;
 | 
			
		||||
 | 
			
		||||
  # Define a user account. Don't forget to set a password with ‘passwd’.
 | 
			
		||||
  users.users.chris = {
 | 
			
		||||
    isNormalUser = true;
 | 
			
		||||
| 
						 | 
				
			
			@ -133,6 +142,8 @@
 | 
			
		|||
    ydotool
 | 
			
		||||
    bottles
 | 
			
		||||
    exa
 | 
			
		||||
    imv
 | 
			
		||||
    feh
 | 
			
		||||
    mpv
 | 
			
		||||
    yt-dlp
 | 
			
		||||
    rofi-emoji
 | 
			
		||||
| 
						 | 
				
			
			@ -169,12 +180,19 @@
 | 
			
		|||
    any-nix-shell
 | 
			
		||||
    wtype
 | 
			
		||||
    xdotool
 | 
			
		||||
    wmctrl
 | 
			
		||||
    xcape
 | 
			
		||||
    unclutter-xfixes
 | 
			
		||||
    bluez-tools
 | 
			
		||||
    networkmanager_dmenu
 | 
			
		||||
    qt5ct
 | 
			
		||||
    lxappearance
 | 
			
		||||
    spotdl
 | 
			
		||||
    kdenlive
 | 
			
		||||
    ffmpeg
 | 
			
		||||
    wlroots
 | 
			
		||||
    picom-next
 | 
			
		||||
    pamixer
 | 
			
		||||
    blender
 | 
			
		||||
    neofetch
 | 
			
		||||
    # Dev tools
 | 
			
		||||
| 
						 | 
				
			
			@ -223,7 +241,7 @@
 | 
			
		|||
 | 
			
		||||
  services.emacs = {
 | 
			
		||||
    enable = true;
 | 
			
		||||
    package = with pkgs; ((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages (epkgs: [ epkgs.vterm epkgs.magit epkgs.pdf-tools ]));
 | 
			
		||||
    package = with pkgs; ((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages (epkgs: [ epkgs.vterm epkgs.magit epkgs.pdf-tools pkgs.mu ]));
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  # Some programs need SUID wrappers, can be configured further or are
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,14 +34,6 @@
 | 
			
		|||
  # Select internationalisation properties.
 | 
			
		||||
  i18n.defaultLocale = "en_US.UTF-8";
 | 
			
		||||
 | 
			
		||||
  # Set default shell to be dash for speed
 | 
			
		||||
  # Apparently this is bad because a lot of nix relies on bash
 | 
			
		||||
  # environment.binsh = "${pkgs.dash}/bin/dash";
 | 
			
		||||
  environment.variables = {
 | 
			
		||||
    EDITOR = "emacsclient -t";
 | 
			
		||||
    VISUAL = "emacsclient -c";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  hardware.uinput.enable = true;
 | 
			
		||||
 | 
			
		||||
  nixpkgs.config.packageOverrides = pkgs: {
 | 
			
		||||
| 
						 | 
				
			
			@ -118,8 +110,17 @@
 | 
			
		|||
  # Enable touchpad support (enabled default in most desktopManager).
 | 
			
		||||
  services.xserver.libinput.enable = true;
 | 
			
		||||
 | 
			
		||||
  # Set default shell to be dash for speed
 | 
			
		||||
  # Apparently this is bad because a lot of nix relies on bash
 | 
			
		||||
  # environment.binsh = "${pkgs.dash}/bin/dash";
 | 
			
		||||
  environment.variables = {
 | 
			
		||||
    EDITOR = "emacsclient -t -a";
 | 
			
		||||
    VISUAL = "emacsclient -c -a";
 | 
			
		||||
  };
 | 
			
		||||
  environment.homeBinInPath = true;
 | 
			
		||||
  programs.fish.enable = true;
 | 
			
		||||
  programs.zsh.enable = true;
 | 
			
		||||
 | 
			
		||||
  # Define a user account. Don't forget to set a password with ‘passwd’.
 | 
			
		||||
  users.users.chris = {
 | 
			
		||||
    isNormalUser = true;
 | 
			
		||||
| 
						 | 
				
			
			@ -170,6 +171,8 @@
 | 
			
		|||
    ydotool
 | 
			
		||||
    bottles
 | 
			
		||||
    exa
 | 
			
		||||
    imv
 | 
			
		||||
    feh
 | 
			
		||||
    mpv
 | 
			
		||||
    yt-dlp
 | 
			
		||||
    rofi-emoji
 | 
			
		||||
| 
						 | 
				
			
			@ -206,16 +209,21 @@
 | 
			
		|||
    any-nix-shell
 | 
			
		||||
    wtype
 | 
			
		||||
    xdotool
 | 
			
		||||
    wmctrl
 | 
			
		||||
    xcape
 | 
			
		||||
    unclutter-xfixes
 | 
			
		||||
    bluez-tools
 | 
			
		||||
    networkmanager_dmenu
 | 
			
		||||
    qt5ct
 | 
			
		||||
    lxappearance
 | 
			
		||||
    spotdl
 | 
			
		||||
    kdenlive
 | 
			
		||||
    ffmpeg
 | 
			
		||||
    wlroots
 | 
			
		||||
    picom-next
 | 
			
		||||
    pamixer
 | 
			
		||||
    neofetch
 | 
			
		||||
    afetch
 | 
			
		||||
    uwufetch
 | 
			
		||||
    screenfetch
 | 
			
		||||
    yafetch
 | 
			
		||||
    freshfetch
 | 
			
		||||
    disfetch
 | 
			
		||||
| 
						 | 
				
			
			@ -269,7 +277,7 @@
 | 
			
		|||
 | 
			
		||||
  services.emacs = {
 | 
			
		||||
    enable = true;
 | 
			
		||||
    package = with pkgs; ((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages (epkgs: [ epkgs.vterm epkgs.magit epkgs.pdf-tools ]));
 | 
			
		||||
    package = with pkgs; ((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages (epkgs: [ epkgs.vterm epkgs.magit epkgs.pdf-tools pkgs.mu ]));
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  # Some programs need SUID wrappers, can be configured further or are
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -302,9 +302,12 @@
 | 
			
		|||
    recursive = true;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  home.file.".config/fish" = {
 | 
			
		||||
    source = ../fish;
 | 
			
		||||
    recursive = true;
 | 
			
		||||
  home.file.".config/fish/config.fish" = {
 | 
			
		||||
    source = ../fish/config.fish;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  home.file.".config/fish/functions" = {
 | 
			
		||||
    source = ../fish/functions;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  programs.qutebrowser.enable = true;
 | 
			
		||||
| 
						 | 
				
			
			@ -318,6 +321,11 @@
 | 
			
		|||
    recursive = true;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  home.file.".config/imv" = {
 | 
			
		||||
    source = ../imv;
 | 
			
		||||
    recursive = true;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  home.file.".config/macchina" = {
 | 
			
		||||
    source = ../macchina;
 | 
			
		||||
    recursive = true;
 | 
			
		||||
| 
						 | 
				
			
			@ -328,7 +336,20 @@
 | 
			
		|||
    recursive = true;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  home.file."scripts" = {
 | 
			
		||||
  home.file.".config/alacritty" = {
 | 
			
		||||
    source = ../alacritty;
 | 
			
		||||
    recursive = true;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  home.file.".config/picom.conf" = {
 | 
			
		||||
    source = ../picom.conf;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  # home.file.".config/networkmanager-dmenu/config.ini" = {
 | 
			
		||||
  #   source = ../networkmanager-dmenu/config.ini;
 | 
			
		||||
  # };
 | 
			
		||||
 | 
			
		||||
  home.file."bin" = {
 | 
			
		||||
    source = ../scripts;
 | 
			
		||||
    recursive = true;
 | 
			
		||||
  };
 | 
			
		||||
| 
						 | 
				
			
			@ -351,10 +372,25 @@
 | 
			
		|||
      mkdir = "mkdir -pv";
 | 
			
		||||
      nupd = "update-nix";
 | 
			
		||||
      nupg = "upgrade-nix";
 | 
			
		||||
      suspend = "systemctl suspend";
 | 
			
		||||
      sysuse = "systemctl --user";
 | 
			
		||||
      myip = "curl icanhazip.com";
 | 
			
		||||
    };
 | 
			
		||||
    initExtra = ''
 | 
			
		||||
      macchina
 | 
			
		||||
      pfetch
 | 
			
		||||
    '';
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  xdg.desktopEntries = {
 | 
			
		||||
    mpv-slow = {
 | 
			
		||||
      name = "MPV";
 | 
			
		||||
      genericName = "Play from MPV but at normal speed";
 | 
			
		||||
      exec = "alacritty -e mpv --profile=slow %U";
 | 
			
		||||
      terminal = true;
 | 
			
		||||
      categories = [ "Application" ];
 | 
			
		||||
      mimeType = [ "audio/ogg" "audio/mpeg" "audio/opus" "audio/x-opus+ogg" "audio/x-wav" ];
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue