(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 = [
./../../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";
}

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 = {
keyd = {
enable = true;
keyboards.default = {
ids = [ "*" ];
settings.main = {
capslock = "esc";
};
};
};
power-profiles-daemon.enable = true;
upower = {

View File

@@ -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 "$@"

View File

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

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" (''
#!/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
'')

View File

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