aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--modules/default.nix1
-rw-r--r--modules/services/default.nix44
-rw-r--r--modules/sway/default.nix36
-rw-r--r--void/home.nix12
-rwxr-xr-xvoid/services/mpd/run3
-rwxr-xr-xvoid/services/pipewire/run3
7 files changed, 82 insertions, 19 deletions
diff --git a/README.md b/README.md
index 465cb57..a2baae6 100644
--- a/README.md
+++ b/README.md
@@ -22,5 +22,5 @@ nixos and home-manager configurations for various systems
* os: Void Linux
* hosts: Framework Laptop 13 (AMD), 51nb x2100
* kernel: [linux-zen](https://github.com/zen-kernel/zen-kernel/releases)
- * prerequisites: pipewire, session manager, drivers
+ * prerequisites: pipewire, session manager, drivers, [turnstile](https://github.com/chimera-linux/turnstile)
* `home-manager switch --impure --flake ~/home#void` (impure to pass env to [nixGL](https://github.com/nix-community/nixGL)
diff --git a/modules/default.nix b/modules/default.nix
index 3998fc1..f924c45 100644
--- a/modules/default.nix
+++ b/modules/default.nix
@@ -8,5 +8,6 @@
./sway
./neovim
./qutebrowser
+ ./services
];
}
diff --git a/modules/services/default.nix b/modules/services/default.nix
new file mode 100644
index 0000000..7409c59
--- /dev/null
+++ b/modules/services/default.nix
@@ -0,0 +1,44 @@
+{ self, config, lib, pkgs, nixgl, ... }:
+let
+ cfg = config.modules.services;
+
+ inherit (lib) mkOption types listOf;
+ runFile = name: value: {
+ ${"service/" + name + "/run"} = {
+ text = value.run;
+ executable = true;
+ };
+ };
+in
+{
+ options.modules.services = {
+ name = mkOption {
+ type = types.string;
+ };
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable the user service manager module.";
+ };
+ services = mkOption {
+ description = "List of user services to run on login";
+ type = types.attrsOf (types.submodule {
+ options = {
+ run = mkOption {
+ type = types.str;
+ description = "The 'run' script for the service";
+ example = ''
+ #!/bin/sh
+
+ exec chpst -e "$TURNSTILE_ENV_DIR" foo
+ '';
+ };
+ };
+ });
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ xdg.configFile = (lib.concatMapAttrs runFile cfg.services);
+ };
+}
diff --git a/modules/sway/default.nix b/modules/sway/default.nix
index 55ef601..5d81354 100644
--- a/modules/sway/default.nix
+++ b/modules/sway/default.nix
@@ -5,10 +5,25 @@ in
{
options.modules.sway = {
enable = lib.mkEnableOption "sway";
- wrapWithNixGL = lib.mkEnableOption "NixGL wrapper";
+ wrapWithNixGL = lib.mkEnableOption "NixGL wrapper.";
terminal = lib.mkOption {
type = lib.types.str;
- description = "terminal command";
+ description = "Terminal command.";
+ };
+ startup = lib.mkOption {
+ type = lib.types.listOf (lib.types.submodule {
+ command = lib.mkOption {
+ type = lib.types.string;
+ description = "Command to be executed on startup.";
+ };
+ always = lib.mkOption {
+ type = lib.types.bool;
+ default = false;
+ description = "Whether to run command on each restart";
+ };
+ });
+ default = [ ];
+ description = "List of commands that sway will run on startup. This should be used only for sway specific applications";
};
};
@@ -19,14 +34,6 @@ in
wayland.windowManager.sway = lib.mkIf cfg.enable {
enable = true;
package = if cfg.wrapWithNixGL then config.lib.nixGL.wrap pkgs.sway else pkgs.sway;
-# package = c
-# package = pkgs.sway;
-# package = pkgs.writeShellScriptBin "sway" ''
-# ${pkgs.nixgl.auto.nixGLDefault}/bin/nixGL ${pkgs.sway}/bin/sway
-# '';
-# extraSessionCommands=''
-# source ${pkgs.nixgl.auto.nixGLDefault}/bin/nixGL
-# '';
config = rec {
modifier = "Mod1";
@@ -236,14 +243,7 @@ in
"--locked XF86MonBrightnessUp" = "exec lightctl -d up";
};
- startup = [
- { command = "foot -s"; }
- { command = "wayneko --layer bottom --follow-pointer true --background-colour 0xcacaca --outline-colour 0x0f0f0f"; }
-# { command = "pipewire"; always = true; } # TODO need to fix this instead of running a new session every time
-# { command = "mpd"; }
-# { command = "mpdscribble"; }
-# { command = "avizo-service"; } # disable if on nixos or systemd
- ];
+ startup = cfg.startup;
seat = {
"*" = {
diff --git a/void/home.nix b/void/home.nix
index 78f05fc..50fdb4a 100644
--- a/void/home.nix
+++ b/void/home.nix
@@ -29,5 +29,17 @@
mako.enable = true;
neovide.enable = true;
+
+ services = {
+ enable = true;
+ services = {
+ "pipewire" = {
+ run = "${builtins.readFile ./services/pipewire/run}";
+ };
+ "mpd" = {
+ run = "${builtins.readFile ./services/mpd/run}";
+ };
+ };
+ };
};
}
diff --git a/void/services/mpd/run b/void/services/mpd/run
new file mode 100755
index 0000000..d0c23db
--- /dev/null
+++ b/void/services/mpd/run
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec chpst -e "$TURNSTILE_ENV_DIR" mpd
diff --git a/void/services/pipewire/run b/void/services/pipewire/run
new file mode 100755
index 0000000..1de4c3b
--- /dev/null
+++ b/void/services/pipewire/run
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec chpst -e "$TURNSTILE_ENV_DIR" pipewire