Compare commits
2 commits
aa9723303b
...
62dc1214e9
Author | SHA1 | Date | |
---|---|---|---|
62dc1214e9 | |||
7a3ea83d40 |
12 changed files with 140 additions and 88 deletions
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
inputs ? {},
|
inputs ? {},
|
||||||
pkgs ? {},
|
pkgs ? {},
|
||||||
|
self ? {},
|
||||||
}: let
|
}: let
|
||||||
lock = builtins.fromJSON (builtins.readFile ../flake.lock);
|
lock = builtins.fromJSON (builtins.readFile ../flake.lock);
|
||||||
|
|
||||||
|
@ -9,11 +10,12 @@
|
||||||
sha256 = lock.nodes.nixpkgs.locked.narHash;
|
sha256 = lock.nodes.nixpkgs.locked.narHash;
|
||||||
}}/lib";
|
}}/lib";
|
||||||
|
|
||||||
inherit (lib) optionalAttrs;
|
inherit (lib) concatStringsSep optionalAttrs stringToCharacters substring tail toUpper;
|
||||||
|
|
||||||
mkVersion = src: "0.0.0+" + src.shortRev;
|
mkVersion = src: "0.0.0+" + src.shortRev;
|
||||||
|
capitalise = str: (toUpper (substring 0 1 str) + (concatStringsSep "" (tail (stringToCharacters str))));
|
||||||
in
|
in
|
||||||
{inherit lib mkVersion;}
|
{inherit lib mkVersion capitalise;}
|
||||||
// (import ./inputs.nix lib lock)
|
// (import ./inputs.nix lib lock)
|
||||||
// optionalAttrs (inputs != {}) (import ./flake-lib.nix inputs)
|
// optionalAttrs (inputs != {}) (import ./flake-lib.nix inputs)
|
||||||
// optionalAttrs (pkgs != {}) (import ./pkgs.nix pkgs mkVersion)
|
// optionalAttrs (pkgs != {}) (import ./pkgs.nix pkgs mkVersion capitalise self)
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
{
|
{
|
||||||
package,
|
lib,
|
||||||
girName,
|
pname,
|
||||||
|
withGirNames,
|
||||||
buildNpmPackage,
|
buildNpmPackage,
|
||||||
ts-for-gir-src,
|
ts-for-gir-src,
|
||||||
...
|
...
|
||||||
}:
|
}: let
|
||||||
|
inherit (lib) concatMapStringsSep;
|
||||||
|
in
|
||||||
buildNpmPackage {
|
buildNpmPackage {
|
||||||
pname = "${package.pname}-types";
|
pname = "${pname}-types";
|
||||||
inherit (package) version;
|
version = "0.0.0";
|
||||||
|
|
||||||
npmDepsHash = "sha256-8De8tRUKzRhD1jyx0anYNPMhxZyIr2nI45HdK6nb8jI=";
|
npmDepsHash = "sha256-8De8tRUKzRhD1jyx0anYNPMhxZyIr2nI45HdK6nb8jI=";
|
||||||
|
|
||||||
|
@ -15,8 +18,8 @@ buildNpmPackage {
|
||||||
dontNpmBuild = true;
|
dontNpmBuild = true;
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
npx @ts-for-gir/cli generate ${girName} \
|
npx @ts-for-gir/cli generate ${concatMapStringsSep " " (p: p.girName) withGirNames} \
|
||||||
-g ${package.dev}/share/gir-1.0 \
|
${concatMapStringsSep "\n" (p: "-g ${p.package.dev}/share/gir-1.0 \\") withGirNames}
|
||||||
-g ${ts-for-gir-src}/girs \
|
-g ${ts-for-gir-src}/girs \
|
||||||
--ignoreVersionConflicts \
|
--ignoreVersionConflicts \
|
||||||
--package \
|
--package \
|
27
lib/pkgs.nix
27
lib/pkgs.nix
|
@ -1,4 +1,4 @@
|
||||||
pkgs: mkVersion: {
|
pkgs: mkVersion: capitalise: self: {
|
||||||
buildPlugin = pname: src:
|
buildPlugin = pname: src:
|
||||||
pkgs.vimUtils.buildVimPlugin {
|
pkgs.vimUtils.buildVimPlugin {
|
||||||
inherit pname src;
|
inherit pname src;
|
||||||
|
@ -21,4 +21,29 @@ pkgs: mkVersion: {
|
||||||
dontNpmBuild = true;
|
dontNpmBuild = true;
|
||||||
}) {};
|
}) {};
|
||||||
in "${pkg}/lib/node_modules/${pkg.pname}/node_modules";
|
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;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@ self: {
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (self.inputs) ags astal gtk-session-lock ts-for-gir-src;
|
inherit (self.inputs) ags astal gtk-session-lock;
|
||||||
in {
|
in {
|
||||||
config = let
|
config = let
|
||||||
inherit (lib) boolToString mkIf toLower;
|
inherit (lib) boolToString mkIf;
|
||||||
|
|
||||||
# Configs
|
# Configs
|
||||||
inherit (config.vars) hostName;
|
inherit (config.vars) hostName;
|
||||||
|
@ -70,15 +70,11 @@ in {
|
||||||
|
|
||||||
home = {
|
home = {
|
||||||
file = let
|
file = let
|
||||||
inherit (import "${self}/lib" {inherit pkgs;}) buildNodeModules;
|
inherit
|
||||||
|
(import "${self}/lib" {inherit pkgs self;})
|
||||||
mkType = package: girName: {
|
buildNodeModules
|
||||||
"${agsConfigDir}/config/types/@girs/${toLower girName}".source =
|
buildNodeTypes
|
||||||
pkgs.callPackage
|
;
|
||||||
./mk-types {
|
|
||||||
inherit ts-for-gir-src package girName;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in (
|
in (
|
||||||
{
|
{
|
||||||
# Generated types
|
# Generated types
|
||||||
|
@ -87,8 +83,16 @@ in {
|
||||||
recursive = true; # To add other types inside the folder
|
recursive = true; # To add other types inside the folder
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// (mkType gtkSessionLock "GtkSessionLock-0.1")
|
// (buildNodeTypes {
|
||||||
// (mkType astalTray "AstalTray-0.1")
|
pname = "gtk-session-lock";
|
||||||
|
configPath = "${agsConfigDir}/config/types/@girs";
|
||||||
|
packages = [gtkSessionLock];
|
||||||
|
})
|
||||||
|
// (buildNodeTypes {
|
||||||
|
pname = "astal-tray";
|
||||||
|
configPath = "${agsConfigDir}/config/types/@girs";
|
||||||
|
packages = [astalTray];
|
||||||
|
})
|
||||||
// {
|
// {
|
||||||
# Out of store symlinks
|
# Out of store symlinks
|
||||||
".config/ags".source = mkOutOfStoreSymlink "${flakeDir}/nixosModules/ags/config";
|
".config/ags".source = mkOutOfStoreSymlink "${flakeDir}/nixosModules/ags/config";
|
||||||
|
|
4
nixosModules/ags/v2/.gitignore
vendored
4
nixosModules/ags/v2/.gitignore
vendored
|
@ -1,3 +1,3 @@
|
||||||
@girs/
|
@girs
|
||||||
node_modules/
|
node_modules
|
||||||
tsconfig.json
|
tsconfig.json
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
import { App } from 'astal';
|
import { App } from 'astal';
|
||||||
|
|
||||||
import style from 'inline:./style.scss';
|
import style from 'inline:./style.scss';
|
||||||
import Bar from './widget/Bar';
|
|
||||||
|
import Bar from './widgets/bar/main';
|
||||||
|
|
||||||
|
|
||||||
App.start({
|
App.start({
|
||||||
css: style,
|
css: style,
|
||||||
main() {
|
|
||||||
Bar(0);
|
main: () => {
|
||||||
|
Bar();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,15 @@
|
||||||
self: {pkgs, ...}: {
|
self: {
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
config = let
|
config = let
|
||||||
|
inherit (lib) attrValues removeAttrs;
|
||||||
|
|
||||||
inherit (self.inputs) agsV2;
|
inherit (self.inputs) agsV2;
|
||||||
|
|
||||||
agsV2Packages = agsV2.packages.${pkgs.system};
|
agsV2Packages = agsV2.packages.${pkgs.system};
|
||||||
|
astalLibs = attrValues (removeAttrs agsV2.inputs.astal.packages.${pkgs.system} ["docs"]);
|
||||||
configDir = "/home/matt/.nix/nixosModules/ags/v2";
|
configDir = "/home/matt/.nix/nixosModules/ags/v2";
|
||||||
in {
|
in {
|
||||||
home = {
|
home = {
|
||||||
|
@ -16,7 +23,22 @@ self: {pkgs, ...}: {
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
file = {
|
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=";
|
||||||
|
|
||||||
"${configDir}/tsconfig.json".source = pkgs.writers.writeJSON "tsconfig.json" {
|
"${configDir}/tsconfig.json".source = pkgs.writers.writeJSON "tsconfig.json" {
|
||||||
"$schema" = "https://json.schemastore.org/tsconfig";
|
"$schema" = "https://json.schemastore.org/tsconfig";
|
||||||
"compilerOptions" = {
|
"compilerOptions" = {
|
||||||
|
@ -36,7 +58,8 @@ self: {pkgs, ...}: {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
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>
|
|
||||||
);
|
|
||||||
}
|
|
30
nixosModules/ags/v2/widgets/bar/main.tsx
Normal file
30
nixosModules/ags/v2/widgets/bar/main.tsx
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
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>
|
||||||
|
);
|
||||||
|
};
|
Loading…
Reference in a new issue