1

Nixos: Move deprecated modules/derivation to separate folder

This commit is contained in:
2024-10-12 12:34:42 +02:00
parent 12443de899
commit f4992a38f4
36 changed files with 2 additions and 18 deletions

View File

@ -0,0 +1,137 @@
{
config,
lib,
mylib,
...
}:
with mylib.modules; let
cfg = config.modules.alacritty;
in {
options.modules.alacritty = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable {
programs.alacritty = {
enable = false;
settings = {
window = {
padding = {
x = 10;
y = 10;
};
font = {
normal = "JetBrainsMono Nerd Font Mono";
size = 12;
};
};
env = {
TERM = "xterm-256color";
};
colors = {
# Default colors
primary = {
background = "#EFF1F5"; # base
foreground = "#4C4F69"; # text
# Bright and dim foreground colors
dim_foreground = "#4C4F69"; # text
bright_foreground = "#4C4F69"; # text
};
# Cursor colors
cursor = {
text = "#EFF1F5"; # base
cursor = "#DC8A78"; # rosewater
};
vi_mode_cursor = {
text = "#EFF1F5"; # base
cursor = "#7287FD"; # lavender
};
# Search colors
search = {
matches = {
foreground = "#EFF1F5"; # base
background = "#6C6F85"; # subtext0
};
focused_match = {
foreground = "#EFF1F5"; # base
background = "#40A02B"; # green
};
footer_bar = {
foreground = "#EFF1F5"; # base
background = "#6C6F85"; # subtext0
};
};
# Keyboard regex hints
hints = {
start = {
foreground = "#EFF1F5"; # base
background = "#DF8E1D"; # yellow
};
end = {
foreground = "#EFF1F5"; # base
background = "#6C6F85"; # subtext0
};
};
# Selection colors
selection = {
text = "#EFF1F5"; # base
background = "#DC8A78"; # rosewater
};
# Normal colors
normal = {
black = "#5C5F77"; # subtext1
red = "#D20F39"; # red
green = "#40A02B"; # green
yellow = "#DF8E1D"; # yellow
blue = "#1E66F5"; # blue
magenta = "#EA76CB"; # pink
cyan = "#179299"; # teal
white = "#ACB0BE"; # surface2
};
# Bright colors
bright = {
black = "#6C6F85"; # subtext0
red = "#D20F39"; # red
green = "#40A02B"; # green
yellow = "#DF8E1D"; # yellow
blue = "#1E66F5"; # blue
magenta = "#EA76CB"; # pink
cyan = "#179299"; # teal
white = "#BCC0CC"; # surface1
};
# Dim colors
dim = {
black = "#5C5F77"; # subtext1
red = "#D20F39"; # red
green = "#40A02B"; # green
yellow = "#DF8E1D"; # yellow
blue = "#1E66F5"; # blue
magenta = "#EA76CB"; # pink
cyan = "#179299"; # teal
white = "#ACB0BE"; # surface2
};
indexed_colors = [
{
index = 16;
color = "#FE640B";
}
{
index = 17;
color = "#DC8A78";
}
];
};
};
};
};
}

View File

@ -0,0 +1,9 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Enable Alacritty";
}

View File

@ -0,0 +1,166 @@
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules; let
cfg = config.modules.audio;
cfgfp = config.modules.flatpak;
in {
imports = [
../flatpak
];
options.modules.audio = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable {
assertions = [
(mkIf cfg.bottles.enable {
assertion = cfgfp.enable;
message = "Cannot enable Bottles without the flatpak module!";
})
];
# Use builtins.concatLists instead of mkMerge as this is more safe as the type is specified,
# also mkMerge doesn't work in every case as it yields a set
home.packages = with pkgs;
builtins.concatLists [
# lib.optional is preferred over mkIf or if...then...else by nix coding standards
# lib.optional wraps its argument in a list, lib.optionals doesn't
# This means that lib.optional can be used for single packages/arguments
# and lib.optionals has to be used when the argument is itself a list
# I use lib.optionals everywhere as I think this is more clear
# Some of these include gamemode as I use that to enable performance governors for CPU/GPU and other stuff
# Enable some default pipewire stuff if pipewire is enabled
(optionals nixosConfig.services.pipewire.enable [
# TODO: Disabled on 03.02.2023 because of temporary build error
# helvum
])
(optionals cfg.carla.enable [carla gamemode])
(optionals cfg.bitwig.enable [
bitwig-studio
gamemode
])
(optionals cfg.tenacity.enable [tenacity])
(optionals cfg.faust.enable [faust])
(optionals cfg.yabridge.enable [yabridge yabridgectl])
(optionals cfg.noisesuppression.noisetorch.enable [noisetorch])
# (optionals cfg.vcvrack.enable [ vcv-rack ]) # Replaced by cardinal
(optionals cfg.cardinal.enable [cardinal])
# (optionals cfg.vital.enable [ vital-synth ]) # Replaced by distrho
(optionals cfg.distrho.enable [distrho])
];
services.easyeffects = mkIf cfg.noisesuppression.easyeffects.enable {
enable = true;
preset = optionalString cfg.noisesuppression.easyeffects.autostart "noise_supression";
};
# NOTE: This desktop entry is created in /etc/profiles/per-user/christoph/share/applications
# This location is part of XDG_DATA_DIRS
xdg.desktopEntries.guitar = mkIf cfg.carla.enable {
name = "Guitar Amp (Carla)";
genericName = "Guitar Amp Simulation";
icon = "carla";
exec = "env PIPEWIRE_LATENCY=256/48000 gamemoderun carla ${config.home.homeDirectory}/.config/carla/GuitarDefault.carxp";
terminal = false;
categories = ["Music" "Audio"];
};
xdg.desktopEntries.bitwig-low-latency = mkIf cfg.bitwig.enable {
name = "Bitwig Studio (Low Latency)";
genericName = "Digital Audio Workstation";
icon = "bitwig-studio";
exec = "env PIPEWIRE_LATENCY=256/48000 gamemoderun bitwig-studio";
terminal = false;
categories = ["Music" "Audio"];
};
# TODO: Disable only for plasma
# TODO: After pipewire.target or partof pipewire.service?
systemd.user.services = {
# autostart-noisetorch =
# (mkIf (cfg.noisesuppression.noisetorch.enable && cfg.noisesuppression.noisetorch.autostart) {
# Unit = {
# Type = "oneshot";
# Description = "Noisetorch noise suppression";
# PartOf = [ "graphical-session.target" ];
# After = [ "graphical-session.target" ];
# };
# Service = {
# Environment = "PATH=${config.home.profileDirectory}/bin"; # Leads to /etc/profiles/per-user/christoph/bin
# ExecStart = "${pkgs.noisetorch}/bin/noisetorch -i";
# Restart = "on-failure";
# };
# Install.WantedBy = [ "graphical-session.target" ];
# });
};
# NOTE: Important to not disable this option if another module enables it
modules.flatpak.bottles.enable = mkIf cfg.bottles.enable true;
home.activation = mkMerge [
# The module includes the default carla project with ArchetypePetrucci + ArchetypeGojira
(mkIf cfg.carla.enable {
linkCarlaConfig =
hm.dag.entryAfter ["writeBoundary"]
(mkLink "${config.home.homeDirectory}/NixFlake/config/carla" "${config.home.homeDirectory}/.config/carla");
})
(mkElse cfg.carla.enable {
unlinkCarlaConfig =
hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.config/carla");
})
# Replaced by distrho
# (mkIf cfg.vital.enable {
# linkVitalVST3 = hm.dag.entryAfter [ "writeBoundary" ]
# (mkLink "${pkgs.vital-synth}/lib/vst3/Vital.vst3" "${config.home.homeDirectory}/.vst3/Vital.vst3");
# })
# (mkElse cfg.vital.enable {
# unlinkVitalVST3 = hm.dag.entryAfter [ "writeBoundary" ]
# (mkUnlink "${config.home.homeDirectory}/.vst3/Vital.vst3");
# })
(mkIf cfg.distrho.enable {
linkDistrhoLV2 =
hm.dag.entryAfter ["writeBoundary"]
(mkLink "${pkgs.distrho}/lib/lv2" "${config.home.homeDirectory}/.lv2/distrho");
linkDistrhoVST =
hm.dag.entryAfter ["writeBoundary"]
(mkLink "${pkgs.distrho}/lib/vst" "${config.home.homeDirectory}/.vst/distrho");
linkDistrhoVST3 =
hm.dag.entryAfter ["writeBoundary"]
(mkLink "${pkgs.distrho}/lib/vst3" "${config.home.homeDirectory}/.vst3/distrho");
})
(mkElse cfg.distrho.enable {
unlinkDistrhoLV2 =
hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.lv2/distrho");
unlinkDistrhoVST =
hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.vst/distrho");
unlinkDistrhoVST3 =
hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.vst3/distrho");
})
(mkIf (cfg.yabridge.enable && cfg.yabridge.autoSync) {
syncYabridge = hm.dag.entryAfter ["writeBoundary"] ''
yabridgectl sync
'';
})
];
};
}

View File

@ -0,0 +1,48 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Audio module";
# TODO: Group these in categories (like instruments/VSTs or sth)
# TODO: Make it easier to add many yes/no options, similar to the flatpak stuff
# Hosts/Editing
carla.enable = mkEnableOpt "Carla (VST host)";
bitwig.enable = mkEnableOpt "Bitwig (Digital audio workstation)";
tenacity.enable = mkEnableOpt "Tenacity (Audacity fork)";
# Instruments/Plugins
# vcvrack.enable = mkEnableOpt "VCV-Rack (Eurorack simulator)"; # Replaced by cardinal
cardinal.enable = mkEnableOpt "Open Source VCV-Rack plugin wrapper";
# vital.enable = mkEnableOpt "Vital (Wavetable synthesizer)"; # Replaced by distrho
distrho.enable = mkEnableOpt "Distrho (Linux VST ports)";
# Misc
faust.enable = mkEnableOpt "Faust (functional DSP language)";
bottles.enable = mkEnableOpt "Bottles (flatpak)";
# TODO: Automatically add the needed paths, depends on the bottle though
# /home/christoph/.var/app/com.usebottles.bottles/data/bottles/bottles/Audio/drive_c/Program Files/Common Files/VST3
# /home/christoph/.var/app/com.usebottles.bottles/data/bottles/bottles/Audio/drive_c/Program Files/VstPlugins
yabridge = {
enable = mkEnableOpt "Yabridge (Windows VST plugin manager)";
autoSync = mkBoolOpt false "Sync yabridge plugins on nixos-rebuild";
};
noisesuppression = {
noisetorch = {
enable = mkEnableOpt "Noisetorch";
autostart = mkBoolOpt false "Autoload Noisetorch suppression";
};
# TODO: Store easyeffects presets/config (dconf com/github/wwmm/easyeffects ?)
easyeffects = {
enable = mkEnableOpt "EasyEffects";
autostart = mkBoolOpt false "Autoload EasyEffects suppression profile";
};
};
}

View File

@ -0,0 +1,130 @@
# https://nixos.org/manual/nixos/stable/index.html#sec-writing-modules
# This is a function with arguments
{
config,
lib,
mylib,
pkgs,
...
}:
# We add stuff from lib to our namespace (mkOption...)
with lib;
with mylib.modules; let
# This is the current state of the option that this module defines
# We use it to determine if the config should be changed below
cfg = config.modules.emacs;
in {
imports = [];
# Options is a vector of options this module defines
# This module defines only the "emacs" option and suboptions "enable" and "doom"
options.modules.emacs = import ./options.nix {inherit lib mylib;};
# Config is the merged set of all module configurations
# Here we define what happens to the config if the module is active (but only if the module is active)
# Since this module is for HomeManager, config is not the system config
# Attribute sets like config can be defined multiple times (every module defines a different config), on
# building the config they are merged
# Because config depends on itself recursively (through cfg) we use mkIf instead of the normal if...then...else,
# as it delays the evaluation (the if is moved inside the assignments inside the set)
# mkIf can only be used in the config section (like mkMerge, mkForce and co)
config = mkIf cfg.enable {
assertions = [
(mkIf cfg.nativeComp {
assertion = !cfg.pgtkNativeComp && !cfg.nixpkgs;
message = "Can't enable more than one Emacs package!";
})
(mkIf cfg.pgtkNativeComp {
assertion = !cfg.nativeComp && !cfg.nixpkgs;
message = "Can't enable more than one Emacs package!";
})
(mkIf cfg.nixpkgs {
assertion = !cfg.nativeComp && !cfg.pgtkNativeComp;
message = "Can't enable more than one Emacs package!";
})
];
# What home packages should be enabled
home.packages = with pkgs;
builtins.concatLists [
(optionals cfg.nativeComp [((emacsPackagesFor emacsNativeComp).emacsWithPackages (epkgs: [epkgs.vterm epkgs.pdf-tools]))])
(optionals cfg.pgtkNativeComp [((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages (epkgs: [epkgs.vterm epkgs.pdf-tools]))])
(optionals cfg.nixpkgs [((emacsPackagesFor emacs).emacsWithPackages (epkgs: [epkgs.vterm epkgs.pdf-tools]))])
# TODO: Check what hlissner has enabled
(optionals cfg.doom.enable [
# emacs-all-the-icons-fonts # Needs to be in fonts.fonts
(ripgrep.override {withPCRE2 = true;})
fd
zstd
sqlite # Org roam
inkscape # Org latex preview
graphviz # Org graphviz support
gnuplot # Org gnuplot support
pandoc # Org export formats
maim
bashInteractive # For keychain
# TODO: I don't want to have this here permanently, maybe put in a shell.nix if compilation is needed?
gcc # Need this for org roam
# TODO: Conflicts with global python?
# withPackages expects a function that gets all the packages as argument and returns a list with the packages we want
(python310.withPackages (ppkgs: [ppkgs.pygments])) # Latex minted
# TODO: Does it work like this aswell?
# python310Packages.pygments
# nixfmt # This belongs in specific flake.nix
# shellcheck # This belongs in specific flake.nix
texlive.combined.scheme-full
])
];
home.sessionPath = mkIf cfg.doom.enable ["${config.home.homeDirectory}/.emacs.d/bin"];
# Note: Don't do it this way as the config becomes immutable
# We tell HomeManager where the config files belong
# home.file.".config/doom" = {
# # With onChange you even could rebuild doom emacs when rebuilding HomeManager but I don't want this to become too slow
# recursive = true; # is a directory
# source = ../../config/doom;
# };
home.activation = mkMerge [
# The parantheses around mkIf are needed for precedence in this case
(mkIf cfg.doom.enable {
# If doom is enabled we want to clone the framework
# The activation script is being run when home-manager rebuilds
# Because we write to the filesystem, this script has to be run after HomeManager's writeBoundary
installDoomEmacs = hm.dag.entryAfter ["writeBoundary"] ''
if [ ! -d "${config.home.homeDirectory}/.emacs.d" ]; then
git clone --depth=1 --single-branch "https://github.com/doomemacs/doomemacs" "${config.home.homeDirectory}/.emacs.d"
fi
'';
# With this approach we keep the config mutable as it is not copied and linked from store
linkDoomConfig =
hm.dag.entryAfter ["writeBoundary" "installDoomEmacs"]
(mkLink "${config.home.homeDirectory}/NixFlake/config/doom" "${config.home.homeDirectory}/.config/doom");
})
(mkElse cfg.doom.enable {
unlinkDoomConfig =
hm.dag.entryAfter ["writeBoundary" "installDoomEmacs"]
(mkUnlink "${config.home.homeDirectory}/.config/doom");
})
(mkIf (cfg.doom.enable && cfg.doom.autoSync) {
syncDoomEmacs = hm.dag.entryAfter ["writeBoundary" "linkDoomConfig"] ''
${config.home.homeDirectory}/.emacs.d/bin/doom sync &
'';
})
(mkIf (cfg.doom.enable && cfg.doom.autoUpgrade) {
upgradeDoomEmacs = hm.dag.entryAfter ["writeBoundary" "linkDoomConfig"] ''
${config.home.homeDirectory}/.emacs.d/bin/doom upgrade -!
'';
})
];
};
}

View File

@ -0,0 +1,20 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Emacs module";
# TODO: Use an enum for this not individual options
nixpkgs = mkBoolOpt false "Use Emacs from the official repositories";
nativeComp = mkBoolOpt false "Use Emacs 28.x branch with native comp support";
pgtkNativeComp = mkBoolOpt false "Use Emacs 29.x branch with native comp and pure gtk support";
doom = {
enable = mkEnableOpt "Doom Emacs framework";
autoSync = mkBoolOpt false "Sync Doom Emacs on nixos-rebuild";
autoUpgrade = mkBoolOpt false "Upgrade Doom Emacs on nixos-rebuild";
};
}

View File

@ -0,0 +1,153 @@
# Example: https://beb.ninja/post/email/
# Example: https://sbr.pm/configurations/mails.html
# TODO: Protonmail-bridge
# TODO: Change to use thunderbird only
# NOTE: The passwords must exist in kwallet
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules; let
cfg = config.modules.email;
in {
options.modules.email = import ./options.nix {inherit lib mylib;};
# TODO: Add Maildir to nextcloud sync
config = mkIf cfg.enable {
home.packages = with pkgs;
builtins.concatLists [
(optionals cfg.kmail.enable [kmail])
];
home.file = mkMerge [
(optionalAttrs (cfg.kmail.enable && cfg.kmail.autostart) {
".config/autostart/org.kde.kmail2.desktop".source = ../../config/autostart/org.kde.kmail2.desktop;
})
];
programs = {
mbsync.enable = true; # isync package
msmtp.enable = true;
# Run notmuch new to index all new mail
notmuch = {
enable = true;
hooks = {
# When running notmuch new all channels will be syncronized by mbsync
preNew = "mbsync --all";
};
};
};
# TODO: imapnotify can't parse the configuration, HM bug?
services.imapnotify.enable = cfg.imapnotify;
# Autosync, don't need imapnotify when enabled
systemd.user.services.mail-autosync = (mkIf cfg.autosync) {
Unit = {Description = "Automatic notmuch/mbsync synchronization";};
Service = {
Type = "oneshot";
# ExecStart = "${pkgs.isync}/bin/mbsync -a";
ExecStart = "${pkgs.notmuch}/bin/notmuch new";
};
};
systemd.user.timers.mail-autosync = (mkIf cfg.autosync) {
Unit = {Description = "Automatic notmuch/mbsync synchronization";};
Timer = {
OnBootSec = "30";
OnUnitActiveSec = "5m";
};
Install = {WantedBy = ["timers.target"];};
};
accounts.email.accounts = {
urpost = {
address = "tobi@urpost.de";
userName = "tobi@urpost.de";
realName = "Christoph Urlacher";
signature.showSignature = "none";
imap.host = "mail.zeus08.de";
imap.port = 993;
smtp.host = "mail.zeus08.de";
smtp.port = 465;
passwordCommand = "kwallet-query -f email -r urpost kdewallet";
mbsync = {
# Imap
enable = true;
create = "maildir";
};
msmtp.enable = true; # Smtp
notmuch.enable = true;
imapnotify.enable = cfg.imapnotify;
imapnotify.onNotify = {
mail = "${pkgs.notmuch}/bin/notmuch new && ${pkgs.libnotify}/bin/notify-send 'New mail arrived on Urpost'";
};
primary = true;
};
hhu = {
address = "christoph.urlacher@hhu.de";
userName = "churl100";
realName = "Christoph Urlacher";
signature.showSignature = "none";
imap.host = "mail.hhu.de";
imap.port = 993;
smtp.host = "mail.hhu.de";
smtp.port = 465;
passwordCommand = "kwallet-query -f email -r hhu kdewallet";
mbsync = {
# Imap
enable = true;
create = "maildir";
};
msmtp.enable = true; # Smtp
notmuch.enable = true;
imapnotify.enable = cfg.imapnotify;
imapnotify.onNotify = {
mail = "${pkgs.notmuch}/bin/notmuch new && ${pkgs.libnotify}/bin/notify-send 'New mail arrived on HHU'";
};
primary = false;
};
# TODO: Setup the correct groups/patterns
gmail = {
address = "tobiasmustermann529@gmail.com";
userName = "tobiasmustermann529@gmail.com";
realName = "Christoph Urlacher";
signature.showSignature = "none";
flavor = "gmail.com";
# NOTE: Uses Gmail app password
passwordCommand = "kwallet-query -f email -r gmail kdewallet";
mbsync = {
# Imap
enable = true;
create = "maildir";
patterns = ["*" "![Gmail]*" "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail"]; # Only sync inbox
};
msmtp.enable = true; # Smtp
notmuch.enable = true;
imapnotify.enable = cfg.imapnotify;
imapnotify.onNotify = {
mail = "${pkgs.notmuch}/bin/notmuch new && ${pkgs.libnotify}/bin/notify-send 'New mail arrived on GMail'";
};
primary = false;
};
};
};
}

View File

@ -0,0 +1,16 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Email";
autosync = mkEnableOpt "Automatically call \"notmuch new\" via systemd timer";
imapnotify = mkEnableOpt "Use imapnotify to sync and index mail automatically";
kmail = {
enable = mkEnableOpt "Kmail";
autostart = mkEnableOpt "Autostart Kmail";
};
}

View File

@ -0,0 +1,172 @@
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
# NOTE: The module is also used by other modules (gaming, audio).
# It is important that every flatpak interaction is handled through this module
# to prevent that anything is removed by a module although it is required by another one
let
cfg = config.modules.flatpak;
in {
options.modules.flatpak = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable {
assertions = [
{
assertion = nixosConfig.services.flatpak.enable;
message = "Cannot use the flatpak module with flatpak disabled in nixos!";
}
];
# NOTE: Is already set by flatpak.enable in configuration.nix
# xdg.systemDirs.data = [
# "/var/lib/flatpak/exports/share"
# "${home.homeDirectory}/.local/share/flatpak/exports/share"
# ];
# TODO: Currently it is not possible to define overrides for the same flatpak from different places
# TODO: Also only filesystem overrides are applied
home.file = let
# Specific overrides
# This generates the set { "<filename>" = "<overrides>"; }
concat_override = name: value: (optionalAttrs (name != null) {".local/share/flatpak/overrides/${name}".text = "[Context]\nfilesystems=${value}";});
# This is a list of sets: [ { "<filename>" = "<overrides>"; } { "<filename>" = "<overrides>"; } ]
extra_overrides = map (set: concat_override (attrName set) (attrValue set)) cfg.extraOverride;
# Global overrides
global_default_overrides = [
"/nix/store:ro"
# TODO: There are irregular problems with flatpak app font antialiasing, I don't know where it comes from or when
# Also some icons are missing, even when icon dir is accessible
# I remember I did something one time that fixed it, but what was it :(?
# NOTE: This doesn't help sadly, also steam can't launch with this because it wants to create a link to ~/.local/share/fonts?
# "${config.home.homeDirectory}/.local/share/icons"
# "${config.home.homeDirectory}/.local/share/fonts"
# TODO: These are not necessary (Really?)
# Make sure flatpaks are allowed to use the icons/fonts that are symlinked by icon/font fix
# "/run/current-system/sw/share/X11/fonts:ro"
# "/run/current-system/sw/share/icons:ro"
];
global_overrides = builtins.concatLists [global_default_overrides cfg.extraGlobalOverride];
str_global_overrides = builtins.concatStringsSep ";" global_overrides;
in
mkMerge ([
{
".local/share/flatpak/overrides/global".text = "[Context]\nfilesystems=${str_global_overrides}";
}
]
++ extra_overrides);
home.activation = mkMerge [
# TODO: Linking isn't always enough, some fonts should be copied aswell...
# We link like this to be able to address the absolute location, also the fonts won't get copied to store
# NOTE: This path contains all the fonts because fonts.fontDir.enable is true
(mkIf cfg.fontFix {
linkFontDir =
lib.hm.dag.entryAfter ["writeBoundary"]
(mkLink "/run/current-system/sw/share/X11/fonts" "${config.home.homeDirectory}/.local/share/fonts/fonts");
copyBaseFonts = lib.hm.dag.entryAfter ["writeBoundary"] ''
cp -f ${pkgs.lxgw-wenkai}/share/fonts/truetype/LXGWWenKaiMono-Regular.ttf ${config.home.homeDirectory}/.local/share/fonts/
cp -f ${pkgs.nerdfonts.override {fonts = ["JetBrainsMono"];}}/share/fonts/truetype/NerdFonts/JetBrainsMonoNerdFontMono-Regular.ttf ${config.home.homeDirectory}/.local/share/fonts/
cp -f ${pkgs.noto-fonts}/share/fonts/noto/NotoSans[wdth,wght].ttf ${config.home.homeDirectory}/.local/share/fonts/
cp -f ${pkgs.noto-fonts-emoji}/share/fonts/noto/NotoColorEmoji.ttf ${config.home.homeDirectory}/.local/share/fonts/
'';
})
(mkElse cfg.fontFix {
unlinkFontDir =
lib.hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.local/share/fonts/fonts");
deleteBaseFonts = lib.hm.dag.entryAfter ["writeBoundary"] ''
rm ${config.home.homeDirectory}/.local/share/fonts/LXGWWenKaiMono-Regular.ttf
rm ${config.home.homeDirectory}/.local/share/fonts/JetBrainsMonoNerdFontMono-Regular.ttf
rm ${config.home.homeDirectory}/.local/share/fonts/NotoSans[wdth,wght].ttf
rm ${config.home.homeDirectory}/.local/share/fonts/NotoColorEmoji.ttf
'';
})
# Fixes missing icons + cursor
# NOTE: This path works because we have homeManager.useUserPackages = true (everything is stored in /etc/profiles/)
(mkIf cfg.iconFix {
linkIconDir =
lib.hm.dag.entryAfter ["writeBoundary"]
(mkLink "/etc/profiles/per-user/christoph/share/icons" "${config.home.homeDirectory}/.local/share/icons");
})
(mkElse cfg.iconFix {
unlinkIconDir =
lib.hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.local/share/icons");
})
# TODO: I should find a smarter way than this to make it easy to add flatpak options
{
# TODO: Enable this block only if any flatpak is enabled
installFlatpaks = let
to_install = builtins.concatLists [
(optionals cfg.discord.enable ["com.discordapp.Discord"])
(optionals cfg.spotify.enable ["com.spotify.Client"])
(optionals cfg.flatseal.enable ["com.github.tchx84.Flatseal"])
(optionals cfg.bottles.enable ["com.usebottles.bottles"])
(optionals cfg.obsidian.enable ["md.obsidian.Obsidian"])
(optionals cfg.jabref.enable ["org.jabref.Jabref"])
cfg.extraInstall
];
to_install_str = builtins.concatStringsSep " " to_install;
in
# Flatpak install can take a long time so we disconnect the process to not trigger the HM timeout (90s)
lib.hm.dag.entryAfter ["writeBoundary"] ''
sudo flatpak install -y ${to_install_str} &
'';
}
{
# TODO: Enable this block only if any flatpak is disabled
removeFlatpaks = let
to_remove = builtins.concatLists [
(optionals (!cfg.discord.enable) ["com.discordapp.Discord"])
(optionals (!cfg.spotify.enable) ["com.spotify.Client"])
(optionals (!cfg.flatseal.enable) ["com.github.tchx84.Flatseal"])
(optionals (!cfg.bottles.enable) ["com.usebottles.bottles"])
(optionals (!cfg.obsidian.enable) ["md.obsidian.Obsidian"])
(optionals (!cfg.jabref.enable) ["org.jabref.Jabref"])
# Remove only the flatpaks that are not present in extraInstall
(without cfg.extraRemove cfg.extraInstall)
];
to_remove_str = builtins.concatStringsSep " " to_remove;
in
# By using || we make sure this command never throws any errors
# Uninstallation is fast so HM timeout shouldn't be triggered
lib.hm.dag.entryAfter ["writeBoundary"] ''
sudo flatpak uninstall -y ${to_remove_str} || echo "Nothing to be removed"
'';
}
(mkIf cfg.autoUpdate {
# Flatpak install can take a long time so we disconnect the process to not trigger the HM timeout (90s)
updateFlatpak = lib.hm.dag.entryAfter ["writeBoundary"] ''
sudo flatpak update -y &
'';
})
# Execute this after flatpak removal as there can be leftovers
(mkIf cfg.autoPrune {
pruneFlatpak = lib.hm.dag.entryAfter ["writeBoundary" "removeFlatpak"] ''
sudo flatpak uninstall --unused -y
'';
})
];
};
}

View File

@ -0,0 +1,55 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Flatpak module";
fontFix = mkBoolOpt true "Link fonts to ~/.local/share/fonts so flatpak apps can find them";
iconFix = mkBoolOpt true "Link icons to ~/.local/share/icons so flatpak apps can find them";
autoUpdate = mkBoolOpt false "Update flatpak apps on nixos-rebuild";
autoPrune = mkBoolOpt false "Remove unused packages on nixos-rebuild";
# TODO: Add library function to make this easier
# TODO: The flatpak name should be included and a list of all enabled apps should be available
# TODO: Do this for strings + packages
discord.enable = mkEnableOpt "Discord";
spotify.enable = mkEnableOpt "Spotify";
flatseal.enable = mkEnableOpt "Flatseal";
bottles.enable = mkEnableOpt "Bottles";
obsidian.enable = mkEnableOpt "Obsidian";
jabref.enable = mkEnableOpt "Jabref";
# xwaylandvideobridge = mkEnableOpt "XWayland Video Bridge"; # TODO
# TODO: Can I use extraInstall = { "com.valve.Steam" = true/false; } and pass the module option as value?
# This is mainly used by other modules to allow them to use flatpak packages
extraInstall = mkOption {
type = types.listOf types.str;
default = [];
description = "Flatpaks that will be installed additionally";
};
# This doesn't uninstall if any flatpak is still present in the extraInstall list
extraRemove = mkOption {
type = types.listOf types.str;
default = [];
description = "Flatpaks that will be removed additionally (use with extraInstall)";
};
extraOverride = mkOption {
type = types.listOf types.attrs;
default = [];
# TODO: Change the format to { "com.usebottles.bottles" = [ "~/Documents" "~/Downloads" ]; }
# TODO: This requires that the lists of the same key are being merged recursively, mkMerge would override the key
example = [{"com.usebottles.bottles" = "\${config.home.homeDirectory}/Documents";}];
description = "Additional overrides";
};
extraGlobalOverride = mkOption {
type = types.listOf types.str;
default = [];
example = ["\${config.home.homeDirectory}/Documents:ro"];
description = "Additional global overrides";
};
}

View File

@ -0,0 +1,161 @@
{
config,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules; let
cfg = config.modules.gaming;
cfgfp = config.modules.flatpak;
in {
imports = [
# NOTE: I don't know if this is the right approach or if I should use config.modules.flatpak
../flatpak
];
# TODO: Enable flatpak MangoHud, there are multiple versions, Steam.Utility.MangoHud works but can't be configured (in ~/.config/MangoHud), other versions don't even work (need to figure that out as Steam.Utility.MangoHud is EOL...)
# TODO: SteamTinkerLaunch option
# TODO: Dolphin + SteamRomManager option
options.modules.gaming = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable {
assertions = [
# TODO: Make lib function for multiple assertions that have the same condition
(mkIf cfg.steam.enable {
assertion = cfgfp.enable;
message = "Cannot enable Steam without the flatpak module!";
})
(mkIf cfg.prism.enable {
assertion = cfgfp.enable;
message = "Cannot enable PrismLauncher without the flatpak module!";
})
(mkIf cfg.bottles.enable {
assertion = cfgfp.enable;
message = "Cannot enable Bottles without the flatpak module!";
})
];
home.packages = with pkgs;
builtins.concatLists [
[
gamemode # gamemode should be always enabled (could also be enabled by audio module)
oversteer # TODO: Make option
# Sometimes needed for Proton prefix shenenigans (for AC etc.), but probably only works with Protontricks only so disable for now...
# wine64 # TODO: Make option or dependant on protontricks?
]
# TODO: Extra config (extensions etc) in chromium module
# (optionals cfg.discordChromium.enable [chromium])
# Prefer flatpak version as nixpkgs version isn't always updated in time
# (optionals cfg.discordElectron.enable [discord])
(optionals cfg.steam.adwaita [adwaita-for-steam])
# Prefer flatpak version as this one doesn't find the STEAM_DIR automatically
# (optionals cfg.steam.enable [ protontricks ])
# (optionals cfg.dwarffortress.enable [dwarf-fortress-packages.dwarf-fortress-full])
(optionals cfg.cemu.enable [cemu cdecrypt wiiu-downloader])
];
# This doesn't work because steam doesn't detect symlinked skins, files have to be copied
# https://github.com/ValveSoftware/steam-for-linux/issues/3572
# home.file = mkMerge [
# (optionalAttrs cfg.steam.adwaita {
# "adwaita-for-steam" = {
# source = "${pkgs.adwaita-for-steam}/share/adwaita-for-steam/Adwaita";
# target = ".var/app/com.valvesoftware.Steam/.local/share/Steam/skins/Adwaita";
# recursive = false;
# };
# })
# ];
home.activation = mkMerge [
(optionalAttrs cfg.steam.adwaita {
copySteamAdwaitaSkin = hm.dag.entryAfter ["writeBoundary"] ''
if [ ! -d ${config.home.homeDirectory}/.var/app/com.valvesoftware.Steam/.local/share/Steam/skins ]; then
mkdir ${config.home.homeDirectory}/.var/app/com.valvesoftware.Steam/.local/share/Steam/skins
fi
# Delete the directory to copy again, if src was updated
if [ -d ${config.home.homeDirectory}/.var/app/com.valvesoftware.Steam/.local/share/Steam/skins/Adwaita ]; then
rm -rf ${config.home.homeDirectory}/.var/app/com.valvesoftware.Steam/.local/share/Steam/skins/Adwaita
fi
cp -r ${pkgs.adwaita-for-steam}/share/adwaita-for-steam/Adwaita ${config.home.homeDirectory}/.var/app/com.valvesoftware.Steam/.local/share/Steam/skins/Adwaita
chmod -R +w ${config.home.homeDirectory}/.var/app/com.valvesoftware.Steam/.local/share/Steam/skins/Adwaita
'';
})
(optionalAttrs (! cfg.steam.adwaita) {
deleteSteamAdwaitaSkin = hm.dag.entryAfter ["writeBoundary"] ''
rm -rf ${config.home.homeDirectory}/.var/app/com.valvesoftware.Steam/.local/share/Steam/skins/Adwaita
'';
})
];
# xdg.desktopEntries.discordChromium = mkIf cfg.discordChromium.enable {
# name = "Discord (Chromium)";
# genericName = "Online voice chat";
# icon = "discord";
# exec = "chromium --new-window discord.com/app";
# terminal = false;
# categories = ["Network" "Chat"];
# };
# TODO: Remove the bottles option from the gaming module (move it to the flatpak module)
# NOTE: Important to not disable this option if another module enables it
# modules.flatpak.bottles.enable = mkIf cfg.bottles.enable true;
modules.flatpak.extraOverride = [
# Allow Bottles to manage proton prefixes
(optionalAttrs cfg.bottles.enable {
"com.usebottles.bottles" = "${config.home.homeDirectory}/.var/app/com.valvesoftware.Steam;${config.home.homeDirectory}/GameSSD;${config.home.homeDirectory}/GameHDD";
})
# Allow Steam to access different library folders
# Allow Steam to explicitly run something through ProtonGE
(optionalAttrs cfg.steam.enable {
# TODO: Make the second string into a list [ ~/GameSSD ~/GameHDD ] etc.
"com.valvesoftware.Steam" = "${config.home.homeDirectory}/GameSSD;${config.home.homeDirectory}/GameHDD;/var/lib/flatpak/runtime/com.valvesoftware.Steam.CompatibilityTool.Proton-GE";
})
# Allow protontricks to change prefixes in different library folders
(optionalAttrs cfg.steam.enable {
"com.github.Matoking.protontricks" = "${config.home.homeDirectory}/GameSSD;${config.home.homeDirectory}/GameHDD";
})
# Allow ProtonUP-Qt to see game list and access steam
(optionalAttrs (cfg.steam.enable && cfg.steam.protonup) {
"net.davidotek.pupgui2" = "${config.home.homeDirectory}/.var/app/com.valvesoftware.Steam;${config.home.homeDirectory}/GameSSD;${config.home.homeDirectory}/GameHDD";
})
];
# TODO: RetroArch option org.libretro.RetroArch
modules.flatpak.extraInstall = builtins.concatLists [
(optionals cfg.steam.enable [
"com.valvesoftware.Steam"
"com.github.Matoking.protontricks"
# "com.valvesoftware.Steam.Utility.steamtinkerlaunch"
# "com.steamgriddb.steam-rom-manager"
# "org.DolphinEmu.dolphin-emu"
])
(optionals (cfg.steam.enable && cfg.steam.gamescope) ["com.valvesoftware.Steam.Utility.gamescope"])
(optionals (cfg.steam.enable && cfg.steam.protonup) ["net.davidotek.pupgui2"])
(optionals cfg.prism.enable ["org.prismlauncher.PrismLauncher"])
];
modules.flatpak.extraRemove = builtins.concatLists [
(optionals (!cfg.steam.enable) [
"com.valvesoftware.Steam"
"com.github.Matoking.protontricks"
# "com.valvesoftware.Steam.Utility.steamtinkerlaunch"
# "com.steamgriddb.steam-rom-manager"
# "org.DolphinEmu.dolphin-emu"
])
(optionals (!cfg.steam.enable || !cfg.steam.gamescope) ["com.valvesoftware.Steam.Utility.gamescope"])
(optionals (!cfg.steam.enable || !cfg.steam.protonup) ["net.davidotek.pupgui2"])
(optionals (!cfg.prism.enable) ["org.prismlauncher.PrismLauncher"])
];
};
}

View File

@ -0,0 +1,23 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Gaming module";
# discordElectron.enable = mkEnableOpt "Discord (Electron) (nixpkgs)";
# discordChromium.enable = mkEnableOpt "Discord (Chromium)";
prism.enable = mkEnableOpt "PrismLauncher for Minecraft (flatpak)";
bottles.enable = mkEnableOpt "Bottles (flatpak)";
# dwarffortress.enable = mkEnableOpt "Dwarf Fortress";
cemu.enable = mkEnableOpt "Cemu (nixpkgs)";
steam = {
enable = mkEnableOpt "Steam (flatpak)";
gamescope = mkBoolOpt false "Enable the gamescope micro compositor (flatpak)";
adwaita = mkBoolOpt false "Enable the adwaita-for-steam skin";
protonup = mkBoolOpt false "Enable ProtonUP-QT";
};
}

View File

@ -0,0 +1,64 @@
# TODO: Expose some settings
# TODO: Fix language config
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules; let
cfg = config.modules.helix;
in {
options.modules.helix = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable {
home.sessionVariables = {
EDITOR = "hx";
VISUAL = "hx";
};
programs.helix = {
enable = true;
# NOTE: Syntax changed
# languages = [
# {
# name = "verilog";
# roots = [
# ".svls.toml"
# ".svlint.toml"
# ];
# language-server = {
# command = "svls";
# args = [];
# };
# }
# ];
# https://docs.helix-editor.com/configuration.html
settings = {
theme = "catppuccin_latte";
editor = {
scrolloff = 10;
mouse = false; # Default true
middle-click-paste = false; # Default true
line-number = "relative";
cursorline = true;
color-modes = true;
auto-completion = true; # Default
bufferline = "multiple";
cursor-shape = {
normal = "block";
insert = "bar";
select = "underline";
};
lsp.display-messages = true;
indent-guides.render = false;
};
};
};
};
}

View File

@ -0,0 +1,9 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Helix Editor";
}

View File

@ -0,0 +1,64 @@
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
# TODO: Remove this module, put protonmail into the email module
with lib;
with mylib.modules; let
cfg = config.modules.misc;
in {
options.modules.misc = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable {
home.packages = with pkgs;
builtins.concatLists [
(optionals cfg.keepass.enable [keepassxc])
(optionals cfg.protonmail.enable [protonmail-bridge])
];
systemd.user.services = mkMerge [
(optionalAttrs (cfg.keepass.enable && cfg.keepass.autostart) {
# TODO: Disable only for plasma
# autostart-keepass = {
# Unit = {
# Type = "oneshot";
# Description = "KeePassXC password manager";
# PartOf = [ "graphical-session.target" ];
# After = [ "graphical-session.target" ];
# };
# Service = {
# # Environment = "PATH=${config.home.profileDirectory}/bin"; # Leads to /etc/profiles/per-user/christoph/bin
# ExecStart = "${pkgs.keepassxc}/bin/keepassxc ${config.home.homeDirectory}/Documents/KeePass/passwords.kbdx";
# # ExecStop = "${pkgs.noisetorch}/bin/noisetorch -u";
# Restart = "on-failure";
# };
# Install.WantedBy = [ "graphical-session.target" ];
# };
})
# TODO: Disable only for plasma
# TODO: Error: has no wallet, find out how to get imap credentials from this
# (optionalAttrs (cfg.protonmail.enable && cfg.protonmail.autostart) {
# autostart-protonmail = {
# Unit = {
# Description = "ProtonMail Bridge";
# After = [ "network.target" ];
# };
# Service = {
# ExecStart = "${pkgs.protonmail-bridge}/bin/protonmail-bridge --no-window --log-level info --noninteractive";
# Restart = "always";
# };
# Install.WantedBy = [ "default.target" ];
# };
# })
];
};
}

View File

@ -0,0 +1,19 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Misc module";
keepass = {
enable = mkEnableOpt "KeePassXC";
autostart = mkBoolOpt false "Autostart KeePassXC";
};
protonmail = {
enable = mkEnableOpt "ProtonMail";
autostart = mkBoolOpt false "Autostart ProtonMail Bridge";
};
}

View File

@ -0,0 +1,50 @@
# Changed from https://github.com/nix-community/home-manager/blob/master/modules/services/nextcloud-client.nix
# I use this instead of the HM module as the autostart wasn't working there
# TODO: Remove this module
# TODO: Check the HM module again if anything changed, as this has also stopped working
# Nextcloud immediately crashes on start, autostart isn't working either...
{
config,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules; let
cfg = config.modules.nextcloud;
in {
options.modules.nextcloud = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable {
assertions = [
{
assertion = !config.services.nextcloud-client.enable;
message = "Can't enable both HM nextcloud and my nextcloud module!";
}
];
# I want to have nextcloud-client in the path when the module is enabled
home.packages = with pkgs; [nextcloud-client];
# TODO: Disable only for plasma
# systemd.user.services = (mkIf cfg.autostart) {
# autostart-nextcloud-client = {
# Unit = {
# Description = "Nextcloud Client";
# PartOf = [ "graphical-session.target" ];
# # was graphical-session-pre.target originally in HM
# After = [ "graphical-session.target" "network-online.target" ];
# };
# Service = {
# Environment = "PATH=${config.home.profileDirectory}/bin";
# ExecStart = "${pkgs.nextcloud-client}/bin/nextcloud --background";
# };
# Install.WantedBy = [ "graphical-session.target" ];
# };
# };
};
}

View File

@ -0,0 +1,10 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Nextcloud Client";
autostart = mkBoolOpt false "Autostart the Nextcloud client (systemd)";
}

View File

@ -0,0 +1,81 @@
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules; let
cfg = config.modules.ranger;
in {
options.modules.ranger = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable {
home.packages = with pkgs;
lib.concatLists [
[
ranger
atool
p7zip
zip
unzip
unrar
libarchive
exiftool
mediainfo
]
(optionals cfg.preview [
# ueberzug # Only X11
# TODO: Conflicts with global python?
python310Packages.pillow
ffmpegthumbnailer
imagemagick
poppler_utils
])
];
home.file = mkMerge [
{
".config/ranger/rc.conf".text = let
# TODO: Why does mkMerge don't work here?
settings =
{
column_ratios = "1,1";
vcs_aware = "true";
preview_images_method = "kitty"; # TODO: Only if kitty enabled
unicode_ellipsis = "true";
draw_borders =
if cfg.preview
then "none"
else "both"; # doesn't work well with preview
line_numbers = "relative";
preview_images =
if cfg.preview
then "true"
else "false";
use_preview_script =
if cfg.preview
then "true"
else "false";
}
// (optionalAttrs cfg.preview {
preview_script = "${config.home.homeDirectory}/.config/ranger/scope.sh";
});
# The settings { column_ratios = "1,1"; } get turned into { column_ratios = "set column_ratios = 1,1"; }
settings_in_values = mapAttrs (name: value: concatStringsSep " " ["set" name value]) settings;
settings_list = attrValues settings_in_values; # Results in [ "set column_rations = 1,1" ]
settings_str = concatStringsSep "\n" settings_list;
in
settings_str;
}
(optionalAttrs cfg.preview {
".config/ranger/scope.sh".source = ../../config/ranger/scope.sh;
})
];
};
}

View File

@ -0,0 +1,10 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Ranger";
preview = mkBoolOpt false "Enable Ranger image preview";
}

View File

@ -0,0 +1,156 @@
# TODO: Expose some settings
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules; let
cfg = config.modules.vscode;
in {
options.modules.vscode = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable {
programs.vscode = {
enable = true;
enableExtensionUpdateCheck = false;
enableUpdateCheck = false;
extensions = with pkgs.vscode-extensions; [
# alefragnani.bookmarks # TODO: Use inline bookmarks instead
# alefragnani.project-manager # NOTE: Not much sense with flake dev environments
catppuccin.catppuccin-vsc
catppuccin.catppuccin-vsc-icons
christian-kohler.path-intellisense
# codezombiech.gitignore # NOTE: Superfluous
# coolbear.systemd-unit-file # NOTE: Unnecessary on NixOS
eamodio.gitlens
# formulahendry.auto-rename-tag
# formulahendry.auto-close-tag
# gitlab.gitlab-workflow
# irongeek.vscode-env
# jnoortheen.nix-ide
# kamadorueda.alejandra
# kamikillerto.vscode-colorize
# llvm-vs-code-extensions.vscode-clangd
# matklad.rust-analyzer
mechatroner.rainbow-csv
# mikestead.dotenv
# mkhl.direnv
# ms-azuretools.vscode-docker
# ms-kubernetes-tools.vscode-kubernetes-tools
ms-python.python
ms-toolsai.jupyter
ms-vscode.cmake-tools
ms-vscode.cpptools
# ms-vscode.hexeditor
# ms-vscode.makefile-tools
ms-python.black-formatter
ms-python.vscode-pylance
ms-vscode-remote.remote-ssh
# naumovs.color-highlight
njpwerner.autodocstring
# james-yu.latex-workshop
# redhat.java
# redhat.vscode-xml
# redhat.vscode-yaml
ritwickdey.liveserver
# rubymaniac.vscode-paste-and-indent
ryu1kn.partial-diff
# serayuzgur.crates
shd101wyy.markdown-preview-enhanced
# skyapps.fish-vscode
# tamasfe.even-better-toml
# timonwong.shellcheck
# tomoki1207.pdf # Incompatible with latex workshop
# valentjn.vscode-ltex
vscodevim.vim
vscode-icons-team.vscode-icons
# yzhang.markdown-all-in-one
];
# haskell = {};
# keybindings = {};
userSettings = {
# VSCode Internals
"editor.fontFamily" = "JetBrainsMono Nerd Font Mono";
"editor.fontSize" = 16;
"editor.renderWhitespace" = "selection";
"editor.cursorStyle" = "line"; # Use line for vim plugin
"editor.lineNumbers" = "relative";
"editor.linkedEditing" = true;
"editor.smoothScrolling" = true;
"editor.stickyScroll.enabled" = true;
"editor.tabCompletion" = "on";
"editor.cursorSmoothCaretAnimation" = "on";
"editor.cursorSurroundingLines" = 10;
"editor.minimap.renderCharacters" = false;
"editor.bracketPairColorization.enabled" = true;
"editor.guides.bracketPairs" = "active";
"editor.guides.bracketPairsHorizontal" = "active";
"editor.guides.highlightActiveIndentation" = false;
"files.autoSave" = "onFocusChange";
"files.trimFinalNewlines" = true;
"files.trimTrailingWhitespace" = true; # NOTE: If this is enabled with frequent autosave, the current lines whitespace will always be removed, which is obnoxious
"window.restoreWindows" = "none";
"window.titleBarStyle" = "custom"; # NOTE: Should help with crashing on wayland
# "window.titleBarStyle" = "native";
# "window.menuBarVisibility" = "toggle";
"workbench.enableExperiments" = false;
"workbench.list.smoothScrolling" = true;
# "workbench.colorTheme" = "Default Light Modern";
# "workbench.iconTheme" = "vscode-icons";
"workbench.colorTheme" = "Catppuccin Latte";
"workbench.iconTheme" = "catppuccin-latte";
"remote.SSH.configFile" = "~/.ssh/custom-config";
"security.workspace.trust.enabled" = false;
# Language Tool
"ltex.checkFrequency" = "manual";
# LaTeX
"latex-workshop.latex.tools" = [
{
"name" = "latexmk";
"command" = "latexmk";
"args" = [
"-synctex=1"
"-shell-escape"
"-interaction=nonstopmode"
"-file-line-error"
"-pdf"
"-outdir=%OUTDIR%"
"%DOC%"
];
"env" = {};
}
];
"latex-workshop.latexindent.args" = [
"-c"
"%DIR%/"
"%TMPFILE%"
"-m"
"-y=defaultIndent: '%INDENT%'"
];
# Nix
"[nix]"."editor.tabSize" = 2;
"nix.enableLanguageServer" = true;
"nix.serverPath" = "nil";
"nix.formatterPath" = "alejandra";
# C++
# "C_Cpp.intelliSenseEngine" = "disabled"; # IntelliSense conflics with Clangd
};
# TODO: Snippets
};
};
}

View File

@ -0,0 +1,9 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Visual Studio Code";
}