Compare commits

...

2 Commits

Author SHA1 Message Date
henrov c2dc15a6a2 Working on reshuffling 2026-03-19 13:16:42 +00:00
henrov fe6ee940e1 deleted generated files 2026-03-19 13:16:41 +00:00
2 changed files with 52 additions and 24 deletions
+26 -12
View File
@@ -778,43 +778,60 @@ This will import all packages listed in ./assets/system/apps/flatpaks.conf
let let
moduleName = "flatpaks"; moduleName = "flatpaks";
username = config.defaultUser or "henrov";
# Relative path for assets
flatpakConfPath = ./assets/system/apps/flatpaks.conf; flatpakConfPath = ./assets/system/apps/flatpaks.conf;
enableProgram = config.enableFlatpaks or false; enableProgram = config.enableFlatpaks or false;
in in
{ {
# Top-level toggle # Top-level toggle for this program
options.enableFlatpaks = lib.mkEnableOption "Enable automatic Flatpak installation"; options.enableFlatpaks = lib.mkEnableOption "Enable automatic Flatpak installation";
# Define myApps top-level option if it doesn't exist yet
options.myApps = lib.mkOption {
type = lib.types.attrsOf lib.types.any;
default = {};
description = "Top-level container for custom apps";
};
config = lib.mkIf enableProgram { config = lib.mkIf enableProgram {
# myApps container
myApps = { myApps = {
flatpaks = { flatpaks = {
enable = true; enable = true;
user = username;
assetsDir = flatpakConfPath; assetsDir = flatpakConfPath;
files = []; # don't read at evaluation files = []; # we handle parsing at runtime
user = config.defaultUser or "henrov";
}; };
}; };
# Deploy the conf file and systemd script # Deploy conf file
environment.etc."flatpak/flatpaks.conf".source = flatpakConfPath; environment.etc."flatpak/flatpaks.conf".source = flatpakConfPath;
# Enable flatpak service
services.flatpak.enable = true;
xdg.portal.enable = true;
# Systemd service for installing listed flatpaks
systemd.services.flatpak-sync = { systemd.services.flatpak-sync = {
description = "Install Flatpak apps listed in flatpaks.conf"; description = "Install Flatpak apps listed in flatpaks.conf";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ]; wants = [ "network-online.target" ];
after = [ "network-online.target" ]; after = [ "network-online.target" ];
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
ExecStart = '' ExecStart = ''
set -euo pipefail set -euo pipefail
CONF="${flatpakConfPath}" CONF="${flatpakConfPath}"
# Add flathub if missing
if ! flatpak remotes --system --columns=name | grep -qx flathub; then 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 flatpak remote-add --system --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
fi fi
# Install apps listed in conf
while read -r app; do while read -r app; do
app=$(echo "$app" | sed 's/#.*//;s/^[[:space:]]*//;s/[[:space:]]*$//') app=$(echo "$app" | sed 's/#.*//;s/^[[:space:]]*//;s/[[:space:]]*$//')
if [[ -n "$app" ]]; then if [[ -n "$app" ]]; then
@@ -835,9 +852,6 @@ in
pkgs.gnused pkgs.gnused
]; ];
}; };
services.flatpak.enable = true;
xdg.portal.enable = true;
}; };
} }
#+END_SRC #+END_SRC
+26 -12
View File
@@ -2,43 +2,60 @@
let let
moduleName = "flatpaks"; moduleName = "flatpaks";
username = config.defaultUser or "henrov";
# Relative path for assets
flatpakConfPath = ./assets/system/apps/flatpaks.conf; flatpakConfPath = ./assets/system/apps/flatpaks.conf;
enableProgram = config.enableFlatpaks or false; enableProgram = config.enableFlatpaks or false;
in in
{ {
# Top-level toggle # Top-level toggle for this program
options.enableFlatpaks = lib.mkEnableOption "Enable automatic Flatpak installation"; options.enableFlatpaks = lib.mkEnableOption "Enable automatic Flatpak installation";
# Define myApps top-level option if it doesn't exist yet
options.myApps = lib.mkOption {
type = lib.types.attrsOf lib.types.any;
default = {};
description = "Top-level container for custom apps";
};
config = lib.mkIf enableProgram { config = lib.mkIf enableProgram {
# myApps container
myApps = { myApps = {
flatpaks = { flatpaks = {
enable = true; enable = true;
user = username;
assetsDir = flatpakConfPath; assetsDir = flatpakConfPath;
files = []; # don't read at evaluation files = []; # we handle parsing at runtime
user = config.defaultUser or "henrov";
}; };
}; };
# Deploy the conf file and systemd script # Deploy conf file
environment.etc."flatpak/flatpaks.conf".source = flatpakConfPath; environment.etc."flatpak/flatpaks.conf".source = flatpakConfPath;
# Enable flatpak service
services.flatpak.enable = true;
xdg.portal.enable = true;
# Systemd service for installing listed flatpaks
systemd.services.flatpak-sync = { systemd.services.flatpak-sync = {
description = "Install Flatpak apps listed in flatpaks.conf"; description = "Install Flatpak apps listed in flatpaks.conf";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ]; wants = [ "network-online.target" ];
after = [ "network-online.target" ]; after = [ "network-online.target" ];
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
ExecStart = '' ExecStart = ''
set -euo pipefail set -euo pipefail
CONF="${flatpakConfPath}" CONF="${flatpakConfPath}"
# Add flathub if missing
if ! flatpak remotes --system --columns=name | grep -qx flathub; then 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 flatpak remote-add --system --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
fi fi
# Install apps listed in conf
while read -r app; do while read -r app; do
app=$(echo "$app" | sed 's/#.*//;s/^[[:space:]]*//;s/[[:space:]]*$//') app=$(echo "$app" | sed 's/#.*//;s/^[[:space:]]*//;s/[[:space:]]*$//')
if [[ -n "$app" ]]; then if [[ -n "$app" ]]; then
@@ -59,8 +76,5 @@ in
pkgs.gnused pkgs.gnused
]; ];
}; };
services.flatpak.enable = true;
xdg.portal.enable = true;
}; };
} }