From e959f54b07aa3a2675a942bd5d9e621c2c15cd88 Mon Sep 17 00:00:00 2001 From: pacien Date: Sat, 12 Nov 2022 03:58:54 +0100 Subject: flake: add devshell and VM sandbox --- flake.nix | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 93d4f2e..d9dbbd9 100644 --- a/flake.nix +++ b/flake.nix @@ -22,14 +22,27 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; + flaky-utils.url = "git+https://cgit.pacien.net/libs/flaky-utils"; }; - outputs = { self, nixpkgs, flake-utils }: + outputs = { self, nixpkgs, flake-utils, flaky-utils }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; ldgalleryVersion = "2.1"; + devTools = with pkgs; [ + # generic + tmux - in rec { + # viewer + nodejs-16_x + yarn + + # compiler + stack + ]; + + in pkgs.lib.fold pkgs.lib.recursiveUpdate { } [ + (rec { packages = rec { compiler = pkgs.haskell.lib.compose.overrideCabal (super: { pname = "ldgallery-compiler"; @@ -138,5 +151,25 @@ default = ldgallery; }; - }); + + devShell = flaky-utils.lib.mkDevShell { + inherit pkgs; + tools = devTools; + shell = null; + }; + }) + + (flaky-utils.lib.mkSandboxSystem { + inherit nixpkgs system; + restrictNetwork = false; + patchQemu9p = true; + config = { + environment.systemPackages = devTools; + virtualisation.forwardPorts = [ + { from = "host"; host.port = 8085; guest.port = 8085; } # vue-cli + ]; + }; + }) + + ]); } -- cgit v1.2.3