(desktop) Gen 473: Broke desktop default.nix down into modules, removed conditionals from users.nix, moved host-dependent logic into corresponding host folders, enabled keyd on laptop

This commit is contained in:
pagedMov
2024-10-14 02:54:34 -04:00
parent 395fa72cbf
commit 6dbe561378
10 changed files with 68 additions and 64 deletions

View File

@@ -5,34 +5,8 @@
imports = [ imports = [
./../../modules/sys ./../../modules/sys
./hardware.nix ./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";
} }

View File

@@ -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";
}

View File

@@ -2,6 +2,17 @@
{ {
services = { services = {
keyd = {
enable = true;
keyboards.default = {
ids = [ "*" ];
settings.main = {
capslock = "esc";
};
};
};
power-profiles-daemon.enable = true; power-profiles-daemon.enable = true;
upower = { upower = {

View File

@@ -40,6 +40,7 @@
shellAliases = { shellAliases = {
grep = "grep --color=auto"; grep = "grep --color=auto";
yazi = "y";
vi = "nvim"; vi = "nvim";
mv = "mv -v"; mv = "mv -v";
cp = "cp -vr"; cp = "cp -vr";
@@ -69,6 +70,15 @@
scheck && runbg aplay ${self}/media/sound/ls.wav 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() { cd() {
export SOUNDS_ENABLED=0 export SOUNDS_ENABLED=0
eza -1 --group-directories-first --icons "$@" eza -1 --group-directories-first --icons "$@"

View File

@@ -141,8 +141,8 @@
"super, c, killactive," "super, c, killactive,"
"super, e, exec, [float;size 45% 70%;move 10 50] kitty btop" "super, e, exec, [float;size 45% 70%;move 10 50] kitty btop"
"super, n, exec, [float;size 50% 35%;move 10 50] pavucontrol" "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, [float;size 25% 30%;move onscreen cursor 0 0] [ ! -f /tmp/passhelperfile ] && kitty passhelper"
"super, p, exec, aplay ~/media/sound/soundtest.wav" "super, 0, exec, aplay ~/media/sound/soundtest.wav"
"super shift, q, exit," "super shift, q, exit,"
"super, m, exec, fuzzel" "super, m, exec, fuzzel"
"super, r, exec, neovide" "super, r, exec, neovide"

View File

@@ -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) ];
}

View File

@@ -3,9 +3,17 @@
pkgs.writeShellScriptBin "passhelper" ('' pkgs.writeShellScriptBin "passhelper" (''
#!/run/current-system/sw/bin/bash #!/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" pass -c "$pass_string"
sleep 1.5 sleep 1.5
/run/current-system/sw/bin/rm /tmp/passhelperfile
exit 0 exit 0
'') '')

View File

@@ -2,11 +2,9 @@
let let
nur = config.nur; nur = config.nur;
steamcfg = if (host == "desktop") then [ ./steam.nix ] else [];
in in
{ {
imports = [ inputs.home-manager.nixosModules.home-manager ] imports = [ inputs.home-manager.nixosModules.home-manager ];
++ steamcfg;
home-manager = { home-manager = {
useUserPackages = true; useUserPackages = true;
useGlobalPkgs = true; useGlobalPkgs = true;
@@ -14,10 +12,7 @@ in
extraSpecialArgs = { inherit self inputs host username nur; }; extraSpecialArgs = { inherit self inputs host username nur; };
users.${username} = { users.${username} = {
programs.home-manager.enable = true; programs.home-manager.enable = true;
imports = imports = [ ./../../home ];
if (host == "desktop") then
[ ./../../home/desktop.nix ]
else [./../../home/laptop.nix ];
home = { home = {
username = "${username}"; username = "${username}";
homeDirectory = "/home/${username}"; homeDirectory = "/home/${username}";