Compare commits

..

No commits in common. "62dc1214e9ada4e66dac215bb6635ec49e6a2417" and "aa9723303be1ebe2083eb975e070311b52372399" have entirely different histories.

12 changed files with 88 additions and 140 deletions

View file

@ -1,7 +1,6 @@
{
inputs ? {},
pkgs ? {},
self ? {},
}: let
lock = builtins.fromJSON (builtins.readFile ../flake.lock);
@ -10,12 +9,11 @@
sha256 = lock.nodes.nixpkgs.locked.narHash;
}}/lib";
inherit (lib) concatStringsSep optionalAttrs stringToCharacters substring tail toUpper;
inherit (lib) optionalAttrs;
mkVersion = src: "0.0.0+" + src.shortRev;
capitalise = str: (toUpper (substring 0 1 str) + (concatStringsSep "" (tail (stringToCharacters str))));
in
{inherit lib mkVersion capitalise;}
{inherit lib mkVersion;}
// (import ./inputs.nix lib lock)
// optionalAttrs (inputs != {}) (import ./flake-lib.nix inputs)
// optionalAttrs (pkgs != {}) (import ./pkgs.nix pkgs mkVersion capitalise self)
// optionalAttrs (pkgs != {}) (import ./pkgs.nix pkgs mkVersion)

View file

@ -1,4 +1,4 @@
pkgs: mkVersion: capitalise: self: {
pkgs: mkVersion: {
buildPlugin = pname: src:
pkgs.vimUtils.buildVimPlugin {
inherit pname src;
@ -21,29 +21,4 @@ pkgs: mkVersion: capitalise: self: {
dontNpmBuild = true;
}) {};
in "${pkg}/lib/node_modules/${pkg.pname}/node_modules";
buildNodeTypes = {
configPath,
packages,
pname,
}: let
inherit (pkgs.lib) concatMapStrings elemAt length map optionalString splitString toLower;
withGirNames =
map (package: {
inherit package;
girName =
if package.pname == "astal-wireplumber"
then "AstalWp-0.1"
else (concatMapStrings capitalise (splitString "-" package.pname)) + "-0.1";
})
packages;
in {
"${configPath}${optionalString (length packages == 1) "/${toLower (elemAt withGirNames 0).girName}"}".source =
pkgs.callPackage
./mk-types {
inherit (self.inputs) ts-for-gir-src;
inherit pname withGirNames;
};
};
}

View file

@ -4,10 +4,10 @@ self: {
pkgs,
...
}: let
inherit (self.inputs) ags astal gtk-session-lock;
inherit (self.inputs) ags astal gtk-session-lock ts-for-gir-src;
in {
config = let
inherit (lib) boolToString mkIf;
inherit (lib) boolToString mkIf toLower;
# Configs
inherit (config.vars) hostName;
@ -70,11 +70,15 @@ in {
home = {
file = let
inherit
(import "${self}/lib" {inherit pkgs self;})
buildNodeModules
buildNodeTypes
;
inherit (import "${self}/lib" {inherit pkgs;}) buildNodeModules;
mkType = package: girName: {
"${agsConfigDir}/config/types/@girs/${toLower girName}".source =
pkgs.callPackage
./mk-types {
inherit ts-for-gir-src package girName;
};
};
in (
{
# Generated types
@ -83,16 +87,8 @@ in {
recursive = true; # To add other types inside the folder
};
}
// (buildNodeTypes {
pname = "gtk-session-lock";
configPath = "${agsConfigDir}/config/types/@girs";
packages = [gtkSessionLock];
})
// (buildNodeTypes {
pname = "astal-tray";
configPath = "${agsConfigDir}/config/types/@girs";
packages = [astalTray];
})
// (mkType gtkSessionLock "GtkSessionLock-0.1")
// (mkType astalTray "AstalTray-0.1")
// {
# Out of store symlinks
".config/ags".source = mkOutOfStoreSymlink "${flakeDir}/nixosModules/ags/config";

View file

@ -1,16 +1,13 @@
{
lib,
pname,
withGirNames,
package,
girName,
buildNpmPackage,
ts-for-gir-src,
...
}: let
inherit (lib) concatMapStringsSep;
in
}:
buildNpmPackage {
pname = "${pname}-types";
version = "0.0.0";
pname = "${package.pname}-types";
inherit (package) version;
npmDepsHash = "sha256-8De8tRUKzRhD1jyx0anYNPMhxZyIr2nI45HdK6nb8jI=";
@ -18,8 +15,8 @@ buildNpmPackage {
dontNpmBuild = true;
buildPhase = ''
npx @ts-for-gir/cli generate ${concatMapStringsSep " " (p: p.girName) withGirNames} \
${concatMapStringsSep "\n" (p: "-g ${p.package.dev}/share/gir-1.0 \\") withGirNames}
npx @ts-for-gir/cli generate ${girName} \
-g ${package.dev}/share/gir-1.0 \
-g ${ts-for-gir-src}/girs \
--ignoreVersionConflicts \
--package \

View file

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

View file

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

View file

@ -1,15 +1,8 @@
self: {
lib,
pkgs,
...
}: {
self: {pkgs, ...}: {
config = let
inherit (lib) attrValues removeAttrs;
inherit (self.inputs) agsV2;
agsV2Packages = agsV2.packages.${pkgs.system};
astalLibs = attrValues (removeAttrs agsV2.inputs.astal.packages.${pkgs.system} ["docs"]);
configDir = "/home/matt/.nix/nixosModules/ags/v2";
in {
home = {
@ -23,22 +16,7 @@ self: {
})
];
file = let
inherit
(import "${self}/lib" {inherit pkgs self;})
buildNodeModules
buildNodeTypes
;
in (
(buildNodeTypes {
pname = "agsV2";
configPath = "${configDir}/@girs";
packages = astalLibs;
})
// {
"${configDir}/node_modules".source =
buildNodeModules ./. "sha256-WjCfS8iEw5Mjor/sQ2t+i0Q1pqVpSDEDbbgrKwK+3cg=";
file = {
"${configDir}/tsconfig.json".source = pkgs.writers.writeJSON "tsconfig.json" {
"$schema" = "https://json.schemastore.org/tsconfig";
"compilerOptions" = {
@ -58,8 +36,7 @@ self: {
};
};
};
}
);
};
};
};

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

View file

@ -1,30 +0,0 @@
import { App, Astal, Gtk, idle, Variable } from 'astal';
const isVisible = Variable<boolean>(false);
export default () => {
return (
<window
className="Bar"
exclusivity={Astal.Exclusivity.EXCLUSIVE}
anchor={
Astal.WindowAnchor.TOP |
Astal.WindowAnchor.LEFT |
Astal.WindowAnchor.RIGHT
}
application={App}
setup={() => idle(() => {
isVisible.set(true);
})}
>
<revealer
revealChild={isVisible()}
transitionType={Gtk.RevealerTransitionType.SLIDE_DOWN}
transitionDuration={500}
>
<label label="hi" />
</revealer>
</window>
);
};