@@ -1,22 +1,26 @@
1−From 26f9c65ef037892977a824f0d7d7111066856b53 Mon Sep 17 00:00:00 2001
2−From: Michael Weiss <dev.primeos@gmail.com>
3−Date: Sat, 27 Apr 2019 14:26:16 +0200
1+From 92283df3acbffa5c1bb21f23cdd686113d905114 Mon Sep 17 00:00:00 2001
2+From: Patrick Hilhorst <git@hilhorst.be>
3+Date: Wed, 31 Mar 2021 21:14:13 +0200
44Subject: [PATCH] Load configs from /etc but fallback to /nix/store
55
66This change will load all configuration files from /etc, to make it easy
77to override them, but fallback to /nix/store/.../etc/sway/config to make
88Sway work out-of-the-box with the default configuration on non NixOS
99systems.
10+
11+Original patch by Michael Weiss, updated for Sway 1.6 by Patrick Hilhorst
12+
13+Co-authored-by: Michael Weiss <dev.primeos@gmail.com>
1014---
1115 meson.build | 3 ++-
12− sway/config.c | 1 +
13− 2 files changed, 3 insertions(+), 1 deletion(-)
16+ sway/config.c | 3 ++-
17+ 2 files changed, 4 insertions(+), 2 deletions(-)
1418
1519diff --git a/meson.build b/meson.build
16−index 02b5d606..c03a9c0f 100644
20+index b7a29660..8ae8ceb3 100644
1721--- a/meson.build
1822+++ b/meson.build
19−@@ -129,7 +129,8 @@ if scdoc.found()
23+@@ -164,7 +164,8 @@ if scdoc.found()
2024 endforeach
2125 endif
2226
@@ -25,18 +29,20 @@ index 02b5d606..c03a9c0f 100644
2529+add_project_arguments('-DNIX_SYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c')
2630
2731 version = '"@0@"'.format(meson.project_version())
28− if git.found()
32+ git = find_program('git', native: true, required: false)
2933diff --git a/sway/config.c b/sway/config.c
30−index 4cd21bbc..dd855753 100644
34+index 76b9ec08..fb5b51aa 100644
3135--- a/sway/config.c
3236+++ b/sway/config.c
33−@@ -317,6 +317,7 @@ static char *get_config_path(void) {
34− "$XDG_CONFIG_HOME/i3/config",
35− SYSCONFDIR "/sway/config",
36− SYSCONFDIR "/i3/config",
37−+ NIX_SYSCONFDIR "/sway/config",
37+@@ -374,7 +374,8 @@ static char *get_config_path(void) {
38+ { .prefix = home, .config_folder = ".i3"},
39+ { .prefix = config_home, .config_folder = "i3"},
40+ { .prefix = SYSCONFDIR, .config_folder = "sway"},
41+- { .prefix = SYSCONFDIR, .config_folder = "i3"}
42++ { .prefix = SYSCONFDIR, .config_folder = "i3"},
43++ { .prefix = NIX_SYSCONFDIR, .config_folder = "sway"},
3844 };
3945
40− char *config_home = getenv("XDG_CONFIG_HOME");
46+ size_t num_config_paths = sizeof(config_paths)/sizeof(config_paths[0]);
4147--
42−2.19.2
48+2.30.1