flatpak service
This commit is contained in:
parent
7eb6780a58
commit
1511f0cd92
3 changed files with 90 additions and 1 deletions
79
guix-config/home/services/flatpak.scm
Normal file
79
guix-config/home/services/flatpak.scm
Normal file
|
|
@ -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>
|
||||||
|
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.")))
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
#:use-module (gnu packages games)
|
#:use-module (gnu packages games)
|
||||||
#:use-module (gnu packages xdisorg)
|
#:use-module (gnu packages xdisorg)
|
||||||
#:use-module (gnu packages monitoring)
|
#:use-module (gnu packages monitoring)
|
||||||
|
#:use-module (gnu packages video)
|
||||||
#:use-module (gnu services)
|
#:use-module (gnu services)
|
||||||
#:use-module (guix gexp)
|
#:use-module (guix gexp)
|
||||||
#:use-module (gnu home services shells)
|
#:use-module (gnu home services shells)
|
||||||
|
|
@ -32,6 +33,7 @@
|
||||||
#:use-module (gnu home services desktop)
|
#:use-module (gnu home services desktop)
|
||||||
#:use-module (guix-config packages emacs)
|
#:use-module (guix-config packages emacs)
|
||||||
#:use-module (guix-config home services emacs)
|
#:use-module (guix-config home services emacs)
|
||||||
|
#:use-module (guix-config home services flatpak)
|
||||||
#:use-module (guix-config home services secretsd)
|
#:use-module (guix-config home services secretsd)
|
||||||
#:use-module (gnu home services niri))
|
#:use-module (gnu home services niri))
|
||||||
|
|
||||||
|
|
@ -44,6 +46,10 @@
|
||||||
fastfetch
|
fastfetch
|
||||||
librewolf
|
librewolf
|
||||||
icecat
|
icecat
|
||||||
|
vlc
|
||||||
|
font-google-noto-emoji
|
||||||
|
font-openmoji
|
||||||
|
|
||||||
;birdtray
|
;birdtray
|
||||||
nextcloud-client
|
nextcloud-client
|
||||||
nautilus
|
nautilus
|
||||||
|
|
@ -88,6 +94,9 @@
|
||||||
(home-dotfiles-configuration
|
(home-dotfiles-configuration
|
||||||
(directories '("../../files"))))
|
(directories '("../../files"))))
|
||||||
(service home-secretsd-service-type)
|
(service home-secretsd-service-type)
|
||||||
|
(service home-flatpak-service-type
|
||||||
|
(home-flatpak-configuration
|
||||||
|
(apps '("in.cinny.Cinny"))))
|
||||||
(service home-emacs-service-type
|
(service home-emacs-service-type
|
||||||
(home-emacs-configuration
|
(home-emacs-configuration
|
||||||
(emacs guixmacs)
|
(emacs guixmacs)
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#:use-module (gnu)
|
#:use-module (gnu)
|
||||||
#:use-module (gnu services dbus)
|
#:use-module (gnu services dbus)
|
||||||
#:use-module (gnu packages cups)
|
#:use-module (gnu packages cups)
|
||||||
|
#:use-module (gnu packages video)
|
||||||
#:use-module (guix)
|
#:use-module (guix)
|
||||||
#:export (base-system))
|
#:export (base-system))
|
||||||
|
|
||||||
|
|
@ -59,7 +60,7 @@
|
||||||
%base-user-accounts))
|
%base-user-accounts))
|
||||||
|
|
||||||
;; Globally-installed packages.
|
;; 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
|
;; Below is the list of system services. To search for available
|
||||||
;; services, run 'guix system search KEYWORD' in a terminal.
|
;; services, run 'guix system search KEYWORD' in a terminal.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue