Refactor ~again~
Who needs free time? I don't.
This commit is contained in:
parent
bbe5d55143
commit
e96548382c
4
Makefile
4
Makefile
|
@ -1,9 +1,7 @@
|
||||||
NIXOS_VERSION := 19.09
|
NIXOS_VERSION := 19.09
|
||||||
NIXOS_PREFIX := $(PREFIX)/etc/nixos
|
NIXOS_PREFIX := $(PREFIX)/etc/nixos
|
||||||
COMMAND := test
|
COMMAND := test
|
||||||
FLAGS := -I "nixpkgs-overlays=$$(pwd)/overlays.nix" \
|
FLAGS := -I "config=$$(pwd)/config" -I "modules=$$(pwd)/modules" $(FLAGS)
|
||||||
-I "config=$$(pwd)/config" \
|
|
||||||
-I "modules=$$(pwd)/modules" $(FLAGS)
|
|
||||||
|
|
||||||
# The real Labowski
|
# The real Labowski
|
||||||
all: channels
|
all: channels
|
||||||
|
|
10
default.nix
10
default.nix
|
@ -16,9 +16,6 @@ device:
|
||||||
# So we can use absolute import paths
|
# So we can use absolute import paths
|
||||||
"config=/etc/dotfiles/config"
|
"config=/etc/dotfiles/config"
|
||||||
"modules=/etc/dotfiles/modules"
|
"modules=/etc/dotfiles/modules"
|
||||||
# We define nixpkgs-overlays so our overlays will be available to
|
|
||||||
# nix-shell/nix-build outside of rebuilding...
|
|
||||||
"nixpkgs-overlays=/etc/dotfiles/overlays.nix"
|
|
||||||
];
|
];
|
||||||
# ...but we still need to set nixpkgs.overlays to make them visible to the
|
# ...but we still need to set nixpkgs.overlays to make them visible to the
|
||||||
# rebuild process, however...
|
# rebuild process, however...
|
||||||
|
@ -27,6 +24,13 @@ device:
|
||||||
|
|
||||||
# For instant nix-shell scripts
|
# For instant nix-shell scripts
|
||||||
environment.systemPackages = [ pkgs.my.cached-nix-shell ];
|
environment.systemPackages = [ pkgs.my.cached-nix-shell ];
|
||||||
|
environment.shellAliases = {
|
||||||
|
nix-env = "NIXPKGS_ALLOW_UNFREE=1 nix-env";
|
||||||
|
nix-shell = ''NIX_PATH="nixpkgs-overlays=/etc/dotfiles/overlays.nix:$NIX_PATH" nix-shell'';
|
||||||
|
nsh = "nix-shell";
|
||||||
|
nen = "nix-env";
|
||||||
|
dots = "make -C ~/.dotfiles";
|
||||||
|
};
|
||||||
|
|
||||||
# This value determines the NixOS release with which your system is to be
|
# This value determines the NixOS release with which your system is to be
|
||||||
# compatible, in order to avoid breaking some software such as database
|
# compatible, in order to avoid breaking some software such as database
|
||||||
|
|
|
@ -16,17 +16,10 @@
|
||||||
|
|
||||||
### My user settings
|
### My user settings
|
||||||
my.username = "hlissner";
|
my.username = "hlissner";
|
||||||
my.env.PATH = [ ../bin ];
|
|
||||||
my.user = {
|
my.user = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
uid = 1000;
|
uid = 1000;
|
||||||
extraGroups = [ "wheel" "video" "networkmanager" ];
|
extraGroups = [ "wheel" "video" "networkmanager" ];
|
||||||
shell = pkgs.zsh;
|
shell = pkgs.zsh;
|
||||||
};
|
};
|
||||||
my.alias.nix-env = "NIXPKGS_ALLOW_UNFREE=1 nix-env";
|
|
||||||
my.alias.nsh = "nix-shell";
|
|
||||||
my.alias.nen = "nix-env";
|
|
||||||
my.alias.sc = "systemctl";
|
|
||||||
my.alias.ssc = "sudo systemctl";
|
|
||||||
my.alias.dots = "make -C ~/.dotfiles";
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
# hosts/personal.nix --- settings common to my personal systems
|
# hosts/personal.nix --- settings common to my personal systems
|
||||||
|
|
||||||
{ config, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [ ./. ];
|
||||||
./.
|
|
||||||
<modules/xdg.nix>
|
|
||||||
];
|
|
||||||
|
|
||||||
# Support for more filesystems
|
# Support for more filesystems
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
|
@ -29,4 +26,51 @@
|
||||||
"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";
|
||||||
|
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
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
alias.l = "exa -1";
|
alias.l = "exa -1";
|
||||||
alias.ll = "exa -l";
|
alias.ll = "exa -l";
|
||||||
alias.la = "LC_COLLATE=C exa -la";
|
alias.la = "LC_COLLATE=C exa -la";
|
||||||
|
alias.sc = "systemctl";
|
||||||
|
alias.ssc = "sudo systemctl";
|
||||||
|
|
||||||
# Write it recursively so other modules can write files to it
|
# Write it recursively so other modules can write files to it
|
||||||
home.xdg.configFile."zsh" = {
|
home.xdg.configFile."zsh" = {
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
# 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
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -43,6 +43,8 @@ in
|
||||||
booted. Anything done here should be idempotent and inexpensive.
|
booted. Anything done here should be idempotent and inexpensive.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
## PATH should always start with its old value
|
||||||
|
config.my.env.PATH = [ ./bin "$PATH" ];
|
||||||
config.environment.extraInit =
|
config.environment.extraInit =
|
||||||
let exportLines = mapAttrsToList (n: v: "export ${n}=\"${v}\"") config.my.env;
|
let exportLines = mapAttrsToList (n: v: "export ${n}=\"${v}\"") config.my.env;
|
||||||
in ''
|
in ''
|
||||||
|
@ -84,7 +86,4 @@ in
|
||||||
# This file is autogenerated, do not edit it!
|
# This file is autogenerated, do not edit it!
|
||||||
${config.my.zsh.env};
|
${config.my.zsh.env};
|
||||||
'';
|
'';
|
||||||
|
|
||||||
## PATH should always start with its old value
|
|
||||||
config.my.env.PATH = [ "$PATH" ];
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue