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** - my personal nix dotfiles in the **flake**
## Build and deploy
- simple build command for system - simple build command for system
```bash ```bash
git clone https://git.foglar.tech/foglar/dotfiles.git $HOME/dotfiles git clone https://git.foglar.tech/foglar/dotfiles.git $HOME/.dotfiles
sudo nixos-rebuild switch --flake ~/dotfiles#laptop sudo nixos-rebuild switch --flake ~/.dotfiles#kogami
``` ```
- generate a vm of the flake with this command - generate a vm of the flake with this command
```bash ```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 - deploy configuration on the new system
```bash ```bash
# Copy my repository # 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 # Generate your own hardware configurations for system
sudo nixos-generate-config --dir ~/dotfiles/zenith sudo nixos-generate-config --dir ~/.dotfiles/kogami
# or # or
sudo nixos-generate-config --dir ~/dotfiles/leanix sudo nixos-generate-config --dir ~/.dotfiles/ginoza
# Rebuild your system from the flake # Rebuild your system from the flake
sudo nixos-rebuild switch --flake ~/dotfiles#zenith sudo nixos-rebuild switch --flake ~/.dotfiles#kogami
``` ```
## Features ## 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 } @ inputs: let
userSettings = { 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 hostname = "kogami"; # kogami or ginoza
shell = "zsh"; # bash, zsh, none shell = "zsh"; # bash, zsh, none
terminal = "kitty"; # kitty, alacritty terminal = "kitty"; # kitty, alacritty, gnome-terminal
browser = "librewolf"; # firefox, librewolf, qutebrowser browser = "librewolf"; # firefox, librewolf, qutebrowser
editor = "neovim"; # neovim, vscode editor = "neovim"; # neovim, vscode

View File

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

View File

@ -2,6 +2,7 @@
lib, lib,
config, config,
pkgs, pkgs,
userSettings,
... ...
}: { }: {
options = { options = {
@ -21,8 +22,14 @@
config = lib.mkIf config.sh.oh-my-posh.enable { config = lib.mkIf config.sh.oh-my-posh.enable {
programs.oh-my-posh = { programs.oh-my-posh = {
enable = true; enable = true;
enableBashIntegration = if config.sh.bash.enable == true then true else false; enableBashIntegration =
enableZshIntegration = if config.sh.zsh.enable == true then true else false; if config.sh.bash.enable == true
then true
else false;
enableZshIntegration =
if config.sh.zsh.enable == true
then true
else false;
settings = { settings = {
"$schema" = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json"; "$schema" = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json";
"blocks" = [ "blocks" = [
@ -83,7 +90,7 @@
"style" = "full"; "style" = "full";
}; };
"style" = "plain"; "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"; "type" = "git";

View File

@ -42,5 +42,14 @@
enable = true; enable = true;
enableSSHSupport = 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"
'';
}; };
} }