diff options
| author | Quentin Aristote <quentin@aristote.fr> | 2022-12-20 22:29:55 +0100 |
|---|---|---|
| committer | Quentin Aristote <quentin@aristote.fr> | 2022-12-20 22:29:55 +0100 |
| commit | 95644485ac1402a8dc84c520a3ded7b29720f950 (patch) | |
| tree | c124a795dba03106cadff1645c532f6251898f86 | |
| parent | 51df83cffaa45130f94bf5ab78b6b14fbb37ec4d (diff) | |
| parent | 9bde3c4624eb916bafcf9a18792edb42e3a25a17 (diff) | |
Merge branch 'master' into searx-engine-alternativeto
| -rw-r--r-- | config/.gitignore | 1 | ||||
| -rw-r--r-- | config/default.nix | 2 | ||||
| -rw-r--r-- | config/services/web/quentin/default.nix | 2 | ||||
| -rw-r--r-- | config/services/web/rss/FipAlbumsBridge.php | 41 | ||||
| -rw-r--r-- | config/services/web/rss/ParisCineInfoBridge.php | 98 | ||||
| -rw-r--r-- | config/services/web/rss/WhatsOnMubiBridge.php | 49 | ||||
| -rw-r--r-- | config/services/web/rss/default.nix | 40 | ||||
| -rw-r--r-- | config/services/web/searx/searx/engines.nix | 30 | ||||
| -rw-r--r-- | config/store.nix | 13 | ||||
| -rw-r--r-- | configuration.nix | 10 | ||||
| -rw-r--r-- | flake.lock | 116 | ||||
| -rw-r--r-- | flake.nix | 41 | ||||
| -rw-r--r-- | hardware-configuration.nix | 27 | ||||
| -rw-r--r-- | modules/default.nix | 1 | ||||
| -rw-r--r-- | modules/rss-bridge.nix | 71 | ||||
| -rw-r--r-- | pkgs/academic-webpage/default.nix | 43 | ||||
| -rw-r--r-- | pkgs/default.nix | 1 | ||||
| -rw-r--r-- | tests/configuration.nix (renamed from tests/vm.nix) | 8 | ||||
| -rwxr-xr-x | tests/run-tests.sh | 9 |
19 files changed, 497 insertions, 106 deletions
diff --git a/config/.gitignore b/config/.gitignore deleted file mode 100644 index 4c7f2b9..0000000 --- a/config/.gitignore +++ /dev/null @@ -1 +0,0 @@ -hardware-configuration.nix
\ No newline at end of file diff --git a/config/default.nix b/config/default.nix index 9cb4668..271ee4b 100644 --- a/config/default.nix +++ b/config/default.nix @@ -6,9 +6,9 @@ (modulesPath + "/profiles/minimal.nix") ./boot.nix ./environment.nix - ./hardware-configuration.nix ./networking.nix ./services + ./store.nix ./users.nix ]; diff --git a/config/services/web/quentin/default.nix b/config/services/web/quentin/default.nix index 8456565..f284071 100644 --- a/config/services/web/quentin/default.nix +++ b/config/services/web/quentin/default.nix @@ -3,7 +3,7 @@ { services.nginx.virtualHosts.quentin = { serverName = "quentin.${config.networking.domain}"; - locations."/".root = "${pkgs.personal.academic-webpage}"; + locations."/".root = "${pkgs.personal.webpage}"; forceSSL = true; enableACME = true; }; diff --git a/config/services/web/rss/FipAlbumsBridge.php b/config/services/web/rss/FipAlbumsBridge.php new file mode 100644 index 0000000..b8ec64d --- /dev/null +++ b/config/services/web/rss/FipAlbumsBridge.php @@ -0,0 +1,41 @@ +<?php + +class FipAlbumsBridge extends XPathAbstract { + const NAME = 'Fip Albums Bridge'; + const URI = 'https://www.radiofrance.fr/fip/albums/'; + const DESCRIPTION = 'Albums promoted by Fip.'; + const MAINTAINER = 'Quentin Aristote'; + const CACHE_TIMEOUT = 86400; // 6h + + const PARAMETERS = [ + '' => [ + 'category' => [ + 'name' => 'Category', + 'type' => 'text', + 'description' => 'See examples for available options.', + 'exampleValue' => 'can be empty, "selections" or "album-jazz-de-la-semaine"' + ] + ] + ]; + + const XPATH_EXPRESSION_ITEM = '//div[starts-with(@class, "CardAlbum ")]'; + const XPATH_EXPRESSION_ITEM_TITLE = './/a/@title'; + const XPATH_EXPRESSION_ITEM_CONTENT = './/img/@alt'; + const XPATH_EXPRESSION_ITEM_URI = './/a/@href'; + const XPATH_EXPRESSION_ITEM_AUTHOR = './/div[starts-with(@class, "CardAlbum-details ")]/div[2]'; + const XPATH_EXPRESSION_ITEM_TIMESTAMP = './/time/@datetime'; + const XPATH_EXPRESSION_ITEM_ENCLOSURES = './/img/@src'; + const XPATH_EXPRESSION_ITEM_CATEGORIES = './/div[starts-with(@class, "CardDetails-label ")]/span[2]'; + + public function getSourceUrl() { + return self::URI . $this->getInput('category'); + } + + public function getIcon() { + return 'https://www.radiofrance.fr/dist/favicons/fip/favicon.png'; + } + + protected function formatItemTimestamp($value) { + return strtotime('today +' . $value); + } +} diff --git a/config/services/web/rss/ParisCineInfoBridge.php b/config/services/web/rss/ParisCineInfoBridge.php new file mode 100644 index 0000000..5e418b4 --- /dev/null +++ b/config/services/web/rss/ParisCineInfoBridge.php @@ -0,0 +1,98 @@ +<?php + +class ParisCineInfoBridge extends BridgeAbstract { + const NAME = 'Paris-ciné.info Bridge'; + const URI = 'https://paris-cine.info/'; + const DESCRIPTION = 'Movies playing in Paris'; + const MAINTAINER = 'Quentin Aristote'; + const CACHE_TIMEOUT = 86400; // 24h + + const PARAMETERS = [ + 'Filters' => [ + // TODO add an option for choosing the reviewer + 'card' => [ + 'name' => 'Card', + 'type' => 'text', + 'title' => 'Fidelity / subscription card.', + 'exampleValue' => 'ugc', + 'defaultValue' => 'all' + ], + 'dayid' => [ + 'name' => 'Day of the week', + 'type' => 'text', + 'title' => 'Comma-separated list of integers (0 means everyday, 1 means Sunday, etc.)/', + 'exampleValue' => '1,3,6', + 'defaultValue' => '0' + ], + 'time' => [ + 'name' => 'Time of day', + 'type' => 'text', + 'title' => 'Morning (8AM-12AM), Afternoon (12AM-18PM), Evening (18PM-12PM).', + 'exampleValue' => 'soir', + 'defaultValue' => 'all' + ], + 'addr' => [ + 'name' => 'Location', + 'type' => 'text', + 'title' => 'Comma-separated list of districts or cities.', + 'exampleValue' => '13e,Châtillon', + 'defaultValue' => 'Paris' + ], + 'cine' => [ + 'name' => 'Theater', + 'type' => 'text', + 'title' => 'ID of a movie theater.', + 'exampleValue' => 'C0150', + ], + 'format' => [ + 'name' => 'Format', + 'type' => 'text', + 'title' => 'Movie format.', + 'exampleValue' => '3D' + ] + ] + ]; + + public function getSourceUrl() { + $query = ''; + foreach(self::PARAMETERS['Filters'] as $param => $val) { + $value = $this->getInput($param); + if ($value != '') { + $query = $query . 'sel' . $param . '=' . $value . '&'; + } + } + $selday = ['week', 'dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'][$this->getInput('dayid')]; + return self::URI . 'get_pcimovies.php?' . $query . 'selday=' . $selday; + } + + private function fetchData() { + return json_decode(getSimpleHTMLDOMCached($this->getSourceUrl()))->data; + } + + public function getIcon() { + return 'https://paris-cine.info/resources/img/favicon-16x16.png'; + } + + public function collectData() { + $data = $this->fetchData(); + foreach($data as $film) { + $item = [ + 'uri' => str_replace('\\/', '/', $film->sc_url), + 'title' => $film->title, + 'timestamp' => str_replace('/', '-', $film->released), + 'author' => $film->dir, + 'content' => ( + $film->year . ' - ' . + 'with ' . str_replace(',', ', ', $film->actors) . ' - ' . + $film->duration . ' - ' . + 'SC: ' . $film->sc_rating . '/10 - ' . + 'IMDB: ' . $film->imdbr . '/10' . ' ' + ), + 'enclosures' => [ $film->poster_url ], + 'categories' => explode(',', $film->genre), + 'id' => $film->id + ]; + $this->items[] = $item; + } + } +} diff --git a/config/services/web/rss/WhatsOnMubiBridge.php b/config/services/web/rss/WhatsOnMubiBridge.php new file mode 100644 index 0000000..4cf7718 --- /dev/null +++ b/config/services/web/rss/WhatsOnMubiBridge.php @@ -0,0 +1,49 @@ +<?php + +class WhatsOnMubiBridge extends XPathAbstract { + const NAME = 'What\'s on Mubi Bridge'; + const URI = 'https://whatsonmubi.com/?catalogue=ns&sort=expires-desc'; + const DESCRIPTION = 'Movies currently showing on Mubi.'; + const MAINTAINER = 'Quentin Aristote'; + const CACHE_TIMEOUT = 21800; // 6h + + const PARAMETERS = [ + '' => [ + 'country' => [ + 'name' => 'Country', + 'type' => 'text', + 'exampleValue' => 'fr', + 'defaultValue' => 'fr', + ] + ] + ]; + + const XPATH_EXPRESSION_ITEM = '//div[@class="film"]'; + const XPATH_EXPRESSION_ITEM_TITLE = './/h2'; + const XPATH_EXPRESSION_ITEM_CONTENT = './/div[@class="film_details flex flex-col flex-1"]'; + const XPATH_EXPRESSION_ITEM_URI = './/a[@class="relative film_thumbnail"]/@href'; + const XPATH_EXPRESSION_ITEM_AUTHOR = './@data-directors'; + const XPATH_EXPRESSION_ITEM_TIMESTAMP = './/p[@class="hidden film-expires"]'; + const XPATH_EXPRESSION_ITEM_ENCLOSURES = './/a[@class="relative film_thumbnail"]/img/@src'; + const XPATH_EXPRESSION_ITEM_CATEGORIES = './/div[@class="film_details flex flex-col flex-1"]//div[@class="mt-3 flex flex-wrap"]'; + + public function getSourceUrl() { + return self::URI . '&showing=' . $this->getInput('country'); + } + + public function getIcon() { + return 'https://whatsonmubi.com/favicon.ico'; + } + + protected function formatItemTimestamp($value) { + return strtotime('today +' . $value); + } + + protected function formatItemContent($value) { + $text = preg_replace("/\s{2}\s+/", "\n", $value); + $lines = array_map("trim", explode("\n", $text)); + $title = $lines[0]; + $director = $lines[1]; + return $director . ' ' . $title; + } +} diff --git a/config/services/web/rss/default.nix b/config/services/web/rss/default.nix index 4d7dd18..f2b667b 100644 --- a/config/services/web/rss/default.nix +++ b/config/services/web/rss/default.nix @@ -1,28 +1,40 @@ { config, lib, pkgs, ... }: -let - cfg = config.services.rss-bridge; - debug = false; - rss-bridge = pkgs.rss-bridge.overrideAttrs (oldAttrs: - oldAttrs // { - installPhase = oldAttrs.installPhase + '' - ln -sf ${./ParisJazzClubBridge.php} $out/bridges/ParisJazzClubBridge.php - ln -sf ${./MaisonDeLaRadioBridge.php} $out/bridges/MaisonDeLaRadioBridge.php - '' + lib.optionalString debug '' - touch $out/DEBUG - ''; - }); +let cfg = config.services.rss-bridge; in { services.rss-bridge = { enable = true; - whitelist = [ "ParisJazzClub" "MaisonDeLaRadio" ]; + extraBridges = [ + # Music + { + name = "FipAlbums"; + source = ./FipAlbumsBridge.php; + } + ## Concerts + { + name = "ParisJazzClub"; + source = ./ParisJazzClubBridge.php; + } + { + name = "MaisonDeLaRadio"; + source = ./MaisonDeLaRadioBridge.php; + } + # Cinema + { + name = "WhatsOnMubi"; + source = ./WhatsOnMubiBridge.php; + } + { + name = "ParisCineInfo"; + source = ./ParisCineInfoBridge.php; + } + ]; virtualHost = "rss"; }; services.nginx = lib.mkIf (cfg.virtualHost != null) { virtualHosts.${cfg.virtualHost} = { serverName = "rss.${config.networking.domain}"; - root = lib.mkForce "${rss-bridge}"; forceSSL = true; enableACME = true; }; diff --git a/config/services/web/searx/searx/engines.nix b/config/services/web/searx/searx/engines.nix index 67de025..9b51d16 100644 --- a/config/services/web/searx/searx/engines.nix +++ b/config/services/web/searx/searx/engines.nix @@ -29,9 +29,9 @@ let extraParameters = { fulltext = 1; }; }; results_xpath = ''//ul[@class="mw-search-results"]/li''; - url_xpath = ''./div[@class="mw-search-result-heading"]/a/@href''; - title_xpath = ''./div[@class="mw-search-result-heading"]/a''; - content_xpath = ''./div[@class="searchresult"]''; + url_xpath = ''.//div[@class="mw-search-result-heading"]/a/@href''; + title_xpath = ''.//div[@class="mw-search-result-heading"]/a/@title''; + content_xpath = ''.//div[@class="searchresult"]''; shortcut = "w${lang}"; categories = "general"; disabled = true; @@ -54,7 +54,7 @@ in { # files "btdigg" # images - "ccengine" + "openverse" "bing images" "library of congress" "qwant images" @@ -95,28 +95,6 @@ in { results = "HTML"; }; } - { # Emojipedia - name = "emojipedia"; - engine = "xpath"; - search_url = makeSearchUrl { - baseUrl = "https://emojipedia.org/search/"; - queryKeyword = "q"; - }; - results_xpath = ''//ol[@class="search-results"]/li/h2''; - url_xpath = "./a/@href"; - title_xpath = "./a"; - content_xpath = "../p"; - shortcut = "emoji"; - disabled = true; - about = { - website = "https://emojipedia.org/"; - wikidata_id = "Q22908129"; - official_api_documentation = ""; - use_official_api = false; - require_api_key = false; - results = "HTML"; - }; - } { name = "nlab"; engine = "xpath"; diff --git a/config/store.nix b/config/store.nix index 79c4f91..8efcd5d 100644 --- a/config/store.nix +++ b/config/store.nix @@ -1,8 +1,11 @@ -{ ... }: +{ lib, ... }: { nix = { - autoOptimiseStore = true; + settings = { + auto-optimise-store = true; + experimental-features = [ "nix-command" "flakes" ]; + }; gc = { automatic = true; dates = "daily"; @@ -10,5 +13,9 @@ }; settings.max-jobs = lib.mkDefault 1; }; - system.autoUpgrade.enable = true; + system.autoUpgrade = { + enable = true; + flake = "git+file:///etc/nixos/"; + flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ]; + }; } diff --git a/configuration.nix b/configuration.nix deleted file mode 100644 index 958a63c..0000000 --- a/configuration.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: - -{ - imports = [ ./config ./modules ]; - - nixpkgs = { - overlays = - [ (final: prev: { personal = import ./pkgs { pkgs = final; }; }) ]; - }; -} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..d5d6fa0 --- /dev/null +++ b/flake.lock @@ -0,0 +1,116 @@ +{ + "nodes": { + "data": { + "inputs": { + "flake-utils": [ + "personal-webpage", + "flake-utils" + ], + "nixpkgs": [ + "personal-webpage", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1671297777, + "narHash": "sha256-kvCzzOupvgGyO3Q/0cpGPgDYEdj8g6MVCH4Mlt/e56k=", + "owner": "qaristote", + "repo": "info", + "rev": "c91a58357700a466aee5135767535136c878e009", + "type": "github" + }, + "original": { + "owner": "qaristote", + "repo": "info", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "id": "flake-utils", + "type": "indirect" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1671249438, + "narHash": "sha256-5e+CcnbZA3/i2BRXbnzRS52Ly67MUNdZR+Zpbb2C65k=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "067bfc6c90a301572cec7da48f09c447a9a8eae0", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "personal-webpage": { + "inputs": { + "data": "data", + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ], + "uncss": "uncss" + }, + "locked": { + "lastModified": 1671298845, + "narHash": "sha256-lFVBXth57Pn6QIN+vPvFR87UxWJ1HFXarHalDvjWrR4=", + "owner": "qaristote", + "repo": "webpage", + "rev": "334d3318b16d765dc10a537be841240986aeea04", + "type": "github" + }, + "original": { + "owner": "qaristote", + "repo": "webpage", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "personal-webpage": "personal-webpage" + } + }, + "uncss": { + "inputs": { + "flake-utils": [ + "personal-webpage", + "flake-utils" + ], + "nixpkgs": [ + "personal-webpage", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1668549614, + "narHash": "sha256-1C2qBUB5Wz7DPPYR4DQi8hh2xoFA89WgEfdI2bsv4pI=", + "owner": "qaristote", + "repo": "uncss", + "rev": "0e5a335e85ec85ff6f764ea87adb5c7da83b0924", + "type": "github" + }, + "original": { + "owner": "qaristote", + "repo": "uncss", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ac3ee30 --- /dev/null +++ b/flake.nix @@ -0,0 +1,41 @@ +{ + inputs = { + personal-webpage = { + url = "github:qaristote/webpage"; + inputs = { + nixpkgs.follows = "/nixpkgs"; + flake-utils.follows = "/flake-utils"; + }; + }; + }; + + outputs = { self, nixpkgs, personal-webpage, flake-utils, ... }@attrs: + flake-utils.lib.eachDefaultSystem (system: { + overlays.default = final: prev: { + personal = import ./pkgs { pkgs = final; } // { + webpage = personal-webpage.defaultPackage."${system}"; + }; + }; + }) // { + nixosModules.default = import ./modules; + nixosConfigurations = let + system = "x86_64-linux"; + specialArgs = attrs; + commonModules = [ + self.nixosModules.default + ({ ... }: { + nixpkgs.overlays = [ self.overlays."${system}".default ]; + }) + ]; + in { + hermes = nixpkgs.lib.nixosSystem { + inherit system specialArgs; + modules = commonModules ++ [ ./config ./hardware-configuration.nix ]; + }; + hermes-test = nixpkgs.lib.nixosSystem { + inherit system specialArgs; + modules = commonModules ++ [ ./tests/configuration.nix ]; + }; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..1b79e6f --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,27 @@ +{ pkgs, lib, modulesPath, ... }: + +{ + imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; + + boot.initrd.availableKernelModules = + [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/2b302948-5608-41c6-b54c-1c0e39ff6a58"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."root".device = + "/dev/disk/by-uuid/eaec758b-ba22-42ab-8992-e765cec9be55"; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/74d78eba-c29a-4724-8fb7-624e0a03faa5"; + fsType = "ext4"; + }; + + swapDevices = [{ device = "/swap"; }]; + +} diff --git a/modules/default.nix b/modules/default.nix index d09a8c0..95f75b4 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -3,5 +3,6 @@ { imports = [ ./filtron.nix + ./rss-bridge.nix ]; } diff --git a/modules/rss-bridge.nix b/modules/rss-bridge.nix new file mode 100644 index 0000000..7c0d349 --- /dev/null +++ b/modules/rss-bridge.nix @@ -0,0 +1,71 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.services.rss-bridge; + rss-bridge = pkgs.rss-bridge.overrideAttrs (oldAttrs: + oldAttrs // { + installPhase = oldAttrs.installPhase + '' + pushd $out/bridges + ln -sf ${./ParisJazzClubBridge.php} ParisJazzClubBridge.php + ln -sf ${./MaisonDeLaRadioBridge.php} MaisonDeLaRadioBridge.php + ln -sf ${./FipAlbumsBridge.php} FipAlbumsBridge.php + ln -sf ${./WhatsOnMubiBridge.php} WhatsOnMubiBridge.php + popd + '' + lib.optionalString debug '' + touch $out/DEBUG + ''; + }); +in { + options.services.rss-bridge = { + package = mkOption { + type = types.package; + description = "Which derivation to use."; + default = pkgs.rss-bridge; + defaultText = literalExample "pkgs.rss-bridge"; + }; + debug = mkEnableOption "debug mode"; + extraBridges = mkOption { + type = types.listOf (types.submodule { + options = { + name = mkOption { + type = types.strMatching "[a-zA-Z0-9]*"; + description = '' + The name of the bridge. + It need not include 'Bridge' at the end, unlike required in RSS-Bridge. + ''; + example = "SomeAppWithANewsletter"; + }; + source = mkOption { + type = types.path; + description = '' + The path to a file whose contents is the PHP sourcecode of the bridge. + See also the RSS-Bridge documentation: https://rss-bridge.github.io/rss-bridge/Bridge_API/index.html. + ''; + }; + }; + }); + default = [ ]; + description = '' + A list of additional bridges that aren't already included in RSS-Bridge. + These bridges are automatically whitelisted''; + }; + }; + + config.services.rss-bridge.whitelist = + map (bridge: bridge.name) cfg.extraBridges; + config.services.nginx = mkIf (cfg.virtualHost != null) { + virtualHosts.${cfg.virtualHost}.root = mkIf (cfg.extraBridges != [ ]) + (mkForce (pkgs.runCommand "rss-bridge" { } ('' + mkdir -p $out/bridges + cp -r ${cfg.package}/* $out/ + pushd $out/bridges + '' + concatStrings (map (bridge: '' + ln -sf ${bridge.source} "${bridge.name}Bridge.php" + '') cfg.extraBridges) + '' + popd + '' + lib.optionalString cfg.debug '' + touch $out/DEBUG + ''))); + }; +} diff --git a/pkgs/academic-webpage/default.nix b/pkgs/academic-webpage/default.nix deleted file mode 100644 index 8310109..0000000 --- a/pkgs/academic-webpage/default.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ pkgs, stdenvNoCC, fetchFromGitHub, ... }: - -let wowchemy-module = name: stdenvNoCC.mkDerivation { - inherit name; - version = "v5.5.0"; - src = fetchFromGitHub { - owner = "wowchemy"; - repo = "wowchemy-hugo-themes"; - rev = "3f178a06f49582758671432d3ff8298f5d65244f"; - sha256 = "2+Pf8cBS/QEbsIjbk1VSG+OUqxHYKK7/kLajNoHvN1k="; - }; - installPhase = '' - cp -r $src/"${name}" $out - ''; - preferLocalBuild = true; - }; - wowchemy = wowchemy-module "wowchemy"; - wowchemy-cms = wowchemy-module "wowchemy-cms"; - -in stdenvNoCC.mkDerivation rec { - pname = "academic-webpage"; - version = "latest"; - - buildInputs = with pkgs; [ hugo wowchemy wowchemy-cms ]; - - src = fetchFromGitHub { - owner = "qaristote"; - repo = "academic-webpage"; - rev = "bc012418ac3621a7292bce834d2efb837281bb15"; - sha256 = "dCfTxHz98V7QOnYCP2f1QT/4UDgnUq4HnShY+q6eYxY="; - }; - - patchPhase = '' - sed -i -e "s/github.com\/wowchemy\/wowchemy-hugo-modules\/\(wowchemy[-a-z]*\)\/v5/\1/g" config/_default/config.yaml - mkdir -p themes - ln -sf "${wowchemy}" themes/wowchemy - ln -sf "${wowchemy-cms}" themes/wowchemy-cms - ''; - - installPhase = '' - hugo --destination $out - ''; -} diff --git a/pkgs/default.nix b/pkgs/default.nix index e7120f7..73848b0 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,6 +1,5 @@ { pkgs }: { - academic-webpage = pkgs.callPackage ./academic-webpage { }; filtron = pkgs.callPackage ./filtron {}; } diff --git a/tests/vm.nix b/tests/configuration.nix index e878c12..a1ccf52 100644 --- a/tests/vm.nix +++ b/tests/configuration.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, lib, modulesPath, ... }: let nginxPorts = lib.concatLists @@ -13,7 +13,9 @@ let enableACME = lib.mkForce false; }; in { - imports = [ ../configuration.nix ]; + imports = [ ../config ]; + + boot.isContainer = true; networking = lib.mkForce { domain = "aristote.vm"; @@ -27,6 +29,8 @@ in { services.filtron.rules = lib.mkForce [ ]; + services.rss-bridge.debug = true; + services.nginx.virtualHosts = { quentin = nginxMakeLocal 8080; searx = nginxMakeLocal 8081; diff --git a/tests/run-tests.sh b/tests/run-tests.sh index a55e282..705f28d 100755 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -7,8 +7,10 @@ function cleanup { sudo nixos-container stop hermes } +echo Stopping container for update ... sudo nixos-container stop hermes || exit 2 -sudo nixos-container update hermes --config-file ./vm.nix || exit 2 +echo Updating container ... +sudo nixos-container update hermes --flake ..#hermes-test || exit 2 echo Starting container ... sudo nixos-container start hermes || exit 2 @@ -40,10 +42,9 @@ echo echo Checking custom Searx engines : declare -A QUERIES QUERIES[alternativeto]=Searx -QUERIES[emojipedia]='Thinking%20Face' QUERIES[nlab]='Kan%20extension' -QUERIES[wikipediafr]=Paris -QUERIES[wikipediaen]=Paris +QUERIES[wfr]=Paris +QUERIES[wen]=Paris for ENGINE in "${!QUERIES[@]}" do echo Checking engine $ENGINE ... |
