From 768039bf86847aac9ec191ccd795cec03d5cd2c0 Mon Sep 17 00:00:00 2001 From: self Date: Mon, 21 Aug 2023 07:34:46 -0700 Subject: [PATCH] eliminate git submodule when used as a Nix flake --- default.nix | 6 +++++- flake.lock | 17 +++++++++++++++++ flake.nix | 7 ++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index 6c261161..06a1d684 100644 --- a/default.nix +++ b/default.nix @@ -1,5 +1,5 @@ { lib, stdenv, rustPlatform, fetchFromGitHub, openssl, postgresql, libiconv -, Security, protobuf, rustfmt, nixosTests }: +, Security, protobuf, rustfmt, nixosTests, lemmy-translations }: rustPlatform.buildRustPackage rec { version = "0.18.2"; @@ -11,6 +11,10 @@ rustPlatform.buildRustPackage rec { echo 'pub const VERSION: &str = "${version}";' > crates/utils/src/version.rs ''; + preBuild = '' + ln -sf ${lemmy-translations} crates/utils/translations + ''; + cargoSha256 = "sha256-2HWz6gYRo4YkXQz4V5COY2vpCu/PD8kKxzDG21YjYbo="; buildInputs = [ postgresql ] diff --git a/flake.lock b/flake.lock index 2719ce3f..75ba3153 100644 --- a/flake.lock +++ b/flake.lock @@ -18,6 +18,22 @@ "type": "github" } }, + "lemmy-translations": { + "flake": false, + "locked": { + "lastModified": 1690314617, + "narHash": "sha256-fkv6l6/888XOdxZ8Y0P+Ww/y+8Wh4F8SIStncAmifu8=", + "owner": "lemmynet", + "repo": "lemmy-translations", + "rev": "68d14665d4f854fc20f9117636b5cde7176e91dd", + "type": "github" + }, + "original": { + "owner": "lemmynet", + "repo": "lemmy-translations", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1690031011, @@ -36,6 +52,7 @@ "root": { "inputs": { "flake-utils": "flake-utils", + "lemmy-translations": "lemmy-translations", "nixpkgs": "nixpkgs" } }, diff --git a/flake.nix b/flake.nix index 81cb3dd1..aac53e91 100644 --- a/flake.nix +++ b/flake.nix @@ -4,15 +4,20 @@ inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; + lemmy-translations = { + url = "github:lemmynet/lemmy-translations"; + flake = false; + }; }; - outputs = { self, nixpkgs, flake-utils }: + outputs = { self, nixpkgs, flake-utils, lemmy-translations }: flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; in { packages = { lemmy-server = (pkgs.callPackage ./default.nix { + inherit lemmy-translations; libiconv = null; Security = null; }); -- 2.44.1