About
History
New snippet →
Upload snippet →
Snippet #2391 (python)
#2391
Expires in: 0 minutes
View Raw
commit
f60118c5c8ea8a6527d5f8fc7bbe6adc99126e4e
Author
:
Nadrieril
<
nadrieril
@gmail
.
com
>
Date
:
Sun
Jul
8
13
:
14
:
36
2018
+
0100
nixos
/
xserver
:
use
xkbDir
setting
when
validating
/
converting
configuration
diff
--
git
a
/
nixos
/
modules
/
config
/
i18n
.
nix
b
/
nixos
/
modules
/
config
/
i18n
.
nix
index
6
bf8c653e11
.
.8
ec910ce93a
100644
---
a
/
nixos
/
modules
/
config
/
i18n
.
nix
+++
b
/
nixos
/
modules
/
config
/
i18n
.
nix
@@
-
120
,
7
+
120
,
7
@@
with
lib
;
mkIf
config
.
i18n
.
consoleUseXkbConfig
(
pkgs
.
runCommand
"xkb-console-keymap"
{
preferLocalBuild
=
true
;
}
''
'$
{pkgs.ckbcomp}
/bin/ckbcomp'
-
model
'$
{xkbModel}
'
-
layout
'$
{layout}
'
\
-
-
option
'$
{xkbOptions}
'
-
variant
'$
{xkbVariant}
'
>
"$out"
+
-
option
'$
{xkbOptions}
'
-
variant
'$
{xkbVariant}
'
-
I
'$
{xkbDir}
'
>
"$out"
''
);
environment
.
systemPackages
=
diff
--
git
a
/
nixos
/
modules
/
services
/
x11
/
xserver
.
nix
b
/
nixos
/
modules
/
services
/
x11
/
xserver
.
nix
index
0237
dd6f560
.
.0e62
c888052
100644
---
a
/
nixos
/
modules
/
services
/
x11
/
xserver
.
nix
+++
b
/
nixos
/
modules
/
services
/
x11
/
xserver
.
nix
@@
-
687
,
10
+
687
,
10
@@
in
services
.
xserver
.
xkbDir
=
mkDefault
"$
{pkgs.xkeyboard_config}
/etc/X11/xkb"
;
system
.
extraDependencies
=
singleton
(
pkgs
.
runCommand
"xkb-validated"
{
-
inherit
(
cfg
)
xkbModel
layout
xkbVariant
xkbOptions
;
+
inherit
(
cfg
)
xkbModel
layout
xkbVariant
xkbOptions
xkbDir
;
nativeBuildInputs
=
[
pkgs
.
xkbvalidate
];
}
''
-
validate
"$xkbModel"
"$layout"
"$xkbVariant"
"$xkbOptions"
+
validate
"$xkbModel"
"$layout"
"$xkbVariant"
"$xkbOptions"
"$xkbDir"
touch
"$out"
''
);
diff
--
git
a
/
pkgs
/
tools
/
X11
/
xkbvalidate
/
xkbvalidate
.
c
b
/
pkgs
/
tools
/
X11
/
xkbvalidate
/
xkbvalidate
.
c
index
d9c9042467c
.
.2
c0b218a0e8
100644
---
a
/
pkgs
/
tools
/
X11
/
xkbvalidate
/
xkbvalidate
.
c
+++
b
/
pkgs
/
tools
/
X11
/
xkbvalidate
/
xkbvalidate
.
c
@@
-
96
,
13
+
96
,
14
@@
int
main
(
int
argc
,
char
**
argv
)
struct
xkb_context
*
ctx
;
struct
xkb_rule_names
*
rdef
;
-
if
(
argc
!=
5
)
{
-
fprintf
(
stderr
,
"Usage:
%s
model layout variant options
\n
"
,
argv
[
0
]);
+
if
(
argc
!=
6
)
{
+
fprintf
(
stderr
,
"Usage:
%s
model layout variant options dir
\n
"
,
argv
[
0
]);
return
EXIT_FAILURE
;
}
-
ctx
=
xkb_context_new
(
XKB_CONTEXT_NO_ENVIRONMENT_NAMES
);
+
ctx
=
xkb_context_new
(
XKB_CONTEXT_NO_ENVIRONMENT_NAMES
||
XKB_CONTEXT_NO_DEFAULT_INCLUDES
);
xkb_context_set_log_fn
(
ctx
,
add_log
);
+
xkb_context_include_path_append
(
ctx
,
argv
[
5
]);
rdef
=
malloc
(
sizeof
(
struct
xkb_rule_names
));
Wrap long lines
Reply to this snippet →
Honeypot, don't fill.
commit f60118c5c8ea8a6527d5f8fc7bbe6adc99126e4e Author: Nadrieril <nadrieril@gmail.com> Date: Sun Jul 8 13:14:36 2018 +0100 nixos/xserver: use xkbDir setting when validating/converting configuration diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix index 6bf8c653e11..8ec910ce93a 100644 --- a/nixos/modules/config/i18n.nix +++ b/nixos/modules/config/i18n.nix @@ -120,7 +120,7 @@ with lib; mkIf config.i18n.consoleUseXkbConfig (pkgs.runCommand "xkb-console-keymap" { preferLocalBuild = true; } '' '${pkgs.ckbcomp}/bin/ckbcomp' -model '${xkbModel}' -layout '${layout}' \ - -option '${xkbOptions}' -variant '${xkbVariant}' > "$out" + -option '${xkbOptions}' -variant '${xkbVariant}' -I '${xkbDir}' > "$out" ''); environment.systemPackages = diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index 0237dd6f560..0e62c888052 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -687,10 +687,10 @@ in services.xserver.xkbDir = mkDefault "${pkgs.xkeyboard_config}/etc/X11/xkb"; system.extraDependencies = singleton (pkgs.runCommand "xkb-validated" { - inherit (cfg) xkbModel layout xkbVariant xkbOptions; + inherit (cfg) xkbModel layout xkbVariant xkbOptions xkbDir; nativeBuildInputs = [ pkgs.xkbvalidate ]; } '' - validate "$xkbModel" "$layout" "$xkbVariant" "$xkbOptions" + validate "$xkbModel" "$layout" "$xkbVariant" "$xkbOptions" "$xkbDir" touch "$out" ''); diff --git a/pkgs/tools/X11/xkbvalidate/xkbvalidate.c b/pkgs/tools/X11/xkbvalidate/xkbvalidate.c index d9c9042467c..2c0b218a0e8 100644 --- a/pkgs/tools/X11/xkbvalidate/xkbvalidate.c +++ b/pkgs/tools/X11/xkbvalidate/xkbvalidate.c @@ -96,13 +96,14 @@ int main(int argc, char **argv) struct xkb_context *ctx; struct xkb_rule_names *rdef; - if (argc != 5) { - fprintf(stderr, "Usage: %s model layout variant options\n", argv[0]); + if (argc != 6) { + fprintf(stderr, "Usage: %s model layout variant options dir\n", argv[0]); return EXIT_FAILURE; } - ctx = xkb_context_new(XKB_CONTEXT_NO_ENVIRONMENT_NAMES); + ctx = xkb_context_new(XKB_CONTEXT_NO_ENVIRONMENT_NAMES || XKB_CONTEXT_NO_DEFAULT_INCLUDES); xkb_context_set_log_fn(ctx, add_log); + xkb_context_include_path_append(ctx, argv[5]); rdef = malloc(sizeof(struct xkb_rule_names));
Text (preformatted)
Text (not code)
----------
ABAP
ApacheConf
AppleScript
ActionScript
Bash
BBCode
C
Clojure
COBOL
CSS
CUDA
Dart
Delphi
Diff
Django
Erlang
Fortran
Go
Groovy
Haml
Haskell
HTML
HTTP
INI
IRC
Java
JavaScript
JSON
Lua
Makefile
Mako
Mason
Matlab
Modula
Monkey
MySQL
NumPy
OCaml
Perl
PHP
PostScript
PowerShell
Prolog
Properties
Puppet
Python
Ruby
reStructuredText
Rust
Sass
Scala
Scheme
Scilab
SCSS
Smalltalk
Smarty
SQL
Tcl
Tcsh
TeX
Text (Preformatted)
Text (non-code)
VB.net
VimL
XML
XQuery
XSLT
YAML
Author:
⌘+⏎ or Ctrl+⏎
Expire in
One Time Snippet
In one hour
In one week
In one month