Skip to content

Instantly share code, notes, and snippets.

@DavHau
Created March 10, 2022 10:27
Show Gist options
  • Select an option

  • Save DavHau/3505b78a6fe1854a11be2f9015068c1b to your computer and use it in GitHub Desktop.

Select an option

Save DavHau/3505b78a6fe1854a11be2f9015068c1b to your computer and use it in GitHub Desktop.
dream2nix flake for discourse
{
inputs.dream2nix.url = "github:nix-community/dream2nix";
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
inputs.src = { flake = false; url = "github:discourse/discourse/v2.9.0.beta2"; };
outputs = { self, dream2nix, nixpkgs, src, ... }@inputs:
let
dream2nix = inputs.dream2nix.lib2.init {
config.projectRoot = ./. ;
pkgs = nixpkgs.legacyPackages.x86_64-linux;
};
# some override required for multiple packages
disable-npm-build = {
buildScript = "true";
};
in
dream2nix.makeFlakeOutputs rec {
pname = "discourse";
source = inputs.src;
# Inject some dependencies to fix error:
# discourse> ember-qunit has the following unmet peerDependencies:
# discourse>
# discourse> * @ember/test-helpers: `^2.1.0`; it was not installed
# discourse> * qunit: `^2.13.0`; it was not installed
inject = {
# from
ember-qunit."5.1.4" = [
# to
["@ember/test-helpers" "2.2.5"]
["qunit" "2.15.0"]
];
};
packageOverrides = {
discourse-hbr = { inherit disable-npm-build; };
pretty-text = { inherit disable-npm-build; };
select-kit = { inherit disable-npm-build; };
truth-helpers = { inherit disable-npm-build; };
admin = { inherit disable-npm-build; };
discourse-common = { inherit disable-npm-build; };
discourse-widget-hbs.patch-scripts = {
buildScript = "true";
# currently irrelevant as build is disabled by line above
postPatch = ''
substituteInPlace ./index.js --replace \
'require("../../../../lib/javascripts/widget-hbs-compiler")' \
'require("./widget-hbs-compiler")'
cp ${source}/lib/javascripts/widget-hbs-compiler.js \
./widget-hbs-compiler.js
'';
};
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment