Files
nixpkgs/pkgs/by-name/us/userborn/package.nix
r-vdp 3d3e3dbfc4 nixos/userborn: import legacy /var/lib/nixos state on first run
ids that were allocated and later freed only live in
/var/lib/nixos/{uid,gid}-map. userborn allocates from /etc/passwd
alone, so without this a new user could get a previously-used uid and
inherit file ownership.

Service has a ConditionPathExists on the uid-map and a sentinel under
/var/lib/userborn, so it runs at most once and is a no-op on fresh
installs.
2026-08-13 12:16:35 +02:00

56 lines
1.3 KiB
Nix

{
lib,
rustPlatform,
fetchFromGitHub,
libxcrypt,
nixosTests,
nix-update-script,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "userborn";
version = "1.0.1";
src = fetchFromGitHub {
owner = "nikstur";
repo = "userborn";
tag = finalAttrs.version;
hash = "sha256-YUJY5Ss29joSkBztf6r7DwSci/hTBYgmN1qkJRfhHAo=";
};
sourceRoot = "${finalAttrs.src.name}/rust/userborn";
cargoHash = "sha256-U9RZQ9MabWJEWzMrsmEoIoEUUkFVT7igUBPalXnFeRU=";
nativeBuildInputs = [ rustPlatform.bindgenHook ];
buildInputs = [ libxcrypt ];
stripAllList = [ "bin" ];
passthru = {
updateScript = nix-update-script { };
tests = {
inherit (nixosTests)
userborn
userborn-migration
userborn-mutable-users
userborn-mutable-etc
userborn-immutable-users
userborn-immutable-etc
userborn-static
;
};
};
meta = {
homepage = "https://github.com/nikstur/userborn";
description = "Declaratively bear (manage) Linux users and groups";
changelog = "https://github.com/nikstur/userborn/blob/${finalAttrs.version}/CHANGELOG.md";
license = lib.licenses.mit;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ nikstur ];
mainProgram = "userborn";
};
})