snowfall migration wip homepc done

This commit is contained in:
Aleksandr Lebedev 2025-08-09 17:07:55 +02:00
parent ed08a98651
commit 25774148e4
37 changed files with 1943 additions and 1447 deletions

View file

@ -0,0 +1,87 @@
{
lib,
osConfig,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.impermanence;
osCfg = osConfig.${namespace}.impermanence;
name = config.snowfallorg.user.name;
home = config.snowfallorg.user.home.directory;
in {
options.${namespace}.impermanence = with types; {
enable = mkBoolOpt osCfg.enable "Enable impermanence";
persistentStorage = mkOpt path "${osCfg.persistentStorage}${home}" "Actual persistent storage path";
};
imports = with inputs; [
impermanence.homeManagerModules.impermanence
];
config = mkIf cfg.enable {
home.persistence."${cfg.persistentStorage}" = {
directories = [
"Downloads"
"Music"
"Pictures"
"Documents"
"Videos"
"Apps"
"VMs"
"Git"
"nixos-config"
"blender"
".gnupg"
".password-store"
".ssh"
".emacs.d"
".local/share/keyrings"
".local/share/direnv"
".local/share/chat.fluffy.fluffychat"
".klei"
"Android"
{
directory = ".var/app";
method = "symlink";
}
{
directory = ".local/share/Steam";
method = "symlink";
}
".mozilla"
".librewolf"
".local/share/mcpelauncher"
".local/share/PrismLauncher"
".local/share/TelegramDesktop"
".local/share/Paradox Interactive"
".config/unity3d/Ludeon Studios/RimWorld by Ludeon Studios"
".config/solaar"
".config/eww"
".config/kdeconnect"
".config/blender"
".config/unity3d"
".config/Element"
".config/GIMP"
".cache/nix-index"
".local/share/aspyr-media"
".themes"
];
files = [
".screenrc"
".config/kdeglobals"
".config/Minecraft Linux Launcher/Minecraft Linux Launcher UI.conf"
];
allowOther = true;
};
};
}

View file

@ -0,0 +1,34 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.programs.bottles;
impermanence = config.${namespace}.impermanence;
in {
options.${namespace}.programs.bottles = with types; {
enable = mkBoolOpt false "Enable Bottles";
};
config = mkIf cfg.enable (mkIf impermanence.enable {
home.persistence."${impermanence.persistentStorage}".directories = [
{
directory = ".local/share/bottles";
method = "symlink";
}
];
}
// {
home.packages = with pkgs; [bottles];
});
}

View file

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Before After
Before After

View file

@ -0,0 +1,143 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.programs.librewolf;
lock-false = {
Value = false;
Status = "locked";
};
lock-true = {
Value = true;
Status = "locked";
};
in {
options.${namespace}.programs.librewolf = with types; {
enable = mkBoolOpt false "Enable librewolf with best settings";
};
config = mkIf cfg.enable {
programs = {
librewolf = {
enable = true;
languagePacks = ["de" "en-US" "ru"];
/*
---- POLICIES ----
*/
# Check about:policies#documentation for options.
policies = {
DisableTelemetry = true;
DisableFirefoxStudies = true;
EnableTrackingProtection = {
Value = true;
Locked = true;
Cryptomining = true;
Fingerprinting = true;
};
DisablePocket = true;
DisableFirefoxAccounts = true;
DisableAccounts = true;
DisableFirefoxScreenshots = true;
OverrideFirstRunPage = "";
OverridePostUpdatePage = "";
DontCheckDefaultBrowser = true;
DisplayBookmarksToolbar = "never"; # alternatives: "always" or "newtab"
DisplayMenuBar = "default-off"; # alternatives: "always", "never" or "default-on"
SearchBar = "unified"; # alternative: "separate"
OfferToSaveLogins = false;
OffertosaveloginsDefault = false;
PasswordManagerEnabled = false;
NoDefaultBookmarks = true;
/*
---- EXTENSIONS ----
*/
# Check about:support for extension/add-on ID strings.
# Valid strings for installation_mode are "allowed", "blocked",
# "force_installed" and "normal_installed".
#https://mozilla.github.io/policy-templates/#extensionsettings
ExtensionSettings = {
"*".installation_mode = "allowed"; # blocks all addons except the ones specified below
# uBlock Origin
"uBlock0@raymondhill.net" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
installation_mode = "force_installed";
};
# Privacy Badger:
"jid1-MnnxcxisBPnSXQ@jetpack" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/privacy-badger17/latest.xpi";
installation_mode = "force_installed";
};
# Dark Reader
"addon@darkreader.org" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/darkreader/latest.xpi";
installation_mode = "force_installed";
};
#auto tab discard
"{c2c003ee-bd69-42a2-b0e9-6f34222cb046}" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/auto-tab-discard/latest.xpi";
installation_mode = "force_installed";
};
# global speed
"{f4961478-ac79-4a18-87e9-d2fb8c0442c4}" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/global-speed/latest.xpi";
installation_mode = "force_installed";
};
# sponsorblock
"sponsorBlocker@ajay.app" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi";
installation_mode = "force_installed";
};
# Adguard adblocker
"adguardadblocker@adguard.com" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/adguard-adblocker/latest.xpi";
installation_mode = "force_installed";
};
};
/*
---- PREFERENCES ----
*/
# Check about:config for options.
Preferences = {
"browser.contentblocking.category" = {
Value = "strict";
Status = "locked";
};
"extensions.pocket.enabled" = lock-false;
"extensions.screenshots.disabled" = lock-true;
"browser.startup.page" = 3; # restore session on startup
"browser.topsites.contile.enabled" = lock-false;
"browser.formfill.enable" = lock-false;
"browser.search.suggest.enabled" = lock-false;
"browser.search.suggest.enabled.private" = lock-false;
"browser.urlbar.suggest.searches" = lock-false;
"browser.urlbar.showSearchSuggestionsFirst" = lock-false;
"browser.newtabpage.activity-stream.feeds.section.topstories" = lock-false;
"browser.newtabpage.activity-stream.feeds.snippets" = lock-false;
"browser.newtabpage.activity-stream.section.highlights.includePocket" = lock-false;
"browser.newtabpage.activity-stream.section.highlights.includeBookmarks" = lock-false;
"browser.newtabpage.activity-stream.section.highlights.includeDownloads" = lock-false;
"browser.newtabpage.activity-stream.section.highlights.includeVisited" = lock-false;
"browser.newtabpage.activity-stream.showSponsored" = lock-false;
"browser.newtabpage.activity-stream.system.showSponsored" = lock-false;
"browser.newtabpage.activity-stream.showSponsoredTopSites" = lock-false;
};
};
};
};
};
}

View file

@ -0,0 +1,34 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.programs.prismlauncher;
impermanence = config.${namespace}.impermanence;
in {
options.${namespace}.programs.prismlauncher = with types; {
enable = mkBoolOpt false "Enable prismlauncher";
};
config = mkIf cfg.enable (mkIf impermanence.enable {
home.persistence."${impermanence.persistentStorage}".directories = [
{
directory = ".local/share/Prismlauncher";
method = "symlink";
}
];
}
// {
home.packages = with pkgs; [prismlauncher];
});
}

View file

@ -0,0 +1,88 @@
{
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

@ -0,0 +1,38 @@
{
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 (import ./batteryStatus.nix {
inherit config;
inherit namespace;
inherit pkgs;
});
}

View file

@ -47,7 +47,6 @@ in {
with pkgs.${namespace}; [
libreoffice
root-files
pass
gparted
qdirstat
exfatprogs
@ -65,14 +64,6 @@ in {
#kde
kdePackages.gwenview
kdePackages.ark
# user packages
obs-studio
neovim
localsend
gdb
element-desktop
];
programs.kdeconnect.enable = true;
programs.kdeconnect.package = lib.mkDefault pkgs.kdePackages.kdeconnect-kde;

View file

@ -0,0 +1,37 @@
{
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 = mkHomeManagerConfigOpt config;
};
config = mkUser {
inherit config;
inherit (cfg) enable;
homeConfig = cfg.config;
inherit username;
inherit admin;
inherit extraGroups;
inherit trustedSshKeys;
};
}

View file

@ -20,7 +20,10 @@ in {
};
config = mkIf cfg.enable {
${namespace}.loginManagers.sddm.enable = mkDefault true;
${namespace} = {
loginManagers.sddm.enable = mkDefault true;
programs.dolphin.enable = mkDefault true;
};
security.pam.services.hyprlock = {};
programs.niri = {
enable = true;