- Fix gawk D-Bus value parsing to preserve multi-word connection names - Fix userUnits merge to union wantedBy lists across users (was last-writer-wins) - Drop require_root from state/status subcommands (read-only, unprivileged) - Add Restart=on-failure + RestartSec=5 to nmtrust-apply and nmtrust-eval - Merge duplicate mkSystemUnitOverrides/mkUserUnitOverrides into mkUnitOverrides
74 lines
1.6 KiB
Nix
74 lines
1.6 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchFromGitHub,
|
|
makeWrapper,
|
|
nixosTests,
|
|
shellcheck,
|
|
bash,
|
|
systemd,
|
|
coreutils,
|
|
gawk,
|
|
util-linux,
|
|
}:
|
|
|
|
stdenv.mkDerivation {
|
|
pname = "nmtrust";
|
|
version = "0.1.1";
|
|
|
|
strictDeps = true;
|
|
__structuredAttrs = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "brett";
|
|
repo = "nmtrust-nix";
|
|
rev = "v0.1.1";
|
|
hash = "sha256-niCbYxeunNxfkM/HEUiMAvwiholR0nmEPqssOOl9Qvo=";
|
|
};
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
nativeCheckInputs = [ shellcheck ];
|
|
|
|
doCheck = true;
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
shellcheck nmtrust.sh
|
|
runHook postCheck
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
install -Dm755 nmtrust.sh $out/bin/nmtrust
|
|
wrapProgram $out/bin/nmtrust \
|
|
--prefix PATH : ${
|
|
lib.makeBinPath [
|
|
bash
|
|
systemd
|
|
coreutils
|
|
gawk
|
|
util-linux
|
|
]
|
|
}
|
|
runHook postInstall
|
|
'';
|
|
|
|
passthru.tests = { inherit (nixosTests) nmtrust; };
|
|
|
|
meta = {
|
|
description = "Declarative network trust management for NixOS";
|
|
longDescription = ''
|
|
nmtrust evaluates the trust state of active NetworkManager connections
|
|
and activates corresponding systemd targets. Services bound to these
|
|
targets start and stop automatically as you move between trusted,
|
|
untrusted, and offline networks.
|
|
|
|
A NixOS-native reimplementation of nmtrust by Peter Hogg (pigmonkey).
|
|
'';
|
|
homepage = "https://github.com/brett/nmtrust-nix";
|
|
license = lib.licenses.unlicense;
|
|
maintainers = [ lib.maintainers.brett ];
|
|
mainProgram = "nmtrust";
|
|
platforms = lib.platforms.linux;
|
|
};
|
|
}
|