nixpkgs/pkgs/by-name/pi/picocrypt/package.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

78 lines
1.6 KiB
Nix

{
lib,
buildGoModule,
fetchFromGitHub,
stdenv,
copyDesktopItems,
makeDesktopItem,
xorg,
glfw,
gtk3,
pkg-config,
wrapGAppsHook3,
}:
buildGoModule rec {
pname = "picocrypt";
version = "1.43";
src = fetchFromGitHub {
owner = "Picocrypt";
repo = "Picocrypt";
rev = "refs/tags/${version}";
hash = "sha256-xxlmerEGujBvghC+OpMW0gkDl7zPOW4r6cM7T6qOc6A=";
};
sourceRoot = "${src.name}/src";
vendorHash = "sha256-QeNFXmWeA/hkYdFzJoHj61bo/DmGWakdhFRLtSYG7+Y=";
ldflags = [
"-s"
"-w"
];
buildInputs =
# Depends on a vendored, patched GLFW.
glfw.buildInputs or [ ]
++ glfw.propagatedBuildInputs or [ ]
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
gtk3
xorg.libXxf86vm
];
nativeBuildInputs = [
copyDesktopItems
pkg-config
wrapGAppsHook3
];
CGO_ENABLED = 1;
postInstall = ''
mv $out/bin/Picocrypt $out/bin/picocrypt-gui
install -Dm644 $src/images/key.svg $out/share/icons/hicolor/scalable/apps/picocrypt.svg
'';
desktopItems = [
(makeDesktopItem {
name = "Picocrypt";
exec = "picocrypt-gui";
icon = "picocrypt";
comment = meta.description;
desktopName = "Picocrypt";
categories = [ "Utility" ];
})
];
meta = {
description = "Very small, very simple, yet very secure encryption tool, written in Go";
homepage = "https://github.com/Picocrypt/Picocrypt";
changelog = "https://github.com/Picocrypt/Picocrypt/blob/main/Changelog.md";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ ryand56 ];
mainProgram = "picocrypt-gui";
};
}