mirror of
https://github.com/javalsai/lidm.git
synced 2025-08-30 09:58:00 +02:00
feat(nix): add keys enum to global cfg
This commit is contained in:
11
INSTALL.md
11
INSTALL.md
@@ -102,21 +102,24 @@ pass:
|
||||
* A string to copy the config from a theme in `themes/` with said name
|
||||
(**name**, e.g `"cherry"`).
|
||||
* An attribute tree with the same names as the config file, e.g:
|
||||
|
||||
```nix
|
||||
{
|
||||
with config.lidm.keysEnum; {
|
||||
strings = {
|
||||
f_poweroff = "custom_poweroff";
|
||||
# etc
|
||||
};
|
||||
|
||||
behavior = {
|
||||
include_defshell = true;
|
||||
source = [
|
||||
"path1"
|
||||
"path2"
|
||||
];
|
||||
# etc
|
||||
};
|
||||
# etc
|
||||
|
||||
functions = { poweroff = F1; };
|
||||
|
||||
# etc...
|
||||
};
|
||||
```
|
||||
|
||||
|
@@ -10,11 +10,14 @@ let
|
||||
keys-h-file = builtins.readFile "${src}/include/keys.h";
|
||||
};
|
||||
in
|
||||
builtins.toFile "lidm.conf" (
|
||||
if builtins.isString cfg then
|
||||
builtins.readFile "${src}/themes/${cfg}.ini"
|
||||
else if builtins.isAttrs cfg then
|
||||
maker.make cfg
|
||||
else
|
||||
builtins.throw "invalid cfg type, expected str or attrs"
|
||||
)
|
||||
{
|
||||
inherit maker;
|
||||
file = builtins.toFile "lidm.conf" (
|
||||
if builtins.isString cfg then
|
||||
builtins.readFile "${src}/themes/${cfg}.ini"
|
||||
else if builtins.isAttrs cfg then
|
||||
maker.make cfg
|
||||
else
|
||||
builtins.throw "invalid cfg type, expected str or attrs"
|
||||
);
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg-file =
|
||||
get-cfg =
|
||||
if config.cfg != null then
|
||||
import ./get-cfg-file.nix {
|
||||
inherit lib;
|
||||
@@ -13,6 +13,8 @@ let
|
||||
}
|
||||
else
|
||||
null;
|
||||
cfg-file = get-cfg.file;
|
||||
maker = get-cfg.maker;
|
||||
in
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
pname = "lidm";
|
||||
@@ -41,4 +43,8 @@ pkgs.stdenv.mkDerivation rec {
|
||||
fixupPhase = ''
|
||||
rm -rf $out/etc
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
keysEnum = maker.keys-enum;
|
||||
};
|
||||
}
|
||||
|
@@ -30,15 +30,23 @@ let
|
||||
};
|
||||
in
|
||||
{
|
||||
options.services.lidm.config = lib.mkOption {
|
||||
type =
|
||||
with lib.types;
|
||||
oneOf [
|
||||
str
|
||||
attrs
|
||||
];
|
||||
default = { };
|
||||
description = "Config options for lidm | Either attr tree or name of bundled themes";
|
||||
options = {
|
||||
lidm.keysEnum = lib.mkOption {
|
||||
type = with lib.types; attrs;
|
||||
default = lidm.passthru.keysEnum;
|
||||
readOnly = true;
|
||||
description = "Keys enum constants";
|
||||
};
|
||||
services.lidm.config = lib.mkOption {
|
||||
type =
|
||||
with lib.types;
|
||||
oneOf [
|
||||
str
|
||||
attrs
|
||||
];
|
||||
default = { };
|
||||
description = "Config options for lidm | Either attr tree or name of bundled themes";
|
||||
};
|
||||
};
|
||||
config = {
|
||||
services.displayManager.defaultSession = "lidm";
|
||||
|
Reference in New Issue
Block a user