Skip to content

i3blocks: search for config in correct system directory#21839

Merged
7c6f434c merged 1 commit intoNixOS:masterfrom
kierdavis:i3blocks-sysconfdir
Jan 13, 2017
Merged

i3blocks: search for config in correct system directory#21839
7c6f434c merged 1 commit intoNixOS:masterfrom
kierdavis:i3blocks-sysconfdir

Conversation

@kierdavis
Copy link
Copy Markdown
Contributor

The SYSCONFDIR variable used in the Makefile servers two purposes:

  1. During buildPhase, it is hardcoded into the executable as one of
    the locations that will be searched for the i3blocks.conf config
    file. We want this set to /etc, so that /etc/i3blocks.conf
    will be automatically loaded if it exists, as specified in the
    manpage.

  2. During installPhase, it specifies the location that the sample
    i3blocks.conf should be installed to. We want this to be $out/etc.

Case 2 was already handled correctly, but case 1 was not. This resulted
in i3blocks instead searching for i3blocks.conf in the default value of
SYSCONFDIR, which is /usr/local/etc, a directory which generally does
not exist on NixOS. This commit remedies this problem by setting
SYSCONFDIR=/etc during buildPhase.

A minor stylistic fix (correcting a usage of makeFlags to buildFlags) has also been applied in this commit.

Motivation for this change
Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

The SYSCONFDIR variable used in the Makefile servers two purposes:

1) During buildPhase, it is hardcoded into the executable as one of
   the locations that will be searched for the i3blocks.conf config
   file. We want this set to "/etc", so that "/etc/i3blocks.conf"
   will be automatically loaded if it exists, as specified in the
   manpage.

2) During installPhase, it specifies the location that the sample
   i3blocks.conf should be installed to. We want this to be "$out/etc".

Case 2 was already handled correctly, but case 1 was not. This resulted
in i3blocks instead searching for i3blocks.conf in the default value of
SYSCONFDIR, which is "/usr/local/etc", a directory which generally does
not exist on NixOS. This commit remedies this problem by setting
SYSCONFDIR=/etc during buildPhase.

A minor stylistic fix (correcting a usage of "makeFlags" to "buildFlags"
in the expression) has also been applied in this commit.
@mention-bot
Copy link
Copy Markdown

@kierdavis, thanks for your PR! By analyzing the history of the files in this pull request, we identified @MindTooth and @zimbatm to be potential reviewers.

@7c6f434c 7c6f434c merged commit 740d857 into NixOS:master Jan 13, 2017
@7c6f434c
Copy link
Copy Markdown
Member

The platforms should actually be linux or maybe linux ++ freebsd, right?

@ghost
Copy link
Copy Markdown

ghost commented Jan 13, 2017

@7c6f434c
Copy link
Copy Markdown
Member

7c6f434c commented Jan 13, 2017 via email

@ghost
Copy link
Copy Markdown

ghost commented Jan 13, 2017

I would guess through XQuartz or something. But not on the base system.

Not used to the syntax, but unix !darwin, would that work then?

@7c6f434c
Copy link
Copy Markdown
Member

7c6f434c commented Jan 13, 2017 via email

@ghost
Copy link
Copy Markdown

ghost commented Jan 13, 2017

So maybe this then:

platforms = linux ++ freebsd ++ openbsd ++ netbsd ++ illumos;

@kierdavis kierdavis deleted the i3blocks-sysconfdir branch January 13, 2017 11:06
@7c6f434c
Copy link
Copy Markdown
Member

7c6f434c commented Jan 13, 2017 via email

@ghost
Copy link
Copy Markdown

ghost commented Jan 13, 2017

I see what you're getting at, and I'll up a PR :-)

@ghost ghost mentioned this pull request Jan 13, 2017
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants