add nix development flake

This commit is contained in:
2023-07-21 00:07:11 +02:00
parent 9bf1a13e02
commit c59b2732f7
6 changed files with 72 additions and 12 deletions

View File

@@ -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

View File

@@ -12,4 +12,4 @@ pnpm-lock.yaml
package-lock.json
yarn.lock
static/languages/*/.json
static/languages/*.json

27
flake.lock generated Normal file
View File

@@ -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
}

40
flake.nix Normal file
View File

@@ -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
];
};
});
};
}

4
package-lock.json generated
View File

@@ -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": {

View File

@@ -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",