nixpkgs/pkgs/tools/networking/dogdns/default.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

70 lines
1.6 KiB
Nix

{ lib
, rustPlatform
, fetchFromGitHub
, installShellFiles
, stdenv
, pkg-config
, openssl
, just
, pandoc
, Security
}:
rustPlatform.buildRustPackage rec {
pname = "dogdns";
version = "unstable-2021-10-07";
src = fetchFromGitHub {
owner = "ogham";
repo = "dog";
rev = "721440b12ef01a812abe5dc6ced69af6e221fad5";
sha256 = "sha256-y3T0vXg7631FZ4bzcbQjz3Buui/DFxh9LG8BZWwynp0=";
};
patches = [
# remove date info to make the build reproducible
# remove commit hash to avoid dependency on git and the need to keep `.git`
./remove-date-info.patch
];
nativeBuildInputs = [ installShellFiles just pandoc ]
++ lib.optionals stdenv.hostPlatform.isLinux [ pkg-config ];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ openssl ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ Security ];
outputs = [ "out" "man" ];
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"mutagen-0.2.0" = "sha256-FnSeNI9lAcxonRFTu7wnP/M/d5UbMzSZ97w+mUqoEg8=";
};
};
dontUseJustBuild = true;
dontUseJustCheck = true;
dontUseJustInstall = true;
postPatch = ''
# update Cargo.lock to work with openssl 3
ln -sf ${./Cargo.lock} Cargo.lock
'';
postBuild = ''
just man
'';
postInstall = ''
installShellCompletion completions/dog.{bash,fish,zsh}
installManPage ./target/man/*.1
'';
meta = with lib; {
description = "Command-line DNS client";
homepage = "https://dns.lookup.dog";
license = licenses.eupl12;
maintainers = with maintainers; [ figsoda ];
mainProgram = "dog";
};
}