mirror of
https://gitlab.com/Zaney/zaneyos.git
synced 2025-06-24 05:51:46 +02:00
Working on Zaney Control Center and added flatpak service for enabling FlatHub
This commit is contained in:
parent
5e08ac0346
commit
fc1df2b684
@ -1,6 +1,6 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
let inherit (import ../../options.nix) flakeDir theShell; in
|
let inherit (import ../../options.nix) flakeDir flakePrev flakeBackup theShell; in
|
||||||
lib.mkIf (theShell == "bash") {
|
lib.mkIf (theShell == "bash") {
|
||||||
# Configure Bash
|
# Configure Bash
|
||||||
programs.bash = {
|
programs.bash = {
|
||||||
@ -18,7 +18,10 @@ lib.mkIf (theShell == "bash") {
|
|||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
sessionVariables = {
|
sessionVariables = {
|
||||||
|
FLAKEDIR = "${flakeDir}";
|
||||||
|
ZANEYOS = true;
|
||||||
|
FLAKEBACKUP = "${flakeBackup}";
|
||||||
|
FLAKEPREV = "${flakePrev}";
|
||||||
};
|
};
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
sv="sudo nvim";
|
sv="sudo nvim";
|
||||||
|
@ -53,8 +53,6 @@ in with lib; {
|
|||||||
env = GDK_BACKEND, wayland
|
env = GDK_BACKEND, wayland
|
||||||
env = CLUTTER_BACKEND, wayland
|
env = CLUTTER_BACKEND, wayland
|
||||||
env = SDL_VIDEODRIVER, ${sdl-videodriver}
|
env = SDL_VIDEODRIVER, ${sdl-videodriver}
|
||||||
env = XCURSOR_SIZE, 24
|
|
||||||
env = XCURSOR_THEME, Bibata-Modern-Ice
|
|
||||||
env = QT_QPA_PLATFORM, wayland
|
env = QT_QPA_PLATFORM, wayland
|
||||||
env = QT_WAYLAND_DISABLE_WINDOWDECORATION, 1
|
env = QT_WAYLAND_DISABLE_WINDOWDECORATION, 1
|
||||||
env = QT_AUTO_SCREEN_SCALE_FACTOR, 1
|
env = QT_AUTO_SCREEN_SCALE_FACTOR, 1
|
||||||
@ -113,7 +111,6 @@ in with lib; {
|
|||||||
exec-once = $POLKIT_BIN
|
exec-once = $POLKIT_BIN
|
||||||
exec-once = dbus-update-activation-environment --systemd --all
|
exec-once = dbus-update-activation-environment --systemd --all
|
||||||
exec-once = systemctl --user import-environment QT_QPA_PLATFORMTHEME WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
|
exec-once = systemctl --user import-environment QT_QPA_PLATFORMTHEME WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
|
||||||
exec-once = hyprctl setcursor Bibata-Modern-Ice 24
|
|
||||||
exec-once = swww init
|
exec-once = swww init
|
||||||
exec-once = waybar
|
exec-once = waybar
|
||||||
exec-once = swaync
|
exec-once = swaync
|
||||||
|
@ -23,7 +23,7 @@ in {
|
|||||||
(import ./../scripts/web-search.nix { inherit pkgs; })
|
(import ./../scripts/web-search.nix { inherit pkgs; })
|
||||||
(import ./../scripts/rofi-launcher.nix { inherit pkgs; })
|
(import ./../scripts/rofi-launcher.nix { inherit pkgs; })
|
||||||
(import ./../scripts/screenshootin.nix { inherit pkgs; })
|
(import ./../scripts/screenshootin.nix { inherit pkgs; })
|
||||||
(import ./../scripts/zcc.nix { inherit pkgs; })
|
# (import ./../scripts/zcc.nix { inherit pkgs; })
|
||||||
];
|
];
|
||||||
|
|
||||||
programs.gh.enable = true;
|
programs.gh.enable = true;
|
||||||
|
@ -1,25 +1,121 @@
|
|||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (import ../../options.nix) flakeDir;
|
inherit (import ../../options.nix) flakeDir flakePrev flakeBackup;
|
||||||
in
|
in
|
||||||
pkgs.writeShellScriptBin "zcc" ''
|
pkgs.writeShellScriptBin "zcc" ''
|
||||||
kdenlive=false
|
if [ "$#" -eq 0 ]; then
|
||||||
|
echo "The ZaneyOS Control Center requires an option like 'zcc [OPTION]'."
|
||||||
|
elif [ "$#" -eq 1 ]; then
|
||||||
|
if [ "$ZANEYOS" = true ]; then
|
||||||
|
choice="$1"
|
||||||
|
if [[ "$choice" = "update" ]]; then
|
||||||
|
# Add your update logic here
|
||||||
|
# If ~/zaneyos-previous exists, backup the configuration
|
||||||
|
if [[ -d ${flakePrev} ]]; then
|
||||||
|
# Check if ~/zaneyos-backup exists, otherwise create it
|
||||||
|
if [[ ! -d ${flakeBackup} ]]; then
|
||||||
|
mkdir ${flakeBackup}
|
||||||
|
fi
|
||||||
|
|
||||||
# Function to toggle the boolean variable
|
# Create a unique backup folder name with date and time
|
||||||
toggle_kdenlive() {
|
backup_folder=${flakeBackup}/$(date +"%Y%m%d%H%M%S")
|
||||||
kdenlive=$(yad --width=200 --height=100 --title="Toggle Kdenlive" \
|
|
||||||
--text="Toggle Kdenlive" --button="Toggle:0" --button="Cancel:1" \
|
|
||||||
--checkbox --value="$kdenlive")
|
|
||||||
|
|
||||||
# If the user clicks "Toggle" button, update the boolean value
|
# Backup previous configuration
|
||||||
if [ "$?" -eq 0 ]; then
|
sudo mv ${flakePrev} "$backup_folder"
|
||||||
echo "Kdenlive is now set to: $kdenlive"
|
echo "---"
|
||||||
|
echo "Previous configuration saved in $backup_folder"
|
||||||
|
fi
|
||||||
|
# Copy the previous repository
|
||||||
|
sudo cp -rp ${flakeDir} ${flakePrev}
|
||||||
|
echo "---"
|
||||||
|
echo "Actual configuration saved on $FLAKEPREV"
|
||||||
|
|
||||||
|
# Change directory
|
||||||
|
cd ${flakeDir} || exit 1
|
||||||
|
|
||||||
|
# Run git status to get only modified, tracked but not committed files
|
||||||
|
files_to_check=$(git status -s --untracked-files=no | awk '{print $2}')
|
||||||
|
|
||||||
|
# Stash changes and update the local repo from the remote one
|
||||||
|
echo "---"
|
||||||
|
echo "Updating zaneyos..."
|
||||||
|
git stash && git pull
|
||||||
|
|
||||||
|
# Show files to check to the user
|
||||||
|
echo "---"
|
||||||
|
echo "Files to review:"
|
||||||
|
echo $files_to_check
|
||||||
|
|
||||||
|
# Initialize the unresolved_files list
|
||||||
|
unresolved_files=()
|
||||||
|
|
||||||
|
# Verify and overwrite files if the user confirms or save files to be manually reviewed
|
||||||
|
for file in $files_to_check; do
|
||||||
|
echo "---"
|
||||||
|
echo "Differences on $file:"
|
||||||
|
diff "$file" ~/zaneyos-previous/"$file"
|
||||||
|
echo "---"
|
||||||
|
read -p "Overwrite file $file with your? [Y/n]: " choice
|
||||||
|
case "$choice" in
|
||||||
|
*)
|
||||||
|
cp ~/zaneyos-previous/"$file" "$file"
|
||||||
|
;;
|
||||||
|
n|N)
|
||||||
|
# Add the file to unresolved_files
|
||||||
|
unresolved_files+=("$file")
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# If unresolved_files contains one or more files
|
||||||
|
if [[ ''${#unresolved_files[@]} -gt 0 ]]; then
|
||||||
|
# Show the user files to be manually reviewed and exit
|
||||||
|
echo "---"
|
||||||
|
echo "Review manually the following files:"
|
||||||
|
printf '%s\n' "''${unresolved_files[@]}"
|
||||||
|
else
|
||||||
|
# Prompt for updating flake.nix
|
||||||
|
echo "---"
|
||||||
|
read -p "Do you want to update flake? [Y/n]: " update_flake
|
||||||
|
update_flake=${update_flake:-Y} # Set Y as default option
|
||||||
|
if [[ $update_flake == [Yy] ]]; then
|
||||||
|
# Run flake-update
|
||||||
|
echo "---"
|
||||||
|
echo "Running flake-update..."
|
||||||
|
sudo nix flake update ~/zaneyos
|
||||||
|
# Prompt for system rebuild
|
||||||
|
echo "---"
|
||||||
|
read -p "Do you want to rebuild the system? [Y/n]: " rebuild_system
|
||||||
|
rebuild_system=${rebuild_system:-Y} # Set Y as default option
|
||||||
|
if [[ $rebuild_system == [Yy] ]]; then
|
||||||
|
# Run flake-rebuild
|
||||||
|
echo "---"
|
||||||
|
echo "Running flake-rebuild..."
|
||||||
|
sudo nixos-rebuild switch --flake ~/zaneyos
|
||||||
|
else
|
||||||
|
echo "---"
|
||||||
|
echo "Ok, the system will not be rebuilt"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "---"
|
||||||
|
echo "Ok, flake will not be updated"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "---"
|
||||||
|
echo "Ok. Press any key to exit."
|
||||||
|
read -n 1 -s
|
||||||
|
|
||||||
|
elif [[ "$choice" = "install" ]]; then
|
||||||
|
echo "Installing..."
|
||||||
|
# Add logic for when the user chooses not to update
|
||||||
|
else
|
||||||
|
echo "Invalid option. Try zcc update or zcc install"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Toggle canceled. Kdenlive remains set to: $kdenlive"
|
echo "ZANEYOS is false"
|
||||||
fi
|
fi
|
||||||
}
|
else
|
||||||
|
echo "Too many arguments. Please provide one argument."
|
||||||
# Call the toggle function
|
fi
|
||||||
toggle_kdenlive
|
|
||||||
''
|
''
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
# Bootloader
|
# Bootloader
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
boot.kernel.sysctl = { "vm.max_map_count" = 2147483642; };
|
||||||
|
|
||||||
# This is for OBS Virtual Cam Support - v4l2loopback setup
|
# This is for OBS Virtual Cam Support - v4l2loopback setup
|
||||||
boot.kernelModules = [ "v4l2loopback" ];
|
boot.kernelModules = [ "v4l2loopback" ];
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
{ config, lib, ... }:
|
{ pkgs, config, lib, ... }:
|
||||||
|
|
||||||
let inherit (import ../../options.nix) flatpak; in
|
let inherit (import ../../options.nix) flatpak; in
|
||||||
lib.mkIf (flatpak == true) {
|
lib.mkIf (flatpak == true) {
|
||||||
services.flatpak.enable = true;
|
services.flatpak.enable = true;
|
||||||
|
|
||||||
|
systemd.services.flatpak-repo = {
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
path = [ pkgs.flatpak ];
|
||||||
|
script = ''
|
||||||
|
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||||
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,8 @@ in {
|
|||||||
wallpaperDir = "${userHome}/Pictures/Wallpapers";
|
wallpaperDir = "${userHome}/Pictures/Wallpapers";
|
||||||
screenshotDir = "${userHome}/Pictures/Screenshots";
|
screenshotDir = "${userHome}/Pictures/Screenshots";
|
||||||
flakeDir = "${flakeDir}";
|
flakeDir = "${flakeDir}";
|
||||||
|
flakePrev = "${userHome}/.zaneyos-previous";
|
||||||
|
flakeBackup = "${userHome}/.zaneyos-backup";
|
||||||
terminal = "alacritty"; # This sets the terminal that is used by the hyprland terminal keybinding
|
terminal = "alacritty"; # This sets the terminal that is used by the hyprland terminal keybinding
|
||||||
|
|
||||||
# System Settings
|
# System Settings
|
||||||
|
Loading…
x
Reference in New Issue
Block a user