Compare commits

...

41 commits

Author SHA1 Message Date
Robert Helgesson ef64bc598f
redshift: add assertion on latitude and longitude
These two options must be set if the provider is set to "manual".

Closes #841

(cherry picked from commit 8bddc1adab)
2019-10-02 23:18:51 +02:00
Robert Helgesson 8def383511
mpd: allow path literal values in options
This allows specifying, for example, the music directory using path
literals without causing the directory to be copied to the Nix store.

Suggested-by: Silvan Mosberger <infinisil@icloud.com>
(cherry picked from commit b0544c8cde)
2019-09-17 22:55:16 +02:00
Robert Helgesson c13c1b33d9
xsession: remove bashisms in start scripts
Fixes #836

(cherry picked from commit 0dfa1eef25)
2019-09-17 22:54:56 +02:00
Robert Helgesson d74320012e
polybar: restart service on failure
(cherry picked from commit 698d0f0a44)
2019-09-17 22:53:09 +02:00
Alex Rice aa2f70def7
rofi: string -> str
(cherry picked from commit ec0459e139)
2019-09-03 15:39:48 +02:00
Robert Helgesson 76ba4bedff
systemd: fix unit examples
Closes #823

(cherry picked from commit 875eea1330)
2019-08-29 19:22:06 +02:00
Robert Helgesson 46eaee3262
Replace use of stdenv.shell by runtimeShell
(cherry picked from commit eb1b86a5ec)
2019-08-29 19:20:21 +02:00
Robert Helgesson f8187816a4
nixpkgs: improve description formatting slightly
(cherry picked from commit 57925c50bf)
2019-08-29 19:19:31 +02:00
Robert Helgesson f9ac2671bb
Use types.port where applicable
This changes the type of all options that specify ports to
`types.port`. This type restricts values to between 0 and 65535.

(cherry picked from commit ed4f66185f)
2019-08-29 19:19:16 +02:00
Robert Helgesson 2307cb280a
nix-darwin: pass on warnings to the system configuration
(cherry picked from commit c2429ca0cf)
2019-08-29 19:17:59 +02:00
Robert Helgesson 14c5a22cfb
nixos: pass on warnings to the system configuration
Fixes #804

(cherry picked from commit 7834ffbbf1)
2019-08-29 19:17:52 +02:00
Robert Helgesson 0f85326dee
emacs: document how to list available extra packages
(cherry picked from commit 5eed33ef08)
2019-08-29 19:17:10 +02:00
pacien 35d31c390d
alot: fix account extraConfig section
(cherry picked from commit 31ae1bc2ff)
2019-08-29 19:17:00 +02:00
Robert Helgesson 176e82ee1c
install: restrict to nix-shell
This commit adds a "build" command to the install derivation that
tells the user that `nix-shell` should be used.

A derivation attribute `shellHookOnly = true` is also added with the
intent to indicate that the shell hook is the entire point of the
derivation.

(cherry picked from commit fcdab6a62d)
2019-08-29 19:16:25 +02:00
Tobias Happ 634a909ddc
xsession: set RemainAfterExit for setxkbmap.service
(cherry picked from commit 2eae9daae7)
2019-08-29 19:16:14 +02:00
Robert Helgesson 33c6230dac
gitlab-ci: only run a single test
Unfortunately the full test suite seems to run out of memory on the
GitLab CI runner.

(cherry picked from commit 8830b8d082)
2019-08-19 16:37:53 +02:00
Robert Helgesson 1d8b6e7d9e
gitlab-ci: trigger NUR update
This will trigger a CI job at

    https://gitlab.com/rycee/nur-expressions

that will update Home Manager in NUR.

(cherry picked from commit 55c962fda2)
2019-08-19 16:37:52 +02:00
Robert Helgesson cf5e08cfb8
gitlab-ci: add test stage
(cherry picked from commit eb7f39f0aa)
2019-08-19 16:37:50 +02:00
Nikita Uvarov 45a73067ac
zsh: fix completion when oh-my-zsh is enabled
enableCompletion option not only calls compinit but also adds
nix-zsh-completions package to home.packages which should still happen
even if oh-my-zsh is enabled.

The double compinit call will still be eliminated by moving guarding condition
down to the compinit call itself.

Fixes #771.

(cherry picked from commit 7310cfc557)
2019-08-14 17:09:39 +02:00
Nikita Uvarov ef906c5a92
zsh: create oh-my-zsh cache directory
Fixes #761.

(cherry picked from commit 42ad0effdd)
2019-08-14 17:09:39 +02:00
paumr bb18d4c746
mbsync: fix use of certificatesFile
The `tls.certificatesFile` option may be set to a path but the
`CertificateFile` attribute should be a string.

(cherry picked from commit 3743e8995a)
2019-08-14 17:09:20 +02:00
Tobias Happ 6d5246f49f
systemd-activate.rb: add start/stop/restart sockets
(cherry picked from commit 4c9b40ca0e)
2019-08-14 17:09:20 +02:00
Olli Helenius 5d054abe6a
dconf: assume empty list value is a list of strings
Fixes #769.

(cherry picked from commit caf3349f01)
2019-08-14 17:09:14 +02:00
Brian Hicks a85f22164d
nix-darwin: add docs
(cherry picked from commit 6239ce20af)
2019-07-28 15:03:42 +02:00
Robert Helgesson dd6d8e278b
vscode: fix configuration path for Darwin
Fixes #737

(cherry picked from commit 056443ccbd)
2019-07-28 15:03:22 +02:00
Shanon McQuay 9291923e84
skim: correctly name default options
skim uses SKIM_DEFAULT_OPTIONS rather than SKIM_DEFAULT_OPTS.

(cherry picked from commit 734128930f)
2019-07-28 15:03:13 +02:00
Robert Helgesson b8bbd242f8
mbsync: use full path to mu in example
(cherry picked from commit ca4f22be85)
2019-07-28 15:02:55 +02:00
Robert Helgesson 413ac52bed
mbsync: put extra config at the beginning
If it is at the end it will just end up applying to the last defined
section.

Fixes #748

(cherry picked from commit c3520bfa52)
2019-07-05 22:19:57 +02:00
Robert Helgesson 4f13f06b01
network-manager-applet: fix indentation
(cherry picked from commit 5b50eb18fc)
2019-06-09 22:49:19 +02:00
Florian Klink d714740961
screen-locker: fix systemd unit
In particular, don't add trailing backslashes introduced by
`xautolockExtraOptions`. Systemd's unit file parser seems to have
gotten a bit stricter and with systemd 242, the trailing backslash
caused the next non-empty line to be ignored.

In that case, this was `[Section]`, so all subsequent settings were
mistakenly added to `[Service]`, causing them to be ignored entirely.

Simplify and fix this by using `concatStringsSep` to build a single
`ExecStart` line.

(cherry picked from commit 8991fe2e90)
2019-06-09 22:48:06 +02:00
Robert Helgesson 81d600d948
vscode: add example for extensions option
(cherry picked from commit e1535d2bd8)
2019-06-09 22:47:27 +02:00
Jaka Hudoklin 3daa1da497
nixos: use usercfg.home.username for username
Use `usercfg.home.username` for username instead of attribute name,
as this way we can change username regardless of the name of the attribute.

(cherry picked from commit 2e13c3cdfd)
2019-06-09 22:46:11 +02:00
Roman Volosatovs 41d2a16f99
nix-darwin: actually install packages
Also apply assertions when using the nix-darwin module.

Closes #702

(cherry picked from commit 1480a6ca14)
2019-06-09 22:46:01 +02:00
Tadeo Kondrak 24b734500f
alacritty: don't create file if settings is empty
Also add a few test cases for the alacritty module.

(cherry picked from commit d2ed39f103)
2019-05-15 00:01:21 +02:00
Robert Helgesson de9fc235d0
tests: bump nmt version
(cherry picked from commit 939274281a)
2019-05-15 00:00:35 +02:00
Robert Helgesson 14a0dce9e8
flameshot: fix service description
(cherry picked from commit f99d4ba7c4)
2019-05-01 18:24:38 +02:00
Will Dietz ef78cae6a4
files: fix find invocation broken in c94eaa0e
Add parens to expression so the `-exec` includes files matching both.

Otherwise (before this change) the `-exec` is only invoked for
links (`-type l`):

    file or (link -> doexec)
      =>
    (file or link) -> doexec

(cherry picked from commit f56256f488)
2019-05-01 18:24:30 +02:00
Robert Helgesson e3c4ec12cc
home-manager: add uninstall command
(cherry picked from commit 3bb7c75db3)
2019-05-01 18:24:02 +02:00
Robert Helgesson f73c6ed74f
files: replace unnecessary use of xargs
(cherry picked from commit c94eaa0e6c)
2019-05-01 18:24:02 +02:00
Robert Helgesson de0dae5666
firefox: deprecate Google Talk and IcedTea options
(cherry picked from commit a16439e38e)
2019-05-01 18:24:02 +02:00
Robert Helgesson 162a65f029
Fix type of various sessionVariables options
Unfortunately, using `attrsOf` is not possible since it results in too
eager evaluation. In particular, the

    home.sessionVariables = {
      FOO = "Hello";
      BAR = "${config.home.sessionVariables.FOO} World!";
    };

example will cause an infinite recursion.

This commit restores the option type of

- `home.sessionVariables`,
- `pam.sessionVariables`,
- `programs.bash.sessionVariables`, and
- `programs.zsh.sessionVariables`

to `attrs`. It also adds test cases for the above options to avoid
regressions.

Fixes #659

(cherry picked from commit b6e613c771)
2019-05-01 18:24:02 +02:00
54 changed files with 557 additions and 128 deletions

View file

@ -1,6 +1,18 @@
image: nixos/nix:latest
pages:
stages:
- test
- deploy
Run tests:
stage: test
script:
- nix-shell tests -A run.files-text
only:
- release-19.03
Deploy manual:
stage: deploy
script:
- mkdir -p ~/.config/nixpkgs
- echo '{ manual.html.enable = true; }' > ~/.config/nixpkgs/home.nix
@ -12,3 +24,14 @@ pages:
- public
only:
- master
Deploy NUR:
stage: deploy
variables:
HM_BRANCH: $CI_COMMIT_REF_NAME
HM_COMMIT_SHA: $CI_COMMIT_SHA
trigger:
project: rycee/nur-expressions
branch: master
only:
- release-19.03

View file

@ -230,7 +230,81 @@ home-manager.useUserPackages = true;
<title>nix-darwin module</title>
<para>
To be done.
Home Manager provides a module that allows you to prepare user
environments directly from the nix-darwin configuration file, which often is
more convenient than using the <command>home-manager</command> tool.
</para>
<para>
To make the NixOS module available for use you must <option>import</option>
it into your system configuration. This is most conveniently done by adding
a Home Manager channel, for example
</para>
<screen>
<prompt>#</prompt> <userinput>nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager</userinput>
<prompt>#</prompt> <userinput>nix-channel --update</userinput>
</screen>
<para>
if you are following Nixpkgs master or an unstable channel and
</para>
<screen>
<prompt>#</prompt> <userinput>nix-channel --add https://github.com/rycee/home-manager/archive/release-19.03.tar.gz home-manager</userinput>
<prompt>#</prompt> <userinput>nix-channel --update</userinput>
</screen>
<para>
if you follow a Nixpkgs version 19.03 channel.
</para>
<para>
It is then possible to add
</para>
<programlisting language="nix">
imports = [ &lt;home-manager/nix-darwin&gt; ];
</programlisting>
<para>
to your nix-darwin <filename>configuration.nix</filename> file, which will
introduce a new NixOS option called <option>home-manager</option> whose type
is an attribute set that maps user names to Home Manager configurations.
</para>
<para>
For example, a nix-darwin configuration may include the lines
</para>
<programlisting language="nix">
home-manager.users.eve = { pkgs, ... }: {
home.packages = [ pkgs.atool pkgs.httpie ];
programs.bash.enable = true;
};
</programlisting>
<para>
and after a <command>darwin-rebuild --switch</command> the user eve's
environment should include a basic Bash configuration and the packages atool
and httpie.
</para>
<note>
<para>
By default user packages will not be ignored in favor of
<option>environment.systemPackages</option>, but they will be intalled to
<option>/etc/profiles/per-user/$USERNAME</option> if
</para>
<programlisting language="nix">
home-manager.useUserPackages = true;
</programlisting>
<para>
is added to the nix-darwin configuration. This option may become the default
value in the future.
</para>
</note>
</section>
</chapter>

View file

@ -10,6 +10,20 @@ function errorEcho() {
echo $* >&2
}
function setVerboseAndDryRun() {
if [[ -v VERBOSE ]]; then
export VERBOSE_ARG="--verbose"
else
export VERBOSE_ARG=""
fi
if [[ -v DRY_RUN ]] ; then
export DRY_RUN_CMD=echo
else
export DRY_RUN_CMD=""
fi
}
function setWorkDir() {
if [[ ! -v WORK_DIR ]]; then
WORK_DIR="$(mktemp --tmpdir -d home-manager-build.XXXXXXXXXX)"
@ -216,17 +230,7 @@ function doListGens() {
# Removes linked generations. Takes as arguments identifiers of
# generations to remove.
function doRmGenerations() {
if [[ -v VERBOSE ]]; then
export VERBOSE_ARG="--verbose"
else
export VERBOSE_ARG=""
fi
if [[ -v DRY_RUN ]] ; then
export DRY_RUN_CMD=echo
else
export DRY_RUN_CMD=""
fi
setVerboseAndDryRun
pushd "/nix/var/nix/profiles/per-user/$USER" > /dev/null
@ -246,6 +250,11 @@ function doRmGenerations() {
popd > /dev/null
}
function doRmAllGenerations() {
$DRY_RUN_CMD rm $VERBOSE_ARG \
"/nix/var/nix/profiles/per-user/$USER/home-manager"*
}
function doExpireGenerations() {
local profileDir="/nix/var/nix/profiles/per-user/$USER"
@ -347,6 +356,56 @@ function doShowNews() {
fi
}
function doUninstall() {
setVerboseAndDryRun
echo "This will remove Home Manager from your system."
if [[ -v DRY_RUN ]]; then
echo "This is a dry run, nothing will actually be uninstalled."
fi
local confirmation
read -r -n 1 -p "Really uninstall Home Manager? [y/n] " confirmation
echo
case $confirmation in
y|Y)
echo "Switching to empty Home Manager configuration..."
HOME_MANAGER_CONFIG="$(mktemp --tmpdir home-manager.XXXXXXXXXX)"
echo "{}" > "$HOME_MANAGER_CONFIG"
doSwitch
rm "$HOME_MANAGER_CONFIG"
$DRY_RUN_CMD rm $VERBOSE_ARG -r \
"${XDG_DATA_HOME:-$HOME/.local/share}/home-manager"
$DRY_RUN_CMD rm $VERBOSE_ARG \
"/nix/var/nix/gcroots/per-user/$USER/current-home"
;;
*)
echo "Yay!"
exit 0
;;
esac
local deleteProfiles
read -r -n 1 \
-p 'Remove all Home Manager generations? [y/n] ' \
deleteProfiles
echo
case $deleteProfiles in
y|Y)
doRmAllGenerations
echo "All generations are now eligible for garbage collection."
;;
*)
echo "Leaving generations but they may still be garbage collected."
;;
esac
echo "Home Manager is uninstalled but your home.nix is left untouched."
}
function doHelp() {
echo "Usage: $0 [OPTION] COMMAND"
echo
@ -385,6 +444,8 @@ function doHelp() {
echo " packages List all packages installed in home-manager-path"
echo
echo " news Show news entries in a pager"
echo
echo " uninstall Remove Home Manager"
}
EXTRA_NIX_PATH=()
@ -466,6 +527,9 @@ case "$cmd" in
news)
doShowNews --all
;;
uninstall)
doUninstall
;;
help|--help)
doHelp
;;

View file

@ -6,6 +6,7 @@ runCommand
propagatedBuildInputs = [ home-manager ];
preferLocalBuild = true;
allowSubstitutes = false;
shellHookOnly = true;
shellHook = ''
confFile="''${XDG_CONFIG_HOME:-$HOME/.config}/nixpkgs/home.nix"
@ -53,4 +54,7 @@ runCommand
fi
'';
}
""
''
echo This derivation is not buildable, instead run it using nix-shell.
exit 1
''

View file

@ -95,7 +95,7 @@ let
};
port = mkOption {
type = types.nullOr types.ints.positive;
type = types.nullOr types.port;
default = null;
example = 993;
description = ''
@ -125,7 +125,7 @@ let
};
port = mkOption {
type = types.nullOr types.ints.positive;
type = types.nullOr types.port;
default = null;
example = 465;
description = ''

View file

@ -74,8 +74,8 @@ in
function checkNewGenCollision() {
local newGenFiles
newGenFiles="$(readlink -e "$newGenPath/home-files")"
find "$newGenFiles" -type f -print0 -or -type l -print0 \
| xargs -0 bash ${check} "$newGenFiles"
find "$newGenFiles" \( -type f -or -type l \) \
-exec bash ${check} "$newGenFiles" {} +
}
checkNewGenCollision || exit 1
@ -155,8 +155,8 @@ in
local newGenFiles
newGenFiles="$(readlink -e "$newGenPath/home-files")"
find "$newGenFiles" -type f -print0 -or -type l -print0 \
| xargs -0 bash ${link} "$newGenFiles"
find "$newGenFiles" \( -type f -or -type l \) \
-exec bash ${link} "$newGenFiles" {} +
}
function cleanOldGen() {

View file

@ -149,7 +149,7 @@ in
home.sessionVariables = mkOption {
default = {};
type = with types; attrsOf (either int str);
type = types.attrs;
example = { EDITOR = "emacs"; GS_OPTIONS = "-sPAPERSIZE=a4"; };
description = ''
Environment variables to always set at login.
@ -167,19 +167,19 @@ in
variable may have a runtime dependency on another session
variable. In particular code like
<programlisting language="nix">
home.sessionVariables = {
FOO = "Hello";
BAR = "$FOO World!";
};
home.sessionVariables = {
FOO = "Hello";
BAR = "$FOO World!";
};
</programlisting>
may not work as expected. If you need to reference another
session variable, then do so inside Nix instead. The above
example then becomes
<programlisting language="nix">
home.sessionVariables = {
FOO = "Hello";
BAR = "''${config.home.sessionVariables.FOO} World!";
};
home.sessionVariables = {
FOO = "Hello";
BAR = "''${config.home.sessionVariables.FOO} World!";
};
</programlisting>
'';
};
@ -370,7 +370,7 @@ in
+ optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH";
activationScript = pkgs.writeScript "activation-script" ''
#!${pkgs.stdenv.shell}
#!${pkgs.runtimeShell}
set -eu
set -o pipefail

View file

@ -13,9 +13,15 @@ let
let
tweakVal = v:
if isString v then "'${v}'"
else if isList v then "[" + concatMapStringsSep "," tweakVal v + "]"
else if isList v then tweakList v
else if isBool v then (if v then "true" else "false")
else toString v;
# Assume empty list is a list of strings, see #769
tweakList = v:
if v == [] then "@as []"
else "[" + concatMapStringsSep "," tweakVal v + "]";
in
"${key}=${tweakVal value}";

View file

@ -82,8 +82,7 @@ in
<programlisting language="nix">
nixpkgs.config = import ./nixpkgs-config.nix;
xdg.configFile."nixpkgs/config.nix".source =
./nixpkgs-config.nix;
xdg.configFile."nixpkgs/config.nix".source = ./nixpkgs-config.nix;
</programlisting>
in your Home Manager configuration.

View file

@ -14,7 +14,7 @@ in
options = {
pam.sessionVariables = mkOption {
default = {};
type = with types; attrsOf (either int str);
type = types.attrs;
example = { EDITOR = "vim"; };
description = ''
Environment variables that will be set for the PAM session.

View file

@ -41,10 +41,13 @@ in
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.alacritty ];
config = mkMerge [
(mkIf cfg.enable {
home.packages = [ pkgs.alacritty ];
xdg.configFile."alacritty/alacritty.yml".text =
replaceStrings ["\\\\"] ["\\"] (builtins.toJSON cfg.settings);
};
xdg.configFile."alacritty/alacritty.yml" = mkIf (cfg.settings != {}) {
text = replaceStrings ["\\\\"] ["\\"] (builtins.toJSON cfg.settings);
};
})
];
}

View file

@ -36,11 +36,10 @@ let
boolStr (signature.showSignature == "attach");
}
)
++ [ alot.extraConfig ]
++ [ "[[[abook]]]" ]
++ mapAttrsToList (n: v: n + "=" + v) alot.contactCompletion
)
+ "\n"
+ alot.extraConfig;
);
configFile =
let

View file

@ -72,7 +72,7 @@ in
sessionVariables = mkOption {
default = {};
type = with types; attrsOf (either int str);
type = types.attrs;
example = { MAILCHECK = 30; };
description = ''
Environment variables that will be set for the Bash session.

View file

@ -36,7 +36,11 @@ in
default = self: [];
defaultText = "epkgs: []";
example = literalExample "epkgs: [ epkgs.emms epkgs.magit ]";
description = "Extra packages available to Emacs.";
description = ''
Extra packages available to Emacs. To get a list of
available packages run:
<command>nix-env -f '&lt;nixpkgs&gt;' -qaP -A emacsPackagesNg</command>.
'';
};
overrides = mkOption {

View file

@ -49,13 +49,33 @@ in
enableGoogleTalk = mkOption {
type = types.bool;
default = false;
description = "Whether to enable the unfree Google Talk plugin.";
description = ''
Whether to enable the unfree Google Talk plugin. This option
is <emphasis>deprecated</emphasis> and will only work if
<programlisting language="nix">
programs.firefox.package = pkgs.firefox-esr-52-unwrapped;
</programlisting>
and the <option>plugin.load_flash_only</option> Firefox
option has been disabled.
'';
};
enableIcedTea = mkOption {
type = types.bool;
default = false;
description = "Whether to enable the Java applet plugin.";
description = ''
Whether to enable the Java applet plugin. This option is
<emphasis>deprecated</emphasis> and will only work if
<programlisting language="nix">
programs.firefox.package = pkgs.firefox-esr-52-unwrapped;
</programlisting>
and the <option>plugin.load_flash_only</option> Firefox
option has been disabled.
'';
};
};
};

View file

@ -101,7 +101,7 @@ let
};
port = mkOption {
type = types.int;
type = types.port;
default = 6667;
description = "Port of the chat server.";
};

View file

@ -20,7 +20,7 @@ let
}
//
optionalAttrs (tls.enable && tls.certificatesFile != null) {
CertificateFile = tls.certificatesFile;
CertificateFile = toString tls.certificatesFile;
};
masterSlaveMapping = {
@ -173,9 +173,9 @@ in
in
concatStringsSep "\n" (
[ "# Generated by Home Manager.\n" ]
++ optional (cfg.extraConfig != "") cfg.extraConfig
++ accountsConfig
++ groupsConfig
++ optional (cfg.extraConfig != "") cfg.extraConfig
) + "\n";
home.activation.createMaildir =

View file

@ -188,7 +188,7 @@ in
{
target = "${notmuchIni.database.path}/.notmuch/hooks/${name}";
source = pkgs.writeScript name ''
#!${pkgs.stdenv.shell}
#!${pkgs.runtimeShell}
export PATH="${pkgs.notmuch}/bin''${PATH:+:}$PATH"
export NOTMUCH_CONFIG="${config.xdg.configHome}/notmuch/notmuchrc"

View file

@ -270,7 +270,7 @@ in
theme = mkOption {
default = null;
type = with types; nullOr (either string path);
type = with types; nullOr (either str path);
example = "Arc";
description = ''
Name of theme or path to theme file in rasi format. Available

View file

@ -107,7 +107,7 @@ in
SKIM_CTRL_T_COMMAND = cfg.fileWidgetCommand;
SKIM_CTRL_T_OPTS = cfg.fileWidgetOptions;
SKIM_DEFAULT_COMMAND = cfg.defaultCommand;
SKIM_DEFAULT_OPTS = cfg.defaultOptions;
SKIM_DEFAULT_OPTIONS = cfg.defaultOptions;
}
);

View file

@ -21,7 +21,7 @@ let
};
port = mkOption {
type = types.nullOr types.int;
type = types.nullOr types.port;
default = null;
description = "Specifies port number to connect on remote host.";
};

View file

@ -6,6 +6,12 @@ let
cfg = config.programs.vscode;
configFilePath =
if pkgs.stdenv.hostPlatform.isDarwin then
"Library/Application Support/Code/User/settings.json"
else
"${config.xdg.configHome}/Code/User/settings.json";
in
{
@ -23,14 +29,15 @@ in
}
'';
description = ''
Configuration written to
<filename>~/.config/Code/User/settings.json</filename>.
Configuration written to Visual Studio Code's
<filename>settings.json</filename>.
'';
};
extensions = mkOption {
type = types.listOf types.package;
default = [];
example = literalExample "[ pkgs.vscode-extensions.bbenoist.Nix ]";
description = ''
The extensions Visual Studio Code should be started with.
These will override but not delete manually installed ones.
@ -46,7 +53,6 @@ in
})
];
xdg.configFile."Code/User/settings.json".text =
builtins.toJSON cfg.userSettings;
home.file."${configFilePath}".text = builtins.toJSON cfg.userSettings;
};
}

View file

@ -202,7 +202,7 @@ in
sessionVariables = mkOption {
default = {};
type = with types; attrsOf (either int str);
type = types.attrs;
example = { MAILCHECK = 30; };
description = "Environment variables that will be set for zsh session.";
};
@ -294,7 +294,7 @@ in
(mkIf cfg.oh-my-zsh.enable {
home.file."${relToDotDir ".zshenv"}".text = ''
ZSH="${pkgs.oh-my-zsh}/share/oh-my-zsh";
ZSH_CACHE_DIR="''${XDG_CACHE_HOME:-''$HOME/.cache}/oh-my-zsh";
ZSH_CACHE_DIR="${config.xdg.cacheHome}/oh-my-zsh";
'';
})
@ -338,7 +338,13 @@ in
fpath+="$HOME/${pluginsDir}/${plugin.name}"
'') cfg.plugins)}
${optionalString cfg.enableCompletion "autoload -U compinit && compinit"}
# Oh-My-Zsh calls compinit during initialization,
# calling it twice causes sight start up slowdown
# as all $fpath entries will be traversed again.
${optionalString (cfg.enableCompletion && !cfg.oh-my-zsh.enable)
"autoload -U compinit && compinit"
}
${optionalString cfg.enableAutosuggestions
"source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
}
@ -387,10 +393,9 @@ in
}
(mkIf cfg.oh-my-zsh.enable {
# Oh-My-Zsh calls compinit during initialization,
# calling it twice causes sight start up slowdown
# as all $fpath entries will be traversed again.
programs.zsh.enableCompletion = mkForce false;
# Make sure we create a cache directory since some plugins expect it to exist
# See: https://github.com/rycee/home-manager/issues/761
home.file."${config.xdg.cacheHome}/oh-my-zsh/.keep".text = "";
})
(mkIf (cfg.plugins != []) {

View file

@ -35,7 +35,7 @@ in
};
Service = {
ExecStart = "${pkgs.stdenv.shell} -l -c 'exec ${emacsBinPath}/emacs --fg-daemon'";
ExecStart = "${pkgs.runtimeShell} -l -c 'exec ${emacsBinPath}/emacs --fg-daemon'";
ExecStop = "${emacsBinPath}/emacsclient --eval '(kill-emacs)'";
Restart = "on-failure";
};

View file

@ -23,7 +23,7 @@ in
systemd.user.services.flameshot = {
Unit = {
Description = "Powerful yet simple to use screenshot software";
Description = "Flameshot screenshot tool";
After = [
"graphical-session-pre.target"
"polybar.service"

View file

@ -71,7 +71,7 @@ in
postExec = mkOption {
type = types.nullOr types.str;
default = null;
example = "mu index";
example = "\${pkgs.mu}/bin/mu index";
description = ''
An optional command to run after mbsync executes successfully.
This is useful for running mailbox indexing tools.

View file

@ -46,6 +46,7 @@ in {
type = types.path;
default = "${config.home.homeDirectory}/music";
defaultText = "$HOME/music";
apply = toString; # Prevent copies to Nix store.
description = ''
The directory where mpd reads music from.
'';
@ -55,6 +56,7 @@ in {
type = types.path;
default = "${cfg.dataDir}/playlists";
defaultText = ''''${dataDir}/playlists'';
apply = toString; # Prevent copies to Nix store.
description = ''
The directory where mpd stores playlists.
'';
@ -79,6 +81,7 @@ in {
type = types.path;
default = "${config.xdg.dataHome}/${name}";
defaultText = "$XDG_DATA_HOME/mpd";
apply = toString; # Prevent copies to Nix store.
description = ''
The directory where MPD stores its state, tag cache,
playlists etc.
@ -98,7 +101,7 @@ in {
};
port = mkOption {
type = types.ints.positive;
type = types.port;
default = 6600;
description = ''
The TCP port on which the the daemon will listen.

View file

@ -56,7 +56,7 @@ in
};
port = mkOption {
type = types.ints.positive;
type = types.port;
default = config.services.mpd.network.port;
defaultText = "config.services.mpd.network.port";
description = ''

View file

@ -19,24 +19,24 @@ in
config = mkIf cfg.enable {
systemd.user.services.network-manager-applet = {
Unit = {
Description = "Network Manager applet";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Unit = {
Description = "Network Manager applet";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Service = {
ExecStart = toString (
[
"${pkgs.networkmanagerapplet}/bin/nm-applet"
"--sm-disable"
] ++ optional config.xsession.preferStatusNotifierItems "--indicator"
);
};
Service = {
ExecStart = toString (
[
"${pkgs.networkmanagerapplet}/bin/nm-applet"
"--sm-disable"
] ++ optional config.xsession.preferStatusNotifierItems "--indicator"
);
};
};
};
}

View file

@ -131,6 +131,7 @@ in
scriptPkg = pkgs.writeShellScriptBin "polybar-start" cfg.script;
in
"${scriptPkg}/bin/polybar-start";
Restart = "on-failure";
};
Install = {

View file

@ -123,6 +123,18 @@ in
};
config = mkIf cfg.enable {
assertions = [
{
assertion =
cfg.provider == "manual"
-> cfg.latitude != null && cfg.longitude != null;
message =
"Must provide services.redshift.latitude and"
+ " services.redshift.latitude when"
+ " services.redshift.provider is set to \"manual\".";
}
];
systemd.user.services.redshift = {
Unit = {
Description = "Redshift colour temperature adjuster";

View file

@ -58,13 +58,12 @@ in {
};
Service = {
ExecStart = ''
${pkgs.xautolock}/bin/xautolock \
-detectsleep \
-time ${toString cfg.inactiveInterval} \
-locker '${pkgs.systemd}/bin/loginctl lock-session $XDG_SESSION_ID' \
${concatStringsSep " " cfg.xautolockExtraOptions}
'';
ExecStart = concatStringsSep " " ([
"${pkgs.xautolock}/bin/xautolock"
"-detectsleep"
"-time ${toString cfg.inactiveInterval}"
"-locker '${pkgs.systemd}/bin/loginctl lock-session $XDG_SESSION_ID'"
] ++ cfg.xautolockExtraOptions);
};
};

View file

@ -76,7 +76,7 @@ def get_services(dir)
end
def get_service_files(dir)
Dir.chdir(dir) { Dir['*.service'] }
Dir.chdir(dir) { Dir['*.{service,socket}'] }
end
def get_changed_services(dir_a, dir_b, services)

View file

@ -81,15 +81,17 @@ let
unitExample = type: literalExample ''
{
Unit = {
Description = "Example description";
Documentation = [ "man:example(1)" "man:example(5)" ];
};
${toLower type}-name = {
Unit = {
Description = "Example description";
Documentation = [ "man:example(1)" "man:example(5)" ];
};
${type} = {
};
}
${type} = {
};
}
};
'';
sessionVariables = mkIf (cfg.sessionVariables != {}) {

View file

@ -81,6 +81,7 @@ in
Service = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart =
let
args = concatStringsSep " " (
@ -109,7 +110,7 @@ in
home.file.".xprofile".text = ''
. "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh"
if [[ -e "$HOME/.profile" ]]; then
if [ -e "$HOME/.profile" ]; then
. "$HOME/.profile"
fi
@ -134,7 +135,7 @@ in
home.file.${cfg.scriptPath} = {
executable = true;
text = ''
if [[ ! -v HM_XPROFILE_SOURCED ]]; then
if [ -z "$HM_XPROFILE_SOURCED" ]; then
. ~/.xprofile
fi
unset HM_XPROFILE_SOURCED
@ -149,7 +150,7 @@ in
systemctl --user stop graphical-session-pre.target
# Wait until the units actually stop.
while [[ -n "$(systemctl --user --no-legend --state=deactivating list-units)" ]]; do
while [ -n "$(systemctl --user --no-legend --state=deactivating list-units)" ]; do
sleep 0.5
done
'';

View file

@ -39,6 +39,29 @@ in
};
config = mkIf (cfg.users != {}) {
warnings =
flatten (flip mapAttrsToList cfg.users (user: config:
flip map config.warnings (warning:
"${user} profile: ${warning}"
)
));
assertions =
flatten (flip mapAttrsToList cfg.users (user: config:
flip map config.assertions (assertion:
{
inherit (assertion) assertion;
message = "${user} profile: ${assertion.message}";
}
)
));
users.users = mkIf cfg.useUserPackages (
mapAttrs (username: usercfg: {
packages = usercfg.home.packages;
}) cfg.users
);
system.activationScripts.postActivation.text =
concatStringsSep "\n" (mapAttrsToList (username: usercfg: ''
echo Activating home-manager configuration for ${username}

View file

@ -44,6 +44,13 @@ in
};
config = mkIf (cfg.users != {}) {
warnings =
flatten (flip mapAttrsToList cfg.users (user: config:
flip map config.warnings (warning:
"${user} profile: ${warning}"
)
));
assertions =
flatten (flip mapAttrsToList cfg.users (user: config:
flip map config.assertions (assertion:
@ -60,28 +67,31 @@ in
}) cfg.users
);
systemd.services = mapAttrs' (username: usercfg:
nameValuePair ("home-manager-${utils.escapeSystemdPath username}") {
description = "Home Manager environment for ${username}";
wantedBy = [ "multi-user.target" ];
wants = [ "nix-daemon.socket" ];
after = [ "nix-daemon.socket" ];
systemd.services = mapAttrs' (_: usercfg:
let
username = usercfg.home.username;
in
nameValuePair ("home-manager-${utils.escapeSystemdPath username}") {
description = "Home Manager environment for ${username}";
wantedBy = [ "multi-user.target" ];
wants = [ "nix-daemon.socket" ];
after = [ "nix-daemon.socket" ];
serviceConfig = {
User = usercfg.home.username;
Type = "oneshot";
RemainAfterExit = "yes";
SyslogIdentifier = "hm-activate-${username}";
serviceConfig = {
User = usercfg.home.username;
Type = "oneshot";
RemainAfterExit = "yes";
SyslogIdentifier = "hm-activate-${username}";
# The activation script is run by a login shell to make sure
# that the user is given a sane Nix environment.
ExecStart = pkgs.writeScript "activate-${username}" ''
#! ${pkgs.stdenv.shell} -el
echo Activating home-manager configuration for ${username}
exec ${usercfg.home.activationPackage}/activate
'';
};
}
# The activation script is run by a login shell to make sure
# that the user is given a sane Nix environment.
ExecStart = pkgs.writeScript "activate-${username}" ''
#! ${pkgs.runtimeShell} -el
echo Activating home-manager configuration for ${username}
exec ${usercfg.home.activationPackage}/activate
'';
};
}
) cfg.users;
};
}

View file

@ -5,8 +5,8 @@ let
nmt = pkgs.fetchFromGitLab {
owner = "rycee";
repo = "nmt";
rev = "b6ab61e707ec1ca3839fef42f9960a1179d543c4";
sha256 = "097fm1hmsyhy8chf73wwrvafcxny37414fna3haxf0q5fvpv4jfb";
rev = "89fb12a2aaa8ec671e22a033162c7738be714305";
sha256 = "07yc1jkgw8vhskzk937k9hfba401q8rn4sgj9baw3fkjl9zrbcyf";
};
in
@ -31,8 +31,13 @@ import nmt {
{
i3-keybindings = ./modules/services/window-managers/i3-keybindings.nix;
}
// import ./modules/misc/pam
// import ./modules/systemd
)
// import ./modules/home-environment
// import ./modules/programs/alacritty
// import ./modules/programs/bash
// import ./modules/programs/ssh
// import ./modules/programs/tmux;
// import ./modules/programs/tmux
// import ./modules/programs/zsh;
}

View file

@ -0,0 +1,3 @@
{
home-session-variables = ./session-variables.nix;
}

View file

@ -0,0 +1,6 @@
# Only source this once.
if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi
export __HM_SESS_VARS_SOURCED=1
export V1="v1"
export V2="v2-v1"

View file

@ -0,0 +1,19 @@
{ config, lib, ... }:
with lib;
{
config = {
home.sessionVariables = {
V1 = "v1";
V2 = "v2-${config.home.sessionVariables.V1}";
};
nmt.script = ''
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
assertFileContent \
home-path/etc/profile.d/hm-session-vars.sh \
${./session-variables-expected.txt}
'';
};
}

View file

@ -0,0 +1,3 @@
{
pam-session-variables = ./session-variables.nix;
}

View file

@ -0,0 +1,2 @@
V1 OVERRIDE="v1"
V2 OVERRIDE="v2-v1"

View file

@ -0,0 +1,19 @@
{ config, lib, ... }:
with lib;
{
config = {
pam.sessionVariables = {
V1 = "v1";
V2 = "v2-${config.pam.sessionVariables.V1}";
};
nmt.script = ''
assertFileExists home-files/.pam_environment
assertFileContent \
home-files/.pam_environment \
${./session-variables-expected.txt}
'';
};
}

View file

@ -0,0 +1,4 @@
{
alacritty-example-settings = ./example-settings.nix;
alacritty-empty-settings = ./empty-settings.nix;
}

View file

@ -0,0 +1,13 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
programs.alacritty.enable = true;
nmt.script = ''
assertPathNotExists home-files/.config/alacritty
'';
};
}

View file

@ -0,0 +1 @@
{"key_bindings":[{"chars":"\x0c","key":"K","mods":"Control"}],"window":{"dimensions":{"columns":200,"lines":3}}}

View file

@ -0,0 +1,32 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
programs.alacritty = {
enable = true;
settings = {
window.dimensions = {
lines = 3;
columns = 200;
};
key_bindings = [
{
key = "K";
mods = "Control";
chars = "\\x0c";
}
];
};
};
nmt.script = ''
assertFileContent \
home-files/.config/alacritty/alacritty.yml \
${./example-settings-expected.yml}
'';
};
}

View file

@ -0,0 +1,3 @@
{
bash-session-variables = ./session-variables.nix;
}

View file

@ -0,0 +1,8 @@
# -*- mode: sh -*-
. "@homeDirectory@/.nix-profile/etc/profile.d/hm-session-vars.sh"
export V1="v1"
export V2="v2-v1"

View file

@ -0,0 +1,28 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
programs.bash = {
enable = true;
sessionVariables = {
V1 = "v1";
V2 = "v2-${config.programs.bash.sessionVariables.V1}";
};
};
nmt.script = ''
assertFileExists home-files/.profile
assertFileContent \
home-files/.profile \
${
pkgs.substituteAll {
src = ./session-variables-expected.txt;
inherit (config.home) homeDirectory;
}
}
'';
};
}

View file

@ -7,7 +7,7 @@ with lib;
programs.tmux = { enable = false; };
nmt.script = ''
assertFileNotExists home-files/.tmux.conf
assertPathNotExists home-files/.tmux.conf
'';
};
}

View file

@ -0,0 +1,3 @@
{
zsh-session-variables = ./session-variables.nix;
}

View file

@ -0,0 +1,22 @@
{ config, lib, ... }:
with lib;
{
config = {
programs.zsh = {
enable = true;
sessionVariables = {
V1 = "v1";
V2 = "v2-${config.programs.zsh.sessionVariables.V1}";
};
};
nmt.script = ''
assertFileExists home-files/.zshrc
assertFileRegex home-files/.zshrc 'export V1="v1"'
assertFileRegex home-files/.zshrc 'export V2="v2-v1"'
'';
};
}