Maintain more global options via home-manager

Use home-manager to create xsession.
Readme contains info on how to start xsession on login.

That way home-manager can maintain languages, keyboard and further stuff
globally for user.

No more need to set stuff as workaround within i3 or zsh.
Also enabled to start systemd units after login, as home-manager will
create and trigger `hm-graphical-session.target`.
This commit is contained in:
Daniel Siepmann 2022-05-20 12:39:40 +02:00
parent fb009d303d
commit 2823c2f0f9
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
7 changed files with 102 additions and 46 deletions

View file

@ -31,6 +31,8 @@
file = import ./home/files.nix { };
} // import ./home/home.nix {
inherit pkgs;
};
nix = import ./home/programs/nix.nix {
@ -70,7 +72,7 @@
};
xsession.windowManager.i3 = import ./home/windowManager/i3.nix {
xsession = import ./home/xsession.nix {
inherit config pkgs;
};

68
home/home.nix Normal file
View file

@ -0,0 +1,68 @@
{ pkgs }:
let
usLocale = "en_US.UTF-8";
in {
language = {
base = "${usLocale}";
ctype = "${usLocale}";
numeric = "${usLocale}";
time = "${usLocale}";
collate = "${usLocale}";
monetary = "${usLocale}";
messages = "${usLocale}";
paper = "${usLocale}";
name = "${usLocale}";
address = "${usLocale}";
telephone = "${usLocale}";
measurement = "${usLocale}";
};
keyboard = {
layout = "us";
model = "pc105";
options = [
"numpad:mac"
"ctrl:nocaps"
"compose:ralt"
];
};
sessionVariables = {
EDITOR = "${pkgs.neovim}/bin/nvim";
SHELL = "${pkgs.zsh}/bin/zsh";
TYPO3_CONTEXT = "Development/dsiepmann";
TYPO3_ADDITIONAL_CONFIGURATION = "/home/daniels/.local/share/typo3-configuration/AdditionalConfiguration.inc.php";
LSCOLORS = "HxGxDxDxbxDxDxababcxcx";
LS_COLORS = "di=1;37:ln=1;36:so=1;33:pi=1;33:ex=31:bd=1;33:cd=1;33:su=30;41:sg=30;41:tw=32:ow=32";
GREP_COLOR = "0;30;44";
PHAN_COLOR_SCHEME = "code";
};
shellAliases = {
ll = "ls -laph --color=auto";
# Open in main view with all references.
tigr = "tig refs";
# Open in main view with ALL commits, not only current branch tree.
tiga = "tig --all --show-signature";
# Tmux outside tmux.
ta = "tmux attach";
tc = "tmux new-session -s ";
# TYPO3 contribution specific commands
t3Push = "git push origin HEAD:refs/for/master";
t3Pull = "git pull --rebase origin master; git checkout master";
t3Rollback = "git checkout master; git reset --hard origin/master";
t3Clean = "t3Rollback && t3Pull";
# TODO: Move to nix package / shellapplication Create borg backup
createBackup = "mkdir -p ~/backup-etc && sudo cp -r /etc/* ~/backup-etc && sudo cp -r /etc/.* ~/backup-etc && sudo chown daniels:daniels -R ~/backup-etc/ && borg create -v --progress --stats --exclude-from ~/.config/borg/exclude /media/daniels/Backup::$(date +%F-%R) ~/; sudo rm -rf ~/backup-etc";
};
}

View file

@ -10,48 +10,12 @@
# Can be re sourced via: __HM_ZSH_SESS_VARS_SOURCED= source ~/.zshenv
sessionVariables = {
LC_ALL = "en_US.UTF-8";
LANG = "en_US.UTF-8";
LANGUAGE = "en_US";
MANPAGER="${pkgs.page}/bin/page -C -e 'au User PageDisconnect sleep 100m|%y p|enew! |bd! #|pu p|set ft=man'";
EDITOR = "${pkgs.neovim}/bin/nvim";
SHELL = "${pkgs.zsh}/bin/zsh";
LSCOLORS = "HxGxDxDxbxDxDxababcxcx";
LS_COLORS = "di=1;37:ln=1;36:so=1;33:pi=1;33:ex=31:bd=1;33:cd=1;33:su=30;41:sg=30;41:tw=32:ow=32";
GREP_COLOR = "0;30;44";
TYPO3_CONTEXT = "Development/dsiepmann";
TYPO3_ADDITIONAL_CONFIGURATION = "/home/daniels/.local/share/typo3-configuration/AdditionalConfiguration.inc.php";
PHAN_COLOR_SCHEME = "code";
# Reduce timeout after <ESC> (vi keybindings)
KEYTIMEOUT = 1;
};
shellAliases = {
ll = "ls -laph --color=auto";
# Open in main view with all references.
tigr = "tig refs";
# Open in main view with ALL commits, not only current branch tree.
tiga = "tig --all --show-signature";
# Tmux outside tmux.
ta = "tmux attach";
tc = "tmux new-session -s ";
# TYPO3 contribution specific commands
t3Push = "git push origin HEAD:refs/for/master";
t3Pull = "git pull --rebase origin master; git checkout master";
t3Rollback = "git checkout master; git reset --hard origin/master";
t3Clean = "t3Rollback && t3Pull";
# Create borg backup
createBackup = "mkdir -p ~/backup-etc && sudo cp -r /etc/* ~/backup-etc && sudo cp -r /etc/.* ~/backup-etc && sudo chown daniels:daniels -R ~/backup-etc/ && borg create -v --progress --stats --exclude-from ~/.config/borg/exclude /media/daniels/Backup::$(date +%F-%R) ~/; sudo rm -rf ~/backup-etc";
};
history = {
size = 10000;
save = 10000;

View file

@ -12,7 +12,7 @@
Install = {
WantedBy = [
"default.target"
"hm-graphical-session.target"
];
};
}

View file

@ -183,12 +183,6 @@ in {
command = "xinput --set-prop 'DELL07E6:00 06CB:76AF Touchpad' 'libinput Tapping Enabled' 1";
notification = false;
}
{
# Use CAPS LOCK as ctrl
command = "setxkbmap -option ctrl:nocaps; setxkbmap -option compose:ralt";
notification = false;
always = true;
}
{
command = "xsetroot -solid \"#2E3436\"";
notification = false;
@ -379,8 +373,8 @@ in {
displays = {
"a" = "exec xrandr --auto --output eDP1 --scale 1x1 --mode 1920x1080 && xbacklight -set 10;";
"e" = "exec xrandr --auto --output eDP1 --off";
"h" = "exec xrandr --output eDP1 --off --output DP2-1 --scale 1x1 --mode 2560x1440 && setxkbmap -option ctrl:nocaps && setxkbmap -option compose:ralt && setxkbmap -option numpad:mac";
"v" = "exec xrandr --auto --output DP2-1 --primary --scale 1x1 --mode 2560x1440 --output eDP1 --mode 1920x1080 --left-of DP2-1 && setxkbmap -option ctrl:nocaps && setxkbmap -option compose:ralt && setxkbmap -option numpad:mac";
"h" = "exec xrandr --output eDP1 --off --output DP2-1 --scale 1x1 --mode 2560x1440";
"v" = "exec xrandr --auto --output DP2-1 --primary --scale 1x1 --mode 2560x1440 --output eDP1 --mode 1920x1080 --left-of DP2-1";
"r" = "exec xrandr --output DP2-1 --primary --mode 1920x1080 --output eDP1 --mode 1920x1080 --left-of DP2-1 && xbacklight -set 100;";
# Mirror

11
home/xsession.nix Normal file
View file

@ -0,0 +1,11 @@
{ config, pkgs }:
{
enable = true;
numlock.enable = true;
windowManager.i3 = import ./windowManager/i3.nix {
inherit config pkgs;
};
}

View file

@ -84,6 +84,23 @@ List of manual needed changes for various reasons.
cd ~/.local/share && ln -s ~/.nix-profile/share/applications
* Allow gdm3 to use xsessions as login.
Add the following content as `/usr/share/xsessions/xsession.desktop`:
[Desktop Entry]
Name=XSession
Comment=This session uses the custom xsession file
Exec=/etc/X11/Xsession
Type=Application
X-DesktopNames=GNOME-Flashback;GNOME;
X-Ubuntu-Gettext-Domain=gnome-flashback
This is used by gdm3 (installed via ubuntu host) to allow logging in via
xsession which will pick up all the settings generated by home-manager.
Do not forget to call `sudo desktop-file-install xsession.desktop` to make
system aware of the file.
Todos
-----