aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix56
1 files changed, 56 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..bbfd8f0
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,56 @@
1# Author: Euxane TRAN-GIRARD
2# Licence: EUPL-1.2
3
4{
5 inputs = {
6 # For Nim 2.2.0 (necessary for generics, also better C compiler on master)
7 # https://github.com/NixOS/nixpkgs/pull/346578
8 nixpkgs.url = "github:NixOS/nixpkgs/7b2fbd2";
9 flake-utils.url = "github:numtide/flake-utils";
10 flaky-utils.url = "git+https://cgit.euxane.net/flaky-utils";
11 };
12
13 outputs = { self, nixpkgs, flake-utils, flaky-utils }:
14 flake-utils.lib.eachDefaultSystem (system: let
15 pkgs = import nixpkgs { inherit system; };
16 in {
17 devShell = flaky-utils.lib.mkDevShell {
18 inherit pkgs;
19
20 tools = with pkgs; [
21 nim
22 nrpl
23 nim-atlas
24 nimble
25 nimlangserver
26 nim_lk
27 ];
28
29 prePrompt = ''
30 echo "<C-d> to exit this development shell."
31 '';
32
33 shell = null;
34 };
35
36 packages.default = pkgs.stdenv.mkDerivation (final: {
37 pname = "tickwatch";
38 meta.mainProgram = final.pname;
39 version = "SNAPSHOT";
40 src = ./.;
41 buildInputs = [ pkgs.nim ];
42 buildPhase = ''
43 export VERSION=${final.version}
44 nim c --nimcache:. -d:release main.nim
45 '';
46 doCheck = true;
47 checkPhase = ''
48 nim r --nimcache:. -d:test main.nim
49 '';
50 installPhase = ''
51 mkdir -p $out/bin
52 mv main $out/bin/${final.meta.mainProgram}
53 '';
54 });
55 });
56}