FROM registry.fedoraproject.org/fedora-bootc:44

#Ajout du dépot mullvad
RUN curl -fsSL https://repository.mullvad.net/rpm/stable/mullvad.repo -o /etc/yum.repos.d/mullvad.repo

#Install de gnome avec support hardware + Podman + Cups + Vulkan driver + Plymouth + dev tools + divers utilitaires
RUN dnf install -y \
    @kde-desktop-environment \
    @hardware-support \
    @development-tools \
    @multimedia \
    vulkan-tools \
    mesa-vulkan-drivers \
	mesa-vulkan-drivers.i686 \
	vulkan-loader \
	vulkan-loader.i686 \
    vulkan-tools \
    glibc-langpack-fr \
    langpacks-core-fr \
    langpacks-fr \
    distrobox \
    buildah \
    podman \
    docker-cli \
    rsync \
    mullvad-vpn \
    plasma-login-manager \
    kcm-plasmalogin \
    podman-compose \
    fuse-overlayfs \
    cups \
    cups-pdf \
    jq \
    plymouth \
    plymouth-system-theme \
    plymouth-plugin-label \
    plymouth-plugin-fade-throbber \
    wget \
    kernel-modules \
    kernel-modules-extra \
    SDL2 \
    evtest \
    libusb \
    usbutils \
    gstreamer1 \
    gstreamer1-plugins-base \
    gstreamer1-vaapi \
    ffmpeg \
    && dnf remove -y sddm snapshot PackageKit PackageKit-gstreamer-plugin PackageKit-command-not-found toolbox || true \
    && dnf install -y flatpak \
    && dnf clean all \
    && rm -rf /var/cache/dnf

#Installation de Filen Desktop
RUN wget https://cdn.filen.io/@filen/desktop/release/latest/Filen_linux_x86_64.rpm -O /tmp/filen.rpm \
    && dnf install -y /tmp/filen.rpm \
    && rm -f /tmp/filen.rpm

#Installation de starship
RUN curl -sS https://starship.rs/install.sh | sh -s -- -y

#Installation des polices FiraMono Nerd Font
RUN mkdir -p /usr/share/fonts/firamono-nerd && \
    cd /usr/share/fonts/firamono-nerd && \
    wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/FiraMono.zip && \
    unzip FiraMono.zip && \
    rm FiraMono.zip && \
    fc-cache -fv

#Configuration de starship pour tous les utilisateurs
RUN echo 'eval "$(starship init bash)"' >> /etc/bashrc

#Configuration par défaut de starship pour tous les utilisateurs
RUN mkdir -p /etc/skel/.config && \
    starship preset nerd-font-symbols -o /etc/skel/.config/starship.toml

#Langue FR par défaut + Fuse userns + Timezone Paris
RUN echo "LANG=fr_FR.UTF-8" > /etc/locale.conf \
    && echo "KEYMAP=fr" > /etc/vconsole.conf \
    && ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime \
    && echo "user.max_user_namespaces=28633" > /etc/sysctl.d/userns.conf

#Activation du module xpad pour support manette xbox
RUN echo "xpad" > /etc/modules-load.d/xpad.conf

#Ajout de flathub
RUN flatpak remote-add --if-not-exists --system flathub https://dl.flathub.org/repo/flathub.flatpakrepo || true

#Activation du service flatpak-first-boot
COPY services/flatpak-first-boot.service /etc/systemd/system/flatpak-first-boot.service
RUN systemctl enable flatpak-first-boot.service

#Définir le target graphique par défaut
RUN systemctl set-default graphical.target

#Activation des services + Desactivation de bootc-update automatique
RUN systemctl preset-all && \
    systemctl enable --force plasmalogin.service NetworkManager.service bluetooth.service podman.socket cups.service mullvad-daemon.service && \
    systemctl mask bootc-fetch-apply-updates.timer
