From 32bf78aa36ed89204eadf8e4f43d1f2aad7d7961 Mon Sep 17 00:00:00 2001 From: Gerg-L Date: Mon, 20 Feb 2023 21:56:14 -0500 Subject: [PATCH] moved systems to their own folders reworked sxhkd moved images to /misc --- flake.nix | 6 +- imports/boot.nix | 2 +- imports/dwm.nix | 4 +- imports/gnome.nix | 2 +- imports/shells.nix | 1 - imports/sxhkd.nix | 31 ------- imports/xfce.nix | 2 +- {images => misc}/nixos.png | Bin {images => misc}/recursion.png | Bin modules/sxhkd.nix | 87 +++++++++--------- .../{laptop.nix => game-laptop/default.nix} | 1 - .../{desktop.nix => gerg-desktop/default.nix} | 30 +++--- systems/{mom.nix => mom-laptop/default.nix} | 0 13 files changed, 66 insertions(+), 100 deletions(-) delete mode 100644 imports/sxhkd.nix rename {images => misc}/nixos.png (100%) rename {images => misc}/recursion.png (100%) rename systems/{laptop.nix => game-laptop/default.nix} (99%) rename systems/{desktop.nix => gerg-desktop/default.nix} (86%) rename systems/{mom.nix => mom-laptop/default.nix} (100%) diff --git a/flake.nix b/flake.nix index ab4ba7e..e91507e 100644 --- a/flake.nix +++ b/flake.nix @@ -59,7 +59,7 @@ (import ./modules inputs) (import ./common.nix inputs) (import ./nix.nix inputs) - (import ./systems/desktop.nix inputs) + (import ./systems/gerg-desktop inputs) { nixpkgs.overlays = [ (import ./pkgs) @@ -81,7 +81,7 @@ (import ./modules inputs) (import ./common.nix inputs) (import ./nix.nix inputs) - (import ./systems/laptop.nix inputs) + (import ./systems/game-laptop inputs) ]; }; moms-laptop = unstable.lib.nixosSystem { @@ -97,7 +97,7 @@ (import ./modules inputs) (import ./common.nix inputs) (import ./nix.nix inputs) - (import ./systems/mom.nix inputs) + (import ./systems/mom-laptop inputs) ]; }; }; diff --git a/imports/boot.nix b/imports/boot.nix index ebc93e2..4bef5e4 100644 --- a/imports/boot.nix +++ b/imports/boot.nix @@ -13,7 +13,7 @@ _: {lib, ...}: { plymouth = { enable = true; theme = "breeze"; - logo = ../images/nixos.png; + logo = ../misc/nixos.png; }; loader = { systemd-boot = { diff --git a/imports/dwm.nix b/imports/dwm.nix index b141e21..e9aa6f7 100644 --- a/imports/dwm.nix +++ b/imports/dwm.nix @@ -18,12 +18,12 @@ }; displayManager = { sessionCommands = '' - feh --bg-scale ${../images/recursion.png} + feh --bg-scale ${../misc/recursion.png} ''; defaultSession = "none+dwm"; lightdm = { enable = true; - background = ../images/recursion.png; + background = ../misc/recursion.png; extraConfig = "minimum-vt=1"; greeters.mini = { enable = true; diff --git a/imports/gnome.nix b/imports/gnome.nix index 1c3717f..28a25b8 100644 --- a/imports/gnome.nix +++ b/imports/gnome.nix @@ -53,7 +53,7 @@ _: { lightdm = { enable = true; extraConfig = "minimum-vt=1"; - background = ../images/recursion.png; + background = ../misc/recursion.png; greeters.mini = { enable = true; user = settings.username; diff --git a/imports/shells.nix b/imports/shells.nix index f4697eb..70e2e69 100644 --- a/imports/shells.nix +++ b/imports/shells.nix @@ -1,5 +1,4 @@ { - nvim-flake, fetch-rs, suckless, ... diff --git a/imports/sxhkd.nix b/imports/sxhkd.nix deleted file mode 100644 index d3a544b..0000000 --- a/imports/sxhkd.nix +++ /dev/null @@ -1,31 +0,0 @@ -_: {pkgs, ...}: { - environment.systemPackages = [ - pkgs.maim #screenshooter - pkgs.brightnessctl #brightness control for laptop - pkgs.playerctl #music control - pkgs.xclip - pkgs.coreutils - ]; - - services.sxhkd = { - enable = true; - keybindings = { - #media keybindings - "XF86AudioPlay" = "playerctl play-pause"; - "XF86AudioPause" = "playerctl play-pause"; - "XF86AudioStop" = "playerctl stop"; - "XF86AudioNext" = "playerctl next"; - "XF86AudioPrev" = "playerctl previous"; - "XF86AudioRaiseVolume" = "amixer sset Master 40+"; - "XF86AudioLowerVolume" = "amixer sset Master 40-"; - "XF86AudioMute" = "amixer sset Master toggle "; - "XF86MonBrightnessUp" = "brightnessctl s 20+"; - "XF86MonBrightnessDown" = "brightnessctl s 20-"; - #screenshot stuff - "Print" = "maim $HOME/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg"; - "Print + shift" = "maim | xclip -selection clipboard -t image/png"; - "super + Print" = "maim -s $HOME/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg"; - "super + Print + shift" = "maim -s | xclip -selection clipboard -t image/png"; - }; - }; -} diff --git a/imports/xfce.nix b/imports/xfce.nix index cd2a7a1..bd6a39c 100644 --- a/imports/xfce.nix +++ b/imports/xfce.nix @@ -21,7 +21,7 @@ _: { lightdm = { enable = true; extraConfig = "minimum-vt=1"; - background = ../images/recursion.png; + background = ../misc/recursion.png; greeters.mini = { enable = true; user = settings.username; diff --git a/images/nixos.png b/misc/nixos.png similarity index 100% rename from images/nixos.png rename to misc/nixos.png diff --git a/images/recursion.png b/misc/recursion.png similarity index 100% rename from images/recursion.png rename to misc/recursion.png diff --git a/modules/sxhkd.nix b/modules/sxhkd.nix index cafd9de..7a87bd8 100644 --- a/modules/sxhkd.nix +++ b/modules/sxhkd.nix @@ -6,61 +6,56 @@ _: { ... }: with lib; let - cfg = config.services.sxhkd; - keybindingsStr = concatStringsSep "\n" (mapAttrsToList (hotkey: command: - optionalString (command != null) '' - ${hotkey} - ${command} - '') - cfg.keybindings); - configFile = pkgs.writeText "sxhkdrc" (concatStringsSep "\n" [keybindingsStr cfg.extraConfig]); + cfg = config.localModules.sxhkd; + keybindingsStr = '' + XF86AudioPlay + playerctl play-pause + XF86AudioPause + playerctl play-pause + XF86AudioStop + playerctl stop + XF86AudioNext + playerctl next + XF86AudioPrev + playerctl previous + XF86AudioRaiseVolume + amixer sset Master 40+ + XF86AudioLowerVolume + amixer sset Master 40- + XF86AudioMute + amixer sset Master toggle + XF86MonBrightnessUp + brightnessctl s 20+ + XF86MonBrightnessDown + brightnessctl s 20- + Print + maim $HOME/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg + Print + shift + maim | xclip -selection clipboard -t image/png + super + Print + maim -s $HOME/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg + super + Print + shift + maim -s | xclip -selection clipboard -t image/png + ''; + configFile = pkgs.writeText "sxhkdrc" keybindingsStr; in { - options.services.sxhkd = { + options.localModules.sxhkd = { enable = mkEnableOption "simple X hotkey daemon"; - - package = mkOption { - type = types.package; - default = pkgs.sxhkd; - defaultText = "pkgs.sxhkd"; - description = "Package containing the sxhkd executable."; - }; - extraOptions = mkOption { - type = types.listOf types.str; - default = []; - description = "Command line arguments to invoke sxhkd with."; - example = literalExpression ''[ "-m 1" ]''; - }; - - keybindings = mkOption { - type = types.attrsOf (types.nullOr types.str); - default = {}; - description = "An attribute set that assigns hotkeys to commands."; - example = literalExpression '' - { - "super + shift + {r,c}" = "i3-msg {restart,reload}"; - "super + {s,w}" = "i3-msg {stacking,tabbed}"; - } - ''; - }; - - extraConfig = mkOption { - default = ""; - type = types.lines; - description = "Additional configuration to add."; - example = literalExpression '' - super + {_,shift +} {1-9,0} - i3-msg {workspace,move container to workspace} {1-10} - ''; - }; }; config = mkIf cfg.enable { - environment.systemPackages = [cfg.package]; + environment.systemPackages = [ + pkgs.maim #screenshooter + pkgs.brightnessctl #brightness control for laptop + pkgs.playerctl #music control + pkgs.xclip + pkgs.coreutils + ]; systemd.user.services.sxhkd = { description = "sxhkd hotkey daemon"; wantedBy = ["graphical-session.target"]; partOf = ["graphical-session.target"]; serviceConfig = { - ExecStart = "${cfg.package}/bin/sxhkd -c ${configFile} ${toString cfg.extraOptions}"; + ExecStart = "${pkgs.sxhkd}/bin/sxhkd -c ${configFile}"; RestartSec = 3; Restart = "always"; }; diff --git a/systems/laptop.nix b/systems/game-laptop/default.nix similarity index 99% rename from systems/laptop.nix rename to systems/game-laptop/default.nix index ff93578..a50250f 100644 --- a/systems/laptop.nix +++ b/systems/game-laptop/default.nix @@ -1,7 +1,6 @@ inputs: { pkgs, settings, - lib, ... }: { imports = [ diff --git a/systems/desktop.nix b/systems/gerg-desktop/default.nix similarity index 86% rename from systems/desktop.nix rename to systems/gerg-desktop/default.nix index 83ef516..44cbb5e 100644 --- a/systems/desktop.nix +++ b/systems/gerg-desktop/default.nix @@ -6,21 +6,25 @@ inputs: { }: { imports = [ # (import ../imports/boot.nix inputs) - (import ../imports/dwm.nix inputs) - (import ../imports/fonts.nix inputs) - (import ../imports/git.nix inputs) - (import ../imports/packages.nix inputs) - (import ../imports/parrot.nix inputs) - (import ../imports/picom.nix inputs) - (import ../imports/refreshrate.nix inputs) - (import ../imports/shells.nix inputs) - (import ../imports/sxhkd.nix inputs) - (import ../imports/theme.nix inputs) - (import ../imports/vfio.nix inputs) - # (import ../imports/mining.nix inputs) - (import ../imports/spicetify.nix inputs) + (import ../../imports/dwm.nix inputs) + (import ../../imports/fonts.nix inputs) + (import ../../imports/git.nix inputs) + (import ../../imports/packages.nix inputs) + (import ../../imports/parrot.nix inputs) + (import ../../imports/picom.nix inputs) + (import ../../imports/refreshrate.nix inputs) + (import ../../imports/shells.nix inputs) + (import ../../imports/theme.nix inputs) + (import ../../imports/vfio.nix inputs) + # (import ../../imports/mining.nix inputs) + (import ../../imports/spicetify.nix inputs) ]; system.stateVersion = "23.05"; + + localModules = { + sxhkd.enable = true; + }; + environment.systemPackages = with pkgs; [ webcord # talk to people (gross) bitwarden #store stuff diff --git a/systems/mom.nix b/systems/mom-laptop/default.nix similarity index 100% rename from systems/mom.nix rename to systems/mom-laptop/default.nix