flatpak: enabled flatpak for castle

This commit is contained in:
Tigor Hutasuhut 2024-09-02 09:38:57 +07:00
parent 126fd41dec
commit ae0b053444
9 changed files with 55 additions and 57 deletions

View file

@ -420,6 +420,21 @@
"type": "github" "type": "github"
} }
}, },
"nix-flatpak": {
"locked": {
"lastModified": 1721549352,
"narHash": "sha256-nlXJa8RSOX0kykrIYW33ukoHYq+FOSNztHLLgqKwOp8=",
"owner": "gmodena",
"repo": "nix-flatpak",
"rev": "dbce39ea8664820ba9037caaf1e2fad365ed6b4b",
"type": "github"
},
"original": {
"owner": "gmodena",
"repo": "nix-flatpak",
"type": "github"
}
},
"nix-index-database": { "nix-index-database": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -539,6 +554,7 @@
"hyprland": "hyprland", "hyprland": "hyprland",
"hyprland-contrib": "hyprland-contrib", "hyprland-contrib": "hyprland-contrib",
"neovim-nightly-overlay": "neovim-nightly-overlay", "neovim-nightly-overlay": "neovim-nightly-overlay",
"nix-flatpak": "nix-flatpak",
"nix-index-database": "nix-index-database", "nix-index-database": "nix-index-database",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_3",
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",

View file

@ -18,6 +18,7 @@
neovim-nightly-overlay = { neovim-nightly-overlay = {
url = "github:nix-community/neovim-nightly-overlay"; url = "github:nix-community/neovim-nightly-overlay";
}; };
nix-flatpak.url = "github:gmodena/nix-flatpak";
hyprland-contrib = { hyprland-contrib = {
url = "github:hyprwm/contrib"; url = "github:hyprwm/contrib";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -51,11 +52,13 @@
, neovim-nightly-overlay , neovim-nightly-overlay
, nix-index-database , nix-index-database
, rust-overlay , rust-overlay
, nix-flatpak
, ... , ...
}: }:
let let
commonModules = [ commonModules = [
nur.nixosModules.nur nur.nixosModules.nur
nix-flatpak.nixosModules.nix-flatpak
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
nix-index-database.nixosModules.nix-index nix-index-database.nixosModules.nix-index
{ {

View file

@ -8,6 +8,7 @@
./services.nix ./services.nix
./games.nix ./games.nix
./environments.nix ./environments.nix
./flatpak.nix
]; ];
options.profile = { options.profile = {
@ -63,7 +64,6 @@
android.enable = lib.mkEnableOption "android"; android.enable = lib.mkEnableOption "android";
avahi.enable = lib.mkEnableOption "avahi"; avahi.enable = lib.mkEnableOption "avahi";
bluetooth.enable = lib.mkEnableOption "bluetooth"; bluetooth.enable = lib.mkEnableOption "bluetooth";
flatpak.enable = lib.mkEnableOption "flatpak";
gnome.enable = lib.mkEnableOption "gnome"; gnome.enable = lib.mkEnableOption "gnome";
kde.enable = lib.mkEnableOption "kde"; kde.enable = lib.mkEnableOption "kde";
networking.firewall = { networking.firewall = {

10
options/flatpak.nix Normal file
View file

@ -0,0 +1,10 @@
{ lib, ... }:
let
inherit (lib) mkEnableOption;
in
{
options.profile.flatpak = {
enable = mkEnableOption "flatpak";
zen-browser.enable = mkEnableOption "zen-browser";
};
}

View file

@ -75,6 +75,11 @@ in
dbeaver.enable = true; dbeaver.enable = true;
kde.enable = false; kde.enable = false;
flatpak = {
enable = true;
zen-browser.enable = true;
};
microsoft-edge.enable = true; microsoft-edge.enable = true;
nextcloud.enable = false; nextcloud.enable = false;

View file

@ -3,6 +3,7 @@
imports = [ imports = [
profile-path profile-path
hardware-configuration hardware-configuration
./flatpak
./modules ./modules
./services ./services
./podman ./podman

View file

@ -0,0 +1,19 @@
{ config, lib, ... }:
let
cfg = config.profile.flatpak;
inherit (lib.lists) optional;
in
{
config = lib.mkIf cfg.enable {
fonts.fontDir.enable = true;
services.flatpak = {
enable = true;
update.auto = {
enable = true;
onCalendar = "weekly"; # Default value
};
packages = [ ]
++ optional cfg.zen-browser.enable "io.github.zen_browser.zen";
};
};
}

View file

@ -7,7 +7,6 @@
./bluetooth.nix ./bluetooth.nix
./boot_loader.nix ./boot_loader.nix
./brightnessctl.nix ./brightnessctl.nix
./flatpak.nix
./font.nix ./font.nix
./gnome.nix ./gnome.nix
./hyprland.nix ./hyprland.nix

View file

@ -1,55 +0,0 @@
{ config, pkgs, lib, ... }:
let
cfg = config.profile.flatpak;
in
{
config = lib.mkIf cfg.enable {
# Allow flatpak to access fonts
fonts.fontDir.enable = true;
services.flatpak.enable = true;
# system.fsPackages = [ pkgs.bindfs ];
# Allows user installed fonts to be accessed by flatpak
# fileSystems =
# let
# mkRoSymBind = path: {
# device = path;
# fsType = "fuse.bindfs";
# options = [ "ro" "resolve-symlinks" "x-gvfs-hide" ];
# };
# aggregatedFonts = pkgs.buildEnv {
# name = "system-fonts";
# paths = config.fonts.packages;
# pathsToLink = [ "/share/fonts" ];
# };
# in
# {
# # Create an FHS mount to support flatpak host icons/fonts
# "/usr/share/icons" = mkRoSymBind (config.system.path + "/share/icons");
# "/usr/share/fonts" = mkRoSymBind (aggregatedFonts + "/share/fonts");
# };
xdg.portal = {
enable = true;
xdgOpenUsePortal = true;
# extraPortals = with pkgs; [
# # xdg-desktop-portal-gtk
# # xdg-desktop-portal-kde
# # xdg-desktop-portal-gnome
# ];
};
# Auto update flatpak every boot with systemd
# systemd.services.flatpak-update = {
# wantedBy = [ "multi-user.target" ];
# after = [ "network-online.target" ];
# wants = [ "network-online.target" ];
# description = "Auto update flatpak every boot after network is online";
# serviceConfig = {
# Type = "oneshot";
# ExecStart = ''${pkgs.flatpak}/bin/flatpak update --assumeyes --noninteractive --system'';
# };
# };
};
}