refactor: modularize flatpak and make roblox an option

This commit is contained in:
Youwen Wu 2024-12-23 01:18:36 -08:00
parent 6414434a1e
commit ab0ccf2519
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
3 changed files with 71 additions and 32 deletions

View file

@ -2,12 +2,31 @@
# versioned. Therefore, they are not included in generational rollbacks and # versioned. Therefore, they are not included in generational rollbacks and
# persist between generations. This is not ideal, but at least it is a better # persist between generations. This is not ideal, but at least it is a better
# situation than imperative installation # situation than imperative installation
{ inputs, ... }: {
inputs,
config,
lib,
...
}:
let
cfg = config.liminalOS.programs.flatpaks;
in
{ {
imports = [ imports = [
inputs.nix-flatpak.nixosModules.nix-flatpak inputs.${cfg.moduleName}.nixosModules.nix-flatpak
]; ];
options.liminalOS.programs.flatpaks = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to enable Nix flatpak support with some fixes as well as declarative flatpak management.
'';
};
};
config = lib.mkIf cfg.enable {
services.flatpak = { services.flatpak = {
enable = true; enable = true;
@ -30,16 +49,6 @@
enable = true; enable = true;
onCalendar = "weekly"; onCalendar = "weekly";
}; };
};
packages = [
{
flatpakref = "https://sober.vinegarhq.org/sober.flatpakref";
sha256 = "sha256:1pj8y1xhiwgbnhrr3yr3ybpfis9slrl73i0b1lc9q89vhip6ym2l";
}
{
appId = "org.vinegarhq.Sober";
origin = "sober";
}
];
}; };
} }

View file

@ -0,0 +1,10 @@
[Flatpak Ref]
Title=Sober
Name=org.vinegarhq.Sober
Url=https://sober.vinegarhq.org/repo/
SuggestRemoteName=sober
Homepage=https://sober.vinegarhq.org
Icon=https://sober.vinegarhq.org/sober.svg
RuntimeRepo=https://dl.flathub.org/repo/flathub.flatpakrepo
IsRuntime=false
GPGKey=LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgptUUdOQkdhc3U4QUJEQURUQzExYjFmUG9LZU9Ea1hTT3lrYzllajRZeFZMSlZQN2NFZmRnV05aWllsYnFsZ0xECms2MTNx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ming = {
enable = lib.mkEnableOption "gaming"; enable = lib.mkEnableOption "gaming";
withHamachi = lib.mkEnableOption "hamachi"; utilities.hamachi.enable = lib.mkEnableOption "hamachi";
roblox.enable = lib.mkOption {
type = lib.types.bool;
default = config.liminalOS.extras.gaming && cfg.enable;
description = ''
Whether to install the Roblox Sober flatpak automatically. Note that this will enable the nix-flatpak service and automatic flatpak updates.`
'';
};
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -21,6 +28,19 @@ in
mangojuice mangojuice
]; ];
liminalOS.programs.flatpaks.enable = true;
services.flatpak.packages = lib.mkIf cfg.roblox.enable [
{
flatpakref = "https://sober.vinegarhq.org/sober.flatpakref";
sha256 = "sha256:1pj8y1xhiwgbnhrr3yr3ybpfis9slrl73i0b1lc9q89vhip6ym2l";
}
{
appId = "org.vinegarhq.Sober";
origin = "sober";
}
];
programs.steam = { programs.steam = {
enable = true; enable = true;
remotePlay.openFirewall = true; remotePlay.openFirewall = true;
@ -47,8 +67,8 @@ in
users.users.${config.liminalOS.username}.extraGroups = [ "gamemode" ]; users.users.${config.liminalOS.username}.extraGroups = [ "gamemode" ];
services.logmein-hamachi.enable = cfg.withHamachi; services.logmein-hamachi.enable = cfg.utilities.hamachi.enable;
programs.haguichi.enable = cfg.withHamachi; programs.haguichi.enable = cfg.utilities.hamachi.enable;
nixpkgs.config.packageOverrides = pkgs: { nixpkgs.config.packageOverrides = pkgs: {
steam = pkgs.steam.override { steam = pkgs.steam.override {