about summary refs log tree commit diff
path: root/pkgs/applications/misc/oranda
diff options
context:
space:
mode:
authorfigsoda <figsoda@pm.me>2023-09-11 15:25:28 -0400
committerfigsoda <figsoda@pm.me>2023-09-11 15:48:26 -0400
commitda8348f1869f07bbb053b7e5731afa27d8088e8c (patch)
treeb082c831dd13504abccdc5953e08d82c29db157c /pkgs/applications/misc/oranda
parent5c0faf014fbda0cf56365779a93ff7f6ef7484b6 (diff)
downloadnixlib-da8348f1869f07bbb053b7e5731afa27d8088e8c.tar
nixlib-da8348f1869f07bbb053b7e5731afa27d8088e8c.tar.gz
nixlib-da8348f1869f07bbb053b7e5731afa27d8088e8c.tar.bz2
nixlib-da8348f1869f07bbb053b7e5731afa27d8088e8c.tar.lz
nixlib-da8348f1869f07bbb053b7e5731afa27d8088e8c.tar.xz
nixlib-da8348f1869f07bbb053b7e5731afa27d8088e8c.tar.zst
nixlib-da8348f1869f07bbb053b7e5731afa27d8088e8c.zip
oranda: 0.3.1 -> 0.4.0
Diff: https://github.com/axodotdev/oranda/compare/v0.3.1...v0.4.0

Changelog: https://github.com/axodotdev/oranda/blob/v0.4.0/CHANGELOG.md
Diffstat (limited to 'pkgs/applications/misc/oranda')
-rw-r--r--pkgs/applications/misc/oranda/default.nix18
-rw-r--r--pkgs/applications/misc/oranda/tailwind.patch52
2 files changed, 6 insertions, 64 deletions
diff --git a/pkgs/applications/misc/oranda/default.nix b/pkgs/applications/misc/oranda/default.nix
index 1471afed1d66..ec449c12c376 100644
--- a/pkgs/applications/misc/oranda/default.nix
+++ b/pkgs/applications/misc/oranda/default.nix
@@ -2,34 +2,28 @@
 , rustPlatform
 , fetchFromGitHub
 , pkg-config
+, tailwindcss
 , oniguruma
 , stdenv
 , darwin
-, tailwindcss
 }:
 
 rustPlatform.buildRustPackage rec {
   pname = "oranda";
-  version = "0.3.1";
+  version = "0.4.0";
 
   src = fetchFromGitHub {
     owner = "axodotdev";
     repo = "oranda";
     rev = "v${version}";
-    hash = "sha256-v/4FPDww142V5mx+pHhaHkDiIUN70dwei8mTeZELztc=";
+    hash = "sha256-PHaqWKsZyNZnEAzEWMzJK6MD0b4O6pkYQG403ONIj0w=";
   };
 
-  cargoHash = "sha256-Q5EY9PB50DxFXFTPiv3RktI37b2TCDqLVNISxixnspY=";
-
-  patches = [
-    # oranda-generate-css which is used in the build script tries to download
-    # tailwindcss from the internet, so we have to patch it to use the
-    # tailwindcss from nixpkgs
-    ./tailwind.patch
-  ];
+  cargoHash = "sha256-zV7vG1mcgVusWCa4jKNLD+SqzReLZQRotk6nvzPYCU4=";
 
   nativeBuildInputs = [
     pkg-config
+    tailwindcss
   ];
 
   buildInputs = [
@@ -46,7 +40,7 @@ rustPlatform.buildRustPackage rec {
 
   env = {
     RUSTONIG_SYSTEM_LIBONIG = true;
-    TAILWINDCSS = lib.getExe tailwindcss;
+    ORANDA_USE_TAILWIND_BINARY = true;
   } // lib.optionalAttrs stdenv.isDarwin {
     # without this, tailwindcss fails with OpenSSL configuration error
     OPENSSL_CONF = "";
diff --git a/pkgs/applications/misc/oranda/tailwind.patch b/pkgs/applications/misc/oranda/tailwind.patch
deleted file mode 100644
index 6a1ffb3c959f..000000000000
--- a/pkgs/applications/misc/oranda/tailwind.patch
+++ /dev/null
@@ -1,52 +0,0 @@
---- a/generate-css/src/lib.rs
-+++ b/generate-css/src/lib.rs
-@@ -28,48 +28,7 @@ pub fn default_css_output_dir() -> Utf8PathBuf {
- }
- 
- pub fn build_css(dist_dir: &Utf8Path) -> Result<()> {
--    // Fetch our cache dir
--    let project_dir = ProjectDirs::from("dev", "axo", "oranda")
--        .expect("Unable to create cache dir for downloading Tailwind!");
--    let cache_dir = project_dir.cache_dir();
--    // Figure out our target "double" (tailwind has weird naming around this)
--    let double = match (env::consts::OS, env::consts::ARCH) {
--        ("linux", "x86_64") => "linux-x64",
--        ("linux", "aarch64") => "linux-arm64",
--        ("linux", "arm") => "linux-armv7",
--        ("macos", "x86_64") => "macos-x64",
--        ("macos", "aarch64") => "macos-arm64",
--        ("windows", "x86_64") => "windows-x64.exe",
--        ("windows", "aarch64") => "windows-arm64.exe",
--        _ => "linux-x64",
--    };
--    let mut binary_path = Utf8PathBuf::from(cache_dir.display().to_string());
--    LocalAsset::create_dir_all(&binary_path)?;
--    binary_path.push(format!("tailwindcss-{double}"));
--    if !binary_path.exists() {
--        // Fetch the binary from GitHub if it doesn't exist
--        tracing::info!("Fetching Tailwind binary from GitHub release...");
--        let url = format!(
--			"https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-{double}"
--		);
--        let handle = tokio::runtime::Handle::current();
--        let response = handle.block_on(reqwest::get(url))?;
--        let bytes = handle.block_on(response.bytes())?;
--        let file = LocalAsset::new(&binary_path, Vec::from(bytes))?;
--        file.write(
--            binary_path
--                .parent()
--                .expect("Tailwind binary path has no parent!?"),
--        )?;
--
--        // On non-Windows platforms, we need to mark the file as executable
--        #[cfg(target_family = "unix")]
--        {
--            use std::os::unix::prelude::PermissionsExt;
--            let user_execute = std::fs::Permissions::from_mode(0o755);
--            std::fs::set_permissions(&binary_path, user_execute)?;
--        }
--    }
-+    let binary_path = env!("TAILWINDCSS");
- 
-     tracing::info!("Building oranda CSS using Tailwind...");
-     let css_src_path = manifest_dir().join(CSS_SRC_PATH);