feat: add host-aligned NixOS module (#652)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Kevin Yueandgithub-actions[bot] authored and GitHub committed 2026-09-01 09:47:01 +08:00
1 parent 87f91e3c13
commit 8eb4d48887
5 files changed
+186 -28

No files matched your search

+50 -7
View File
@@ -20,13 +20,10 @@
nixpkgs,
rust-overlay,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
mkPackageSet =
pkgs:
let
pkgs = (import nixpkgs) {
inherit system;
overlays = [ (import rust-overlay) ];
};
inherit (pkgs) lib;
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
@@ -399,6 +396,49 @@
'';
};
in
{
inherit fromSource prebuilt;
};
nixosModule =
{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.globalprotect-openconnect;
in
{
options.programs.globalprotect-openconnect = {
enable = lib.mkEnableOption "GlobalProtect-openconnect";
package = lib.mkOption {
type = lib.types.package;
# Use the NixOS module's package set so WebKit and graphics
# dependencies match the rest of the system.
default = (mkPackageSet pkgs).prebuilt;
description = "GlobalProtect-openconnect package to install.";
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
services.ayatana-indicators.enable = lib.mkDefault true;
};
};
in
(flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = (import nixpkgs) {
inherit system;
overlays = [ (import rust-overlay) ];
};
inherit (pkgs) lib;
inherit (mkPackageSet pkgs) fromSource prebuilt;
in
{
# For `nix build`
packages = {
@@ -425,5 +465,8 @@
];
};
}
);
))
// {
nixosModules.default = nixosModule;
};
}