home-manager: move all config together, allow for multiple users

This commit is contained in:
Katherina Walshe-Grey 2024-08-29 17:55:30 +01:00
parent 8076f91738
commit f5191640f5
14 changed files with 19 additions and 13 deletions

14
home/qenya/cli.nix Normal file
View file

@ -0,0 +1,14 @@
{ config, lib, pkgs, ... }:
{
home.packages = with pkgs; [
tree # like `ls -R` but nicer
# Extremely important
fortune
cowsay
lolcat
];
programs.btop.enable = true;
}

View file

@ -0,0 +1,27 @@
{ config, lib, pkgs, ... }:
let inherit (lib) mkIf;
in {
dconf = {
settings =
let
backgroundOptions = {
color-shading-type = "solid";
picture-options = "zoom";
picture-uri = "${config.home.homeDirectory}/.background-image";
primary-color = "#3a4ba0";
secondary-color = "#2f302f";
};
in
{
"org/gnome/desktop/background" = backgroundOptions // {
picture-uri-dark = backgroundOptions.picture-uri;
};
"org/gnome/desktop/screensaver" = backgroundOptions;
"org/gnome/desktop/interface".color-scheme = "prefer-dark";
};
};
home.file.".background-image" = mkIf config.dconf.enable {
source = ./background-image.jpg;
};
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View file

@ -0,0 +1,19 @@
{ config, lib, pkgs, ... }:
# dconf is the configuration manager for GNOME.
# home-manager, in its infinite wisdom, sets `dconf.enable` to true by default.
# This is a problem because we don't want it to attempt to apply our settings on
# a system that doesn't actually have GNOME installed. So, we override the
# default to false.
let inherit (lib) mkDefault;
in {
dconf.enable = mkDefault false;
imports = [
# TODO: nix-ify other parts of GNOME config
./appearance.nix
./keyboard.nix
];
}

View file

@ -0,0 +1,14 @@
# { config, lib, pkgs, ... }:
{
dconf = {
settings = {
"org/gnome/desktop/wm/keybindings" = {
# These are largely useless on most normal systems
# and conflict with VS Code's default keybinds for "Copy Line Up/Down"
move-to-workspace-up = [ ];
move-to-workspace-down = [ ];
};
};
};
}

12
home/qenya/default.nix Normal file
View file

@ -0,0 +1,12 @@
{
imports = [
./dconf
./cli.nix
./git.nix
./tmux.nix
./vscode.nix
./zsh.nix
];
home.stateVersion = "23.11";
}

14
home/qenya/git.nix Normal file
View file

@ -0,0 +1,14 @@
{ config, lib, pkgs, ... }:
{
programs.git = {
enable = true;
userName = "Katherina Walshe-Grey";
userEmail = "git@qenya.tel";
extraConfig = {
init.defaultBranch = "main";
pull.rebase = true;
push.autoSetupRemote = true;
};
};
}

33
home/qenya/tmux.nix Normal file
View file

@ -0,0 +1,33 @@
{ config, lib, pkgs, ... }:
{
# Derived from https://github.com/srid/nixos-config/blob/master/home/tmux.nix
programs.tmux = {
enable = true;
clock24 = true;
shortcut = "a"; # `screen` muscle memory compatibility
baseIndex = 1; # this is a UI, 0-indexing is not appropriate, fight me
newSession = true; # skip the manual step
escapeTime = 0; # otherwise I keep reflexively hammering Esc
secureSocket = false; # make sessions survive user logout
plugins = with pkgs; [
tmuxPlugins.better-mouse-mode
];
mouse = true;
extraConfig = ''
# https://old.reddit.com/r/tmux/comments/mesrci/tmux_2_doesnt_seem_to_use_256_colors/
set -g default-terminal "xterm-256color"
set -ga terminal-overrides ",*256col*:Tc"
set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
set-environment -g COLORTERM "truecolor"
# easy-to-remember split pane commands
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
'';
};
}

53
home/qenya/vscode.nix Normal file
View file

@ -0,0 +1,53 @@
{ config, lib, pkgs, osConfig, ... }:
let
inherit (lib) mkIf;
in
{
programs.vscode = {
enableExtensionUpdateCheck = false;
enableUpdateCheck = false;
package = pkgs.vscodium;
extensions = with pkgs.vscode-extensions; [
dbaeumer.vscode-eslint
golang.go
jdinhlife.gruvbox
jnoortheen.nix-ide
ms-python.python
];
mutableExtensionsDir = false;
userSettings = {
"[go]" = {
"editor.defaultFormatter" = "golang.go";
"editor.formatOnSave" = false;
};
"extensions.autoUpdate" = false;
"git.autofetch" = true;
"git.confirmSync" = false;
"git.enableSmartCommit" = true;
"git.inputValidation" = true;
"git.inputValidationSubjectLength" = null;
"gopls" = {
"formatting.gofumpt" = true;
"ui.semanticTokens" = true;
};
"javascript.updateImportsOnFileMove.enabled" = "always";
"nix.enableLanguageServer" = true;
"nix.serverPath" = "nil";
"nix.serverSettings".nil = {
diagnostics.ignored = [ "unused_binding" "unused_with" ];
formatting.command = [ "nixpkgs-fmt" ];
};
"terminal.integrated.allowChords" = false;
"terminal.integrated.defaultProfile.linux" = "zsh";
"workbench.colorTheme" = "Gruvbox Dark Hard";
};
};
# Language servers etc
home.packages = mkIf config.programs.vscode.enable (with pkgs; [
gopls
nil
nixpkgs-fmt
]);
}

32
home/qenya/zsh.nix Normal file
View file

@ -0,0 +1,32 @@
{ config, lib, pkgs, ... }:
{
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
dotDir = ".config/zsh";
shellAliases = {
ll = "ls -l";
nix-shell = ''nix-shell --command "zsh"''; # TODO: tweak theme to display something when inside nix-shell
};
history = {
size = 10000;
path = "${config.xdg.dataHome}/zsh/history";
ignorePatterns = [ "rm *" "pkill *" ];
};
oh-my-zsh = {
enable = true;
plugins = [ "git" "sudo" ];
theme = "agnoster";
};
envExtra = ''
DEFAULT_USER=qenya
'';
};
}