diff options
author | pacien | 2022-11-12 03:58:54 +0100 |
---|---|---|
committer | pacien | 2022-11-12 03:58:54 +0100 |
commit | e959f54b07aa3a2675a942bd5d9e621c2c15cd88 (patch) | |
tree | 8fffe37632bd03393b9d6c5006359d027e313d6d | |
parent | 2106fcac20ffd1719a3dd187a61e0462dd5e6000 (diff) | |
download | ldgallery-e959f54b07aa3a2675a942bd5d9e621c2c15cd88.tar.gz |
flake: add devshell and VM sandbox
-rw-r--r-- | flake.lock | 16 | ||||
-rw-r--r-- | flake.nix | 39 |
2 files changed, 52 insertions, 3 deletions
@@ -15,6 +15,21 @@ | |||
15 | "type": "github" | 15 | "type": "github" |
16 | } | 16 | } |
17 | }, | 17 | }, |
18 | "flaky-utils": { | ||
19 | "locked": { | ||
20 | "lastModified": 1668221526, | ||
21 | "narHash": "sha256-cUtnjzEIgnfohdb0UhPU0ZVYyJ9USQhUwnEXexLlMNc=", | ||
22 | "ref": "master", | ||
23 | "rev": "bfa3be010c8c90f1bd0326747b9b424535381bb2", | ||
24 | "revCount": 11, | ||
25 | "type": "git", | ||
26 | "url": "https://cgit.pacien.net/libs/flaky-utils" | ||
27 | }, | ||
28 | "original": { | ||
29 | "type": "git", | ||
30 | "url": "https://cgit.pacien.net/libs/flaky-utils" | ||
31 | } | ||
32 | }, | ||
18 | "nixpkgs": { | 33 | "nixpkgs": { |
19 | "locked": { | 34 | "locked": { |
20 | "lastModified": 1662019588, | 35 | "lastModified": 1662019588, |
@@ -34,6 +49,7 @@ | |||
34 | "root": { | 49 | "root": { |
35 | "inputs": { | 50 | "inputs": { |
36 | "flake-utils": "flake-utils", | 51 | "flake-utils": "flake-utils", |
52 | "flaky-utils": "flaky-utils", | ||
37 | "nixpkgs": "nixpkgs" | 53 | "nixpkgs": "nixpkgs" |
38 | } | 54 | } |
39 | } | 55 | } |
@@ -22,14 +22,27 @@ | |||
22 | inputs = { | 22 | inputs = { |
23 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | 23 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; |
24 | flake-utils.url = "github:numtide/flake-utils"; | 24 | flake-utils.url = "github:numtide/flake-utils"; |
25 | flaky-utils.url = "git+https://cgit.pacien.net/libs/flaky-utils"; | ||
25 | }; | 26 | }; |
26 | 27 | ||
27 | outputs = { self, nixpkgs, flake-utils }: | 28 | outputs = { self, nixpkgs, flake-utils, flaky-utils }: |
28 | flake-utils.lib.eachDefaultSystem (system: let | 29 | flake-utils.lib.eachDefaultSystem (system: let |
29 | pkgs = import nixpkgs { inherit system; }; | 30 | pkgs = import nixpkgs { inherit system; }; |
30 | ldgalleryVersion = "2.1"; | 31 | ldgalleryVersion = "2.1"; |
32 | devTools = with pkgs; [ | ||
33 | # generic | ||
34 | tmux | ||
31 | 35 | ||
32 | in rec { | 36 | # viewer |
37 | nodejs-16_x | ||
38 | yarn | ||
39 | |||
40 | # compiler | ||
41 | stack | ||
42 | ]; | ||
43 | |||
44 | in pkgs.lib.fold pkgs.lib.recursiveUpdate { } [ | ||
45 | (rec { | ||
33 | packages = rec { | 46 | packages = rec { |
34 | compiler = pkgs.haskell.lib.compose.overrideCabal (super: { | 47 | compiler = pkgs.haskell.lib.compose.overrideCabal (super: { |
35 | pname = "ldgallery-compiler"; | 48 | pname = "ldgallery-compiler"; |
@@ -138,5 +151,25 @@ | |||
138 | 151 | ||
139 | default = ldgallery; | 152 | default = ldgallery; |
140 | }; | 153 | }; |
141 | }); | 154 | |
155 | devShell = flaky-utils.lib.mkDevShell { | ||
156 | inherit pkgs; | ||
157 | tools = devTools; | ||
158 | shell = null; | ||
159 | }; | ||
160 | }) | ||
161 | |||
162 | (flaky-utils.lib.mkSandboxSystem { | ||
163 | inherit nixpkgs system; | ||
164 | restrictNetwork = false; | ||
165 | patchQemu9p = true; | ||
166 | config = { | ||
167 | environment.systemPackages = devTools; | ||
168 | virtualisation.forwardPorts = [ | ||
169 | { from = "host"; host.port = 8085; guest.port = 8085; } # vue-cli | ||
170 | ]; | ||
171 | }; | ||
172 | }) | ||
173 | |||
174 | ]); | ||
142 | } | 175 | } |