aux-search/frontend/default.nix

84 lines
1.8 KiB
Nix
Raw Normal View History

2020-06-18 22:41:01 +00:00
{ pkgs ? import <nixpkgs> { }
Feat/dynamic import (#473) * Make the channel importer versions dynamic * few things fromt he list 1. add nixos-org-configurations as input to flake.nix 2. evaluate channels.nix file and export channels via environment variable. that environment variable (lets call it NIXOS_CHANNELS) should be present during the build and inside the nix shell. the content of the variable can be JSON. 3. we pickup the NIXOS_CHANNELS environment variable in frontend/webpack.config.js and pass it further to webpack process, just like we do with ELASTICSEARCH_MAPPING_SCHEMA_VERSION. 4. we forward NIXOS_CHANNELS to Elm via frontend/src/index.js as an Elm application flag. Just like we do with other variables there. * Decode nixosChannels in Elm * Use nixosChannels that came via application flag * read nixos channels in github action * defaultNixOSChannel should be calculated * add two pointers where the check should be added * pass nixosChannels to flake-info and remove title, rather calculate it * Add NixosChannels struct validation and validation Error * Read NIXOS_CHANNEL variable * Check channel * Add channel struct to fix parsing NIXOS_CHANNELS * Use `eachDefaultSystem` instead of listing them manually * Add individual dev shells for frontend and backend * Update .github/workflows/import-to-elasticsearch.yml Co-authored-by: Naïm Favier <n@monade.li> * use both development environments by default (as it was) but still provide devShells for each of the subprojects * pkgs.lib → lib everywhere and define lib = nixpkgs.lib before the call to eachDefaultSystem Also, version = lib.fileContents ./VERSION; * Update flake.nix Co-authored-by: Naïm Favier <n@monade.li> * typo * bumping version to test the changes to import-to-elasticsearch github action * some invisibile characters needed to be removed * typo * will this work * typo * forgot the checkout step * add some debugging * typo * read NIXOS_CHANNELS from environment not via argument * fix for the NIXOS_CHANNELS variable Co-authored-by: Janne Heß <janne@hess.ooo> Co-authored-by: ysndr <me@ysndr.de> Co-authored-by: Naïm Favier <n@monade.li>
2022-04-24 21:48:01 +00:00
, nixosChannels
, version
2020-03-28 04:09:01 +00:00
}:
let
package = builtins.fromJSON (builtins.readFile ./package.json);
2020-06-18 22:41:01 +00:00
yarnPkg = pkgs.yarn2nix-moretea.mkYarnPackage rec {
name = "${package.name}-yarn-${package.version}";
src = null;
dontUnpack = true;
packageJSON = ./package.json;
yarnLock = ./yarn.lock;
preConfigure = ''
mkdir ${package.name}
cd ${package.name}
ln -s ${packageJSON} ./package.json
ln -s ${yarnLock} ./yarn.lock
'';
yarnPreBuild = ''
mkdir -p $HOME/.node-gyp/${pkgs.nodejs.version}
echo 9 > $HOME/.node-gyp/${pkgs.nodejs.version}/installVersion
ln -sfv ${pkgs.nodejs}/include $HOME/.node-gyp/${pkgs.nodejs.version}
'';
publishBinsFor =
2020-06-18 22:41:01 +00:00
[
"webpack"
"webpack-dev-server"
];
};
2020-06-18 22:41:01 +00:00
in
pkgs.stdenv.mkDerivation {
name = "${package.name}-${package.version}";
2020-03-28 04:09:01 +00:00
src = pkgs.lib.cleanSource ./.;
2021-01-23 16:25:43 +00:00
preferLocalBuild = true;
2020-03-28 04:09:01 +00:00
buildInputs =
2020-06-18 22:41:01 +00:00
[
yarnPkg
] ++
2020-03-28 04:09:01 +00:00
(with pkgs; [
nodejs
elm2nix
2020-03-28 04:09:01 +00:00
]) ++
(with pkgs.nodePackages; [
yarn
]) ++
(with pkgs.elmPackages; [
elm
elm-format
2020-03-30 07:27:22 +00:00
elm-language-server
elm-test
elm-analyse
2020-03-28 04:09:01 +00:00
]);
Feat/dynamic import (#473) * Make the channel importer versions dynamic * few things fromt he list 1. add nixos-org-configurations as input to flake.nix 2. evaluate channels.nix file and export channels via environment variable. that environment variable (lets call it NIXOS_CHANNELS) should be present during the build and inside the nix shell. the content of the variable can be JSON. 3. we pickup the NIXOS_CHANNELS environment variable in frontend/webpack.config.js and pass it further to webpack process, just like we do with ELASTICSEARCH_MAPPING_SCHEMA_VERSION. 4. we forward NIXOS_CHANNELS to Elm via frontend/src/index.js as an Elm application flag. Just like we do with other variables there. * Decode nixosChannels in Elm * Use nixosChannels that came via application flag * read nixos channels in github action * defaultNixOSChannel should be calculated * add two pointers where the check should be added * pass nixosChannels to flake-info and remove title, rather calculate it * Add NixosChannels struct validation and validation Error * Read NIXOS_CHANNEL variable * Check channel * Add channel struct to fix parsing NIXOS_CHANNELS * Use `eachDefaultSystem` instead of listing them manually * Add individual dev shells for frontend and backend * Update .github/workflows/import-to-elasticsearch.yml Co-authored-by: Naïm Favier <n@monade.li> * use both development environments by default (as it was) but still provide devShells for each of the subprojects * pkgs.lib → lib everywhere and define lib = nixpkgs.lib before the call to eachDefaultSystem Also, version = lib.fileContents ./VERSION; * Update flake.nix Co-authored-by: Naïm Favier <n@monade.li> * typo * bumping version to test the changes to import-to-elasticsearch github action * some invisibile characters needed to be removed * typo * will this work * typo * forgot the checkout step * add some debugging * typo * read NIXOS_CHANNELS from environment not via argument * fix for the NIXOS_CHANNELS variable Co-authored-by: Janne Heß <janne@hess.ooo> Co-authored-by: ysndr <me@ysndr.de> Co-authored-by: Naïm Favier <n@monade.li>
2022-04-24 21:48:01 +00:00
ELASTICSEARCH_MAPPING_SCHEMA_VERSION = version;
NIXOS_CHANNELS = builtins.toJSON nixosChannels;
configurePhase = pkgs.elmPackages.fetchElmDeps {
elmPackages = import ./elm-srcs.nix;
elmVersion = pkgs.elmPackages.elm.version;
registryDat = ./registry.dat;
};
patchPhase = ''
rm -rf node_modules
ln -sf ${yarnPkg}/libexec/${package.name}/node_modules .
'';
buildPhase = ''
# Yarn writes cache directories etc to $HOME.
export HOME=$PWD/yarn_home
yarn prod
'';
installPhase = ''
mkdir -p $out
cp -R ./dist/* $out/
cp netlify.toml $out/
'';
2020-03-28 04:09:01 +00:00
Feat/dynamic import (#473) * Make the channel importer versions dynamic * few things fromt he list 1. add nixos-org-configurations as input to flake.nix 2. evaluate channels.nix file and export channels via environment variable. that environment variable (lets call it NIXOS_CHANNELS) should be present during the build and inside the nix shell. the content of the variable can be JSON. 3. we pickup the NIXOS_CHANNELS environment variable in frontend/webpack.config.js and pass it further to webpack process, just like we do with ELASTICSEARCH_MAPPING_SCHEMA_VERSION. 4. we forward NIXOS_CHANNELS to Elm via frontend/src/index.js as an Elm application flag. Just like we do with other variables there. * Decode nixosChannels in Elm * Use nixosChannels that came via application flag * read nixos channels in github action * defaultNixOSChannel should be calculated * add two pointers where the check should be added * pass nixosChannels to flake-info and remove title, rather calculate it * Add NixosChannels struct validation and validation Error * Read NIXOS_CHANNEL variable * Check channel * Add channel struct to fix parsing NIXOS_CHANNELS * Use `eachDefaultSystem` instead of listing them manually * Add individual dev shells for frontend and backend * Update .github/workflows/import-to-elasticsearch.yml Co-authored-by: Naïm Favier <n@monade.li> * use both development environments by default (as it was) but still provide devShells for each of the subprojects * pkgs.lib → lib everywhere and define lib = nixpkgs.lib before the call to eachDefaultSystem Also, version = lib.fileContents ./VERSION; * Update flake.nix Co-authored-by: Naïm Favier <n@monade.li> * typo * bumping version to test the changes to import-to-elasticsearch github action * some invisibile characters needed to be removed * typo * will this work * typo * forgot the checkout step * add some debugging * typo * read NIXOS_CHANNELS from environment not via argument * fix for the NIXOS_CHANNELS variable Co-authored-by: Janne Heß <janne@hess.ooo> Co-authored-by: ysndr <me@ysndr.de> Co-authored-by: Naïm Favier <n@monade.li>
2022-04-24 21:48:01 +00:00
passthru.yarnPkg = yarnPkg;
2020-03-28 04:09:01 +00:00
}