aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 3977d714e9cdd5de44f42584817c2a113b079b7c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# 🔒 `pia.nix`

> Private Internet Access VPN Configurations & CLI for NixOS

## Flake-based Installation

Add the `pia.nix` NixOS module to your system flake and configuration.

```nix
{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
  inputs.pia.url = "github:Fuwn/pia.nix";
  inputs.pia.inputs.nixpkgs.follows = "nixpkgs";

  outputs = { nixpkgs, pia, self }: {
    nixosConfigurations.yourConfiguration = nixpkgs.lib.nixosSystem {
      modules = [ pia.nixosModules."x86_64-linux".default ];
    };
  };
}
```

## Module Set-up

Configure `pia.nix` in your NixOS configuration through the `services.pia`
attribute set.

```nix
{ config, ... }: {
  services.pia.enable = true;
  services.pia.authUserPass.username = "hooty";
  services.pia.authUserPass.password = "hunter42";
}
```

## Usage

```sh
# List all available VPN regions
pia list

# List all available VPN regions with fuzzy search support
pia search

# Activate VPN in a specific region
pia start japan

# Uses `pia search` to activate VPN in a specific region
pia start

# Deactivate VPN in a specific region
pia stop japan

# Uses `pia search` to deactivate VPN in a specific region
pia stop
```

## Credits

This repository started off as a fork of [~rprospero/nixos-pia](https://git.sr.ht/~rprospero/nixos-pia),
which provided a starting point for populating OpenVPN with Private Internet
Access' VPN configurations.