nixpkgs/pkgs/by-name/pw/pwgen-secure/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

51 lines
1.3 KiB
Nix

{ lib, python3Packages, fetchFromGitHub }:
let
inherit (python3Packages) buildPythonApplication pythonOlder;
in
buildPythonApplication rec {
pname = "pwgen-secure";
version = "0.9.1";
# it needs `secrets` which was introduced in 3.6
disabled = pythonOlder "3.6";
# GH is newer than Pypi and contains both library *and* the actual program
# whereas Pypi only has the library
src = fetchFromGitHub {
owner = "mjmunger";
repo = "pwgen_secure";
rev = "v${version}";
sha256 = "15md5606hzy1xfhj2lxmc0nvynyrcs4vxa5jdi34kfm31rdklj28";
};
postPatch = ''
shareDir=$out/share/${pname}
substituteInPlace spwgen.py \
--replace-fail ' \ ' ' \\ '
substituteInPlace pwgen_secure/rpg.py \
--replace-fail "os.path.join(path, 'words.txt')" "os.path.join('$shareDir', 'words.txt')"
'';
propagatedBuildInputs = with python3Packages; [ docopt ];
postInstall = ''
install -Dm555 spwgen.py $out/bin/spwgen
install -Dm444 pwgen_secure/words.txt -t $shareDir
'';
# there are no checks
doCheck = false;
meta = with lib; {
description = "Secure password generation library to replace pwgen";
homepage = "https://github.com/mjmunger/pwgen_secure/";
license = licenses.mit;
maintainers = with maintainers; [ peterhoeg ];
mainProgram = "spwgen";
};
}