diff options
author | Ryan Lahfa <masterancpp@gmail.com> | 2024-03-01 23:31:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-01 23:31:26 +0100 |
commit | b1f53dc4dd07a8a7321fa32b458eec5aa9d75528 (patch) | |
tree | d095154a56bb11f54dc743ba59d7f317779e8876 /pkgs/by-name/op | |
parent | 9e343b8635964e7155e544473e5c760af2778d4e (diff) | |
parent | a9bebf8eb55f3fdd7d5fdb661ed0140fd12f111d (diff) | |
download | nixlib-b1f53dc4dd07a8a7321fa32b458eec5aa9d75528.tar nixlib-b1f53dc4dd07a8a7321fa32b458eec5aa9d75528.tar.gz nixlib-b1f53dc4dd07a8a7321fa32b458eec5aa9d75528.tar.bz2 nixlib-b1f53dc4dd07a8a7321fa32b458eec5aa9d75528.tar.lz nixlib-b1f53dc4dd07a8a7321fa32b458eec5aa9d75528.tar.xz nixlib-b1f53dc4dd07a8a7321fa32b458eec5aa9d75528.tar.zst nixlib-b1f53dc4dd07a8a7321fa32b458eec5aa9d75528.zip |
Merge pull request #292014 from lf-/jade/opengist
opengist: init at 1.6.1
Diffstat (limited to 'pkgs/by-name/op')
-rw-r--r-- | pkgs/by-name/op/opengist/package.nix | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/pkgs/by-name/op/opengist/package.nix b/pkgs/by-name/op/opengist/package.nix new file mode 100644 index 000000000000..fb9efcd7b076 --- /dev/null +++ b/pkgs/by-name/op/opengist/package.nix @@ -0,0 +1,70 @@ +{ lib, buildGoModule, buildNpmPackage, fetchFromGitHub, moreutils, jq, git }: +let + # finalAttrs when 🥺 (buildGoModule does not support them) + # https://github.com/NixOS/nixpkgs/issues/273815 + version = "1.6.1"; + src = fetchFromGitHub { + owner = "thomiceli"; + repo = "opengist"; + rev = "v${version}"; + hash = "sha256-rJ8oiH08kSSFNgPHKGo68Oi1i3L1SEJyHuzoxKMOZME="; + }; + + frontend = buildNpmPackage { + pname = "opengist-frontend"; + inherit version src; + + nativeBuildInputs = [ moreutils jq ]; + + # npm complains of "invalid package". shrug. we can give it a version. + preBuild = '' + jq '.version = "${version}"' package.json | sponge package.json + ''; + + # copy pasta from the Makefile upstream, seems to be a workaround of sass + # issues, unsure why it is not done in vite: + # https://github.com/thomiceli/opengist/blob/05eccfa8e728335514a40476cd8116cfd1ca61dd/Makefile#L16-L19 + postBuild = '' + EMBED=1 npx postcss 'public/assets/embed-*.css' -c public/postcss.config.js --replace + ''; + + installPhase = '' + mkdir -p $out + cp -R public $out + ''; + + npmDepsHash = "sha256-Sy321tIQOOrypk+EOGGixEzrPdhA9U8Hak+DOS+d00A="; + }; +in +buildGoModule { + pname = "opengist"; + inherit version src; + vendorHash = "sha256-IorqXJKzUTUL5zfKRipZaJtRlwVOmTwolJXFG/34Ais="; + tags = [ + "fs_embed" + ]; + + # required for tests + nativeCheckInputs = [ + git + ]; + + # required for tests to not try to write into $HOME and fail + preCheck = '' + export OG_OPENGIST_HOME=$(mktemp -d) + ''; + + postPatch = '' + cp -R ${frontend}/public/{manifest.json,assets} public/ + ''; + + passthru.frontend = frontend; + + meta = { + description = "Self-hosted pastebin powered by Git"; + homepage = "https://github.com/thomiceli/opengist"; + license = lib.licenses.agpl3Only; + maintainers = with lib.maintainers; [ lf- ]; + platforms = lib.platforms.unix; + }; +} |