about summary refs log tree commit diff
path: root/pkgs/development/tools/rust/cargo-deb/default.nix
diff options
context:
space:
mode:
authorJamie Quigley <jamie@quigley.xyz>2022-06-19 17:41:16 +0100
committerJamie Quigley <jamie@quigley.xyz>2022-06-19 17:58:16 +0100
commit6f7502f325084646dbc9b04fb7e2fd9cace7b25b (patch)
treef9522af3e2b76d22a65fcc96d25dc4a2ea6efd0c /pkgs/development/tools/rust/cargo-deb/default.nix
parente989490deecfa0319cb49953e81e69c19b9a9df2 (diff)
treewide: move all cargo subcommands to `pkgs/development/tools/rust/`
Diffstat (limited to 'pkgs/development/tools/rust/cargo-deb/default.nix')
-rw-r--r--pkgs/development/tools/rust/cargo-deb/default.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/pkgs/development/tools/rust/cargo-deb/default.nix b/pkgs/development/tools/rust/cargo-deb/default.nix
new file mode 100644
index 0000000000000..2eb2ddd2d9843
--- /dev/null
+++ b/pkgs/development/tools/rust/cargo-deb/default.nix
@@ -0,0 +1,49 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+, rustPlatform
+, rust
+, libiconv
+, Security
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "cargo-deb";
+  version = "1.30.0";
+
+  src = fetchFromGitHub {
+    owner = "mmstick";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "sha256-rAmG6Aj0D9dHVueh1BN1Chhit+XFhqGib1WTvMDy0LI=";
+  };
+
+  buildInputs = lib.optionals stdenv.isDarwin [ libiconv Security ];
+
+  cargoSha256 = "sha256-MEpyEdjLWNZvqE7gJLvQ169tgmJRzec4vqQI9fF3xr8=";
+
+  preCheck = ''
+    substituteInPlace tests/command.rs \
+      --replace 'target/debug' "target/${rust.toRustTarget stdenv.buildPlatform}/release"
+
+    # This is an FHS specific assert depending on glibc location
+    substituteInPlace src/dependencies.rs \
+      --replace 'assert!(deps.iter().any(|d| d.starts_with("libc")));' '// no libc assert here'
+  '';
+
+  meta = with lib; {
+    description = "Generate Debian packages from information in Cargo.toml";
+    homepage = "https://github.com/mmstick/cargo-deb";
+    license = licenses.mit;
+    # test failures:
+    #   control::tests::generate_scripts_generates_maintainer_scripts_for_unit
+    #   dh_installsystemd::tests::find_units_in_empty_dir_finds_nothing
+    #   dh_lib::tests::apply_with_no_matching_files
+    #   dh_lib::tests::debhelper_script_subst_with_generated_file_only
+    #   dh_lib::tests::debhelper_script_subst_with_no_matching_files
+    #   dh_lib::tests::pkgfile_finds_most_specific_match_without_pkg_file
+    #   dh_lib::tests::pkgfile_finds_most_specific_match_without_unit_file
+    broken = (stdenv.isDarwin && stdenv.isx86_64);
+    maintainers = with maintainers; [ Br1ght0ne ];
+  };
+}