more cleanup
This commit is contained in:
@@ -7,9 +7,14 @@
|
||||
with lib;
|
||||
let
|
||||
cfg = config.${namespace}.bootloader.lanzaboote;
|
||||
inherit (lib.${namespace}) mkOpt;
|
||||
in
|
||||
{
|
||||
imports = [ ./options.nix ];
|
||||
options.${namespace}.bootloader.lanzaboote = {
|
||||
enable = mkEnableOption "enable lanzaboote";
|
||||
|
||||
configLimit = mkOpt types.int 10 "Number of boot items to keep";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
boot = {
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
{ lib, namespace, ... }:
|
||||
with lib;
|
||||
let
|
||||
inherit (lib.${namespace}) mkOpt;
|
||||
in
|
||||
{
|
||||
options.${namespace}.bootloader.lanzaboote = {
|
||||
enable = mkEnableOption "enable lanzaboote";
|
||||
|
||||
configLimit = mkOpt types.int 10 "Number of boot items to keep";
|
||||
};
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
{ config, lib, namespace, ... }:
|
||||
with lib;
|
||||
let
|
||||
# inherit (lib.${namespace}) mkOpt;
|
||||
inherit (lib.${namespace}) mkOpt;
|
||||
cfg = config.${namespace}.boot.systemd-boot;
|
||||
in
|
||||
{
|
||||
options.${namespace}.boot.systemd-boot = {
|
||||
enable = mkEnableOption "enable systemd-boot";
|
||||
|
||||
configLimit = mkOpt types.int 10 "Number of boot items to keep";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
@@ -14,7 +16,7 @@ in
|
||||
loader = {
|
||||
systemd-boot = {
|
||||
enable = mkDefault true;
|
||||
configurationLimit = mkDefault 10;
|
||||
configurationLimit = cfg.configLimit;
|
||||
};
|
||||
|
||||
efi = {
|
||||
|
||||
@@ -8,7 +8,10 @@ let
|
||||
cfg = config.${namespace}.desktop.cosmic;
|
||||
in
|
||||
{
|
||||
imports = [ ./options.nix ];
|
||||
options.${namespace}.desktop.cosmic = {
|
||||
enable = lib.mkEnableOption "enable cosmic settings";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services = {
|
||||
desktopManager.cosmic.enable = true;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{ lib, namespace, ... }:
|
||||
with lib;
|
||||
{
|
||||
options.${namespace}.desktop.cosmic = {
|
||||
enable = mkEnableOption "enable cosmic settings";
|
||||
};
|
||||
}
|
||||
@@ -8,86 +8,6 @@
|
||||
let
|
||||
cfg = config.${namespace}.desktop.hyprland;
|
||||
|
||||
# Create a persistent directory for wallpapers
|
||||
wallpaperDir = "/var/lib/wallpapers";
|
||||
|
||||
# Default fallback wallpaper (included in the system)
|
||||
defaultWallpaper = pkgs.runCommand "default-wallpaper" { } ''
|
||||
mkdir -p $out
|
||||
cp ${pkgs.nixos-artwork.wallpapers.nineish-dark-gray}/share/backgrounds/nixos/nix-wallpaper-nineish-dark-gray.png $out/default.jpg
|
||||
'';
|
||||
|
||||
bing-wallpaper = pkgs.writeScriptBin "bing-wallpaper" ''
|
||||
# Directory to store wallpapers
|
||||
WALLPAPER_DIR="${wallpaperDir}"
|
||||
IMG_PATH="$WALLPAPER_DIR/current.jpg"
|
||||
FALLBACK_PATH="$WALLPAPER_DIR/fallback.jpg"
|
||||
|
||||
# Ensure directory exists
|
||||
mkdir -p "$WALLPAPER_DIR"
|
||||
|
||||
# Copy to the standard location for other services
|
||||
ln -sf "$IMG_PATH" /run/wallpaper.jpg
|
||||
|
||||
# Try to download new wallpaper
|
||||
if curl -s --connect-timeout 5 --max-time 10 "https://www.bing.com" > /dev/null; then
|
||||
URL=$(curl -s "https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1" | \
|
||||
jq -r '.images[0].url')
|
||||
FULL_URL="https://www.bing.com$URL"
|
||||
if curl -s -o "$IMG_PATH.tmp" "$FULL_URL"; then
|
||||
mv "$IMG_PATH.tmp" "$IMG_PATH"
|
||||
echo "Downloaded $FULL_URL to $IMG_PATH successfully"
|
||||
else
|
||||
echo "Failed to download Bing wallpaper, using previous or fallback"
|
||||
# If current doesn't exist, use fallback
|
||||
if [ ! -f "$IMG_PATH" ] && [ -f "$FALLBACK_PATH" ]; then
|
||||
cp "$FALLBACK_PATH" "$IMG_PATH"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "Network unavailable, using previous or fallback wallpaper"
|
||||
# If current doesn't exist, use fallback
|
||||
if [ ! -f "$IMG_PATH" ] && [ -f "$FALLBACK_PATH" ]; then
|
||||
cp "$FALLBACK_PATH" "$IMG_PATH"
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
|
||||
nasa-wallpaper = pkgs.writeScriptBin "nasa-wallpaper" ''
|
||||
# Directory to store wallpapers
|
||||
WALLPAPER_DIR="${wallpaperDir}"
|
||||
IMG_PATH="$WALLPAPER_DIR/current.jpg"
|
||||
FALLBACK_PATH="$WALLPAPER_DIR/fallback.jpg"
|
||||
|
||||
# Ensure directory exists
|
||||
mkdir -p "$WALLPAPER_DIR"
|
||||
|
||||
# Copy to the standard location for other services
|
||||
ln -sf "$IMG_PATH" /run/wallpaper.jpg
|
||||
|
||||
# Try to download new wallpaper
|
||||
if curl -s --connect-timeout 5 --max-time 10 "https://api.nasa.gov" > /dev/null; then
|
||||
APOD_URL="https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY"
|
||||
IMAGE_URL=$(curl -s "$APOD_URL" | jq -r '.hdurl // .url')
|
||||
if curl -s -o "$IMG_PATH.tmp" "$IMAGE_URL"; then
|
||||
mv "$IMG_PATH.tmp" "$IMG_PATH"
|
||||
echo "Downloaded $IMAGE_URL to $IMG_PATH successfully"
|
||||
else
|
||||
echo "Failed to download NASA wallpaper, using previous or fallback"
|
||||
# If current doesn't exist, use fallback
|
||||
if [ ! -f "$IMG_PATH" ] && [ -f "$FALLBACK_PATH" ]; then
|
||||
cp "$FALLBACK_PATH" "$IMG_PATH"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "Network unavailable, using previous or fallback wallpaper"
|
||||
# If current doesn't exist, use fallback
|
||||
if [ ! -f "$IMG_PATH" ] && [ -f "$FALLBACK_PATH" ]; then
|
||||
cp "$FALLBACK_PATH" "$IMG_PATH"
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
|
||||
# Select the appropriate wallpaper script based on the configuration
|
||||
|
||||
sddmThemeName = "sddm-astronaut-theme";
|
||||
@@ -97,42 +17,11 @@ let
|
||||
Background = "/run/wallpaper.jpg";
|
||||
};
|
||||
};
|
||||
|
||||
# The script to use based on the selected wallpaper source
|
||||
wallpaper-command = if cfg.wallpaperSource == "nasa" then "nasa-wallpaper" else "bing-wallpaper";
|
||||
|
||||
# System activation script to ensure wallpaper is available early in boot
|
||||
wallpaper-activation-script = ''
|
||||
# Create wallpaper directory if it doesn't exist
|
||||
mkdir -p ${wallpaperDir}
|
||||
|
||||
# Copy default wallpaper as fallback if it doesn't exist
|
||||
if [ ! -f ${wallpaperDir}/fallback.jpg ]; then
|
||||
cp ${defaultWallpaper}/default.jpg ${wallpaperDir}/fallback.jpg
|
||||
fi
|
||||
|
||||
# If no current wallpaper exists, use the fallback
|
||||
if [ ! -f ${wallpaperDir}/current.jpg ]; then
|
||||
cp ${wallpaperDir}/fallback.jpg ${wallpaperDir}/current.jpg
|
||||
fi
|
||||
|
||||
# Create symlink for Plymouth and SDDM
|
||||
ln -sf ${wallpaperDir}/current.jpg /run/wallpaper.jpg
|
||||
'';
|
||||
in
|
||||
{
|
||||
imports = [ ./options.nix ];
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [
|
||||
bing-wallpaper
|
||||
nasa-wallpaper
|
||||
pkgs.jq
|
||||
];
|
||||
|
||||
# Add system activation script to ensure wallpaper is available early
|
||||
system.activationScripts.wallpaper = wallpaper-activation-script;
|
||||
|
||||
# Configure Plymouth to use the same wallpaper
|
||||
boot.plymouth = {
|
||||
enable = true;
|
||||
@@ -185,99 +74,6 @@ in
|
||||
nm-applet.enable = true;
|
||||
};
|
||||
|
||||
systemd = {
|
||||
services = {
|
||||
preload-wallpaper = {
|
||||
enable = true;
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
before = [ "display-manager.service" ];
|
||||
requiredBy = [
|
||||
"plymouth-quit-wait.service"
|
||||
"display-manager.service"
|
||||
];
|
||||
wantedBy = [ "display-manager.service" ];
|
||||
path = [
|
||||
pkgs.bash
|
||||
pkgs.jq
|
||||
pkgs.curl
|
||||
bing-wallpaper
|
||||
nasa-wallpaper
|
||||
];
|
||||
script = ''
|
||||
${wallpaper-command}
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
TimeoutSec = "10s"; # Limit how long we wait for network
|
||||
};
|
||||
};
|
||||
|
||||
# Create a service that runs very early in boot to ensure wallpaper is available
|
||||
early-wallpaper-setup = {
|
||||
enable = true;
|
||||
description = "Setup wallpaper early in boot process";
|
||||
wantedBy = [
|
||||
"multi-user.target"
|
||||
"plymouth-start.service"
|
||||
];
|
||||
before = [ "plymouth-start.service" ];
|
||||
script = ''
|
||||
# Ensure wallpaper directory exists
|
||||
mkdir -p ${wallpaperDir}
|
||||
|
||||
# If no current wallpaper exists, use the fallback
|
||||
if [ ! -f ${wallpaperDir}/current.jpg ]; then
|
||||
cp ${wallpaperDir}/fallback.jpg ${wallpaperDir}/current.jpg
|
||||
fi
|
||||
|
||||
# Create symlink for Plymouth and SDDM
|
||||
ln -sf ${wallpaperDir}/current.jpg /run/wallpaper.jpg
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
user = {
|
||||
services = {
|
||||
reload-wallpaper = {
|
||||
enable = true;
|
||||
path = [
|
||||
pkgs.bash
|
||||
pkgs.jq
|
||||
pkgs.curl
|
||||
pkgs.hyprland
|
||||
bing-wallpaper
|
||||
nasa-wallpaper
|
||||
];
|
||||
script = ''
|
||||
${wallpaper-command}
|
||||
${pkgs.hyprland}/bin/hyprctl hyprpaper reload ,/run/wallpaper.jpg
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
};
|
||||
};
|
||||
};
|
||||
# Create a timer to run the service periodically
|
||||
timers = {
|
||||
reload-wallpaper = {
|
||||
description = "Timer for reload-wallpaper";
|
||||
wantedBy = [ "timers.target" ];
|
||||
|
||||
# Timer configuration
|
||||
timerConfig = {
|
||||
OnCalendar = "daily"; # Check every day
|
||||
Persistent = true; # Run immediately if last run was missed
|
||||
Unit = "reload-wallpaper.service";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
security = {
|
||||
# Enable gnome keyring for password storage
|
||||
pam.services.sddm.enableGnomeKeyring = true;
|
||||
|
||||
@@ -1,16 +1,27 @@
|
||||
{ lib, ... }:
|
||||
{ lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
inherit (lib.${namespace}) mkOpt;
|
||||
|
||||
# Default fallback wallpaper (included in the system)
|
||||
defaultWallpaper = pkgs.runCommand "default-wallpaper" { } ''
|
||||
mkdir -p $out
|
||||
cp ${pkgs.nixos-artwork.wallpapers.nineish-dark-gray}/share/backgrounds/nixos/nix-wallpaper-nineish-dark-gray.png $out/default.jpg
|
||||
'';
|
||||
in
|
||||
{
|
||||
options.mjallen.desktop.hyprland = {
|
||||
enable = mkEnableOption "enable hyprland desktop environment";
|
||||
|
||||
wallpaperSource = mkOption {
|
||||
type = types.enum [
|
||||
wallpaperSource = mkOpt (types.enum [
|
||||
"bing"
|
||||
"nasa"
|
||||
];
|
||||
default = "bing";
|
||||
description = "Source for the wallpaper (bing or nasa)";
|
||||
};
|
||||
]) "bing" "Source for the wallpaper (bing or nasa)";
|
||||
|
||||
wallpaper = mkOpt types.path "/var/lib/wallpapers/current.jpg" "Path to the wallpaper folder";
|
||||
|
||||
wallpaperDir = mkOpt types.path "/var/lib/wallpapers" "Path to the wallpaper folder";
|
||||
|
||||
defaultWallpaper = mkOpt types.path "${defaultWallpaper}/default.jpg" "Default wallpaper";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
nord = import ./theme.nix;
|
||||
themeSize = "compact"; # [ "standard" "compact" ]
|
||||
themeAccent = "all"; # [ "default" "purple" "pink" "red" "orange" "yellow" "green" "teal" "grey" "all" ]
|
||||
themeVariant = "nord"; # [ "nord" "dracula" "gruvbox" "everforest" "catppuccin" "all" "black" "rimless" "normal" "float" ]
|
||||
themeColor = "dark"; # [ "standard" "light" "dark" ]
|
||||
iconThemeVariant = "all"; # [ "default" "purple" "pink" "red" "orange" "yellow" "green" "teal" "grey" "all" ]
|
||||
iconScheme = "nord"; # [ "default" "nord" "dracula" "gruvbox" "everforest" "catppuccin" "all" ]
|
||||
|
||||
sddmThemePkg = pkgs.sddm-astronaut.override {
|
||||
embeddedTheme = "astronaut";
|
||||
themeConfig = {
|
||||
Background = "/run/wallpaper.jpg";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
# Username
|
||||
user = "matt";
|
||||
|
||||
# Displays
|
||||
displayLeft = {
|
||||
input = "eDP-1";
|
||||
resolution = "3456x2234"; # "3356x2160";
|
||||
refreshRate = "60.00000";
|
||||
};
|
||||
displayRight = {
|
||||
input = "DP-2";
|
||||
resolution = "3840x2160";
|
||||
refreshRate = "240.00000";
|
||||
};
|
||||
|
||||
# Cursor
|
||||
cursorTheme = "macOS";
|
||||
cursorThemePkg = pkgs.apple-cursor;
|
||||
cursorSize = 24;
|
||||
|
||||
# GTK
|
||||
gtkThemeSize = themeSize;
|
||||
gtkThemeAccent = themeAccent;
|
||||
gtkThemeVariant = themeVariant;
|
||||
gtkThemeColor = themeColor;
|
||||
gtkTheme = "Colloid-Dark-Compact-Nord";
|
||||
gtkThemePkg = pkgs.colloid-gtk-theme.override {
|
||||
sizeVariants = [ themeSize ];
|
||||
colorVariants = [ themeColor ];
|
||||
themeVariants = [ themeAccent ];
|
||||
tweaks = [ themeVariant ];
|
||||
};
|
||||
|
||||
# Icons
|
||||
iconThemeScheme = iconScheme;
|
||||
iconTheme = "Colloid-Nord-Dark";
|
||||
iconThemePkg = pkgs.colloid-icon-theme.override {
|
||||
schemeVariants = [ iconScheme ];
|
||||
colorVariants = [ iconThemeVariant ];
|
||||
};
|
||||
|
||||
# Fonts
|
||||
fontName = "JetBrainsMono NFM";
|
||||
fontPackage = pkgs.nerd-fonts.jetbrains-mono;
|
||||
fontSize = 12;
|
||||
|
||||
# SDDM/Locking
|
||||
sddm = {
|
||||
themeName = "sddm-astronaut-theme";
|
||||
package = sddmThemePkg;
|
||||
};
|
||||
lockScreenTimer = 900; # 15 min
|
||||
screenOffTimer = 930; # 15.5 min
|
||||
suspendTimer = 3600; # 1hr
|
||||
|
||||
# Packages needed for the theme(s)
|
||||
requiredPkgs = with pkgs; [
|
||||
adwaita-icon-theme
|
||||
adwaita-icon-theme
|
||||
apple-cursor
|
||||
catppuccin
|
||||
catppuccin-gtk
|
||||
catppuccin-qt5ct
|
||||
catppuccin-sddm
|
||||
colloid-gtk-theme
|
||||
colloid-icon-theme
|
||||
nemo
|
||||
nemo-python
|
||||
nemo-emblems
|
||||
nemo-preview
|
||||
nemo-seahorse
|
||||
nemo-fileroller
|
||||
nemo-qml-plugin-dbus
|
||||
papirus-folders
|
||||
sddm-astronaut
|
||||
];
|
||||
|
||||
defaultApps = {
|
||||
browser = pkgs.firefox;
|
||||
editor = pkgs.micro;
|
||||
fileExplorer = pkgs.nemo;
|
||||
visual = pkgs.vscodium;
|
||||
terminal = pkgs.kitty;
|
||||
office = pkgs.onlyoffice-bin_latest;
|
||||
video = pkgs.vlc;
|
||||
imageViewer = pkgs.nomacs;
|
||||
};
|
||||
|
||||
theme = nord;
|
||||
}
|
||||
176
modules/nixos/desktop/hyprland/wallpapers/default.nix
Normal file
176
modules/nixos/desktop/hyprland/wallpapers/default.nix
Normal file
@@ -0,0 +1,176 @@
|
||||
{ config, lib, pkgs, namespace, ... }:
|
||||
let
|
||||
cfg = config.${namespace}.desktop.hyprland;
|
||||
|
||||
# The script to use based on the selected wallpaper source
|
||||
wallpaper-command = if cfg.wallpaperSource == "nasa" then "nasa-wallpaper" else "bing-wallpaper";
|
||||
|
||||
# System activation script to ensure wallpaper is available early in boot
|
||||
wallpaper-activation-script = ''
|
||||
# Create wallpaper directory if it doesn't exist
|
||||
mkdir -p ${cfg.wallpaperDir}
|
||||
|
||||
# Copy default wallpaper as fallback if it doesn't exist
|
||||
if [ ! -f ${cfg.wallpaperDir}/fallback.jpg ]; then
|
||||
cp ${cfg.defaultWallpaper} ${cfg.wallpaperDir}/fallback.jpg
|
||||
fi
|
||||
|
||||
# If no current wallpaper exists, use the fallback
|
||||
if [ ! -f ${cfg.wallpaperDir}/current.jpg ]; then
|
||||
cp ${cfg.wallpaperDir}/fallback.jpg ${cfg.wallpaperDir}/current.jpg
|
||||
fi
|
||||
|
||||
# Create symlink for Plymouth and SDDM
|
||||
ln -sf ${cfg.wallpaperDir}/current.jpg /run/wallpaper.jpg
|
||||
'';
|
||||
|
||||
bing-wallpaper = pkgs.writeScriptBin "bing-wallpaper" ''
|
||||
# Directory to store wallpapers
|
||||
WALLPAPER_DIR="${cfg.wallpaperDir}"
|
||||
IMG_PATH="$WALLPAPER_DIR/current.jpg"
|
||||
FALLBACK_PATH="$WALLPAPER_DIR/fallback.jpg"
|
||||
|
||||
# Ensure directory exists
|
||||
mkdir -p "$WALLPAPER_DIR"
|
||||
|
||||
# Copy to the standard location for other services
|
||||
ln -sf "$IMG_PATH" /run/wallpaper.jpg
|
||||
|
||||
# Try to download new wallpaper
|
||||
if ${pkgs.curl}/bin/curl -s --connect-timeout 5 --max-time 10 "https://www.bing.com" > /dev/null; then
|
||||
URL=$(${pkgs.curl}/bin/curl -s "https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1" | \
|
||||
${pkgs.jq}/bin/jq -r '.images[0].url')
|
||||
FULL_URL="https://www.bing.com$URL"
|
||||
if ${pkgs.curl}/bin/curl -s -o "$IMG_PATH.tmp" "$FULL_URL"; then
|
||||
mv "$IMG_PATH.tmp" "$IMG_PATH"
|
||||
echo "Downloaded $FULL_URL to $IMG_PATH successfully"
|
||||
else
|
||||
echo "Failed to download Bing wallpaper, using previous or fallback"
|
||||
# If current doesn't exist, use fallback
|
||||
if [ ! -f "$IMG_PATH" ] && [ -f "$FALLBACK_PATH" ]; then
|
||||
cp "$FALLBACK_PATH" "$IMG_PATH"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "Network unavailable, using previous or fallback wallpaper"
|
||||
# If current doesn't exist, use fallback
|
||||
if [ ! -f "$IMG_PATH" ] && [ -f "$FALLBACK_PATH" ]; then
|
||||
cp "$FALLBACK_PATH" "$IMG_PATH"
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
|
||||
nasa-wallpaper = pkgs.writeScriptBin "nasa-wallpaper" ''
|
||||
# Directory to store wallpapers
|
||||
WALLPAPER_DIR="${cfg.wallpaperDir}"
|
||||
IMG_PATH="$WALLPAPER_DIR/current.jpg"
|
||||
FALLBACK_PATH="$WALLPAPER_DIR/fallback.jpg"
|
||||
|
||||
# Ensure directory exists
|
||||
mkdir -p "$WALLPAPER_DIR"
|
||||
|
||||
# Copy to the standard location for other services
|
||||
ln -sf "$IMG_PATH" /run/wallpaper.jpg
|
||||
|
||||
# Try to download new wallpaper
|
||||
if ${pkgs.curl}/bin/curl -s --connect-timeout 5 --max-time 10 "https://api.nasa.gov" > /dev/null; then
|
||||
APOD_URL="https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY"
|
||||
IMAGE_URL=$(${pkgs.curl}/bin/curl -s "$APOD_URL" | ${pkgs.jq}/bin/jq -r '.hdurl // .url')
|
||||
if ${pkgs.curl}/bin/curl -s -o "$IMG_PATH.tmp" "$IMAGE_URL"; then
|
||||
mv "$IMG_PATH.tmp" "$IMG_PATH"
|
||||
echo "Downloaded $IMAGE_URL to $IMG_PATH successfully"
|
||||
else
|
||||
echo "Failed to download NASA wallpaper, using previous or fallback"
|
||||
# If current doesn't exist, use fallback
|
||||
if [ ! -f "$IMG_PATH" ] && [ -f "$FALLBACK_PATH" ]; then
|
||||
cp "$FALLBACK_PATH" "$IMG_PATH"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "Network unavailable, using previous or fallback wallpaper"
|
||||
# If current doesn't exist, use fallback
|
||||
if [ ! -f "$IMG_PATH" ] && [ -f "$FALLBACK_PATH" ]; then
|
||||
cp "$FALLBACK_PATH" "$IMG_PATH"
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
in
|
||||
{
|
||||
imports = [ ../options.nix ];
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [
|
||||
bing-wallpaper
|
||||
nasa-wallpaper
|
||||
];
|
||||
|
||||
# Add system activation script to ensure wallpaper is available early
|
||||
system.activationScripts.wallpaper = wallpaper-activation-script;
|
||||
|
||||
systemd = {
|
||||
services = {
|
||||
preload-wallpaper = {
|
||||
enable = true;
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
before = [ "display-manager.service" ];
|
||||
requiredBy = [
|
||||
"plymouth-quit-wait.service"
|
||||
"display-manager.service"
|
||||
];
|
||||
wantedBy = [ "display-manager.service" ];
|
||||
path = [
|
||||
pkgs.bash
|
||||
pkgs.jq
|
||||
pkgs.curl
|
||||
bing-wallpaper
|
||||
nasa-wallpaper
|
||||
];
|
||||
script = ''
|
||||
${wallpaper-command}
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
TimeoutSec = "10s"; # Limit how long we wait for network
|
||||
};
|
||||
};
|
||||
};
|
||||
user = {
|
||||
services = {
|
||||
reload-wallpaper = {
|
||||
enable = true;
|
||||
path = [
|
||||
pkgs.bash
|
||||
pkgs.jq
|
||||
pkgs.curl
|
||||
pkgs.hyprland
|
||||
bing-wallpaper
|
||||
nasa-wallpaper
|
||||
];
|
||||
script = ''
|
||||
${wallpaper-command}
|
||||
${pkgs.hyprland}/bin/hyprctl hyprpaper reload ,${cfg.wallpaper}
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
};
|
||||
};
|
||||
};
|
||||
# Create a timer to run the service periodically
|
||||
timers = {
|
||||
reload-wallpaper = {
|
||||
description = "Timer for reload-wallpaper";
|
||||
wantedBy = [ "timers.target" ];
|
||||
|
||||
# Timer configuration
|
||||
timerConfig = {
|
||||
OnCalendar = "daily"; # Check every day
|
||||
Persistent = true; # Run immediately if last run was missed
|
||||
Unit = "reload-wallpaper.service";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -5,11 +5,23 @@
|
||||
namespace,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
inherit (lib.${namespace}) mkOpt mkBoolOpt;
|
||||
cfg = config.${namespace}.hardware.amd;
|
||||
in
|
||||
{
|
||||
imports = [ ./options.nix ];
|
||||
options.${namespace}.hardware.amd = {
|
||||
enable = mkEnableOption "amd hardware config";
|
||||
|
||||
corectrl.enable = mkBoolOpt false "Enable Corectl";
|
||||
|
||||
corectrl.enablePolkit = mkBoolOpt false "Enable Corectl Polkit";
|
||||
|
||||
corectrl.polkitGroup = mkOpt types.str "wheel" "Corectl Polkit Group";
|
||||
|
||||
lact.enable = mkBoolOpt false "Enable Lact daemon";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
boot = {
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
{ lib, namespace, ... }:
|
||||
with lib;
|
||||
let
|
||||
inherit (lib.${namespace}) mkOpt mkBoolOpt;
|
||||
in
|
||||
{
|
||||
options.${namespace}.hardware.amd = {
|
||||
enable = mkEnableOption "amd hardware config";
|
||||
|
||||
corectrl.enable = mkBoolOpt false "Enable Corectl";
|
||||
|
||||
corectrl.enablePolkit = mkBoolOpt false "Enable Corectl Polkit";
|
||||
|
||||
corectrl.polkitGroup = mkOpt types.str "wheel" "Corectl Polkit Group";
|
||||
|
||||
lact.enable = mkBoolOpt false "Enable Lact daemon";
|
||||
};
|
||||
}
|
||||
@@ -6,10 +6,21 @@
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
inherit (lib.${namespace}) mkBoolOpt;
|
||||
cfg = config.${namespace}.hardware.nvidia;
|
||||
in
|
||||
{
|
||||
imports = [ ./options.nix ];
|
||||
options.${namespace}.hardware.nvidia = {
|
||||
enable = mkEnableOption "nvidia hardware config";
|
||||
|
||||
enableOpen = mkBoolOpt false "Enable open source driver";
|
||||
|
||||
nvidiaSettings = mkBoolOpt false "Install nvidia settings";
|
||||
|
||||
enableBeta = mkBoolOpt false "Enable Beta drivers";
|
||||
|
||||
enableNvidiaDocker = mkBoolOpt false "Enable nvidia docker support";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
hardware = {
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
{ lib, namespace, ... }:
|
||||
with lib;
|
||||
let
|
||||
inherit (lib.${namespace}) mkBoolOpt;
|
||||
in
|
||||
{
|
||||
options.${namespace}.hardware.nvidia = {
|
||||
enable = mkEnableOption "nvidia hardware config";
|
||||
|
||||
enableOpen = mkBoolOpt false "Enable open source driver";
|
||||
|
||||
nvidiaSettings = mkBoolOpt false "Install nvidia settings";
|
||||
|
||||
enableBeta = mkBoolOpt false "Enable Beta drivers";
|
||||
|
||||
enableNvidiaDocker = mkBoolOpt false "Enable nvidia docker support";
|
||||
};
|
||||
}
|
||||
@@ -6,10 +6,44 @@
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
inherit (lib.${namespace}) mkOpt;
|
||||
cfg = config.${namespace}.impermanence;
|
||||
in
|
||||
{
|
||||
imports = [ ./options.nix ];
|
||||
options.${namespace}.impermanence = {
|
||||
enable = mkEnableOption "enable impermanence";
|
||||
persistencePath = mkOption {
|
||||
type = types.str;
|
||||
default = "/nix/persist/system";
|
||||
description = "Path to the persistence directory";
|
||||
};
|
||||
|
||||
# extraDirectories = mkOpt (types.listOf types.path) [ ] "Extra directory paths to add to impermanence";
|
||||
extraDirectories = mkOpt (types.listOf (types.either types.str (types.submodule {
|
||||
options = {
|
||||
directory = mkOption {
|
||||
type = types.str;
|
||||
description = "Directory path";
|
||||
};
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "root";
|
||||
description = "Directory owner";
|
||||
};
|
||||
group = mkOption {
|
||||
type = types.str;
|
||||
default = "root";
|
||||
description = "Directory group";
|
||||
};
|
||||
mode = mkOption {
|
||||
type = types.str;
|
||||
default = "u=rwx,g=rx,o=";
|
||||
description = "Directory permissions";
|
||||
};
|
||||
};
|
||||
}))) [ ] "Extra directory paths to add to impermanence";
|
||||
extraFiles = mkOpt (types.listOf types.path) [ ] "Extra file paths to add to impermanence";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.persistence."/nix/persist/system" = {
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
{ lib, namespace, ... }:
|
||||
with lib;
|
||||
let
|
||||
inherit (lib.mjallen) mkOpt;
|
||||
in
|
||||
{
|
||||
|
||||
options.${namespace}.impermanence = {
|
||||
enable = mkEnableOption "enable impermanence";
|
||||
persistencePath = mkOption {
|
||||
type = types.str;
|
||||
default = "/nix/persist/system";
|
||||
description = "Path to the persistence directory";
|
||||
};
|
||||
|
||||
# extraDirectories = mkOpt (types.listOf types.path) [ ] "Extra directory paths to add to impermanence";
|
||||
extraDirectories = mkOpt (types.listOf (types.either types.str (types.submodule {
|
||||
options = {
|
||||
directory = mkOption {
|
||||
type = types.str;
|
||||
description = "Directory path";
|
||||
};
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "root";
|
||||
description = "Directory owner";
|
||||
};
|
||||
group = mkOption {
|
||||
type = types.str;
|
||||
default = "root";
|
||||
description = "Directory group";
|
||||
};
|
||||
mode = mkOption {
|
||||
type = types.str;
|
||||
default = "u=rwx,g=rx,o=";
|
||||
description = "Directory permissions";
|
||||
};
|
||||
};
|
||||
}))) [ ] "Extra directory paths to add to impermanence";
|
||||
extraFiles = mkOpt (types.listOf types.path) [ ] "Extra file paths to add to impermanence";
|
||||
};
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
inherit (lib.mjallen) mkOpt mkBoolOpt;
|
||||
inherit (lib.${namespace}) mkOpt mkBoolOpt;
|
||||
in
|
||||
{
|
||||
options.${namespace}.network = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ lib, namespace, ... }:
|
||||
let
|
||||
inherit (lib.mjallen) mkOpt mkBoolOpt;
|
||||
inherit (lib.${namespace}) mkOpt mkBoolOpt;
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
inherit (lib.mjallen) mkOpt mkBoolOpt;
|
||||
inherit (lib.${namespace}) mkOpt mkBoolOpt;
|
||||
cfg = config.${namespace}.user;
|
||||
|
||||
# Common SSH keys used across systems
|
||||
|
||||
Reference in New Issue
Block a user