Skip to content

Commit

Permalink
fider: init at 0.23.0
Browse files Browse the repository at this point in the history
Co-authored-by: Niklas Korz <[email protected]>
  • Loading branch information
drupol and niklaskorz committed Nov 3, 2024
1 parent 92d4367 commit 2ac3b27
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkgs/by-name/fi/fider/0001-disable-etc-copy.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/app/cmd/server.go b/app/cmd/server.go
index fcfbeec2..71f01c9d 100644
--- a/app/cmd/server.go
+++ b/app/cmd/server.go
@@ -46,7 +46,6 @@ func RunServer() int {
})
}

- copyEtcFiles(ctx)
startJobs(ctx)

e := routes(web.New())
61 changes: 61 additions & 0 deletions pkgs/by-name/fi/fider/frontend.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
version,
src,
lib,
esbuild,
buildGoModule,
fetchFromGitHub,
buildNpmPackage,
}:
let
esbuild' = esbuild.override {
buildGoModule =
args:
buildGoModule (
args
// rec {
version = "0.14.38";
src = fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${version}";
hash = "sha256-rvMi1oC7qGidvi4zrm9KCMMntu6LJGVOGN6VmU2ivQE=";
};
vendorHash = "sha256-QPkBR+FscUc3jOvH7olcGUhM6OW4vxawmNJuRQxPuGs=";
}
);
};
in
buildNpmPackage {
inherit src version;
pname = "fider-frontend";

nativeBuildInputs = [ esbuild' ];

npmDepsHash = "sha256-gnboT5WQzftOCZ2Ouuza7bqpxJf+Zs7OWC8OHMZNHvw=";

buildPhase = ''
runHook preBuild
npx lingui extract public/
npx lingui compile
NODE_ENV=production node esbuild.config.js
NODE_ENV=production npx webpack-cli
runHook postBuild
'';

installPhase = ''
runHook preInstall
mkdir -p $out
cp -r dist ssr.js favicon.png robots.txt $out/
runHook postInstall
'';

env = {
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = 1;
ESBUILD_BINARY_PATH = lib.getExe esbuild';
};
}
50 changes: 50 additions & 0 deletions pkgs/by-name/fi/fider/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
lib,
stdenvNoCC,
fetchFromGitHub,
callPackage,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "fider";
version = "0.23.0";

src = fetchFromGitHub {
owner = "getfider";
repo = "fider";
rev = "v${finalAttrs.version}";
hash = "sha256-QZMBapCeT+xEOf/XvOFHhF4g1inwOW2a5N5TxcQJOHU=";
};

dontConfigure = true;
dontBuild = true;

server = callPackage ./server.nix {
inherit (finalAttrs) src version;
};
frontend = callPackage ./frontend.nix {
inherit (finalAttrs) src version;
};

installPhase = ''
runHook preInstall
mkdir -p $out/etc
cp -r locale views migrations $out/
cp -r etc/*.md $out/etc/
ln -s ${finalAttrs.server}/* $out/
ln -s ${finalAttrs.frontend}/* $out/
runHook postInstall
'';

meta = {
description = "Open platform to collect and prioritize feedback";
homepage = "https://github.com/getfider/fider";
license = lib.licenses.agpl3Only;
mainProgram = "fider";
maintainers = with lib.maintainers; [
drupol
niklaskorz
];
};
})
28 changes: 28 additions & 0 deletions pkgs/by-name/fi/fider/server.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
version,
src,
buildGoModule,
}:
buildGoModule {
inherit src version;
pname = "fider-server";

patches = [
./0001-disable-etc-copy.patch
];

vendorHash = "sha256-CfopU72fpXiTaBtdf9A57Wb+flDu2XEtTISxImeJLL0=";

ldflags = [
"-s"
"-w"
];

doCheck = false; # requires a running PostgreSQL database

# preCheck = ''
# set -o allexport
# source ./.test.env
# set +o allexport
# '';
}

0 comments on commit 2ac3b27

Please sign in to comment.