diff --git a/overlays/site-musique.nix b/overlays/site-musique.nix new file mode 100644 index 0000000..62f738b --- /dev/null +++ b/overlays/site-musique.nix @@ -0,0 +1,5 @@ +self: super: + +{ + site-musique = super.callPackage ../pkgs/site-musique { }; +} diff --git a/pkgs/site-musique/default.nix b/pkgs/site-musique/default.nix new file mode 100644 index 0000000..fc0f5d7 --- /dev/null +++ b/pkgs/site-musique/default.nix @@ -0,0 +1,24 @@ +{ lib, stdenv, fetchgit }: + +stdenv.mkDerivation rec { + name= "site-musique"; + + src = fetchgit { + url = "https://gitlab.com/nyanloutre/site-musique.git"; + rev = "78e5d570534d528cdf19c44332cd2c929f6fa861"; + sha256 = "0rv1il85gxvi4d6yal8ac7q9jjz0w0ghmklbwzpd3p04v34y1rpd"; + }; + + installPhase = '' + mkdir -p $out/ + cp -R . $out/ + ''; + + meta = { + description = "Site internet de l'association Musique Fraternité de Meyenheim"; + homepage = https://musique-meyenheim.fr/; + maintainers = with stdenv.lib.maintainers; [ nyanloutre ]; + license = stdenv.lib.licenses.cc-by-nc-sa-40; + platforms = stdenv.lib.platforms.all; + }; +} diff --git a/services/pr-autobot.py b/services/pr-autobot.py index 0d41877..350ad13 100755 --- a/services/pr-autobot.py +++ b/services/pr-autobot.py @@ -59,7 +59,7 @@ if latest_commit != previous_commit: pr = repo.create_pull(title=branch, body=pr_message, base='nixos-18.09', head=branch) - print("Pull request numéro " + str(pr.number) + " créée") + print("Pull request numéro " + str(pr.numero) + " créée") print("URL : " + pr.html_url) while pr.mergeable == None: diff --git a/services/site-musique.nix b/services/site-musique.nix index ef1fbd2..78f6101 100644 --- a/services/site-musique.nix +++ b/services/site-musique.nix @@ -24,6 +24,10 @@ in config = mkIf cfg.enable { + nixpkgs.overlays = [ + (import ../overlays/site-musique.nix) + ]; + services.haproxy-acme.services = { ${cfg.domaine} = { ip = "127.0.0.1"; port = cfg.port; auth = false; }; }; @@ -32,7 +36,7 @@ in "musique" = { listen = [ { addr = "127.0.0.1"; port = cfg.port; } ]; locations."/" = { - root = "/run/site-musique/result"; + root = pkgs.site-musique; index = "index.php"; extraConfig = '' location ~* \.php$ { @@ -63,39 +67,5 @@ in catch_workers_output = yes ''; - systemd.services.build-site-musique = { - description = "Compilation du site de la musique"; - requires = ["network-online.target"]; - path = with pkgs;[ git nix ]; - environment = { HOME = "/var/lib/site-musique"; NIX_PATH = "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs"; }; - - serviceConfig = { - DynamicUser = true; - RuntimeDirectory = "site-musique"; - RuntimeDirectoryPreserve = "yes"; - CacheDirectory = "site-musique"; - Type = "oneshot"; - ExecStart = "${pkgs.writeShellScriptBin "build.sh" '' - set -x - set -e - GIT_CLONE_DIR=/var/cache/site-musique - - if [ ! -d $GIT_CLONE_DIR/.git ]; then - git clone --depth 1 https://gitlab.com/nyanloutre/site-musique.git $GIT_CLONE_DIR - else - git -C $GIT_CLONE_DIR pull - fi - - NIXPKGS_ALLOW_UNFREE=1 nix-build -o /run/site-musique/result $GIT_CLONE_DIR - ''}/bin/build.sh"; - }; - }; - - systemd.timers.build-site-musique = { - description = "Timer de compilation du site de la musique"; - requires = ["network-online.target"]; - wantedBy = ["multi-user.target"]; - timerConfig = { OnCalendar = "*:0/5"; Unit = "build-site-musique.service"; }; - }; }; }