Compare commits
41 commits
master
...
release-19
Author | SHA1 | Date | |
---|---|---|---|
ef64bc598f | |||
8def383511 | |||
c13c1b33d9 | |||
d74320012e | |||
aa2f70def7 | |||
76ba4bedff | |||
46eaee3262 | |||
f8187816a4 | |||
f9ac2671bb | |||
2307cb280a | |||
14c5a22cfb | |||
0f85326dee | |||
35d31c390d | |||
176e82ee1c | |||
634a909ddc | |||
33c6230dac | |||
1d8b6e7d9e | |||
cf5e08cfb8 | |||
45a73067ac | |||
ef906c5a92 | |||
bb18d4c746 | |||
6d5246f49f | |||
5d054abe6a | |||
a85f22164d | |||
dd6d8e278b | |||
9291923e84 | |||
b8bbd242f8 | |||
413ac52bed | |||
4f13f06b01 | |||
d714740961 | |||
81d600d948 | |||
3daa1da497 | |||
41d2a16f99 | |||
24b734500f | |||
de9fc235d0 | |||
14a0dce9e8 | |||
ef78cae6a4 | |||
e3c4ec12cc | |||
f73c6ed74f | |||
de0dae5666 | |||
162a65f029 |
|
@ -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
|
||||
|
|
|
@ -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 = [ <home-manager/nix-darwin> ];
|
||||
</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>
|
||||
|
|
|
@ -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
|
||||
;;
|
||||
|
|
|
@ -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
|
||||
''
|
||||
|
|
|
@ -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 = ''
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}";
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
@ -36,11 +36,10 @@ let
|
|||
boolStr (signature.showSignature == "attach");
|
||||
}
|
||||
)
|
||||
++ [ alot.extraConfig ]
|
||||
++ [ "[[[abook]]]" ]
|
||||
++ mapAttrsToList (n: v: n + "=" + v) alot.contactCompletion
|
||||
)
|
||||
+ "\n"
|
||||
+ alot.extraConfig;
|
||||
);
|
||||
|
||||
configFile =
|
||||
let
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 '<nixpkgs>' -qaP -A emacsPackagesNg</command>.
|
||||
'';
|
||||
};
|
||||
|
||||
overrides = mkOption {
|
||||
|
|
|
@ -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.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -101,7 +101,7 @@ let
|
|||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.int;
|
||||
type = types.port;
|
||||
default = 6667;
|
||||
description = "Port of the chat server.";
|
||||
};
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -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.";
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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 != []) {
|
||||
|
|
|
@ -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";
|
||||
};
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 = ''
|
||||
|
|
|
@ -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"
|
||||
);
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -131,6 +131,7 @@ in
|
|||
scriptPkg = pkgs.writeShellScriptBin "polybar-start" cfg.script;
|
||||
in
|
||||
"${scriptPkg}/bin/polybar-start";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
|
||||
Install = {
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 != {}) {
|
||||
|
|
|
@ -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
|
||||
'';
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
3
tests/modules/home-environment/default.nix
Normal file
3
tests/modules/home-environment/default.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
home-session-variables = ./session-variables.nix;
|
||||
}
|
|
@ -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"
|
19
tests/modules/home-environment/session-variables.nix
Normal file
19
tests/modules/home-environment/session-variables.nix
Normal 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}
|
||||
'';
|
||||
};
|
||||
}
|
3
tests/modules/misc/pam/default.nix
Normal file
3
tests/modules/misc/pam/default.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
pam-session-variables = ./session-variables.nix;
|
||||
}
|
2
tests/modules/misc/pam/session-variables-expected.txt
Normal file
2
tests/modules/misc/pam/session-variables-expected.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
V1 OVERRIDE="v1"
|
||||
V2 OVERRIDE="v2-v1"
|
19
tests/modules/misc/pam/session-variables.nix
Normal file
19
tests/modules/misc/pam/session-variables.nix
Normal 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}
|
||||
'';
|
||||
};
|
||||
}
|
4
tests/modules/programs/alacritty/default.nix
Normal file
4
tests/modules/programs/alacritty/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
alacritty-example-settings = ./example-settings.nix;
|
||||
alacritty-empty-settings = ./empty-settings.nix;
|
||||
}
|
13
tests/modules/programs/alacritty/empty-settings.nix
Normal file
13
tests/modules/programs/alacritty/empty-settings.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.alacritty.enable = true;
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/alacritty
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
{"key_bindings":[{"chars":"\x0c","key":"K","mods":"Control"}],"window":{"dimensions":{"columns":200,"lines":3}}}
|
32
tests/modules/programs/alacritty/example-settings.nix
Normal file
32
tests/modules/programs/alacritty/example-settings.nix
Normal 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}
|
||||
'';
|
||||
};
|
||||
}
|
3
tests/modules/programs/bash/default.nix
Normal file
3
tests/modules/programs/bash/default.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
bash-session-variables = ./session-variables.nix;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: sh -*-
|
||||
|
||||
. "@homeDirectory@/.nix-profile/etc/profile.d/hm-session-vars.sh"
|
||||
|
||||
export V1="v1"
|
||||
export V2="v2-v1"
|
||||
|
||||
|
28
tests/modules/programs/bash/session-variables.nix
Normal file
28
tests/modules/programs/bash/session-variables.nix
Normal 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;
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -7,7 +7,7 @@ with lib;
|
|||
programs.tmux = { enable = false; };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileNotExists home-files/.tmux.conf
|
||||
assertPathNotExists home-files/.tmux.conf
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
3
tests/modules/programs/zsh/default.nix
Normal file
3
tests/modules/programs/zsh/default.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
zsh-session-variables = ./session-variables.nix;
|
||||
}
|
22
tests/modules/programs/zsh/session-variables.nix
Normal file
22
tests/modules/programs/zsh/session-variables.nix
Normal 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"'
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue