Compare commits
1 commit
master
...
thubrecht/
Author | SHA1 | Date | |
---|---|---|---|
c45c4e3d45 |
17 changed files with 3643 additions and 736 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,5 +1,4 @@
|
|||
node_modules
|
||||
public/build
|
||||
result
|
||||
|
||||
.direnv
|
|
@ -1,75 +1,37 @@
|
|||
{
|
||||
"tree": {
|
||||
"Rentrée": {
|
||||
"Évènements pour les masteriens": {},
|
||||
"Exchange and international students": {},
|
||||
"Départements": {},
|
||||
"Amphis de rentrée": {},
|
||||
"Divers rentrée": {},
|
||||
"Associatif divers": {},
|
||||
"Visites": {}
|
||||
},
|
||||
"Délégation Générale Numérique": {},
|
||||
"COF": {
|
||||
"BdA": {},
|
||||
"Évènements (COF)": {},
|
||||
"Rentrée du COF": {},
|
||||
"Assemblées Générales (COF)": {},
|
||||
"BdA": {
|
||||
"Évènements (BdA)": {},
|
||||
"Spectacles du tirage BdA": {}
|
||||
}
|
||||
"Assemblées Générales (COF)": {}
|
||||
},
|
||||
"Clubs COF": {
|
||||
"PLS": {},
|
||||
"HackENS": {},
|
||||
"Club Bouffe": {},
|
||||
"Club réseau": {},
|
||||
"hackENS": {},
|
||||
"Écriv'ENS": {},
|
||||
"BOcal": {},
|
||||
"CinéClub": {},
|
||||
"Ernestophone": {},
|
||||
"Club Jeux": {},
|
||||
"DDR": {},
|
||||
"BandarrêtdurgENS": {},
|
||||
"L'Hômonerie": {},
|
||||
"Ulmity": {},
|
||||
"Arts pla'": {},
|
||||
"Club Inutile ☔": {}
|
||||
},
|
||||
"BDS": {
|
||||
"Évènements (BDS)": {},
|
||||
"Rentrée du BDS": {}
|
||||
},
|
||||
"Clubs BDS": {
|
||||
"Valse": {},
|
||||
"Créneaux encadrés": {},
|
||||
"ENSelle": {}
|
||||
},
|
||||
"BDS": {},
|
||||
"La Nuit de l'ENS": {},
|
||||
"Délégation Générale": {},
|
||||
"K-Fêt": {},
|
||||
"Écocampus": {},
|
||||
"La Psychédéliste": {},
|
||||
"Ambassadeur·rice·s santé": {}
|
||||
"Rentrée académique": {
|
||||
"Amphis de rentrée": {},
|
||||
"Rentrée des départements": {},
|
||||
"Conférences de recherche": {},
|
||||
"Visites de bibliothèques": {},
|
||||
"Réunions de rentrée des Masters": {},
|
||||
"Activités pour les étudiants internationaux": {}
|
||||
},
|
||||
"Divers": {}
|
||||
},
|
||||
|
||||
"sources": {
|
||||
"dgnum-nc": {
|
||||
"dmo7DgdmTnsMd8zo": {
|
||||
"name": "Valse"
|
||||
},
|
||||
"eEPk6miCzozgPb42": {
|
||||
"name": "Délégation Générale Numérique",
|
||||
"short_name": "DGNum",
|
||||
"color": "#27327a"
|
||||
}
|
||||
},
|
||||
"eleves-ens": {
|
||||
"qG6jpJPfK37Nw8ZC": {
|
||||
"name": "PLS"
|
||||
},
|
||||
"caey6jt6pTgKengA": {
|
||||
"name": "BOcal",
|
||||
"color": "#e6973e"
|
||||
},
|
||||
"LLWm8qK9iC5YGrrR": {
|
||||
"name": "Délégation Générale",
|
||||
"short_name": "DG"
|
||||
|
@ -81,7 +43,7 @@
|
|||
"w442JdS5AaQ6czrP": {
|
||||
"name": "Écriv'ENS"
|
||||
},
|
||||
"aoazRGFcjHSe4LxG": {
|
||||
"fRtjDkjrZyn6fxd8": {
|
||||
"name": "K-Fêt",
|
||||
"color": "#c63b52",
|
||||
"default_location": "K-Fêt"
|
||||
|
@ -98,12 +60,7 @@
|
|||
"short_name": "AG COF"
|
||||
},
|
||||
"r4yJZDHjwNtH8wkR": {
|
||||
"name": "Évènements (BdA)"
|
||||
},
|
||||
"83AkowSYPnYrjSFr": {
|
||||
"name": "Spectacles du tirage BdA",
|
||||
"short_name": "Spectacles",
|
||||
"initial": false
|
||||
"name": "BdA"
|
||||
},
|
||||
"ZtWm3MYSi388k2yk": {
|
||||
"name": "DDR"
|
||||
|
@ -115,99 +72,59 @@
|
|||
"name": "Club Inutile ☔",
|
||||
"initial": false
|
||||
},
|
||||
"Ekjb4kDqMMqwJXZF": {
|
||||
"name": "Rentrée des départements",
|
||||
"short_name": "Dpt"
|
||||
},
|
||||
"8SKP62tQJP65K8EW": {
|
||||
"name": "Conférences de recherche",
|
||||
"short_name": "Conf"
|
||||
},
|
||||
"PnRXqeq4SsSC33FM": {
|
||||
"name": "Visites de bibliothèques",
|
||||
"short_name": "Bibli",
|
||||
"initial": false
|
||||
},
|
||||
"NWPtiEiz62LTtjo2": {
|
||||
"name": "Amphis de rentrée",
|
||||
"short_name": "Prés. de rentrée"
|
||||
},
|
||||
"JiRt58aJXay9kfyk": {
|
||||
"name": "Réunions de rentrée des Masters",
|
||||
"short_name": "Masters"
|
||||
},
|
||||
"5Rb4bRjCDcsFjDdQ": {
|
||||
"name": "Activités pour les étudiants internationaux",
|
||||
"short_name": "Internationaux"
|
||||
},
|
||||
"62wKfQRrLNz2WXjt": {
|
||||
"name": "Divers"
|
||||
},
|
||||
"TFjE83ASCMK9rfRi": {
|
||||
"name": "BandarrêtdurgENS",
|
||||
"short_name": "Banda"
|
||||
},
|
||||
"kR8fMzmf4ciop9Je": {
|
||||
"name": "Club Jeux",
|
||||
"short_name": "Jeux",
|
||||
"color": "#5f9ae0"
|
||||
"TyMrLaPPDzT7yAGC": {
|
||||
"name": "BDS"
|
||||
}
|
||||
},
|
||||
"22rQF3gjjz8LifZC": {
|
||||
"name": "La Psychédéliste",
|
||||
"short_name": "Psychédéliste"
|
||||
"klub-reseau": {
|
||||
"5WrcagPPARQ3BD87": {
|
||||
"name": "Club réseau",
|
||||
"default_location": "Cave d'hackENS"
|
||||
},
|
||||
"AfHYkm3gqQ4fRRj5": {
|
||||
"name": "HackENS",
|
||||
"TFEAKjAgNFQZpNjo": {
|
||||
"name": "hackENS",
|
||||
"default_location": "Cave d'hackENS"
|
||||
}
|
||||
},
|
||||
"frama-agenda": {
|
||||
"qZcPZdGb5YtJHrNZ": {
|
||||
"name": "ENSelle"
|
||||
},
|
||||
"K6iGBG47WXaKWs3Q": {
|
||||
"name": "Créneaux encadrés",
|
||||
"initial": false
|
||||
},
|
||||
"TFjE83ASCMK9rfRi": {
|
||||
"name": "BandarrêtdurgENS",
|
||||
"short_name": "Banda"
|
||||
},
|
||||
"dSYCtdC6bgyWpKyt": {
|
||||
"name": "Évènements (BDS)"
|
||||
},
|
||||
"goXLq2dQ8LgFAjkM": {
|
||||
"name": "Club Bouffe"
|
||||
},
|
||||
"Q8w6dw4jGLBP9ftB": {
|
||||
"name": "Écocampus"
|
||||
},
|
||||
"T5WoHbs4FT5A945Z": {
|
||||
"name": "CinéClub"
|
||||
},
|
||||
"zmgdYw62RatzmGDt": {
|
||||
"name": "Ulmity"
|
||||
},
|
||||
"iXGysEGxo7EsKjwG": {
|
||||
"name": "Ambassadeur·rice·s santé",
|
||||
"short_name": "Amba. santé",
|
||||
"color": "#f5a142"
|
||||
},
|
||||
"AYNpoC674yAjEmRy": {
|
||||
"name": "L'Hômonerie"
|
||||
},
|
||||
"MJf2wnQafbLc2arS": {
|
||||
"name": "Arts pla'",
|
||||
"color": "#ffb969"
|
||||
},
|
||||
"qS7WJwyBaGRQFyX3": {
|
||||
"name": "Exchange and international students",
|
||||
"short_name": "Exchange"
|
||||
},
|
||||
"fGmpGCNZrHQkNt7L": {
|
||||
"name": "Départements",
|
||||
"short_name": "Dpt",
|
||||
"initial": false
|
||||
},
|
||||
"W6qjeqEzEekNieWk": {
|
||||
"name": "Évènements pour les masteriens",
|
||||
"short_name": "Master"
|
||||
},
|
||||
"oDPMTBSma2bfo6WS": {
|
||||
"name": "Amphis de rentrée",
|
||||
"short_name": "Amphis",
|
||||
"initial": false
|
||||
},
|
||||
"aPXtDmXDxmLxkERg": {
|
||||
"name": "Divers rentrée",
|
||||
"short_name": "Rentrée"
|
||||
},
|
||||
"fqK3nqqPtXLyo4Y4": {
|
||||
"name": "Rentrée du COF",
|
||||
"short_name": "COF"
|
||||
},
|
||||
"YQnfcozPDoRgNSBb": {
|
||||
"name": "Rentrée du BDS",
|
||||
"short_name": "BDS"
|
||||
},
|
||||
"tfA32kgc3GM2fH2C": {
|
||||
"name": "Visites"
|
||||
},
|
||||
"KDNA4GrFMkkJrwNd": {
|
||||
"name": "Associatif divers",
|
||||
"short_name": "Asso"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,10 @@
|
|||
{
|
||||
"nameMap": {
|
||||
"Amphi Jourdan": "Amphithéâtre Jourdan",
|
||||
"Cour aux Ernest": "Cour aux Ernests",
|
||||
"R2-21 (Jourdan)": "R2-21",
|
||||
"Salle Jean Ibanes (Jourdan, R1-07)": "Salle Jean Ibanes (R1-07)",
|
||||
"Salle Madeleine Rebérioux (Jourdan, R2-02)": "Salle Madeleine Rebérioux (R2-02)",
|
||||
"Salle Marcel Roncayolo (Jourdan, R2-05)": "Salle Marcel Roncayolo (R2-05)",
|
||||
"Cour des bibliothèques": "Cour du NIR",
|
||||
"Salle Jaurès": "Amphithéâtre Jaurès",
|
||||
"Jaurès": "Amphithéâtre Jaurès",
|
||||
"Dussane": "Salle Dussane",
|
||||
"Cour aux Ernest": "Cour aux Ernests",
|
||||
"Restaurant": "Pôt",
|
||||
"29 rue d'Ulm": "Bâtiment du 29",
|
||||
"Gymnase": "Gymnase Jean Prévost",
|
||||
"Pôt (Restaurant)": "Pôt"
|
||||
"Salle Marcel Roncayolo (Jourdan, R2-05)": "Salle Marcel Roncayolo (R2-05)"
|
||||
},
|
||||
|
||||
"rooms": {
|
||||
|
@ -22,7 +12,6 @@
|
|||
"Amphithéâtre Galois",
|
||||
"Bibliothèque Lettres",
|
||||
"Salle Histoire",
|
||||
"Salle Aron",
|
||||
"Salle Cavaillès",
|
||||
"Salle Dussane",
|
||||
"Salle des Actes",
|
||||
|
@ -31,10 +20,6 @@
|
|||
"Salle Cartan",
|
||||
"Salle Noether",
|
||||
"Salle Bourbaki",
|
||||
"Petite salle ECLA",
|
||||
"Salle Reig ECLA",
|
||||
"Salle Césaire ECLA",
|
||||
"Salle Beckett",
|
||||
"Cour aux Ernests",
|
||||
"Cour du NIR",
|
||||
"Cour Pasteur",
|
||||
|
@ -43,17 +28,11 @@
|
|||
"Canopée",
|
||||
"K-Fêt",
|
||||
"Cave d'hackENS",
|
||||
"Gymnase Jean Prévost",
|
||||
"Salle d'expression artistique (SEA)",
|
||||
"Locaux des départements lettres et sciences humaines et sociales"
|
||||
"Gymnase"
|
||||
],
|
||||
"24 rue Lhomond": ["Salle CONF IV"],
|
||||
"29 rue d'Ulm": [
|
||||
"Bâtiment du 29",
|
||||
"Bibliothèque des sciences expérimentales",
|
||||
"Amphithéâtre Jaurès"],
|
||||
"29 rue d'Ulm": ["Bibliothèque des sciences expérimentales", "Salle Jaurès"],
|
||||
"Jourdan": [
|
||||
"Campus de Jourdan",
|
||||
"Bibliothèque de Jourdan",
|
||||
"Salle Marcel Roncayolo (R2-05)",
|
||||
"Salle Madeleine Rebérioux (R2-02)",
|
||||
|
|
47
default.nix
47
default.nix
|
@ -1,44 +1,9 @@
|
|||
{ pkgs ? import ./nix {} }:
|
||||
{
|
||||
sources ? import ./npins,
|
||||
pkgs ? import sources.nixpkgs { },
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (pkgs.lib.fileset)
|
||||
fileFilter
|
||||
gitTrackedWith
|
||||
intersection
|
||||
toSource
|
||||
;
|
||||
in
|
||||
|
||||
{
|
||||
package = pkgs.buildNpmPackage {
|
||||
name = "metis";
|
||||
|
||||
src = toSource {
|
||||
root = ./.;
|
||||
fileset = intersection (gitTrackedWith { } ./.) (
|
||||
fileFilter ({ name, hasExt, ... }: !(hasExt "nix") && name != "npins") ./.
|
||||
);
|
||||
};
|
||||
|
||||
npmDepsHash = "sha256-RbjWNVY8KlPP9ajQRnrsWhOZiiyyMGQSY39lmZnTC1I=";
|
||||
|
||||
installPhase = ''
|
||||
cp -r public $out
|
||||
'';
|
||||
};
|
||||
|
||||
devShell = pkgs.mkShell {
|
||||
name = "metis.dev";
|
||||
|
||||
packages = [ pkgs.nodejs ];
|
||||
};
|
||||
|
||||
providers = {
|
||||
eleves-ens = "cloud.eleves.ens.fr";
|
||||
frama-agenda = "framagenda.org";
|
||||
dgnum-nc = "cloud.dgnum.eu";
|
||||
production = pkgs.npmlock2nix.build {
|
||||
src = ./.;
|
||||
installPhase = "cp -r public/build $out";
|
||||
buildCommands = [ "npm run build" ];
|
||||
};
|
||||
shell = import ./shell.nix { inherit pkgs; };
|
||||
}
|
||||
|
|
12
nix/default.nix
Normal file
12
nix/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
# nix/default.nix
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
let
|
||||
sources = import ./sources.nix;
|
||||
in
|
||||
import sources.nixpkgs {
|
||||
overlays = [
|
||||
(self: super: {
|
||||
npmlock2nix = pkgs.callPackage sources.npmlock2nix { };
|
||||
})
|
||||
];
|
||||
}
|
38
nix/sources.json
Normal file
38
nix/sources.json
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"niv": {
|
||||
"branch": "master",
|
||||
"description": "Easy dependency management for Nix projects",
|
||||
"homepage": "https://github.com/nmattia/niv",
|
||||
"owner": "nmattia",
|
||||
"repo": "niv",
|
||||
"rev": "5830a4dd348d77e39a0f3c4c762ff2663b602d4c",
|
||||
"sha256": "1d3lsrqvci4qz2hwjrcnd8h5vfkg8aypq3sjd4g3izbc8frwz5sm",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/nmattia/niv/archive/5830a4dd348d77e39a0f3c4c762ff2663b602d4c.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"nixpkgs": {
|
||||
"branch": "master",
|
||||
"description": "Nix Packages collection",
|
||||
"homepage": "",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "21.05",
|
||||
"sha256": "1ckzhh24mgz6jd1xhfgx0i9mijk6xjqxwsshnvq789xsavrmsc36",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/nixos/nixpkgs/archive/21.05.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"npmlock2nix": {
|
||||
"branch": "master",
|
||||
"description": null,
|
||||
"homepage": null,
|
||||
"owner": "nix-community",
|
||||
"repo": "npmlock2nix",
|
||||
"rev": "ff17a3c59233911f776d8d462d61d82a3e41df34",
|
||||
"sha256": "0l624gkkpn1r0g48b204k0wcqm9cwy5rzd5mnxwfjhyjj1wg4nl7",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/nix-community/npmlock2nix/archive/ff17a3c59233911f776d8d462d61d82a3e41df34.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
}
|
||||
}
|
174
nix/sources.nix
Normal file
174
nix/sources.nix
Normal file
|
@ -0,0 +1,174 @@
|
|||
# This file has been generated by Niv.
|
||||
|
||||
let
|
||||
|
||||
#
|
||||
# The fetchers. fetch_<type> fetches specs of type <type>.
|
||||
#
|
||||
|
||||
fetch_file = pkgs: name: spec:
|
||||
let
|
||||
name' = sanitizeName name + "-src";
|
||||
in
|
||||
if spec.builtin or true then
|
||||
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
|
||||
else
|
||||
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
|
||||
|
||||
fetch_tarball = pkgs: name: spec:
|
||||
let
|
||||
name' = sanitizeName name + "-src";
|
||||
in
|
||||
if spec.builtin or true then
|
||||
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
|
||||
else
|
||||
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
|
||||
|
||||
fetch_git = name: spec:
|
||||
let
|
||||
ref =
|
||||
if spec ? ref then spec.ref else
|
||||
if spec ? branch then "refs/heads/${spec.branch}" else
|
||||
if spec ? tag then "refs/tags/${spec.tag}" else
|
||||
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
|
||||
in
|
||||
builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; };
|
||||
|
||||
fetch_local = spec: spec.path;
|
||||
|
||||
fetch_builtin-tarball = name: throw
|
||||
''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
|
||||
$ niv modify ${name} -a type=tarball -a builtin=true'';
|
||||
|
||||
fetch_builtin-url = name: throw
|
||||
''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
|
||||
$ niv modify ${name} -a type=file -a builtin=true'';
|
||||
|
||||
#
|
||||
# Various helpers
|
||||
#
|
||||
|
||||
# https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
|
||||
sanitizeName = name:
|
||||
(
|
||||
concatMapStrings (s: if builtins.isList s then "-" else s)
|
||||
(
|
||||
builtins.split "[^[:alnum:]+._?=-]+"
|
||||
((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
|
||||
)
|
||||
);
|
||||
|
||||
# The set of packages used when specs are fetched using non-builtins.
|
||||
mkPkgs = sources: system:
|
||||
let
|
||||
sourcesNixpkgs =
|
||||
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; };
|
||||
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
|
||||
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
|
||||
in
|
||||
if builtins.hasAttr "nixpkgs" sources
|
||||
then sourcesNixpkgs
|
||||
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
|
||||
import <nixpkgs> {}
|
||||
else
|
||||
abort
|
||||
''
|
||||
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
|
||||
add a package called "nixpkgs" to your sources.json.
|
||||
'';
|
||||
|
||||
# The actual fetching function.
|
||||
fetch = pkgs: name: spec:
|
||||
|
||||
if ! builtins.hasAttr "type" spec then
|
||||
abort "ERROR: niv spec ${name} does not have a 'type' attribute"
|
||||
else if spec.type == "file" then fetch_file pkgs name spec
|
||||
else if spec.type == "tarball" then fetch_tarball pkgs name spec
|
||||
else if spec.type == "git" then fetch_git name spec
|
||||
else if spec.type == "local" then fetch_local spec
|
||||
else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
|
||||
else if spec.type == "builtin-url" then fetch_builtin-url name
|
||||
else
|
||||
abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
|
||||
|
||||
# If the environment variable NIV_OVERRIDE_${name} is set, then use
|
||||
# the path directly as opposed to the fetched source.
|
||||
replace = name: drv:
|
||||
let
|
||||
saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
|
||||
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
|
||||
in
|
||||
if ersatz == "" then drv else
|
||||
# this turns the string into an actual Nix path (for both absolute and
|
||||
# relative paths)
|
||||
if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
|
||||
|
||||
# Ports of functions for older nix versions
|
||||
|
||||
# a Nix version of mapAttrs if the built-in doesn't exist
|
||||
mapAttrs = builtins.mapAttrs or (
|
||||
f: set: with builtins;
|
||||
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
|
||||
);
|
||||
|
||||
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
|
||||
range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
|
||||
|
||||
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
|
||||
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
|
||||
|
||||
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
|
||||
stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
|
||||
concatMapStrings = f: list: concatStrings (map f list);
|
||||
concatStrings = builtins.concatStringsSep "";
|
||||
|
||||
# https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
|
||||
optionalAttrs = cond: as: if cond then as else {};
|
||||
|
||||
# fetchTarball version that is compatible between all the versions of Nix
|
||||
builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
|
||||
let
|
||||
inherit (builtins) lessThan nixVersion fetchTarball;
|
||||
in
|
||||
if lessThan nixVersion "1.12" then
|
||||
fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
|
||||
else
|
||||
fetchTarball attrs;
|
||||
|
||||
# fetchurl version that is compatible between all the versions of Nix
|
||||
builtins_fetchurl = { url, name ? null, sha256 }@attrs:
|
||||
let
|
||||
inherit (builtins) lessThan nixVersion fetchurl;
|
||||
in
|
||||
if lessThan nixVersion "1.12" then
|
||||
fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
|
||||
else
|
||||
fetchurl attrs;
|
||||
|
||||
# Create the final "sources" from the config
|
||||
mkSources = config:
|
||||
mapAttrs (
|
||||
name: spec:
|
||||
if builtins.hasAttr "outPath" spec
|
||||
then abort
|
||||
"The values in sources.json should not have an 'outPath' attribute"
|
||||
else
|
||||
spec // { outPath = replace name (fetch config.pkgs name spec); }
|
||||
) config.sources;
|
||||
|
||||
# The "config" used by the fetchers
|
||||
mkConfig =
|
||||
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
|
||||
, sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
|
||||
, system ? builtins.currentSystem
|
||||
, pkgs ? mkPkgs sources system
|
||||
}: rec {
|
||||
# The sources, i.e. the attribute set of spec name to spec
|
||||
inherit sources;
|
||||
|
||||
# The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
|
||||
inherit pkgs;
|
||||
};
|
||||
|
||||
in
|
||||
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
|
|
@ -1,47 +0,0 @@
|
|||
# Generated by npins. Do not modify; will be overwritten regularly
|
||||
let
|
||||
data = builtins.fromJSON (builtins.readFile ./sources.json);
|
||||
version = data.version;
|
||||
|
||||
mkSource = spec:
|
||||
assert spec ? type; let
|
||||
path =
|
||||
if spec.type == "Git" then mkGitSource spec
|
||||
else if spec.type == "GitRelease" then mkGitSource spec
|
||||
else if spec.type == "PyPi" then mkPyPiSource spec
|
||||
else if spec.type == "Channel" then mkChannelSource spec
|
||||
else builtins.throw "Unknown source type ${spec.type}";
|
||||
in
|
||||
spec // { outPath = path; };
|
||||
|
||||
mkGitSource = { repository, revision, url ? null, hash, ... }:
|
||||
assert repository ? type;
|
||||
# At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository
|
||||
# In the latter case, there we will always be an url to the tarball
|
||||
if url != null then
|
||||
(builtins.fetchTarball {
|
||||
inherit url;
|
||||
sha256 = hash; # FIXME: check nix version & use SRI hashes
|
||||
})
|
||||
else assert repository.type == "Git"; builtins.fetchGit {
|
||||
url = repository.url;
|
||||
rev = revision;
|
||||
# hash = hash;
|
||||
};
|
||||
|
||||
mkPyPiSource = { url, hash, ... }:
|
||||
builtins.fetchurl {
|
||||
inherit url;
|
||||
sha256 = hash;
|
||||
};
|
||||
|
||||
mkChannelSource = { url, hash, ... }:
|
||||
builtins.fetchTarball {
|
||||
inherit url;
|
||||
sha256 = hash;
|
||||
};
|
||||
in
|
||||
if version == 3 then
|
||||
builtins.mapAttrs (_: mkSource) data.pins
|
||||
else
|
||||
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"pins": {
|
||||
"nixpkgs": {
|
||||
"type": "Channel",
|
||||
"name": "nixpkgs-unstable",
|
||||
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-24.11pre696114.dfffb2e7a52d/nixexprs.tar.xz",
|
||||
"hash": "15dj4hcx5wqcnxwfhh1gx2rpcwyip794bkmv0vpz4f01hibr7wd2"
|
||||
}
|
||||
},
|
||||
"version": 3
|
||||
}
|
3748
package-lock.json
generated
3748
package-lock.json
generated
File diff suppressed because it is too large
Load diff
BIN
public.tar.gz
Normal file
BIN
public.tar.gz
Normal file
Binary file not shown.
|
@ -4,7 +4,7 @@
|
|||
<meta charset='utf-8'>
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
||||
|
||||
<title>Calendrier de la DGNum</title>
|
||||
<title>Calendrier du Club Réseau</title>
|
||||
|
||||
<link rel='icon' href='/favicon.svg'>
|
||||
<link rel='stylesheet' href='/global.css'>
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
(import ./. { }).devShell
|
||||
{ pkgs ? import ./nix {} }:
|
||||
pkgs.npmlock2nix.shell {
|
||||
src = ./.;
|
||||
nodejs = pkgs.nodejs-14_x;
|
||||
}
|
||||
|
|
|
@ -102,7 +102,6 @@
|
|||
title: room
|
||||
}))
|
||||
),
|
||||
filterResourcesWithEvents: true,
|
||||
height: '100%',
|
||||
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
|
||||
nowIndicator: true,
|
||||
|
@ -122,11 +121,6 @@
|
|||
isLoading = b;
|
||||
if (spinner) {
|
||||
spinner.$set({ isLoading: b });
|
||||
if (b) {
|
||||
setTimeout(() => {
|
||||
spinner.$set({ isLoading: false });
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
},
|
||||
eventSources: [],
|
||||
|
@ -135,14 +129,11 @@
|
|||
progressiveEventRendering: true,
|
||||
expandRows: true,
|
||||
eventDidMount: info => {
|
||||
const title = info.event.extendedProps.short_name;
|
||||
if (title !== undefined) {
|
||||
new Tooltip(info.el, {
|
||||
title: title,
|
||||
title: info.event.extendedProps.short_name,
|
||||
trigger: 'hover',
|
||||
placement: 'top'
|
||||
});
|
||||
}
|
||||
},
|
||||
viewDidMount: arg => {
|
||||
spinner = new Spinner({
|
||||
|
@ -205,12 +196,6 @@
|
|||
<FullCalendar bind:this={calendar} options={$options} />
|
||||
|
||||
<EventModal event={$event} open={openModal} {toggle} />
|
||||
|
||||
<script
|
||||
defer
|
||||
data-domain="calendrier.dgnum.eu"
|
||||
src="https://analytics.dgnum.eu/js/script.js"
|
||||
></script>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
|
|
|
@ -56,10 +56,7 @@
|
|||
</span>
|
||||
|
||||
<span>
|
||||
{#if event.extendedProps.simAllDay}
|
||||
<Icon name="calendar-range" class="text-primary" />
|
||||
<span class="ms-1">{dateFormat(event.start)} ({timeFormat(event.extendedProps.realStart)}) - {dateFormat(event.end)} ({timeFormat(event.extendedProps.realEnd)})</span>
|
||||
{:else if event.allDay}
|
||||
{#if event.allDay}
|
||||
<Icon name="calendar-range" class="text-primary" />
|
||||
<span class="ms-1">{dateFormat(event.start)} - {dateFormat(event.end)}</span>
|
||||
{:else}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
<ModalBody>
|
||||
<p>Calendrier commun de la vie étudiante de l'ENS</p>
|
||||
<b>Comment rajouter son calendrier :</b>
|
||||
<b>Comment rajouter son calendrier :</b>
|
||||
<ul>
|
||||
<li>
|
||||
Utiliser un NextCloud, idéalement
|
||||
|
@ -26,18 +26,15 @@
|
|||
</li>
|
||||
<li>Créer un calendrier dessus, créer un lien de partage public.</li>
|
||||
<li>
|
||||
Envoyer le lien de partage public à la DGNum<br />
|
||||
(calendrier [at] dgnum [.] eu) pour faire une requête d'ajout.
|
||||
Envoyer le lien de partage public au Club Réseau<br />
|
||||
(club-reseau [at] lists [.] ens [.] psl [.] eu) pour faire une requête d'ajout.
|
||||
</li>
|
||||
</ul>
|
||||
<p>Code source :
|
||||
<a href="https://git.dgnum.eu/DGNum/metis">https://git.dgnum.eu/DGNum/metis</a>
|
||||
</p>
|
||||
</ModalBody>
|
||||
|
||||
<ModalFooter>
|
||||
<Icon name="balloon-heart" class="text-danger fs-5" />
|
||||
<span class="fs-7">Propulsé par la <a href="https://dgnum.eu">Délégation Générale Numérique</a></span>
|
||||
<span class="fs-7">Propulsé par le Club Réseau de l'ENS</span>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
|
||||
|
|
|
@ -132,31 +132,13 @@ function fcEventFromjCalEvent(cal) {
|
|||
return function (evt) {
|
||||
const start = new Date(evt.dtstart)
|
||||
const end = new Date(evt.dtend)
|
||||
|
||||
const allDay = !evt.dtstart.endsWith('Z')
|
||||
|
||||
const duration = end - start // in ms
|
||||
const dayMs = 24 * 3600 * 1000
|
||||
|
||||
const fcEvent = {
|
||||
title: `${cal.short_name ?? cal.name} : ${evt.summary}`,
|
||||
start: evt.dtstart,
|
||||
end: evt.dtend,
|
||||
color: cal.color,
|
||||
textColor: invertColor(cal.color),
|
||||
duration: duration
|
||||
}
|
||||
|
||||
if (!allDay && (duration > dayMs - 1)) {
|
||||
fcEvent.allDay = true
|
||||
fcEvent.simAllDay = true
|
||||
|
||||
fcEvent.realStart = new Date(start)
|
||||
fcEvent.realEnd = new Date(end)
|
||||
|
||||
fcEvent.start = start.setUTCHours(0, 0, 0)
|
||||
fcEvent.end = end.setUTCHours(23, 59, 59)
|
||||
fcEvent.duration = end - start // Update the duration
|
||||
duration: end - start // in ms
|
||||
}
|
||||
|
||||
fcEvent.calendar = cal.name
|
||||
|
@ -190,6 +172,14 @@ function fcEventFromjCalEvent(cal) {
|
|||
}
|
||||
}
|
||||
|
||||
function mkEventsFromCalendar(id, cal) {
|
||||
return fetchCalendar(id, cal).then(calendar => {
|
||||
if (calendar[0] !== 'vcalendar') return
|
||||
const cal = new Calendar(id, calendar)
|
||||
return cal.events.map(fcEventFromjCalEvent(cal))
|
||||
})
|
||||
}
|
||||
|
||||
export function mkSource(name) {
|
||||
const calendarId = calendarsByName[name]
|
||||
if (!calendarId) return null
|
||||
|
|
Loading…
Reference in a new issue