add nix support for dev (#548)

This commit is contained in:
Uriel
2023-02-04 13:35:56 -03:00
committed by GitHub
parent 39603e0d6c
commit 85362c9964
9 changed files with 187 additions and 4 deletions

1
.envrc Normal file
View File

@@ -0,0 +1 @@
use flake

3
.gitignore vendored
View File

@@ -33,3 +33,6 @@ build/
# Rust build artifacts
/target
# direnv has been claimed for Nix usage
.direnv/

View File

@@ -9,7 +9,8 @@
"esbenp.prettier-vscode",
"rust-lang.rust-analyzer",
"bradlc.vscode-tailwindcss",
"EditorConfig.EditorConfig"
"EditorConfig.EditorConfig",
"macabeus.vscode-fluent",
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []

93
flake.lock generated Normal file
View File

@@ -0,0 +1,93 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1675410244,
"narHash": "sha256-ODj6egMoH/HgAF/0wIy0EfRBeUx5FMuLl6uAdUW3kCI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f7543a7539a007e9562e4d8d24e17a4bcf369b68",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-22.11",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1665296151,
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1675391458,
"narHash": "sha256-ukDKZw922BnK5ohL9LhwtaDAdCsJL7L6ScNEyF1lO9w=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "383a4acfd11d778d5c2efcf28376cbd845eeaedf",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

83
flake.nix Normal file
View File

@@ -0,0 +1,83 @@
{
description = "Server app for SlimeVR ecosystem";
inputs.nixpkgs.url = "nixpkgs/nixos-22.11";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.rust-overlay.url = "github:oxalica/rust-overlay";
outputs = {
self,
nixpkgs,
flake-utils,
rust-overlay,
}:
flake-utils.lib.eachDefaultSystem
(
system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {
inherit system overlays;
};
rustTarget = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
nativeBuildInputs = with pkgs; [
curl
gcc
openssl
pkgconfig
which
zlib
freetype
expat
];
buildInputs = with pkgs; [
appimagekit
atk
cairo
dbus
dbus.lib
dprint
gdk-pixbuf
glib.out
gobject-introspection
gtk3
harfbuzz
libayatana-appindicator-gtk3
libffi
libsoup
openssl.out
pango
pkg-config
treefmt
webkitgtk
zlib
# Some nice things to have
exa
fd
jdk # JDK17
nodejs
gradle
];
in {
devShells.default = pkgs.mkShell {
nativeBuildInputs =
nativeBuildInputs
++ [
];
buildInputs =
buildInputs
++ [
rustTarget
];
shellHook = ''
alias ls=exa
alias find=fd
'';
};
}
);
}

View File

@@ -1,4 +1,4 @@
#!/bin/node
#!/usr/bin/env node
/*
Process exit codes:
First bit: Fluent syntax error in english file

View File

@@ -1,4 +1,4 @@
#!/bin/node
#!/usr/bin/env node
// eslint-disable-next-line @typescript-eslint/no-var-requires
const fs = require('fs');
// eslint-disable-next-line @typescript-eslint/no-var-requires

2
shell.nix Normal file
View File

@@ -0,0 +1,2 @@
# Just uses the flake. For the nix-env addon (which is kind of dead) users, I use the direnv addon.
(builtins.getFlake ("git+file://" + toString ./.)).devShells.${builtins.currentSystem}.default