aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/default.nix2
-rw-r--r--modules/global.nix1
-rw-r--r--modules/services/default.nix34
-rw-r--r--modules/zsh.nix27
-rw-r--r--modules/zsh/default.nix41
-rw-r--r--modules/zsh/themes/stefan.zsh-theme9
6 files changed, 82 insertions, 32 deletions
diff --git a/modules/default.nix b/modules/default.nix
index f924c45..a0510dc 100644
--- a/modules/default.nix
+++ b/modules/default.nix
@@ -4,7 +4,7 @@
./foot.nix
./mako.nix
./neovide.nix
- ./zsh.nix
+ ./zsh
./sway
./neovim
./qutebrowser
diff --git a/modules/global.nix b/modules/global.nix
index 5565476..adedc50 100644
--- a/modules/global.nix
+++ b/modules/global.nix
@@ -31,6 +31,7 @@ in
qutebrowser = {
wrapWithNixGL = cfg.notNixOS;
};
+ zsh.enable = true;
};
nixGL = lib.mkIf cfg.notNixOS {
diff --git a/modules/services/default.nix b/modules/services/default.nix
index 7409c59..b0d9d9a 100644
--- a/modules/services/default.nix
+++ b/modules/services/default.nix
@@ -3,11 +3,16 @@ let
cfg = config.modules.services;
inherit (lib) mkOption types listOf;
- runFile = name: value: {
+ mkService = name: value: {
${"service/" + name + "/run"} = {
text = value.run;
executable = true;
};
+ ${"service/" + name + "/log/run"} = {
+ enable = value.log != "";
+ text = value.log;
+ executable = true;
+ };
};
in
{
@@ -20,6 +25,12 @@ in
default = false;
description = "Whether to enable the user service manager module.";
};
+ coreServices = mkOption {
+ type = types.listOf types.str;
+ description = "List of services to start first";
+ example = [ "dbus" ];
+ default = [];
+ };
services = mkOption {
description = "List of user services to run on login";
type = types.attrsOf (types.submodule {
@@ -27,18 +38,33 @@ in
run = mkOption {
type = types.str;
description = "The 'run' script for the service";
- example = ''
- #!/bin/sh
+ example =
+ ''#!/bin/sh
exec chpst -e "$TURNSTILE_ENV_DIR" foo
'';
};
+ log = mkOption {
+ type = types.nullOr types.str;
+ description = "The log/run script for the service. A pipe is opened from the output of the 'run' process to this script";
+ example =
+ ''#!/bin/sh
+
+ exec vlogger -t dbus-$(id -u) -p daemon
+ '';
+ default = "";
+ };
};
});
};
};
config = lib.mkIf cfg.enable {
- xdg.configFile = (lib.concatMapAttrs runFile cfg.services);
+ xdg.configFile = (lib.concatMapAttrs mkService cfg.services)
+ // {
+ "service/turnstile-ready/conf" = {
+ text = ''core_services="${lib.strings.concatStringsSep " " cfg.coreServices}'';
+ };
+ };
};
}
diff --git a/modules/zsh.nix b/modules/zsh.nix
deleted file mode 100644
index 5085263..0000000
--- a/modules/zsh.nix
+++ /dev/null
@@ -1,27 +0,0 @@
-{ config, lib, pkgs, ... }:
-let
- cfg = config.modules.zsh;
-in
-{
- options.modules.zsh = {
- enable = lib.mkEnableOption "zsh";
- };
-
- config = {
- home.packages = with pkgs; [
- zsh
- oh-my-zsh
- zsh-autosuggestions
- ];
-
- programs.zsh = lib.mkIf cfg.enable {
- enable = true;
- enableCompletion = true;
- autosuggestion.enable = true;
- oh-my-zsh = {
- enable = true;
- theme = "lambda";
- };
- };
- };
-}
diff --git a/modules/zsh/default.nix b/modules/zsh/default.nix
new file mode 100644
index 0000000..b1ed82e
--- /dev/null
+++ b/modules/zsh/default.nix
@@ -0,0 +1,41 @@
+{ config, lib, pkgs, ... }:
+let
+ cfg = config.modules.zsh;
+
+ inherit (lib) mkEnableOption mkOption mkIf types;
+in
+{
+ options.modules.zsh = {
+ enable = mkEnableOption "zsh";
+ theme = mkOption {
+ type = types.str;
+ description = "name of zsh theme to apply";
+ default = "stefan";
+ };
+ };
+
+ config = mkIf cfg.enable {
+ home.packages = with pkgs; [
+ zsh
+ oh-my-zsh
+ zsh-autosuggestions
+ ];
+
+ home.file.".oh-my-zsh/themes" = {
+ source = ./themes;
+ recursive = true;
+ };
+
+ programs.zsh = {
+ enable = true;
+ enableCompletion = true;
+ autosuggestion.enable = true;
+ oh-my-zsh = {
+ enable = true;
+ };
+ initExtra = ''
+ source ~/.oh-my-zsh/themes/${cfg.theme}.zsh-theme
+ '';
+ };
+ };
+}
diff --git a/modules/zsh/themes/stefan.zsh-theme b/modules/zsh/themes/stefan.zsh-theme
new file mode 100644
index 0000000..4d71d9c
--- /dev/null
+++ b/modules/zsh/themes/stefan.zsh-theme
@@ -0,0 +1,9 @@
+function virtualenv_info {
+ [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
+}
+
+NEWLINE=$'\n'
+PROMPT="%F{magenta}%~% %f% %F{yellow}% ${NEWLINE}λ %b%f%"
+RPROMPT='$(virtualenv_info)% $(git_prompt_info)'
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"