More refactoring goodness
This commit is contained in:
parent
9ebd743f78
commit
bbe5d55143
2
Makefile
2
Makefile
|
@ -46,7 +46,7 @@ channels:
|
||||||
|
|
||||||
$(NIXOS_PREFIX)/configuration.nix:
|
$(NIXOS_PREFIX)/configuration.nix:
|
||||||
@sudo nixos-generate-config --root "$(PREFIX)"
|
@sudo nixos-generate-config --root "$(PREFIX)"
|
||||||
@echo "(import /etc/dotfiles \"$$(hostname)\")" | sudo tee "$(NIXOS_PREFIX)/configuration.nix"
|
@echo "import /etc/dotfiles \"$$(hostname)\"" | sudo tee "$(NIXOS_PREFIX)/configuration.nix"
|
||||||
|
|
||||||
|
|
||||||
# Convenience aliases
|
# Convenience aliases
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
# hosts/personal.nix --- settings common to my personal systems
|
# hosts/personal.nix --- settings common to my personal systems
|
||||||
|
|
||||||
{ pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
{
|
{
|
||||||
imports = [ ./. ];
|
imports = [
|
||||||
|
./.
|
||||||
|
<modules/xdg.nix>
|
||||||
|
];
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
# Support for more filesystems
|
# Support for more filesystems
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
exfat
|
exfat
|
||||||
ntfs3g
|
ntfs3g
|
||||||
hfsprogs
|
hfsprogs
|
||||||
|
@ -26,27 +29,4 @@
|
||||||
"192.168.1.11" = [ "shiro" ];
|
"192.168.1.11" = [ "shiro" ];
|
||||||
"192.168.1.12" = [ "midori" ];
|
"192.168.1.12" = [ "midori" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
### A tidy $HOME is a tidy mind.
|
|
||||||
# Obey XDG conventions;
|
|
||||||
my.home.xdg.enable = true;
|
|
||||||
environment.variables = {
|
|
||||||
# These are the defaults, but some applications are buggy when these lack
|
|
||||||
# explicit values.
|
|
||||||
XDG_CONFIG_HOME = "$HOME/.config";
|
|
||||||
XDG_CACHE_HOME = "$HOME/.cache";
|
|
||||||
XDG_DATA_HOME = "$HOME/.local/share";
|
|
||||||
XDG_BIN_HOME = "$HOME/.local/bin";
|
|
||||||
};
|
|
||||||
# Conform more programs to XDG conventions. The rest are handled by their
|
|
||||||
# respective modules.
|
|
||||||
my.env = {
|
|
||||||
__GL_SHADER_DISK_CACHE_PATH = "$XDG_CACHE_HOME/nv";
|
|
||||||
CUDA_CACHE_PATH = "$XDG_CACHE_HOME/nv";
|
|
||||||
HISTFILE = "$XDG_DATA_HOME/bash/history";
|
|
||||||
INPUTRC = "$XDG_CACHE_HOME/readline/inputrc";
|
|
||||||
LESSHISTFILE = "$XDG_CACHE_HOME/lesshst";
|
|
||||||
WGETRC = "$XDG_CACHE_HOME/wgetrc";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
55
modules/desktop/apps/st.nix
Normal file
55
modules/desktop/apps/st.nix
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
services.xserver.desktopManager.xterm.enable = false;
|
||||||
|
|
||||||
|
my.packages = with pkgs; [
|
||||||
|
libqalculate # calculator cli w/ currency & unit conversion
|
||||||
|
|
||||||
|
xst # st + nice-to-have extensions
|
||||||
|
(makeDesktopItem {
|
||||||
|
name = "xst";
|
||||||
|
desktopName = "Suckless Terminal";
|
||||||
|
genericName = "Default terminal";
|
||||||
|
icon = "utilities-terminal";
|
||||||
|
exec = "${xst}/bin/xst";
|
||||||
|
categories = "Development;System;Utility";
|
||||||
|
})
|
||||||
|
|
||||||
|
(writeScriptBin "st-scratch" ''
|
||||||
|
#!${stdenv.shell}
|
||||||
|
SCRID=st-scratch
|
||||||
|
focused=$(xdotool getactivewindow)
|
||||||
|
scratch=$(xdotool search --onlyvisible --classname $SCRID)
|
||||||
|
if [[ -n $scratch ]]; then
|
||||||
|
if [[ $focused == $scratch ]]; then
|
||||||
|
xdotool windowkill $scratch
|
||||||
|
else
|
||||||
|
xdotool windowactivate $scratch
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
xst -t $SCRID -n $SCRID -c $SCRID \
|
||||||
|
-f "$(xrdb -query | grep 'st-scratch\.font' | cut -f2)" \
|
||||||
|
-g 100x26 \
|
||||||
|
-e $SHELL
|
||||||
|
fi
|
||||||
|
'')
|
||||||
|
(writeScriptBin "st-calc" ''
|
||||||
|
#!${stdenv.shell}
|
||||||
|
SCRID=st-calc
|
||||||
|
scratch=$(xdotool search --onlyvisible --classname $SCRID)
|
||||||
|
[ -n "$scratch" ] && xdotool windowkill $scratch
|
||||||
|
xst -t $SCRID -n $SCRID -c $SCRID \
|
||||||
|
-f "$(xrdb -query | grep 'st-scratch\.font' | cut -f2)" \
|
||||||
|
-g 80x12 \
|
||||||
|
-e $SHELL -c qalc
|
||||||
|
'')
|
||||||
|
(makeDesktopItem {
|
||||||
|
name = "st-calc";
|
||||||
|
desktopName = "Calculator";
|
||||||
|
icon = "calc";
|
||||||
|
exec = "st-calc";
|
||||||
|
categories = "Development";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
|
@ -2,14 +2,16 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
./. # common settings
|
||||||
# My launcher
|
# My launcher
|
||||||
./apps/rofi.nix
|
./apps/rofi.nix
|
||||||
|
|
||||||
# I often need a thumbnail browser to show off, peruse or organize photos,
|
# I often need a thumbnail browser to show off, peruse or organize photos,
|
||||||
# design work, or digital art.
|
# design work, or digital art.
|
||||||
./apps/thunar.nix
|
./apps/thunar.nix
|
||||||
|
#
|
||||||
./apps/redshift.nix
|
./apps/redshift.nix
|
||||||
|
#
|
||||||
|
./apps/st.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
|
@ -26,7 +28,6 @@
|
||||||
services = {
|
services = {
|
||||||
xserver = {
|
xserver = {
|
||||||
enable = true;
|
enable = true;
|
||||||
desktopManager.xterm.enable = false;
|
|
||||||
windowManager.bspwm.enable = true;
|
windowManager.bspwm.enable = true;
|
||||||
displayManager.lightdm = {
|
displayManager.lightdm = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -1,6 +1,42 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
my = {
|
||||||
|
packages = with pkgs; [
|
||||||
|
calibre # managing my ebooks
|
||||||
|
evince # pdf reader
|
||||||
|
feh # image viewer
|
||||||
|
mpv # video player
|
||||||
|
xclip
|
||||||
|
xdotool
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
## Sound
|
||||||
|
sound.enable = true;
|
||||||
|
hardware.pulseaudio.enable = true;
|
||||||
|
|
||||||
|
## Fonts
|
||||||
|
fonts = {
|
||||||
|
enableFontDir = true;
|
||||||
|
enableGhostscriptFonts = true;
|
||||||
|
fonts = with pkgs; [
|
||||||
|
ubuntu_font_family
|
||||||
|
dejavu_fonts
|
||||||
|
fira-code
|
||||||
|
fira-code-symbols
|
||||||
|
symbola
|
||||||
|
noto-fonts
|
||||||
|
noto-fonts-cjk
|
||||||
|
font-awesome-ttf
|
||||||
|
siji
|
||||||
|
];
|
||||||
|
fontconfig.defaultFonts = {
|
||||||
|
sansSerif = ["Ubuntu"];
|
||||||
|
monospace = ["Fira Code"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
services.compton = {
|
services.compton = {
|
||||||
backend = "glx";
|
backend = "glx";
|
||||||
vSync = true;
|
vSync = true;
|
||||||
|
@ -22,108 +58,4 @@
|
||||||
"_GTK_FRAME_EXTENTS@:c"
|
"_GTK_FRAME_EXTENTS@:c"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
my = {
|
|
||||||
env.XAUTHORITY = "/tmp/Xauthority";
|
|
||||||
init = "[ -e ~/.Xauthority ] && mv -f ~/.Xauthority \"$XAUTHORITY\"";
|
|
||||||
|
|
||||||
packages = with pkgs; [
|
|
||||||
libqalculate
|
|
||||||
xclip
|
|
||||||
xdotool
|
|
||||||
mpv # video player
|
|
||||||
feh # image viewer
|
|
||||||
|
|
||||||
# Useful apps
|
|
||||||
calibre # managing my ebooks
|
|
||||||
evince # pdf reader
|
|
||||||
|
|
||||||
xst # st + nice-to-have extensions
|
|
||||||
(makeDesktopItem {
|
|
||||||
name = "xst";
|
|
||||||
desktopName = "Suckless Terminal";
|
|
||||||
genericName = "Default terminal";
|
|
||||||
icon = "utilities-terminal";
|
|
||||||
exec = "${xst}/bin/xst";
|
|
||||||
categories = "Development;System;Utility";
|
|
||||||
})
|
|
||||||
|
|
||||||
(writeScriptBin "st-scratch" ''
|
|
||||||
#!${stdenv.shell}
|
|
||||||
SCRID=st-scratch
|
|
||||||
focused=$(xdotool getactivewindow)
|
|
||||||
scratch=$(xdotool search --onlyvisible --classname $SCRID)
|
|
||||||
if [[ -n $scratch ]]; then
|
|
||||||
if [[ $focused == $scratch ]]; then
|
|
||||||
xdotool windowkill $scratch
|
|
||||||
else
|
|
||||||
xdotool windowactivate $scratch
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
xst -t $SCRID -n $SCRID -c $SCRID \
|
|
||||||
-f "$(xrdb -query | grep 'st-scratch\.font' | cut -f2)" \
|
|
||||||
-g 100x26 \
|
|
||||||
-e $SHELL
|
|
||||||
fi
|
|
||||||
'')
|
|
||||||
(writeScriptBin "st-calc" ''
|
|
||||||
#!${stdenv.shell}
|
|
||||||
SCRID=st-calc
|
|
||||||
scratch=$(xdotool search --onlyvisible --classname $SCRID)
|
|
||||||
[ -n "$scratch" ] && xdotool windowkill $scratch
|
|
||||||
xst -t $SCRID -n $SCRID -c $SCRID \
|
|
||||||
-f "$(xrdb -query | grep 'st-scratch\.font' | cut -f2)" \
|
|
||||||
-g 80x12 \
|
|
||||||
-e $SHELL -c qalc
|
|
||||||
'')
|
|
||||||
(makeDesktopItem {
|
|
||||||
name = "st-calc";
|
|
||||||
desktopName = "Calculator";
|
|
||||||
icon = "calc";
|
|
||||||
exec = "st-calc";
|
|
||||||
categories = "Development";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
fonts.enableFontDir = true;
|
|
||||||
fonts.enableGhostscriptFonts = true;
|
|
||||||
fonts.fonts = with pkgs; [
|
|
||||||
ubuntu_font_family
|
|
||||||
dejavu_fonts
|
|
||||||
fira-code
|
|
||||||
fira-code-symbols
|
|
||||||
symbola
|
|
||||||
noto-fonts
|
|
||||||
noto-fonts-cjk
|
|
||||||
font-awesome-ttf
|
|
||||||
siji
|
|
||||||
];
|
|
||||||
fonts.fontconfig.defaultFonts = {
|
|
||||||
sansSerif = ["Ubuntu"];
|
|
||||||
monospace = ["Fira Code"];
|
|
||||||
};
|
|
||||||
|
|
||||||
system.activationScripts.clearHome = ''
|
|
||||||
pushd /home/${config.my.username}
|
|
||||||
rm -rf .compose-cache .nv .pki .dbus .fehbg
|
|
||||||
[ -s .xsession-errors ] || rm -f .xsession-errors*
|
|
||||||
popd
|
|
||||||
'';
|
|
||||||
|
|
||||||
sound.enable = true;
|
|
||||||
hardware.pulseaudio.enable = true;
|
|
||||||
# Prevents ~/.esd_auth files by disabling the esound protocol module for
|
|
||||||
# pulseaudio, which I likely don't need. Is there a better way?
|
|
||||||
hardware.pulseaudio.configFile =
|
|
||||||
let paConfigFile =
|
|
||||||
with pkgs; runCommand "disablePulseaudioEsoundModule"
|
|
||||||
{ buildInputs = [ pulseaudio ]; } ''
|
|
||||||
mkdir "$out"
|
|
||||||
cp ${pulseaudio}/etc/pulse/default.pa "$out/default.pa"
|
|
||||||
sed -i -e 's|load-module module-esound-protocol-unix|# ...|' "$out/default.pa"
|
|
||||||
'';
|
|
||||||
in lib.mkIf config.hardware.pulseaudio.enable
|
|
||||||
"${paConfigFile}/default.pa";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
49
modules/xdg.nix
Normal file
49
modules/xdg.nix
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
# modules/xdg.nix -- a tidy $HOME is a tidy mind
|
||||||
|
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
# Obey XDG conventions;
|
||||||
|
my.home.xdg.enable = true;
|
||||||
|
environment.variables = {
|
||||||
|
# These are the defaults, but some applications are buggy when these lack
|
||||||
|
# explicit values.
|
||||||
|
XDG_CONFIG_HOME = "$HOME/.config";
|
||||||
|
XDG_CACHE_HOME = "$HOME/.cache";
|
||||||
|
XDG_DATA_HOME = "$HOME/.local/share";
|
||||||
|
XDG_BIN_HOME = "$HOME/.local/bin";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Conform more programs to XDG conventions. The rest are handled by their
|
||||||
|
# respective modules.
|
||||||
|
my.env = {
|
||||||
|
__GL_SHADER_DISK_CACHE_PATH = "$XDG_CACHE_HOME/nv";
|
||||||
|
CUDA_CACHE_PATH = "$XDG_CACHE_HOME/nv";
|
||||||
|
HISTFILE = "$XDG_DATA_HOME/bash/history";
|
||||||
|
INPUTRC = "$XDG_CACHE_HOME/readline/inputrc";
|
||||||
|
LESSHISTFILE = "$XDG_CACHE_HOME/lesshst";
|
||||||
|
WGETRC = "$XDG_CACHE_HOME/wgetrc";
|
||||||
|
XAUTHORITY = "/tmp/Xauthority";
|
||||||
|
};
|
||||||
|
my.init = "[ -e ~/.Xauthority ] && mv -f ~/.Xauthority \"$XAUTHORITY\"";
|
||||||
|
|
||||||
|
# Prevents ~/.esd_auth files by disabling the esound protocol module for
|
||||||
|
# pulseaudio, which I likely don't need. Is there a better way?
|
||||||
|
hardware.pulseaudio.configFile =
|
||||||
|
let paConfigFile =
|
||||||
|
with pkgs; runCommand "disablePulseaudioEsoundModule"
|
||||||
|
{ buildInputs = [ pulseaudio ]; } ''
|
||||||
|
mkdir "$out"
|
||||||
|
cp ${pulseaudio}/etc/pulse/default.pa "$out/default.pa"
|
||||||
|
sed -i -e 's|load-module module-esound-protocol-unix|# ...|' "$out/default.pa"
|
||||||
|
'';
|
||||||
|
in lib.mkIf config.hardware.pulseaudio.enable
|
||||||
|
"${paConfigFile}/default.pa";
|
||||||
|
|
||||||
|
# Clean up leftovers, as much as we can
|
||||||
|
system.activationScripts.clearHome = ''
|
||||||
|
pushd /home/${config.my.username}
|
||||||
|
rm -rf .compose-cache .nv .pki .dbus .fehbg
|
||||||
|
[ -s .xsession-errors ] || rm -f .xsession-errors*
|
||||||
|
popd
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue