at master 1.8 kB view raw
1From 92283df3acbffa5c1bb21f23cdd686113d905114 Mon Sep 17 00:00:00 2001 2From: Patrick Hilhorst <git@hilhorst.be> 3Date: Wed, 31 Mar 2021 21:14:13 +0200 4Subject: [PATCH] Load configs from /etc but fallback to /nix/store 5 6This change will load all configuration files from /etc, to make it easy 7to override them, but fallback to /nix/store/.../etc/sway/config to make 8Sway work out-of-the-box with the default configuration on non NixOS 9systems. 10 11Original patch by Michael Weiss, updated for Sway 1.6 by Patrick Hilhorst 12 13Co-authored-by: Michael Weiss <dev.primeos@gmail.com> 14--- 15 meson.build | 3 ++- 16 sway/config.c | 3 ++- 17 2 files changed, 4 insertions(+), 2 deletions(-) 18 19diff --git a/meson.build b/meson.build 20index b7a29660..8ae8ceb3 100644 21--- a/meson.build 22+++ b/meson.build 23@@ -164,7 +164,8 @@ if scdoc.found() 24 endforeach 25 endif 26 27-add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c') 28+add_project_arguments('-DSYSCONFDIR="/@0@"'.format(sysconfdir), language : 'c') 29+add_project_arguments('-DNIX_SYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c') 30 31 version = '"@0@"'.format(meson.project_version()) 32 git = find_program('git', native: true, required: false) 33diff --git a/sway/config.c b/sway/config.c 34index 76b9ec08..fb5b51aa 100644 35--- a/sway/config.c 36+++ b/sway/config.c 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"}, 44 }; 45 46 size_t num_config_paths = sizeof(config_paths)/sizeof(config_paths[0]); 47-- 482.30.1