Move some config from home/default.nix and nixos system config

Add options to desktop.nix from home/default.nix that are
desktop-relevant.

Add mimeapp config back from nixos system config

Move fd, ripgrep to enabled programs, remmina to enable service

Emacs config now imports shell config to ensure requirements are met
instead of duplicating some

Move Zsh config into it's own file zsh.nix
This commit is contained in:
Evie Litherland-Smith 2024-06-07 10:51:35 +01:00
parent 6c4723e9b9
commit 22dbc09500
9 changed files with 269 additions and 176 deletions

View file

@ -1,10 +1,4 @@
{
config,
lib,
pkgs,
catppuccinVariant ? "Mocha",
...
}: {
{config, ...}: {
imports = [
# Programs
../programs/desktop/default.nix
@ -22,99 +16,8 @@
];
programs.home-manager.enable = true;
nixpkgs.config.allowUnfree = true;
services = {
gpg-agent.pinentryPackage = pkgs.pinentry-gtk2;
avizo.enable = true;
syncthing.enable = true;
udiskie = {
enable = true;
notify = true;
automount = true;
tray = "never";
};
};
gtk = with lib.strings; let
accent = "Lavender";
variant = catppuccinVariant;
type =
if variant == "Latte"
then "Light"
else "Dark";
inverseType =
if type == "Light"
then "Dark"
else "Light";
in {
enable = true;
iconTheme = {
package = pkgs.catppuccin-papirus-folders.override {
accent = toLower accent;
flavor = toLower variant;
};
name = "Papirus-Dark";
};
cursorTheme = {
package = pkgs.catppuccin-cursors."${toLower variant}${inverseType}";
name = "Catppuccin-${variant}-${inverseType}-Cursors";
size = 32;
};
theme = let
size = "Standard";
in {
package = pkgs.catppuccin-gtk.override {
accents = [(toLower accent)];
size = toLower size;
variant = toLower variant;
};
name = "Catppuccin-${variant}-${size}-${accent}-${type}";
};
};
xdg = {
userDirs = {
enable = true;
createDirectories = true;
extraConfig = {
XDG_PROJECTS_DIR = "${config.home.homeDirectory}/Projects";
};
};
};
xresources.properties = with config.scheme.withHashtag; {
"*background" = base00;
"*foreground" = base05;
"*color0" = base00;
"*color1" = red;
"*color2" = green;
"*color3" = yellow;
"*color4" = blue;
"*color5" = magenta;
"*color6" = cyan;
"*color7" = base04;
"*color8" = base01;
"*color9" = red;
"*color10" = green;
"*color11" = yellow;
"*color12" = blue;
"*color13" = magenta;
"*color14" = cyan;
"*color15" = base05;
};
home = {
homeDirectory = "/home/${config.home.username}";
packages = with pkgs; [
rclone
git-sync
pinentry
fd
ripgrep
ffmpeg
mpv
evince
libreoffice-fresh
inkscape
remmina
webcord
signal-desktop
];
stateVersion = "23.05";
};
}

View file

@ -17,13 +17,4 @@
proton.primary = lib.mkForce false;
outlook.primary = lib.mkForce true;
};
xdg.configFile."teams-for-linux/config.json".text = builtins.toJSON {
awayOnSystemIdle = true;
closeAppOnCross = true;
electronCLIFlags = lib.mkIf config.wayland.windowManager.sway.enable [["ozone-platform" "wayland"]];
followSystemTheme = false;
notificationMethod = "electron";
optInTeamsV2 = true;
spellCheckerLanguages = ["en_GB"];
};
}

View file

@ -1,4 +1,10 @@
{pkgs, ...}: {
{
config,
lib,
pkgs,
catppuccinVariant ? "Mocha",
...
}: {
imports = [
./sway/default.nix
./niri/default.nix
@ -13,6 +19,14 @@
./wlogout/default.nix
];
home.packages = with pkgs; [
pinentry
ffmpeg
evince
libreoffice-fresh
inkscape
webcord
signal-desktop
swayimg
swaybg
(writeShellScriptBin "set-background" ''
${swaybg}/bin/swaybg -m fill -i ${./wallpapers/landscapes/tropic_island_day.jpg}
@ -29,4 +43,96 @@
systemctl --user restart davmail
'')
];
services = {
avizo.enable = true;
gpg-agent.pinentryPackage = pkgs.pinentry-gtk2;
remmina.enable = true;
syncthing.enable = true;
udiskie = {
enable = true;
notify = true;
automount = true;
tray = "never";
};
};
programs.mpv.enable = true;
gtk = with lib.strings; let
accent = "Lavender";
variant = catppuccinVariant;
type =
if variant == "Latte"
then "Light"
else "Dark";
inverseType =
if type == "Light"
then "Dark"
else "Light";
in {
enable = true;
iconTheme = {
package = pkgs.catppuccin-papirus-folders.override {
accent = toLower accent;
flavor = toLower variant;
};
name = "Papirus-Dark";
};
cursorTheme = {
package = pkgs.catppuccin-cursors."${toLower variant}${inverseType}";
name = "Catppuccin-${variant}-${inverseType}-Cursors";
size = 32;
};
theme = let
size = "Standard";
in {
package = pkgs.catppuccin-gtk.override {
accents = [(toLower accent)];
size = toLower size;
variant = toLower variant;
};
name = "Catppuccin-${variant}-${size}-${accent}-${type}";
};
};
xdg = {
mime.enable = true;
mimeApps = let
defaultApplications = import ./mimeapps.nix;
in {
enable = true;
inherit defaultApplications;
associations = {
added = defaultApplications;
removed = {
"x-scheme-handler/zoomus" = config.xdg.mimeApps.defaultApplications."x-scheme-handler/http";
"x-scheme-handler/msteams" = ["teams-for-linux.desktop"];
};
};
};
userDirs = {
enable = true;
createDirectories = true;
extraConfig = {
XDG_PROJECTS_DIR = "${config.home.homeDirectory}/Projects";
};
};
};
xresources.properties = with config.scheme.withHashtag; {
"*background" = base00;
"*foreground" = base05;
"*color0" = base00;
"*color1" = red;
"*color2" = green;
"*color3" = yellow;
"*color4" = blue;
"*color5" = magenta;
"*color6" = cyan;
"*color7" = base04;
"*color8" = base01;
"*color9" = red;
"*color10" = green;
"*color11" = yellow;
"*color12" = blue;
"*color13" = magenta;
"*color14" = cyan;
"*color15" = base05;
};
}

View file

@ -0,0 +1,68 @@
let
emacs = ["emacsclient.desktop" "emacs.desktop"];
browser = ["firefox.desktop" "nyxt.desktop"];
in {
"inode/directory" = ["thunar.desktop"];
"inode/symlink" = ["thunar.desktop"];
"image/jpeg" = ["swayimg.desktop"];
"image/png" = ["swayimg.desktop"];
"video/mp4" = ["mpv.desktop"];
"text/plain" = emacs;
"text/richtext" = emacs;
"text/org" = emacs;
"text/markdown" = emacs;
"text/rust" = emacs;
"text/csv" = emacs;
"text/html" = emacs;
"text/css" = emacs;
"text/tab-separated-values" = emacs;
"text/x-emacs-lisp" = emacs;
"text/x-fortran" = emacs;
"text/x-idl" = emacs;
"text/x-log" = emacs;
"text/x-lua" = emacs;
"text/x-makefile" = emacs;
"text/x-python" = emacs;
"text/x-python3" = emacs;
"text/x-readme" = emacs;
"text/x-scheme" = emacs;
"text/x-tex" = emacs;
"text/x-texinfo" = emacs;
"application/json" = emacs;
"application/toml" = emacs;
"application/yaml" = emacs;
"application/xml" = emacs;
"application/rss+xml" = emacs;
"application/xhtml+xml" = emacs;
"application/oxps" = emacs;
"application/x-shellscript" = emacs;
"application/pdf" = ["evince.desktop"];
"application/epub+zip" = ["evince.desktop"];
"application/msword" = ["writer.desktop"];
"application/zip" = ["xarchiver.desktop"];
"application/x-extension-htm" = browser;
"application/x-extension-html" = browser;
"application/x-extension-shtml" = browser;
"application/x-extension-xhtml" = browser;
"application/x-extension-xht" = browser;
"application/x-mozilla-bookmarks" = browser;
"x-scheme-handler/http" = browser;
"x-scheme-handler/https" = browser;
"x-scheme-handler/about" = browser;
"x-scheme-handler/chrome" = browser;
"x-scheme-handler/webcal" = browser;
"x-scheme-handler/unknown" = emacs;
"x-scheme-handler/prusaslicer" = ["PrusaSlicerURLProtocol.desktop"];
"x-scheme-handler/ms-word" = ["writer.desktop"];
"x-scheme-handler/ms-powerpoint" = ["impress.desktop"];
"x-scheme-handler/ms-excel" = ["calc.desktop"];
}

View file

@ -5,6 +5,7 @@
...
}: {
imports = [
../shell/default.nix
./python/default.nix
./lua/default.nix
];
@ -139,8 +140,6 @@
imagemagick
languagetool
wordnet
fd
ripgrep
graphviz # For org-roam graph
mp3info # For EMMS

View file

@ -5,7 +5,15 @@
}: {
programs.bottom = {
enable = true;
settings.colors = with config.scheme.withHashtag; let
settings = {
flags = {
group_processes = true;
temperature_type = "celsius";
battery = true;
enable_gpu = true;
enable_cache_memory = true;
};
colors = with config.scheme.withHashtag; let
rainbow = [red yellow green cyan blue magenta];
in {
table_header_color = base05;
@ -32,4 +40,5 @@
arc_color = cyan;
};
};
};
}

View file

@ -5,23 +5,18 @@
...
}: {
imports = [
./bottom.nix
./fastfetch.nix
./git.nix
./ssh.nix
./starship.nix
./bottom.nix
./zellij.nix
./zsh.nix
];
home.packages = with pkgs; [
rclone
git-sync
du-dust
];
xdg.configFile = let
variants = ["Latte" "Frappe" "Macchiato" "Mocha"];
mkVariant = variant: let
fname = "catppuccin${variant}.tmTheme";
in {
name = "bat/themes/${fname}";
value = {source = ./. + "/${fname}";};
};
in
builtins.listToAttrs
(lib.lists.forEach variants mkVariant);
programs = {
bash.enable = true;
bat = {
@ -41,39 +36,25 @@
enable = true;
nix-direnv.enable = true;
};
fd.enable = true;
fzf = {
enable = true;
defaultCommand = "${pkgs.fd}/bin/fd --type f";
changeDirWidgetCommand = "${pkgs.fd}/bin/fd --type d";
fileWidgetCommand = "${pkgs.fd}/bin/fd --type f";
};
zsh = {
enable = true;
enableCompletion = true;
autocd = true;
autosuggestion.enable = true;
defaultKeymap = "emacs";
syntaxHighlighting = {
enable = true;
highlighters = ["brackets" "cursor"];
};
historySubstringSearch.enable = true;
history = {
extended = true;
share = true;
ignoreDups = true;
ignoreAllDups = true;
ignoreSpace = true;
expireDuplicatesFirst = true;
};
initExtra = ''
## completion config and styling
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' menu 'select=long-list'
## transient prompt
source ${./transient.zsh}
'';
jq.enable = true;
ripgrep.enable = true;
};
xdg.configFile = let
variants = ["Latte" "Frappe" "Macchiato" "Mocha"];
mkVariant = variant: let
fname = "catppuccin${variant}.tmTheme";
in {
name = "bat/themes/${fname}";
value = {source = ./. + "/${fname}";};
};
in
builtins.listToAttrs
(lib.lists.forEach variants mkVariant);
}

View file

@ -0,0 +1,6 @@
{...}: {
programs.fastfetch = {
enable = true;
settings = {};
};
}

30
programs/shell/zsh.nix Normal file
View file

@ -0,0 +1,30 @@
{...}: {
programs.zsh = {
enable = true;
enableCompletion = true;
autocd = true;
autosuggestion.enable = true;
defaultKeymap = "emacs";
syntaxHighlighting = {
enable = true;
highlighters = ["brackets" "cursor"];
};
historySubstringSearch.enable = true;
history = {
extended = true;
share = true;
ignoreDups = true;
ignoreAllDups = true;
ignoreSpace = true;
expireDuplicatesFirst = true;
};
initExtra = ''
## completion config and styling
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' menu 'select=long-list'
## transient prompt
source ${./transient.zsh}
'';
};
}