aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/default.nix1
-rw-r--r--modules/services/default.nix44
-rw-r--r--modules/sway/default.nix36
3 files changed, 63 insertions, 18 deletions
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 = {
"*" = {