Regenerated

This commit is contained in:
2026-03-19 15:09:54 +00:00
parent 85ace71da9
commit 2c8a011ffb
29 changed files with 31 additions and 1530 deletions
+31 -15
View File
@@ -820,34 +820,48 @@ This will import all packages listed in ../../assets/system/apps/flatpaks.conf
{ lib, pkgs, config, ... }:
let
flatpakConfPath = ../../../assets/system/apps/flatpaks.conf;
moduleName = "flatpaks";
# Toggle for this module
enableProgram = config.enableFlatpaks or false;
# Path to your asset file
assetPath = ../../../assets/system/apps/flatpaks.conf;
# User fallback
username = config.defaultUser or "henrov";
# Optionally, map multiple files if you want
files = lib.genAttrs [ "flatpaks.conf" ] (name: {
src = assetPath;
});
in
{
# Top-level toggle
# Top-level toggle option
options.enableFlatpaks = lib.mkEnableOption "Enable automatic Flatpak installation";
# Config assignments
# Only apply configuration if enabled
config = lib.mkIf enableProgram {
# Use programs.flatpaks instead of myApps.flatpaks
programs.flatpaks = {
# Dendritic app data (no myApps container)
${moduleName} = {
enable = true;
user = config.defaultUser or "henrov";
assetsDir = flatpakConfPath;
files = []; # handled at runtime
user = username;
assetsDir = assetPath;
files = files;
};
# Deploy the conf file
environment.etc."flatpak/flatpaks.conf".source = flatpakConfPath;
# Deploy configuration file
environment.etc."flatpak/flatpaks.conf".source = assetPath;
# Enable system flatpak service
services.flatpak.enable = true;
xdg.portal.enable = true;
# Systemd service for installing listed flatpaks
systemd.services.flatpak-sync = {
description = "Install Flatpak apps listed in flatpaks.conf";
# Systemd service to install listed flatpaks
systemd.services."${moduleName}-sync" = {
description = "Install Flatpak apps listed in ${moduleName}.conf";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
@@ -856,12 +870,14 @@ in
Type = "oneshot";
ExecStart = ''
set -euo pipefail
CONF="${flatpakConfPath}"
CONF="${assetPath}"
# Ensure Flathub exists
if ! flatpak remotes --system --columns=name | grep -qx flathub; then
flatpak remote-add --system --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
fi
# Install apps listed in config
while IFS= read -r app || [ -n "$app" ]; do
app=$(echo "$app" | sed 's/#.*//;s/^[[:space:]]*//;s/[[:space:]]*$//')
if [ -n "$app" ]; then
@@ -873,7 +889,7 @@ in
'';
};
restartTriggers = [ flatpakConfPath ];
restartTriggers = [ assetPath ];
path = [ pkgs.flatpak pkgs.coreutils pkgs.gnugrep pkgs.gnused ];
};
};