Compare commits
No commits in common. "master" and "eww" have entirely different histories.
703 changed files with 4497 additions and 75139 deletions
.forgejo/workflows
.gitattributes.gitignoreLICENSE.mdREADME.md_outputs.nixapps
README.mdbuildApp.nix
config
default.nixextract-subs
gen-docs
list2series
mc-mods
packages.nixpin-inputs
update-sources
config/eww
|
@ -1,19 +0,0 @@
|
||||||
name: Discord
|
|
||||||
|
|
||||||
on:
|
|
||||||
- workflow_dispatch
|
|
||||||
- push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
discord_commits:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: discord commits
|
|
||||||
if: contains(github.event.head_commit.message, '(servers)')
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Discommit
|
|
||||||
uses: https://github.com/matt1432/discommit@v0.0.2
|
|
||||||
with:
|
|
||||||
discord_webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
|
||||||
api_url: 'https://git.nelim.org/api/v1/repos/$OWNER/$REPO/git/commits/$REF'
|
|
||||||
title: 'New commit containing changes to server configs:'
|
|
5
.gitattributes
vendored
5
.gitattributes
vendored
|
@ -1,5 +0,0 @@
|
||||||
flake.lock -diff
|
|
||||||
flake.nix -diff
|
|
||||||
**/non-declarative-conf -diff
|
|
||||||
**/package-lock.json -diff
|
|
||||||
**/HomeAssistantGenerated -diff
|
|
22
.gitignore
vendored
22
.gitignore
vendored
|
@ -1,23 +1 @@
|
||||||
# Python
|
|
||||||
*.egg-info
|
*.egg-info
|
||||||
|
|
||||||
# NPM
|
|
||||||
*node_modules
|
|
||||||
*build/
|
|
||||||
|
|
||||||
# Direnv
|
|
||||||
*.direnv/
|
|
||||||
|
|
||||||
# Generated by nix
|
|
||||||
result*
|
|
||||||
!results/
|
|
||||||
.nixd.json
|
|
||||||
|
|
||||||
## AGS
|
|
||||||
**/vars.ts
|
|
||||||
**/config.js
|
|
||||||
*icons
|
|
||||||
**/types
|
|
||||||
|
|
||||||
# Other
|
|
||||||
*.temp
|
|
||||||
|
|
16
LICENSE.md
16
LICENSE.md
|
@ -1,16 +0,0 @@
|
||||||
MIT No Attribution
|
|
||||||
|
|
||||||
Copyright 2024 Mathis H.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
|
||||||
software and associated documentation files (the "Software"), to deal in the Software
|
|
||||||
without restriction, including without limitation the rights to use, copy, modify,
|
|
||||||
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
permit persons to whom the Software is furnished to do so.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
||||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
||||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
||||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
107
README.md
107
README.md
|
@ -1,100 +1,13 @@
|
||||||
# My NixOS configs
|
what is currently not working:
|
||||||
|
- plymouth theme has no login prompt
|
||||||
|
- sddm theme flashes white
|
||||||
|
- fixme: swaync acts up with eww
|
||||||
|
- autosign in to keyring
|
||||||
|
|
||||||
## AGS
|
what i want to do:
|
||||||
|
- learn flakes
|
||||||
|
- add auto-rotate widget in eww control center
|
||||||
|
|
||||||
You might find it weird that most of my config is written in TypeScript.
|
# Docs
|
||||||
That's because all my desktops run
|
|
||||||
[AGS](https://github.com/Aylur/ags)
|
|
||||||
for UI. Click on
|
|
||||||
[this](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/modules/ags)
|
|
||||||
to see my configuration.
|
|
||||||
|
|
||||||
I'm also a victim of Stockholm syndrome at this point and make my scripts
|
Since I use my laptop with one user, I symlinked the configs to my home directory following the tutorial [here](https://nixos.wiki/wiki/NixOS_configuration_editors)
|
||||||
in TypeScript because it's the scripting language I am most comfortable with.
|
|
||||||
|
|
||||||
## About
|
|
||||||
|
|
||||||
### General
|
|
||||||
|
|
||||||
This repo is the complete configuration of machines I own running NixOS or Nix
|
|
||||||
and any other related smaller projects exposed by a Nix Flake.
|
|
||||||
|
|
||||||
Its main directory structure is based on a flake's
|
|
||||||
[outputs](https://wiki.nixos.org/wiki/Flakes#Output_schema).
|
|
||||||
|
|
||||||
I try to follow a few rules to better organise my Nix code:
|
|
||||||
|
|
||||||
- Every main subdirectory only has an optional `default.nix` and subfolders for each
|
|
||||||
of its attributes.
|
|
||||||
- Inside a subdirectory, if there is non nix code, it will be in a `config` folder.
|
|
||||||
- Every module should not do anything if imported. An enable option should be toggled
|
|
||||||
for it to have any effect.
|
|
||||||
- Any nix file that represents a module should be named `default.nix` (a nix file
|
|
||||||
which is imported directly can be called anything else alongside `default.nix`)
|
|
||||||
|
|
||||||
### Flake Location
|
|
||||||
|
|
||||||
This git repo will always be located at `$FLAKE` (`config.environment.variables.FLAKE`)
|
|
||||||
and symlinked to `/etc/nixos` to have everything where NixOS tools
|
|
||||||
expect things to be.
|
|
||||||
|
|
||||||
ie.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo rm -r /etc/nixos
|
|
||||||
|
|
||||||
echo "$FLAKE" # /home/matt/.nix
|
|
||||||
|
|
||||||
sudo ln -sf /home/matt/.nix /etc/nixos
|
|
||||||
```
|
|
||||||
|
|
||||||
### Subdirectories
|
|
||||||
|
|
||||||
| Output / Directory | Description |
|
|
||||||
| -------------------- | ----------- |
|
|
||||||
| `apps` | [Misc scripts ran from the flake](./apps) |
|
|
||||||
| `configurations` | [device, ISO and nix-on-droid configurations](./configurations) |
|
|
||||||
| `devShells` | [Development shells for a bunch of projects and languages](./devShells) |
|
|
||||||
| `homeManagerModules` | [Modules made for home-manager](./homeManagerModules) |
|
|
||||||
| `inputs` | [Pre-evaluated flake inputs](./inputs) |
|
|
||||||
| `lib` | [Custom Nix functions made easily available](./lib) |
|
|
||||||
| `modules` | [Modules made for NixOS systems](./modules) |
|
|
||||||
| `nixFastChecks` | [Attribute set of derivations exposed by this flake](./nixFastChecks) |
|
|
||||||
| `overlays` | [Nixpkgs overlays](./overlays) |
|
|
||||||
| `packages` | [Some custom packages not available in nixpkgs or modified from it](./packages) |
|
|
||||||
| `results` | Directory where I neatly keep my result symlinks from `nixFastChecks` |
|
|
||||||
| `scopedPackages` | [Some custom package scopes not available in nixpkgs or modified from it](./scopedPackages) |
|
|
||||||
|
|
||||||
### Secrets
|
|
||||||
|
|
||||||
All my secrets are in a private git repo that makes use of
|
|
||||||
[sops-nix](https://github.com/Mic92/sops-nix).
|
|
||||||
I generate `.sops.yaml` from `.sops.nix`:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
let
|
|
||||||
wim = "somekey";
|
|
||||||
binto = "somekey2";
|
|
||||||
in {
|
|
||||||
creation_rules = [
|
|
||||||
{
|
|
||||||
path_regex = "secrets/[^/]+\\.(yaml|json|env|ini)$";
|
|
||||||
key_groups = [
|
|
||||||
{
|
|
||||||
age = [wim binto];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
which is then converted to `.sops.yaml` using
|
|
||||||
[remarshal](https://github.com/remarshal-project/remarshal)
|
|
||||||
and this shell command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
nix eval --json --file ./.sops.nix | remarshal --if json --of yaml > .sops.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
TLDR: I **[hate](https://ruudvanasseldonk.com/2023/01/11/the-yaml-document-from-hell)** YAML
|
|
||||||
|
|
110
_outputs.nix
110
_outputs.nix
|
@ -1,110 +0,0 @@
|
||||||
{
|
|
||||||
inputs = import ./inputs;
|
|
||||||
|
|
||||||
outputs = inputs @ {
|
|
||||||
self,
|
|
||||||
systems,
|
|
||||||
nixpkgs,
|
|
||||||
secrets,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (self.lib) mkNixOS mkNixOnDroid mkPkgs;
|
|
||||||
|
|
||||||
perSystem = attrs:
|
|
||||||
nixpkgs.lib.genAttrs (import systems) (system:
|
|
||||||
attrs (mkPkgs {inherit system nixpkgs;}));
|
|
||||||
in {
|
|
||||||
lib = import ./lib {inherit inputs perSystem;};
|
|
||||||
|
|
||||||
nixOnDroidConfigurations.default =
|
|
||||||
mkNixOnDroid [./configurations/android];
|
|
||||||
|
|
||||||
nixosConfigurations = {
|
|
||||||
# Desktops
|
|
||||||
wim = mkNixOS {
|
|
||||||
extraModules = [
|
|
||||||
./configurations/wim
|
|
||||||
secrets.nixosModules.default
|
|
||||||
];
|
|
||||||
};
|
|
||||||
binto = mkNixOS {
|
|
||||||
cudaSupport = true;
|
|
||||||
extraModules = [./configurations/binto];
|
|
||||||
};
|
|
||||||
|
|
||||||
bbsteamie = mkNixOS {
|
|
||||||
mainUser = "mariah";
|
|
||||||
extraModules = [./configurations/bbsteamie];
|
|
||||||
};
|
|
||||||
|
|
||||||
# NAS
|
|
||||||
nos = mkNixOS {
|
|
||||||
cudaSupport = true;
|
|
||||||
extraModules = [
|
|
||||||
./configurations/nos
|
|
||||||
secrets.nixosModules.nos
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Build / test server
|
|
||||||
servivi = mkNixOS {
|
|
||||||
extraModules = [
|
|
||||||
./configurations/servivi
|
|
||||||
secrets.nixosModules.servivi
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Home-assistant
|
|
||||||
homie = mkNixOS {
|
|
||||||
extraModules = [
|
|
||||||
./configurations/homie
|
|
||||||
secrets.nixosModules.homie
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Cluster
|
|
||||||
thingone = mkNixOS {
|
|
||||||
extraModules = [
|
|
||||||
(import ./configurations/cluster "thingone")
|
|
||||||
secrets.nixosModules.thingy
|
|
||||||
];
|
|
||||||
};
|
|
||||||
thingtwo = mkNixOS {
|
|
||||||
extraModules = [
|
|
||||||
(import ./configurations/cluster "thingtwo")
|
|
||||||
secrets.nixosModules.thingy
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
live-image = mkNixOS {
|
|
||||||
mainUser = "nixos";
|
|
||||||
extraModules = [./configurations/live-image];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# For nix-fast-build. I use a custom output to alleviate eval time of this flake. ie. when doing nix flake show
|
|
||||||
nixFastChecks = import ./nixFastChecks {inherit perSystem self;};
|
|
||||||
|
|
||||||
homeManagerModules = import ./homeManagerModules {inherit self;};
|
|
||||||
|
|
||||||
nixosModules = import ./modules {inherit self;};
|
|
||||||
|
|
||||||
overlays = import ./overlays {inherit self;};
|
|
||||||
|
|
||||||
apps =
|
|
||||||
perSystem (pkgs:
|
|
||||||
import ./apps {inherit pkgs self;});
|
|
||||||
|
|
||||||
appsPackages = perSystem (pkgs: pkgs.appsPackages);
|
|
||||||
|
|
||||||
devShells =
|
|
||||||
perSystem (pkgs:
|
|
||||||
import ./devShells {inherit pkgs self;});
|
|
||||||
|
|
||||||
packages = perSystem (pkgs: pkgs.selfPackages);
|
|
||||||
|
|
||||||
scopedPackages = perSystem (pkgs: pkgs.scopedPackages);
|
|
||||||
|
|
||||||
formatter = perSystem (pkgs: pkgs.alejandra);
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
# Apps
|
|
||||||
|
|
||||||
This directory contains every derivations for apps exposed by this flake.
|
|
||||||
|
|
||||||
## List of my apps found in `self.apps`
|
|
||||||
|
|
||||||
| Name | Description |
|
|
||||||
| ---- | ----------- |
|
|
||||||
| `extract-subs` | Extract all `srt` subtitle files from a `mkv` video with the appropriate name. FIXME: fluent-ffmpeg is deprecated |
|
|
||||||
| `gen-docs` | Generates the READMEs in this repository from nix attributes. |
|
|
||||||
| `list2series` | Converts a Komga read list into a comics series for reading with mihon. |
|
|
||||||
| `mc-mods` | Checks if a list of mods have a version available for a specific Minecraft version and a specific loader. |
|
|
||||||
| `pin-inputs` | Takes a list of inputs to pin to their current rev in `flake.lock`. |
|
|
||||||
| `update-sources` | Updates all derivation sources in this repository and generates a commit message for the changes made. |
|
|
|
@ -1,61 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
src,
|
|
||||||
npmDepsHash,
|
|
||||||
runtimeInputs,
|
|
||||||
buildNpmPackage,
|
|
||||||
meta,
|
|
||||||
makeWrapper,
|
|
||||||
nodejs_latest,
|
|
||||||
jq,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib) boolToString concatMapStringsSep concatStringsSep mapAttrsToList;
|
|
||||||
inherit (builtins) fromJSON isBool readFile;
|
|
||||||
|
|
||||||
packageJSON = fromJSON (readFile "${src}/package.json");
|
|
||||||
tsconfig = fromJSON (readFile ./config/tsconfig.base.json);
|
|
||||||
|
|
||||||
pname = packageJSON.name;
|
|
||||||
inherit (packageJSON) version;
|
|
||||||
in
|
|
||||||
buildNpmPackage {
|
|
||||||
inherit pname version src runtimeInputs npmDepsHash;
|
|
||||||
|
|
||||||
prePatch = ''
|
|
||||||
# Patch tsconfig
|
|
||||||
mv ./tsconfig.json ./project.json
|
|
||||||
sed 's/^ *\/\/.*//' ${./config/tsconfig.base.json} > ./base.json
|
|
||||||
${jq}/bin/jq -sr '.[0] * .[1] | del(.extends)' ./project.json ./base.json > ./tsconfig.json
|
|
||||||
rm base.json project.json
|
|
||||||
'';
|
|
||||||
|
|
||||||
nativeBuildInputs = [makeWrapper];
|
|
||||||
|
|
||||||
postInstall = ''
|
|
||||||
wrapProgram $out/bin/${pname} \
|
|
||||||
--prefix PATH : ${concatMapStringsSep ":" (p: p + "/bin") runtimeInputs}
|
|
||||||
'';
|
|
||||||
|
|
||||||
doCheck = true;
|
|
||||||
|
|
||||||
checkPhase = ''
|
|
||||||
runHook preCheck
|
|
||||||
|
|
||||||
npx tsc ${concatStringsSep " " (mapAttrsToList (n: v:
|
|
||||||
if n == "lib"
|
|
||||||
then concatMapStringsSep " " (x: "--lib ${x}") v
|
|
||||||
else "--${n} ${
|
|
||||||
if isBool v
|
|
||||||
then boolToString v
|
|
||||||
else toString v
|
|
||||||
}")
|
|
||||||
tsconfig.compilerOptions)} src/app.ts
|
|
||||||
|
|
||||||
runHook postCheck
|
|
||||||
'';
|
|
||||||
|
|
||||||
nodejs = nodejs_latest;
|
|
||||||
|
|
||||||
meta = {mainProgram = pname;} // meta;
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
use flake $FLAKE#node
|
|
||||||
npm ci
|
|
|
@ -1,451 +0,0 @@
|
||||||
import eslint from '@eslint/js';
|
|
||||||
import jsdoc from 'eslint-plugin-jsdoc';
|
|
||||||
import stylistic from '@stylistic/eslint-plugin';
|
|
||||||
import tseslint from 'typescript-eslint';
|
|
||||||
|
|
||||||
|
|
||||||
export default tseslint.config({
|
|
||||||
files: ['**/*.js', '**/*.ts'],
|
|
||||||
ignores: ['node_modules/**', 'types/**'],
|
|
||||||
|
|
||||||
extends: [
|
|
||||||
eslint.configs.recommended,
|
|
||||||
jsdoc.configs['flat/recommended-typescript'],
|
|
||||||
stylistic.configs['recommended-flat'],
|
|
||||||
...tseslint.configs.recommended,
|
|
||||||
...tseslint.configs.stylistic,
|
|
||||||
],
|
|
||||||
|
|
||||||
rules: {
|
|
||||||
// JSDoc settings
|
|
||||||
'jsdoc/tag-lines': ['warn', 'any', { startLines: 1 }],
|
|
||||||
'jsdoc/check-line-alignment': ['warn', 'always', {
|
|
||||||
tags: ['param', 'arg', 'argument', 'property', 'prop'],
|
|
||||||
}],
|
|
||||||
'jsdoc/no-types': 'off',
|
|
||||||
|
|
||||||
// Newer settings
|
|
||||||
'@typescript-eslint/no-extraneous-class': ['off'],
|
|
||||||
'@typescript-eslint/no-implied-eval': ['off'],
|
|
||||||
'class-methods-use-this': 'off',
|
|
||||||
'@stylistic/no-multiple-empty-lines': 'off',
|
|
||||||
|
|
||||||
// Pre-flat config
|
|
||||||
'@typescript-eslint/no-unused-vars': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
args: 'all',
|
|
||||||
argsIgnorePattern: '^_',
|
|
||||||
caughtErrors: 'all',
|
|
||||||
caughtErrorsIgnorePattern: '^_',
|
|
||||||
destructuredArrayIgnorePattern: '^_',
|
|
||||||
varsIgnorePattern: '^_',
|
|
||||||
ignoreRestSiblings: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
'array-callback-return': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
allowImplicit: true,
|
|
||||||
checkForEach: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'no-constructor-return': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'no-unreachable-loop': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
ignore: [
|
|
||||||
'ForInStatement',
|
|
||||||
'ForOfStatement',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'no-use-before-define': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
functions: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'block-scoped-var': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'curly': [
|
|
||||||
'warn',
|
|
||||||
],
|
|
||||||
'default-case-last': [
|
|
||||||
'warn',
|
|
||||||
],
|
|
||||||
'default-param-last': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'eqeqeq': [
|
|
||||||
'error',
|
|
||||||
'smart',
|
|
||||||
],
|
|
||||||
'func-names': [
|
|
||||||
'warn',
|
|
||||||
'never',
|
|
||||||
],
|
|
||||||
'func-style': [
|
|
||||||
'warn',
|
|
||||||
'expression',
|
|
||||||
],
|
|
||||||
'logical-assignment-operators': [
|
|
||||||
'warn',
|
|
||||||
'always',
|
|
||||||
],
|
|
||||||
'no-array-constructor': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'no-empty-function': [
|
|
||||||
'warn',
|
|
||||||
],
|
|
||||||
'no-empty-static-block': [
|
|
||||||
'warn',
|
|
||||||
],
|
|
||||||
'no-extend-native': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'no-extra-bind': [
|
|
||||||
'warn',
|
|
||||||
],
|
|
||||||
'no-implicit-coercion': [
|
|
||||||
'warn',
|
|
||||||
],
|
|
||||||
'no-iterator': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'no-labels': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'no-lone-blocks': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'no-lonely-if': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'no-loop-func': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'no-magic-numbers': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
ignore: [
|
|
||||||
-1,
|
|
||||||
0.1,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
3,
|
|
||||||
4,
|
|
||||||
5,
|
|
||||||
10,
|
|
||||||
12,
|
|
||||||
33,
|
|
||||||
66,
|
|
||||||
100,
|
|
||||||
255,
|
|
||||||
360,
|
|
||||||
450,
|
|
||||||
500,
|
|
||||||
1000,
|
|
||||||
],
|
|
||||||
ignoreDefaultValues: true,
|
|
||||||
ignoreClassFieldInitialValues: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'no-multi-assign': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'no-new-wrappers': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'no-object-constructor': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'no-proto': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'no-return-assign': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'no-sequences': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'no-shadow': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
builtinGlobals: true,
|
|
||||||
allow: [
|
|
||||||
'Window',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'no-undef-init': [
|
|
||||||
'warn',
|
|
||||||
],
|
|
||||||
'no-undefined': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'no-useless-constructor': [
|
|
||||||
'warn',
|
|
||||||
],
|
|
||||||
'no-useless-escape': [
|
|
||||||
'off',
|
|
||||||
],
|
|
||||||
'no-useless-return': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'no-var': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'no-void': [
|
|
||||||
'off',
|
|
||||||
],
|
|
||||||
'no-with': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'object-shorthand': [
|
|
||||||
'error',
|
|
||||||
'always',
|
|
||||||
],
|
|
||||||
'one-var': [
|
|
||||||
'error',
|
|
||||||
'never',
|
|
||||||
],
|
|
||||||
'operator-assignment': [
|
|
||||||
'warn',
|
|
||||||
'always',
|
|
||||||
],
|
|
||||||
'prefer-arrow-callback': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'prefer-const': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'prefer-object-has-own': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'prefer-regex-literals': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'prefer-template': [
|
|
||||||
'warn',
|
|
||||||
],
|
|
||||||
'no-prototype-builtins': 'off',
|
|
||||||
'@typescript-eslint/no-var-requires': [
|
|
||||||
'off',
|
|
||||||
],
|
|
||||||
'@stylistic/array-bracket-newline': [
|
|
||||||
'warn',
|
|
||||||
'consistent',
|
|
||||||
],
|
|
||||||
'@stylistic/array-bracket-spacing': [
|
|
||||||
'warn',
|
|
||||||
'never',
|
|
||||||
],
|
|
||||||
'@stylistic/arrow-parens': [
|
|
||||||
'warn',
|
|
||||||
'always',
|
|
||||||
],
|
|
||||||
'@stylistic/brace-style': [
|
|
||||||
'warn',
|
|
||||||
'stroustrup',
|
|
||||||
],
|
|
||||||
'@stylistic/comma-dangle': [
|
|
||||||
'warn',
|
|
||||||
'always-multiline',
|
|
||||||
],
|
|
||||||
'@stylistic/comma-spacing': [
|
|
||||||
'warn',
|
|
||||||
{
|
|
||||||
before: false,
|
|
||||||
after: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'@stylistic/comma-style': [
|
|
||||||
'error',
|
|
||||||
'last',
|
|
||||||
],
|
|
||||||
'@stylistic/dot-location': [
|
|
||||||
'error',
|
|
||||||
'property',
|
|
||||||
],
|
|
||||||
'@stylistic/function-call-argument-newline': [
|
|
||||||
'warn',
|
|
||||||
'consistent',
|
|
||||||
],
|
|
||||||
'@stylistic/function-paren-newline': [
|
|
||||||
'warn',
|
|
||||||
'consistent',
|
|
||||||
],
|
|
||||||
'@stylistic/indent': [
|
|
||||||
'warn',
|
|
||||||
4,
|
|
||||||
{
|
|
||||||
SwitchCase: 1,
|
|
||||||
ignoreComments: true,
|
|
||||||
ignoredNodes: ['TemplateLiteral > *'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'@stylistic/key-spacing': [
|
|
||||||
'warn',
|
|
||||||
{
|
|
||||||
beforeColon: false,
|
|
||||||
afterColon: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'@stylistic/keyword-spacing': [
|
|
||||||
'warn',
|
|
||||||
{
|
|
||||||
before: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'@stylistic/linebreak-style': [
|
|
||||||
'error',
|
|
||||||
'unix',
|
|
||||||
],
|
|
||||||
'@stylistic/lines-between-class-members': [
|
|
||||||
'warn',
|
|
||||||
'always',
|
|
||||||
{
|
|
||||||
exceptAfterSingleLine: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'@stylistic/max-len': [
|
|
||||||
'warn',
|
|
||||||
{
|
|
||||||
code: 105,
|
|
||||||
ignoreComments: true,
|
|
||||||
ignoreTrailingComments: true,
|
|
||||||
ignoreUrls: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'@stylistic/multiline-ternary': [
|
|
||||||
'warn',
|
|
||||||
'always-multiline',
|
|
||||||
],
|
|
||||||
'@stylistic/new-parens': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'@stylistic/no-mixed-operators': [
|
|
||||||
'warn',
|
|
||||||
],
|
|
||||||
'@stylistic/no-mixed-spaces-and-tabs': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'@stylistic/no-multi-spaces': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'@stylistic/no-tabs': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'@stylistic/no-trailing-spaces': [
|
|
||||||
'error',
|
|
||||||
],
|
|
||||||
'@stylistic/no-whitespace-before-property': [
|
|
||||||
'warn',
|
|
||||||
],
|
|
||||||
'@stylistic/nonblock-statement-body-position': [
|
|
||||||
'error',
|
|
||||||
'below',
|
|
||||||
],
|
|
||||||
'@stylistic/object-curly-newline': [
|
|
||||||
'warn',
|
|
||||||
{
|
|
||||||
consistent: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'@stylistic/object-curly-spacing': [
|
|
||||||
'warn',
|
|
||||||
'always',
|
|
||||||
],
|
|
||||||
'@stylistic/operator-linebreak': [
|
|
||||||
'warn',
|
|
||||||
'after',
|
|
||||||
],
|
|
||||||
'@stylistic/padded-blocks': [
|
|
||||||
'error',
|
|
||||||
'never',
|
|
||||||
],
|
|
||||||
'@stylistic/padding-line-between-statements': [
|
|
||||||
'warn',
|
|
||||||
{
|
|
||||||
blankLine: 'always',
|
|
||||||
prev: '*',
|
|
||||||
next: 'return',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
blankLine: 'always',
|
|
||||||
prev: [
|
|
||||||
'const',
|
|
||||||
'let',
|
|
||||||
'var',
|
|
||||||
],
|
|
||||||
next: '*',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
blankLine: 'any',
|
|
||||||
prev: [
|
|
||||||
'const',
|
|
||||||
'let',
|
|
||||||
'var',
|
|
||||||
],
|
|
||||||
next: [
|
|
||||||
'const',
|
|
||||||
'let',
|
|
||||||
'var',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
blankLine: 'always',
|
|
||||||
prev: [
|
|
||||||
'case',
|
|
||||||
'default',
|
|
||||||
],
|
|
||||||
next: '*',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'@stylistic/quote-props': [
|
|
||||||
'error',
|
|
||||||
'consistent-as-needed',
|
|
||||||
],
|
|
||||||
'@stylistic/quotes': [
|
|
||||||
'error',
|
|
||||||
'single',
|
|
||||||
{
|
|
||||||
avoidEscape: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'@stylistic/semi': [
|
|
||||||
'error',
|
|
||||||
'always',
|
|
||||||
],
|
|
||||||
'@stylistic/semi-spacing': [
|
|
||||||
'warn',
|
|
||||||
],
|
|
||||||
'@stylistic/space-before-blocks': [
|
|
||||||
'warn',
|
|
||||||
],
|
|
||||||
'@stylistic/space-before-function-paren': [
|
|
||||||
'warn',
|
|
||||||
'never',
|
|
||||||
],
|
|
||||||
'@stylistic/space-infix-ops': [
|
|
||||||
'warn',
|
|
||||||
],
|
|
||||||
'@stylistic/spaced-comment': [
|
|
||||||
'warn',
|
|
||||||
'always',
|
|
||||||
],
|
|
||||||
'@stylistic/switch-colon-spacing': [
|
|
||||||
'warn',
|
|
||||||
],
|
|
||||||
'@stylistic/wrap-regex': [
|
|
||||||
'warn',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
});
|
|
|
@ -1,3 +0,0 @@
|
||||||
import eslintConf from './eslint.config';
|
|
||||||
|
|
||||||
export default eslintConf;
|
|
1738
apps/config/package-lock.json
generated
1738
apps/config/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,16 +0,0 @@
|
||||||
{
|
|
||||||
"name": "eslint-conf",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"type": "module",
|
|
||||||
"exports": "./index.ts",
|
|
||||||
"dependencies": {
|
|
||||||
"@eslint/js": "9.30.1",
|
|
||||||
"@stylistic/eslint-plugin": "5.1.0",
|
|
||||||
"eslint": "9.30.1",
|
|
||||||
"eslint-plugin-jsdoc": "51.3.3",
|
|
||||||
"jiti": "2.4.2",
|
|
||||||
"pkg-types": "2.2.0",
|
|
||||||
"typescript": "5.8.3",
|
|
||||||
"typescript-eslint": "8.35.1"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "ESNext",
|
|
||||||
"lib": [
|
|
||||||
"ESNext"
|
|
||||||
],
|
|
||||||
"module": "preserve",
|
|
||||||
"moduleResolution": "bundler",
|
|
||||||
"baseUrl": ".",
|
|
||||||
"noEmit": true,
|
|
||||||
"newLine": "LF",
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"isolatedModules": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"strict": true,
|
|
||||||
"noImplicitAny": false
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
|
||||||
"extends": "./tsconfig.base.json",
|
|
||||||
"includes": [
|
|
||||||
"*.ts",
|
|
||||||
"**/*.ts",
|
|
||||||
"*.js",
|
|
||||||
"**/*.js"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
{pkgs, ...}: let
|
|
||||||
inherit (pkgs.lib) getExe mapAttrs;
|
|
||||||
|
|
||||||
mkApp = pkg: {
|
|
||||||
program = getExe pkg;
|
|
||||||
type = "app";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
mapAttrs (n: v: mkApp v) pkgs.appsPackages
|
|
|
@ -1,3 +0,0 @@
|
||||||
use flake $FLAKE#subtitles-dev
|
|
||||||
(cd ../config; npm ci)
|
|
||||||
npm ci
|
|
|
@ -1,19 +0,0 @@
|
||||||
{
|
|
||||||
buildApp,
|
|
||||||
ffmpeg-full,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
buildApp {
|
|
||||||
src = ./.;
|
|
||||||
npmDepsHash = "sha256-q24xCXk4d6530TML4n/8QpVKC/UYQRz3Cij8ZeMsKcE=";
|
|
||||||
|
|
||||||
runtimeInputs = [
|
|
||||||
ffmpeg-full
|
|
||||||
];
|
|
||||||
|
|
||||||
meta.description = ''
|
|
||||||
Extract all `srt` subtitle files from a `mkv` video with the appropriate name.
|
|
||||||
|
|
||||||
FIXME: fluent-ffmpeg is deprecated
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
import eslintConf from 'eslint-conf';
|
|
||||||
|
|
||||||
export default eslintConf;
|
|
1560
apps/extract-subs/package-lock.json
generated
1560
apps/extract-subs/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"name": "extract-subs",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"bin": "out/bin/app.cjs",
|
|
||||||
"type": "module",
|
|
||||||
"scripts": {
|
|
||||||
"build": "node_ver=$(node -v); esbuild src/app.ts --bundle --platform=node --target=\"node${node_ver:1:2}\" --outfile=out/bin/app.cjs"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@types/fluent-ffmpeg": "2.1.27",
|
|
||||||
"fluent-ffmpeg": "2.1.3",
|
|
||||||
"@types/node": "24.0.10",
|
|
||||||
"esbuild": "0.25.5",
|
|
||||||
"eslint": "9.30.1",
|
|
||||||
"jiti": "2.4.2",
|
|
||||||
"typescript": "5.8.3"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"eslint-conf": "file:../config"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,157 +0,0 @@
|
||||||
import { spawnSync as spawn } from 'child_process';
|
|
||||||
|
|
||||||
import ffprobe from './ffprobe';
|
|
||||||
import { ISO6393To1 } from './lang-codes';
|
|
||||||
|
|
||||||
/* Types */
|
|
||||||
import { FfprobeStream } from 'fluent-ffmpeg';
|
|
||||||
|
|
||||||
|
|
||||||
const SPAWN_OPTS = {
|
|
||||||
stdio: [process.stdin, process.stdout, process.stderr],
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* These are the cli arguments
|
|
||||||
*
|
|
||||||
* @param videoPath the directory in which we want to sync the subtitles
|
|
||||||
* @param languages a comma-separated list of languages (3 letters) to sync the subtitles
|
|
||||||
*/
|
|
||||||
const video = process.argv[2];
|
|
||||||
const languages = process.argv[3]?.split(',');
|
|
||||||
|
|
||||||
|
|
||||||
// Global Vars
|
|
||||||
const subIndexes: number[] = [];
|
|
||||||
let videoPath: string;
|
|
||||||
let baseName: string;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the relative path to the subtitle file of a ffmpeg stream.
|
|
||||||
*
|
|
||||||
* @param sub the stream of the subtitles to extract
|
|
||||||
* @returns the path of the subtitle file
|
|
||||||
*/
|
|
||||||
const getSubPath = (sub: FfprobeStream): string => {
|
|
||||||
const language = ISO6393To1.get(sub.tags.language);
|
|
||||||
|
|
||||||
const forced = sub.disposition?.forced === 0 ?
|
|
||||||
'' :
|
|
||||||
'.forced';
|
|
||||||
|
|
||||||
const hearingImpaired = sub.disposition?.hearing_impaired === 0 ?
|
|
||||||
'' :
|
|
||||||
'.sdh';
|
|
||||||
|
|
||||||
return `${baseName}${forced}.${language}${hearingImpaired}.srt`;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes all subtitles streams from the video file.
|
|
||||||
*/
|
|
||||||
const removeContainerSubs = (): void => {
|
|
||||||
spawn('mv', [
|
|
||||||
videoPath,
|
|
||||||
`${videoPath}.bak`,
|
|
||||||
], SPAWN_OPTS);
|
|
||||||
|
|
||||||
spawn('ffmpeg', [
|
|
||||||
'-i', `${videoPath}.bak`,
|
|
||||||
'-map', '0',
|
|
||||||
...subIndexes.map((i) => ['-map', `-0:${i}`]).flat(),
|
|
||||||
'-c', 'copy', videoPath,
|
|
||||||
], SPAWN_OPTS);
|
|
||||||
|
|
||||||
spawn('rm', [
|
|
||||||
`${videoPath}.bak`,
|
|
||||||
], SPAWN_OPTS);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extracts a sub of a video file to a subtitle file.
|
|
||||||
*
|
|
||||||
* @param sub the stream of the subtitles to extract
|
|
||||||
*/
|
|
||||||
const extractSub = (sub: FfprobeStream): void => {
|
|
||||||
const subFile = getSubPath(sub);
|
|
||||||
|
|
||||||
spawn('ffmpeg', [
|
|
||||||
'-i', videoPath,
|
|
||||||
'-map', `0:${sub.index}`, subFile,
|
|
||||||
], SPAWN_OPTS);
|
|
||||||
|
|
||||||
subIndexes.push(sub.index);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sorts the list of streams to only keep subtitles
|
|
||||||
* that can be extracted.
|
|
||||||
*
|
|
||||||
* @param lang the language of the subtitles
|
|
||||||
* @param streams the streams
|
|
||||||
* @returns the streams that represent subtitles
|
|
||||||
*/
|
|
||||||
const findSubs = (
|
|
||||||
lang: string,
|
|
||||||
streams: FfprobeStream[],
|
|
||||||
): FfprobeStream[] => {
|
|
||||||
const subs = streams.filter((s) => s.tags?.language &&
|
|
||||||
s.tags.language === lang &&
|
|
||||||
s.codec_type === 'subtitle');
|
|
||||||
|
|
||||||
const pgs = subs.filter((s) => s.codec_name === 'hdmv_pgs_subtitle');
|
|
||||||
|
|
||||||
// If we only have PGS subs, warn user
|
|
||||||
if (pgs.length === subs.length) {
|
|
||||||
console.warn(`No SRT subtitle tracks were found for ${lang}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove PGS streams from subs
|
|
||||||
return subs.filter((s) => s.codec_name !== 'hdmv_pgs_subtitle');
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Where the magic happens.
|
|
||||||
*/
|
|
||||||
const main = async(): Promise<void> => {
|
|
||||||
// Get rid of video extension
|
|
||||||
baseName = videoPath.split('/').at(-1)!.replace(/\.[^.]*$/, '');
|
|
||||||
|
|
||||||
// ffprobe the video file to see available sub tracks
|
|
||||||
const data = await ffprobe(videoPath);
|
|
||||||
|
|
||||||
if (!data?.streams) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for languages wanted
|
|
||||||
languages.forEach((lang) => {
|
|
||||||
const subs = findSubs(lang, data.streams);
|
|
||||||
|
|
||||||
if (subs.length === 0) {
|
|
||||||
console.warn(`No subtitle tracks were found for ${lang}`);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extract all subs
|
|
||||||
subs.forEach((sub) => {
|
|
||||||
extractSub(sub);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
removeContainerSubs();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Check if there are 2 params
|
|
||||||
if (video && languages) {
|
|
||||||
videoPath = video;
|
|
||||||
main();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.error('Error: no argument passed');
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
import Ffmpeg from 'fluent-ffmpeg';
|
|
||||||
|
|
||||||
|
|
||||||
export default (videoPath: string) => new Promise<Ffmpeg.FfprobeData>((resolve) => {
|
|
||||||
Ffmpeg.ffprobe(videoPath, (_e, data) => {
|
|
||||||
resolve(data);
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,373 +0,0 @@
|
||||||
export const ISO6391To3 = new Map([
|
|
||||||
['aa', 'aar'],
|
|
||||||
['ab', 'abk'],
|
|
||||||
['af', 'afr'],
|
|
||||||
['ak', 'aka'],
|
|
||||||
['am', 'amh'],
|
|
||||||
['ar', 'ara'],
|
|
||||||
['an', 'arg'],
|
|
||||||
['as', 'asm'],
|
|
||||||
['av', 'ava'],
|
|
||||||
['ae', 'ave'],
|
|
||||||
['ay', 'aym'],
|
|
||||||
['az', 'aze'],
|
|
||||||
['ba', 'bak'],
|
|
||||||
['bm', 'bam'],
|
|
||||||
['be', 'bel'],
|
|
||||||
['bn', 'ben'],
|
|
||||||
['bi', 'bis'],
|
|
||||||
['bo', 'bod'],
|
|
||||||
['bs', 'bos'],
|
|
||||||
['br', 'bre'],
|
|
||||||
['bg', 'bul'],
|
|
||||||
['ca', 'cat'],
|
|
||||||
['cs', 'ces'],
|
|
||||||
['ch', 'cha'],
|
|
||||||
['ce', 'che'],
|
|
||||||
['cu', 'chu'],
|
|
||||||
['cv', 'chv'],
|
|
||||||
['kw', 'cor'],
|
|
||||||
['co', 'cos'],
|
|
||||||
['cr', 'cre'],
|
|
||||||
['cy', 'cym'],
|
|
||||||
['da', 'dan'],
|
|
||||||
['de', 'deu'],
|
|
||||||
['dv', 'div'],
|
|
||||||
['dz', 'dzo'],
|
|
||||||
['el', 'ell'],
|
|
||||||
['en', 'eng'],
|
|
||||||
['eo', 'epo'],
|
|
||||||
['et', 'est'],
|
|
||||||
['eu', 'eus'],
|
|
||||||
['ee', 'ewe'],
|
|
||||||
['fo', 'fao'],
|
|
||||||
['fa', 'fas'],
|
|
||||||
['fj', 'fij'],
|
|
||||||
['fi', 'fin'],
|
|
||||||
['fr', 'fre'],
|
|
||||||
['fy', 'fry'],
|
|
||||||
['ff', 'ful'],
|
|
||||||
['gd', 'gla'],
|
|
||||||
['ga', 'gle'],
|
|
||||||
['gl', 'glg'],
|
|
||||||
['gv', 'glv'],
|
|
||||||
['gn', 'grn'],
|
|
||||||
['gu', 'guj'],
|
|
||||||
['ht', 'hat'],
|
|
||||||
['ha', 'hau'],
|
|
||||||
['sh', 'hbs'],
|
|
||||||
['he', 'heb'],
|
|
||||||
['hz', 'her'],
|
|
||||||
['hi', 'hin'],
|
|
||||||
['ho', 'hmo'],
|
|
||||||
['hr', 'hrv'],
|
|
||||||
['hu', 'hun'],
|
|
||||||
['hy', 'hye'],
|
|
||||||
['ig', 'ibo'],
|
|
||||||
['io', 'ido'],
|
|
||||||
['ii', 'iii'],
|
|
||||||
['iu', 'iku'],
|
|
||||||
['ie', 'ile'],
|
|
||||||
['ia', 'ina'],
|
|
||||||
['id', 'ind'],
|
|
||||||
['ik', 'ipk'],
|
|
||||||
['is', 'isl'],
|
|
||||||
['it', 'ita'],
|
|
||||||
['jv', 'jav'],
|
|
||||||
['ja', 'jpn'],
|
|
||||||
['kl', 'kal'],
|
|
||||||
['kn', 'kan'],
|
|
||||||
['ks', 'kas'],
|
|
||||||
['ka', 'kat'],
|
|
||||||
['kr', 'kau'],
|
|
||||||
['kk', 'kaz'],
|
|
||||||
['km', 'khm'],
|
|
||||||
['ki', 'kik'],
|
|
||||||
['rw', 'kin'],
|
|
||||||
['ky', 'kir'],
|
|
||||||
['kv', 'kom'],
|
|
||||||
['kg', 'kon'],
|
|
||||||
['ko', 'kor'],
|
|
||||||
['kj', 'kua'],
|
|
||||||
['ku', 'kur'],
|
|
||||||
['lo', 'lao'],
|
|
||||||
['la', 'lat'],
|
|
||||||
['lv', 'lav'],
|
|
||||||
['li', 'lim'],
|
|
||||||
['ln', 'lin'],
|
|
||||||
['lt', 'lit'],
|
|
||||||
['lb', 'ltz'],
|
|
||||||
['lu', 'lub'],
|
|
||||||
['lg', 'lug'],
|
|
||||||
['mh', 'mah'],
|
|
||||||
['ml', 'mal'],
|
|
||||||
['mr', 'mar'],
|
|
||||||
['mk', 'mkd'],
|
|
||||||
['mg', 'mlg'],
|
|
||||||
['mt', 'mlt'],
|
|
||||||
['mn', 'mon'],
|
|
||||||
['mi', 'mri'],
|
|
||||||
['ms', 'msa'],
|
|
||||||
['my', 'mya'],
|
|
||||||
['na', 'nau'],
|
|
||||||
['nv', 'nav'],
|
|
||||||
['nr', 'nbl'],
|
|
||||||
['nd', 'nde'],
|
|
||||||
['ng', 'ndo'],
|
|
||||||
['ne', 'nep'],
|
|
||||||
['nl', 'nld'],
|
|
||||||
['nn', 'nno'],
|
|
||||||
['nb', 'nob'],
|
|
||||||
['no', 'nor'],
|
|
||||||
['ny', 'nya'],
|
|
||||||
['oc', 'oci'],
|
|
||||||
['oj', 'oji'],
|
|
||||||
['or', 'ori'],
|
|
||||||
['om', 'orm'],
|
|
||||||
['os', 'oss'],
|
|
||||||
['pa', 'pan'],
|
|
||||||
['pi', 'pli'],
|
|
||||||
['pl', 'pol'],
|
|
||||||
['pt', 'por'],
|
|
||||||
['ps', 'pus'],
|
|
||||||
['qu', 'que'],
|
|
||||||
['rm', 'roh'],
|
|
||||||
['ro', 'ron'],
|
|
||||||
['rn', 'run'],
|
|
||||||
['ru', 'rus'],
|
|
||||||
['sg', 'sag'],
|
|
||||||
['sa', 'san'],
|
|
||||||
['si', 'sin'],
|
|
||||||
['sk', 'slk'],
|
|
||||||
['sl', 'slv'],
|
|
||||||
['se', 'sme'],
|
|
||||||
['sm', 'smo'],
|
|
||||||
['sn', 'sna'],
|
|
||||||
['sd', 'snd'],
|
|
||||||
['so', 'som'],
|
|
||||||
['st', 'sot'],
|
|
||||||
['es', 'spa'],
|
|
||||||
['sq', 'sqi'],
|
|
||||||
['sc', 'srd'],
|
|
||||||
['sr', 'srp'],
|
|
||||||
['ss', 'ssw'],
|
|
||||||
['su', 'sun'],
|
|
||||||
['sw', 'swa'],
|
|
||||||
['sv', 'swe'],
|
|
||||||
['ty', 'tah'],
|
|
||||||
['ta', 'tam'],
|
|
||||||
['tt', 'tat'],
|
|
||||||
['te', 'tel'],
|
|
||||||
['tg', 'tgk'],
|
|
||||||
['tl', 'tgl'],
|
|
||||||
['th', 'tha'],
|
|
||||||
['ti', 'tir'],
|
|
||||||
['to', 'ton'],
|
|
||||||
['tn', 'tsn'],
|
|
||||||
['ts', 'tso'],
|
|
||||||
['tk', 'tuk'],
|
|
||||||
['tr', 'tur'],
|
|
||||||
['tw', 'twi'],
|
|
||||||
['ug', 'uig'],
|
|
||||||
['uk', 'ukr'],
|
|
||||||
['ur', 'urd'],
|
|
||||||
['uz', 'uzb'],
|
|
||||||
['ve', 'ven'],
|
|
||||||
['vi', 'vie'],
|
|
||||||
['vo', 'vol'],
|
|
||||||
['wa', 'wln'],
|
|
||||||
['wo', 'wol'],
|
|
||||||
['xh', 'xho'],
|
|
||||||
['yi', 'yid'],
|
|
||||||
['yo', 'yor'],
|
|
||||||
['za', 'zha'],
|
|
||||||
['zh', 'zho'],
|
|
||||||
['zu', 'zul'],
|
|
||||||
]);
|
|
||||||
|
|
||||||
export const ISO6393To1 = new Map([
|
|
||||||
['aar', 'aa'],
|
|
||||||
['abk', 'ab'],
|
|
||||||
['afr', 'af'],
|
|
||||||
['aka', 'ak'],
|
|
||||||
['amh', 'am'],
|
|
||||||
['ara', 'ar'],
|
|
||||||
['arg', 'an'],
|
|
||||||
['asm', 'as'],
|
|
||||||
['ava', 'av'],
|
|
||||||
['ave', 'ae'],
|
|
||||||
['aym', 'ay'],
|
|
||||||
['aze', 'az'],
|
|
||||||
['bak', 'ba'],
|
|
||||||
['bam', 'bm'],
|
|
||||||
['bel', 'be'],
|
|
||||||
['ben', 'bn'],
|
|
||||||
['bis', 'bi'],
|
|
||||||
['bod', 'bo'],
|
|
||||||
['bos', 'bs'],
|
|
||||||
['bre', 'br'],
|
|
||||||
['bul', 'bg'],
|
|
||||||
['cat', 'ca'],
|
|
||||||
['ces', 'cs'],
|
|
||||||
['cha', 'ch'],
|
|
||||||
['che', 'ce'],
|
|
||||||
['chu', 'cu'],
|
|
||||||
['chv', 'cv'],
|
|
||||||
['cor', 'kw'],
|
|
||||||
['cos', 'co'],
|
|
||||||
['cre', 'cr'],
|
|
||||||
['cym', 'cy'],
|
|
||||||
['dan', 'da'],
|
|
||||||
['deu', 'de'],
|
|
||||||
['div', 'dv'],
|
|
||||||
['dzo', 'dz'],
|
|
||||||
['ell', 'el'],
|
|
||||||
['eng', 'en'],
|
|
||||||
['epo', 'eo'],
|
|
||||||
['est', 'et'],
|
|
||||||
['eus', 'eu'],
|
|
||||||
['ewe', 'ee'],
|
|
||||||
['fao', 'fo'],
|
|
||||||
['fas', 'fa'],
|
|
||||||
['fij', 'fj'],
|
|
||||||
['fin', 'fi'],
|
|
||||||
['fre', 'fr'],
|
|
||||||
['fry', 'fy'],
|
|
||||||
['ful', 'ff'],
|
|
||||||
['gla', 'gd'],
|
|
||||||
['gle', 'ga'],
|
|
||||||
['glg', 'gl'],
|
|
||||||
['glv', 'gv'],
|
|
||||||
['grn', 'gn'],
|
|
||||||
['guj', 'gu'],
|
|
||||||
['hat', 'ht'],
|
|
||||||
['hau', 'ha'],
|
|
||||||
['hbs', 'sh'],
|
|
||||||
['heb', 'he'],
|
|
||||||
['her', 'hz'],
|
|
||||||
['hin', 'hi'],
|
|
||||||
['hmo', 'ho'],
|
|
||||||
['hrv', 'hr'],
|
|
||||||
['hun', 'hu'],
|
|
||||||
['hye', 'hy'],
|
|
||||||
['ibo', 'ig'],
|
|
||||||
['ido', 'io'],
|
|
||||||
['iii', 'ii'],
|
|
||||||
['iku', 'iu'],
|
|
||||||
['ile', 'ie'],
|
|
||||||
['ina', 'ia'],
|
|
||||||
['ind', 'id'],
|
|
||||||
['ipk', 'ik'],
|
|
||||||
['isl', 'is'],
|
|
||||||
['ita', 'it'],
|
|
||||||
['jav', 'jv'],
|
|
||||||
['jpn', 'ja'],
|
|
||||||
['kal', 'kl'],
|
|
||||||
['kan', 'kn'],
|
|
||||||
['kas', 'ks'],
|
|
||||||
['kat', 'ka'],
|
|
||||||
['kau', 'kr'],
|
|
||||||
['kaz', 'kk'],
|
|
||||||
['khm', 'km'],
|
|
||||||
['kik', 'ki'],
|
|
||||||
['kin', 'rw'],
|
|
||||||
['kir', 'ky'],
|
|
||||||
['kom', 'kv'],
|
|
||||||
['kon', 'kg'],
|
|
||||||
['kor', 'ko'],
|
|
||||||
['kua', 'kj'],
|
|
||||||
['kur', 'ku'],
|
|
||||||
['lao', 'lo'],
|
|
||||||
['lat', 'la'],
|
|
||||||
['lav', 'lv'],
|
|
||||||
['lim', 'li'],
|
|
||||||
['lin', 'ln'],
|
|
||||||
['lit', 'lt'],
|
|
||||||
['ltz', 'lb'],
|
|
||||||
['lub', 'lu'],
|
|
||||||
['lug', 'lg'],
|
|
||||||
['mah', 'mh'],
|
|
||||||
['mal', 'ml'],
|
|
||||||
['mar', 'mr'],
|
|
||||||
['mkd', 'mk'],
|
|
||||||
['mlg', 'mg'],
|
|
||||||
['mlt', 'mt'],
|
|
||||||
['mon', 'mn'],
|
|
||||||
['mri', 'mi'],
|
|
||||||
['msa', 'ms'],
|
|
||||||
['mya', 'my'],
|
|
||||||
['nau', 'na'],
|
|
||||||
['nav', 'nv'],
|
|
||||||
['nbl', 'nr'],
|
|
||||||
['nde', 'nd'],
|
|
||||||
['ndo', 'ng'],
|
|
||||||
['nep', 'ne'],
|
|
||||||
['nld', 'nl'],
|
|
||||||
['nno', 'nn'],
|
|
||||||
['nob', 'nb'],
|
|
||||||
['nor', 'no'],
|
|
||||||
['nya', 'ny'],
|
|
||||||
['oci', 'oc'],
|
|
||||||
['oji', 'oj'],
|
|
||||||
['ori', 'or'],
|
|
||||||
['orm', 'om'],
|
|
||||||
['oss', 'os'],
|
|
||||||
['pan', 'pa'],
|
|
||||||
['pli', 'pi'],
|
|
||||||
['pol', 'pl'],
|
|
||||||
['por', 'pt'],
|
|
||||||
['pus', 'ps'],
|
|
||||||
['que', 'qu'],
|
|
||||||
['roh', 'rm'],
|
|
||||||
['ron', 'ro'],
|
|
||||||
['run', 'rn'],
|
|
||||||
['rus', 'ru'],
|
|
||||||
['sag', 'sg'],
|
|
||||||
['san', 'sa'],
|
|
||||||
['sin', 'si'],
|
|
||||||
['slk', 'sk'],
|
|
||||||
['slv', 'sl'],
|
|
||||||
['sme', 'se'],
|
|
||||||
['smo', 'sm'],
|
|
||||||
['sna', 'sn'],
|
|
||||||
['snd', 'sd'],
|
|
||||||
['som', 'so'],
|
|
||||||
['sot', 'st'],
|
|
||||||
['spa', 'es'],
|
|
||||||
['sqi', 'sq'],
|
|
||||||
['srd', 'sc'],
|
|
||||||
['srp', 'sr'],
|
|
||||||
['ssw', 'ss'],
|
|
||||||
['sun', 'su'],
|
|
||||||
['swa', 'sw'],
|
|
||||||
['swe', 'sv'],
|
|
||||||
['tah', 'ty'],
|
|
||||||
['tam', 'ta'],
|
|
||||||
['tat', 'tt'],
|
|
||||||
['tel', 'te'],
|
|
||||||
['tgk', 'tg'],
|
|
||||||
['tgl', 'tl'],
|
|
||||||
['tha', 'th'],
|
|
||||||
['tir', 'ti'],
|
|
||||||
['ton', 'to'],
|
|
||||||
['tsn', 'tn'],
|
|
||||||
['tso', 'ts'],
|
|
||||||
['tuk', 'tk'],
|
|
||||||
['tur', 'tr'],
|
|
||||||
['twi', 'tw'],
|
|
||||||
['uig', 'ug'],
|
|
||||||
['ukr', 'uk'],
|
|
||||||
['urd', 'ur'],
|
|
||||||
['uzb', 'uz'],
|
|
||||||
['ven', 've'],
|
|
||||||
['vie', 'vi'],
|
|
||||||
['vol', 'vo'],
|
|
||||||
['wln', 'wa'],
|
|
||||||
['wol', 'wo'],
|
|
||||||
['xho', 'xh'],
|
|
||||||
['yid', 'yi'],
|
|
||||||
['yor', 'yo'],
|
|
||||||
['zha', 'za'],
|
|
||||||
['zho', 'zh'],
|
|
||||||
['zul', 'zu'],
|
|
||||||
]);
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
|
||||||
"extends": "../config/tsconfig.base.json",
|
|
||||||
"includes": [
|
|
||||||
"*.ts",
|
|
||||||
"**/*.ts",
|
|
||||||
"*.js",
|
|
||||||
"**/*.js"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
writeShellApplication,
|
|
||||||
jq,
|
|
||||||
pandoc,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
writeShellApplication {
|
|
||||||
name = "gen-docs";
|
|
||||||
runtimeInputs = [jq pandoc];
|
|
||||||
text = builtins.readFile ./script.sh;
|
|
||||||
|
|
||||||
meta.description = ''
|
|
||||||
Generates the READMEs in this repository from nix attributes.
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
attr: selfPath: let
|
|
||||||
inherit (builtins) mapAttrs replaceStrings;
|
|
||||||
|
|
||||||
modules = import "${selfPath}/${attr}" {description = true;};
|
|
||||||
|
|
||||||
trimNewlines = s: replaceStrings ["\n"] [" "] s;
|
|
||||||
in {
|
|
||||||
attrs =
|
|
||||||
mapAttrs (_: v: {
|
|
||||||
desc = trimNewlines v;
|
|
||||||
})
|
|
||||||
modules;
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
configs: let
|
|
||||||
inherit (builtins) mapAttrs replaceStrings;
|
|
||||||
|
|
||||||
trimNewlines = s: replaceStrings ["\n"] [" "] s;
|
|
||||||
in {
|
|
||||||
attrs =
|
|
||||||
mapAttrs (_: v: {
|
|
||||||
roleDesc = trimNewlines (v.config.meta.roleDescription or "");
|
|
||||||
hwDesc = trimNewlines (v.config.meta.hardwareDescription or "");
|
|
||||||
})
|
|
||||||
configs;
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
x: let
|
|
||||||
inherit (builtins) currentSystem mapAttrs removeAttrs replaceStrings;
|
|
||||||
|
|
||||||
trimNewlines = s: replaceStrings ["\n"] [" "] s;
|
|
||||||
packages = removeAttrs x.${currentSystem} ["default"];
|
|
||||||
in {
|
|
||||||
attrs =
|
|
||||||
mapAttrs (_: v: {
|
|
||||||
desc = trimNewlines (v.meta.description or "");
|
|
||||||
homepage = v.meta.homepage or "";
|
|
||||||
})
|
|
||||||
packages;
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
attr: selfPath: let
|
|
||||||
inherit (builtins) currentSystem getFlake mapAttrs removeAttrs replaceStrings;
|
|
||||||
|
|
||||||
self = getFlake selfPath;
|
|
||||||
scopes = ((import "${selfPath}/${attr}" {description = true;}) {} {}).scopedPackages;
|
|
||||||
|
|
||||||
trimNewlines = s: replaceStrings ["\n"] [" "] s;
|
|
||||||
in {
|
|
||||||
attrs =
|
|
||||||
mapAttrs (n: v: {
|
|
||||||
desc = trimNewlines v;
|
|
||||||
packages = let
|
|
||||||
scopePkgs = removeAttrs self.${attr}.${currentSystem}.${n} [
|
|
||||||
"buildFirefoxXpiAddon"
|
|
||||||
"callPackage"
|
|
||||||
"newScope"
|
|
||||||
"override"
|
|
||||||
"overrideDerivation"
|
|
||||||
"overrideScope"
|
|
||||||
"packages"
|
|
||||||
"recurseForDerivations"
|
|
||||||
];
|
|
||||||
in
|
|
||||||
mapAttrs (_: pkg: {
|
|
||||||
desc = trimNewlines (pkg.meta.description or "");
|
|
||||||
homepage = pkg.meta.homepage or "";
|
|
||||||
})
|
|
||||||
scopePkgs;
|
|
||||||
})
|
|
||||||
scopes;
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
substituteDerivs() {
|
|
||||||
echo '' | pandoc --metadata-file <(
|
|
||||||
nix eval \
|
|
||||||
--impure \
|
|
||||||
--json \
|
|
||||||
"$FLAKE"#"$1" \
|
|
||||||
--apply "import \"$FLAKE/apps/gen-docs/$3.nix\"" |
|
|
||||||
jq -r
|
|
||||||
) -t markdown --template "$FLAKE/apps/gen-docs/templates/$2.md" -o "$FLAKE/$2/README.md"
|
|
||||||
}
|
|
||||||
|
|
||||||
substituteAttrs() {
|
|
||||||
echo '' | pandoc --metadata-file <(
|
|
||||||
nix eval \
|
|
||||||
--impure \
|
|
||||||
--json \
|
|
||||||
--expr "\"$FLAKE\"" \
|
|
||||||
--apply "(import \"$FLAKE/apps/gen-docs/getAttrsMeta.nix\") \"$1\"" |
|
|
||||||
jq -r
|
|
||||||
) -t markdown --template "$FLAKE/apps/gen-docs/templates/$1.md" -o "$FLAKE/$1/README.md"
|
|
||||||
}
|
|
||||||
|
|
||||||
substituteScopes() {
|
|
||||||
echo '' | pandoc --metadata-file <(
|
|
||||||
nix eval \
|
|
||||||
--impure \
|
|
||||||
--json \
|
|
||||||
--expr "\"$FLAKE\"" \
|
|
||||||
--apply "(import \"$FLAKE/apps/gen-docs/getScopesMeta.nix\") \"$1\"" |
|
|
||||||
jq -r
|
|
||||||
) -t markdown --template "$FLAKE/apps/gen-docs/templates/$1.md" -o "$FLAKE/$1/README.md"
|
|
||||||
}
|
|
||||||
|
|
||||||
substituteDerivs "appsPackages" "apps" "getPackageMeta"
|
|
||||||
substituteDerivs "nixosConfigurations" "configurations" "getConfigMeta"
|
|
||||||
substituteDerivs "devShells" "devShells" "getPackageMeta"
|
|
||||||
substituteDerivs "packages" "packages" "getPackageMeta"
|
|
||||||
|
|
||||||
substituteAttrs "modules"
|
|
||||||
substituteAttrs "homeManagerModules"
|
|
||||||
substituteAttrs "overlays"
|
|
||||||
|
|
||||||
substituteScopes "scopedPackages"
|
|
|
@ -1,11 +0,0 @@
|
||||||
# Apps
|
|
||||||
|
|
||||||
This directory contains every derivations for apps exposed by this flake.
|
|
||||||
|
|
||||||
## List of my apps found in `self.apps`
|
|
||||||
|
|
||||||
| Name | Description |
|
|
||||||
| ---- | ----------- |
|
|
||||||
$for(attrs/pairs)$
|
|
||||||
| `$it.key$` | $it.value.desc/nowrap$ |
|
|
||||||
$endfor$
|
|
|
@ -1,13 +0,0 @@
|
||||||
# NixosConfigurations
|
|
||||||
|
|
||||||
This directory contains every device's main configuration file, their `hardware-configuration.nix` and some custom modules
|
|
||||||
unique to them.
|
|
||||||
|
|
||||||
## List of my devices
|
|
||||||
|
|
||||||
| Name | Model / Specs | Description |
|
|
||||||
| --------- | ------------- | ------------------------------------------------------------------------------------------------ |
|
|
||||||
| `android` | OnePlus 9 Pro | [Nix-On-Droid](https://github.com/nix-community/nix-on-droid) configuration for my OnePlus 9 Pro |
|
|
||||||
$for(attrs/pairs)$
|
|
||||||
| `$it.key$` | $it.value.hwDesc/nowrap$ | $it.value.roleDesc/nowrap$ |
|
|
||||||
$endfor$
|
|
|
@ -1,11 +0,0 @@
|
||||||
# DevShells
|
|
||||||
|
|
||||||
This directory contains every derivations for devShells exposed by this flake.
|
|
||||||
|
|
||||||
## List of my devShells found in `self.devShells`
|
|
||||||
|
|
||||||
| Name | Description |
|
|
||||||
| ---- | ----------- |
|
|
||||||
$for(attrs/pairs)$
|
|
||||||
| `$it.key$` | $it.value.desc/nowrap$ |
|
|
||||||
$endfor$
|
|
|
@ -1,11 +0,0 @@
|
||||||
# HomeManagerModules
|
|
||||||
|
|
||||||
This directory contains every home-manager modules exposed by this flake.
|
|
||||||
|
|
||||||
## List of my home-manager modules found in `self.homeManagerModules`
|
|
||||||
|
|
||||||
| Name | Description |
|
|
||||||
| ---- | ----------- |
|
|
||||||
$for(attrs/pairs)$
|
|
||||||
| `$it.key$` | $it.value.desc/nowrap$ |
|
|
||||||
$endfor$
|
|
|
@ -1,11 +0,0 @@
|
||||||
# NixosModules
|
|
||||||
|
|
||||||
This directory contains every modules for NixOS exposed by this flake.
|
|
||||||
|
|
||||||
## List of my modules found in `self.nixosModules`
|
|
||||||
|
|
||||||
| Name | Description |
|
|
||||||
| ---- | ----------- |
|
|
||||||
$for(attrs/pairs)$
|
|
||||||
| `$it.key$` | $it.value.desc/nowrap$ |
|
|
||||||
$endfor$
|
|
|
@ -1,11 +0,0 @@
|
||||||
# Overlays
|
|
||||||
|
|
||||||
This directory contains every overlay exposed by this flake.
|
|
||||||
|
|
||||||
## List of my overlays found in `self.overlays`
|
|
||||||
|
|
||||||
| Name | Description |
|
|
||||||
| ---- | ----------- |
|
|
||||||
$for(attrs/pairs)$
|
|
||||||
| `$it.key$` | $it.value.desc/nowrap$ |
|
|
||||||
$endfor$
|
|
|
@ -1,11 +0,0 @@
|
||||||
# Packages
|
|
||||||
|
|
||||||
This directory contains every derivations for packages exposed by this flake.
|
|
||||||
|
|
||||||
## List of my packages found in `self.packages`
|
|
||||||
|
|
||||||
| Name | Description | Homepage |
|
|
||||||
| ---- | ----------- | -------- |
|
|
||||||
$for(attrs/pairs)$
|
|
||||||
| `$it.key$` | $it.value.desc/nowrap$ | $it.value.homepage/nowrap$ |
|
|
||||||
$endfor$
|
|
|
@ -1,18 +0,0 @@
|
||||||
# ScopedPackages
|
|
||||||
|
|
||||||
This directory contains every package scopes exposed by this flake.
|
|
||||||
|
|
||||||
## List of my package scopes found in `self.scopedPackages`
|
|
||||||
|
|
||||||
$for(attrs/pairs)$
|
|
||||||
### $it.key$
|
|
||||||
|
|
||||||
$it.value.desc/nowrap$
|
|
||||||
|
|
||||||
| Name | Description | Homepage |
|
|
||||||
| ---- | ----------- | -------- |
|
|
||||||
$for(it.value.packages/pairs)$
|
|
||||||
| `$it.key$` | $it.value.desc/nowrap$ | $it.value.homepage/nowrap$ |
|
|
||||||
$endfor$
|
|
||||||
|
|
||||||
$endfor$
|
|
|
@ -1,3 +0,0 @@
|
||||||
use flake $FLAKE#node
|
|
||||||
(cd ../config; npm ci)
|
|
||||||
npm ci
|
|
1
apps/list2series/.gitignore
vendored
1
apps/list2series/.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
.env
|
|
|
@ -1,11 +0,0 @@
|
||||||
{buildApp, ...}:
|
|
||||||
buildApp {
|
|
||||||
src = ./.;
|
|
||||||
npmDepsHash = "sha256-p/EEjotM7O0vJhjzd02gYwkjNw6ZTsjW8t8fdSfZ+9c=";
|
|
||||||
|
|
||||||
runtimeInputs = [];
|
|
||||||
|
|
||||||
meta.description = ''
|
|
||||||
Converts a Komga read list into a comics series for reading with mihon.
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
import eslintConf from 'eslint-conf';
|
|
||||||
|
|
||||||
export default eslintConf;
|
|
File diff suppressed because it is too large
Load diff
1828
apps/list2series/package-lock.json
generated
1828
apps/list2series/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"name": "list2series",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"bin": "out/bin/app.cjs",
|
|
||||||
"type": "module",
|
|
||||||
"scripts": {
|
|
||||||
"build": "node_ver=$(node -v); esbuild src/app.ts --bundle --platform=node --target=\"node${node_ver:1:2}\" --outfile=out/bin/app.cjs"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@types/node": "24.0.10",
|
|
||||||
"axios": "1.10.0",
|
|
||||||
"esbuild": "0.25.5",
|
|
||||||
"eslint": "9.30.1",
|
|
||||||
"jiti": "2.4.2",
|
|
||||||
"pkg-types": "2.2.0",
|
|
||||||
"typescript": "5.8.3"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"eslint-conf": "file:../config"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,359 +0,0 @@
|
||||||
import axios from 'axios';
|
|
||||||
import { linkSync, mkdirSync, readFileSync, rmSync } from 'fs';
|
|
||||||
import { basename } from 'path';
|
|
||||||
|
|
||||||
import {
|
|
||||||
type Book,
|
|
||||||
type ListsJson,
|
|
||||||
type ReadList,
|
|
||||||
type Series,
|
|
||||||
} from './types';
|
|
||||||
|
|
||||||
|
|
||||||
// Examples of calling this script:
|
|
||||||
// $ just l2s copy 0K65Q482KK7SD
|
|
||||||
// $ just l2s meta 0K65Q482KK7SD
|
|
||||||
|
|
||||||
const readNeighborFile = (filename: string) => JSON.parse(
|
|
||||||
readFileSync(`${process.env.FLAKE}/apps/list2series/${filename}`, { encoding: 'utf-8' }),
|
|
||||||
);
|
|
||||||
|
|
||||||
const API = readNeighborFile('.env').API;
|
|
||||||
|
|
||||||
const getListInfo = async(listId: string): Promise<ReadList> => {
|
|
||||||
const res = await axios.request({
|
|
||||||
method: 'get',
|
|
||||||
maxBodyLength: Infinity,
|
|
||||||
url: `https://komga.nelim.org/api/v1/readlists/${listId}`,
|
|
||||||
headers: {
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'X-API-Key': API,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return res.data;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getSeries = async(seriesTitle: string, operator = true): Promise<Series[]> => {
|
|
||||||
return (await axios.request({
|
|
||||||
method: 'post',
|
|
||||||
maxBodyLength: Infinity,
|
|
||||||
url: 'https://komga.nelim.org/api/v1/series/list?unpaged=true',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'X-API-Key': API,
|
|
||||||
},
|
|
||||||
data: JSON.stringify({
|
|
||||||
condition: {
|
|
||||||
title: {
|
|
||||||
operator: operator ? 'is' : 'isNot',
|
|
||||||
value: seriesTitle,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
})).data.content;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getSeriesBooks = async(listName: string, seriesPath: string): Promise<Book[]> => {
|
|
||||||
const thisSeries = (await getSeries('', false)).find((s) => s.url === seriesPath);
|
|
||||||
|
|
||||||
if (!thisSeries) {
|
|
||||||
throw new Error('Series could not be found');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset Series metadata
|
|
||||||
axios.request({
|
|
||||||
method: 'patch',
|
|
||||||
maxBodyLength: Infinity,
|
|
||||||
url: `https://komga.nelim.org/api/v1/series/${thisSeries.id}/metadata`,
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-API-Key': API,
|
|
||||||
},
|
|
||||||
data: JSON.stringify({
|
|
||||||
ageRating: null,
|
|
||||||
ageRatingLock: true,
|
|
||||||
alternateTitles: null,
|
|
||||||
alternateTitlesLock: true,
|
|
||||||
genres: null,
|
|
||||||
genresLock: true,
|
|
||||||
language: null,
|
|
||||||
languageLock: true,
|
|
||||||
links: null,
|
|
||||||
linksLock: true,
|
|
||||||
publisherLock: true,
|
|
||||||
readingDirection: 'LEFT_TO_RIGHT',
|
|
||||||
readingDirectionLock: true,
|
|
||||||
sharingLabels: null,
|
|
||||||
sharingLabelsLock: true,
|
|
||||||
status: null,
|
|
||||||
statusLock: true,
|
|
||||||
summary: null,
|
|
||||||
summaryLock: true,
|
|
||||||
tags: null,
|
|
||||||
tagsLock: true,
|
|
||||||
title: listName,
|
|
||||||
titleLock: true,
|
|
||||||
titleSort: listName,
|
|
||||||
titleSortLock: true,
|
|
||||||
totalBookCountLock: true,
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
const books = await axios.request({
|
|
||||||
method: 'post',
|
|
||||||
maxBodyLength: Infinity,
|
|
||||||
url: 'https://komga.nelim.org/api/v1/books/list?unpaged=true',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'X-API-Key': API,
|
|
||||||
},
|
|
||||||
data: JSON.stringify({
|
|
||||||
condition: {
|
|
||||||
seriesId: {
|
|
||||||
operator: 'is',
|
|
||||||
value: thisSeries.id,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
return books.data.content;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getBookInfo = async(id: string): Promise<Book> => {
|
|
||||||
const res = await axios.request({
|
|
||||||
method: 'get',
|
|
||||||
maxBodyLength: Infinity,
|
|
||||||
url: `https://komga.nelim.org/api/v1/books/${id}`,
|
|
||||||
headers: {
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'X-API-Key': API,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return res.data;
|
|
||||||
};
|
|
||||||
|
|
||||||
// There doesn't seem to be a way to wait for the scan to be done
|
|
||||||
const scanLibrary = (): void => {
|
|
||||||
axios.request({
|
|
||||||
method: 'post',
|
|
||||||
maxBodyLength: Infinity,
|
|
||||||
url: 'https://komga.nelim.org/api/v1/libraries/0K4QG58XA29DZ/scan',
|
|
||||||
headers: {
|
|
||||||
'X-API-Key': API,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const setBookMetadata = async(i: number, source: Book, target: Book): Promise<void> => {
|
|
||||||
const thisSeries = (await getSeries(source.seriesTitle))[0];
|
|
||||||
|
|
||||||
source.metadata.title = thisSeries.booksCount !== 1 ?
|
|
||||||
`${source.seriesTitle} Issue #${source.metadata.number}` :
|
|
||||||
source.metadata.title = source.seriesTitle;
|
|
||||||
|
|
||||||
source.metadata.number = i.toString();
|
|
||||||
source.metadata.numberSort = i;
|
|
||||||
|
|
||||||
const metadata = JSON.stringify(source.metadata);
|
|
||||||
|
|
||||||
axios.request({
|
|
||||||
method: 'patch',
|
|
||||||
maxBodyLength: Infinity,
|
|
||||||
url: `https://komga.nelim.org/api/v1/books/${target.id}/metadata`,
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-API-Key': API,
|
|
||||||
},
|
|
||||||
data: metadata,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const getListBooks = async(listKeyOrId: string): Promise<{
|
|
||||||
list: ReadList
|
|
||||||
seriesPath: string
|
|
||||||
listBooks: Book[]
|
|
||||||
}> => {
|
|
||||||
let listId = listKeyOrId;
|
|
||||||
|
|
||||||
const listMappings = readNeighborFile('lists.json') as ListsJson;
|
|
||||||
|
|
||||||
// support giving key instead of ID
|
|
||||||
if (Object.keys(listMappings).includes(listKeyOrId)) {
|
|
||||||
listId = listMappings[listKeyOrId].readlistId;
|
|
||||||
}
|
|
||||||
|
|
||||||
const list = await getListInfo(listId);
|
|
||||||
const ids = list.bookIds;
|
|
||||||
const seriesPath = `/data/comics/[List] ${list.name}`;
|
|
||||||
|
|
||||||
const listBooks = [] as Book[];
|
|
||||||
|
|
||||||
for (let i = 0; i < ids.length; i++) {
|
|
||||||
const book = await getBookInfo(ids[i]);
|
|
||||||
|
|
||||||
listBooks[i] = book;
|
|
||||||
};
|
|
||||||
|
|
||||||
return { list, seriesPath, listBooks };
|
|
||||||
};
|
|
||||||
|
|
||||||
const main = async(): Promise<void> => {
|
|
||||||
if (process.argv[2] === 'copy') {
|
|
||||||
const { seriesPath, listBooks } = await getListBooks(process.argv[3]);
|
|
||||||
|
|
||||||
rmSync(seriesPath, { recursive: true, force: true });
|
|
||||||
mkdirSync(seriesPath, { recursive: true });
|
|
||||||
|
|
||||||
for (const book of listBooks) {
|
|
||||||
const bookPath = book.url;
|
|
||||||
const inListPath = `${seriesPath}/${basename(bookPath)}`;
|
|
||||||
|
|
||||||
console.log(`hardlinking ${basename(bookPath)}`);
|
|
||||||
linkSync(bookPath, inListPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
scanLibrary();
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (process.argv[2] === 'meta') {
|
|
||||||
const { list, seriesPath, listBooks } = await getListBooks(process.argv[3]);
|
|
||||||
|
|
||||||
const seriesBooks = await getSeriesBooks(`[List] ${list.name}`, seriesPath);
|
|
||||||
|
|
||||||
for (const target of seriesBooks) {
|
|
||||||
const source = listBooks.find((b) => basename(b.url) === basename(target.url));
|
|
||||||
|
|
||||||
if (source) {
|
|
||||||
const i = listBooks.indexOf(source) + 1;
|
|
||||||
|
|
||||||
console.log(`Setting metadata for ${source.name}`);
|
|
||||||
setBookMetadata(i, source, target);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (process.argv[2] === 'json') {
|
|
||||||
const { listBooks } = await getListBooks(process.argv[3]);
|
|
||||||
|
|
||||||
const output = [] as { series: string, title: string, number: number }[];
|
|
||||||
|
|
||||||
listBooks.forEach((book) => {
|
|
||||||
output.push({
|
|
||||||
series: book.seriesTitle,
|
|
||||||
title: book.metadata.title,
|
|
||||||
number: book.metadata.numberSort,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(JSON.stringify(output, null, 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (process.argv[2] === 'init') {
|
|
||||||
const listKey = process.argv[3];
|
|
||||||
const listMappings = readNeighborFile('lists.json') as ListsJson;
|
|
||||||
|
|
||||||
const listData = listMappings[listKey];
|
|
||||||
const cvIssueLinks = listData.issues;
|
|
||||||
|
|
||||||
const bookIds = [] as string[];
|
|
||||||
|
|
||||||
for (let i = 0; i < cvIssueLinks.length; ++i) {
|
|
||||||
const { series, title, number } = cvIssueLinks[i];
|
|
||||||
|
|
||||||
const seriesSearch = (await axios.request({
|
|
||||||
method: 'post',
|
|
||||||
maxBodyLength: Infinity,
|
|
||||||
url: 'https://komga.nelim.org/api/v1/series/list?unpaged=true',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'X-API-Key': API,
|
|
||||||
},
|
|
||||||
data: JSON.stringify({
|
|
||||||
condition: {
|
|
||||||
title: {
|
|
||||||
operator: 'is',
|
|
||||||
value: series,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
})).data.content;
|
|
||||||
|
|
||||||
const bookSearch = [] as Book[];
|
|
||||||
|
|
||||||
for (const seriesResult of seriesSearch) {
|
|
||||||
const seriesId = seriesResult.id;
|
|
||||||
|
|
||||||
bookSearch.push(...((await axios.request({
|
|
||||||
method: 'post',
|
|
||||||
maxBodyLength: Infinity,
|
|
||||||
url: 'https://komga.nelim.org/api/v1/books/list?unpaged=true',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'X-API-Key': API,
|
|
||||||
},
|
|
||||||
data: JSON.stringify({
|
|
||||||
condition: {
|
|
||||||
seriesId: {
|
|
||||||
operator: 'is',
|
|
||||||
value: seriesId,
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
operator: 'is',
|
|
||||||
value: title,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
})).data.content as Book[]));
|
|
||||||
}
|
|
||||||
|
|
||||||
const matchingBooks = bookSearch.filter((b) =>
|
|
||||||
b.metadata.title === title &&
|
|
||||||
b.metadata.numberSort === number);
|
|
||||||
|
|
||||||
if (matchingBooks.length === 0) {
|
|
||||||
console.error(matchingBooks, number);
|
|
||||||
throw new Error(`No issue matched the title '${title}' from ${series}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (matchingBooks.length !== 1) {
|
|
||||||
console.error(matchingBooks, number);
|
|
||||||
throw new Error(`More than one issue matched the title '${title}' from ${series}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
bookIds[i] = matchingBooks[0].id;
|
|
||||||
}
|
|
||||||
|
|
||||||
axios.request({
|
|
||||||
method: 'patch',
|
|
||||||
maxBodyLength: Infinity,
|
|
||||||
url: `https://komga.nelim.org/api/v1/readlists/${listData.readlistId}`,
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'X-API-Key': API,
|
|
||||||
},
|
|
||||||
data: JSON.stringify({
|
|
||||||
bookIds,
|
|
||||||
ordered: true,
|
|
||||||
// name: 'string',
|
|
||||||
// summary: 'string',
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(`Updated ${listKey}.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
console.error('Arguments not recognized.');
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
main();
|
|
|
@ -1,146 +0,0 @@
|
||||||
export interface ListJson {
|
|
||||||
readlistId: string
|
|
||||||
issues: {
|
|
||||||
series: string
|
|
||||||
title: string
|
|
||||||
number: number
|
|
||||||
}[]
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ListsJson = Record<string, ListJson>;
|
|
||||||
|
|
||||||
export interface Media {
|
|
||||||
status: string
|
|
||||||
mediaType: string
|
|
||||||
pagesCount: number
|
|
||||||
comment: string
|
|
||||||
epubDivinaCompatible: boolean
|
|
||||||
epubIsKepub: boolean
|
|
||||||
mediaProfile: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Author {
|
|
||||||
name: string
|
|
||||||
role: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Link {
|
|
||||||
label: string
|
|
||||||
url: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ShortBookMetadata {
|
|
||||||
authors: Author[]
|
|
||||||
tags: unknown[]
|
|
||||||
releaseDate: string
|
|
||||||
summary: string
|
|
||||||
summaryNumber: string
|
|
||||||
created: string
|
|
||||||
lastModified: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BookMetadata {
|
|
||||||
title: string
|
|
||||||
titleLock: boolean
|
|
||||||
summary: string
|
|
||||||
summaryLock: boolean
|
|
||||||
number: string
|
|
||||||
numberLock: boolean
|
|
||||||
numberSort: number
|
|
||||||
numberSortLock: boolean
|
|
||||||
releaseDate: string
|
|
||||||
releaseDateLock: boolean
|
|
||||||
authors: Author[]
|
|
||||||
authorsLock: boolean
|
|
||||||
tags: unknown[]
|
|
||||||
tagsLock: boolean
|
|
||||||
isbn: string
|
|
||||||
isbnLock: boolean
|
|
||||||
links: Link[]
|
|
||||||
linksLock: boolean
|
|
||||||
created: string
|
|
||||||
lastModified: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Book {
|
|
||||||
id: string
|
|
||||||
seriesId: string
|
|
||||||
seriesTitle: string
|
|
||||||
libraryId: string
|
|
||||||
name: string
|
|
||||||
url: string
|
|
||||||
number: number
|
|
||||||
created: string
|
|
||||||
lastModified: string
|
|
||||||
fileLastModified: string
|
|
||||||
sizeBytes: number
|
|
||||||
size: string
|
|
||||||
media: Media
|
|
||||||
metadata: BookMetadata
|
|
||||||
readProgress: null | unknown
|
|
||||||
deleted: boolean
|
|
||||||
fileHash: string
|
|
||||||
oneshot: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SeriesMetadata {
|
|
||||||
status: string
|
|
||||||
statusLock: boolean
|
|
||||||
title: string
|
|
||||||
titleLock: boolean
|
|
||||||
titleSort: string
|
|
||||||
titleSortLock: boolean
|
|
||||||
summary: string
|
|
||||||
summaryLock: boolean
|
|
||||||
readingDirection: string
|
|
||||||
readingDirectionLock: boolean
|
|
||||||
publisher: string
|
|
||||||
publisherLock: boolean
|
|
||||||
ageRating: null | string
|
|
||||||
ageRatingLock: boolean
|
|
||||||
language: string
|
|
||||||
languageLock: boolean
|
|
||||||
genres: string[]
|
|
||||||
genresLock: boolean
|
|
||||||
tags: unknown[]
|
|
||||||
tagsLock: boolean
|
|
||||||
totalBookCount: null | number
|
|
||||||
totalBookCountLock: boolean
|
|
||||||
sharingLabels: unknown[]
|
|
||||||
sharingLabelsLock: boolean
|
|
||||||
links: Link[]
|
|
||||||
linksLock: boolean
|
|
||||||
alternateTitles: string[]
|
|
||||||
alternateTitlesLock: boolean
|
|
||||||
created: string
|
|
||||||
lastModified: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Series {
|
|
||||||
id: string
|
|
||||||
libraryId: string
|
|
||||||
name: string
|
|
||||||
url: string
|
|
||||||
created: string
|
|
||||||
lastModified: string
|
|
||||||
fileLastModified: string
|
|
||||||
booksCount: number
|
|
||||||
booksReadCount: number
|
|
||||||
booksUnreadCount: number
|
|
||||||
booksInProgressCount: number
|
|
||||||
metadata: SeriesMetadata
|
|
||||||
booksMetadata: ShortBookMetadata
|
|
||||||
deleted: boolean
|
|
||||||
oneshot: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ReadList {
|
|
||||||
id: string
|
|
||||||
name: string
|
|
||||||
summary: string
|
|
||||||
ordered: boolean
|
|
||||||
bookIds: string[]
|
|
||||||
createdDate: string
|
|
||||||
lastModifiedDate: string
|
|
||||||
filtered: boolean
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
|
||||||
"extends": "../config/tsconfig.base.json",
|
|
||||||
"includes": [
|
|
||||||
"*.ts",
|
|
||||||
"**/*.ts",
|
|
||||||
"*.js",
|
|
||||||
"**/*.js"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
use flake $FLAKE#node
|
|
||||||
(cd ../config; npm ci)
|
|
||||||
npm ci
|
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
buildApp,
|
|
||||||
nodejs_latest,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
buildApp {
|
|
||||||
src = ./.;
|
|
||||||
npmDepsHash = "sha256-0IiT1EQWuk3w3mYlErBl00xeqJX2ajGHkD0tFg1QOTw=";
|
|
||||||
|
|
||||||
runtimeInputs = [
|
|
||||||
nodejs_latest
|
|
||||||
];
|
|
||||||
|
|
||||||
meta.description = ''
|
|
||||||
Checks if a list of mods have a version available for a specific Minecraft
|
|
||||||
version and a specific loader.
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
import eslintConf from 'eslint-conf';
|
|
||||||
|
|
||||||
export default eslintConf;
|
|
1548
apps/mc-mods/package-lock.json
generated
1548
apps/mc-mods/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,20 +0,0 @@
|
||||||
{
|
|
||||||
"name": "mc-mods",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"bin": "out/bin/app.cjs",
|
|
||||||
"type": "module",
|
|
||||||
"scripts": {
|
|
||||||
"build": "node_ver=$(node -v); esbuild src/app.ts --bundle --platform=node --target=\"node${node_ver:1:2}\" --outfile=out/bin/app.cjs"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@types/node": "24.0.10",
|
|
||||||
"esbuild": "0.25.5",
|
|
||||||
"eslint": "9.30.1",
|
|
||||||
"jiti": "2.4.2",
|
|
||||||
"pkg-types": "2.2.0",
|
|
||||||
"typescript": "5.8.3"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"eslint-conf": "file:../config"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,147 +0,0 @@
|
||||||
import { createWriteStream, mkdirSync, rmSync } from 'fs';
|
|
||||||
import { Readable } from 'stream';
|
|
||||||
|
|
||||||
interface Hashes {
|
|
||||||
sha1: string
|
|
||||||
sha512: string
|
|
||||||
}
|
|
||||||
interface File {
|
|
||||||
hashes: Hashes
|
|
||||||
url: string
|
|
||||||
filename: string
|
|
||||||
primary: boolean
|
|
||||||
size: number
|
|
||||||
file_type: string
|
|
||||||
}
|
|
||||||
interface Dependency {
|
|
||||||
version_id: string
|
|
||||||
project_id: string
|
|
||||||
file_name: string
|
|
||||||
dependency_type: string
|
|
||||||
}
|
|
||||||
interface ModVersion {
|
|
||||||
game_versions: string[]
|
|
||||||
loaders: string[]
|
|
||||||
id: string
|
|
||||||
project_id: string
|
|
||||||
author_id: string
|
|
||||||
featured: boolean
|
|
||||||
name: string
|
|
||||||
version_number: string
|
|
||||||
changelog: string
|
|
||||||
changelog_url: string
|
|
||||||
date_published: string
|
|
||||||
downloads: number
|
|
||||||
version_type: string
|
|
||||||
status: string
|
|
||||||
files: File[]
|
|
||||||
dependencies: Dependency[]
|
|
||||||
}
|
|
||||||
|
|
||||||
const LOADER = 'fabric';
|
|
||||||
|
|
||||||
const game_version = process.argv[2] ?? '';
|
|
||||||
const action = process.argv[3] ?? 'check';
|
|
||||||
|
|
||||||
const getVersions = async(slug: string): Promise<ModVersion[]> => {
|
|
||||||
const res = await fetch(`https://api.modrinth.com/v2/project/${slug}/version`);
|
|
||||||
|
|
||||||
return res.ok ?
|
|
||||||
await res.json() as ModVersion[] :
|
|
||||||
[];
|
|
||||||
};
|
|
||||||
|
|
||||||
const checkModCompat = async(slug: string): Promise<ModVersion | null> => {
|
|
||||||
const versions = await getVersions(slug);
|
|
||||||
|
|
||||||
const matching = versions.filter((ver) =>
|
|
||||||
ver.game_versions.includes(game_version) &&
|
|
||||||
ver.loaders.includes(LOADER));
|
|
||||||
|
|
||||||
if (matching.length === 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const timeSorted = matching.sort((a, b) => {
|
|
||||||
const dateA = new Date(a.date_published);
|
|
||||||
const dateB = new Date(b.date_published);
|
|
||||||
|
|
||||||
return dateB.getTime() - dateA.getTime();
|
|
||||||
});
|
|
||||||
|
|
||||||
return timeSorted.some((v) => v.version_type === 'release') ?
|
|
||||||
timeSorted.filter((v) => v.version_type === 'release')[0] :
|
|
||||||
timeSorted[0];
|
|
||||||
};
|
|
||||||
|
|
||||||
const getDownloadUrls = (version: ModVersion): string[] => version.files.map((file) => file.url);
|
|
||||||
|
|
||||||
const showModDownloadUrls = async(modName: string): Promise<boolean> => {
|
|
||||||
const ver = await checkModCompat(modName);
|
|
||||||
|
|
||||||
if (ver) {
|
|
||||||
const urls = getDownloadUrls(ver);
|
|
||||||
|
|
||||||
console.log(`\n${modName}:`, urls);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const download = async(url: string, path: string) => Readable
|
|
||||||
.fromWeb((await fetch(url)).body!).pipe(createWriteStream(path));
|
|
||||||
|
|
||||||
const main = () => {
|
|
||||||
const mods = [
|
|
||||||
'badpackets',
|
|
||||||
'c2me-fabric',
|
|
||||||
'cloth-config',
|
|
||||||
'clumps',
|
|
||||||
'fabric-api',
|
|
||||||
'ferrite-core',
|
|
||||||
'leaves-be-gone',
|
|
||||||
'lithium',
|
|
||||||
'modernfix',
|
|
||||||
'no-chat-reports',
|
|
||||||
'noisium',
|
|
||||||
'vmp-fabric',
|
|
||||||
'wthit',
|
|
||||||
];
|
|
||||||
|
|
||||||
if (action === 'check') {
|
|
||||||
mods.forEach(async(modName) => {
|
|
||||||
if (!(await showModDownloadUrls(modName))) {
|
|
||||||
console.error(`No matching releases of ${modName} were found for ${game_version}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else if (action === 'download') {
|
|
||||||
rmSync('./out', { force: true, recursive: true });
|
|
||||||
mkdirSync('./out');
|
|
||||||
|
|
||||||
mods.forEach(async(modName) => {
|
|
||||||
const ver = await checkModCompat(modName);
|
|
||||||
|
|
||||||
if (ver === null) {
|
|
||||||
console.error(`No matching releases of ${modName} were found for ${game_version}`);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const fileName =
|
|
||||||
`${modName}-${ver.version_number}.jar`;
|
|
||||||
|
|
||||||
console.log(`Downloading ${fileName}`);
|
|
||||||
|
|
||||||
await download(
|
|
||||||
ver.files[0].url,
|
|
||||||
`./out/${fileName}`,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
main();
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
|
||||||
"extends": "../config/tsconfig.base.json",
|
|
||||||
"includes": [
|
|
||||||
"*.ts",
|
|
||||||
"**/*.ts",
|
|
||||||
"*.js",
|
|
||||||
"**/*.js"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
{inputs, ...}: (final: prev: {
|
|
||||||
appsPackages = let
|
|
||||||
inherit (final.lib) listToAttrs nameValuePair;
|
|
||||||
|
|
||||||
buildApp = attrs: (final.callPackage ./buildApp.nix ({} // inputs // attrs));
|
|
||||||
callPackage = file: final.callPackage file ({inherit buildApp;} // inputs);
|
|
||||||
in
|
|
||||||
listToAttrs (map (x: nameValuePair x (callPackage ./${x})) [
|
|
||||||
"extract-subs"
|
|
||||||
"gen-docs"
|
|
||||||
"list2series"
|
|
||||||
"mc-mods"
|
|
||||||
"pin-inputs"
|
|
||||||
"update-sources"
|
|
||||||
]);
|
|
||||||
})
|
|
|
@ -1,3 +0,0 @@
|
||||||
use flake $FLAKE#node
|
|
||||||
(cd ../config; npm ci)
|
|
||||||
npm ci
|
|
|
@ -1,11 +0,0 @@
|
||||||
{buildApp, ...}:
|
|
||||||
buildApp {
|
|
||||||
src = ./.;
|
|
||||||
npmDepsHash = "sha256-O10djW1GlSho53+uj/pJdbX3LjexDm1T2LanNO2xi/k=";
|
|
||||||
|
|
||||||
runtimeInputs = [];
|
|
||||||
|
|
||||||
meta.description = ''
|
|
||||||
Takes a list of inputs to pin to their current rev in `flake.lock`.
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
import eslintConf from 'eslint-conf';
|
|
||||||
|
|
||||||
export default eslintConf;
|
|
1548
apps/pin-inputs/package-lock.json
generated
1548
apps/pin-inputs/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,20 +0,0 @@
|
||||||
{
|
|
||||||
"name": "pin-inputs",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"bin": "out/bin/app.cjs",
|
|
||||||
"type": "module",
|
|
||||||
"scripts": {
|
|
||||||
"build": "node_ver=$(node -v); esbuild src/app.ts --bundle --platform=node --target=\"node${node_ver:1:2}\" --outfile=out/bin/app.cjs"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@types/node": "24.0.10",
|
|
||||||
"esbuild": "0.25.5",
|
|
||||||
"eslint": "9.30.1",
|
|
||||||
"jiti": "2.4.2",
|
|
||||||
"pkg-types": "2.2.0",
|
|
||||||
"typescript": "5.8.3"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"eslint-conf": "file:../config"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
import { readFileSync, writeFileSync } from 'fs';
|
|
||||||
|
|
||||||
export const replaceInFile = (replace: RegExp, replacement: string, file: string) => {
|
|
||||||
const fileContents = readFileSync(file);
|
|
||||||
|
|
||||||
const replaced = fileContents.toString().replace(replace, replacement);
|
|
||||||
|
|
||||||
writeFileSync(file, replaced);
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Constants */
|
|
||||||
const FLAKE = process.env.FLAKE;
|
|
||||||
|
|
||||||
if (!FLAKE) {
|
|
||||||
console.error('Environment variable FLAKE not found');
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const FLAKE_LOCK = JSON.parse(readFileSync(`${FLAKE}/flake.lock`, 'utf8')).nodes;
|
|
||||||
const INPUT_REVS = new Map<string, string>();
|
|
||||||
|
|
||||||
Object.entries(FLAKE_LOCK).forEach(([key, val]) => {
|
|
||||||
if (key !== 'root') {
|
|
||||||
// eslint-disable-next-line
|
|
||||||
INPUT_REVS.set(key, (val as any).locked.rev);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const INPUTS = process.argv.slice(2);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the commit hash of the specified input in this flake.
|
|
||||||
*
|
|
||||||
* @param input the name of the input
|
|
||||||
* @returns the commit hash
|
|
||||||
*/
|
|
||||||
const getCurrentRev = (input: string): string => {
|
|
||||||
if (!INPUT_REVS.has(input)) {
|
|
||||||
throw new Error(`Input ${input} could not be found.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return INPUT_REVS.get(input) as string;
|
|
||||||
};
|
|
||||||
|
|
||||||
INPUTS.forEach((input) => {
|
|
||||||
try {
|
|
||||||
const inputsFile = `${FLAKE}/inputs/default.nix`;
|
|
||||||
const rev = getCurrentRev(input);
|
|
||||||
|
|
||||||
const msg = ['FIX', 'ME'].join('');
|
|
||||||
|
|
||||||
replaceInFile(
|
|
||||||
new RegExp(`(\\n[ ]*)${input} =.*\\n.*\\n.*`),
|
|
||||||
`$&\n$1 # ${msg}: $1 rev = "${rev}";`,
|
|
||||||
inputsFile,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
console.error((e as Error).message);
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
|
||||||
"extends": "../config/tsconfig.base.json",
|
|
||||||
"includes": [
|
|
||||||
"*.ts",
|
|
||||||
"**/*.ts",
|
|
||||||
"*.js",
|
|
||||||
"**/*.js"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
use flake $FLAKE#node
|
|
||||||
(cd ../config; npm ci)
|
|
||||||
npm ci
|
|
|
@ -1,36 +0,0 @@
|
||||||
{
|
|
||||||
buildApp,
|
|
||||||
callPackage,
|
|
||||||
curl,
|
|
||||||
findutils,
|
|
||||||
go,
|
|
||||||
jq,
|
|
||||||
just,
|
|
||||||
nix-update,
|
|
||||||
nodejs_latest,
|
|
||||||
prefetch-npm-deps,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
buildApp {
|
|
||||||
src = ./.;
|
|
||||||
npmDepsHash = "sha256-suf/9pHegIFeKG8TZA/39aTdg7SE4XAH/Td35ztGDpk=";
|
|
||||||
|
|
||||||
runtimeInputs = [
|
|
||||||
curl
|
|
||||||
findutils
|
|
||||||
go
|
|
||||||
jq
|
|
||||||
just
|
|
||||||
nix-update
|
|
||||||
nodejs_latest
|
|
||||||
prefetch-npm-deps
|
|
||||||
# We want to use the one from my config with authfile
|
|
||||||
# (callPackage ../../modules/docker/updateImage.nix {})
|
|
||||||
(callPackage ../../configurations/homie/modules/home-assistant/netdaemon/update.nix {})
|
|
||||||
];
|
|
||||||
|
|
||||||
meta.description = ''
|
|
||||||
Updates all derivation sources in this repository and
|
|
||||||
generates a commit message for the changes made.
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
import eslintConf from 'eslint-conf';
|
|
||||||
|
|
||||||
export default eslintConf;
|
|
1548
apps/update-sources/package-lock.json
generated
1548
apps/update-sources/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,20 +0,0 @@
|
||||||
{
|
|
||||||
"name": "update-sources",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"bin": "out/bin/app.cjs",
|
|
||||||
"type": "module",
|
|
||||||
"scripts": {
|
|
||||||
"build": "node_ver=$(node -v); esbuild src/app.ts --bundle --platform=node --target=\"node${node_ver:1:2}\" --outfile=out/bin/app.cjs"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@types/node": "24.0.10",
|
|
||||||
"esbuild": "0.25.5",
|
|
||||||
"eslint": "9.30.1",
|
|
||||||
"jiti": "2.4.2",
|
|
||||||
"pkg-types": "2.2.0",
|
|
||||||
"typescript": "5.8.3"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"eslint-conf": "file:../config"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,204 +0,0 @@
|
||||||
import { spawnSync } from 'node:child_process';
|
|
||||||
import { writeFileSync } from 'node:fs';
|
|
||||||
import { styleText } from 'node:util';
|
|
||||||
|
|
||||||
import { parseArgs } from './lib';
|
|
||||||
|
|
||||||
import updateCaddyPlugins from './caddy';
|
|
||||||
import updateDocker from './docker';
|
|
||||||
import updateFirefoxAddons from '././firefox';
|
|
||||||
import updateFlakeInputs from './flake';
|
|
||||||
import updateNetDaemon from './netdaemon';
|
|
||||||
import runNixUpdate from './nix-update';
|
|
||||||
import updateNodeModules from './node-modules';
|
|
||||||
import updateVuetorrent from './vuetorrent';
|
|
||||||
|
|
||||||
|
|
||||||
/* Constants */
|
|
||||||
const FLAKE = process.env.FLAKE;
|
|
||||||
|
|
||||||
if (!FLAKE) {
|
|
||||||
console.error('Environment variable FLAKE was not found.\n');
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const args = parseArgs();
|
|
||||||
|
|
||||||
const main = async() => {
|
|
||||||
if (args['custom-sidebar']) {
|
|
||||||
console.log(
|
|
||||||
runNixUpdate('scopedPackages', 'lovelace-components', 'custom-sidebar') ?? 'No updates',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args['caddy'] || args['caddy-plugins']) {
|
|
||||||
console.log(updateCaddyPlugins() ?? 'No updates');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args['docker']) {
|
|
||||||
console.log(updateDocker() ?? 'No updates');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args['firefox']) {
|
|
||||||
console.log(updateFirefoxAddons() ?? 'No updates');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args['homepage']) {
|
|
||||||
console.log(runNixUpdate('homepage') ?? 'No updates');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args['flake'] || args['inputs']) {
|
|
||||||
console.log(updateFlakeInputs() ?? 'No updates');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args['material-rounded-theme']) {
|
|
||||||
console.log(
|
|
||||||
runNixUpdate('scopedPackages', 'lovelace-components', 'material-rounded-theme') ??
|
|
||||||
'No updates',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args['netdaemon']) {
|
|
||||||
console.log(updateNetDaemon() ?? 'No updates');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args['node'] || args['node_modules']) {
|
|
||||||
console.log((await updateNodeModules()) ?? 'No updates');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args['pam-fprint-grosshack']) {
|
|
||||||
console.log(runNixUpdate('pam-fprint-grosshack') ?? 'No updates');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args['protonhax']) {
|
|
||||||
console.log(runNixUpdate('protonhax') ?? 'No updates');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args['some-sass-language-server']) {
|
|
||||||
console.log(runNixUpdate('some-sass-language-server') ?? 'No updates');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args['trash'] || args['trash-d']) {
|
|
||||||
console.log(runNixUpdate('trash-d') ?? 'No updates');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args['vuetorrent']) {
|
|
||||||
console.log(updateVuetorrent() ?? 'No updates');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args['a'] || args['all']) {
|
|
||||||
// Update this first because of nix run cmd
|
|
||||||
const firefoxOutput = updateFirefoxAddons();
|
|
||||||
|
|
||||||
console.log(firefoxOutput ?? 'No updates');
|
|
||||||
|
|
||||||
|
|
||||||
const flakeOutput = updateFlakeInputs();
|
|
||||||
|
|
||||||
console.log(flakeOutput ?? 'No updates');
|
|
||||||
|
|
||||||
|
|
||||||
const dockerOutput = updateDocker();
|
|
||||||
|
|
||||||
console.log(dockerOutput ?? 'No updates');
|
|
||||||
|
|
||||||
|
|
||||||
const netdaemonOutput = updateNetDaemon();
|
|
||||||
|
|
||||||
console.log(netdaemonOutput ?? 'No updates');
|
|
||||||
|
|
||||||
|
|
||||||
const nodeModulesOutput = await updateNodeModules();
|
|
||||||
|
|
||||||
console.log(nodeModulesOutput ?? 'No updates');
|
|
||||||
|
|
||||||
|
|
||||||
const vuetorrentOutput = updateVuetorrent();
|
|
||||||
|
|
||||||
console.log(vuetorrentOutput ?? 'No updates');
|
|
||||||
|
|
||||||
|
|
||||||
const caddyPluginsOutput = updateCaddyPlugins();
|
|
||||||
|
|
||||||
console.log(caddyPluginsOutput ?? 'No updates');
|
|
||||||
|
|
||||||
|
|
||||||
// nix-update executions
|
|
||||||
const nixUpdateOutputs: string[] = [];
|
|
||||||
|
|
||||||
const updatePackage = (
|
|
||||||
attr: string,
|
|
||||||
scope?: string,
|
|
||||||
scopeAttr?: string,
|
|
||||||
): void => {
|
|
||||||
const execution = runNixUpdate(attr, scope, scopeAttr);
|
|
||||||
|
|
||||||
if (execution) {
|
|
||||||
nixUpdateOutputs.push(execution);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
updatePackage('homepage');
|
|
||||||
updatePackage('pam-fprint-grosshack');
|
|
||||||
updatePackage('protonhax');
|
|
||||||
updatePackage('some-sass-language-server');
|
|
||||||
updatePackage('trash-d');
|
|
||||||
updatePackage('scopedPackages', 'lovelace-components', 'custom-sidebar');
|
|
||||||
updatePackage('scopedPackages', 'lovelace-components', 'material-rounded-theme');
|
|
||||||
|
|
||||||
|
|
||||||
spawnSync(`alejandra -q ${FLAKE}`, [], { shell: true });
|
|
||||||
|
|
||||||
spawnSync('nixFastBuild', [], {
|
|
||||||
shell: true,
|
|
||||||
stdio: 'inherit',
|
|
||||||
});
|
|
||||||
|
|
||||||
const indentOutput = (output: string): string => {
|
|
||||||
return ` ${output.replace(/\n*$/g, '').split('\n').join('\n ')}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
const output = [
|
|
||||||
'chore: update sources',
|
|
||||||
];
|
|
||||||
|
|
||||||
if (flakeOutput) {
|
|
||||||
output.push(`Flake Inputs:\n${indentOutput(flakeOutput)}\n`);
|
|
||||||
}
|
|
||||||
if (dockerOutput) {
|
|
||||||
output.push(`Docker Images:\n${indentOutput(dockerOutput)}\n`);
|
|
||||||
}
|
|
||||||
if (firefoxOutput) {
|
|
||||||
output.push(`Firefox Addons:\n${indentOutput(firefoxOutput)}\n`);
|
|
||||||
}
|
|
||||||
if (nodeModulesOutput) {
|
|
||||||
output.push(`Node modules:\n${indentOutput(nodeModulesOutput)}\n`);
|
|
||||||
}
|
|
||||||
if (vuetorrentOutput) {
|
|
||||||
output.push(`qBittorrent Sources:\n${indentOutput(vuetorrentOutput)}\n`);
|
|
||||||
}
|
|
||||||
if (caddyPluginsOutput) {
|
|
||||||
output.push(`Caddy Plugins:\n${indentOutput(caddyPluginsOutput)}\n`);
|
|
||||||
}
|
|
||||||
if (netdaemonOutput) {
|
|
||||||
output.push(`NetDaemon:\n${indentOutput(netdaemonOutput)}\n`);
|
|
||||||
}
|
|
||||||
if (nixUpdateOutputs.length > 0) {
|
|
||||||
output.push(`nix-update executions:\n${indentOutput(nixUpdateOutputs.join('\n'))}\n`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args['f']) {
|
|
||||||
console.log(styleText(['magenta'], `\n\nWriting commit message to ${args['f']}\n`));
|
|
||||||
writeFileSync(args['f'], output.join('\n\n'));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.log(styleText(['magenta'], '\n\nCommit message:\n'));
|
|
||||||
console.log(output.join('\n\n'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
spawnSync(`alejandra -q ${FLAKE}`, [], { shell: true });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
main();
|
|
|
@ -1,92 +0,0 @@
|
||||||
import { writeFileSync } from 'node:fs';
|
|
||||||
import { spawnSync } from 'node:child_process';
|
|
||||||
|
|
||||||
import { replaceInFile } from './lib';
|
|
||||||
import { styleText } from 'node:util';
|
|
||||||
|
|
||||||
/* Types */
|
|
||||||
interface Plugin {
|
|
||||||
url: string
|
|
||||||
version: string
|
|
||||||
type: 'version' | 'git'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Constants */
|
|
||||||
const FLAKE = process.env.FLAKE;
|
|
||||||
|
|
||||||
const genPluginsText = (
|
|
||||||
plugins: Record<string, Plugin>,
|
|
||||||
) => `{
|
|
||||||
plugins = {
|
|
||||||
${Object.entries(plugins)
|
|
||||||
.map(([key, value]) => `
|
|
||||||
${key} = {
|
|
||||||
url = "${value.url}";
|
|
||||||
version = "${value.version}";
|
|
||||||
type = "${value.type}";
|
|
||||||
};
|
|
||||||
`)
|
|
||||||
.join('')}
|
|
||||||
};
|
|
||||||
|
|
||||||
hash = "";
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export default (): string | null => {
|
|
||||||
console.log(styleText(['magenta'], '\nUpdating caddy plugins:\n'));
|
|
||||||
|
|
||||||
const updates: string[] = [];
|
|
||||||
const dir = `${FLAKE}/configurations/cluster/modules/caddy`;
|
|
||||||
|
|
||||||
// Setup workspace
|
|
||||||
spawnSync(
|
|
||||||
[
|
|
||||||
'rm -rf /tmp/update-caddy',
|
|
||||||
'mkdir -p /tmp/update-caddy',
|
|
||||||
'cd /tmp/update-caddy || exit 1',
|
|
||||||
'go mod init temp',
|
|
||||||
].join('; '),
|
|
||||||
[],
|
|
||||||
{ shell: true, cwd: '/tmp' },
|
|
||||||
);
|
|
||||||
|
|
||||||
const plugins = JSON.parse(spawnSync(
|
|
||||||
['nix', 'eval', '-f', `${dir}/plugins.nix`, '--json'].join(' '), [], { shell: true },
|
|
||||||
).stdout.toString()).plugins as Record<string, Plugin>;
|
|
||||||
|
|
||||||
// Get most recent versions of plugins
|
|
||||||
Object.entries(plugins).forEach(([key, value]) => {
|
|
||||||
const NEW_VERSION = spawnSync([
|
|
||||||
'go mod init temp > /dev/null',
|
|
||||||
`go get ${value.url}${value.type === 'git' ? '@HEAD' : ''} > /dev/null`,
|
|
||||||
`grep '${value.url}' go.mod`,
|
|
||||||
].join('; '), [], { shell: true, cwd: '/tmp/update-caddy' })
|
|
||||||
.stdout
|
|
||||||
.toString()
|
|
||||||
.trim()
|
|
||||||
.replace(' // indirect', '')
|
|
||||||
.split(' ')[1];
|
|
||||||
|
|
||||||
if (plugins[key].version !== NEW_VERSION) {
|
|
||||||
updates.push(`${key}: ${plugins[key].version} -> ${NEW_VERSION}`);
|
|
||||||
plugins[key].version = NEW_VERSION;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
writeFileSync(`${dir}/plugins.nix`, genPluginsText(plugins));
|
|
||||||
|
|
||||||
// Get new hash
|
|
||||||
const caddyPkgAttr = 'nixosConfigurations.thingone.config.services.caddy.package';
|
|
||||||
|
|
||||||
const NEW_HASH = spawnSync(
|
|
||||||
`nix build "$FLAKE#${caddyPkgAttr}" |& sed -n 's/.*got: *//p'`,
|
|
||||||
[],
|
|
||||||
{ shell: true },
|
|
||||||
).stdout.toString().trim();
|
|
||||||
|
|
||||||
replaceInFile(/hash = ".*";/, `hash = "${NEW_HASH}";`, `${dir}/plugins.nix`);
|
|
||||||
|
|
||||||
return updates.length > 0 ? updates.join('\n') : null;
|
|
||||||
};
|
|
|
@ -1,57 +0,0 @@
|
||||||
import { readdirSync } from 'node:fs';
|
|
||||||
import { spawnSync } from 'node:child_process';
|
|
||||||
import { styleText } from 'node:util';
|
|
||||||
|
|
||||||
|
|
||||||
/* Constants */
|
|
||||||
const FLAKE = process.env.FLAKE;
|
|
||||||
|
|
||||||
const updateImages = (imagePath: string): string | undefined => {
|
|
||||||
console.log(`Updating ${imagePath.split('/').at(-1)} images`);
|
|
||||||
|
|
||||||
const out = spawnSync(`updateImages ${imagePath}`, [], { shell: true }).stdout.toString();
|
|
||||||
|
|
||||||
if (out.length > 1) {
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default (): string | null => {
|
|
||||||
console.log(styleText(['magenta'], '\nUpdating docker images:\n'));
|
|
||||||
|
|
||||||
const updates: string[] = [];
|
|
||||||
|
|
||||||
const jdownloaderUpdates = updateImages(`${FLAKE}/configurations/nos/modules/comics/jdownloader2`);
|
|
||||||
|
|
||||||
if (jdownloaderUpdates) {
|
|
||||||
updates.push(jdownloaderUpdates);
|
|
||||||
}
|
|
||||||
|
|
||||||
const jellfyinUpdates = updateImages(`${FLAKE}/configurations/nos/modules/jellyfin`);
|
|
||||||
|
|
||||||
if (jellfyinUpdates) {
|
|
||||||
updates.push(jellfyinUpdates);
|
|
||||||
}
|
|
||||||
|
|
||||||
const hassUpdates = updateImages(`${FLAKE}/configurations/homie/modules/home-assistant/netdaemon`);
|
|
||||||
|
|
||||||
if (hassUpdates) {
|
|
||||||
updates.push(hassUpdates);
|
|
||||||
}
|
|
||||||
|
|
||||||
const DIR = `${FLAKE}/configurations/nos/modules/docker`;
|
|
||||||
|
|
||||||
readdirSync(DIR, { withFileTypes: true, recursive: true }).forEach((path) => {
|
|
||||||
if (path.name === 'compose.nix') {
|
|
||||||
const composeUpdates = updateImages(path.parentPath);
|
|
||||||
|
|
||||||
if (composeUpdates) {
|
|
||||||
updates.push(composeUpdates);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return updates.length > 0 ?
|
|
||||||
updates.join('') :
|
|
||||||
null;
|
|
||||||
};
|
|
|
@ -1,63 +0,0 @@
|
||||||
import { spawnSync } from 'node:child_process';
|
|
||||||
import { readFileSync } from 'node:fs';
|
|
||||||
import { styleText } from 'node:util';
|
|
||||||
|
|
||||||
|
|
||||||
/* Constants */
|
|
||||||
const FLAKE = process.env.FLAKE;
|
|
||||||
|
|
||||||
export default (): string | null => {
|
|
||||||
console.log(styleText(['magenta'], '\nUpdating firefox addons using mozilla-addons-to-nix:\n'));
|
|
||||||
|
|
||||||
const DIR = `${FLAKE}/scopedPackages/firefox-addons`;
|
|
||||||
const GENERATED_FILE = `${DIR}/generated-firefox-addons.nix`;
|
|
||||||
const SLUGS = `${DIR}/addons.json`;
|
|
||||||
|
|
||||||
const nameMap = Object.fromEntries([...JSON.parse(readFileSync(SLUGS, 'utf-8'))]
|
|
||||||
.map((addon) => [addon.slug, addon.pname || addon.slug]));
|
|
||||||
|
|
||||||
const nixExpr = `'
|
|
||||||
x: let
|
|
||||||
inherit (builtins) attrValues filter hasAttr isAttrs map;
|
|
||||||
in
|
|
||||||
map (d: d.name) (filter (y:
|
|
||||||
isAttrs y &&
|
|
||||||
hasAttr "type" y &&
|
|
||||||
y.type == "derivation") (attrValues x))
|
|
||||||
'`;
|
|
||||||
|
|
||||||
const OLD_VERS = Object.fromEntries([...JSON.parse(spawnSync([
|
|
||||||
'nix',
|
|
||||||
'eval',
|
|
||||||
'.#scopedPackages.x86_64-linux.firefoxAddons',
|
|
||||||
'--apply',
|
|
||||||
nixExpr,
|
|
||||||
'--json',
|
|
||||||
].join(' '), [], { shell: true }).stdout.toString())]
|
|
||||||
.map((p) => {
|
|
||||||
const pname = p.replace(/-[0-9].*$/, '');
|
|
||||||
|
|
||||||
return [pname, p.replace(`${pname}-`, '')];
|
|
||||||
})
|
|
||||||
.filter((pinfo) => pinfo[0] !== 'frankerfacez'));
|
|
||||||
|
|
||||||
const NEW_VERS = Object.fromEntries(spawnSync([
|
|
||||||
'nix', 'run', 'sourcehut:~rycee/mozilla-addons-to-nix', SLUGS, GENERATED_FILE,
|
|
||||||
].join(' '), [], { shell: true }).stdout
|
|
||||||
.toString()
|
|
||||||
.split('\n')
|
|
||||||
.map((p) => {
|
|
||||||
const pinfo = p.replace('Fetched ', '').split(' ');
|
|
||||||
|
|
||||||
return [nameMap[pinfo[0]], pinfo[2]];
|
|
||||||
}));
|
|
||||||
|
|
||||||
const changelogs = Object.keys(OLD_VERS)
|
|
||||||
.sort()
|
|
||||||
.filter((pname) => OLD_VERS[pname] !== NEW_VERS[pname])
|
|
||||||
.map((pname) => `${pname}: ${OLD_VERS[pname]} -> ${NEW_VERS[pname]}`);
|
|
||||||
|
|
||||||
return changelogs.length > 0 ?
|
|
||||||
changelogs.join('\n') :
|
|
||||||
null;
|
|
||||||
};
|
|
|
@ -1,59 +0,0 @@
|
||||||
import { spawnSync } from 'node:child_process';
|
|
||||||
import { styleText } from 'node:util';
|
|
||||||
|
|
||||||
|
|
||||||
/* Constants */
|
|
||||||
const FLAKE = process.env.FLAKE;
|
|
||||||
|
|
||||||
export default (): string | null => {
|
|
||||||
console.log(styleText(['magenta'], '\nUpdating flake inputs:\n'));
|
|
||||||
|
|
||||||
const output: string = spawnSync(
|
|
||||||
`git restore flake.lock &> /dev/null; nix flake update --flake ${FLAKE}` +
|
|
||||||
' |& grep -v "warning: updating lock file" |& grep -v "unpacking"',
|
|
||||||
[],
|
|
||||||
{ shell: true },
|
|
||||||
).stdout.toString();
|
|
||||||
|
|
||||||
const inputsUpdates: string[] = output
|
|
||||||
// Get an array of each update / change
|
|
||||||
.split('\n•')
|
|
||||||
// Filter out some inputs
|
|
||||||
.filter((input) => ![
|
|
||||||
'systems',
|
|
||||||
'flake-compat',
|
|
||||||
'flake-utils',
|
|
||||||
'flake-parts',
|
|
||||||
'treefmt-nix',
|
|
||||||
'lib-aggregate',
|
|
||||||
'lib-aggregate/nixpkgs-lib',
|
|
||||||
'nix-gaming/umu',
|
|
||||||
'nix-github-actions',
|
|
||||||
'pre-commit-hooks',
|
|
||||||
].some((inputName) => input.startsWith(` Updated input '${inputName}'`)));
|
|
||||||
|
|
||||||
const formattedOutput: string = inputsUpdates
|
|
||||||
// Add an extra blank line between inputs
|
|
||||||
.join('\n\n•')
|
|
||||||
// Help readability of git revs
|
|
||||||
.split('\n')
|
|
||||||
.map((l) => l
|
|
||||||
.replace(
|
|
||||||
/\/(.{40})\?narHash=sha256[^']*(.*)/,
|
|
||||||
(_, backref1, backref2) => `${backref2} rev: ${backref1}`,
|
|
||||||
)
|
|
||||||
.replace(
|
|
||||||
/\?ref.*&rev=(.{40})[^'&]*(.*)/,
|
|
||||||
(_, backref1, backref2) => `${backref2} rev: ${backref1}`,
|
|
||||||
))
|
|
||||||
.join('\n');
|
|
||||||
|
|
||||||
// make sure we cleanup 'follows' statements
|
|
||||||
spawnSync('just genflake', [], {
|
|
||||||
cwd: FLAKE, shell: true, stdio: 'inherit',
|
|
||||||
});
|
|
||||||
|
|
||||||
return inputsUpdates.length > 0 ?
|
|
||||||
formattedOutput :
|
|
||||||
null;
|
|
||||||
};
|
|
|
@ -1,49 +0,0 @@
|
||||||
import { spawnSync } from 'node:child_process';
|
|
||||||
import { readFileSync, writeFileSync } from 'node:fs';
|
|
||||||
|
|
||||||
/* Types */
|
|
||||||
interface Args {
|
|
||||||
f: string | undefined
|
|
||||||
[name: string]: unknown
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const parseArgs = (): Args => {
|
|
||||||
const args = {} as Args;
|
|
||||||
let lastFlag: string | null = null;
|
|
||||||
|
|
||||||
for (let i = 2; i < process.argv.length; ++i) {
|
|
||||||
const arg = process.argv[i];
|
|
||||||
|
|
||||||
if (arg.toString().startsWith('-')) {
|
|
||||||
lastFlag = arg.toString().replace(/^-{1,2}/, '');
|
|
||||||
args[lastFlag] = true;
|
|
||||||
}
|
|
||||||
else if (lastFlag) {
|
|
||||||
args[lastFlag] = arg;
|
|
||||||
lastFlag = null;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.error(`Could not parse args: ${arg.toString()}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return args;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const parseFetchurl = (url: string): string => JSON.parse(spawnSync(
|
|
||||||
['nix', 'store', 'prefetch-file', '--refresh', '--json',
|
|
||||||
'--hash-type', 'sha256', url, '--name', '"escaped"'].join(' '), [], { shell: true },
|
|
||||||
).stdout.toString()).hash;
|
|
||||||
|
|
||||||
export const replaceInFile = (replace: RegExp, replacement: string, file: string): void => {
|
|
||||||
const fileContents = readFileSync(file);
|
|
||||||
|
|
||||||
const replaced = fileContents.toString().replace(replace, replacement);
|
|
||||||
|
|
||||||
writeFileSync(file, replaced);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const npmRun = (args: string[], workspaceDir: string): string => spawnSync(
|
|
||||||
'npm', args, { cwd: workspaceDir },
|
|
||||||
).stdout.toString();
|
|
|
@ -1,32 +0,0 @@
|
||||||
import { readFileSync, writeFileSync } from 'node:fs';
|
|
||||||
import { spawnSync } from 'node:child_process';
|
|
||||||
import { styleText } from 'node:util';
|
|
||||||
|
|
||||||
|
|
||||||
/* Constants */
|
|
||||||
const FLAKE = process.env.FLAKE;
|
|
||||||
|
|
||||||
export default (): string | null => {
|
|
||||||
console.log(styleText(['magenta'], '\nUpdating NetDaemon:\n'));
|
|
||||||
|
|
||||||
const FOLDER = `${FLAKE}/configurations/homie/modules/home-assistant/netdaemon`;
|
|
||||||
|
|
||||||
const OLD_VERSION = readFileSync(`${FOLDER}/.version`).toString().replace('\n', '');
|
|
||||||
|
|
||||||
const VERSION = JSON.parse(spawnSync([
|
|
||||||
'curl', '-s', 'https://api.github.com/repos/net-daemon/netdaemon/releases/latest',
|
|
||||||
].join(' '), [], { shell: true }).stdout.toString()).tag_name.replace('v', '');
|
|
||||||
|
|
||||||
if (OLD_VERSION !== VERSION) {
|
|
||||||
writeFileSync(`${FOLDER}/.version`, `${VERSION}\n`);
|
|
||||||
|
|
||||||
spawnSync('bumpNetdaemonDeps', [], {
|
|
||||||
cwd: FOLDER,
|
|
||||||
stdio: ['inherit', 'ignore', 'inherit'],
|
|
||||||
});
|
|
||||||
|
|
||||||
return `NetDaemon: ${OLD_VERSION} -> ${VERSION}\n`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
};
|
|
|
@ -1,35 +0,0 @@
|
||||||
import { spawnSync } from 'node:child_process';
|
|
||||||
import { styleText } from 'node:util';
|
|
||||||
|
|
||||||
|
|
||||||
/* Constants */
|
|
||||||
const FLAKE = process.env.FLAKE;
|
|
||||||
|
|
||||||
const getAttrVersion = (attr: string): string => spawnSync(
|
|
||||||
['nix', 'eval', '--raw', `${FLAKE}#${attr}.version`].join(' '), [], { shell: true },
|
|
||||||
).stdout.toString();
|
|
||||||
|
|
||||||
export default (
|
|
||||||
attr: string,
|
|
||||||
scope?: string,
|
|
||||||
scopeAttr?: string,
|
|
||||||
): string | null => {
|
|
||||||
const realAttr = scope ? `${attr}.x86_64-linux.${scope}.${scopeAttr}` : attr;
|
|
||||||
const cleanAttr = scope ? `${attr}.${scope}.${scopeAttr}` : attr;
|
|
||||||
|
|
||||||
console.log(styleText(['magenta'], `\nUpdating ${cleanAttr}:\n`));
|
|
||||||
|
|
||||||
const OLD_VERSION = getAttrVersion(realAttr);
|
|
||||||
|
|
||||||
spawnSync(
|
|
||||||
'nix-update',
|
|
||||||
['--flake', realAttr, '-u'],
|
|
||||||
{ cwd: FLAKE, stdio: ['inherit', 'ignore', 'inherit'] },
|
|
||||||
);
|
|
||||||
|
|
||||||
const NEW_VERSION = getAttrVersion(realAttr);
|
|
||||||
|
|
||||||
return OLD_VERSION !== NEW_VERSION ?
|
|
||||||
`${cleanAttr}: ${OLD_VERSION} -> ${NEW_VERSION}` :
|
|
||||||
null;
|
|
||||||
};
|
|
|
@ -1,123 +0,0 @@
|
||||||
import { readPackageJSON, writePackageJSON } from 'pkg-types';
|
|
||||||
import { accessSync, constants, existsSync } from 'node:fs';
|
|
||||||
import { spawnSync } from 'node:child_process';
|
|
||||||
import { styleText } from 'node:util';
|
|
||||||
|
|
||||||
import { replaceInFile, npmRun } from './lib';
|
|
||||||
|
|
||||||
|
|
||||||
/* Constants */
|
|
||||||
const FLAKE = process.env.FLAKE as string;
|
|
||||||
|
|
||||||
const PINS = new Map([]);
|
|
||||||
|
|
||||||
const updatePackageJson = async(workspaceDir: string, updates: object) => {
|
|
||||||
const currentPackageJson = await readPackageJSON(`${workspaceDir}/package.json`);
|
|
||||||
|
|
||||||
const outdated = JSON.parse(npmRun(['outdated', '--json'], workspaceDir));
|
|
||||||
|
|
||||||
const updateDeps = (deps: string) => {
|
|
||||||
Object.keys(currentPackageJson[deps]).forEach(async(dep) => {
|
|
||||||
if (dep === 'astal') {
|
|
||||||
const latestCommit = JSON.parse(spawnSync(
|
|
||||||
['curl', '-s', 'https://api.github.com/repos/Aylur/astal/commits/main'].join(' '), [], { shell: true },
|
|
||||||
).stdout.toString()).sha;
|
|
||||||
|
|
||||||
currentPackageJson[deps][dep] = `https://gitpkg.vercel.app/Aylur/astal/lang/gjs/src?${latestCommit}`;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PINS.has(dep)) {
|
|
||||||
currentPackageJson[deps][dep] = PINS.get(dep);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const versions = outdated[dep];
|
|
||||||
const current = versions?.wanted || versions?.current;
|
|
||||||
|
|
||||||
if (!current) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (current !== versions.latest) {
|
|
||||||
updates[dep] = `${current} -> ${versions.latest}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentPackageJson[deps][dep] = versions.latest;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
if (currentPackageJson.dependencies) {
|
|
||||||
updateDeps('dependencies');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentPackageJson.devDependencies) {
|
|
||||||
updateDeps('devDependencies');
|
|
||||||
}
|
|
||||||
|
|
||||||
await writePackageJSON(`${workspaceDir}/package.json`, currentPackageJson);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const prefetchNpmDeps = (workspaceDir: string): string => {
|
|
||||||
npmRun(['update', '--package-lock-only'], workspaceDir);
|
|
||||||
|
|
||||||
return spawnSync(
|
|
||||||
'prefetch-npm-deps',
|
|
||||||
[`${workspaceDir}/package-lock.json`],
|
|
||||||
).stdout.toString().replace('\n', '');
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export default async(): Promise<string | null> => {
|
|
||||||
console.log(styleText(['magenta'], '\nUpdating node modules:\n'));
|
|
||||||
|
|
||||||
const updates = {};
|
|
||||||
|
|
||||||
const packages = spawnSync('find', [FLAKE, '-name', 'package.json']).stdout.toString().split('\n')
|
|
||||||
.filter((f) => f !== '')
|
|
||||||
.filter((f) => ![
|
|
||||||
'.direnv',
|
|
||||||
'node_modules',
|
|
||||||
'results',
|
|
||||||
].some((dirName) => f.includes(dirName)));
|
|
||||||
|
|
||||||
for (const path of packages) {
|
|
||||||
console.log(path);
|
|
||||||
|
|
||||||
try {
|
|
||||||
accessSync(path, constants.R_OK | constants.W_OK);
|
|
||||||
|
|
||||||
const parentPath = path.replace('/package.json', '');
|
|
||||||
|
|
||||||
await updatePackageJson(parentPath, updates);
|
|
||||||
|
|
||||||
if (existsSync(`${parentPath}/default.nix`)) {
|
|
||||||
const hash = prefetchNpmDeps(parentPath);
|
|
||||||
|
|
||||||
replaceInFile(
|
|
||||||
/npmDepsHash = ".*";/,
|
|
||||||
`npmDepsHash = "${hash}";`,
|
|
||||||
`${parentPath}/default.nix`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure we update the apps' config package-lock.json
|
|
||||||
if (parentPath.includes('apps/config')) {
|
|
||||||
npmRun(['i'], parentPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
console.warn(`Could not write to ${path}`);
|
|
||||||
console.warn(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Object.entries(updates).length > 0 ?
|
|
||||||
Object.entries(updates)
|
|
||||||
.map(([key, dep]) => `${key}: ${dep}`)
|
|
||||||
.join('\n') :
|
|
||||||
null;
|
|
||||||
};
|
|
|
@ -1,44 +0,0 @@
|
||||||
import { writeFileSync } from 'node:fs';
|
|
||||||
import { spawnSync } from 'node:child_process';
|
|
||||||
import { styleText } from 'node:util';
|
|
||||||
|
|
||||||
import { parseFetchurl } from './lib';
|
|
||||||
|
|
||||||
|
|
||||||
/* Constants */
|
|
||||||
const FLAKE = process.env.FLAKE;
|
|
||||||
|
|
||||||
const genVueText = (
|
|
||||||
version: string,
|
|
||||||
hash: string,
|
|
||||||
url: string,
|
|
||||||
) => `# This file was autogenerated. DO NOT EDIT!
|
|
||||||
{
|
|
||||||
version = "${version}";
|
|
||||||
url = "${url}";
|
|
||||||
hash = "${hash}";
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export default (): string | null => {
|
|
||||||
console.log(styleText(['magenta'], '\nUpdating Vuetorrent:\n'));
|
|
||||||
|
|
||||||
const FILE = `${FLAKE}/configurations/nos/modules/qbittorrent/vuetorrent.nix`;
|
|
||||||
|
|
||||||
const OLD_VERSION = JSON.parse(spawnSync(
|
|
||||||
['nix', 'eval', '-f', FILE, '--json'].join(' '), [], { shell: true },
|
|
||||||
).stdout.toString()).version;
|
|
||||||
|
|
||||||
const VERSION = JSON.parse(spawnSync(
|
|
||||||
['curl', '-s', 'https://api.github.com/repos/VueTorrent/VueTorrent/releases/latest'].join(' '), [], { shell: true },
|
|
||||||
).stdout.toString()).tag_name.replace('v', '');
|
|
||||||
|
|
||||||
const URL = `https://github.com/VueTorrent/VueTorrent/releases/download/v${VERSION}/vuetorrent.zip`;
|
|
||||||
const HASH = parseFetchurl(URL);
|
|
||||||
|
|
||||||
const fileText = genVueText(VERSION, HASH, URL);
|
|
||||||
|
|
||||||
writeFileSync(FILE, fileText);
|
|
||||||
|
|
||||||
return OLD_VERSION !== VERSION ? `Vuetorrent: ${OLD_VERSION} -> ${VERSION}\n` : null;
|
|
||||||
};
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
|
||||||
"extends": "../config/tsconfig.base.json",
|
|
||||||
"includes": [
|
|
||||||
"*.ts",
|
|
||||||
"**/*.ts",
|
|
||||||
"*.js",
|
|
||||||
"**/*.js"
|
|
||||||
]
|
|
||||||
}
|
|
1
config/eww/README.md
Normal file
1
config/eww/README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
inspired from: https://github.com/AlphaTechnolog/dotfiles/tree/openbox
|
1
config/eww/closer/README.md
Normal file
1
config/eww/closer/README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
always open this widget last
|
60
config/eww/closer/closer.yuck
Normal file
60
config/eww/closer/closer.yuck
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
(defwidget closer []
|
||||||
|
(eventbox :onclick "$EWW_PATH/close-opened.sh && eww close closer")
|
||||||
|
)
|
||||||
|
(defwindow closer :monitor 0
|
||||||
|
:geometry (geometry :width "100%"
|
||||||
|
:height "100%")
|
||||||
|
:stacking "overlay"
|
||||||
|
:focusable false
|
||||||
|
(closer :window "")
|
||||||
|
)
|
||||||
|
|
||||||
|
(defwidget closer-notif []
|
||||||
|
(eventbox :onclick "$EWW_PATH/notif-toggle.sh off")
|
||||||
|
)
|
||||||
|
(defwindow closer-notif1 :monitor 0
|
||||||
|
:geometry (geometry :width "1360px"
|
||||||
|
:height "1200px")
|
||||||
|
:stacking "overlay"
|
||||||
|
:focusable false
|
||||||
|
:exclusive "ignore"
|
||||||
|
(closer-notif)
|
||||||
|
)
|
||||||
|
(defwindow closer-notif2 :monitor 0
|
||||||
|
:geometry (geometry :width "100%"
|
||||||
|
:height "200px"
|
||||||
|
:y "1060px")
|
||||||
|
:stacking "overlay"
|
||||||
|
:focusable false
|
||||||
|
:exclusive "ignore"
|
||||||
|
(closer-notif)
|
||||||
|
)
|
||||||
|
(defwindow closer-notif3 :monitor 0
|
||||||
|
:geometry (geometry :width "100%"
|
||||||
|
:height "60px")
|
||||||
|
:stacking "overlay"
|
||||||
|
:focusable false
|
||||||
|
:exclusive "ignore"
|
||||||
|
(closer-notif)
|
||||||
|
)
|
||||||
|
(defwindow closer-notif4 :monitor 0
|
||||||
|
:geometry (geometry :width "60px"
|
||||||
|
:height "100%"
|
||||||
|
:x "1860px")
|
||||||
|
:stacking "overlay"
|
||||||
|
:focusable false
|
||||||
|
:exclusive "ignore"
|
||||||
|
(closer-notif)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defwidget on-release-fix []
|
||||||
|
(eventbox :onclick "eww close on-release-fix")
|
||||||
|
)
|
||||||
|
(defwindow on-release-fix :monitor 0
|
||||||
|
:geometry (geometry :width "100%"
|
||||||
|
:height "100%"
|
||||||
|
)
|
||||||
|
:stacking "overlay"
|
||||||
|
:exclusive "ignore"
|
||||||
|
(on-release-fix)
|
||||||
|
)
|
32
config/eww/colors.scss
Normal file
32
config/eww/colors.scss
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
$darkbg: #0b0d16;
|
||||||
|
$bg: rgba(40, 42, 54, 0.8); //rgba(69, 71, 90, 0.3); #0d0f18;
|
||||||
|
$bgfull: rgb(40, 42, 54);
|
||||||
|
$contrastbg: rgba(189, 147, 249, 0.8);
|
||||||
|
$bgSecondary: #11131c;
|
||||||
|
$bgSecondaryAlt: #a5b6cf;
|
||||||
|
$fg: #a5b6cf;
|
||||||
|
$fgDim: #a5b6cf;
|
||||||
|
$watermelon: #dd6777;
|
||||||
|
|
||||||
|
// Aliases
|
||||||
|
$background: $bg;
|
||||||
|
$backgroundSecondary: $bgSecondary;
|
||||||
|
$backgroundSecondaryAlt: $bgSecondaryAlt;
|
||||||
|
$foreground: $fg;
|
||||||
|
$foregroundDim: $fgDim;
|
||||||
|
|
||||||
|
$black: #151720;
|
||||||
|
$dimblack: #1a1c25;
|
||||||
|
$lightblack: #262831;
|
||||||
|
$red: #dd6777;
|
||||||
|
$blue: #86aaec;
|
||||||
|
$cyan: #93cee9;
|
||||||
|
$blue-desaturated: #93cee9;
|
||||||
|
$magenta: #c296eb;
|
||||||
|
$purple: #c296eb;
|
||||||
|
$green: #90ceaa;
|
||||||
|
$aquamarine: #90ceaa;
|
||||||
|
$yellow: #ecd3a0;
|
||||||
|
$accent: $blue;
|
||||||
|
$javacafeMagenta: #c296eb;
|
||||||
|
$javacafeBlue: #86aaec;
|
75
config/eww/date/date.scss
Normal file
75
config/eww/date/date.scss
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
.date {
|
||||||
|
background-color: $bg;
|
||||||
|
color: $fg;
|
||||||
|
border-radius: 30px;
|
||||||
|
border: 2px solid $contrastbg;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timebox {
|
||||||
|
margin: 30px 0px;
|
||||||
|
.time-container {
|
||||||
|
.content {
|
||||||
|
font-family: Product Sans;
|
||||||
|
font-weight: bolder;
|
||||||
|
font-size: 60px;
|
||||||
|
}
|
||||||
|
.divider {
|
||||||
|
margin: 8px 15px;
|
||||||
|
padding: 0px 1px;
|
||||||
|
background: linear-gradient($red, $magenta, $blue, $cyan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.date-container {
|
||||||
|
font-family: Product Sans;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.cal-box {
|
||||||
|
font-family: Product Sans;
|
||||||
|
background-color: $bg;
|
||||||
|
border-radius: 30px;
|
||||||
|
padding: 0 1rem .2rem;
|
||||||
|
color: $fg;
|
||||||
|
background-color: $bgfull;
|
||||||
|
border-bottom: 2px solid $contrastbg;
|
||||||
|
border-top: 2px solid $contrastbg;
|
||||||
|
margin: 0px 12px 18px 12px;
|
||||||
|
|
||||||
|
.cal {
|
||||||
|
background-color: inherit;
|
||||||
|
padding: .5rem .10rem 0rem;
|
||||||
|
margin-left: 10px;
|
||||||
|
border-radius: 30px;
|
||||||
|
|
||||||
|
& > * {
|
||||||
|
border: solid 0px transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.highlight {
|
||||||
|
padding: 10rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
calendar:selected {
|
||||||
|
color: $cyan;
|
||||||
|
}
|
||||||
|
|
||||||
|
calendar.header {
|
||||||
|
color: $cyan;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
calendar.button {
|
||||||
|
color: $cyan;
|
||||||
|
}
|
||||||
|
|
||||||
|
calendar.highlight {
|
||||||
|
color: $green;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
calendar:indeterminate {
|
||||||
|
color: $lightblack;
|
||||||
|
}
|
63
config/eww/date/date.yuck
Normal file
63
config/eww/date/date.yuck
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
(defwidget divider []
|
||||||
|
(box :class "divider"
|
||||||
|
:orientation "v"
|
||||||
|
:space-evenly true)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defwidget time []
|
||||||
|
(box :class "timebox"
|
||||||
|
:orientation "v"
|
||||||
|
:space-evenly false
|
||||||
|
(box :class "time-container"
|
||||||
|
:orientation "h"
|
||||||
|
:space-evenly false
|
||||||
|
:halign "center"
|
||||||
|
:valign "center"
|
||||||
|
(label :text "${lithour}" :class "content")
|
||||||
|
(divider)
|
||||||
|
(label :text "${litmin}" :class "content")
|
||||||
|
)
|
||||||
|
(box :class "date-container"
|
||||||
|
:orientation "h"
|
||||||
|
:space-evenly true
|
||||||
|
:halign "center"
|
||||||
|
(label :text "${completeday}")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defwidget cal []
|
||||||
|
(box :class "cal-box"
|
||||||
|
:orientation "v"
|
||||||
|
:space-evenly false
|
||||||
|
(calendar :class "cal"
|
||||||
|
:day calendar_day
|
||||||
|
:month calendar_month
|
||||||
|
:year calendar_year)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defwidget date []
|
||||||
|
(box :class "date"
|
||||||
|
:orientation "v"
|
||||||
|
:space-evenly false
|
||||||
|
(time)
|
||||||
|
(cal)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defvar date-visible false)
|
||||||
|
|
||||||
|
(defwindow date-reveal
|
||||||
|
:monitor 0
|
||||||
|
:stacking "overlay"
|
||||||
|
:geometry (geometry :x "70px"
|
||||||
|
:y "8px"
|
||||||
|
:width "0px" ; automatically generated
|
||||||
|
:height "0px" ; automatically generated
|
||||||
|
:anchor "top right")
|
||||||
|
(revealer
|
||||||
|
:transition "crossfade"
|
||||||
|
:reveal date-visible
|
||||||
|
:duration anim_duration
|
||||||
|
(date)))
|
10
config/eww/eww.scss
Normal file
10
config/eww/eww.scss
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
* {
|
||||||
|
all: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
@import "colors.scss";
|
||||||
|
@import "date/date.scss";
|
||||||
|
@import "powermenu/powermenu.scss";
|
||||||
|
@import "playerinfo/playerinfo.scss";
|
||||||
|
@import "quick-settings/quick-settings.scss";
|
||||||
|
@import "traybuttons/traybuttons.scss";
|
7
config/eww/eww.yuck
Normal file
7
config/eww/eww.yuck
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
(include "variables.yuck")
|
||||||
|
(include "date/date.yuck")
|
||||||
|
(include "powermenu/powermenu.yuck")
|
||||||
|
(include "playerinfo/playerinfo.yuck")
|
||||||
|
(include "closer/closer.yuck")
|
||||||
|
(include "quick-settings/quick-settings.yuck")
|
||||||
|
(include "traybuttons/traybuttons.yuck")
|
90
config/eww/playerinfo/playerinfo.scss
Normal file
90
config/eww/playerinfo/playerinfo.scss
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
.playerinfo {
|
||||||
|
padding: 10px;
|
||||||
|
min-width: 400px;
|
||||||
|
border-radius: 30px;
|
||||||
|
border-top: 2px solid $contrastbg;
|
||||||
|
border-bottom: 2px solid $contrastbg;
|
||||||
|
transition: background 250ms;
|
||||||
|
.top {
|
||||||
|
font-size: 23px;
|
||||||
|
}
|
||||||
|
.metadata {
|
||||||
|
.title{
|
||||||
|
font-weight: 500;
|
||||||
|
transition: text 250ms;
|
||||||
|
}
|
||||||
|
.artist{
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 15px;
|
||||||
|
transition: text 250ms;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.bottom {
|
||||||
|
font-size: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pausebutton {
|
||||||
|
transition: background 250ms;
|
||||||
|
padding: 14px 16px;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.playing {
|
||||||
|
transition: all ease .2s;
|
||||||
|
border-radius: 15px;
|
||||||
|
label {
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.paused {
|
||||||
|
border-radius: 26px;
|
||||||
|
transition: all ease .2s;
|
||||||
|
padding: 14px 14px 14px 18px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.previousbutton,
|
||||||
|
.nextbutton,
|
||||||
|
.shuffle,
|
||||||
|
.repeat {
|
||||||
|
border-radius: 100%;
|
||||||
|
transition: background-color 200ms;
|
||||||
|
&:hover {
|
||||||
|
border-radius: 100%;
|
||||||
|
background-color: rgba(127, 132, 156, 0.4);
|
||||||
|
transition: background-color 200ms;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.repeat {
|
||||||
|
label {
|
||||||
|
padding-right: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.song-pos {
|
||||||
|
scale {
|
||||||
|
highlight {
|
||||||
|
margin: 0px;
|
||||||
|
border-radius: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
trough {
|
||||||
|
background-color: #363847;
|
||||||
|
border-radius: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
slider {
|
||||||
|
margin: -8px;
|
||||||
|
min-height: 20px;
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow: rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px;
|
||||||
|
transition: background-color 0.5s ease-in-out;
|
||||||
|
}
|
||||||
|
slider:hover {
|
||||||
|
background-color: #303240;
|
||||||
|
transition: background-color 0.5s ease-in-out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
124
config/eww/playerinfo/playerinfo.yuck
Normal file
124
config/eww/playerinfo/playerinfo.yuck
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
(defpoll player :interval "1s" "echo Spot")
|
||||||
|
(defpoll music_cover :interval "1s" "$EWW_PATH/music.sh cover") ;done
|
||||||
|
(defvar music_accent "rgb(0,0,0)") ;done
|
||||||
|
(defvar button_accent "rgb(0,0,0)") ;done
|
||||||
|
(defvar button_text "rgb(255,255,255)") ;done
|
||||||
|
(defpoll music_status :interval "1s" "playerctl -p Spot status")
|
||||||
|
(defpoll title :interval "1s" "playerctl -p Spot metadata title")
|
||||||
|
(defpoll artist :interval "1s" "playerctl -p Spot metadata artist")
|
||||||
|
(defvar button_height "42")
|
||||||
|
(defpoll shuffle_status :interval "1s" "playerctl -p Spot shuffle")
|
||||||
|
(defpoll repeat_icon :interval "1s" "$EWW_PATH/music.sh loop_status")
|
||||||
|
(defvar song_pos "0")
|
||||||
|
(defpoll song_length :interval "1s" "$EWW_PATH/music.sh length")
|
||||||
|
(defvar get_pos "true")
|
||||||
|
|
||||||
|
(defwidget playerinfo []
|
||||||
|
(centerbox :class "playerinfo"
|
||||||
|
:style "background: radial-gradient(circle, rgba(0, 0, 0, 0.4) 30%, ${music_accent}), url(\"${music_cover}\");
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;"
|
||||||
|
:orientation "v"
|
||||||
|
(box :class "top"
|
||||||
|
:halign "start"
|
||||||
|
:valign "start"
|
||||||
|
:style "color: ${button_accent};"
|
||||||
|
"${player == 'Spot' ? '' : '爵' }"
|
||||||
|
)
|
||||||
|
(box :class "center"
|
||||||
|
:orientation "h"
|
||||||
|
:space-evenly false
|
||||||
|
(box :class "metadata"
|
||||||
|
:orientation "v"
|
||||||
|
:halign "start"
|
||||||
|
:valign "center"
|
||||||
|
:hexpand true
|
||||||
|
(label :limit-width 25 :halign "start" :text title :class "title")
|
||||||
|
(label :limit-width 25 :halign "start" :text artist :class "artist")
|
||||||
|
)
|
||||||
|
(centerbox :orientation "v"
|
||||||
|
(label)
|
||||||
|
(eventbox :class "pausebutton ${music_status == 'Playing' ? 'playing' : 'paused'}"
|
||||||
|
:halign "left"
|
||||||
|
:style "background-color: ${button_accent};
|
||||||
|
color: ${button_text};"
|
||||||
|
:onclick "playerctl -p Spot play-pause"
|
||||||
|
:cursor "pointer"
|
||||||
|
:onhover "eww update button_height=41"
|
||||||
|
:onhoverlost "eww update button_height=42"
|
||||||
|
|
||||||
|
(label :text "${music_status == 'Playing' ? ' ' : ''}"
|
||||||
|
:width button_height
|
||||||
|
:height button_height
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(label)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(box :class "bottom"
|
||||||
|
:style "color: ${button_accent};"
|
||||||
|
:space-evenly false
|
||||||
|
:spacing 0
|
||||||
|
(eventbox :valign "end"
|
||||||
|
:halign "start"
|
||||||
|
:onclick "playerctl -p Spot previous & $EWW_PATH/music.sh cover"
|
||||||
|
:class "previousbutton"
|
||||||
|
:width 40
|
||||||
|
:cursor "pointer"
|
||||||
|
""
|
||||||
|
)
|
||||||
|
(eventbox :cursor "pointer"
|
||||||
|
:class "song-pos"
|
||||||
|
:hexpand true
|
||||||
|
:onhover "eww update get_pos=false"
|
||||||
|
:onhoverlost "eww update get_pos=true"
|
||||||
|
(scale :value song_pos
|
||||||
|
:min 0
|
||||||
|
:max song_length
|
||||||
|
:orientation "h"
|
||||||
|
:onchange "playerctl -p Spot position {}"
|
||||||
|
:css "highlight { background-color: ${button_accent}; }
|
||||||
|
slider { background-color: ${button_accent}; }
|
||||||
|
trough { background-color: rgba(${button_accent}, 0.4); }"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(box :valign "end"
|
||||||
|
:halign "end"
|
||||||
|
|
||||||
|
(eventbox :onclick "playerctl -p Spot next & $EWW_PATH/music.sh cover"
|
||||||
|
:class "nextbutton"
|
||||||
|
:width 40
|
||||||
|
:cursor "pointer"
|
||||||
|
""
|
||||||
|
)
|
||||||
|
(eventbox :onclick "playerctl -p Spot shuffle toggle"
|
||||||
|
:class "shuffle"
|
||||||
|
:width 40
|
||||||
|
:cursor "pointer"
|
||||||
|
"${shuffle_status == 'On' ? '' : ''}"
|
||||||
|
)
|
||||||
|
(eventbox :onclick "$EWW_PATH/music.sh loop"
|
||||||
|
:class "repeat"
|
||||||
|
:width 40
|
||||||
|
:cursor "pointer"
|
||||||
|
"${repeat_icon}"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(defwindow playerinfo
|
||||||
|
:monitor 0
|
||||||
|
:stacking "overlay"
|
||||||
|
:exclusive "ignore"
|
||||||
|
:focusable "false"
|
||||||
|
:geometry (geometry :x "800px"
|
||||||
|
:y "10px"
|
||||||
|
:width "0px"
|
||||||
|
:height "0px"
|
||||||
|
:anchor "top left"
|
||||||
|
)
|
||||||
|
(playerinfo)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
28
config/eww/powermenu/powermenu.scss
Normal file
28
config/eww/powermenu/powermenu.scss
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
.powermenu {
|
||||||
|
background-color: $bg;
|
||||||
|
color: $fg;
|
||||||
|
padding: 20px;
|
||||||
|
font-family: MesloLGS NF;
|
||||||
|
/*font-family: Iosevka Nerd Font;*/
|
||||||
|
font-size: 70px;
|
||||||
|
border-radius: 30px;
|
||||||
|
border: 2px solid $contrastbg;
|
||||||
|
button {
|
||||||
|
border-radius: 12px;
|
||||||
|
min-width: 80px;
|
||||||
|
transition: all ease .2s;
|
||||||
|
&:hover { background-color: $bgSecondary; }
|
||||||
|
&:active { background-color: $bgSecondary; }
|
||||||
|
.content {
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 0px 15px 0px 15px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.shutdown { color: $red; }
|
||||||
|
.reboot { color: $magenta; }
|
||||||
|
.logout { color: $yellow; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.powermenu-clickhandler {
|
||||||
|
background-color: black;
|
||||||
|
}
|
55
config/eww/powermenu/powermenu.yuck
Normal file
55
config/eww/powermenu/powermenu.yuck
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
(defwidget powermenu []
|
||||||
|
(box :class "powermenu"
|
||||||
|
:orientation "h"
|
||||||
|
:space-evenly true
|
||||||
|
:spacing 20
|
||||||
|
(button :class "shutdown"
|
||||||
|
:onclick "systemctl poweroff"
|
||||||
|
(label :text "襤" :class "content")
|
||||||
|
)
|
||||||
|
(button :class "reboot"
|
||||||
|
:onclick "systemctl reboot"
|
||||||
|
(label :text "勒" :class "content")
|
||||||
|
)
|
||||||
|
(button :class "logout"
|
||||||
|
:onclick "hyprctl dispatch exit"
|
||||||
|
(label :text "" :class "content")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defwidget powermenu-clickhandler []
|
||||||
|
(button :class "powermenu-clickhandler"
|
||||||
|
:onclick "eww close powermenu powermenu-clickhandler"
|
||||||
|
""
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defwindow powermenu-clickhandler
|
||||||
|
:monitor 0
|
||||||
|
:geometry (geometry :x "0px"
|
||||||
|
:y "0px"
|
||||||
|
:width "100%"
|
||||||
|
:height "100%"
|
||||||
|
:anchor "center")
|
||||||
|
:wm-ignore true
|
||||||
|
(powermenu-clickhandler)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defvar powermenu-visible false)
|
||||||
|
|
||||||
|
(defwindow powermenu-reveal
|
||||||
|
:monitor 0
|
||||||
|
:stacking "overlay"
|
||||||
|
:geometry (geometry :x "0px"
|
||||||
|
:y "0px"
|
||||||
|
:width "500px"
|
||||||
|
:height "150px"
|
||||||
|
:anchor "center")
|
||||||
|
(revealer
|
||||||
|
:transition "crossfade"
|
||||||
|
:reveal powermenu-visible
|
||||||
|
:duration anim_duration
|
||||||
|
(powermenu)
|
||||||
|
)
|
||||||
|
)
|
190
config/eww/quick-settings/quick-settings.scss
Normal file
190
config/eww/quick-settings/quick-settings.scss
Normal file
|
@ -0,0 +1,190 @@
|
||||||
|
.quick-settings-smol {
|
||||||
|
font-size: 2px;
|
||||||
|
min-height: 52px;
|
||||||
|
min-width: 36px;
|
||||||
|
padding: 0px 0px 0px 0px;
|
||||||
|
background-color: $bg;
|
||||||
|
color: rgba(0,0,0,0);
|
||||||
|
border: 2px solid $contrastbg;
|
||||||
|
border-bottom: none;
|
||||||
|
border-top-right-radius: 80px;
|
||||||
|
border-top-left-radius: 80px;
|
||||||
|
border-bottom-left-radius: 0px;
|
||||||
|
border-bottom-right-radius: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-settings-logo {
|
||||||
|
font-size: 24px;
|
||||||
|
min-height: 36px;
|
||||||
|
min-width: 36px;
|
||||||
|
padding: 0px 0px 0px 0px;
|
||||||
|
background-color: rgba(0,0,0,0);
|
||||||
|
color: #CBA6F7;
|
||||||
|
border-radius: 80px;
|
||||||
|
border: 2px solid rgba(0,0,0,0);
|
||||||
|
transition: background-color 0.5s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-settings-logo:hover, .quick-settings-logo:active {
|
||||||
|
background-color: rgba(127, 132, 156, 0.4);
|
||||||
|
transition: background-color 0.5s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-settings {
|
||||||
|
font-size: 30px;
|
||||||
|
min-width: 500px;
|
||||||
|
padding: 0px 0px 0px 0px;
|
||||||
|
background-color: $bg;
|
||||||
|
border-top-right-radius: 0px;
|
||||||
|
border-top-left-radius: 30px;
|
||||||
|
border-bottom-left-radius: 30px;
|
||||||
|
border-bottom-right-radius: 30px;
|
||||||
|
border: 2px solid $contrastbg;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 22px;
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-label {
|
||||||
|
font-size: 30px;
|
||||||
|
margin-left: 15px;
|
||||||
|
margin-right: 10px;
|
||||||
|
min-width: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub-label {
|
||||||
|
font-size: 14px;
|
||||||
|
margin-top: -10px;
|
||||||
|
margin-left: 0px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding: 3px;
|
||||||
|
border: 2px solid $contrastbg;
|
||||||
|
border-top-right-radius: 20px;
|
||||||
|
border-top-left-radius: 10px;
|
||||||
|
border-bottom-left-radius: 10px;
|
||||||
|
border-bottom-right-radius: 20px;
|
||||||
|
min-width: 106px;
|
||||||
|
background: #1b1b1b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-chev {
|
||||||
|
margin-left: 0px;
|
||||||
|
|
||||||
|
font-size: 40px;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-grid {
|
||||||
|
font-size: 10px;
|
||||||
|
min-height: 160px;
|
||||||
|
min-width: 470px;
|
||||||
|
background-color: $bgfull;
|
||||||
|
border-top: 2px solid $contrastbg;
|
||||||
|
border-bottom: 2px solid $contrastbg;
|
||||||
|
border-radius: 15px;
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-row {
|
||||||
|
min-height: 70px;
|
||||||
|
min-width: 450px;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-button {
|
||||||
|
min-height: 65px;
|
||||||
|
min-width: 70px;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-part {
|
||||||
|
background: #1b1b1b;
|
||||||
|
border-top-left-radius: 15px;
|
||||||
|
border-bottom-left-radius: 15px;
|
||||||
|
border-left: 2px solid $contrastbg;
|
||||||
|
border-top: 2px solid $contrastbg;
|
||||||
|
border-bottom: 2px solid $contrastbg;
|
||||||
|
transition: all 0.5s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-part {
|
||||||
|
background: #1b1b1b;
|
||||||
|
border-top-right-radius: 30px;
|
||||||
|
border-bottom-right-radius: 30px;
|
||||||
|
border-right: 2px solid $contrastbg;
|
||||||
|
border-top: 2px solid $contrastbg;
|
||||||
|
border-bottom: 2px solid $contrastbg;
|
||||||
|
transition: all 0.5s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-part:hover, .right-part:active {
|
||||||
|
color: $contrastbg;
|
||||||
|
border: 2px solid $contrastbg;
|
||||||
|
border-top-left-radius: 7px;
|
||||||
|
border-bottom-left-radius: 7px;
|
||||||
|
transition: all 0.5s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-part:hover, .left-part:active {
|
||||||
|
color: $contrastbg;
|
||||||
|
border: 2px solid $contrastbg;
|
||||||
|
border-top-right-radius: 7px;
|
||||||
|
border-bottom-right-radius: 7px;
|
||||||
|
transition: all 0.5s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.player {
|
||||||
|
margin-top: 6px;
|
||||||
|
min-height: 220px;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider-box {
|
||||||
|
min-height: 100px;
|
||||||
|
min-width: 470px;
|
||||||
|
background-color: $bgfull;
|
||||||
|
border-top: 2px solid $contrastbg;
|
||||||
|
border-bottom: 2px solid $contrastbg;
|
||||||
|
border-radius: 15px;
|
||||||
|
margin-top: 30px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
|
||||||
|
.slider-label {
|
||||||
|
font-size: 30px;
|
||||||
|
min-width: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
scale {
|
||||||
|
min-height: 55px;
|
||||||
|
min-width: 400px;
|
||||||
|
margin-left: 18px;
|
||||||
|
margin-right: 20px;
|
||||||
|
|
||||||
|
highlight {
|
||||||
|
margin: 0px;
|
||||||
|
background-color: #79659f;
|
||||||
|
border-radius: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
trough {
|
||||||
|
background-color: #363847;
|
||||||
|
border-radius: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
slider {
|
||||||
|
margin: -4px;
|
||||||
|
min-width: 20px;
|
||||||
|
min-height: 20px;
|
||||||
|
background: #3e4153;
|
||||||
|
border-radius: 100%;
|
||||||
|
box-shadow: rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px;
|
||||||
|
transition: background-color 0.5s ease-in-out;
|
||||||
|
}
|
||||||
|
slider:hover {
|
||||||
|
background-color: #303240;
|
||||||
|
transition: background-color 0.5s ease-in-out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
360
config/eww/quick-settings/quick-settings.yuck
Normal file
360
config/eww/quick-settings/quick-settings.yuck
Normal file
|
@ -0,0 +1,360 @@
|
||||||
|
(defvar showqs false)
|
||||||
|
(defvar showplayer false)
|
||||||
|
|
||||||
|
(defwidget quick-settings-smol []
|
||||||
|
(box :class "quick-settings-smol"
|
||||||
|
:orientation "h"
|
||||||
|
(label :text " ")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(defwindow quick-settings-smol-reveal
|
||||||
|
:monitor 0
|
||||||
|
:stacking "overlay"
|
||||||
|
:exclusive "ignore"
|
||||||
|
:geometry (geometry :x "5px"
|
||||||
|
:y "10px"
|
||||||
|
:width "0px"
|
||||||
|
:height "0px"
|
||||||
|
:anchor "top right"
|
||||||
|
)
|
||||||
|
(revealer
|
||||||
|
:transition "crossfade"
|
||||||
|
:reveal showqs
|
||||||
|
:duration anim_duration
|
||||||
|
(quick-settings-smol)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defvar qs-run-off "false")
|
||||||
|
(defwidget quick-settings-logo []
|
||||||
|
(eventbox :class "quick-settings-logo"
|
||||||
|
:onclick "$EWW_PATH/run.sh '$EWW_PATH/qs-toggle.sh off' qs-run-off &"
|
||||||
|
:cursor "pointer"
|
||||||
|
:onhover "eww update qs-run-off=true"
|
||||||
|
:onhoverlost "eww update qs-run-off=false"
|
||||||
|
|
||||||
|
(box :class "quick-settings-logo"
|
||||||
|
:orientation "h"
|
||||||
|
(label :text " ")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(defwindow quick-settings-logo-reveal
|
||||||
|
:monitor 0
|
||||||
|
:stacking "overlay"
|
||||||
|
:exclusive "ignore"
|
||||||
|
:geometry (geometry :x "5px"
|
||||||
|
:y "10px"
|
||||||
|
:width "0px"
|
||||||
|
:height "0px"
|
||||||
|
:anchor "top right"
|
||||||
|
)
|
||||||
|
(revealer
|
||||||
|
:transition "crossfade"
|
||||||
|
:reveal showqs
|
||||||
|
:duration anim_duration
|
||||||
|
(quick-settings-logo)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(defvar expand_player "false")
|
||||||
|
(defwidget quick-settings []
|
||||||
|
(box :orientation "v"
|
||||||
|
:space-evenly false
|
||||||
|
(box :class "quick-settings"
|
||||||
|
:orientation "v"
|
||||||
|
:space-evenly false
|
||||||
|
(label :text "Control Center"
|
||||||
|
:class "title"
|
||||||
|
:xalign 0.04
|
||||||
|
)
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; Button Grid
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(box :class "button-grid"
|
||||||
|
:orientation "v"
|
||||||
|
:valign "start"
|
||||||
|
:width 0
|
||||||
|
:height 0
|
||||||
|
:halign "center"
|
||||||
|
:space-evenly false
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; Row ONE
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(box :class "button-row"
|
||||||
|
:orientation "h"
|
||||||
|
:space-evenly true
|
||||||
|
:width 0
|
||||||
|
:height 0
|
||||||
|
:halign "center"
|
||||||
|
:style "margin-top: 15px;
|
||||||
|
margin-bottom: 7px"
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(box :class "grid-button"
|
||||||
|
:orientation "h"
|
||||||
|
:space-evenly false
|
||||||
|
:width 0
|
||||||
|
:height 0
|
||||||
|
|
||||||
|
(eventbox :class "left-part"
|
||||||
|
:cursor "pointer"
|
||||||
|
:onclick "$EWW_PATH/network.sh toggle"
|
||||||
|
(label :text " ${network_icon} "
|
||||||
|
:class "grid-label"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(eventbox :class "right-part"
|
||||||
|
:cursor "pointer"
|
||||||
|
:onclick "nm-connection-editor &"
|
||||||
|
|
||||||
|
(label :text " " :class "grid-chev")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(box :class "grid-button"
|
||||||
|
:orientation "h"
|
||||||
|
:space-evenly false
|
||||||
|
:width 0
|
||||||
|
:height 0
|
||||||
|
|
||||||
|
(eventbox :class "left-part"
|
||||||
|
:cursor "pointer"
|
||||||
|
:onclick "$EWW_PATH/bluetooth.sh toggle"
|
||||||
|
|
||||||
|
(label :text " ${bluetooth_icon} "
|
||||||
|
:class "grid-label"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(eventbox :class "right-part"
|
||||||
|
:cursor "pointer"
|
||||||
|
:onclick "blueberry &"
|
||||||
|
|
||||||
|
(label :text " " :class "grid-chev")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(box :class "grid-button"
|
||||||
|
:orientation "h"
|
||||||
|
:space-evenly false
|
||||||
|
:width 0
|
||||||
|
:height 0
|
||||||
|
|
||||||
|
(eventbox :class "left-part"
|
||||||
|
:cursor "pointer"
|
||||||
|
:onclick "$EWW_PATH/network.sh toggle-radio"
|
||||||
|
|
||||||
|
(label :text "${network_radio == 'on' ? ' ' : ' '}"
|
||||||
|
:class "grid-label"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(eventbox :class "right-part"
|
||||||
|
:cursor "pointer"
|
||||||
|
:onclick "notify-send 'set this up moron'"
|
||||||
|
|
||||||
|
(label :text " "
|
||||||
|
:class "grid-chev"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; SUB ROW
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(box :orientation "h"
|
||||||
|
:space-evenly true
|
||||||
|
:spacing 34
|
||||||
|
:width 0
|
||||||
|
:height 0
|
||||||
|
:halign "center"
|
||||||
|
|
||||||
|
|
||||||
|
(label :text "${network_ssid}"
|
||||||
|
:class "sub-label"
|
||||||
|
:width 0
|
||||||
|
:height 0
|
||||||
|
:xalign 0.4
|
||||||
|
:limit-width 12
|
||||||
|
)
|
||||||
|
|
||||||
|
(label :text "${bluetooth_dev}"
|
||||||
|
:class "sub-label"
|
||||||
|
:width 0
|
||||||
|
:height 0
|
||||||
|
:xalign 0.4
|
||||||
|
:limit-width 12
|
||||||
|
)
|
||||||
|
|
||||||
|
(label :text ""
|
||||||
|
:class ""
|
||||||
|
:width 0
|
||||||
|
:height 0
|
||||||
|
:xalign 0.4
|
||||||
|
:limit-width 12
|
||||||
|
)
|
||||||
|
)
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; Row TWO
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(box :class "button-row"
|
||||||
|
:orientation "h"
|
||||||
|
:space-evenly true
|
||||||
|
:width 0
|
||||||
|
:height 0
|
||||||
|
:halign "center"
|
||||||
|
:style "margin-top: 7px;
|
||||||
|
margin-bottom: 15px;"
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(box :class "grid-button"
|
||||||
|
:orientation "h"
|
||||||
|
:space-evenly false
|
||||||
|
:width 0
|
||||||
|
:height 0
|
||||||
|
|
||||||
|
(eventbox :class "left-part"
|
||||||
|
:cursor "pointer"
|
||||||
|
:onclick "swayosd --output-volume mute-toggle"
|
||||||
|
|
||||||
|
(label :text " ${volume_icon} "
|
||||||
|
:class "grid-label"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(eventbox :class "right-part"
|
||||||
|
:cursor "pointer"
|
||||||
|
:onclick "pavucontrol &"
|
||||||
|
|
||||||
|
(label :text " " :class "grid-chev")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(box :class "grid-button"
|
||||||
|
:orientation "h"
|
||||||
|
:space-evenly false
|
||||||
|
:width 0
|
||||||
|
:height 0
|
||||||
|
|
||||||
|
(eventbox :class "left-part"
|
||||||
|
:cursor "pointer"
|
||||||
|
:onclick "$EWW_PATH/mic.sh toggle-muted"
|
||||||
|
|
||||||
|
(label :text " ${mic_icon} "
|
||||||
|
:class "grid-label"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(eventbox :class "right-part"
|
||||||
|
:cursor "pointer"
|
||||||
|
:onclick "pavucontrol &"
|
||||||
|
|
||||||
|
(label :text " " :class "grid-chev")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(box :class "grid-button"
|
||||||
|
:orientation "h"
|
||||||
|
:space-evenly false
|
||||||
|
:width 0
|
||||||
|
:height 0
|
||||||
|
|
||||||
|
(eventbox :class "left-part"
|
||||||
|
:cursor "pointer"
|
||||||
|
:onclick "$LOCK_PATH/lock.sh &"
|
||||||
|
|
||||||
|
(label :text " "
|
||||||
|
:class "grid-label"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(eventbox :class "right-part"
|
||||||
|
:cursor "pointer"
|
||||||
|
:onclick "$EWW_PATH/open.sh powermenu"
|
||||||
|
|
||||||
|
(label :text " " :class "grid-chev")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(box :class "slider-box"
|
||||||
|
:orientation "v"
|
||||||
|
:space-evenly true
|
||||||
|
:spacing 0
|
||||||
|
:width 0
|
||||||
|
:height 0
|
||||||
|
:halign "center"
|
||||||
|
|
||||||
|
(box :class "slider"
|
||||||
|
:orientation "h"
|
||||||
|
:valign "start"
|
||||||
|
:halign "center"
|
||||||
|
:width 0
|
||||||
|
:height 0
|
||||||
|
:space-evenly false
|
||||||
|
|
||||||
|
(label :text "${volume_icon}" :class "slider-label")
|
||||||
|
|
||||||
|
(scale :value volume_value
|
||||||
|
:onchange "$EWW_PATH/volume.sh set {}"
|
||||||
|
:min 0
|
||||||
|
:max 101
|
||||||
|
:height 0
|
||||||
|
:width 0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(box :class "slider"
|
||||||
|
:orientation "h"
|
||||||
|
:valign "start"
|
||||||
|
:halign "center"
|
||||||
|
:width 0
|
||||||
|
:height 0
|
||||||
|
:space-evenly false
|
||||||
|
|
||||||
|
(label :text " ${br_icon} " :class "slider-label" :style "margin-left: 6px;
|
||||||
|
margin-right: -6px")
|
||||||
|
|
||||||
|
(scale :value br
|
||||||
|
:onchange "$EWW_PATH/brightness.sh set {}"
|
||||||
|
:min 0
|
||||||
|
:max 256
|
||||||
|
:height 0
|
||||||
|
:width 0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(centerbox :orientation "h"
|
||||||
|
:style "margin-bottom: 10px;"
|
||||||
|
(label)
|
||||||
|
|
||||||
|
(revealer :reveal showplayer
|
||||||
|
(eventbox :cursor "pointer"
|
||||||
|
:onclick "${expand_player == 'true' ? 'eww update expand_player=false' : 'eww update expand_player=true'}"
|
||||||
|
"${expand_player == 'true' ? ' ' : ' ' }"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(label)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(revealer :reveal expand_player
|
||||||
|
:transition "slidedown"
|
||||||
|
(box :class "player"
|
||||||
|
:style "${expand_player == 'true' ? 'opacity: 1; transition: opacity ${anim_duration}' :
|
||||||
|
'opacity: 0; transition: opacity ${anim_duration}'}"
|
||||||
|
(playerinfo)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(defwindow quick-settings-reveal
|
||||||
|
:monitor 0
|
||||||
|
:stacking "overlay"
|
||||||
|
:geometry (geometry :x "5px"
|
||||||
|
:y "7px"
|
||||||
|
:width "0px"
|
||||||
|
:height "0px"
|
||||||
|
:anchor "top right"
|
||||||
|
)
|
||||||
|
(revealer
|
||||||
|
:transition "crossfade"
|
||||||
|
:reveal showqs
|
||||||
|
:duration anim_duration
|
||||||
|
(quick-settings)
|
||||||
|
)
|
||||||
|
)
|
35
config/eww/scripts/bluetooth.sh
Executable file
35
config/eww/scripts/bluetooth.sh
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
FILE="$HOME/.config/.bluetooth"
|
||||||
|
|
||||||
|
get_device() {
|
||||||
|
if [[ $(bluetoothctl devices Connected) != "" ]]; then
|
||||||
|
bluetoothctl devices Connected | awk '{ for (i = 3; i <= NF; i++) { printf("%s ", $i) } printf("\n") }'
|
||||||
|
else
|
||||||
|
echo "Disconnected"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_state() {
|
||||||
|
if [[ "$(rfkill list | grep -A 1 hci0 | grep -o no)" == "no" ]]; then
|
||||||
|
eww update bluetooth_icon=" "
|
||||||
|
echo " " > "$FILE"
|
||||||
|
else
|
||||||
|
eww update bluetooth_icon=" "
|
||||||
|
echo " " > "$FILE"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
[[ "$1" == "device" ]] && get_device
|
||||||
|
if [[ "$1" == "toggle" ]]; then
|
||||||
|
rfkill toggle bluetooth
|
||||||
|
get_state
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $1 == "icon" ]]; then
|
||||||
|
while true; do
|
||||||
|
get_state
|
||||||
|
tail "$FILE"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
fi
|
46
config/eww/scripts/brightness.sh
Executable file
46
config/eww/scripts/brightness.sh
Executable file
|
@ -0,0 +1,46 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
get_icon () {
|
||||||
|
val=$(brightnessctl get)
|
||||||
|
|
||||||
|
if [ "$val" -le 3 ]; then
|
||||||
|
eww update br_icon=" "
|
||||||
|
|
||||||
|
elif [ "$val" -le 38 ]; then
|
||||||
|
eww update br_icon=" "
|
||||||
|
|
||||||
|
elif [ "$val" -le 77 ]; then
|
||||||
|
eww update br_icon=" "
|
||||||
|
|
||||||
|
elif [ "$val" -le 115 ]; then
|
||||||
|
eww update br_icon=" "
|
||||||
|
|
||||||
|
elif [ "$val" -le 153 ]; then
|
||||||
|
eww update br_icon=" "
|
||||||
|
|
||||||
|
elif [ "$val" -le 191 ]; then
|
||||||
|
eww update br_icon=" "
|
||||||
|
|
||||||
|
elif [ "$val" -le 230 ]; then
|
||||||
|
eww update br_icon=" "
|
||||||
|
|
||||||
|
else
|
||||||
|
eww update br_icon=" "
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $1 == "br" ]]; then
|
||||||
|
brightnessctl get
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $1 == "icon" ]]; then
|
||||||
|
while true; do
|
||||||
|
get_icon
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $1 == "set" ]]; then
|
||||||
|
brightnessctl set "$2"
|
||||||
|
get_icon
|
||||||
|
fi
|
20
config/eww/scripts/close-opened.sh
Executable file
20
config/eww/scripts/close-opened.sh
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Store the output of the command in an array, keeping only lines with '*'
|
||||||
|
readarray -t array <<< "$(eww windows | grep '^\*')"
|
||||||
|
|
||||||
|
# Remove the '*' from each element
|
||||||
|
for ((i=0; i<${#array[@]}; i++))
|
||||||
|
do
|
||||||
|
array[i]=${array[i]#'*'}
|
||||||
|
done
|
||||||
|
|
||||||
|
# Close every window except permanent ones
|
||||||
|
for element in "${array[@]}"
|
||||||
|
do
|
||||||
|
[[ "$element" != "left-bar" ]] &&
|
||||||
|
[[ "$element" != "notif-panel" ]] &&
|
||||||
|
[[ "$element" != "quick-settings-toggle" ]] &&
|
||||||
|
[[ "$element" != "playerinfo" ]] &&
|
||||||
|
eww close "$element"
|
||||||
|
done
|
46
config/eww/scripts/heart.sh
Executable file
46
config/eww/scripts/heart.sh
Executable file
|
@ -0,0 +1,46 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
FILE="$HOME/.config/.heart"
|
||||||
|
|
||||||
|
toggle() {
|
||||||
|
if grep -q "$FILE"; then
|
||||||
|
eww update heart-ts=false
|
||||||
|
echo > "$FILE"
|
||||||
|
else
|
||||||
|
eww update heart-ts=true
|
||||||
|
echo >> "$FILE"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
[[ "$1" == "toggle" ]] && toggle
|
||||||
|
|
||||||
|
|
||||||
|
startup() {
|
||||||
|
(
|
||||||
|
if [[ ! -f "$FILE" ]]; then
|
||||||
|
echo > "$FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f "$HOME/.config/.bluetooth" ]]; then
|
||||||
|
echo > "$FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -q "$HOME/.config/.bluetooth"; then
|
||||||
|
rfkill block bluetooth
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$HYPR_PATH"/osk-toggle.sh getState &
|
||||||
|
"$EWW_PATH"/on-release.sh &
|
||||||
|
"$EWW_PATH"/music.sh accents &
|
||||||
|
input-emulator start mouse -n &
|
||||||
|
|
||||||
|
if grep -q "$FILE"; then
|
||||||
|
sleep 0.9 &&
|
||||||
|
eww update heart-ts=true
|
||||||
|
fi
|
||||||
|
) &
|
||||||
|
|
||||||
|
tail -f "$FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
[[ "$1" == "startup" ]] && startup
|
30
config/eww/scripts/mic.sh
Executable file
30
config/eww/scripts/mic.sh
Executable file
|
@ -0,0 +1,30 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
SOURCE="@DEFAULT_SOURCE@"
|
||||||
|
|
||||||
|
is_muted () {
|
||||||
|
pactl get-source-mute $SOURCE | awk '{print $2}'
|
||||||
|
}
|
||||||
|
|
||||||
|
get_icon () {
|
||||||
|
if [[ $(is_muted) == "yes" ]]; then
|
||||||
|
echo " "
|
||||||
|
else
|
||||||
|
echo " "
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $1 == "icon" ]]; then
|
||||||
|
while true; do
|
||||||
|
sleep 0.01
|
||||||
|
get_icon
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $1 == "muted" ]]; then
|
||||||
|
is_muted
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $1 == "toggle-muted" ]]; then
|
||||||
|
swayosd --input-volume mute-toggle
|
||||||
|
fi
|
87
config/eww/scripts/music.sh
Executable file
87
config/eww/scripts/music.sh
Executable file
|
@ -0,0 +1,87 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
loop() {
|
||||||
|
loop_status=$(playerctl -p Spot loop)
|
||||||
|
|
||||||
|
case $loop_status in
|
||||||
|
"None" )
|
||||||
|
playerctl -p Spot loop Playlist
|
||||||
|
eww update repeat_icon=""
|
||||||
|
;;
|
||||||
|
"Track" )
|
||||||
|
playerctl -p Spot loop None
|
||||||
|
eww update repeat_icon=""
|
||||||
|
;;
|
||||||
|
"Playlist" )
|
||||||
|
playerctl -p Spot loop Track
|
||||||
|
eww update repeat_icon=""
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
echo "Unknown loop status."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
loop_status() {
|
||||||
|
loop_status=$(playerctl -p Spot loop)
|
||||||
|
|
||||||
|
case $loop_status in
|
||||||
|
"None" )
|
||||||
|
eww update repeat_icon=""
|
||||||
|
;;
|
||||||
|
"Track" )
|
||||||
|
eww update repeat_icon=""
|
||||||
|
;;
|
||||||
|
"Playlist" )
|
||||||
|
eww update repeat_icon=""
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
echo "Unknown loop status."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
get_length() {
|
||||||
|
if [[ $(eww get get_pos) == "true" ]]; then
|
||||||
|
eww update song_pos="$(playerctl -p Spot position)"
|
||||||
|
fi
|
||||||
|
eww update song_length="$(echo "$(playerctl -p Spot metadata mpris:length)/1000000" | bc -l)"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_accents() {
|
||||||
|
accents="$(coloryou /tmp/cover.jpg | sed 's/,//g' | sed 's/}//' | sed 's/'\''//g')"
|
||||||
|
music_accent=$(echo "$accents" | awk '{ print $2 }')
|
||||||
|
eww update music_accent="$music_accent"
|
||||||
|
|
||||||
|
button_accent=$(echo "$accents" | awk '{ print $4 }')
|
||||||
|
eww update button_accent="$button_accent"
|
||||||
|
|
||||||
|
button_text=$(echo "$accents" | awk '{ print $6 }')
|
||||||
|
eww update button_text="$button_text"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_cover() {
|
||||||
|
existing_file="/tmp/cover.jpg"
|
||||||
|
new_image_url=$(playerctl -p Spot metadata mpris:artUrl)
|
||||||
|
existing_hash=$(md5sum "$existing_file" | awk '{print $1}')
|
||||||
|
|
||||||
|
# Download the new image only if the hashes are different
|
||||||
|
if [[ "$(wget -qO- "$new_image_url" | md5sum | awk '{print $1}')" != "$existing_hash" ]]; then
|
||||||
|
wget -qO "$existing_file" "$new_image_url"
|
||||||
|
get_accents
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -s "/tmp/cover.jpg" ]]; then
|
||||||
|
eww update showplayer=true
|
||||||
|
echo "/tmp/cover.jpg"
|
||||||
|
else
|
||||||
|
eww update showplayer=false
|
||||||
|
echo "randomfile"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
[[ "$1" == "accents" ]] && get_accents
|
||||||
|
[[ "$1" == "loop" ]] && loop
|
||||||
|
[[ "$1" == "loop_status" ]] && loop_status
|
||||||
|
[[ "$1" == "length" ]] && get_length
|
||||||
|
[[ "$1" == "cover" ]] && get_cover
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue