Removed old stuff(dont use NixOS on desktop anymore) + update

This commit is contained in:
Aleksandr Lebedev 2026-01-20 17:16:27 +01:00
parent 859ffa55e8
commit 53750afbe3
47 changed files with 22 additions and 18286 deletions

View file

@ -1,57 +0,0 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
osConfig,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.hardware.tablet;
osCfg = osConfig.${namespace}.hardware.tablet;
in {
options.${namespace}.hardware.tablet = with types; {
enable = mkBoolOpt osCfg.enable "Enable tablet module for hardware that supports it";
path = mkOpt path osCfg.path "Path with a file, where it's stated, whether tablet mode 'on' or 'off'";
onTabletModeEnable = mkOpt (listOf (attrsOf str)) [] "Actions to do when entering tablet mode. Should have name and command string attributes.";
onTabletModeDisable = mkOpt (listOf (attrsOf str)) [] "Actions to do when exiting tablet mode. Should have name and command string attributes.";
};
config = mkIf cfg.enable {
systemd.user.services.tablet-mode-watcher = {
Service = {
Type = "oneshot";
ExecStart = pkgs.writeShellScript "tablet-mode-watcher" ''
state=$(${pkgs.coreutils}/bin/cat "${cfg.path}" 2>/dev/null || echo 0)
if [ "$state" -eq 1 ]; then
echo "Tablet mode ON"
${concatStringsSep "\n" (map (cmd: ''
systemd-run --user --unit=tablet-on-${cmd.name} --collect sh -c '${cmd.command}'
'')
cfg.onTabletModeEnable)}
else
echo "Tablet mode OFF"
${concatStringsSep "\n" (map (cmd: ''
systemd-run --user --unit=tablet-off-${cmd.name} --collect sh -c '${cmd.command}'
'')
cfg.onTabletModeDisable)}
fi
'';
};
};
systemd.user.paths.tablet-mode-watcher = {
Unit.Description = "Watch for tablet mode changes";
Path.PathChanged = cfg.path;
Install.WantedBy = ["default.target"];
};
};
}

View file

@ -1,35 +0,0 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.hardware.asahi;
in {
options.${namespace}.hardware.asahi = with types; {
enable = mkBoolOpt false "Enable hardware support for Apple Silicon (M Chips)";
imports = [
inputs.apple-silicon-support.nixosModules.default
({pkgs, ...}: {
hardware.asahi = {
peripheralFirmwareDirectory = ./firmware;
useExperimentalGPUDriver = true; #deprecated
#experimentalGPUInstallMode = "overlay";
setupAsahiSound = true;
};
environment.systemPackages = with pkgs; [
mesa-asahi-edge
];
})
];
};
}

View file

@ -1,88 +0,0 @@
{
config,
namespace,
pkgs,
...
}: let
cfg = config.${namespace}.hardware.battery;
battery-path = "/sys/class/power_supply/${cfg.batteryName}";
get-battery-level = "${pkgs.writeShellScriptBin "get-battery-level" ''
cat ${battery-path}/capacity 2>/dev/null || echo "N/A"
''}/bin/get-battery-level";
get-status = "${pkgs.writeShellScriptBin "get-status" ''
cat ${battery-path}/status 2>/dev/null || echo "Unknown"
''}/bin/get-status";
get-icon = "${pkgs.writeShellScriptBin "get-icon" ''
BATTERY_LEVEL=$(${get-battery-level})
STATUS=$(${get-status})
if [[ "$BATTERY_LEVEL" == "N/A" ]]; then
ICON="󰂑 "
elif [[ "$STATUS" == "Charging" ]]; then
if [[ $BATTERY_LEVEL -ge 90 ]]; then
ICON="󰂋 "
elif [[ $BATTERY_LEVEL -ge 80 ]]; then
ICON="󰂊 "
elif [[ $BATTERY_LEVEL -ge 70 ]]; then
ICON="󰢞 "
elif [[ $BATTERY_LEVEL -ge 60 ]]; then
ICON="󰂉 "
elif [[ $BATTERY_LEVEL -ge 50 ]]; then
ICON="󰢝 "
elif [[ $BATTERY_LEVEL -ge 40 ]]; then
ICON="󰂈 "
elif [[ $BATTERY_LEVEL -ge 30 ]]; then
ICON="󰂇 "
elif [[ $BATTERY_LEVEL -ge 20 ]]; then
ICON="󰂆 "
elif [[ $BATTERY_LEVEL -ge 10 ]]; then
ICON="󰢜 "
else
ICON="󰢜 "
fi
else
if [[ $BATTERY_LEVEL -ge 90 ]]; then
ICON="󰂂 "
elif [[ $BATTERY_LEVEL -ge 70 ]]; then
ICON="󰂀 "
elif [[ $BATTERY_LEVEL -ge 50 ]]; then
ICON="󰁾 "
elif [[ $BATTERY_LEVEL -ge 30 ]]; then
ICON="󰁼 "
elif [[ $BATTERY_LEVEL -ge 10 ]]; then
ICON="󰁺 "
else
ICON="󰁺 "
fi
fi
echo "$ICON"
''}/bin/get-icon";
get-remaining-time = "${pkgs.writeShellScriptBin "get-remaining-time" ''
REMAINING_ENERGY=$(cat ${battery-path}/${cfg.remainingEnergy})
POWER_USAGE=$(cat ${battery-path}/${cfg.powerUsage})
if [[ -n "$REMAINING_ENERGY" && -n "$POWER_USAGE" && "$POWER_USAGE" -ne 0 ]]; then
TIME_LEFT=$(((REMAINING_ENERGY / POWER_USAGE)))
MINUTES_LEFT=$(((( (REMAINING_ENERGY * 60) / POWER_USAGE )) - (TIME_LEFT * 60)))
echo "$TIME_LEFT h $MINUTES_LEFT min"
else
echo ""
fi
''}/bin/get-remaining-time";
in {
${namespace}.hardware.battery.scripts = {
icon = get-icon;
status = get-status;
time = get-remaining-time;
level = get-battery-level;
labelAdaptive = "${pkgs.writeShellScriptBin "labelAdaptive" ''
if [[ "$(${get-status})" == "Charging" ]]; then
echo "$(${get-battery-level})% $(${get-icon})"
else
echo "$(${get-remaining-time}) $(${get-icon})"
fi
''}/bin/labelAdaptive";
labelPercent = "${pkgs.writeShellScriptBin "labelPercent" ''
echo "$(${get-battery-level})% $(${get-icon})"
''}/bin/labelPercent";
};
}

View file

@ -1,43 +0,0 @@
{
lib,
pkgs,
namespace,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.hardware.battery;
in {
options.${namespace}.hardware.battery = with types; {
enable = mkBoolOpt false "If you have a battery in your hardware, enable this";
batteryName = mkOpt str "BAT1" ''
Put your battery name here. You can find it at "/sys/class/power_supply/"
'';
remainingEnergy = mkOpt str "charge_now" ''
File in your battery, that tells the current amount of energy
'';
powerUsage = mkOpt str "current_now" ''
File in your battery, that tells, how much energy your hardware is using
'';
scripts = {
icon = mkOpt' str "";
status = mkOpt' str "";
time = mkOpt' str "";
level = mkOpt' str "";
labelAdaptive = mkOpt' str "";
labelPercent = mkOpt' str "";
};
};
config = mkIf cfg.enable (mkMerge [
(import ./batteryStatus.nix {
inherit config;
inherit namespace;
inherit pkgs;
})
{
services.upower.enable = true;
}
]);
}

View file

@ -1,88 +0,0 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.hardware.framework12;
in {
options.${namespace}.hardware.framework12 = with types; {
enable = mkBoolOpt false "Enable hardware support for framework 12. P.s. you still need to import inputs.nixos-hardware.nixosModules.framework-12-13th-gen-intel yourself";
};
config = mkIf cfg.enable {
${namespace}.hardware = {
tablet.enable = true;
battery = {
enable = true;
batteryName = "BAT1";
remainingEnergy = "charge_now";
powerUsage = "current_now";
};
};
# Ensure that the `pinctrl_tigerlake` kernel module is loaded before `soc_button_array`.
# This is required for correcly switching to tablet mode when the display is folded back.
boot.extraModprobeConfig = ''
softdep soc_button_array pre: pinctrl_tigerlake
'';
boot.initrd.kernelModules = ["pinctrl_tigerlake"];
# Patch the `udev` rules shipping with `iio-sensor-proxy` according to:
# https://github.com/FrameworkComputer/linux-docs/blob/main/framework12/Ubuntu-25-04-accel-ubuntu25.04.md
nixpkgs.overlays = [
(final: prev: {
iio-sensor-proxy = prev.iio-sensor-proxy.overrideAttrs (old: {
postInstall = ''
${old.postInstall or ""}
sed -i 's/.*iio-buffer-accel/#&/' $out/lib/udev/rules.d/80-iio-sensor-proxy.rules
'';
});
})
];
hardware.intel-gpu-tools.enable = true;
services.thermald.enable = true;
hardware.enableRedistributableFirmware = true;
environment.systemPackages = [
pkgs.framework-tool
(pkgs.writeShellScriptBin "reset-tablet" ''
sudo ${pkgs.framework-tool}/bin/framework_tool --tablet-mode tablet
sudo ${pkgs.framework-tool}/bin/framework_tool --tablet-mode auto
'')
];
security.sudo.extraRules = [
{
users = ["ALL"];
commands = [
{
command = "${pkgs.framework-tool}/bin/framework_tool";
options = ["NOPASSWD"];
}
];
}
];
services.xserver.videoDrivers = ["modesetting"];
hardware.graphics = {
enable = true;
extraPackages = with pkgs; [
# For modern Intel CPU's
intel-media-driver # Enable Hardware Acceleration
vpl-gpu-rt # Enable QSV
];
};
environment.sessionVariables = {LIBVA_DRIVER_NAME = "iHD";};
users.groups.touchscreen = {};
services.udev.extraRules = ''
KERNEL=="event*", ATTRS{name}=="ILIT2901:00 222A:5539", SYMLINK+="touchscreen", MODE="0660", GROUP="touchscreen"
'';
};
}

View file

@ -1,44 +0,0 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.hardware.hibernation;
in {
options.${namespace}.hardware.hibernation = with types; {
enable = mkBoolOpt false "Enable hibernation";
swapFileOffset = mkOpt (nullOr int) null "Offset of swapfile. Calculate offset using https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Acquire_swap_file_offset";
resumeDevice = mkOpt' path "/dev/disk/by-label/nixos";
};
config = mkIf cfg.enable {
boot = {
kernelParams =
[
"mem_sleep_default=deep"
]
#https://github.com/nix-community/disko/issues/651#issuecomment-2383741717
++ optional (cfg.swapFileOffset != null) "resume_offset=${builtins.toString cfg.swapFileOffset}";
resumeDevice = mkDefault cfg.resumeDevice;
};
services.logind.settings.Login = {
HandleLidSwitch = mkDefault "suspend-then-hibernate";
HandlePowerKey = mkDefault "suspend-then-hibernate";
HandlePowerKeyLongPress = mkDefault "poweroff";
};
systemd.sleep.extraConfig = ''
HibernateDelaySec=30m
SuspendState=mem
'';
};
}

View file

@ -1,70 +0,0 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.hardware.tablet;
in {
options.${namespace}.hardware.tablet = with types; {
enable = mkBoolOpt false "Enable tablet module for hardware that supports it";
path = mkOpt path "/run/tablet-mode-state" "Path with a file, where it's stated, whether tablet mode 'on' or 'off'";
inputDevice = mkOpt' str "/dev/input/event4";
onTabletModeEnable = mkOpt (listOf (attrsOf str)) [] "Actions to do when entering tablet mode";
onTabletModeDisable = mkOpt (listOf (attrsOf str)) [] "Actions to do when exiting tablet mode";
};
config = mkIf cfg.enable {
# 1. System service for watching
systemd.services = {
tablet-mode-watcher = {
description = "Watch for tablet mode changes";
serviceConfig = {
ExecStart = "${pkgs.writeShellScript "tablet-mode-eventd" ''
if [ -f "${cfg.path}" ]; then
in_tablet_mode=$(${pkgs.coreutils}/bin/cat "${cfg.path}")
else
echo 0 > "${cfg.path}"
in_tablet_mode=0
fi
stdbuf -oL -eL ${lib.getExe pkgs.libinput} debug-events --device "${cfg.inputDevice}" | while read -r line; do
if [[ "$line" =~ switch\ tablet-mode\ state\ ([01]) ]]; then
d="''${BASH_REMATCH[1]}"
if [ "$d" -ne "$in_tablet_mode" ]; then
in_tablet_mode=$d
if [ "$d" -eq 1 ]; then
${concatStringsSep "\n" (map (cmd: ''
systemd-run --unit=tablet-on-${cmd.name} --collect sh -c '${cmd.command}'
'')
cfg.onTabletModeEnable)}
echo "Tablet mode ON"
echo 1 > "${cfg.path}"
else
${concatStringsSep "\n" (map (cmd: ''
systemd-run --unit=tablet-off-${cmd.name} --collect sh -c '${cmd.command}'
'')
cfg.onTabletModeDisable)}
echo "Tablet mode OFF"
echo 0 > "${cfg.path}"
fi
fi
fi
done
''}";
Restart = "always";
};
wantedBy = ["graphical.target"];
};
};
};
}

View file

@ -1,46 +0,0 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.loginManagers.sddm;
in {
options.${namespace}.loginManagers.sddm = with types; {
enable = mkBoolOpt false "Enable sddm as login manager";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
(catppuccin-sddm.override {
flavor = "mocha";
# font = "";
fontSize = "16";
#background;
loginBackground = false;
})
wvkbd
];
services.xserver.enable = true;
services.displayManager.sddm = {
enable = true;
theme = "catppuccin-mocha";
package = mkDefault pkgs.kdePackages.sddm;
wayland.enable = mkDefault config.${namespace}.presets.wayland.enable;
settings = {
General = {
InputMethod = "wvkbd-mobintl"; # Enables optional virtual keyboard at login (SDDM). Useful for touchscreens or accessibility.
};
};
};
};
}

View file

@ -66,7 +66,6 @@ in {
git
btop
comma
snowfallorg.flake
];
programs.bash = {
shellAliases = {

View file

@ -1,61 +0,0 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.presets.gaming;
in {
options.${namespace}.presets.gaming = with types; {
enable = mkBoolOpt false "Enable everything that you need for gaming";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
unzip
wget
xdotool
xorg.xprop
xorg.xrandr
unixtools.xxd
xorg.xwininfo
yad
protonup-qt
protontricks
];
programs.steam = {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
package = pkgs.steam.override {
extraPkgs = pkgs:
with pkgs; [
xorg.libXcursor
xorg.libXi
xorg.libXinerama
xorg.libXScrnSaver
libpng
libpulseaudio
libvorbis
sdl3
SDL2
stdenv.cc.cc.lib
libkrb5
keyutils
gamescope
];
};
};
programs.gamemode.enable = true;
};
}

View file

@ -1,34 +0,0 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.presets.wayland;
in {
options.${namespace}.presets.wayland = with types; {
enable = mkBoolOpt false "Enable preset with MUST HAVE wayland things";
};
config = mkIf cfg.enable {
environment.sessionVariables = {
NIXOS_OZONE_WL = "1";
};
environment.systemPackages = with pkgs; [
wl-clipboard
git-credential-manager
egl-wayland
pwvucontrol
];
hardware.graphics.enable = true;
};
}

View file

@ -1,134 +0,0 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.presets.workstation;
in {
options.${namespace}.presets.workstation = with types; {
enable = mkBoolOpt false "Enable workstation preset";
};
config = mkIf cfg.enable {
${namespace} = {
presets.default = enabled;
presets.wayland = enabled;
hardware.printing = enabled;
hardware.bluetooth = enabled;
#programs.fastfetch = {
# enable = true;
# firstNixOSInstall = 1729112485;
#};
gpg = enabled;
services.syncthing = {
enable = true;
user = "kylekrein";
};
};
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
networking.networkmanager.enable = true;
services.udisks2.enable = true;
environment.systemPackages = with pkgs;
with pkgs.${namespace}; [
rnote
libreoffice
root-files
gparted
qdirstat
exfatprogs
tealdeer
telegram-desktop
vlc
git-credential-manager
qpwgraph
solaar
pdfarranger
densify
gimp3
krita
inkscape
cameractrls-gtk4
#kde
kdePackages.gwenview
kdePackages.ark
shotwell
deploy-rs
custom.deploy-rs-online
];
programs.kdeconnect.enable = true;
programs.kdeconnect.package = lib.mkDefault pkgs.kdePackages.kdeconnect-kde;
fonts.packages = with pkgs; [
nerd-fonts.jetbrains-mono
font-awesome
nerd-fonts.symbols-only
hack-font
noto-fonts-emoji
# microsoft fonts:
#corefonts
#vistafonts
];
environment.sessionVariables = {
MANPAGER = "emacsclient -c";
EDITOR = "emacsclient -c";
};
hardware = {
logitech.wireless.enable = true;
};
security.polkit.enable = true;
services.flatpak = enabled;
#programs.thunar = {
# enable = true;
# plugins = with pkgs.xfce; [
# thunar-archive-plugin
# thunar-volman
# ];
# };
#programs.xfconf.enable = true; # so thunar can save config
#services.gvfs.enable = true; # Mount, trash, and other functionalities
#services.tumbler.enable = true; # Thumbnail support for images
#greeter
programs.dankMaterialShell.greeter = {
enable = config.${namespace}.windowManagers.niri.enable || config.programs.hyprland.enable;
compositor.name =
if config.${namespace}.windowManagers.niri.enable
then "niri"
else "hyprland";
configHome = let
imp = config.${namespace}.impermanence;
in "${
if imp.enable
then imp.persistentStorage
else ""
}${config.users.users.kylekrein.home}";
};
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
};
}

View file

@ -1,70 +0,0 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.programs.dolphin;
in {
options.${namespace}.programs.dolphin = with types; {
enable = mkBoolOpt false "Enable dolphin on non Kde environments";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
kdePackages.qtwayland
kdePackages.qtsvg
kdePackages.kio-fuse #to mount remote filesystems via FUSE
kdePackages.kio-extras #extra protocols support (sftp, fish and more)
kdePackages.kio-admin
libheif #https://github.com/NixOS/nixpkgs/issues/164021
libheif.out
#kde
kdePackages.breeze-icons
kdePackages.breeze
kdePackages.kdesdk-thumbnailers
kdePackages.kdegraphics-thumbnailers
kdePackages.kservice
kdePackages.kdbusaddons
kdePackages.kfilemetadata
kdePackages.kconfig
kdePackages.kcoreaddons
kdePackages.kcrash
kdePackages.kguiaddons
kdePackages.ki18n
kdePackages.kitemviews
kdePackages.kwidgetsaddons
kdePackages.kwindowsystem
shared-mime-info
#kde support tools
#libsForQt5.qt5ct
#qt6ct
kdePackages.kimageformats
kdePackages.dolphin
kdePackages.dolphin-plugins
];
xdg = {
menus.enable = true;
mime.enable = true;
};
#https://discourse.nixos.org/t/dolphin-does-not-have-mime-associations/48985/3
# This fixes the unpopulated MIME menus
environment.etc."/xdg/menus/plasma-applications.menu".text = builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu";
environment.etc."/xdg/menus/applications.menu".text = builtins.readFile "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu";
#environment.pathsToLink = [
# "share/thumbnailers"
#];
};
}

View file

@ -1,37 +0,0 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
username = "andrej";
admin = false;
extraGroups = ["networkmanager"];
trustedSshKeys = [];
cfg = config.${namespace}.users.${username};
in {
options.${namespace}.users.${username} = with types; {
enable = mkBoolOpt false "Enable ${username} user";
config = mkOpt types.attrs {} "Additional home manager config for ${username}";
};
config = mkUser {
inherit config;
inherit (cfg) enable;
homeConfig = cfg.config;
inherit username;
inherit admin;
inherit extraGroups;
inherit trustedSshKeys;
};
}

View file

@ -1,37 +0,0 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
username = "tania";
admin = false;
extraGroups = ["networkmanager" "touchscreen"];
trustedSshKeys = [];
cfg = config.${namespace}.users.${username};
in {
options.${namespace}.users.${username} = with types; {
enable = mkBoolOpt false "Enable ${username} user";
config = mkOpt types.attrs {} "Additional home manager config for ${username}";
};
config = mkUser {
inherit config;
inherit (cfg) enable;
homeConfig = cfg.config;
inherit username;
inherit admin;
inherit extraGroups;
inherit trustedSshKeys;
};
}

View file

@ -1,40 +0,0 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.windowManagers.niri;
in {
options.${namespace}.windowManagers.niri = with types; {
enable = mkBoolOpt false "Enable Niri as your window manager";
};
config = mkIf cfg.enable {
${namespace} = {
programs.dolphin.enable = mkDefault true;
};
security.pam.services.quickshell = {};
programs.niri = {
enable = true;
package = pkgs.niri-unstable;
};
niri-flake.cache.enable = true;
environment.systemPackages = with pkgs; [
wl-clipboard
wayland-utils
libsecret
gamescope
xwayland-satellite-unstable
];
};
}