Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions doc/install-nixos.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build compiles everything: the dependency build is kept in the local
Nix store and reused, so following the repository rebuilds just the
ReFineID crates.

## Fresh machine, shortest path
## Fresh machine, shortest path (not recommended)

Add to `/etc/nixos/configuration.nix`:

Expand All @@ -20,10 +20,12 @@ Add to `/etc/nixos/configuration.nix`:
((builtins.getFlake "github:ReFineID/ReFineID-Unix").nixosModules.default)
];
programs.refineid.enable = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Keep the dependency build in the store across garbage collection,
# so updates never recompile more than the ReFineID crates.
nix.settings.keep-outputs = true;
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
# Keep the dependency build in the store across garbage collection,
# so updates never recompile more than the ReFineID crates.
keep-outputs = true;
};
```

Browser card login needs `programs.firefox.enable = true;` -- already
Expand Down Expand Up @@ -70,8 +72,8 @@ system configuration).

## 1. System-wide install (recommended)

Works on any NixOS 26.05 or newer with flakes enabled. Flakes are on
by default on recent installs; if not, add to
Works on any NixOS 26.05 or newer with flakes enabled.
If flakes are not enabled, add to
`/etc/nixos/configuration.nix`:

```nix
Expand All @@ -86,7 +88,10 @@ Add the input and the module to your system flake:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
refineid.url = "github:ReFineID/ReFineID-Unix";
refineid = {
url = "github:ReFineID/ReFineID-Unix";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { nixpkgs, refineid, ... }: {
Expand Down Expand Up @@ -129,7 +134,7 @@ in
`fetchTarball`.) Then:

```sh
sudo nixos-rebuild switch
sudo NIX_CONFIG="experimental-features = nix-command flakes" nixos-rebuild switch
```

### What the option does
Expand Down Expand Up @@ -177,14 +182,16 @@ rest lives in that user's profile. In `/etc/nixos/configuration.nix`:

```nix
services.pcscd.enable = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.settings.keep-outputs = true;
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
keep-outputs = true;
};
```

then, as the user:

```sh
nix profile install github:ReFineID/ReFineID-Unix
nix profile add github:ReFineID/ReFineID-Unix
```

That user gets the `refineid` CLI and the GUI, application-menu
Expand Down
38 changes: 10 additions & 28 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
};

outputs =
{ self, nixpkgs, crane }:
{
self,
nixpkgs,
crane,
}:
let
systems = [
"x86_64-linux"
Expand All @@ -24,37 +28,15 @@
default = refineid;
});

nixosModules.refineid = import ./nix/module.nix { refineidPackage = packageFor; };
nixosModules.default = self.nixosModules.refineid;
nixosModules = {
refineid = import ./nix/module.nix { refineidPackage = packageFor; };
default = self.nixosModules.refineid;
};

overlays.default = final: prev: { refineid = packageFor final; };

devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
inputsFrom = [ (packageFor pkgs) ];
packages = with pkgs; [
clippy
rustfmt
pcsc-tools # pcsc_scan for reader debugging
opensc # pkcs11-tool for module debugging
nss.tools # tstclnt/certutil/modutil for the hardware cert-auth rig
];
# The GUI dlopens the windowing/GL stack; a dev build has no
# baked rpath, so provide the libraries via the environment.
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (
with pkgs;
[
libGL
libxkbcommon
wayland
gtk3
libx11
libxcursor
libxi
libxrandr
]
);
};
default = import ./shell.nix { inherit pkgs; };
});
};
}
7 changes: 2 additions & 5 deletions nix/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@ in

# System-wide p11-kit registration: OpenSSL (pkcs11-provider),
# GnuTLS, and OpenSSH discover the card through p11-kit.
environment.etc."pkcs11/modules/refineid.module".text = ''
module: ${cfg.package}/lib/librefineid_pkcs11.so
trust-policy: no
critical: no
'';
environment.etc."pkcs11/modules/refineid.module".source =
"${cfg.package}/share/p11-kit/modules/refineid.module";

# Firefox does not consult p11-kit on NixOS; the enterprise
# policy loads the module directly.
Expand Down
2 changes: 2 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ pkgs.mkShell {
opensc # pkcs11-tool for module debugging
nss.tools # tstclnt/certutil/modutil for the hardware cert-auth rig
];
# The GUI dlopens the windowing/GL stack; a dev build has no
# baked rpath, so provide the libraries via the environment.
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (
with pkgs;
[
Expand Down
Loading