1

reformat using alejandra

This commit is contained in:
2023-01-18 14:00:02 +01:00
parent 3ad68f24d6
commit eb44696de3
43 changed files with 1283 additions and 1095 deletions

View File

@ -1,17 +1,22 @@
# This is your home-manager configuration file
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
# The nixosConfig allows to access the toplevel system configuration from within home manager
# https://github.com/nix-community/home-manager/blob/586ac1fd58d2de10b926ce3d544b3179891e58cb/nixos/default.nix#L19
{ inputs, hostname, username, lib, mylib, config, nixosConfig, pkgs, ... }:
{
inputs,
hostname,
username,
lib,
mylib,
config,
nixosConfig,
pkgs,
...
}:
# This is a module
# Because no imports/options/config is defined explicitly, everything is treated as config
# { inputs, lib, ... }: { ... } gets turned into { inputs, lib, ... }: { config = { ... }; } implicitly
let
in rec {
rec {
# Every module is a nix expression, specifically a function { inputs, lib, ... }: { ... }
# Every module (/function) is called with the same arguments as this module (home.nix)
# Arguments with matching names are "plugged in" into the right slots,
@ -214,7 +219,7 @@ in rec {
ffmpeg_5-full # v5, including ffplay
imagemagick # Convert image (magic)
httpie # Cool http client
(ripgrep.override { withPCRE2 = true; }) # fast as fuck
(ripgrep.override {withPCRE2 = true;}) # fast as fuck
nvd # nix rebuild diff
# du-dust # Disk usage analyzer (for directories)
gdu # Alternative to du-dust (I like it better)
@ -241,6 +246,8 @@ in rec {
texlive.combined.scheme-full
pandoc # document converting madness
lm_sensors
alejandra # nix code formatter
nil # nix language server
# Xooooorg/Desktop environment stuff
xclip
@ -302,7 +309,6 @@ in rec {
# jetbrains.idea-ultimate
# jetbrains.clion
# TODO: LaTeX module
texlab
@ -342,6 +348,8 @@ in rec {
# Use NixCommunity binary cache
cachix
# tor-browser-bundle-bin
];
# Packages with extra options managed by HomeManager natively
@ -411,8 +419,8 @@ in rec {
enable = true;
enableFishIntegration = config.modules.fish.enable;
enableXsessionIntegration = true;
agents = [ "ssh" ];
keys = [ "id_ed25519" ];
agents = ["ssh"];
keys = ["id_ed25519"];
};
# Realtime Motion Interpolation: https://gist.github.com/phiresky/4bfcfbbd05b3c2ed8645
@ -421,10 +429,13 @@ in rec {
# NOTE: wrapMpv explained here: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/applications/video/mpv/wrapper.nix#L84
# wrapMpv gets two args: the mpv derivation and some options
# Possible overrides for derivation: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/applications/video/mpv/default.nix#L222
package = pkgs.wrapMpv (pkgs.mpv-unwrapped.override { vapoursynthSupport = true; }) {
package = pkgs.wrapMpv (pkgs.mpv-unwrapped.override {vapoursynthSupport = true;}) {
youtubeSupport = true;
extraMakeWrapperArgs = [
"--prefix" "LD_LIBRARY_PATH" ":" "${pkgs.vapoursynth-mvtools}/lib"
"--prefix"
"LD_LIBRARY_PATH"
":"
"${pkgs.vapoursynth-mvtools}/lib"
];
};
};

View File

@ -1,7 +1,15 @@
{ inputs, hostname, username, lib, mylib, config, nixosConfig, pkgs, ... }:
{
inputs,
hostname,
username,
lib,
mylib,
config,
nixosConfig,
pkgs,
...
}:
# Here goes the stuff that will only be enabled on the desktop
rec {
imports = [
../../modules
@ -21,8 +29,10 @@ rec {
yabridge.autoSync = true;
noisesuppression = {
noisetorch.enable = true;
noisetorch.autostart = true;
noisetorch.enable = false;
noisetorch.autostart = false;
easyeffects.enable = false;
easyeffects.autostart = false;
};
cardinal.enable = true;

View File

@ -1,7 +1,15 @@
{ inputs, hostname, username, lib, mylib, config, nixosConfig, pkgs, ... }:
{
inputs,
hostname,
username,
lib,
mylib,
config,
nixosConfig,
pkgs,
...
}:
# Here goes the stuff that will only be enabled on the laptop
rec {
imports = [
../../modules
@ -22,4 +30,4 @@ rec {
discordChromium.enable = true;
};
};
}
}

View File

@ -1,9 +1,13 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }:
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
let
with mylib.modules; let
cfg = config.modules.audio;
cfgfp = config.modules.flatpak;
in {
@ -64,35 +68,35 @@ in {
# 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 [
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
# 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
# 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 [helvum])
# Enable some default pipewire stuff if pipewire is enabled
(optionals nixosConfig.services.pipewire.enable [ helvum ])
(optionals cfg.carla.enable [carla gamemode])
(optionals cfg.bitwig.enable [
bitwig-studio
gamemode
])
(optionals cfg.tenacity.enable [tenacity])
(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.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 ])
];
# (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;
@ -107,7 +111,7 @@ in {
icon = "carla";
exec = "env PIPEWIRE_LATENCY=256/48000 gamemoderun carla ${config.home.homeDirectory}/.config/carla/GuitarDefault.carxp";
terminal = false;
categories = [ "Music" "Audio" ];
categories = ["Music" "Audio"];
};
xdg.desktopEntries.bitwig-low-latency = mkIf cfg.bitwig.enable {
@ -116,7 +120,7 @@ in {
icon = "bitwig-studio";
exec = "env PIPEWIRE_LATENCY=256/48000 gamemoderun bitwig-studio";
terminal = false;
categories = [ "Music" "Audio" ];
categories = ["Music" "Audio"];
};
# TODO: Disable only for plasma
@ -147,12 +151,14 @@ in {
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");
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");
unlinkCarlaConfig =
hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.config/carla");
})
# Replaced by distrho
@ -166,24 +172,30 @@ in {
# })
(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");
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");
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" ] ''
syncYabridge = hm.dag.entryAfter ["writeBoundary"] ''
yabridgectl sync
'';
})

View File

@ -1,6 +1,12 @@
{ inputs, config, nixosConfig, lib, pkgs, mylib, ... }:
{
inputs,
config,
nixosConfig,
lib,
pkgs,
mylib,
...
}: {
imports = [
./audio.nix
./emacs.nix

View File

@ -1,18 +1,20 @@
# https://nixos.org/manual/nixos/stable/index.html#sec-writing-modules
# This is a function with arguments
{ config, lib, mylib, pkgs, ... }:
{
config,
lib,
mylib,
pkgs,
...
}:
# We add stuff from lib to our namespace (mkOption...)
with lib;
with mylib.modules;
let
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 = [ ];
imports = [];
# Options is a vector of options this module defines
# This module defines only the "emacs" option and suboptions "enable" and "doom"
@ -56,39 +58,43 @@ in {
];
# 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 ])) ])
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: 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: 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
# 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: 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
# nixfmt # This belongs in specific flake.nix
# shellcheck # This belongs in specific flake.nix
texlive.combined.scheme-full
])
];
texlive.combined.scheme-full
])
];
home.sessionPath = mkIf cfg.doom.enable [ "${config.home.homeDirectory}/.emacs.d/bin" ];
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
@ -99,36 +105,36 @@ in {
# };
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" ] ''
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");
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");
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" ] ''
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" ] ''
upgradeDoomEmacs = hm.dag.entryAfter ["writeBoundary" "linkDoomConfig"] ''
${config.home.homeDirectory}/.emacs.d/bin/doom upgrade -!
'';
})

View File

@ -1,18 +1,19 @@
# Example: https://beb.ninja/post/email/
# Example: https://sbr.pm/configurations/mails.html
# NOTE: The passwords must exist in kwallet
# TODO: Emacs mail config
{ config, nixosConfig, lib, mylib, pkgs, ... }:
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
let
with mylib.modules; let
cfg = config.modules.email;
in {
options.modules.email = {
enable = mkEnableOpt "Email";
autosync = mkEnableOpt "Automatically call \"notmuch new\" via systemd timer";
@ -26,9 +27,10 @@ in {
# TODO: Add Maildir to nextcloud sync
config = mkIf cfg.enable {
home.packages = with pkgs; builtins.concatLists [
(optionals cfg.kmail.enable [ kmail ])
];
home.packages = with pkgs;
builtins.concatLists [
(optionals cfg.kmail.enable [kmail])
];
home.file = mkMerge [
(optionalAttrs (cfg.kmail.enable && cfg.kmail.autostart) {
@ -54,7 +56,7 @@ in {
# Autosync, don't need imapnotify when enabled
systemd.user.services.mail-autosync = (mkIf cfg.autosync) {
Unit = { Description = "Automatic notmuch/mbsync synchronization"; };
Unit = {Description = "Automatic notmuch/mbsync synchronization";};
Service = {
Type = "oneshot";
# ExecStart = "${pkgs.isync}/bin/mbsync -a";
@ -62,12 +64,12 @@ in {
};
};
systemd.user.timers.mail-autosync = (mkIf cfg.autosync) {
Unit = { Description = "Automatic notmuch/mbsync synchronization"; };
Unit = {Description = "Automatic notmuch/mbsync synchronization";};
Timer = {
OnBootSec = "30";
OnUnitActiveSec = "5m";
};
Install = { WantedBy = [ "timers.target" ]; };
Install = {WantedBy = ["timers.target"];};
};
accounts.email.accounts = {
@ -84,14 +86,15 @@ in {
passwordCommand = "kwallet-query -f email -r urpost kdewallet";
mbsync = { # Imap
mbsync = {
# Imap
enable = true;
create = "maildir";
};
msmtp.enable = true; # Smtp
notmuch.enable = true;
imapnotify.enable = cfg.imapnotify;
imapnotify.onNotify = {
imapnotify.onNotify = {
mail = "${pkgs.notmuch}/bin/notmuch new && ${pkgs.libnotify}/bin/notify-send 'New mail arrived on Urpost'";
};
@ -111,14 +114,15 @@ in {
passwordCommand = "kwallet-query -f email -r hhu kdewallet";
mbsync = { # Imap
mbsync = {
# Imap
enable = true;
create = "maildir";
};
msmtp.enable = true; # Smtp
notmuch.enable = true;
imapnotify.enable = cfg.imapnotify;
imapnotify.onNotify = {
imapnotify.onNotify = {
mail = "${pkgs.notmuch}/bin/notmuch new && ${pkgs.libnotify}/bin/notify-send 'New mail arrived on HHU'";
};
@ -137,7 +141,8 @@ in {
# NOTE: Uses Gmail app password
passwordCommand = "kwallet-query -f email -r gmail kdewallet";
mbsync = { # Imap
mbsync = {
# Imap
enable = true;
create = "maildir";
patterns = ["*" "![Gmail]*" "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail"]; # Only sync inbox
@ -145,7 +150,7 @@ in {
msmtp.enable = true; # Smtp
notmuch.enable = true;
imapnotify.enable = cfg.imapnotify;
imapnotify.onNotify = {
imapnotify.onNotify = {
mail = "${pkgs.notmuch}/bin/notmuch new && ${pkgs.libnotify}/bin/notify-send 'New mail arrived on GMail'";
};

View File

@ -1,14 +1,17 @@
# TODO: https://github.com/nix-community/home-manager/commit/69d19b9839638fc487b370e0600a03577a559081
{ inputs, config, nixosConfig, lib, mylib, pkgs, ... }:
{
inputs,
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
let
with mylib.modules; let
cfg = config.modules.firefox;
in {
options.modules.firefox = {
enable = mkEnableOpt "Firefox";
wayland = mkBoolOpt false "Enable firefox wayland support";
@ -19,16 +22,17 @@ in {
};
config = mkIf cfg.enable {
home.packages = with pkgs; builtins.concatLists [
# TODO: I don't think vaapi works yet
(optionals cfg.vaapi [
# NOTE: I put these into hardware.opengl.extrapackages, don't know if they belong there...
# libva
# libvdpau
])
home.packages = with pkgs;
builtins.concatLists [
# TODO: I don't think vaapi works yet
(optionals cfg.vaapi [
# NOTE: I put these into hardware.opengl.extrapackages, don't know if they belong there...
# libva
# libvdpau
])
(optionals cfg.gnomeTheme [ firefox-gnome-theme ])
];
(optionals cfg.gnomeTheme [firefox-gnome-theme])
];
home.sessionVariables = mkMerge [
{
@ -52,7 +56,7 @@ in {
icon = "firefox";
exec = "firefox --private-window %U";
terminal = false;
categories = [ "Network" "WebBrowser" ];
categories = ["Network" "WebBrowser"];
};
programs.firefox = {
@ -72,7 +76,7 @@ in {
# not strictly necessary
extraPolicies = {
# TODO: Make library function to allow easy bookmark creation and add my default bookmarks/folders
Bookmarks = (optionalAttrs cfg.defaultBookmarks { });
Bookmarks = optionalAttrs cfg.defaultBookmarks {};
CaptivePortal = false;
DisableFirefoxAccounts = true;
DisableFirefoxStudies = true;

View File

@ -1,12 +1,15 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }:
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
let
with mylib.modules; let
cfg = config.modules.fish;
in {
options.modules.fish = {
enable = mkEnableOpt "Fish";
};
@ -31,87 +34,88 @@ in {
hasHomePackage = package: (contains config.home.packages package);
# Only add fish abbr if package is installed
abbrify = package: abbr: (optionalAttrs (hasHomePackage package) abbr);
in mkMerge [
# Default abbrs, always available
{
# Shell basic
c = "clear";
q = "exit";
in
mkMerge [
# Default abbrs, always available
{
# Shell basic
c = "clear";
q = "exit";
# Fish
h = batifyWithArgs "history" "-l fish"; # -l fish sets syntax highlighting to fish
listabbrs = batifyWithArgs "abbr" "-l fish";
# Fish
h = batifyWithArgs "history" "-l fish"; # -l fish sets syntax highlighting to fish
listabbrs = batifyWithArgs "abbr" "-l fish";
# tools
cd = "z"; # zoxide for quickjump to previously visited locations
mkdir = "mkdir -p"; # also create parents (-p)
blk = batify "lsblk -o NAME,LABEL,UUID,FSTYPE,SIZE,FSUSE%,MOUNTPOINT,MODEL";
grep = "grep --color=auto -E"; # grep with extended regex
watch = "watch -d -c -n -0.5";
# tools
cd = "z"; # zoxide for quickjump to previously visited locations
mkdir = "mkdir -p"; # also create parents (-p)
blk = batify "lsblk -o NAME,LABEL,UUID,FSTYPE,SIZE,FSUSE%,MOUNTPOINT,MODEL";
grep = "grep --color=auto -E"; # grep with extended regex
watch = "watch -d -c -n -0.5";
# systemd
failed = "systemctl --failed";
errors = "journalctl -p 3 -xb";
kernelerrors = "journalctl -p 3 -xb -k";
uniterrors = "journalctl -xb --unit=";
useruniterrors = "journalctl -xb --user-unit=";
# systemd
failed = "systemctl --failed";
errors = "journalctl -p 3 -xb";
kernelerrors = "journalctl -p 3 -xb -k";
uniterrors = "journalctl -xb --unit=";
useruniterrors = "journalctl -xb --user-unit=";
# ssh locations
xxhamster = "TERM=ansi ssh christoph@217.160.142.51";
}
# ssh locations
xxhamster = "TERM=ansi ssh christoph@217.160.142.51";
}
# Abbrs only available if package is installed
(abbrify pkgs.btop { top = "btop"; })
(abbrify pkgs.duf {
df = "duf";
disksummary = "duf";
})
(abbrify pkgs.exa {
ls = "exa --color always --group-directories-first -F --git --icons"; # color-ls
lsl = "exa --color always --group-directories-first -F -l --git --icons";
lsa = "exa --color always --group-directories-first -F -l -a --git --icons";
tre = "exa --color always --group-directories-first -F -T -L 2 ---icons";
})
(abbrify pkgs.fd { find = "fd"; })
(abbrify pkgs.fzf { fuzzy = "fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'"; })
(abbrify pkgs.gdu {
du = "gdu";
storageanalysis = "gdu";
})
(abbrify pkgs.git {
gs = "git status";
gcm = "git commit -m";
ga = "git add";
glg = "git log --graph --decorate --oneline";
gcl = "git clone";
})
(abbrify pkgs.gping { ping = "gping"; })
(abbrify pkgs.lazygit { lg = "lazygit"; })
(abbrify pkgs.navi { n = "navi"; })
(abbrify pkgs.notmuch {
mailrefresh = "notmuch new";
mailsearch = "notmuch search";
})
(abbrify pkgs.protonvpn-cli {
vpnat = "protonvpn-cli c --cc at";
vpnch = "protonvpn-cli c --cc ch";
vpnlu = "protonvpn-cli c --cc lu";
vpnus = "protonvpn-cli c --cc us";
vpnhk = "protonvpn-cli c --cc hk";
vpnkr = "protonvpn-cli c --cc kr";
vpnoff = "protonvpn-cli d";
})
(abbrify pkgs.ranger { r = "ranger --choosedir=$HOME/.rangerdir; set LASTDIR (cat $HOME/.rangerdir); cd $LASTDIR"; })
(abbrify pkgs.rsync {
cp = "rsync -ahv --inplace --partial --info=progress2";
rsync = "rsync -ahv --inplace --partial --info=progress2";
})
(abbrify pkgs.sd { sed = "sd"; })
(abbrify pkgs.yt-dlp {
mp4 = "yt-dlp -f 'bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b' --recode-video mp4"; # the -f options are yt-dlp defaults
mp3 = "yt-dlp -f 'ba' --extract-audio --audio-format mp3";
})
];
# Abbrs only available if package is installed
(abbrify pkgs.btop {top = "btop";})
(abbrify pkgs.duf {
df = "duf";
disksummary = "duf";
})
(abbrify pkgs.exa {
ls = "exa --color always --group-directories-first -F --git --icons"; # color-ls
lsl = "exa --color always --group-directories-first -F -l --git --icons";
lsa = "exa --color always --group-directories-first -F -l -a --git --icons";
tre = "exa --color always --group-directories-first -F -T -L 2 ---icons";
})
(abbrify pkgs.fd {find = "fd";})
(abbrify pkgs.fzf {fuzzy = "fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'";})
(abbrify pkgs.gdu {
du = "gdu";
storageanalysis = "gdu";
})
(abbrify pkgs.git {
gs = "git status";
gcm = "git commit -m";
ga = "git add";
glg = "git log --graph --decorate --oneline";
gcl = "git clone";
})
(abbrify pkgs.gping {ping = "gping";})
(abbrify pkgs.lazygit {lg = "lazygit";})
(abbrify pkgs.navi {n = "navi";})
(abbrify pkgs.notmuch {
mailrefresh = "notmuch new";
mailsearch = "notmuch search";
})
(abbrify pkgs.protonvpn-cli {
vpnat = "protonvpn-cli c --cc at";
vpnch = "protonvpn-cli c --cc ch";
vpnlu = "protonvpn-cli c --cc lu";
vpnus = "protonvpn-cli c --cc us";
vpnhk = "protonvpn-cli c --cc hk";
vpnkr = "protonvpn-cli c --cc kr";
vpnoff = "protonvpn-cli d";
})
(abbrify pkgs.ranger {r = "ranger --choosedir=$HOME/.rangerdir; set LASTDIR (cat $HOME/.rangerdir); cd $LASTDIR";})
(abbrify pkgs.rsync {
cp = "rsync -ahv --inplace --partial --info=progress2";
rsync = "rsync -ahv --inplace --partial --info=progress2";
})
(abbrify pkgs.sd {sed = "sd";})
(abbrify pkgs.yt-dlp {
mp4 = "yt-dlp -f 'bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b' --recode-video mp4"; # the -f options are yt-dlp defaults
mp3 = "yt-dlp -f 'ba' --extract-audio --audio-format mp3";
})
];
shellInit = ''
set -e fish_greeting

View File

@ -1,191 +1,199 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }:
{
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 = {
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";
let
cfg = config.modules.flatpak;
in {
options.modules.flatpak = {
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";
# 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";
# 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 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";
};
};
# 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";
};
};
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"
config = mkIf cfg.enable {
assertions = [
{
assertion = nixosConfig.services.flatpak.enable;
message = "Cannot use the flatpak module with flatpak disabled in nixos!";
}
];
global_overrides = builtins.concatLists [ global_default_overrides cfg.extraGlobalOverride ];
# 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"
# ];
str_global_overrides = builtins.concatStringsSep ";" global_overrides;
in mkMerge ([
{
".local/share/flatpak/overrides/global".text = "[Context]\nfilesystems=${str_global_overrides}";
}
] ++ extra_overrides);
# 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}";});
home.activation = mkMerge [
# 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");
})
(mkElse cfg.fontFix {
unlinkFontDir = lib.hm.dag.entryAfter [ "writeBoundary" ]
(mkUnlink "${config.home.homeDirectory}/.local/share/fonts");
})
# This is a list of sets: [ { "<filename>" = "<overrides>"; } { "<filename>" = "<overrides>"; } ]
extra_overrides = map (set: concat_override (attrName set) (attrValue set)) cfg.extraOverride;
# 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");
})
# Global overrides
# 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" ])
cfg.extraInstall
];
global_default_overrides = [
"/nix/store:ro"
to_install_str = builtins.concatStringsSep " " to_install;
in
# 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 [
# 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");
})
(mkElse cfg.fontFix {
unlinkFontDir =
lib.hm.dag.entryAfter ["writeBoundary"]
(mkUnlink "${config.home.homeDirectory}/.local/share/fonts");
})
# 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"])
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"])
# 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)
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
sudo flatpak install -y ${to_install_str} &
updateFlatpak = lib.hm.dag.entryAfter ["writeBoundary"] ''
sudo flatpak update -y &
'';
}
})
{
# 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" ])
# 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"
# 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
'';
}
(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

@ -1,9 +1,12 @@
{ config, lib, mylib, pkgs, ... }:
{
config,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
let
with mylib.modules; let
cfg = config.modules.gaming;
cfgfp = config.modules.flatpak;
in {
@ -50,26 +53,27 @@ in {
})
];
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?
]
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 ])
# 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 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 ])
# 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.dwarffortress.enable [dwarf-fortress-packages.dwarf-fortress-full])
];
# 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
@ -84,7 +88,7 @@ in {
# ];
home.activation = mkMerge [
(optionalAttrs cfg.steam.adwaita {
copySteamAdwaitaSkin = hm.dag.entryAfter [ "writeBoundary" ] ''
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
@ -100,7 +104,7 @@ in {
})
(optionalAttrs (! cfg.steam.adwaita) {
deleteSteamAdwaitaSkin = hm.dag.entryAfter [ "writeBoundary" ] ''
deleteSteamAdwaitaSkin = hm.dag.entryAfter ["writeBoundary"] ''
rm -rf ${config.home.homeDirectory}/.var/app/com.valvesoftware.Steam/.local/share/Steam/skins/Adwaita
'';
})
@ -112,7 +116,7 @@ in {
icon = "discord";
exec = "chromium --new-window discord.com/app";
terminal = false;
categories = [ "Network" "Chat" ];
categories = ["Network" "Chat"];
};
# NOTE: Important to not disable this option if another module enables it
@ -152,8 +156,8 @@ in {
# "com.valvesoftware.Steam.CompatibilityTool.Proton-GE"
"net.davidotek.pupgui2"
])
(optionals (cfg.steam.enable && cfg.steam.gamescope) [ "com.valvesoftware.Steam.Utility.gamescope" ])
(optionals cfg.prism.enable [ "org.prismlauncher.PrismLauncher" ])
(optionals (cfg.steam.enable && cfg.steam.gamescope) ["com.valvesoftware.Steam.Utility.gamescope"])
(optionals cfg.prism.enable ["org.prismlauncher.PrismLauncher"])
];
modules.flatpak.extraRemove = builtins.concatLists [
@ -168,8 +172,8 @@ in {
# "com.valvesoftware.Steam.CompatibilityTool.Proton-GE"
"net.davidotek.pupgui2"
])
(optionals (!cfg.steam.enable || !cfg.steam.gamescope) [ "com.valvesoftware.Steam.Utility.gamescope" ])
(optionals (!cfg.prism.enable) [ "org.prismlauncher.PrismLauncher" ])
(optionals (!cfg.steam.enable || !cfg.steam.gamescope) ["com.valvesoftware.Steam.Utility.gamescope"])
(optionals (!cfg.prism.enable) ["org.prismlauncher.PrismLauncher"])
];
};
}

View File

@ -1,12 +1,15 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }:
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
let
with mylib.modules; let
cfg = config.modules.gnome;
in {
options.modules.gnome = {
enable = mkEnableOpt "Gnome Desktop";
# TODO: Add option for dash-to-dock
@ -40,7 +43,7 @@ in {
];
gtk = mkMerge [
{ enable = true; }
{enable = true;}
(optionalAttrs cfg.theme.papirusIcons {
iconTheme.package = pkgs.papirus-icon-theme;
@ -60,42 +63,43 @@ in {
})
];
home.packages = with pkgs; builtins.concatLists [
[
# gnome.gnome-session # Allow to start gnome from tty (sadly this is not usable, many things don't work)
gnome.gnome-boxes # VM
# gnome.sushi # Gnome files previews (use service, has to be added to dbus packages)
gnome.gnome-logs # systemd log viewer
gnome.gnome-tweaks # conflicts with nixos/hm gnome settings file sometimes, watch out what settings to change
gnome.gnome-nettool
gnome.simple-scan
gnome.gnome-sound-recorder
gnome.file-roller # archive manager
# gnome.dconf-editor
dconf-editor-wrapped # Sets XDG_DATA_DIRS to include all gsettings-schemas
gsettings-desktop-schemas
# gnome-usage # Alternative system performance monitor (gnome.gnome-system-monitor is the preinstalled one)
# gnome-secrets # Alternative keepass database viewer
gnome-firmware
]
home.packages = with pkgs;
builtins.concatLists [
[
# gnome.gnome-session # Allow to start gnome from tty (sadly this is not usable, many things don't work)
gnome.gnome-boxes # VM
# gnome.sushi # Gnome files previews (use service, has to be added to dbus packages)
gnome.gnome-logs # systemd log viewer
gnome.gnome-tweaks # conflicts with nixos/hm gnome settings file sometimes, watch out what settings to change
gnome.gnome-nettool
gnome.simple-scan
gnome.gnome-sound-recorder
gnome.file-roller # archive manager
# gnome.dconf-editor
dconf-editor-wrapped # Sets XDG_DATA_DIRS to include all gsettings-schemas
gsettings-desktop-schemas
# gnome-usage # Alternative system performance monitor (gnome.gnome-system-monitor is the preinstalled one)
# gnome-secrets # Alternative keepass database viewer
gnome-firmware
]
(optionals cfg.extensions [
gnomeExtensions.appindicator
gnomeExtensions.auto-activities
gnomeExtensions.blur-my-shell
gnomeExtensions.custom-hot-corners-extended
gnomeExtensions.extensions-sync
gnomeExtensions.gamemode
gnomeExtensions.launch-new-instance
gnomeExtensions.maximize-to-empty-workspace
gnomeExtensions.no-overview
gnomeExtensions.pip-on-top
gnomeExtensions.rounded-window-corners
gnomeExtensions.sound-output-device-chooser
gnomeExtensions.tweaks-in-system-menu
gnomeExtensions.vitals
])
];
(optionals cfg.extensions [
gnomeExtensions.appindicator
gnomeExtensions.auto-activities
gnomeExtensions.blur-my-shell
gnomeExtensions.custom-hot-corners-extended
gnomeExtensions.extensions-sync
gnomeExtensions.gamemode
gnomeExtensions.launch-new-instance
gnomeExtensions.maximize-to-empty-workspace
gnomeExtensions.no-overview
gnomeExtensions.pip-on-top
gnomeExtensions.rounded-window-corners
gnomeExtensions.sound-output-device-chooser
gnomeExtensions.tweaks-in-system-menu
gnomeExtensions.vitals
])
];
# TODO: Check what gnome-tweaks sets
dconf.settings = with lib.hm.gvariant; {
@ -216,7 +220,7 @@ in {
};
"org/gnome/nautilus/icon-view" = {
captions = [ "size" "date_modified" "none" ];
captions = ["size" "date_modified" "none"];
default-zoom-level = "larger";
};
@ -254,28 +258,29 @@ in {
"drive-menu@gnome-shell-extensions.gcampax.github.com"
"user-theme@gnome-shell-extensions.gcampax.github.com"
];
enabled-extensions = with pkgs; builtins.concatLists [
[
"workspace-indicator@gnome-shell-extensions.gcampax.github.com"
]
enabled-extensions = with pkgs;
builtins.concatLists [
[
"workspace-indicator@gnome-shell-extensions.gcampax.github.com"
]
(optionals cfg.extensions [
gnomeExtensions.appindicator.extensionUuid
gnomeExtensions.auto-activities.extensionUuid
gnomeExtensions.blur-my-shell.extensionUuid
gnomeExtensions.custom-hot-corners-extended.extensionUuid
gnomeExtensions.extensions-sync.extensionUuid
gnomeExtensions.gamemode.extensionUuid
gnomeExtensions.launch-new-instance.extensionUuid
gnomeExtensions.maximize-to-empty-workspace.extensionUuid
gnomeExtensions.no-overview.extensionUuid
gnomeExtensions.pip-on-top.extensionUuid
gnomeExtensions.rounded-window-corners.extensionUuid
gnomeExtensions.sound-output-device-chooser.extensionUuid
gnomeExtensions.tweaks-in-system-menu.extensionUuid
gnomeExtensions.vitals.extensionUuid
])
];
(optionals cfg.extensions [
gnomeExtensions.appindicator.extensionUuid
gnomeExtensions.auto-activities.extensionUuid
gnomeExtensions.blur-my-shell.extensionUuid
gnomeExtensions.custom-hot-corners-extended.extensionUuid
gnomeExtensions.extensions-sync.extensionUuid
gnomeExtensions.gamemode.extensionUuid
gnomeExtensions.launch-new-instance.extensionUuid
gnomeExtensions.maximize-to-empty-workspace.extensionUuid
gnomeExtensions.no-overview.extensionUuid
gnomeExtensions.pip-on-top.extensionUuid
gnomeExtensions.rounded-window-corners.extensionUuid
gnomeExtensions.sound-output-device-chooser.extensionUuid
gnomeExtensions.tweaks-in-system-menu.extensionUuid
gnomeExtensions.vitals.extensionUuid
])
];
};
"org/gnome/shell/app-switcher" = {
@ -310,7 +315,7 @@ in {
fixed-widths = true;
hide-icons = false;
hide-zeros = false;
hot-sensors = [ "__network-rx_max__" ];
hot-sensors = ["__network-rx_max__"];
position-in-panel = 2;
show-battery = false;
show-fan = false;

View File

@ -1,13 +1,16 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }:
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
let
with mylib.modules; let
cfg = config.modules.kitty;
# cfgnv = config.modules.neovim;
in {
options.modules.kitty = {
enable = mkEnableOpt "Kitty";
};
@ -30,7 +33,7 @@ in {
# Light Theme
# background = "#f7f7f7";
# foreground = "#494542";
# foreground = "#39FF14"; # Matrix green because I'm a master hacker
# selection_background = "#a4a1a1";
# selection_foreground = "#f7f7f7";
# cursor = "#494542";
@ -58,4 +61,4 @@ in {
};
};
};
}
}

View File

@ -1,9 +1,13 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }:
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
let
with mylib.modules; let
cfg = config.modules.misc;
in {
options.modules.misc = {
@ -21,11 +25,11 @@ in {
};
config = mkIf cfg.enable {
home.packages = with pkgs; builtins.concatLists [
(optionals cfg.keepass.enable [ keepassxc ])
(optionals cfg.protonmail.enable [ protonmail-bridge ])
];
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) {

View File

@ -1,12 +1,15 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }:
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
let
with mylib.modules; let
cfg = config.modules.neovim;
in {
options.modules.neovim = {
enable = mkEnableOpt "NeoVim";
alias = mkBoolOpt false "Link nvim to vim/vi";
@ -70,7 +73,7 @@ in {
}
{
plugin = (nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars));
plugin = nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars);
config = ''
lua << EOF
require('nvim-treesitter.configs').setup {

View File

@ -1,15 +1,16 @@
# 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: 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, ... }:
{
config,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
let
with mylib.modules; let
cfg = config.modules.nextcloud;
in {
options.modules.nextcloud = {
@ -24,9 +25,9 @@ in {
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 ];
home.packages = with pkgs; [nextcloud-client];
# TODO: Disable only for plasma
# systemd.user.services = (mkIf cfg.autostart) {

View File

@ -1,21 +1,20 @@
# TODO: KDE Connect config
# TODO: Plasma Configuration (https://github.com/pjones/plasma-manager)
{ config, lib, mylib, pkgs, ... }:
{
config,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
let
with mylib.modules; let
cfg = config.modules.plasma;
in {
options.modules.plasma = {
};
config = mkIf cfg.enable {
home.packages = with pkgs; [ ];
home.packages = with pkgs; [];
};
}

View File

@ -1,63 +1,79 @@
{ config, nixosConfig, lib, mylib, pkgs, ... }:
{
config,
nixosConfig,
lib,
mylib,
pkgs,
...
}:
with lib;
with mylib.modules;
let
with mylib.modules; let
cfg = config.modules.ranger;
in {
options.modules.ranger = {
enable = mkEnableOpt "Ranger";
preview = mkBoolOpt false "Enable Ranger image preview";
};
config = mkIf cfg.enable {
home.packages = with pkgs; lib.concatLists [
[
ranger
atool
p7zip
zip
unzip
unrar
libarchive
exiftool
mediainfo
]
home.packages = with pkgs;
lib.concatLists [
[
ranger
atool
p7zip
zip
unzip
unrar
libarchive
exiftool
mediainfo
]
(optionals cfg.preview [
# ueberzug # Only X11
python310Packages.pillow
ffmpegthumbnailer
imagemagick
poppler_utils
])
];
(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";
});
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;
in
settings_str;
}
(optionalAttrs cfg.preview {