Compare commits
2 Commits
326d8fbae7
...
e4161bfed9
Author | SHA1 | Date |
---|---|---|
Sam | e4161bfed9 | |
Sam | 18448d340a |
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, inputs, ... }:
|
||||
{ pkgs, inputs, outputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
inputs.nix-colors.homeManagerModules.default
|
||||
|
@ -7,6 +7,11 @@
|
|||
./fonts.nix
|
||||
];
|
||||
|
||||
nixpkgs.overlays = [
|
||||
inputs.nur.overlay
|
||||
outputs.overlays.additions
|
||||
];
|
||||
|
||||
# Global home packages without config go here (for all hosts and users)
|
||||
home.packages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
|
@ -20,7 +25,7 @@
|
|||
btop
|
||||
htop
|
||||
postgresql
|
||||
hugo
|
||||
bc
|
||||
;
|
||||
};
|
||||
home.stateVersion = "23.11";
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
{ pkgs, inputs, ... }: {
|
||||
{ pkgs, ... }: {
|
||||
imports = [
|
||||
./firefox.nix
|
||||
./alacritty.nix
|
||||
./zotero.nix
|
||||
];
|
||||
|
||||
nixpkgs.overlays = [
|
||||
inputs.nur.overlay
|
||||
];
|
||||
|
||||
# Global packages for desktop environments
|
||||
home.packages = [
|
||||
pkgs.alacritty
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
|
||||
imports = [
|
||||
../common
|
||||
../status-bar
|
||||
];
|
||||
|
||||
home.packages = [
|
||||
pkgs.dwmblocks
|
||||
];
|
||||
|
||||
# TODO configure x11 to look in .config/x11
|
||||
|
@ -8,6 +15,14 @@
|
|||
home.file.".xinitrc" = {
|
||||
recursive = true;
|
||||
text = ''
|
||||
|
||||
autostart="dwmblocks"
|
||||
|
||||
for program in $autostart; do
|
||||
pidof -sx "$program" || "$program" &
|
||||
done >/dev/null 2>&1
|
||||
|
||||
|
||||
if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
|
||||
eval $(dbus-launch --exit-with-session --sh-syntax)
|
||||
fi
|
|
@ -1,6 +1,5 @@
|
|||
{ lib
|
||||
, config
|
||||
, pkgs
|
||||
, ...
|
||||
}: {
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = [
|
||||
(pkgs.writeShellScriptBin "sb-cpu-pct" (builtins.readFile ./sb-cpu-pct.sh))
|
||||
(pkgs.writeShellScriptBin "sb-mem-pct" (builtins.readFile ./sb-mem-pct.sh))
|
||||
(pkgs.writeShellScriptBin "sb-volume" (builtins.readFile ./sb-volume.sh))
|
||||
(pkgs.writeShellScriptBin "sb-network-status" (builtins.readFile ./sb-network-status.sh))
|
||||
(pkgs.writeShellScriptBin "sb-updates" (builtins.readFile ./sb-updates.sh))
|
||||
];
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
echo $(top -bn 1 |grep "Cpu(s)" | awk '{print $2+$6 "%"}' | sed "s/\..//g")
|
|
@ -0,0 +1,3 @@
|
|||
# Gets current ram percent utilisation
|
||||
|
||||
echo $(free | awk '/^Mem/ {print "100*" $3 " / " $2 }' | bc | awk '{print $1"%"}')
|
|
@ -0,0 +1,43 @@
|
|||
# Nerd Font Symbols
|
||||
wifi_symbol=" "
|
||||
lan_symbol=" "
|
||||
disconnected_symbol=" "
|
||||
vpn_symbol=" "
|
||||
internet=" "
|
||||
internet_disconnected=" "
|
||||
|
||||
# Get the network status
|
||||
DEFAULT_INTERFACE=$(ip route | grep '^default' | awk '{print $5}' | uniq)
|
||||
IP_ADDRESS=$(ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p')
|
||||
|
||||
if [ -z "$DEFAULT_INTERFACE" ]; then
|
||||
network_symbol="$disconnected_symbol"
|
||||
else
|
||||
# Check if it is a wireless interface (wlan*)
|
||||
if [[ $DEFAULT_INTERFACE == wl* ]]; then
|
||||
network_symbol="$wifi_symbol"
|
||||
else
|
||||
network_symbol="$lan_symbol"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check internet connectivity
|
||||
if ! ping -c 1 8.8.8.8 &> /dev/null;
|
||||
then
|
||||
network_symbol="$network_symbol $internet_disconnected"
|
||||
else
|
||||
network_symbol="$network_symbol $internet"
|
||||
fi
|
||||
|
||||
if ip addr show tun0 > /dev/null 2>&1; then
|
||||
network_symbol="$network_symbol $vpn_symbol"
|
||||
else
|
||||
network_symbol="$network_symbol"
|
||||
fi
|
||||
|
||||
if [ -z "$IP_ADDRESS" ];
|
||||
then
|
||||
printf "$network_symbol"
|
||||
else
|
||||
printf "$network_symbol|$IP_ADDRESS"
|
||||
fi
|
|
@ -0,0 +1,6 @@
|
|||
# Gets number of flake inputs that are ready for update
|
||||
# Checks every 60 minutes
|
||||
inputs=$(cd /etc/nixos &&
|
||||
nix flake update --output-lock-file <(cat flake.nix) 2> /tmp/update &&
|
||||
cat /tmp/update | grep -c Update)
|
||||
printf " $inputs"
|
|
@ -0,0 +1,41 @@
|
|||
# Prints the current volume or 婢 if muted.
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) setsid -f "$TERMINAL" -e pulsemixer ;;
|
||||
2) pamixer -t && pkill -RTMIN+10 dwmblocks && exit 1 ;;
|
||||
4) pamixer --set-limit 150 --allow-boost -i 1 && pkill -RTMIN+10 dwmblocks && exit 1 ;;
|
||||
5) pamixer --set-limit 150 --allow-boost -d 1 && pkill -RTMIN+10 dwmblocks && exit 1 ;;
|
||||
3) notify-send "Volume module" "\- Shows volume , 婢 if muted.
|
||||
- Middle click to mute.
|
||||
- Scroll to change." ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
get_mic_status=$(pamixer --default-source --get-mute)
|
||||
vol="$(pamixer --get-volume)"
|
||||
|
||||
if [ $get_mic_status == false ]; then
|
||||
mic_status=""
|
||||
else
|
||||
mic_status=""
|
||||
fi
|
||||
|
||||
if [ "$vol" -gt "90" ]; then
|
||||
icon=""
|
||||
elif [ "$vol" -gt "50" ]; then
|
||||
icon=""
|
||||
elif [ "$vol" -gt "30" ]; then
|
||||
icon=""
|
||||
elif [ "$vol" -gt "0" ]; then
|
||||
icon=""
|
||||
else
|
||||
icon=""
|
||||
fi
|
||||
|
||||
if [ $(pamixer --get-mute) = true ]; then
|
||||
icon=""
|
||||
vol="0"
|
||||
fi
|
||||
|
||||
print_string="$mic_status $icon $vol%"
|
||||
printf '%s' "${print_string}"
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
programs.git = {
|
||||
enable = true;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
./common/optional/git.nix
|
||||
./common/optional/sops.nix
|
||||
./common/optional/syncthing.nix
|
||||
./common/optional/desktop/startx
|
||||
./common/optional/desktop/dwm
|
||||
|
||||
];
|
||||
|
||||
|
|
|
@ -3,4 +3,5 @@
|
|||
pkgs: {
|
||||
sddm-theme = pkgs.callPackage ./sddm-theme { };
|
||||
st = pkgs.callPackage ./st { };
|
||||
dwmblocks = pkgs.callPackage ./dwmblocks { };
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
{ pkgs ? import <nixpkgs> { }
|
||||
, fetchFromGitea ? pkgs.fetchFromGitea
|
||||
, pkg-config ? pkgs.pkg-config
|
||||
, libX11 ? pkgs.xorg.libX11
|
||||
, libXft ? pkgs.xorg.libXft
|
||||
}:
|
||||
pkgs.stdenv.mkDerivation {
|
||||
pname = "dwmblocks";
|
||||
name = "dwmblocks";
|
||||
|
||||
src = fetchFromGitea {
|
||||
domain = "git.bitlab21.com";
|
||||
owner = "sam";
|
||||
repo = "dwmblocks";
|
||||
rev = "c4e7a9b1eb98123e239ba76bc551934721fd18ca";
|
||||
sha256 = "sha256-F1x8jOT+c2pPCF9qKq5boIWzegMBTCxwzKMVtmtMWGM=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
libX11
|
||||
libXft
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
make
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
mv dwmblocks $out/bin
|
||||
'';
|
||||
|
||||
}
|
|
@ -1,13 +1,8 @@
|
|||
{ pkgs ? import <nixpkgs> { }
|
||||
, fetchFromGitea ? pkgs.fetchFromGitea
|
||||
, stdenv ? pkgs.stdenv
|
||||
, pkg-config ? pkgs.pkg-config
|
||||
, fontconfig ? pkgs.fontconfig
|
||||
, freetype ? pkgs.freetype
|
||||
, libX11 ? pkgs.xorg.libX11
|
||||
, libXft ? pkgs.xorg.libXft
|
||||
, ncurses ? pkgs.ncurses
|
||||
, extraLibs ? [ ]
|
||||
}:
|
||||
pkgs.stdenv.mkDerivation {
|
||||
pname = "st";
|
||||
|
@ -21,31 +16,22 @@ pkgs.stdenv.mkDerivation {
|
|||
sha256 = "sha256-4W9w/Efk+YCSP1VuUFr+jPXIyrlpktwxRPUOZHTAtx8=";
|
||||
};
|
||||
|
||||
makeFlags = [
|
||||
"PKG_CONFIG=${stdenv.cc.targetPrefix}pkg-config"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
ncurses
|
||||
fontconfig
|
||||
freetype
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
libX11
|
||||
libXft
|
||||
] ++ extraLibs;
|
||||
|
||||
installFlags = [ "PREFIX=$(out)" ];
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
make
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/usr/local/bin
|
||||
mv st $out/usr/local/bin
|
||||
mkdir -p $out/bin
|
||||
mv st $out/bin
|
||||
'';
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue