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
Generated
+34 -1
View File
@@ -71,11 +71,44 @@
"type": "github"
}
},
"nixunstable": {
"locked": {
"lastModified": 1651007983,
"narHash": "sha256-GNay7yDPtLcRcKCNHldug85AhAvBpTtPEJWSSDYBw8U=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e10da1c7f542515b609f8dfbcf788f3d85b14936",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nur": {
"locked": {
"lastModified": 1651053120,
"narHash": "sha256-PKbB7MK6jwG4G3A/2RR0ZA8YSNanwi5R+Bvv/LwzKwo=",
"owner": "nix-community",
"repo": "NUR",
"rev": "2eb8999947487d915d6a1100d672284a1989c905",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "NUR",
"type": "github"
}
},
"root": {
"inputs": {
"agenix": "agenix",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs_2"
"nixpkgs": "nixpkgs_2",
"nixunstable": "nixunstable",
"nur": "nur"
}
}
},
+6
View File
@@ -6,16 +6,19 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
nixunstable.url = "github:nixos/nixpkgs/nixos-unstable";
agenix.url = "github:ryantm/agenix";
home-manager = {
url = "github:nix-community/home-manager/release-21.11";
inputs.nixpkgs.follows = "nixpkgs";
};
nur.url = "github:nix-community/NUR";
};
outputs = inputs:
let
mods = hostname: [
{ nixpkgs.overlays = [ inputs.nur.overlay ]; }
inputs.agenix.nixosModule
./modules
./profiles/base
@@ -24,6 +27,9 @@
home-manager.useGlobalPkgs = true;
home-manager.users.greg = import ./home/home.nix "greg";
home-manager.users.root = import ./home/home.nix "root";
home-manager.extraSpecialArgs = {
nixunstable = inputs.nixunstable;
};
}
];
+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
'';
};
}
+1 -1
View File
@@ -6,5 +6,5 @@
./hardware-configuration.nix
];
networking.hostName = "jude";
greg.gnome = true;
greg.gnome.enable= true;
}
+1
View File
@@ -7,5 +7,6 @@
./linode.nix
./proxy.nix
./rpi4.nix
./xprograms.nix
];
}
+15 -3
View File
@@ -5,10 +5,12 @@ let
in with lib; {
options = {
greg.gnome = mkEnableOption "Enable my default Gnome3 setup";
greg.gnome.enable = mkEnableOption "Enable my default Gnome3 setup";
};
config = mkIf cfg {
config = mkIf cfg.enable {
greg.xprograms.enable = true;
# Sets up a basic Gnome installation
services.xserver = {
enable = true;
@@ -21,16 +23,26 @@ in with lib; {
programs.dconf.enable = true;
programs.sway.enable = true; # Gives us Wayland
xdg.portal.wlr.enable = true; # Allows screen sharing in Wayland
xdg.portal = {
enable = true;
gtkUsePortal = true;
wlr.enable = true; # Enables screen sharing in Wayland
};
# Enable some Gnome plugins that I like
environment.systemPackages = with pkgs; [
gnome3.adwaita-icon-theme
gnomeExtensions.appindicator
gnomeExtensions.dash-to-dock
];
services.udev.packages = with pkgs; [
gnome3.gnome-settings-daemon
];
services.pipewire.enable = true;
# Enablement for Firefox
services.gnome.chrome-gnome-shell.enable = true;
};
}
+16
View File
@@ -0,0 +1,16 @@
{ config, lib, pkgs, ... }:
let
cfg = config.greg.xprograms;
in with lib; {
options = {
greg.xprograms.enable = mkEnableOption "Install my favorite XPrograms";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
keepassxc
];
};
}
-1
View File
@@ -5,7 +5,6 @@
./nix.nix
./programs.nix
./syncthing.nix
./xonsh.nix
];
-1
View File
@@ -16,7 +16,6 @@
transcrypt
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget
xonsh
yamllint # Used in vim
];
}
-127
View File
@@ -1,127 +0,0 @@
{ pkgs, ... }:
{
programs.xonsh = {
enable = true;
config = ''
# set -e == $RAISE_SUBPROC_ERROR = True
# set -x == trace on; $XONSH_TRACE_SUBPROC = True
# $? == _.rtn
import os
$TIMEFORMAT = '%3Uu %3Ss %3lR %P%%'
$CLICOLOR = 1
$LSCOLORS = 'ExGxBxDxCxEgEdxbxgxcxd'
$EDITOR = '${pkgs.vim}/bin/vim'
$PKG_CONFIG_PATH = '/usr/local/lib/pkgconfig'
# Tells vox where to find virtualenvs
$VIRTUALENV_HOME = $HOME + '/venv/'
$PROMPT = '{env_name}{BOLD_GREEN}{user}@{hostname}{BOLD_BLUE} {short_cwd}{branch_color}{curr_branch: {}}{RESET} {BOLD_BLUE}{prompt_end}{RESET} '
$SWORD_PATH = $HOME + '/.sword'
$OS_CLOUD = 'default'
$GOPATH = '~/.go'
$JAVA_HOME = '/etc/alternatives/java_sdk'
$MAVEN_OPTS = ' -Dmaven.wagon.http.ssl.insecure=true'
# Coloured man page support
# using 'less' env vars (format is '\E[<brightness>;<colour>m')
$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
####################################
#
# Alias Time
#
####################################
aliases['ll'] = 'ls -l'
aliases['vup'] = 'vagrant up --provision --provider libvirt'
aliases['vos'] = 'vagrant up --provision --provider openstack'
aliases['vssh'] = 'vagrant ssh'
aliases['vhalt'] = 'vagrant halt'
aliases['vprov'] = 'vagrant provision'
aliases['vdown'] = 'vagrant destroy'
aliases['ac'] = 'vox activate'
aliases['d'] = 'vox deactivate'
aliases['devroles'] = 'cd ~/src/ansible_collections/devroles'
aliases['molcol'] = 'molecule -c ../../tests/molecule.yml'
aliases['packaging'] = 'cd ~/src/packaging'
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
# Open a new terminal tab (Gnome Terminal) in the same CWD
$PROMPT = '{vte_new_tab_cwd}' + $PROMPT
'';
};
}