omnom: fix & refactor (#421398)

authored by Cosima Neidahl and committed by GitHub 8a462fb9 ec49bcde

+37 -38
+37 -38
pkgs/by-name/om/omnom/package.nix
··· 34 34 "-w" 35 35 ]; 36 36 37 - postBuild = 38 - let 39 - omnom-addons = buildNpmPackage { 40 - pname = "omnom-addons"; 41 - inherit (finalAttrs) version src; 37 + postInstall = '' 38 + mkdir -p $out/share/addons 42 39 43 - npmDepsHash = "sha256-sUn5IvcHWJ/yaqeGz9SGvGx9HHAlrcnS0lJxIxUVS6M="; 44 - sourceRoot = "${finalAttrs.src.name}/ext"; 45 - npmPackFlags = [ "--ignore-scripts" ]; 40 + # Copy Firefox and Chrome addons 41 + cp -r ${finalAttrs.passthru.omnom-addons}/*.zip $out/share/addons 46 42 47 - nativeBuildInputs = [ zip ]; 43 + mkdir -p $out/share/examples 48 44 49 - # Fix path for the `static` directory 50 - postConfigure = '' 51 - substituteInPlace webpack.config.js \ 52 - --replace-fail '"..", ".."' '".."' 53 - ''; 45 + cp -r static templates $out/share 46 + cp config.yml_sample $out/share/examples/config.yml 47 + ''; 54 48 55 - postBuild = '' 56 - mkdir -p $out 49 + passthru = { 50 + omnom-addons = buildNpmPackage (finalAttrs': { 51 + pname = "omnom-addons"; 52 + inherit (finalAttrs) version src; 53 + 54 + npmDepsHash = "sha256-sUn5IvcHWJ/yaqeGz9SGvGx9HHAlrcnS0lJxIxUVS6M="; 55 + sourceRoot = "${finalAttrs'.src.name}/ext"; 56 + npmPackFlags = [ "--ignore-scripts" ]; 57 57 58 - zip -r "$out/omnom_ext_src.zip" README.md src utils package* webpack.config.js 58 + nativeBuildInputs = [ zip ]; 59 59 60 - pushd build 61 - zip "$out/omnom_ext_chrome.zip" ./* icons/* -x manifest_ff.json 62 - zip "$out/omnom_ext_firefox.zip" ./* icons/* -x manifest_ff.json 63 - popd 64 - ''; 60 + # Fix path for the `static` directory 61 + postConfigure = '' 62 + substituteInPlace webpack.config.js \ 63 + --replace-fail '"..", ".."' '".."' 64 + ''; 65 65 66 - postCheck = '' 67 - npm run build-test 68 - ''; 69 - }; 70 - in 71 - '' 72 - mkdir -p $out/share/addons 66 + postBuild = '' 67 + mkdir -p $out 73 68 74 - # Copy Firefox and Chrome addons 75 - cp -r ${omnom-addons}/*.zip $out/share/addons 76 - ''; 69 + zip -r "$out/omnom_ext_src.zip" README.md src utils package* webpack.config.js 77 70 78 - postInstall = '' 79 - mkdir -p $out/share/examples 71 + pushd build 72 + zip "$out/omnom_ext_chrome.zip" ./* icons/* -x manifest_ff.json 73 + cp manifest_ff.json manifest.json 74 + zip "$out/omnom_ext_firefox.zip" ./* icons/* -x manifest_ff.json 75 + popd 76 + ''; 80 77 81 - cp -r static templates $out/share 82 - cp config.yml_sample $out/share/examples/config.yml 83 - ''; 78 + postCheck = '' 79 + npm run build-test 80 + ''; 81 + }); 84 82 85 - passthru.tests = nixosTests.omnom; 83 + tests = nixosTests.omnom; 84 + }; 86 85 87 86 meta = { 88 87 description = "Webpage bookmarking and snapshotting service";