From ed6fafda45d638b1bafd5deaee098b80156b41e8 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Thu, 24 Oct 2024 00:08:51 +0200 Subject: [PATCH] feat(nix): Rework a bit --- default.nix | 43 +++++++++++++++++++++++++++++++++++++------ providers.nix | 8 -------- shell.nix | 5 +---- 3 files changed, 38 insertions(+), 18 deletions(-) delete mode 100644 providers.nix diff --git a/default.nix b/default.nix index c97e9c9..5377e57 100644 --- a/default.nix +++ b/default.nix @@ -1,13 +1,44 @@ -{ pkgs ? import (import ./npins).nixpkgs {} }: { - production = pkgs.buildNpmPackage { + sources ? import ./npins, + pkgs ? import sources.nixpkgs { }, +}: + +let + inherit (pkgs.lib.fileset) + fileFilter + gitTrackedWith + intersection + toSource + ; +in + +{ + package = pkgs.buildNpmPackage { name = "metis"; - src = ./.; + + 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"; }; - shell = import ./shell.nix { inherit pkgs; }; - providers = import ./providers.nix; } diff --git a/providers.nix b/providers.nix deleted file mode 100644 index 52acbd5..0000000 --- a/providers.nix +++ /dev/null @@ -1,8 +0,0 @@ -let - providers = { - eleves-ens = "cloud.eleves.ens.fr"; - frama-agenda = "framagenda.org"; - dgnum-nc = "cloud.dgnum.eu"; - }; -in - builtins.mapAttrs (name: value: "https://${value}/remote.php/dav/public-calendars/") providers diff --git a/shell.nix b/shell.nix index 8fffe07..d6d21cf 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1 @@ -{ pkgs ? import (import ./npins).nixpkgs {} }: -pkgs.mkShell { - packages = [ pkgs.nodejs ]; -} +(import ./. { }).devShell