trusted users + restructure folders
This commit is contained in:
195
home/modules/audio.nix
Normal file
195
home/modules/audio.nix
Normal file
@ -0,0 +1,195 @@
|
||||
{ config, nixosConfig, lib, mylib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with mylib.modules;
|
||||
|
||||
let
|
||||
cfg = config.modules.audio;
|
||||
cfgfp = config.modules.flatpak;
|
||||
in {
|
||||
imports = [
|
||||
./flatpak.nix
|
||||
];
|
||||
|
||||
options.modules.audio = {
|
||||
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)";
|
||||
# vital.enable = mkEnableOpt "Vital (Wavetable synthesizer)";
|
||||
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";
|
||||
};
|
||||
|
||||
easyeffects = {
|
||||
enable = mkEnableOpt "EasyEffects";
|
||||
autostart = mkBoolOpt false "Autoload EasyEffects suppression profile";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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 [ helvum ])
|
||||
|
||||
(optionals cfg.carla.enable [ carla gamemode ])
|
||||
(optionals cfg.bitwig.enable [
|
||||
# TODO: The override doesn't help, Bitwig pipewire still fails...
|
||||
# We need to force pipewire into the dependencies so bitwig can access libpipewire
|
||||
# This will probably get patched directly into nixpkgs in the future
|
||||
# NOTE: override overrides the function arguments (this part: { stdenv, fetchurl, ... })
|
||||
# while overrideAttrs overrides the stuff inside mkDerivation { ... }
|
||||
(bitwig-studio.overrideAttrs (oldAttrs: {
|
||||
buildInputs = oldAttrs.buildInputs ++ [ pipewire ];
|
||||
}))
|
||||
gamemode
|
||||
# bitwig-studio
|
||||
])
|
||||
(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 ])
|
||||
# (optionals cfg.vital.enable [ vital-synth ])
|
||||
(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: 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");
|
||||
})
|
||||
|
||||
# (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
|
||||
'';
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
18
home/modules/default.nix
Normal file
18
home/modules/default.nix
Normal file
@ -0,0 +1,18 @@
|
||||
{ config, nixosConfig, lib, pkgs, mylib, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./audio.nix
|
||||
./emacs.nix
|
||||
./firefox.nix
|
||||
./fish.nix
|
||||
./flatpak.nix
|
||||
./gaming.nix
|
||||
./gnome.nix
|
||||
./kitty.nix
|
||||
./misc.nix
|
||||
./neovim.nix
|
||||
./nextcloud.nix
|
||||
./ranger.nix
|
||||
];
|
||||
}
|
127
home/modules/emacs.nix
Normal file
127
home/modules/emacs.nix
Normal file
@ -0,0 +1,127 @@
|
||||
# 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 = {
|
||||
enable = mkEnableOpt "Emacs module";
|
||||
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";
|
||||
};
|
||||
};
|
||||
|
||||
# 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;
|
||||
message = "Can't enable both nativeComp and pgtkNativeComp!";
|
||||
})
|
||||
(mkIf cfg.pgtkNativeComp {
|
||||
assertion = !cfg.nativeComp;
|
||||
message = "Can't enable both nativeComp and pgtkNativeComp!";
|
||||
})
|
||||
];
|
||||
|
||||
# What home packages should be enabled
|
||||
home.packages = with pkgs; builtins.concatLists [
|
||||
(optionals cfg.nativeComp [ ((emacsPackagesFor emacsNativeComp).emacsWithPackages (epkgs: [ epkgs.vterm ])) ])
|
||||
(optionals cfg.pgtkNativeComp [ ((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages (epkgs: [ epkgs.vterm ])) ])
|
||||
|
||||
# TODO: Check what hlissner has enabled
|
||||
(optionals cfg.doom.enable [
|
||||
emacs-all-the-icons-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
|
||||
|
||||
# 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
|
||||
|
||||
# nixfmt # This belongs in specific flake.nix
|
||||
# shellcheck # This belongs in specific flake.nix
|
||||
|
||||
# TODO: Use LaTeX module instead
|
||||
texlive.combined.scheme-medium
|
||||
])
|
||||
];
|
||||
|
||||
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 -!
|
||||
'';
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
289
home/modules/firefox.nix
Normal file
289
home/modules/firefox.nix
Normal file
@ -0,0 +1,289 @@
|
||||
{ config, nixosConfig, lib, mylib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with mylib.modules;
|
||||
|
||||
let
|
||||
cfg = config.modules.firefox;
|
||||
in {
|
||||
|
||||
options.modules.firefox = {
|
||||
enable = mkEnableOpt "Firefox";
|
||||
wayland = mkBoolOpt false "Enable firefox wayland support";
|
||||
vaapi = mkBoolOpt false "Enable firefox vaapi support";
|
||||
disableTabBar = mkBoolOpt false "Disable the firefox tab bar (for TST)";
|
||||
defaultBookmarks = mkBoolOpt false "Preset standard bookmarks and folders";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; builtins.concatLists [
|
||||
# TODO: I don't think vaapi works yet
|
||||
(optionals cfg.vaapi [
|
||||
libva
|
||||
libva-utils
|
||||
nvidia-vaapi-driver
|
||||
vulkan-tools
|
||||
])
|
||||
];
|
||||
|
||||
home.sessionVariables = mkMerge [
|
||||
{
|
||||
MOZ_USE_XINPUT2 = 1;
|
||||
}
|
||||
|
||||
(optionalAttrs cfg.wayland {
|
||||
MOZ_ENABLE_WAYLAND = 1;
|
||||
EGL_PLATFORM = "wayland";
|
||||
})
|
||||
|
||||
(optionalAttrs cfg.vaapi {
|
||||
LIBVA_DRIVER_NAME = "nvidia";
|
||||
MOZ_DISABLE_RDD_SANDBOX = 1;
|
||||
})
|
||||
];
|
||||
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
|
||||
# firefox-unwrapped is the pure firefox browser, wrapFirefox adds configuration ontop
|
||||
package = pkgs.wrapFirefox pkgs.firefox-unwrapped {
|
||||
forceWayland = cfg.wayland;
|
||||
|
||||
# About policies:
|
||||
# https://github.com/mozilla/policy-templates#enterprisepoliciesenabled
|
||||
extraPolicies = {
|
||||
# TODO: Make library function to allow easy bookmark creation and add my default bookmarks/folders
|
||||
Bookmarks = (optionalAttrs cfg.defaultBookmarks { });
|
||||
CaptivePortal = false;
|
||||
DisableFirefoxAccounts = true;
|
||||
DisableFirefoxStudies = true;
|
||||
DisablePocket = true;
|
||||
DisableTelemetry = true;
|
||||
DisplayBookmarksToolbar = true;
|
||||
FirefoxHome = {
|
||||
Pocket = false;
|
||||
Snippets = false;
|
||||
};
|
||||
HardwareAcceleration = true;
|
||||
NoDefaultBookmarks = true;
|
||||
OfferToSaveLogins = false;
|
||||
PictureInPicture = true;
|
||||
UserMessaging = {
|
||||
ExtensionRecommendations = false;
|
||||
SkipOnboarding = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
|
||||
augmented-steam
|
||||
betterttv
|
||||
bypass-paywalls-clean
|
||||
clearurls
|
||||
cookie-autodelete
|
||||
don-t-fuck-with-paste
|
||||
h264ify
|
||||
keepassxc-browser
|
||||
localcdn
|
||||
privacy-badger
|
||||
search-by-image
|
||||
single-file
|
||||
skip-redirect
|
||||
sponsorblock
|
||||
tab-session-manager
|
||||
to-deepl
|
||||
transparent-standalone-image
|
||||
tree-style-tab
|
||||
ublacklist
|
||||
ublock-origin
|
||||
# umatrix # Many pages need manual intervention
|
||||
unpaywall
|
||||
view-image
|
||||
vimium
|
||||
];
|
||||
|
||||
profiles = {
|
||||
default = {
|
||||
id = 0; # 0 is default profile
|
||||
|
||||
userChrome = concatStringsSep "\n" [
|
||||
(optionalString cfg.disableTabBar ''
|
||||
#TabsToolbar {
|
||||
display: none;
|
||||
}
|
||||
'')
|
||||
];
|
||||
|
||||
settings = mkMerge [
|
||||
(optionalAttrs cfg.vaapi {
|
||||
# Firefox wayland hardware video acceleration
|
||||
# https://github.com/elFarto/nvidia-vaapi-driver/#firefox=
|
||||
"media.ffmpeg.vaapi.enabled" = true;
|
||||
"widget.wayland-dmabuf-vaapi.enabled" = true;
|
||||
"widget.dmabuf.force-enabled" = true;
|
||||
"gfx.webrender.enabled" = true; # Should be set on gnome anyway
|
||||
"media.rdd-ffmpeg.enabled" = true;
|
||||
"media.av1.enabled" = false;
|
||||
"gfx.x11-egl.force-enabled" = true;
|
||||
})
|
||||
|
||||
{
|
||||
"app.update.auto" = false;
|
||||
# "browser.startup.homepage" = "https://lobste.rs";
|
||||
"identity.fxaccounts.account.device.name" = nixosConfig.networking.hostName;
|
||||
|
||||
# Enable ETP for decent security (makes firefox containers and many
|
||||
# common security/privacy add-ons redundant).
|
||||
"browser.contentblocking.category" = "standard";
|
||||
"privacy.donottrackheader.enabled" = true;
|
||||
"privacy.donottrackheader.value" = 1;
|
||||
"privacy.purge_trackers.enabled" = true;
|
||||
# Your customized toolbar settings are stored in
|
||||
# 'browser.uiCustomization.state'. This tells firefox to sync it between
|
||||
# machines. WARNING: This may not work across OSes. Since I use NixOS on
|
||||
# all the machines I use Firefox on, this is no concern to me.
|
||||
# "services.sync.prefs.sync.browser.uiCustomization.state" = true;
|
||||
# Enable userContent.css and userChrome.css for our theme modules
|
||||
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
|
||||
# Don't use the built-in password manager. A nixos user is more likely
|
||||
# using an external one (you are using one, right?).
|
||||
"signon.rememberSignons" = false;
|
||||
# Do not check if Firefox is the default browser
|
||||
"browser.shell.checkDefaultBrowser" = false;
|
||||
# Disable the "new tab page" feature and show a blank tab instead
|
||||
# https://wiki.mozilla.org/Privacy/Reviews/New_Tab
|
||||
# https://support.mozilla.org/en-US/kb/new-tab-page-show-hide-and-customize-top-sites#w_how-do-i-turn-the-new-tab-page-off
|
||||
"browser.newtabpage.enabled" = false;
|
||||
"browser.newtab.url" = "about:blank";
|
||||
# Disable Activity Stream
|
||||
# https://wiki.mozilla.org/Firefox/Activity_Stream
|
||||
"browser.newtabpage.activity-stream.enabled" = false;
|
||||
"browser.newtabpage.activity-stream.telemetry" = false;
|
||||
# Disable new tab tile ads & preload
|
||||
# http://www.thewindowsclub.com/disable-remove-ad-tiles-from-firefox
|
||||
# http://forums.mozillazine.org/viewtopic.php?p=13876331#p13876331
|
||||
# https://wiki.mozilla.org/Tiles/Technical_Documentation#Ping
|
||||
# https://gecko.readthedocs.org/en/latest/browser/browser/DirectoryLinksProvider.html#browser-newtabpage-directory-source
|
||||
# https://gecko.readthedocs.org/en/latest/browser/browser/DirectoryLinksProvider.html#browser-newtabpage-directory-ping
|
||||
"browser.newtabpage.enhanced" = false;
|
||||
"browser.newtabpage.introShown" = true;
|
||||
"browser.newtab.preload" = false;
|
||||
"browser.newtabpage.directory.ping" = "";
|
||||
"browser.newtabpage.directory.source" = "data:text/plain,{}";
|
||||
# Reduce search engine noise in the urlbar's completion window. The
|
||||
# shortcuts and suggestions will still work, but Firefox won't clutter
|
||||
# its UI with reminders that they exist.
|
||||
"browser.urlbar.suggest.searches" = true;
|
||||
"browser.urlbar.shortcuts.bookmarks" = false;
|
||||
"browser.urlbar.shortcuts.history" = true;
|
||||
"browser.urlbar.shortcuts.tabs" = false;
|
||||
"browser.urlbar.showSearchSuggestionsFirst" = false;
|
||||
"browser.urlbar.speculativeConnect.enabled" = false;
|
||||
# https://bugzilla.mozilla.org/1642623
|
||||
"browser.urlbar.dnsResolveSingleWordsAfterSearch" = 0;
|
||||
# https://blog.mozilla.org/data/2021/09/15/data-and-firefox-suggest/
|
||||
"browser.urlbar.suggest.quicksuggest.nonsponsored" = false;
|
||||
"browser.urlbar.suggest.quicksuggest.sponsored" = false;
|
||||
# Show whole URL in address bar
|
||||
"browser.urlbar.trimURLs" = false;
|
||||
# Disable some not so useful functionality.
|
||||
"browser.disableResetPrompt" = true; # "Looks like you haven't started Firefox in a while."
|
||||
"browser.onboarding.enabled" = false; # "New to Firefox? Let's get started!" tour
|
||||
"browser.aboutConfig.showWarning" = false; # Warning when opening about:config
|
||||
"media.videocontrols.picture-in-picture.video-toggle.enabled" = true;
|
||||
"extensions.pocket.enabled" = false;
|
||||
"extensions.shield-recipe-client.enabled" = false;
|
||||
"reader.parse-on-load.enabled" = false; # "reader view"
|
||||
|
||||
# Security-oriented defaults
|
||||
"security.family_safety.mode" = 0;
|
||||
# https://blog.mozilla.org/security/2016/10/18/phasing-out-sha-1-on-the-public-web/
|
||||
"security.pki.sha1_enforcement_level" = 1;
|
||||
# https://github.com/tlswg/tls13-spec/issues/1001
|
||||
"security.tls.enable_0rtt_data" = false;
|
||||
# Use Mozilla geolocation service instead of Google if given permission
|
||||
"geo.provider.network.url" = "https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%";
|
||||
"geo.provider.use_gpsd" = false;
|
||||
# https://support.mozilla.org/en-US/kb/extension-recommendations
|
||||
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr" = false;
|
||||
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons" = false;
|
||||
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features" = false;
|
||||
"extensions.htmlaboutaddons.recommendations.enabled" = false;
|
||||
"extensions.htmlaboutaddons.discover.enabled" = false;
|
||||
"extensions.getAddons.showPane" = false; # uses Google Analytics
|
||||
"browser.discovery.enabled" = false;
|
||||
# Reduce File IO / SSD abuse
|
||||
# Otherwise, Firefox bombards the HD with writes. Not so nice for SSDs.
|
||||
# This forces it to write every 30 minutes, rather than 15 seconds.
|
||||
"browser.sessionstore.interval" = "1800000";
|
||||
# Disable battery API
|
||||
# https://developer.mozilla.org/en-US/docs/Web/API/BatteryManager
|
||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=1313580
|
||||
"dom.battery.enabled" = false;
|
||||
# Disable "beacon" asynchronous HTTP transfers (used for analytics)
|
||||
# https://developer.mozilla.org/en-US/docs/Web/API/navigator.sendBeacon
|
||||
"beacon.enabled" = false;
|
||||
# Disable pinging URIs specified in HTML <a> ping= attributes
|
||||
# http://kb.mozillazine.org/Browser.send_pings
|
||||
"browser.send_pings" = false;
|
||||
# Disable gamepad API to prevent USB device enumeration
|
||||
# https://www.w3.org/TR/gamepad/
|
||||
# https://trac.torproject.org/projects/tor/ticket/13023
|
||||
"dom.gamepad.enabled" = false;
|
||||
# Don't try to guess domain names when entering an invalid domain name in URL bar
|
||||
# http://www-archive.mozilla.org/docs/end-user/domain-guessing.html
|
||||
"browser.fixup.alternate.enabled" = false;
|
||||
# Disable telemetry
|
||||
# https://wiki.mozilla.org/Platform/Features/Telemetry
|
||||
# https://wiki.mozilla.org/Privacy/Reviews/Telemetry
|
||||
# https://wiki.mozilla.org/Telemetry
|
||||
# https://www.mozilla.org/en-US/legal/privacy/firefox.html#telemetry
|
||||
# https://support.mozilla.org/t5/Firefox-crashes/Mozilla-Crash-Reporter/ta-p/1715
|
||||
# https://wiki.mozilla.org/Security/Reviews/Firefox6/ReviewNotes/telemetry
|
||||
# https://gecko.readthedocs.io/en/latest/browser/experiments/experiments/manifest.html
|
||||
# https://wiki.mozilla.org/Telemetry/Experiments
|
||||
# https://support.mozilla.org/en-US/questions/1197144
|
||||
# https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/telemetry/internals/preferences.html#id1
|
||||
"toolkit.telemetry.unified" = false;
|
||||
"toolkit.telemetry.enabled" = false;
|
||||
"toolkit.telemetry.server" = "data:,";
|
||||
"toolkit.telemetry.archive.enabled" = false;
|
||||
"toolkit.telemetry.coverage.opt-out" = true;
|
||||
"toolkit.coverage.opt-out" = true;
|
||||
"toolkit.coverage.endpoint.base" = "";
|
||||
"experiments.supported" = false;
|
||||
"experiments.enabled" = false;
|
||||
"experiments.manifest.uri" = "";
|
||||
"browser.ping-centre.telemetry" = false;
|
||||
# https://mozilla.github.io/normandy/
|
||||
"app.normandy.enabled" = false;
|
||||
"app.normandy.api_url" = "";
|
||||
"app.shield.optoutstudies.enabled" = false;
|
||||
# Disable health reports (basically more telemetry)
|
||||
# https://support.mozilla.org/en-US/kb/firefox-health-report-understand-your-browser-perf
|
||||
# https://gecko.readthedocs.org/en/latest/toolkit/components/telemetry/telemetry/preferences.html
|
||||
"datareporting.healthreport.uploadEnabled" = false;
|
||||
"datareporting.healthreport.service.enabled" = false;
|
||||
"datareporting.policy.dataSubmissionEnabled" = false;
|
||||
"dom.security.https_only_mode" = true;
|
||||
|
||||
# Disable crash reports
|
||||
"breakpad.reportURL" = "";
|
||||
"browser.tabs.crashReporting.sendReport" = false;
|
||||
"browser.crashReports.unsubmittedCheck.autoSubmit2" = false; # don't submit backlogged reports
|
||||
|
||||
# Disable Form autofill
|
||||
# https://wiki.mozilla.org/Firefox/Features/Form_Autofill
|
||||
"browser.formfill.enable" = false;
|
||||
"extensions.formautofill.addresses.enabled" = false;
|
||||
"extensions.formautofill.available" = "off";
|
||||
"extensions.formautofill.creditCards.available" = false;
|
||||
"extensions.formautofill.creditCards.enabled" = false;
|
||||
"extensions.formautofill.heuristics.enabled" = false;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
116
home/modules/fish.nix
Normal file
116
home/modules/fish.nix
Normal file
@ -0,0 +1,116 @@
|
||||
{ config, nixosConfig, lib, mylib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with mylib.modules;
|
||||
|
||||
let
|
||||
cfg = config.modules.fish;
|
||||
in {
|
||||
|
||||
options.modules.fish = {
|
||||
enable = mkEnableOpt "Fish";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
# functions = {};
|
||||
# plugins = [];
|
||||
shellAbbrs = {
|
||||
c = "clear";
|
||||
q = "exit";
|
||||
h = "history | bat";
|
||||
r = "ranger --choosedir=$HOME/.rangerdir; set LASTDIR (cat $HOME/.rangerdir); cd $LASTDIR";
|
||||
|
||||
cd = "z";
|
||||
cp = "cp -i";
|
||||
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";
|
||||
mkd = "mkdir -p";
|
||||
|
||||
blk = "lsblk -o NAME,LABEL,UUID,FSTYPE,SIZE,FSUSE%,MOUNTPOINT,MODEL | bat";
|
||||
fsm = "df -h | bat";
|
||||
grp = "grep --color=auto -E";
|
||||
fzp = "fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'";
|
||||
fre = "free -m";
|
||||
wat = "watch -d -c -n -0.5";
|
||||
dus = "sudo dust -r";
|
||||
dsi = "sudo du -sch . | bat";
|
||||
prc = "procs -t";
|
||||
|
||||
lg = "lazygit";
|
||||
gs = "git status";
|
||||
gcm = "git commit -m";
|
||||
ga = "git add";
|
||||
glg = "git log --graph --decorate --oneline";
|
||||
gcl = "git clone";
|
||||
|
||||
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";
|
||||
|
||||
# This doesn't work at all, many things crash, no internet etc.
|
||||
# gnome = "dbus-run-session gnome-session"; # Requires XDG_SESSION_TYPE to be set for wayland
|
||||
|
||||
failed = "systemctl --failed";
|
||||
errors = "journalctl -p 3 -xb";
|
||||
|
||||
rsync = "rsync -chavzP --info=progress2";
|
||||
performance = "sudo cpupower frequency-set -g performance && nvidia-settings -a [gpu:0]/GPUPowerMizerMode=1";
|
||||
powersave = "sudo cpupower frequency-set -g powersave && nvidia-settings -a [gpu:0]/GPUPowerMizerMode=0";
|
||||
|
||||
xxhamster = "TERM=ansi ssh christoph@217.160.142.51";
|
||||
|
||||
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";
|
||||
};
|
||||
|
||||
shellAliases = {
|
||||
# ".." = "cd ..";
|
||||
"please" = "sudo !!";
|
||||
"yeet" = "rm -rf";
|
||||
};
|
||||
|
||||
shellInit = ''
|
||||
set -e fish_greeting
|
||||
'';
|
||||
};
|
||||
|
||||
# I put these programs here as they all have fish integration and are connected to the shell,
|
||||
# don't know if I will keep it that way
|
||||
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
|
||||
programs.keychain = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
enableXsessionIntegration = true;
|
||||
agents = [ "ssh" ];
|
||||
keys = [ "id_ed25519" ];
|
||||
};
|
||||
|
||||
programs.nix-index = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
|
||||
programs.zoxide = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
};
|
||||
}
|
178
home/modules/flatpak.nix
Normal file
178
home/modules/flatpak.nix
Normal file
@ -0,0 +1,178 @@
|
||||
{ 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
|
||||
|
||||
# TODO: Also need a library function to enable and concatenate different flatpak overrides (also global overrides)
|
||||
|
||||
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";
|
||||
|
||||
# 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";
|
||||
};
|
||||
};
|
||||
|
||||
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 filesystems overrides are applied
|
||||
home.file = mkMerge ([
|
||||
{
|
||||
".local/share/flatpak/overrides/global".text = let
|
||||
default_overrides = [
|
||||
# These are not necessary
|
||||
# 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"
|
||||
"/nix/store:ro"
|
||||
];
|
||||
|
||||
all_overrides = builtins.concatLists [ default_overrides cfg.extraGlobalOverride ];
|
||||
|
||||
str_overrides = builtins.concatStringsSep ";" all_overrides;
|
||||
in "[Context]\nfilesystems=${str_overrides}";
|
||||
}
|
||||
] ++ (map (set: let
|
||||
name = attrName set;
|
||||
value = attrValue set;
|
||||
in (optionalAttrs (name != null) { ".local/share/flatpak/overrides/${name}".text = "[Context]\nfilesystems=${value}"; }))
|
||||
cfg.extraOverride));
|
||||
|
||||
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)
|
||||
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
|
||||
'';
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
88
home/modules/gaming.nix
Normal file
88
home/modules/gaming.nix
Normal file
@ -0,0 +1,88 @@
|
||||
{ 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.nix
|
||||
];
|
||||
|
||||
options.modules.gaming = {
|
||||
enable = mkEnableOpt "Gaming module";
|
||||
|
||||
discordChromium.enable = mkEnableOpt "Discord (Chromium)";
|
||||
polymc.enable = mkEnableOpt "PolyMC (flatpak)";
|
||||
bottles.enable = mkEnableOpt "Bottles (flatpak)";
|
||||
|
||||
steam = {
|
||||
enable = mkEnableOpt "Steam (flatpak)";
|
||||
protonGE = mkBoolOpt false "Enable Steam Proton GloriousEggroll runner (flatpak)";
|
||||
gamescope = mkBoolOpt false "Enable the gamescope micro compositor (flatpak)";
|
||||
};
|
||||
};
|
||||
|
||||
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.polymc.enable {
|
||||
assertion = cfgfp.enable;
|
||||
message = "Cannot enable PolyMC 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)
|
||||
|
||||
# TODO: Extra config (extensions etc), maybe standalone chromium module
|
||||
(optionals cfg.discordChromium.enable [ chromium ])
|
||||
];
|
||||
|
||||
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" ];
|
||||
};
|
||||
|
||||
# NOTE: Important to not disable this option if another module enables it
|
||||
modules.flatpak.bottles.enable = mkIf cfg.bottles.enable true;
|
||||
|
||||
modules.flatpak.extraOverride = [
|
||||
(optionalAttrs cfg.bottles.enable {
|
||||
"com.usebottles.bottles" = "${config.home.homeDirectory}/.var/app/com.valvesoftware.Steam/data/Steam;${config.home.homeDirectory}/GameSSD;${config.home.homeDirectory}/GameHDD";
|
||||
})
|
||||
(optionalAttrs cfg.steam.enable {
|
||||
"com.valvesoftware.Steam" = "${config.home.homeDirectory}/GameSSD;${config.home.homeDirectory}/GameHDD";
|
||||
})
|
||||
];
|
||||
|
||||
modules.flatpak.extraInstall = builtins.concatLists [
|
||||
(optionals cfg.steam.enable [ "com.valvesoftware.Steam" ])
|
||||
(optionals (cfg.steam.enable && cfg.steam.protonGE) [ "com.valvesoftware.Steam.CompatibilityTool.Proton-GE" ])
|
||||
(optionals (cfg.steam.enable && cfg.steam.gamescope) [ "com.valvesoftware.Steam.Utility.gamescope" ])
|
||||
(optionals cfg.polymc.enable [ "org.polymc.PolyMC" ])
|
||||
];
|
||||
|
||||
modules.flatpak.extraRemove = builtins.concatLists [
|
||||
(optionals (!cfg.steam.enable) [ "com.valvesoftware.Steam" ])
|
||||
(optionals (!cfg.steam.enable || !cfg.steam.protonGE) [ "com.valvesoftware.Steam.CompatibilityTool.Proton-GE" ])
|
||||
(optionals (!cfg.steam.enable || !cfg.steam.gamescope) [ "com.valvesoftware.Steam.Utility.gamescope" ])
|
||||
(optionals (!cfg.polymc.enable) [ "org.polymc.PolyMC" ])
|
||||
];
|
||||
};
|
||||
}
|
92
home/modules/gnome.nix
Normal file
92
home/modules/gnome.nix
Normal file
@ -0,0 +1,92 @@
|
||||
{ config, nixosConfig, lib, mylib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with mylib.modules;
|
||||
|
||||
let
|
||||
cfg = config.modules.gnome;
|
||||
in {
|
||||
|
||||
options.modules.gnome = {
|
||||
enable = mkEnableOpt "Gnome Desktop";
|
||||
extensions = mkBoolOpt false "Enable Gnome shell-extensions";
|
||||
|
||||
# TODO: Add other themes, whitesur for example
|
||||
theme = {
|
||||
papirusIcons = mkBoolOpt false "Enable the Papirus icon theme";
|
||||
numixCursor = mkBoolOpt false "Enable the Numix cursor theme";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = nixosConfig.services.xserver.desktopManager.gnome.enable;
|
||||
message = "Can't enable Gnome module when Gnome is not enabled!";
|
||||
}
|
||||
];
|
||||
|
||||
gtk = mkMerge [
|
||||
{ enable = true; }
|
||||
|
||||
(optionalAttrs cfg.theme.papirusIcons {
|
||||
iconTheme.package = pkgs.papirus-icon-theme;
|
||||
iconTheme.name = "Papirus";
|
||||
})
|
||||
];
|
||||
|
||||
home.pointerCursor = mkMerge [
|
||||
{
|
||||
gtk.enable = true;
|
||||
x11.enable = true;
|
||||
}
|
||||
|
||||
(optionalAttrs cfg.theme.numixCursor {
|
||||
package = pkgs.numix-cursor-theme;
|
||||
name = "Numix-Cursor";
|
||||
})
|
||||
];
|
||||
|
||||
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
|
||||
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-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.blur-my-shell
|
||||
gnomeExtensions.sound-output-device-chooser
|
||||
gnomeExtensions.vitals
|
||||
gnomeExtensions.no-overview
|
||||
# gnomeExtensions.switch-workspace
|
||||
gnomeExtensions.maximize-to-empty-workspace
|
||||
gnomeExtensions.pip-on-top
|
||||
gnomeExtensions.custom-hot-corners-extended
|
||||
# gnomeExtensions.dock-from-dash
|
||||
gnomeExtensions.gamemode
|
||||
# gnomeExtensions.gsconnect # kde connect alternative
|
||||
# gnomeExtensions.quake-mode # dropdown for any application
|
||||
# gnomeExtensions.systemd-manager # to quickly start nextcloud
|
||||
gnomeExtensions.extensions-sync
|
||||
gnomeExtensions.tweaks-in-system-menu
|
||||
# gnomeExtensions.compiz-windows-effect # WobBlY wiNdoWS
|
||||
gnomeExtensions.panel-scroll
|
||||
gnomeExtensions.rounded-window-corners
|
||||
# gnomeExtensions.easyeffects-preset-selector # Throws error com.sth could not be found, dbus problem?
|
||||
gnomeExtensions.launch-new-instance
|
||||
gnomeExtensions.auto-activities
|
||||
])
|
||||
];
|
||||
};
|
||||
}
|
62
home/modules/kitty.nix
Normal file
62
home/modules/kitty.nix
Normal file
@ -0,0 +1,62 @@
|
||||
{ config, nixosConfig, lib, mylib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with mylib.modules;
|
||||
|
||||
let
|
||||
cfg = config.modules.kitty;
|
||||
cfgnv = config.modules.neovim;
|
||||
in {
|
||||
|
||||
options.modules.kitty = {
|
||||
enable = mkEnableOpt "Kitty";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# TODO: Copy config from Arch dots, also move the entire config folder (to allow ephemereal configs)
|
||||
# TODO: Light/Dark theme option
|
||||
programs.kitty = {
|
||||
enable = true;
|
||||
font = {
|
||||
package = pkgs.victor-mono;
|
||||
name = "Victor Mono SemiBold";
|
||||
size = 12;
|
||||
};
|
||||
|
||||
settings = {
|
||||
editor = (if cfgnv.enable then "nvim" else "nano");
|
||||
scrollback_lines = 10000;
|
||||
window_padding_width = 10;
|
||||
# hide_window_decorations = "yes";
|
||||
|
||||
# Light Theme
|
||||
# background = "#f7f7f7";
|
||||
# foreground = "#494542";
|
||||
# selection_background = "#a4a1a1";
|
||||
# selection_foreground = "#f7f7f7";
|
||||
# cursor = "#494542";
|
||||
# color0 = "#090200";
|
||||
# color1 = "#da2c20";
|
||||
# color2 = "#00a152";
|
||||
# color3 = "#ffcc00";
|
||||
# color4 = "#00a0e4";
|
||||
# color5 = "#a06994";
|
||||
# color6 = "#0077d9";
|
||||
# color7 = "#a4a1a1";
|
||||
# color8 = "#5b5754";
|
||||
# color9 = "#e8bacf";
|
||||
# color10 = "#3a3332";
|
||||
# color11 = "#494542";
|
||||
# color12 = "#7f7c7b";
|
||||
# color13 = "#d6d4d3";
|
||||
# color14 = "#ccab53";
|
||||
# color15 = "#d2b3ff";
|
||||
};
|
||||
|
||||
keybindings = {
|
||||
"kitty_mod+j" = "next_window";
|
||||
"kitty_mod+k" = "previous_window";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
45
home/modules/misc.nix
Normal file
45
home/modules/misc.nix
Normal file
@ -0,0 +1,45 @@
|
||||
{ config, nixosConfig, lib, mylib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with mylib.modules;
|
||||
|
||||
let
|
||||
cfg = config.modules.misc;
|
||||
in {
|
||||
options.modules.misc = {
|
||||
enable = mkEnableOpt "Misc module";
|
||||
|
||||
keepass = {
|
||||
enable = mkEnableOpt "KeePassXC";
|
||||
autostart = mkBoolOpt false "Autostart KeePassXC";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
home.packages = with pkgs; builtins.concatLists [
|
||||
(optionals cfg.keepass.enable [ keepassxc ])
|
||||
];
|
||||
|
||||
systemd.user.services = {
|
||||
autostart-keepass =
|
||||
(mkIf (cfg.keepass.enable && cfg.keepass.autostart) {
|
||||
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" ];
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
86
home/modules/neovim.nix
Normal file
86
home/modules/neovim.nix
Normal file
@ -0,0 +1,86 @@
|
||||
{ config, nixosConfig, lib, mylib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with mylib.modules;
|
||||
|
||||
let
|
||||
cfg = config.modules.neovim;
|
||||
in {
|
||||
|
||||
options.modules.neovim = {
|
||||
enable = mkEnableOpt "NeoVim";
|
||||
alias = mkBoolOpt "Link nvim to vim/vi";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
|
||||
extraConfig = ''
|
||||
set incsearch
|
||||
set hlsearch
|
||||
set ignorecase
|
||||
set autoindent
|
||||
set expandtab
|
||||
set smartindent
|
||||
set smarttab
|
||||
set shiftwidth=4
|
||||
set softtabstop=4
|
||||
set backspace=indent,eol,start
|
||||
set ruler
|
||||
set number
|
||||
set laststatus=2
|
||||
set noshowmode
|
||||
set undofile
|
||||
set undodir=~/.vim/undo
|
||||
set hidden
|
||||
set printfont=Victor\ Mono\ SemiBold:h10
|
||||
set guifont=Victor\ Mono\ SemiBold:h12
|
||||
let printencoding='utf-8'
|
||||
set encoding=utf-8
|
||||
'';
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
# vim-nix
|
||||
surround-nvim
|
||||
# lightline-vim
|
||||
{
|
||||
plugin = lualine-nvim;
|
||||
config = ''
|
||||
lua << EOF
|
||||
require('lualine').setup {}
|
||||
EOF
|
||||
'';
|
||||
}
|
||||
# vim-gitgutter
|
||||
# YouCompleteMe
|
||||
{
|
||||
|
||||
plugin = nvim-autopairs;
|
||||
config = ''
|
||||
lua << EOF
|
||||
require('nvim-autopairs').setup {}
|
||||
EOF
|
||||
'';
|
||||
}
|
||||
{
|
||||
plugin = (nvim-treesitter.withPlugins
|
||||
(plugins: pkgs.tree-sitter.allGrammars));
|
||||
config = ''
|
||||
lua << EOF
|
||||
require('nvim-treesitter.configs').setup {
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
||||
EOF
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
viAlias = cfg.alias;
|
||||
vimAlias = cfg.alias;
|
||||
};
|
||||
};
|
||||
}
|
47
home/modules/nextcloud.nix
Normal file
47
home/modules/nextcloud.nix
Normal file
@ -0,0 +1,47 @@
|
||||
# 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
|
||||
|
||||
{ config, lib, mylib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with mylib.modules;
|
||||
|
||||
let
|
||||
cfg = config.modules.nextcloud;
|
||||
in {
|
||||
options.modules.nextcloud = {
|
||||
enable = mkEnableOpt "Nextcloud Client";
|
||||
autostart = mkBoolOpt false "Autostart the Nextcloud client (systemd)";
|
||||
};
|
||||
|
||||
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 ];
|
||||
|
||||
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" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
31
home/modules/ranger.nix
Normal file
31
home/modules/ranger.nix
Normal file
@ -0,0 +1,31 @@
|
||||
{ config, nixosConfig, lib, mylib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with mylib.modules;
|
||||
|
||||
let
|
||||
cfg = config.modules.ranger;
|
||||
in {
|
||||
|
||||
options.modules.ranger = {
|
||||
enable = mkEnableOpt "Ranger";
|
||||
};
|
||||
|
||||
# TODO: Ranger configuration
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
ranger
|
||||
ueberzug
|
||||
ffmpegthumbnailer
|
||||
atool
|
||||
p7zip
|
||||
zip
|
||||
unzip
|
||||
unrar
|
||||
libarchive
|
||||
exiftool
|
||||
mediainfo
|
||||
];
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user