Initial commit

This commit is contained in:
Elnu 2022-10-05 19:42:30 -07:00
commit 3d0f689542
19 changed files with 807 additions and 0 deletions

25
polybar/aozora.nix Normal file
View file

@ -0,0 +1,25 @@
{ pkgs, lib, fetchFromGitHub, rustPlatform }:
rustPlatform.buildRustPackage rec {
pname = "aozora";
version = "5b94155b4137c885bd63bc49cd400ec58152547f";
buildInputs = with pkgs; [ openssl ];
nativeBuildInputs = with pkgs; [ pkg-config ];
src = fetchFromGitHub {
owner = "ElnuDev";
repo = pname;
rev = version;
sha256 = "93MP1Iw1eklC+IEQXAhzLHJ+qsDASm53qw7vUEtEstI=";
};
cargoSha256 = "fiDdk6c1rPS6L//KKqfp6ODxcLEzNKrpySCb9n8aGQ0=";
meta = with lib; {
description = "A simple CLI for fetching Plume Labs air quality info.";
homepage = "https://github.com/ElnuDev/aozora";
license = licenses.gpl3;
maintaners = [ maintainers.tailhook ];
};
}

135
polybar/index.nix Normal file
View file

@ -0,0 +1,135 @@
{ pkgs, lib, ... }:
{
# Dependencies
home.packages = with pkgs; [
(pkgs.callPackage ./aozora.nix { })
(pkgs.callPackage ./polybar-now-playing.nix { })
];
services.polybar = {
enable = true;
script = "polybar &";
package = pkgs.polybar.override {
i3GapsSupport = true;
alsaSupport = true;
};
config = {
"colors" = {
background = "#2e3440";
background-alt = "#3b4252";
foreground = "#eceff4";
primary = "#8fbcbb";
secondary = "#ff00ff"; # not sure what this does
alert = "#ff00ff"; # not sure what this does
disabled = "#434c5e";
};
"bar/top" = {
font-0 = "Noto Sans Mono;2";
font-1 = "Noto Sans CJK JP;2";
background = "\${colors.background}";
foreground = "\${colors.foreground}";
width = "100%";
height = "24pt";
line-size = "3pt";
padding-right = 1;
module-margin = 1;
separator = "|";
separator-foreground = "\${colors.disabled}";
cursor-click = "pointer";
cursor-scroll = "ns-resize";
modules-left = [
"xworkspaces"
"xwindow"
"now-playing"
];
modules-right = [
"aozora"
"filesystem"
"pulseaudio"
"memory"
"cpu"
"date"
];
};
"module/xworkspaces" = {
type = "internal/xworkspaces";
label-active-background = "\${colors.background-alt}";
label-active-underline = "\${colors.primary}";
label-active-padding-right = 1;
label-occupied-padding-right = 1;
label-urgent-background = "\${colors.alert}";
label-urgent-padding-right = 1;
label-empty-foreground = "\${colors.disabled}";
label-empty-padding-right = 1;
};
"module/xwindow" = {
type = "internal/xwindow";
};
"module/now-playing" = {
type = "custom/script";
tail = true;
format = "<label>";
exec = "/etc/profiles/per-user/elnu/bin/polybar-now-playing";
click-right = "kill -USR1 $(pgrep --oldest --parent %pid%)";
};
"module/aozora" = {
type = "custom/script";
format = "<label>";
# Wait a few seconds before running to prevent no internet error on first start
# TODO: make aozora wait blockingly for internet in --bar mode
exec = "/run/current-system/sw/bin/sleep 3 && /etc/profiles/per-user/elnu/bin/aozora air-quality-in-lakewood-aw-341300 --bar";
interval = 90;
};
"module/filesystem" = {
type = "internal/fs";
interval = 25;
mount-0 = "/";
label-mounted = "%{F#88c0d0}%mountpoint%%{F-} %percentage_used%%";
label-unmounted = "%mountpoint% not mounted";
label-unmounted-foreground = "\${colors.disabled}";
};
"module/pulseaudio" = {
type = "internal/pulseaudio";
format-volume-prefix = "VOL ";
format-volume-prefix-foreground = "\${colors.primary}";
label-muted = "muted";
label-muted-foreground = "\${colors.disabled}";
};
"module/memory" = {
type = "internal/memory";
interval = 2;
format-prefix = "RAM ";
format-prefix-foreground = "\${colors.primary}";
};
"module/cpu" = {
type = "internal/cpu";
interval = 2;
format-prefix = "CPU ";
format-prefix-foreground = "\${colors.primary}";
};
"module/date" = {
type = "internal/date";
internal = 1;
date = "%H:%M";
date-alt = "%Y-%m-%d %H:%M:%S";
label-foreground = "\${colors.primary}";
};
};
};
}

View file

@ -0,0 +1,36 @@
{ pkgs, lib, fetchFromGitHub }:
with pkgs.python3Packages;
buildPythonPackage rec {
pname = "polybar-now-playing";
version = "c61658efeda178a842b03c558749169aa629f5a6";
# nativeBuildInputs = with pkgs; [ setuptools ];
propagatedBuildInputs = with pkgs; [ dbus-python ];
src = fetchFromGitHub {
owner = "d093w1z";
repo = pname;
rev = version;
sha256 = "DM4cVOWZiEJtBbGcA7PCuX2ZQMbNOj3AQX795ABBvOs=";
};
meta = with lib; {
description = "Script for polybar to display and control media(not only Spotify) using DBus. ";
homepage = "https://github.com/d093w1z/polybar-now-playing";
maintaners = [ maintainers.tailhook ];
};
preBuild = ''
cat > setup.py << 'EOF'
from setuptools import setup
setup (
name='polybar-now-playing',
author='d093w1z',
description='Script for polybar to display and control media(not only Spotify) using DBus. ',
install_requires=['dbus-python'],
scripts=['polybar-now-playing'],
)
EOF
'';
}