feat(ags): prepare env for agsV2
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-09-23 23:52:17 -04:00
parent bc4470feb2
commit aa9723303b
15 changed files with 2422 additions and 11 deletions

View file

@ -39,6 +39,28 @@
"type": "github"
}
},
"agsV2": {
"inputs": {
"astal": "astal",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1727026789,
"narHash": "sha256-5w8qABRVW88/IeczPdMS5G7amtwqm7p70Ws8qrWvSNE=",
"owner": "Aylur",
"repo": "ags",
"rev": "9c1b7ba011fed34e533820e1e39d3b70547da2a1",
"type": "github"
},
"original": {
"owner": "Aylur",
"ref": "v2",
"repo": "ags",
"type": "github"
}
},
"aquamarine": {
"inputs": {
"hyprutils": [
@ -73,6 +95,24 @@
}
},
"astal": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1726616653,
"narHash": "sha256-1rxooSZUo75+1Ps0K4Aut6bx9QuHlfNnG2qUXFOBcqg=",
"owner": "aylur",
"repo": "astal",
"rev": "c37823ae42b38bed8aca06f78f3a4cb44eb41d5c",
"type": "github"
},
"original": {
"owner": "aylur",
"repo": "astal",
"type": "github"
}
},
"astal_2": {
"inputs": {
"nixpkgs": [
"nixpkgs"
@ -1073,7 +1113,7 @@
"inputs": {
"flake-parts": "flake-parts_4",
"nix-github-actions": "nix-github-actions_2",
"nixpkgs": "nixpkgs_2",
"nixpkgs": "nixpkgs_3",
"treefmt-nix": "treefmt-nix_3"
},
"locked": {
@ -1276,15 +1316,15 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1726755586,
"narHash": "sha256-PmUr/2GQGvFTIJ6/Tvsins7Q43KTMvMFhvG6oaYK+Wk=",
"owner": "NixOS",
"lastModified": 1716293225,
"narHash": "sha256-pU9ViBVE3XYb70xZx+jK6SEVphvt7xMTbm6yDIF4xPs=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c04d5652cfa9742b1d519688f65d1bbccea9eb7e",
"rev": "3eaeaeb6b1e08a016380c279f8846e0bd8808916",
"type": "github"
},
"original": {
"owner": "NixOS",
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
@ -1421,6 +1461,22 @@
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1726755586,
"narHash": "sha256-PmUr/2GQGvFTIJ6/Tvsins7Q43KTMvMFhvG6oaYK+Wk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c04d5652cfa9742b1d519688f65d1bbccea9eb7e",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1723221148,
"narHash": "sha256-7pjpeQlZUNQ4eeVntytU3jkw9dFK3k1Htgk2iuXjaD8=",
@ -1614,7 +1670,8 @@
"root": {
"inputs": {
"ags": "ags",
"astal": "astal",
"agsV2": "agsV2",
"astal": "astal_2",
"bat-theme-src": "bat-theme-src",
"bazarr-bulk": "bazarr-bulk",
"caddy-plugins": "caddy-plugins",
@ -1653,7 +1710,7 @@
"nix-index-db": "nix-index-db",
"nix-on-droid": "nix-on-droid",
"nixd": "nixd",
"nixpkgs": "nixpkgs",
"nixpkgs": "nixpkgs_2",
"nixpkgs-wayland": "nixpkgs-wayland",
"nvim-theme-src": "nvim-theme-src",
"pam-fprint-grosshack-src": "pam-fprint-grosshack-src",

View file

@ -10,6 +10,13 @@
repo = "ags";
type = "github";
};
agsV2 = {
inputs.nixpkgs.follows = "nixpkgs";
owner = "Aylur";
ref = "v2";
repo = "ags";
type = "github";
};
astal = {
inputs.nixpkgs.follows = "nixpkgs";
owner = "Aylur";

View file

@ -1,6 +1,6 @@
let
inherit (import ./lib {}) lib mkDep mkInput mkHyprDep mkSrc;
inherit (lib) listToAttrs map removeAttrs;
inherit (import ./lib {}) mkDep mkInput mkHyprDep mkSrc;
inherit (builtins) listToAttrs map removeAttrs;
# Inputs
nixTools = {
@ -150,6 +150,12 @@ let
repo = "ags";
};
agsV2 = mkDep {
owner = "Aylur";
repo = "ags";
ref = "v2";
};
astal = mkDep {
owner = "Aylur";
repo = "astal";

View file

@ -1,5 +1,6 @@
lib: lock: let
inherit (lib) attrValues findFirst foldl' hasAttr matchAttrs optionalAttrs recursiveUpdate removeAttrs;
inherit (lib) attrValues findFirst foldl' hasAttr matchAttrs optionalAttrs recursiveUpdate;
inherit (builtins) removeAttrs;
recursiveUpdateList = list: foldl' recursiveUpdate {} list;
in rec {

View file

@ -58,6 +58,8 @@ in {
}
];
imports = [(import ./v2 self)];
programs.ags = {
enable = true;
extraPackages = [

View file

@ -0,0 +1 @@
use flake "$FLAKE#node"

3
nixosModules/ags/v2/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
@girs/
node_modules/
tsconfig.json

View file

@ -0,0 +1,10 @@
import { App } from 'astal';
import style from 'inline:./style.scss';
import Bar from './widget/Bar';
App.start({
css: style,
main() {
Bar(0);
},
});

View file

@ -0,0 +1,45 @@
self: {pkgs, ...}: {
config = let
inherit (self.inputs) agsV2;
agsV2Packages = agsV2.packages.${pkgs.system};
configDir = "/home/matt/.nix/nixosModules/ags/v2";
in {
home = {
packages = [
(pkgs.writeShellApplication {
name = "agsV2";
runtimeInputs = [];
text = ''
exec ${agsV2Packages.agsFull}/bin/ags --config ${configDir} "$@"
'';
})
];
file = {
"${configDir}/tsconfig.json".source = pkgs.writers.writeJSON "tsconfig.json" {
"$schema" = "https://json.schemastore.org/tsconfig";
"compilerOptions" = {
"target" = "ES2023";
"module" = "ES2022";
"lib" = ["ES2023"];
"strict" = true;
"moduleResolution" = "Bundler";
"skipLibCheck" = true;
"checkJs" = true;
"allowJs" = true;
"jsx" = "react-jsx";
"jsxImportSource" = "${agsV2Packages.astal}/share/astal/gjs/src/jsx";
"paths" = {
"astal" = ["${agsV2Packages.astal}/share/astal/gjs"];
"astal/*" = ["${agsV2Packages.astal}/share/astal/gjs/src/*"];
};
};
};
};
};
};
# For accurate stack trace
_file = ./default.nix;
}

26
nixosModules/ags/v2/env.d.ts vendored Normal file
View file

@ -0,0 +1,26 @@
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
const SRC: string;
declare module 'inline:*' {
const content: string;
export default content;
}
declare module '*.sass' {
const content: string;
export default content;
}
declare module '*.scss' {
const content: string;
export default content;
}
declare module '*.css' {
const content: string;
export default content;
}

View file

@ -0,0 +1,452 @@
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,tsx}'],
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',
'@stylistic/jsx-indent-props': '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',
],
},
});

1745
nixosModules/ags/v2/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,16 @@
{
"name": "ags-v2",
"version": "0.0.0",
"main": "app.ts",
"dependencies": {
"@eslint/js": "9.11.1",
"@stylistic/eslint-plugin": "2.8.0",
"@types/eslint__js": "8.42.3",
"@types/node": "22.6.0",
"eslint": "9.11.1",
"eslint-plugin-jsdoc": "50.2.4",
"jiti": "1.21.6",
"typescript": "5.6.2",
"typescript-eslint": "8.7.0"
}
}

View file

@ -0,0 +1 @@

View file

@ -0,0 +1,39 @@
import { App, Variable, Astal, Gtk } from 'astal';
const time = Variable<string>('').poll(1000, 'date');
/**
* @param monitor the id of the monitor on which we want the widget to appear
* @returns the bar window
*/
export default function Bar(monitor: number) {
return (
<window
className="Bar"
monitor={monitor}
exclusivity={Astal.Exclusivity.EXCLUSIVE}
anchor={
Astal.WindowAnchor.TOP |
Astal.WindowAnchor.LEFT |
Astal.WindowAnchor.RIGHT
}
application={App}
>
<centerbox>
<button
onClicked="echo hello"
halign={Gtk.Align.CENTER}
>
Welcome to AGS!
</button>
<box />
<button
onClick={() => print('hello')}
halign={Gtk.Align.CENTER}
>
<label label={time()} />
</button>
</centerbox>
</window>
);
}