From 128a9be453b10cfd5893ddf55014b0be73eb2318 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 31 Oct 2026 16:32:29 -0400 Subject: [PATCH] Add a role for flatpak. --- nix/configuration/configuration.nix | 1 + nix/configuration/hosts/odo/default.nix | 1 + nix/configuration/roles/flatpak/default.nix | 62 +++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 nix/configuration/roles/flatpak/default.nix diff --git a/nix/configuration/configuration.nix b/nix/configuration/configuration.nix index 8166dcf..389c6a4 100644 --- a/nix/configuration/configuration.nix +++ b/nix/configuration/configuration.nix @@ -36,6 +36,7 @@ in ./roles/ecc ./roles/emacs ./roles/emulate_isa + ./roles/flatpak ./roles/esim ./roles/exfat ./roles/firefox diff --git a/nix/configuration/hosts/odo/default.nix b/nix/configuration/hosts/odo/default.nix index c879c83..4613588 100644 --- a/nix/configuration/hosts/odo/default.nix +++ b/nix/configuration/hosts/odo/default.nix @@ -98,6 +98,7 @@ me.exfat.enable = true; me.firefox.enable = true; me.firewall.enable = true; + me.flatpak.enable = true; me.flux.enable = true; me.font.enable = true; me.gcloud.enable = true; diff --git a/nix/configuration/roles/flatpak/default.nix b/nix/configuration/roles/flatpak/default.nix new file mode 100644 index 0000000..e24c542 --- /dev/null +++ b/nix/configuration/roles/flatpak/default.nix @@ -0,0 +1,62 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + imports = [ ]; + + options.me = { + flatpak.enable = lib.mkOption { + type = lib.types.bool; + default = false; + example = true; + description = "Whether we want to install flatpak."; + }; + }; + + config = lib.mkIf config.me.flatpak.enable { + services.flatpak.enable = true; + + environment.persistence."/persist" = lib.mkIf (config.me.mountPersistence) { + hideMounts = true; + + directories = [ + { + directory = "/var/lib/flatpak"; + user = "root"; + group = "root"; + mode = "0755"; + } + ]; + + users.talexander = { + directories = [ + { + # User-specific configuration. + directory = ".local/share/flatpak"; + user = "talexander"; + group = "talexander"; + mode = "0755"; + } + { + # App data + directory = ".var/app"; + user = "talexander"; + group = "talexander"; + mode = "0755"; + } + { + # Flatpak Lutris installs + directory = "Games"; + user = "talexander"; + group = "talexander"; + mode = "0755"; + } + ]; + }; + }; + }; +}