diff --git a/guix-config/home/services/flatpak.scm b/guix-config/home/services/flatpak.scm new file mode 100644 index 0000000..7793dea --- /dev/null +++ b/guix-config/home/services/flatpak.scm @@ -0,0 +1,79 @@ +(define-module (guix-config home services flatpak) + #:use-module (gnu home services) + #:use-module (gnu home services utils) + #:use-module (gnu services) + #:use-module (gnu packages package-management) + #:use-module (guix gexp) + #:use-module (guix records) + #:export (home-flatpak-configuration + home-flatpak-service-type)) + +;; Configuration record +(define-record-type* + home-flatpak-configuration make-home-flatpak-configuration + home-flatpak-configuration? + (flatpak-package home-flatpak-configuration-flatpak-package + (default flatpak)) + (remotes home-flatpak-configuration-remotes + (default '(("flathub" . "https://flathub.org/repo/flathub.flatpakrepo")))) + (apps home-flatpak-configuration-apps (default '()))) + +;; Service type +(define (home-flatpak-activation config) + #~(begin + (use-modules (ice-9 popen) (ice-9 rdelim) (srfi srfi-1)) + + (define (run cmd) + (format #t "Running: ~a~%" cmd) + (system* "bash" "-c" cmd)) + + ;; Add remotes if missing + (for-each + (lambda (pair) + (let ((name (car pair)) + (url (cdr pair))) + (run (string-append + "flatpak remote-add --user --if-not-exists " + name " " url)))) + '#$(home-flatpak-configuration-remotes config)) + + ;; Install apps + (for-each + (lambda (app) + (run (string-append "flatpak install -y --user " app))) + '#$(home-flatpak-configuration-apps config)))) + +(define (home-flatpak-service config) + (list + ;; 1. Ensure flatpak installed + (simple-service + 'flatpak-packages + home-profile-service-type + (list (home-flatpak-configuration-flatpak-package config))) + + ;; 2. Add flatpak apps to XDG_DATA_DIRS + ;; https://forum.systemcrafters.net/t/gnome-software-center-flatpak-support/1702/3 + (simple-service + 'flatpak-env + home-shell-profile-service-type + (list (local-file + (string-append (getenv "HOME") "/.guix-profile/etc/profile.d/flatpak.sh") + "flatpak.sh"))) + + + ;; 3. Activation phase + (simple-service + 'flatpak-activation + home-activation-service-type + (home-flatpak-activation config)))) + +(define home-flatpak-service-type + (service-type + (name 'home-flatpak) + (extensions + (list (service-extension home-profile-service-type + (compose list home-flatpak-configuration-flatpak-package)) + (service-extension home-activation-service-type + home-flatpak-activation))) + (default-value (home-flatpak-configuration)) + (description "Set up Flatpak with user remotes and apps."))) diff --git a/guix-config/home/workstation.scm b/guix-config/home/workstation.scm index bcc453f..110667e 100644 --- a/guix-config/home/workstation.scm +++ b/guix-config/home/workstation.scm @@ -24,6 +24,7 @@ #:use-module (gnu packages games) #:use-module (gnu packages xdisorg) #:use-module (gnu packages monitoring) + #:use-module (gnu packages video) #:use-module (gnu services) #:use-module (guix gexp) #:use-module (gnu home services shells) @@ -32,6 +33,7 @@ #:use-module (gnu home services desktop) #:use-module (guix-config packages emacs) #:use-module (guix-config home services emacs) + #:use-module (guix-config home services flatpak) #:use-module (guix-config home services secretsd) #:use-module (gnu home services niri)) @@ -44,6 +46,10 @@ fastfetch librewolf icecat + vlc + font-google-noto-emoji + font-openmoji + ;birdtray nextcloud-client nautilus @@ -88,6 +94,9 @@ (home-dotfiles-configuration (directories '("../../files")))) (service home-secretsd-service-type) + (service home-flatpak-service-type + (home-flatpak-configuration + (apps '("in.cinny.Cinny")))) (service home-emacs-service-type (home-emacs-configuration (emacs guixmacs) diff --git a/guix-config/system/base-system.scm b/guix-config/system/base-system.scm index 87e67eb..bee9079 100644 --- a/guix-config/system/base-system.scm +++ b/guix-config/system/base-system.scm @@ -3,6 +3,7 @@ #:use-module (gnu) #:use-module (gnu services dbus) #:use-module (gnu packages cups) + #:use-module (gnu packages video) #:use-module (guix) #:export (base-system)) @@ -59,7 +60,7 @@ %base-user-accounts)) ;; Globally-installed packages. - ; (packages (cons %base-packages)) + (packages (cons intel-vaapi-driver %base-packages)) ;; Below is the list of system services. To search for available ;; services, run 'guix system search KEYWORD' in a terminal.