vlaci / openconnect-sso

Wrapper script for OpenConnect supporting Azure AD (SAMLv2) authentication to Cisco SSL-VPNs
GNU General Public License v3.0
279 stars 119 forks source link

Added initial flake support #110

Closed jhol closed 1 year ago

jhol commented 1 year ago

Rebased from earlier flake branch. This branch reapplies nixpkgs-fmt code cleanup then cherry-picks the "nix: flake support".

The current state of flakes support is rather primitive. The nix code depends on packages from nixpkgs-unstable e.g. pyqt6. For now, users of stable nixpkgs should add the openconnect-sso overlay to nixpkgs-unstable, and combine it with the reset of their packages from nixpkgs-22.05.

Here is an example flake.nix for a NixOS system:

{
  inputs = {
    nixpkgs.url = "nixpkgs/nixos-22.05";
    nixpkgsUnstable.url = "nixpkgs/nixos-unstable";
    openconnect-sso.url = "/home/jholdsworth/Downloads/openconnect-sso";
  };

  outputs = { self, nixpkgs, nixpkgsUnstable, openconnect-sso }:
  let
    inherit (nixpkgs) lib;

    system = "x86_64-linux";

    pkgs = import nixpkgs {
      inherit system;
    };

    pkgsUnstable = import nixpkgsUnstable {
      inherit system;
      overlays = [ openconnect-sso.overlay ];
    };
  in {
    nixosConfigurations.sail = lib.nixosSystem {
      inherit system;

      modules = [
        {
          environment.systemPackages = [
            pkgsUnstable.openconnect-sso
            # Stable packages... 
            pkgs.hello
          ];

          # ...
      ];
    };
  };
}

After the release of nixpkgs-22.11, the usage of nixpkgs-unstable will no longer be necessary.