Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

Declarative flatpaks

Declaratively manage Flatpak installations in NixOS and your $HOME

[!IMPORTANT] The setup script performs changes in a transaction. Errors cause the transaction to fail immediately. Only successful transactions get applied. Therefore, it may take a while until your changes take effect!

[!WARNING] The home-manager module assumes that flatpak is usable on your system. If this is not the case, do not bug report.

[!CAUTION] Expect at least a 2x storage usage increase. This module attempts to optimize storage space use through reflinks, these require a filesystem capable of Copy-on-Write.

Also try https://github.com/gmodena/nix-flatpak

Versioning

Releases are done through git tags.

Setup

Inputs

Flakes

flake.nix

{
  inputs = {
    flatpaks.url = "github:in-a-dil-emma/declarative-flatpak/latest";
  };
}
npins

console

$ npins add github --name flatpaks in-a-dil-emma declarative-flatpak

Import in NixOS

Flakes

configuration.nix

{ flatpaks, ... }: {
  imports = [
    flatpaks.nixosModules.default
  ];
}
npins

configuration.nix

{ flatpaks, ... }: {
  imports = [
    (flatpaks + "/nixos")
  ];
}

Import in Home Manager (standalone or as a NixOS module)

Flakes

home.nix

{ flatpaks, ... }: {
  imports = [
    flatpaks.homeModules.default
  ];
}
npins

home.nix

{ flatpaks, ... }: {
  imports = [
    (flatpaks + "/home-manager")
  ];
}

Configuring

services → flatpak
OPTIONTYPEDEFAULT
enablebooleanfalse
preRemotesCommandstring or nullnull
preInstallCommandstring or nullnull
preSwitchCommandstring or nullnull
UNCHECKEDfinalizeCommandstring or nullnull
flatpakDirpath or nullNixOS: /var/lib/flatpak ;
Home-Manager: ${XDG_DATA_HOME}/flatpak
forceRunOnActivationbooleanfalse
onCalendarsystemd timeweekly

Caution:

UNCHECKEDfinalizeCommand will not cause the transaction to fail. This hook should only be used for commands you don't care about failing.

... → packages → list element

list element is a string, matching one of the following patterns:

  • {remote}:{type}/{ref}/[{arch}]/{branch}[:{commit}]
  • {remote}:{path}.flatpakref
  • :{path}.flatpak

Expressions in [angle brackets] may be omitted. Expressions in {curly brackets} must be substituted.

KEYSUBSTITUTION DESCRIPTION
remoteThe remote to fetch from.
typeRef type. Either app or runtime.
refRef ID used by flatpak.
archSystem architecture, in flatpak's format.
branchRef release branch.
commitUpdate to commit. Must be exactly 64 characters long.
pathA path that exists.
... → remotes → key-value pair
KEYVALUE
NameURL
... → overrides → key-value pair
KEYVALUE
FilenameSee https://docs.flatpak.org/en/latest/flatpak-command-reference.html#flatpak-metadata
Example configuration.
{
  services.flatpak = {
    enable = true;
    remotes = {
      "flathub" = "https://dl.flathub.org/repo/flathub.flatpakrepo";
      "flathub-beta" = "https://dl.flathub.org/beta-repo/flathub-beta.flatpakrepo";
    };
    packages = [
      "flathub:app/org.kde.index//stable"
      "flathub-beta:app/org.kde.kdenlive/x86_64/stable"
      ":${./foobar.flatpak}"
      "flathub:/root/testflatpak.flatpakref"
    ];
    overrides = {
      # note: "global" is a flatpak thing
      # if you ever ran "flatpak override" without specifying a ref you will know
      "global".Context = {
        filesystems = [
          "home"
        ];
        sockets = [
          "!x11"
          "!fallback-x11"
        ];
      };
      "org.mozilla.Firefox" = {
        Environment = {
          "MOZ_ENABLE_WAYLAND" = 1;
        };
        Context.sockets = [
          "!wayland"
          "!fallback-x11"
          "x11"
        ];
      };
    };
  };
}

Please consult the module options for more information.

关于 About

Declaratively manage Flatpak installations in NixOS and your $HOME
declarative-flatpakflatpakhome-managerhome-manager-modulenixnix-flakesnixosnixos-modulenpinstransactional

语言 Languages

Nix99.8%
Shell0.2%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
73
Total Commits
峰值: 15次/周
Less
More

核心贡献者 Contributors