diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 50323f0dd8881..097fe86585ed5 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -254,6 +254,7 @@ ./programs/lazygit.nix ./programs/less.nix ./programs/liboping.nix + ./programs/librepods.nix ./programs/light.nix ./programs/localsend.nix ./programs/mdevctl.nix diff --git a/nixos/modules/programs/librepods.nix b/nixos/modules/programs/librepods.nix new file mode 100644 index 0000000000000..c354f08fce69d --- /dev/null +++ b/nixos/modules/programs/librepods.nix @@ -0,0 +1,38 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.programs.librepods; +in +{ + options = { + programs.librepods = { + enable = lib.mkOption { + default = false; + type = lib.types.bool; + description = '' + Whether to configure system to enable librepods. + To grant access to a user, it must be part of librepods group: + `users.users.alice.extraGroups = ["librepods"];` + ''; + }; + }; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ librepods ]; + users.groups.librepods = { }; + + security.wrappers.librepods = { + source = lib.getExe pkgs.librepods; + capabilities = "cap_net_admin+ep"; + owner = "root"; + group = "librepods"; + }; + }; + + meta.maintainers = [ lib.maintainers.Cameo007 ]; +} diff --git a/pkgs/by-name/li/librepods/package.nix b/pkgs/by-name/li/librepods/package.nix new file mode 100644 index 0000000000000..a171c18642955 --- /dev/null +++ b/pkgs/by-name/li/librepods/package.nix @@ -0,0 +1,48 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + qt6, + pulseaudio, +}: +stdenv.mkDerivation (finalAttrs: { + pname = "librepods"; + version = "0.2.0-alpha"; + + src = fetchFromGitHub { + owner = "kavishdevar"; + repo = "librepods"; + tag = "v${finalAttrs.version}"; + hash = "sha256-pD/Jb/wV91RlsiGl3SnGvQ11GNX37Y//CQHpIRyM/58="; + }; + + nativeBuildInputs = [ + cmake + qt6.wrapQtAppsHook + ]; + + buildInputs = [ + qt6.qtbase + qt6.qtconnectivity + qt6.qtmultimedia + ]; + + sourceRoot = "${finalAttrs.src.name}/linux"; + + postPatch = '' + substituteInPlace autostartmanager.hpp --replace-fail "QString appPath = QCoreApplication::applicationFilePath();" "QString appPath = \"$out/bin/librepods\";" + ''; + + qtWrapperArgs = [ ''--prefix PATH : ${lib.makeBinPath [ pulseaudio ]}'' ]; + + meta = { + description = "AirPods libreated from Apple’s ecosystem"; + homepage = "https://github.com/kavishdevar/librepods"; + changelog = "https://github.com/kavishdevar/librepods/releases/tag/${finalAttrs.src.tag}"; + license = lib.licenses.agpl3Only; + maintainers = with lib.maintainers; [ Cameo007 ]; + mainProgram = "librepods"; + platforms = lib.platforms.linux; + }; +})