1
0
Fork 0

add a nix flake and update dependencies

This commit is contained in:
chaos 2023-09-13 16:02:51 +01:00
parent c170f2a622
commit fe68878411
No known key found for this signature in database
12 changed files with 14196 additions and 35 deletions

3
.browserslistrc Normal file
View file

@ -0,0 +1,3 @@
> 0.25%
not dead
since 2016

2
.envrc
View file

@ -1 +1 @@
use nix
use flake

8
default.nix Normal file
View file

@ -0,0 +1,8 @@
(import (let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}) {src = ./.;})
.defaultNix

78
flake.lock Normal file
View file

@ -0,0 +1,78 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1694422566,
"narHash": "sha256-lHJ+A9esOz9vln/3CJG23FV6Wd2OoOFbDeEs4cMGMqc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3a2786eea085f040a66ecde1bc3ddc7099f6dbeb",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs",
"utils": "utils"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

97
flake.nix Normal file
View file

@ -0,0 +1,97 @@
{
description = "A Web UI for Hashicorp Vault";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = {
self,
nixpkgs,
utils,
...
}:
{
nixosModules.vaultui = import ./nixos-module.nix;
nixosModules.default = self.nixosModules.vaultui;
overlays.vaultui = final: prev: {
vaultui = final.mkYarnPackage rec {
pname = "vaultui";
version = "latest";
src = ./.;
yarnLock = ./yarn.lock;
yarnNix = ./yarn.nix;
packageJSON = ./package.json;
doDist = false;
# required for using system libsass, or else it tries to fetch new node headers
yarnPreBuild = ''
export npm_config_nodedir=${final.pkgs.nodejs}
'';
pkgConfig = {
node-sass = {
nativeBuildInputs = with final.pkgs; [pkg-config];
buildInputs = with final.pkgs; [libsass python3];
postInstall = ''
LIBSASS_EXT=auto yarn --offline run build
rm build/config.gypi
'';
};
};
buildPhase = ''
runHook preBuild
yarn run build
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p "$out/share/vaultui"
${final.rsync}/bin/rsync --recursive deps/vaultui/dist/ "$out/share/vaultui"
runHook postInstall
'';
};
};
overlays.default = self.overlays.vaultui;
}
// utils.lib.eachSystem (utils.lib.defaultSystems) (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [self.overlays.default];
};
in {
defaultPackage = self.packages."${system}".vaultui;
packages.vaultui = pkgs.vaultui;
devShell = pkgs.mkShell {
LIBSASS_EXT = "auto";
npm_config_nodedir = "${pkgs.nodejs}";
nativeBuildInputs = with pkgs; [
nodejs
nodePackages.yarn
yarn2nix
# So we don't need to manually build libsass
pkg-config
libsass
python3
];
};
});
}

47
nixos-module.nix Normal file
View file

@ -0,0 +1,47 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.options) mkOption mkEnableOption mkPackageOption;
inherit (lib) types;
cfg = config.services.vaultui;
in {
options = {
services.vaultui = {
enable = mkEnableOption "vaultui";
package = mkPackageOption pkgs "vaultui";
domain = mkOption {
type = types.str;
};
path = mkOption {
type = types.str;
default = "/";
};
};
};
config = mkIf cfg.enable {
services.nginx = {
enable = true;
virtualHosts."${cfg.domain}" = {
forceSSL = true;
enableACME = true;
locations = {
"${cfg.path}" = {
root = "${cfg.package}/share/vaultui";
extraConfig = ''
try_files $uri $uri/ /index.html;
'';
};
};
};
};
};
}

View file

@ -1,55 +1,58 @@
{
"name": "vaultui",
"version": "latest",
"version": "1.0.0",
"scripts": {
"build": "webpack"
},
"devDependencies": {
"@babel/core": "^7.22.9",
"@babel/eslint-parser": "^7.22.9",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.22.7",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/core": "^7.22.17",
"@babel/eslint-parser": "^7.22.15",
"@babel/plugin-proposal-decorators": "^7.22.15",
"@babel/plugin-syntax-import-assertions": "^7.22.5",
"@babel/plugin-transform-runtime": "^7.22.9",
"@babel/preset-env": "^7.22.9",
"@babel/plugin-transform-class-properties": "^7.22.5",
"@babel/plugin-transform-runtime": "^7.22.15",
"@babel/preset-env": "^7.22.15",
"@types/file-saver": "^2.0.5",
"@types/js-yaml": "^4.0.5",
"@types/prismjs": "^1.26.0",
"@types/uikit": "^3.14.0",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"@types/uikit": "^3.14.1",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"babel-loader": "^9.1.3",
"css-loader": "^6.8.1",
"css-minimizer-webpack-plugin": "^5.0.1",
"eslint": "^8.46.0",
"eslint-config-prettier": "^8.9.0",
"eslint-plugin-import": "^2.28.0",
"eslint": "^8.49.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
"git-revision-webpack-plugin": "^5.0.0",
"html-webpack-plugin": "^5.5.3",
"node-sass": "^9.0.0",
"prettier": "^3.0.0",
"prettier": "^3.0.3",
"raw-loader": "^4.0.2",
"sass-loader": "^13.3.2",
"ts-loader": "^9.4.4",
"typescript": "^5.1.6",
"typescript": "^5.2.2",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
},
"dependencies": {
"clipboard": "^2.0.11",
"codejar": "^4.1.1",
"core-js": "^3.32.0",
"codejar": "^4.2.0",
"core-js": "^3.32.2",
"date-fns": "^2.30.0",
"file-saver": "^2.0.5",
"i18next": "^23.3.0",
"i18next": "^23.5.1",
"js-yaml": "^4.1.0",
"json5": "^2.2.3",
"normalize.css": "^8.0.1",
"preact": "^10.16.0",
"preact": "^10.17.1",
"preact-router": "^4.1.2",
"prismjs": "^1.29.0",
"qr-scanner": "^1.4.2",
"uikit": "^3.16.23"
"sass": "^1.66.1",
"uikit": "^3.16.26"
}
}

View file

@ -1,5 +0,0 @@
{ pkgs ? import <nixpkgs> { } }: pkgs.mkShell {
packages = with pkgs; [
nodejs
];
}

View file

@ -1,2 +0,0 @@
#!/usr/bin/env sh
npx npm-check-updates -u

View file

@ -13,17 +13,12 @@ var babelOptions = {
{
"corejs": { "version": 3 },
"useBuiltIns": "usage",
"targets": {
"firefox": "78",
"chrome": "84",
"safari": "11.1"
}
}
]
],
"plugins": [
["@babel/plugin-proposal-decorators", { "decoratorsBeforeExport": true }],
["@babel/plugin-proposal-class-properties"],
["@babel/plugin-transform-class-properties"],
["@babel/transform-runtime"],
["@babel/plugin-syntax-import-assertions"]
]

6694
yarn.lock Normal file

File diff suppressed because it is too large Load diff

7243
yarn.nix Normal file

File diff suppressed because it is too large Load diff