about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/misc/formatter
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-01-11 23:37:02 +0000
committerAlyssa Ross <hi@alyssa.is>2020-01-11 23:41:30 +0000
commit6c557e3f1c28cf87e9fba232811d6875dd1399c1 (patch)
tree035a071d5d8980df6de0fa42e2ef8fc0cce7055e /nixpkgs/pkgs/applications/misc/formatter
parentda7500bc026e937ac7fce7b50f67a0e1765737a7 (diff)
parente4134747f5666bcab8680aff67fa3b63384f9a0f (diff)
downloadnixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.gz
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.bz2
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.lz
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.xz
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.zst
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.zip
Merge commit 'e4134747f5666bcab8680aff67fa3b63384f9a0f'
Diffstat (limited to 'nixpkgs/pkgs/applications/misc/formatter')
-rw-r--r--nixpkgs/pkgs/applications/misc/formatter/default.nix77
-rw-r--r--nixpkgs/pkgs/applications/misc/formatter/fix-paths.patch53
2 files changed, 130 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/misc/formatter/default.nix b/nixpkgs/pkgs/applications/misc/formatter/default.nix
new file mode 100644
index 000000000000..b777c3b72e72
--- /dev/null
+++ b/nixpkgs/pkgs/applications/misc/formatter/default.nix
@@ -0,0 +1,77 @@
+{ stdenv
+, fetchFromGitHub
+, meson
+, ninja
+, vala
+, pkgconfig
+, pantheon
+, python3
+, substituteAll
+, glib
+, gtk3
+, dosfstools
+, e2fsprogs
+, exfat
+, hfsprogs
+, ntfs3g
+, libgee
+, wrapGAppsHook
+}:
+
+stdenv.mkDerivation rec {
+  pname = "formatter";
+  version = "0.3.2";
+
+  src = fetchFromGitHub {
+    owner = "Djaler";
+    repo = "Formatter";
+    rev = version;
+    sha256 = "0da1dvzsvbwg1ys19yf0n080xc0hjwin9zacjndb24jvphy3bxql";
+  };
+
+  patches = [
+    (substituteAll {
+      src = ./fix-paths.patch;
+      ext4 = "${e2fsprogs}/bin/mkfs.ext4";
+      exfat = "${exfat}/bin/mkfs.exfat";
+      fat = "${dosfstools}/bin/mkfs.fat";
+      ntfs = "${ntfs3g}/bin/mkfs.ntfs";
+      hfsplus = "${hfsprogs}/bin/mkfs.hfsplus";
+    })
+  ];
+
+  nativeBuildInputs = [
+    meson
+    ninja
+    vala
+    pkgconfig
+    python3
+    wrapGAppsHook
+  ];
+
+  buildInputs = [
+    glib
+    gtk3
+    libgee
+    pantheon.granite
+  ];
+
+  postPatch = ''
+    chmod +x meson/post_install.py
+    patchShebangs meson/post_install.py
+  '';
+
+  passthru = {
+    updateScript = pantheon.updateScript {
+      attrPath = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "A simple formatter designed for elementary OS";
+    homepage = "https://github.com/Djaler/Formatter";
+    maintainers = with maintainers; [ kjuvi ] ++ pantheon.maintainers;
+    platforms = platforms.linux;
+    license = licenses.lgpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/misc/formatter/fix-paths.patch b/nixpkgs/pkgs/applications/misc/formatter/fix-paths.patch
new file mode 100644
index 000000000000..67c1d2b43ccc
--- /dev/null
+++ b/nixpkgs/pkgs/applications/misc/formatter/fix-paths.patch
@@ -0,0 +1,53 @@
+diff --git a/src/Objects/DeviceFormatter.vala b/src/Objects/DeviceFormatter.vala
+index cf6a3b8..0de10a9 100644
+--- a/src/Objects/DeviceFormatter.vala
++++ b/src/Objects/DeviceFormatter.vala
+@@ -62,42 +62,42 @@ namespace Formatter {
+             string drive_identifier = drive.get_identifier ("unix-device");
+             switch (filesystem) {
+                 case Formatter.Filesystems.EXT4:
+-                    spawn_args = {"pkexec", "mkfs.ext4", drive_identifier, "-F"};
++                    spawn_args = {"pkexec", "@ext4@", drive_identifier, "-F"};
+                     if (label != "") {
+                         spawn_args += "-L";
+                         spawn_args += label;
+                     }
+                     break;
+                 case Formatter.Filesystems.EXFAT:
+-                    spawn_args = {"pkexec", "mkfs.exfat", drive_identifier};
++                    spawn_args = {"pkexec", "@exfat@", drive_identifier};
+                     if (label != "") {
+                         spawn_args += "-n";
+                         spawn_args += label;
+                     }
+                     break;
+                 case Formatter.Filesystems.FAT16:
+-                    spawn_args = {"pkexec", "mkfs.fat", "-F16", "-I", drive_identifier};
++                    spawn_args = {"pkexec", "@fat@", "-F16", "-I", drive_identifier};
+                     if (label != "") {
+                         spawn_args += "-n";
+                         spawn_args += label;
+                     }
+                     break;
+                 case Formatter.Filesystems.FAT32:
+-                    spawn_args = {"pkexec", "mkfs.fat", "-F32", "-I", drive_identifier};
++                    spawn_args = {"pkexec", "@fat@", "-F32", "-I", drive_identifier};
+                     if (label != "") {
+                         spawn_args += "-n";
+                         spawn_args += label;
+                     }
+                     break;
+                 case Formatter.Filesystems.NTFS:
+-                    spawn_args = {"pkexec", "mkfs.ntfs", drive_identifier, "-f", "-F"};
++                    spawn_args = {"pkexec", "@ntfs@", drive_identifier, "-f", "-F"};
+                     if (label != "") {
+                         spawn_args += "-L";
+                         spawn_args += label;
+                     }
+                     break;
+                 case Formatter.Filesystems.HFS_PLUS:
+-                    spawn_args = {"pkexec", "mkfs.hfsplus", drive_identifier};
++                    spawn_args = {"pkexec", "@hfsplus@", drive_identifier};
+                     if (label != "") {
+                         spawn_args += "-v";
+                         spawn_args += label;