From c59b2732f71ea1e6c4dab0b4480ba8dd2ba0e33c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thea=20Sch=C3=B6bl?= Date: Fri, 21 Jul 2023 00:07:11 +0200 Subject: [PATCH] add nix development flake --- .github/workflows/build.yml | 3 +-- .prettierignore | 2 +- flake.lock | 27 +++++++++++++++++++++++ flake.nix | 40 +++++++++++++++++++++++++++++++++++ package-lock.json | 4 ++-- src/tools/minify-icon-font.ts | 8 +------ 6 files changed, 72 insertions(+), 12 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 29b2190f..a23ec3a7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,8 +19,7 @@ jobs: python-version: 3.x cache: pip - name: ⏬ Install Python dependencies - run: python -m venv venv - - run: ./venv/bin/pip install -r requirements.txt + run: pip install -r requirements.txt - name: 🐉 Use Node.js 18.16.x uses: actions/setup-node@v3 diff --git a/.prettierignore b/.prettierignore index cad77e00..3cc61f35 100644 --- a/.prettierignore +++ b/.prettierignore @@ -12,4 +12,4 @@ pnpm-lock.yaml package-lock.json yarn.lock -static/languages/*/.json +static/languages/*.json diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..8395d915 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1689752456, + "narHash": "sha256-VOChdECcEI8ixz8QY+YC4JaNEFwQd1V8bA0G4B28Ki0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7f256d7da238cb627ef189d56ed590739f42f13b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..8f793005 --- /dev/null +++ b/flake.nix @@ -0,0 +1,40 @@ +{ + description = "A Nix-flake-based development environment for OpenStApps"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + outputs = { self, nixpkgs }: + let + overlays = [ + (final: prev: rec { + nodejs = prev.nodejs-18_x; + chrome = prev.google-chrome; + firefox = prev.firefox; + webkit = prev.epiphany; # Safari-ish browser + }) + ]; + supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { + pkgs = import nixpkgs { + inherit overlays system; + config.allowUnfree = true; + }; + }); + in + { + devShells = forEachSupportedSystem ({ pkgs }: + let + python = (pkgs.python311.withPackages(ps: with ps; [ brotli fonttools ] ++ (with fonttools.optional-dependencies; [ woff ]))); + in + { + default = pkgs.mkShell { + packages = with pkgs; [ + node2nix + nodejs + python + firefox + chrome + webkit + ]; + }; + }); + }; +} diff --git a/package-lock.json b/package-lock.json index 226d7c44..b509f6f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "cccs", + "name": "amacc1ng", "version": "0.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "cccs", + "name": "amacc1ng", "version": "0.2.0", "license": "AGPL-3.0-or-later", "devDependencies": { diff --git a/src/tools/minify-icon-font.ts b/src/tools/minify-icon-font.ts index eec45afa..542d15cb 100644 --- a/src/tools/minify-icon-font.ts +++ b/src/tools/minify-icon-font.ts @@ -77,15 +77,9 @@ for (const icon of icons) { } glyphs.sort() -const pythonPath = "./venv/bin/python" -if (!existsSync(pythonPath)) { - throw new Error(`Expected a python virtual environment at ${pythonPath}`) -} -console.log(await run(`${pythonPath} --version`)) console.log( await run([ - pythonPath, - "-m fontTools.subset", + "pyftsubset", `"${config.inputPath}"`, `--unicodes=${glyphs.join(",")}`, "--no-layout-closure",