nixpkgs/pkgs/by-name/in/interlock/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

55 lines
1.3 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, coreutils
, cryptsetup
, mount
, systemd
, umount
}:
buildGoModule rec {
pname = "interlock";
version = "2020.03.05";
src = fetchFromGitHub {
owner = "usbarmory";
repo = "interlock";
rev = "v${version}";
sha256 = "sha256-YXa4vErt3YnomTKAXCv8yUVhcc0ST47n9waW5E8QZzY=";
};
vendorHash = "sha256-OL6I95IpyTIc8wCwD9nWxVUTrmZH6COhsd/YwNTyvN0=";
ldflags = [ "-s" "-w" ];
postPatch = ''
grep -lr '/s\?bin/' | xargs sed -i \
-e 's|/bin/mount|${mount}/bin/mount|' \
-e 's|/bin/umount|${umount}/bin/umount|' \
-e 's|/bin/cp|${coreutils}/bin/cp|' \
-e 's|/bin/mv|${coreutils}/bin/mv|' \
-e 's|/bin/chown|${coreutils}/bin/chown|' \
-e 's|/bin/date|${coreutils}/bin/date|' \
-e 's|/sbin/poweroff|${systemd}/sbin/poweroff|' \
-e 's|/usr/bin/sudo|/run/wrappers/bin/sudo|' \
-e 's|/sbin/cryptsetup|${cryptsetup}/bin/cryptsetup|'
'';
postInstall = ''
mkdir -p $out/share
cp -R $src/static $out/share
'';
# Tests are broken due to an error during key generation.
doCheck = false;
meta = with lib; {
homepage = "https://github.com/usbarmory/interlock";
description = "File encryption tool and an HSM frontend";
mainProgram = "interlock";
license = licenses.gpl3Plus;
platforms = platforms.linux;
};
}