Vast improvements to desktop experience

This commit is contained in:
Greg Hellings
2022-05-04 13:57:19 -05:00
parent 11a8eab867
commit 1c19e5300d
18 changed files with 370 additions and 141 deletions
+5
View File
@@ -0,0 +1,5 @@
{ pkgs, ... }:
{
home.packages = [ pkgs.element-desktop ];
}
+9
View File
@@ -0,0 +1,9 @@
{ ... }:
{
imports = [
./chat.nix
./firefox.nix
./terminal.nix
];
}
+36
View File
@@ -0,0 +1,36 @@
{ lib, pkgs, ... }:
let
ffPkgs = wayland: if wayland
then [ pkgs.firefox-wayland ]
else [ pkgs.firefox ];
vars = {
MOZ_ENABLE_WAYLAND = "1";
XDG_CURRENT_DESKTOP = "sway";
};
in with lib;
{
programs.firefox = {
enable = true;
enableGnomeExtensions = true;
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
keepassxc-browser
octotree
refined-github
ublock-origin
];
profiles = {
default.settings = {
"browser.startup.page" = 3;
"browser.startup.homepage" = "https://thehellings.com";
"doh-rollout.doorhanger-decision" = "UIDisabled";
"doh-rollout.doneFirstRun" = true;
};
};
};
programs.bash.sessionVariables = vars;
programs.xonsh.sessionVariables = vars;
}
+13
View File
@@ -0,0 +1,13 @@
{ ... }:
{
programs.gnome-terminal = {
enable = true;
showMenubar = true;
themeVariant = "dark";
profile.default = {
default = true;
visibleName = "greg";
};
};
}
+11 -4
View File
@@ -1,12 +1,19 @@
name: { pkgs, lib, ...}:
name: { pkgs, lib, nixosConfig, ...}:
{
let
guiImports = if nixosConfig.greg.gnome.enable then
[ ./gui ] else [];
in {
imports = [
./modules
./bash.nix
./git.nix
./vim.nix
./ssh.nix
];
./vim.nix
./xonsh.nix
] ++ guiImports;
home.username = name;
home.homeDirectory = if name == "root" then "/root" else "/home/${name}";
+7
View File
@@ -0,0 +1,7 @@
{ ... }:
{
imports = [
./xonsh.nix
];
}
+96
View File
@@ -0,0 +1,96 @@
{ config, pkgs, lib, ... }:
let
cfg = config.programs.xonsh;
in with lib; {
options = {
programs.xonsh = {
enable = mkEnableOption "Enable the xonsh program";
sessionVariables = mkOption {
type = types.attrs;
default = {};
example = { XONSH_TRACE_SUBPROC = true; };
description = ''
Environment variables that will be set for the Xonsh session.
'';
};
aliases = mkOption {
type = types.attrsOf types.str;
default = {};
example = literalExpression ''
{
ll = "ls -l";
la = "ls -a";
}
'';
description = ''
An attribute set that maps aliases (the top level attribute names in
this option) to command strings or directly to build outputs.
'';
};
configHeader = mkOption {
type = types.lines;
default = "";
example = literalExpression ''
import os
import sys
'';
description = "An arbitrary string to put at the top of the config file";
};
configFooter = mkOption {
type = types.lines;
default = "";
example = literalExpression ''
def _some_method(args):
do_command()
some_other_thing()
aliases['some_method'] = _some_method
'';
description = "An arbitrary string to put at the end of the config file";
};
};
};
config =
let
shortAliases = concatStringsSep "\n" (
mapAttrsToList (k: v: "aliases['${k}']='${v}'") cfg.aliases
);
listToPythonList = let
listInternals = args:
concatStringsSep "\n" (map (v: "'${v}'") args);
in list: "[${listInternals list}]";
sessionVars = concatStringsSep "\n" (
mapAttrsToList (k: v:
if builtins.typeOf v == "string" then
"\$${k} = '${v}'"
else if builtins.typeOf v == "list" then
"\$${k} = ${listToPythonList}"
else if builtins.typeOf v == "int" then
"\$${k} = ${toString v}"
else ""
) cfg.sessionVariables
);
in mkIf cfg.enable {
home.packages = [ pkgs.xonsh ];
home.file.".xonshrc".text = ''
${cfg.configHeader}
${sessionVars}
${shortAliases}
${cfg.configFooter}
'';
};
}
+3 -3
View File
@@ -22,7 +22,6 @@ in
vim-flake8
vim-fugitive
vim-indent-guides
#vim-stabs
gruvbox
syntastic
];
@@ -74,9 +73,9 @@ let g:ctrlp_switch_buffer = 0
let g:ctrlp_cmd = 'CtrlPMixed'
let g:ctrlp_user_command = {
\'types': {
\1: ['.git', 'git ls-files --cached --exclude-standard --others' ],
\1: ['.git', '${pkgs.git}/bin/git ls-files --cached --exclude-standard --others' ],
\},
\'fallback': 'find . -type f | grep -v -e "\.tox/" -e "\.git/"'
\'fallback': '${pkgs.findutils}/bin/find . -type f | ${pkgs.gnugrep}/bin/grep -v -e "\.tox/" -e "\.git/"'
\}
" let g:ctrpl_match_func = { 'match': 'pymatcher#PyMatch' }
@@ -88,6 +87,7 @@ autocmd! BufWritePost .vimrc source $MYVIMRC
" Tell syntastic to use yamllint
let g:syntastic_yaml_checkers = ['yamllint']
let g:syntastic_yaml_yamllint_args = []
let g:syntastic_shell = "${pkgs.bash}/bin/bash"
" Shortcuts for resolving git diff conflicts
let g:diffget_local_map = 'gl'
let g:diffget_upstream_map = 'gu'
+117
View File
@@ -0,0 +1,117 @@
{ pkgs, config, nixosConfig, lib, ... }:
let
enable = nixosConfig.greg.gnome.enable;
in {
programs.xonsh = {
enable = true;
sessionVariables = {
TIMEFORMAT = "%3Uu %3Ss %3lR %P%%";
CLICOLOR = 1;
LSCOLORS = "ExGxBxDxCxEgEdxbxgxcxd";
EDITOR = "${pkgs.vim}/bin/vim";
# Tells vox where to find virtualenvs
VIRTUALENV_HOME = "${config.home.homeDirectory}/venv/";
# vte_new_tab_cwd causes new Terminal tabs to open in the
# same CWD as the current tab
PROMPT = "{vte_new_tab_cwd}{env_name}{BOLD_GREEN}{user}@{hostname}{BOLD_BLUE} {short_cwd}{branch_color}{curr_branch: {}}{RESET} {BOLD_BLUE}{prompt_end}{RESET} ";
SWORD_PATH = "${config.home.homeDirectory}/.sword/";
OS_CLOUD = "default";
MAVEN_OPTS = " -Dmaven.wagon.http.ssl.insecure=true";
LESS_TERMCAP_mb = "\\033[01;31m"; # begin blinking
LESS_TERMCAP_md = "\\033[01;31m"; # begin bold
LESS_TERMCAP_me = "\\033[0m"; # end mode
LESS_TERMCAP_so = "\\033[01;44;36m"; # begin standout-mode (bottom of screen)
LESS_TERMCAP_se = "\\033[0m"; # end standout-mode
LESS_TERMCAP_us = "\\033[00;36m"; # begin underline
LESS_TERMCAP_ue = "\\033[0m"; # end underline
};
aliases = {
ll = "ls -l";
vup = "vagrant up --provision --provider libvirt";
vos = "vagrant up --provision --provider openstack";
vssh = "vagrant ssh";
vhalt = "vagrant halt";
vprov = "vagrant provision";
vdown = "vagrant destroy";
ac = "vox activate";
d = "vox deactivate";
devroles = "cd ~/src/ansible_collections/devroles";
molcol = "molecule -c ../../tests/molecule.yml";
pa = "cd ~/src/packaging";
};
configHeader = ''
# set -e == $RAISE_SUBPROC_ERROR = True
# set -x == trace on; $XONSH_TRACE_SUBPROC = True
# $? == _.rtn
import os
'';
#$PKG_CONFIG_PATH = '/usr/local/lib/pkgconfig'
#$GOPATH = $HOME + '/.go'
#$JAVA_HOME = '/etc/alternatives/java_sdk'
configFooter = ''
def _yaml2json(args, stdin=None, stdout=None):
import sys, yaml, json
from yaml import CLoader
json.dump(yaml.load(stdin, Loader=CLoader), stdout, indent=4)
def _py2env(args):
vox new @(args[0]) -p /usr/bin/python2
def _py3env(args):
vox new @(args[0])
def _rundock(args):
if os.path.exists('/usr/bin/podman'):
e = 'podman'
else:
e = 'docker'
@(e) exec -ti @(args[0]) /bin/bash
def _pip_extras(args):
import importlib_metadata
print(importlib_metadata.metadata(args[0]).get_all('Provides-Extra'))
# Container stuff
def _newdock(args):
if os.path.exists('/usr/bin/podman'):
e = 'podman'
else:
e = 'docker'
@(e) run -P --privileged=true -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v @(os.getcwd()):/dmnt -v /etc/pki:/etc/pki:ro -d --name @(args[1]) @(args[0]) /sbin/init
rundock @(args[1])
def _unknown_host(args):
sed -i -e @(args[0])d ~/.ssh/known_hosts
aliases['yaml2json'] = _yaml2json
aliases['py2env'] = _py2env
aliases['py3env'] = _py3env
aliases['rundock'] = _rundock
aliases['newdock'] = _newdock
aliases['unknown_host'] = _unknown_host
aliases['pip_extras'] = _pip_extras
###
#
# Other random nice-to-have things
#
###
# Does virtualenv support
xontrib load vox
# Faster coreutils
xontrib load coreutils
# Allows identifying JSON as if it was Python by adding some new builtins to the language
import builtins
builtins.true = True
builtins.false = False
builtins.null = None
'';
};
}