Compare commits

..

No commits in common. "22d1ba38af7a11affff3058a905da6d2c2661d45" and "66f4e6a7b00a5f4f53430b313706ff5359e1f6fb" have entirely different histories.

38 changed files with 111 additions and 592 deletions

View File

@ -7,26 +7,10 @@
../../modules/common.nix
../../modules/x11.nix
../../modules/tlp.nix
../../modules/media.nix
../../modules/anki.nix
../../modules/power-control.nix
];
environment.systemPackages = with pkgs; [
xscreensaver
];
services.getty.autologinUser = "usr";
boot.loader = {
grub.timeoutStyle = "hidden";
timeout = 0;
grub.enable = true;
grub.device = "/dev/sda";
};
hardware.pulseaudio.enable = true;
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
networking.hostName = "x230t";

View File

@ -14,7 +14,7 @@
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/772f67d6-9434-42f1-aa3e-153e41affe4c";
{ device = "/dev/disk/by-uuid/99d9f4ba-5781-4f2d-aa15-f1f911658913";
fsType = "ext4";
};

27
builds/pash.nix Normal file
View File

@ -0,0 +1,27 @@
{ stdenv
, lib
, bash
, gnupg
, makeWrapper
, fetchgit
}:
stdenv.mkDerivation rec {
pname = "pash";
version = "1.00";
src = fetchgit {
url = "https://git.beepboop.systems/rndusr/pash";
sha256 = "sha256-0L3N7F4BwVdu4rR5xpUEIHcX/x64Gni8JTUki5kGH24=";
};
nativeBuildInputs = [ makeWrapper gnupg ];
installPhase = ''
mkdir -p $out/bin
cp $src/pash $out/bin/pash
wrapProgram $out/bin/pash --prefix PATH : ${lib.makeBinPath [ bash ]}
'';
phases = [ "installPhase" ];
}

View File

@ -1,6 +1,2 @@
cd ~/dot_testing
if [ -f "flake.nix" ]; then
sudo nixos-rebuild --flake . switch $@
else
sudo nixos-rebuild -I nixos-config=./boxes/$(hostname).nix switch $@
fi
sudo nixos-rebuild -I nixos-config=./boxes/$(hostname).nix switch $@

View File

@ -12,14 +12,14 @@
stdenv.mkDerivation rec {
pname = "st";
version = "1.02";
version = "69.19";
src = fetchgit {
url = "https://git.beepboop.systems/rndusr/st";
sha256 = "sha256-zdID1SUnTO/zl90EG8TguBNYYCnrnqFnSLz32kQZbng=";
};
nativeBuildInputs = [ pkg-config fontconfig freetype ncurses ];
nativeBuildInputs = [ pkg-config fontconfig freetype ncurses];
buildInputs = [ libX11 libXft ] ++ extraLibs;
buildPhase = ''

View File

@ -1,10 +1,5 @@
{ stdenv
, lib
# for statusbar
, pkg-config
, libxcb
# shell scripts stuff
, makeWrapper
, sxhkd
, bash
, feh
@ -12,33 +7,30 @@
, fzy
, figlet
, curl
, ytfzf
, xrandr
, makeWrapper
}:
stdenv.mkDerivation rec {
pname = "utils";
version = "1.01";
version = "1.00";
src = ./utils;
nativeBuildInputs = [ makeWrapper pkg-config libxcb ];
buildInputs = [ libxcb bash feh xrandr jq curl fzy ytfzf ];
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ bash feh xrandr jq curl fzy ];
buildPhase = ''
ls
make
'';
buildPhase = "";
installPhase = ''
mkdir -p $out/bin
for i in $(ls $src/sh); do
cp $src/sh/$i $out/bin
ln -sf $out/bin/tmenu_run $out/bin/regenerate
wrapProgram $out/bin/$i --prefix PATH : ${lib.makeBinPath [ sxhkd bash feh xrandr jq figlet curl fzy ytfzf ]}
wrapProgram $out/bin/$i --prefix PATH : ${lib.makeBinPath [ sxhkd bash feh xrandr jq figlet curl ]}
done
cp c/status/main $out/bin/statusbar
'';
phases = [ "buildPhase" "installPhase" ];
}

View File

@ -1,3 +0,0 @@
.PHONY: main
main:
make -C c/status -f Makefile

View File

@ -1,2 +0,0 @@
main
*.o

View File

@ -1,9 +0,0 @@
LDFLAGS=`pkg-config --cflags --libs xcb`
CFLAGS=-ggdb -fsanitize=address
main: battery.o bspwm.o time.o battstatus.o
clean:
rm *.o main
run:
./main

View File

@ -1,4 +0,0 @@
status
------
a simple statusbar script thing (tm)

View File

@ -1,38 +0,0 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <fcntl.h>
#include "battery.h"
#include "common.h"
/* config contains a path to the battery */
int mod_battery(char *config, char *name, char *pipename) {
struct message msg;
strcpy(msg.name, name);
int fd = open(pipename, O_WRONLY);
int battery;
int recvd;
chdir("/sys/class/power_supply");
chdir(config);
for(;;) {
battery = open("capacity", O_RDONLY);
recvd = read(battery, msg.content, 3);
msg.content[3] = '\0';
if (msg.content[2] == '\n') {
msg.content[2] = '\0';
}
close(battery);
write(fd, &msg, sizeof(msg));
sleep(30);
}
return 0;
}

View File

@ -1,6 +0,0 @@
#ifndef STATUS_BATTERY_H
#define STATUS_BATTERY_H
int mod_battery(char *config, char *name, char *pipename);
#endif

View File

@ -1,48 +0,0 @@
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include "battstatus.h"
#include "common.h"
int mod_battstatus(char *config, char *name, char *pipename) {
char status;
int battery;
struct message msg;
strcpy(msg.name, name);
int fd = open(pipename, O_WRONLY);
chdir("/sys/class/power_supply");
chdir(config);
for(;;) {
battery = open("status", O_RDONLY);
read(battery, msg.content, 1);
switch(msg.content[0]) {
case 'N': /* not charging */
msg.content[0] = '-';
break;
case 'C': /* charging */
msg.content[0] = '^';
break;
case 'D': /* discharging */
msg.content[0] = 'U';
break;
case 'U': /* unknown */
msg.content[0] = '?';
break;
default: /* what's going on? */
msg.content[0] = '!';
break;
}
msg.content[1] = '\0';
close(battery);
write(fd, &msg, sizeof(msg));
sleep(30);
}
return 0;
}

View File

@ -1,6 +0,0 @@
#ifndef STATUS_BATTSTAT_H
#define STATUS_BATTSTAT_H
int mod_battstatus(char *config, char *name, char *pipename);
#endif

View File

@ -1,142 +0,0 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <xcb/xcb.h>
#include <fcntl.h>
#include "bspwm.h"
#include "common.h"
const char subscribe[] = "subscribe";
int get_socket(void) {
struct sockaddr_un sock;
char *host;
int displaynumber, screennumber;
int fd;
xcb_parse_display(NULL, &host, &displaynumber, &screennumber);
sock.sun_family = AF_UNIX;
snprintf(
sock.sun_path,
sizeof(sock.sun_path), "/tmp/bspwm%s_%i_%i-socket",
host, displaynumber, screennumber
);
free(host);
fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (connect(
fd,
(struct sockaddr *) &sock,
sizeof(sock)
) == -1) {
return -1;
} else {
return fd;
}
}
int should_be_shown(char c) {
return c == 'O' || c == 'o' || c == 'F' || c == 'U' || c == 'u';
}
int is_a_desktop(char c) {
return c == 'O' || c == 'o' || c == 'F' || c == 'f' || c == 'U' || c == 'u';
}
/* XXX: this function has the potential to buffer overflow by ONE BYTE.
* probably fix this? */
void print_desktop_status(char *in, char *out, int outlen) {
int written;
int i;
char c;
/* flags */
int read_colon;
int skip_to_next_colon;
int read_until_colon;
int is_first_desktop;
int last_was_desktop;
i = 0;
written = 0;
read_colon = 1;
skip_to_next_colon = 0;
read_until_colon = 0;
is_first_desktop = 1;
last_was_desktop = 0;
for(;;) {
c = in[i];
if(!c) break;
if(written == outlen) break;
if (skip_to_next_colon) {
if (c == ':') {
skip_to_next_colon = 0;
read_until_colon = 0;
read_colon = 1;
} else if (read_until_colon) {
out[written] = c;
written++;
}
} else if (read_colon && should_be_shown(c)) {
if (!is_first_desktop) {
out[written] = ' ';
written++;
}
switch(c) {
case 'O':
case 'F': /* fallthrough */
out[written] = '*';
written++;
break;
}
skip_to_next_colon = 1;
read_until_colon = 1;
read_colon = 0;
is_first_desktop = 0;
last_was_desktop = 1;
} else if (read_colon && is_a_desktop(c)) {
last_was_desktop = 1;
} else {
if(last_was_desktop) {
break;
}
}
i++;
}
out[written] = '\0';
}
int mod_bspwm(char *config, char *name, char *pipename) {
struct message msg;
int fd, bspcfd;
char in[BUFFER_SIZE];
strcpy(msg.name, name);
msg.flags = 0;
fd = open(pipename, O_WRONLY);
bspcfd = get_socket();
send(bspcfd, subscribe, sizeof(subscribe), 0);
for(;;) {
int recvd = recv(bspcfd, in, BUFFER_SIZE, 0);
print_desktop_status(in, msg.content, 512);
write(fd, &msg, sizeof(msg));
memset(msg.content, 0, 512);
}
return 0;
}

View File

@ -1,6 +0,0 @@
#ifndef STATUS_BSPWM_H
#define STATUS_BSPWM_H
int mod_bspwm(char *config, char *name, char *pipename);
#endif

View File

@ -1,21 +0,0 @@
#ifndef STATUS_COMMON_H
#define STATUS_COMMON_H
#define LENGTH(x) sizeof(x) / sizeof(x[0])
#define BUFFER_SIZE 512
struct module {
int (*fork_callback)(char *config, char *name, char *pipename);
char name[16];
char config[512];
char buffer[512];
int buflen;
};
struct message {
int flags;
char name[16];
char content[512];
};
#endif

View File

@ -1,91 +0,0 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <time.h>
#include <fcntl.h>
#include <xcb/xcb.h>
#include <string.h>
#include "common.h"
#include "battery.h"
#include "battstatus.h"
#include "bspwm.h"
#include "time.h"
struct module mods[] = {
{mod_battery, "battery", "BAT0", { '\0' }},
{mod_battstatus, "battstatus", "BAT0", { '\0' }},
{mod_time, "time", "", { '\0' }},
/* {mod_bspwm, "bspwm", "", { '\0' }}, not working at the moment */
};
void create_module_proc(int index, char *pipename) {
pid_t pid = fork();
if (pid == 0) { /* we're the child */
mods[index].fork_callback(
mods[index].config,
mods[index].name,
pipename
);
}
}
void create_module_procs(char *pipename) {
for(int i = 0; i < LENGTH(mods); i++) {
create_module_proc(i, pipename);
}
}
void redraw() {
/* get the progress' module's value, convert it to int, and then
* figure out how much of the screen should be shaded in */
printf("\033[H\033[2J");
for(int i = 0; i < LENGTH(mods); i++) {
if (i == 0) printf("%s ", mods[i].buffer);
else printf("| %s ", mods[i].buffer);
}
fflush(stdout);
}
static char NAMED_PIPE[] = "/home/usr/.cache/statusbar_pipe";
int main(void) {
char pipename[BUFFER_SIZE];
srand(time(NULL));
strcpy(pipename, &NAMED_PIPE);
pipename[sizeof(NAMED_PIPE) - 1] = 'A' + (rand() % 26);
pipename[sizeof(NAMED_PIPE)] = 'A' + (rand() % 26);
pipename[sizeof(NAMED_PIPE) + 1] = '\0';
mkfifo(pipename, 0666);
int fd = open(pipename, O_RDWR);
struct message msg;
create_module_procs(pipename);
for (;;) {
int ret = read(fd, &msg, sizeof(msg));
if(ret < 0) {
printf("error while reading message from child\n");
}
for(int i = 0; i < LENGTH(mods); i++) {
if(strcmp(mods[i].name, msg.name) == 0) {
mods[i].buflen = strlen(msg.content);
strcpy(mods[i].buffer, msg.content);
redraw();
break;
}
}
}
return 0;
}

View File

@ -1,9 +0,0 @@
with import <nixpkgs> {};
pkgs.mkShell {
nativeBuildInputs = [
gdb
gnumake
pkg-config
xorg.libxcb
];
}

View File

@ -1,27 +0,0 @@
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include <string.h>
#include "common.h"
#include "time.h"
int mod_time(char *config, char *name, char *pipename) {
struct message msg;
time_t now;
struct tm *tm;
int fd;
strcpy(msg.name, name);
msg.flags = 0;
fd = open(pipename, O_WRONLY);
for(;;) {
time(&now);
tm = localtime(&now);
strftime(msg.content, 512, "%H:%M", tm);
write(fd, &msg, sizeof(msg));
sleep(60);
}
}

View File

@ -1,6 +0,0 @@
#ifndef STATUS_TIME_H
#define STATUS_TIME_H
int mod_time(char *config, char *name, char *pipename);
#endif

View File

@ -1,13 +1,4 @@
# mode - change the current effective sxhkd configuration
if [ -n "$1" ]; then
pkill sxhkd
sxhkd -c ~/.config/sxhkd/$1 & disown
[ -f "~/.config/sxhkd/$1.sh ] && ~/.config/sxhkd/$1.sh
exit
fi
# we need a menu
choice=$(ls ~/.config/sxhkd | tmenu)
$0 $choice
pkill sxhkd
sxhkd -c ~/.config/sxhkd/$1 & disown

View File

@ -1,12 +0,0 @@
#!/bin/sh
geos=$(
xrandr | \
grep ' connected' | \
grep -o '[0-9]*x[0-9]*+[0-9]*+[0-9]*' | \
awk -F'[x+]' '{print $1 "x20+" $3 "+" $4}'
)
for i in $geos; do
st -c statusbar -p -g "$i" -e statusbar & disown
done

View File

@ -1,4 +0,0 @@
#!/bin/sh
st &
statusbar

View File

@ -91,12 +91,12 @@
},
"locked": {
"lastModified": 1,
"narHash": "sha256-YmGlTX2Y5d6aQzqZ1IzVp1CnbyXuHE1Fwwtf9nB40zE=",
"path": "/nix/store/arzg5zcsb349c5rz3kaflqiszdvfbqny-source/builds",
"narHash": "sha256-PYg0MoGsZWtACHUwF/teZJ96wUhDs3rHgTe2A0sMQ/A=",
"path": "/nix/store/lnr366wiqiliymnv4j8h8j01m7mvcb5w-source/builds",
"type": "path"
},
"original": {
"path": "/nix/store/arzg5zcsb349c5rz3kaflqiszdvfbqny-source/builds",
"path": "/nix/store/lnr366wiqiliymnv4j8h8j01m7mvcb5w-source/builds",
"type": "path"
}
}

View File

@ -24,13 +24,6 @@
specialArgs = { inherit inputs; };
modules = [
./boxes/virtbox
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.users.usr = import ./boxes/virtbox/home.nix;
}
];
};
x230t = nixpkgs.lib.nixosSystem {
@ -38,13 +31,6 @@
specialArgs = { inherit inputs; };
modules = [
./boxes/x230t
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.users.usr = import ./boxes/x230t/home.nix;
}
];
};
mainsail = nixpkgs.lib.nixosSystem {
@ -52,15 +38,31 @@
specialArgs = { inherit inputs; };
modules = [
./boxes/mainsail
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.users.usr = import ./boxes/mainsail/home.nix;
}
];
};
};
homeConfigurations = {
"usr@x230t" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = { inherit inputs; };
modules = [
./boxes/x230t/home.nix
];
};
"usr@mainsail" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = { inherit inputs; };
modules = [
./boxes/x230t/home.nix
];
};
"usr@virtbox" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = { inherit inputs; };
modules = [
./boxes/x230t/home.nix
];
};
};
};
}

View File

@ -54,6 +54,3 @@ export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
# source the bashrc(s)
[ -f $HOME/.config/bash/bashrc ] && . $HOME/.config/bash/bashrc
[ -f $HOME/.bashrc ] && . $HOME/.bashrc
# if we're interactive and the tty is /dev/tty1 then start xorg
[ "$(tty)" = "/dev/tty1" ] && sx

View File

@ -1,21 +1,11 @@
#!/bin/sh
# rndusr's bspwmrc
bspc monitor -d 1 2 3 4 5 6 7 8 9
bspc rule -a st-gpg-menu state=floating
bspc rule -a statusbar border=off sticky=on state=floating manage=off
bspc rule -a tmenu-prompt border=on sticky=on state=floating
bspc rule -a Xmessage border=on state=floating
bspc rule -a Zathura state=tiled
bspc rule -a generic-st-window state=floating manage=on sticky=on border=on
bspc rule -a floating-feh state=floating
# post-wm boilerplate
statuswrap
wallpaper
disp
HOME=".config/xscreensaver" xscreensaver --no-splash &
polybar &
dunst &
# set up the color scheme
bspc config normal_border_color "#161510"
@ -26,5 +16,13 @@ bspc config pointer_follows_focus true
bspc config pointer_follows_monitor true
bspc config focus_follows_pointer true
bspc config window_gap 0
bspc config top_padding 20
bspc config window_gap 3
#bspc config top_padding 20
bspc rule -a st-gpg-menu state=floating
bspc rule -a statusbar border=off sticky=on state=floating manage=off
bspc rule -a tmenu-prompt border=on sticky=on state=floating
bspc rule -a Xmessage border=on state=floating
bspc rule -a Zathura state=tiled
bspc rule -a generic-st-window state=floating manage=on sticky=on border=on
bspc rule -a floating-feh state=floating

View File

@ -8,8 +8,5 @@
programs.chromium = {
enable = true;
package = pkgs.ungoogled-chromium;
extensions = [
{ id = "ecnphlgnajanjnkcmbpancdjoidceilk"; }
];
};
}

View File

@ -80,6 +80,20 @@ globals.vimtex_view_method = 'zathura'
-- }}}
-- autocommands {{{
-- autocmds for sxhkd and bspwm config files
vim.api.nvim_create_autocmd({"BufWrite"}, {
pattern = {"bspwmrc"},
callback = function()
vim.fn.system("bspc wm -r")
end
})
vim.api.nvim_create_autocmd({"BufWrite"}, {
pattern = {"sxhkdrc"},
callback = function()
vim.fn.system("killall sxhkd -USR1")
end
})
function setTabbing(lang, width)
vim.api.nvim_create_autocmd({"Filetype"}, {
pattern = {lang},
@ -139,8 +153,19 @@ local packer = require('packer').startup(function(use)
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-nvim-lsp'
use 'L3MON4D3/LuaSnip'
use 'https://github.com/vimwiki/vimwiki.git'
use 'lervag/vimtex'
use 'https://github.com/protex/better-digraphs.nvim'
use 'https://github.com/itchyny/calendar.vim'
use {
"folke/which-key.nvim",
config = function()
vim.o.timeout = true
vim.o.timeoutlen = 300
-- require("which-key").setup {
-- }
end
}
if packer_bootstrap then
require('packer').sync()

View File

@ -7,8 +7,5 @@
".config/sxhkd/sxhkdrc" = {
source = ./sxhkdrc;
};
".config/sxhkd/mouse" = {
source = ./mouse;
};
};
}

View File

@ -1,7 +0,0 @@
{ lib, config, pkgs, ...}:
{
environment.systemPackages = with pkgs; [
anki-bin
];
}

View File

@ -25,7 +25,7 @@
users.users.usr = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ];
extraGroups = [ "wheel" ];
initialPassword = "usr";
};
}

View File

@ -1,10 +0,0 @@
{ lib, config, pkgs, ...}:
{
environment.systemPackages = with pkgs; [
musescore
audacity
libsForQt5.kdenlive
anki-bin
];
}

View File

@ -1,25 +0,0 @@
{ lib, config, pkgs, inputs, ...}:
{
# let regular users control power
security.sudo = {
enable = true;
extraRules = [{
commands = [
{
command = "${pkgs.systemd}/bin/systemctl suspend";
options = [ "NOPASSWD" ];
}
{
command = "${pkgs.systemd}/bin/reboot";
options = [ "NOPASSWD" ];
}
{
command = "${pkgs.systemd}/bin/poweroff";
options = [ "NOPASSWD" ];
}
];
groups = [ "wheel" ];
}];
};
}

View File

@ -3,6 +3,4 @@
{
sound.enable = true;
hardware.pulseaudio.enable = true;
users.extraUsers.usr.extraGroups = [ "audio" ];
}

View File

@ -1,7 +0,0 @@
{ lib, config, pkgs, ...}:
{
environment.systemPackages = with pkgs; [
sxiv
];
}

View File

@ -6,13 +6,11 @@
./gnupg.nix
./fonts.nix
./pulse.nix
./sxiv.nix
];
environment.systemPackages = with pkgs; [
bspwm
sxhkd
xscreensaver
environment.systemPackages = [
pkgs.bspwm
pkgs.sxhkd
];
services.xserver = {