diff --git a/hosts/desktop/default.nix b/hosts/desktop/default.nix index 68970cd..ffb5a57 100644 --- a/hosts/desktop/default.nix +++ b/hosts/desktop/default.nix @@ -5,34 +5,8 @@ imports = [ ./../../modules/sys ./hardware.nix + ./settings.nix + ./steam.nix ]; - system.stateVersion = "24.05"; - nixpkgs.config.allowUnfree = true; - nix = { - settings = { - auto-optimise-store = true; - experimental-features = [ "nix-command" "flakes" ]; - substituters = [ "https://nix-gaming.cachix.org" ]; - }; - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 7d"; - }; - }; - - environment = { - variables = { - XCURSOR_SIZE = "24"; - PATH = "${pkgs.clang-tools}/bin:$PATH"; - }; - shells = with pkgs; [ - zsh - bash - ]; - }; - - time.timeZone = "America/New_York"; - i18n.defaultLocale = "en_US.UTF-8"; } diff --git a/hosts/desktop/settings.nix b/hosts/desktop/settings.nix new file mode 100644 index 0000000..e96da7c --- /dev/null +++ b/hosts/desktop/settings.nix @@ -0,0 +1,32 @@ +{ pkgs, ... }: + +{ + system.stateVersion = "24.05"; + nixpkgs.config.allowUnfree = true; + nix = { + settings = { + auto-optimise-store = true; + experimental-features = [ "nix-command" "flakes" ]; + substituters = [ "https://nix-gaming.cachix.org" ]; + }; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + }; + + environment = { + variables = { + XCURSOR_SIZE = "24"; + PATH = "${pkgs.clang-tools}/bin:$PATH"; + }; + shells = with pkgs; [ + zsh + bash + ]; + }; + + time.timeZone = "America/New_York"; + i18n.defaultLocale = "en_US.UTF-8"; +} diff --git a/modules/sys/software/steam.nix b/hosts/desktop/steam.nix similarity index 100% rename from modules/sys/software/steam.nix rename to hosts/desktop/steam.nix diff --git a/hosts/laptop/services.nix b/hosts/laptop/services.nix index 986f4ad..8ab3d75 100644 --- a/hosts/laptop/services.nix +++ b/hosts/laptop/services.nix @@ -2,6 +2,17 @@ { services = { + + keyd = { + enable = true; + keyboards.default = { + ids = [ "*" ]; + settings.main = { + capslock = "esc"; + }; + }; + }; + power-profiles-daemon.enable = true; upower = { diff --git a/modules/home/desktop.nix b/modules/home/default.nix similarity index 100% rename from modules/home/desktop.nix rename to modules/home/default.nix diff --git a/modules/home/environment/zshell.nix b/modules/home/environment/zshell.nix index c70e24f..b2d6eed 100644 --- a/modules/home/environment/zshell.nix +++ b/modules/home/environment/zshell.nix @@ -40,6 +40,7 @@ shellAliases = { grep = "grep --color=auto"; + yazi = "y"; vi = "nvim"; mv = "mv -v"; cp = "cp -vr"; @@ -69,6 +70,15 @@ scheck && runbg aplay ${self}/media/sound/ls.wav } + y() { + local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" + yazi "$@" --cwd-file="$tmp" + if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then + builtin cd -- "$cwd" + fi + rm -f -- "$tmp" + } + cd() { export SOUNDS_ENABLED=0 eza -1 --group-directories-first --icons "$@" diff --git a/modules/home/hyprland/config.nix b/modules/home/hyprland/config.nix index 5b06017..556842e 100644 --- a/modules/home/hyprland/config.nix +++ b/modules/home/hyprland/config.nix @@ -141,8 +141,8 @@ "super, c, killactive," "super, e, exec, [float;size 45% 70%;move 10 50] kitty btop" "super, n, exec, [float;size 50% 35%;move 10 50] pavucontrol" - "super, p, exec, [float;size 31% 30%;move onscreen cursor 0 0] kitty passhelper" - "super, p, exec, aplay ~/media/sound/soundtest.wav" + "super, p, exec, [float;size 25% 30%;move onscreen cursor 0 0] [ ! -f /tmp/passhelperfile ] && kitty passhelper" + "super, 0, exec, aplay ~/media/sound/soundtest.wav" "super shift, q, exit," "super, m, exec, fuzzel" "super, r, exec, neovide" diff --git a/modules/home/laptop.nix b/modules/home/laptop.nix deleted file mode 100644 index c2f871a..0000000 --- a/modules/home/laptop.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ host, nur, self, inputs, username, config, ... }: - - - - -{ - imports = - [ (import ./programs/btop.nix) ] - ++ [ (import ./programs/yazi.nix) ] - ++ [ (import ./programs/kitty.nix) ] - ++ [ (import ./programs/fuzzel.nix) ] - ++ [ (import ./programs/eza.nix) ] - ++ [ (import ./programs/cava.nix) ] - ++ [ (import ./programs/bat.nix) ] - ++ [ (import ./programs/git.nix) ] - ++ [ (import ./environment/gtk.nix) ] - ++ [ (import ./environment/spicetify.nix) ] - ++ [ (import ./environment/starship.nix) ] - ++ [ (import ./environment/laptop_userpkgs.nix) ] - ++ [ (import ./environment/zshell.nix) ] - ++ [ (import ./firefox/firefox.nix) ] - ++ [ (import ./hyprland) ] - ++ [ (import ./scripts ) ] - ++ [ (import ./swaync/swaync.nix) ] - ++ [ (import ./waybar) ]; -} diff --git a/modules/home/scripts/wm-controls/passhelper.nix b/modules/home/scripts/wm-controls/passhelper.nix index b57ece7..a7d07bf 100644 --- a/modules/home/scripts/wm-controls/passhelper.nix +++ b/modules/home/scripts/wm-controls/passhelper.nix @@ -3,9 +3,17 @@ pkgs.writeShellScriptBin "passhelper" ('' #!/run/current-system/sw/bin/bash -pass_string=$(find $HOME/.password-store -type f | sed 's|.*/.password-store/||; s|\.gpg$||' | rg -v ".gpg-id$" | fzf) +# prevent multiple instances, conditional check happens in the hyprland bind +touch /tmp/passhelperfile +trap "[ -f /tmp/passhelperfile ] && /run/current-system/sw/bin/rm /tmp/passhelperfile" EXIT SIGHUP SIGINT + +# get passwords from password store, remove .password store/ prefix and .gpg suffix, exlude .gpg-id file, open results in fzf +pass_string=$(find $HOME/.password-store -type f | sed 's|.*/.password-store/||; s|\.gpg$||' | rg -v ".gpg-id$" | fzf --border --border-label="$(whoami)'s keyring") + +[ $? = 0 ] || { [ -f /tmp/passhelperfile ] && /run/current-system/sw/bin/rm /tmp/passhelperfile; exit 1; } pass -c "$pass_string" sleep 1.5 +/run/current-system/sw/bin/rm /tmp/passhelperfile exit 0 '') diff --git a/modules/sys/software/users.nix b/modules/sys/software/users.nix index b84e101..b3e81fe 100644 --- a/modules/sys/software/users.nix +++ b/modules/sys/software/users.nix @@ -2,11 +2,9 @@ let nur = config.nur; - steamcfg = if (host == "desktop") then [ ./steam.nix ] else []; in { - imports = [ inputs.home-manager.nixosModules.home-manager ] - ++ steamcfg; + imports = [ inputs.home-manager.nixosModules.home-manager ]; home-manager = { useUserPackages = true; useGlobalPkgs = true; @@ -14,10 +12,7 @@ in extraSpecialArgs = { inherit self inputs host username nur; }; users.${username} = { programs.home-manager.enable = true; - imports = - if (host == "desktop") then - [ ./../../home/desktop.nix ] - else [./../../home/laptop.nix ]; + imports = [ ./../../home ]; home = { username = "${username}"; homeDirectory = "/home/${username}";