Yubikey and Oh-my-posh improvements

This commit is contained in:
foglar 2024-12-26 21:56:44 +01:00
parent 4a9ab4e816
commit 34d77cf53b
5 changed files with 45 additions and 13 deletions

View File

@ -2,32 +2,48 @@
- my personal nix dotfiles in the **flake**
## Build and deploy
- simple build command for system
```bash
git clone https://git.foglar.tech/foglar/dotfiles.git $HOME/dotfiles
sudo nixos-rebuild switch --flake ~/dotfiles#laptop
git clone https://git.foglar.tech/foglar/dotfiles.git $HOME/.dotfiles
sudo nixos-rebuild switch --flake ~/.dotfiles#kogami
```
- generate a vm of the flake with this command
```bash
nix run github:nix-community/nixos-generators -- -c ./flake.nix --flake '#leanix' -f vm --disk-size 20480
nix run github:nix-community/nixos-generators -- -c ./flake.nix --flake '#ginoza' -f vm --disk-size 20480
```
- deploy configuration on the new system
```bash
# Copy my repository
git clone https://git.foglar.tech/foglar/dotfiles.git $HOME/dotfiles --depth 1
git clone https://git.foglar.tech/foglar/dotfiles.git $HOME/.dotfiles --depth 1
# Generate your own hardware configurations for system
sudo nixos-generate-config --dir ~/dotfiles/zenith
sudo nixos-generate-config --dir ~/.dotfiles/kogami
# or
sudo nixos-generate-config --dir ~/dotfiles/leanix
sudo nixos-generate-config --dir ~/.dotfiles/ginoza
# Rebuild your system from the flake
sudo nixos-rebuild switch --flake ~/dotfiles#zenith
sudo nixos-rebuild switch --flake ~/.dotfiles#kogami
```
## Features
### Secure Operations
- file for sops is in **~/.config/sops/ags/keys.txt**
### Yubikey
- setup your yubikey to work with current user
```bash
nix-shell -p yubico-pam -p yubikey-manager
ykman otp chalresp --touch --generate 2
ykpamcfg -2 -v
```

View File

@ -54,11 +54,11 @@
...
} @ inputs: let
userSettings = {
username = "foglar"; # konsta or shinya (else defaulting to shinya or none)
username = "shinya"; # konsta or shinya (else defaulting to shinya or none)
hostname = "kogami"; # kogami or ginoza
shell = "zsh"; # bash, zsh, none
terminal = "kitty"; # kitty, alacritty
terminal = "kitty"; # kitty, alacritty, gnome-terminal
browser = "librewolf"; # firefox, librewolf, qutebrowser
editor = "neovim"; # neovim, vscode

View File

@ -11,7 +11,7 @@
# Desktop management
desktop.hyprland.enable = true;
desktop.kde.enable = true;
desktop.kde.enable = false;
desktop.gnome.enable = false;
# Shell management

View File

@ -2,6 +2,7 @@
lib,
config,
pkgs,
userSettings,
...
}: {
options = {
@ -21,8 +22,14 @@
config = lib.mkIf config.sh.oh-my-posh.enable {
programs.oh-my-posh = {
enable = true;
enableBashIntegration = if config.sh.bash.enable == true then true else false;
enableZshIntegration = if config.sh.zsh.enable == true then true else false;
enableBashIntegration =
if config.sh.bash.enable == true
then true
else false;
enableZshIntegration =
if config.sh.zsh.enable == true
then true
else false;
settings = {
"$schema" = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json";
"blocks" = [
@ -83,7 +90,7 @@
"style" = "full";
};
"style" = "plain";
"template" = "<{{ if .Root }}lightBlue{{ else }}green{{ end }}>-[</>{{if eq .Folder \"foglar\"}}~{{else}}{{ .Folder }}{{end}}<{{ if .Root }}lightBlue{{ else }}green{{ end }}>]</>";
"template" = "<{{ if .Root }}lightBlue{{ else }}green{{ end }}>-[</>{{if eq .Folder \"${userSettings.username}\"}}~{{else}}{{ .Folder }}{{end}}<{{ if .Root }}lightBlue{{ else }}green{{ end }}>]</>";
}
{
"type" = "git";

View File

@ -42,5 +42,14 @@
enable = true;
enableSSHSupport = true;
};
services.udev.extraRules = ''
ACTION=="remove",\
ENV{ID_BUS}=="usb",\
ENV{ID_MODEL_ID}=="0407",\
ENV{ID_VENDOR_ID}=="1050",\
ENV{ID_VENDOR}=="Yubico",\
RUN+="${pkgs.systemd}/bin/loginctl lock-sessions"
'';
};
}