From 907ee0c71e0ee2a0f42023be9cd161105993c183 Mon Sep 17 00:00:00 2001 From: DashieTM Date: Thu, 13 Feb 2025 15:40:22 +0100 Subject: [PATCH] Add nix flake --- .gitignore | 5 ++- flake.lock | 64 ++++++++++++++++++++++++++++++++++++ flake.nix | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 164 insertions(+), 1 deletion(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index 3ec53bc..10d22d8 100644 --- a/.gitignore +++ b/.gitignore @@ -202,4 +202,7 @@ dist/* #ionide .ionide/ -*.fs.js \ No newline at end of file +*.fs.js + +# Nix +.envrc diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..26044d2 --- /dev/null +++ b/flake.lock @@ -0,0 +1,64 @@ +{ + "nodes": { + "allSystems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1738453229, + "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1739214665, + "narHash": "sha256-26L8VAu3/1YRxS8MHgBOyOM8xALdo6N0I04PgorE7UM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "64e75cd44acf21c7933d61d7721e812eac1b5a0a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "allSystems": "allSystems", + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..421d08b --- /dev/null +++ b/flake.nix @@ -0,0 +1,96 @@ +{ + description = "Fable library for testing."; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-parts = { + url = "github:hercules-ci/flake-parts"; + inputs.nixpkgs-lib.follows = "nixpkgs"; + }; + allSystems.url = "github:nix-systems/default"; + }; + + outputs = + inputs@{ self, flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = import inputs.allSystems; + + perSystem = + { + self', + lib, + pkgs, + system, + ... + }: + let + permittedPackages = [ + "dotnet-core-combined" + "dotnet-wrapped-combined" + "dotnet-combined" + "dotnet-sdk-6.0.428" + "dotnet-sdk-wrapped-6.0.428" + "dotnet-sdk-6.0.136" + ]; + libPath = + with pkgs; + lib.makeLibraryPath [ + glib + nss + nspr + atk + cups + libdrm + dbus + expat + xorg.libX11 + xorg.libXcomposite + xorg.libXdamage + xorg.libXext + xorg.libXfixes + xorg.libXrandr + xorg.libxcb + xorg.libxshmfence + libxkbcommon + libxcomp + libgbm + gtk3 + pango + cairo + alsa-lib + ]; + in + { + _module.args.pkgs = import self.inputs.nixpkgs { + inherit system; + config = { + permittedInsecurePackages = permittedPackages; + }; + }; + devShells.default = pkgs.mkShell { + inputsFrom = builtins.attrValues self'.packages; + env = { + # Both are defined at https://pptr.dev/api/puppeteer.chromesettings + PUPPETEER_CHROME_SKIP_DOWNLOAD = true; + PUPPETEER_SKIP_CHROME_DOWNLOAD = true; + PUPPETEER_SKIP_DOWNLOAD = true; + NODE_OPTIONS = "--openssl-legacy-provider"; + PUPPETEER_EXECUTABLE_PATH = "${pkgs.chromium}/bin/chromium"; + PUPPETEER_BROWSER = "chrome"; + }; + packages = with pkgs; [ + ( + with dotnetCorePackages; + combinePackages [ + dotnetCorePackages.sdk_6_0 + dotnetCorePackages.sdk_8_0 + ] + ) + fantomas + chromium + ]; + LD_LIBRARY_PATH = libPath; + }; + }; + }; +}