Extract identity component

This commit is contained in:
Andrew Kvalheim 2023-05-17 18:45:47 -07:00
parent e0f09be044
commit e00ec679fb
16 changed files with 66 additions and 27 deletions

View file

@ -1,5 +1,8 @@
{ lib, pkgs, ... }: { lib, pkgs, ... }:
let
identity = import ../resources/identity.nix;
in
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
delta delta
@ -11,9 +14,9 @@
programs.git = { programs.git = {
enable = true; enable = true;
userName = "Andrew Kvalheim"; userName = identity.name.long;
userEmail = "Andrew@Kvalhe.im"; userEmail = identity.email;
signing.key = "0x9254D45940949194"; signing.key = identity.openpgp.id;
aliases = { aliases = {
diff-image = "!f() { cd -- \"\${GIT_PREFIX:-.}\"; GIT_DIFF_IMAGE_ENABLED=1 git diff \"$@\"; }; f"; diff-image = "!f() { cd -- \"\${GIT_PREFIX:-.}\"; GIT_DIFF_IMAGE_ENABLED=1 git diff \"$@\"; }; f";

View file

@ -1,5 +1,8 @@
{ config, ... }: { config, ... }:
let
identity = import ../resources/identity.nix;
in
{ {
imports = [ imports = [
../../packages/kmonad.nix ../../packages/kmonad.nix
@ -26,5 +29,5 @@
services.ydotoold.enable = true; services.ydotoold.enable = true;
# Permissions # Permissions
users.users.ak.extraGroups = [ "ydotool" ]; users.users.${identity.username}.extraGroups = [ "ydotool" ];
} }

View file

@ -2,6 +2,8 @@
let let
inherit (config) host; inherit (config) host;
identity = import ../resources/identity.nix;
in in
{ {
options.host = { options.host = {
@ -52,6 +54,6 @@ in
system.activationScripts.etcAvahiServices = "mkdir -p /etc/avahi/services"; system.activationScripts.etcAvahiServices = "mkdir -p /etc/avahi/services";
# Permissions # Permissions
users.users.ak.extraGroups = [ "networkmanager" ]; users.users.${identity.username}.extraGroups = [ "networkmanager" ];
}; };
} }

View file

@ -1,5 +1,8 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let
identity = import ../resources/identity.nix;
in
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
yubikey-touch-detector-icon yubikey-touch-detector-icon
@ -19,7 +22,7 @@
programs.gpg = { programs.gpg = {
enable = true; enable = true;
settings = { settings = {
default-key = "0x9254D45940949194"; default-key = identity.openpgp.id;
keyid-format = "0xlong"; keyid-format = "0xlong";
no-greeting = true; no-greeting = true;
no-symkey-cache = true; no-symkey-cache = true;

View file

@ -1,5 +1,8 @@
{ pkgs, ... }: { pkgs, ... }:
let
identity = import ../resources/identity.nix;
in
{ {
allowedUnfree = [ "brgenml1lpr" ]; allowedUnfree = [ "brgenml1lpr" ];
@ -16,5 +19,5 @@
}; };
# Permissions # Permissions
users.users.ak.extraGroups = [ "lp" ]; users.users.${identity.username}.extraGroups = [ "lp" ];
} }

View file

@ -1,3 +1,6 @@
let
identity = import ../resources/identity.nix;
in
{ {
imports = [ <nixpkgs/nixos/modules/services/hardware/sane_extra_backends/brscan4.nix> ]; imports = [ <nixpkgs/nixos/modules/services/hardware/sane_extra_backends/brscan4.nix> ];
@ -10,5 +13,5 @@
}; };
# Permissions # Permissions
users.users.ak.extraGroups = [ "scanner" ]; users.users.${identity.username}.extraGroups = [ "scanner" ];
} }

View file

@ -1,17 +1,20 @@
{ pkgs, ... }: { pkgs, ... }:
let
identity = import ../resources/identity.nix;
in
{ {
users.mutableUsers = false; users.mutableUsers = false;
users.groups.ak.gid = 1000; users.groups.${identity.username}.gid = 1000;
users.users.ak = { users.users.${identity.username} = {
isNormalUser = true; isNormalUser = true;
uid = 1000; uid = 1000;
group = "ak"; group = identity.username;
extraGroups = [ "wheel" ]; extraGroups = [ "wheel" ];
description = "Andrew"; description = identity.name.short;
hashedPassword = builtins.readFile ../local/resources/ak.passwd; hashedPassword = builtins.readFile ../local/resources/${identity.username}.passwd;
shell = pkgs.zsh; shell = pkgs.zsh;
openssh.authorizedKeys.keys = [ (builtins.readFile ../resources/andrew.pub) ]; openssh.authorizedKeys.keys = [ identity.ssh ];
}; };
} }

View file

@ -1,3 +1,6 @@
let
identity = import ../resources/identity.nix;
in
{ {
# Containers # Containers
virtualisation.containers.registries.search = [ "docker.io" ]; virtualisation.containers.registries.search = [ "docker.io" ];
@ -8,5 +11,5 @@
virtualisation.libvirtd.enable = true; virtualisation.libvirtd.enable = true;
# Permissions # Permissions
users.users.ak.extraGroups = [ "docker" "libvirtd" "podman" ]; users.users.${identity.username}.extraGroups = [ "docker" "libvirtd" "podman" ];
} }

View file

@ -0,0 +1,10 @@
{
name.long = "Andrew Kvalheim";
name.short = "Andrew";
username = "ak";
email = "andrew@kvalhe.im";
openpgp.id = "0x9254D45940949194";
openpgp.asc = ./andrew.asc;
ssh = builtins.readFile ./andrew.pub;
image = ./andrew.jpg;
}

View file

@ -3,7 +3,7 @@
let let
inherit (config) host; inherit (config) host;
# Resources identity = import ./resources/identity.nix;
palette = import ./resources/palette.nix; palette = import ./resources/palette.nix;
in in
{ {
@ -44,7 +44,7 @@ in
allowDiscards = true; allowDiscards = true;
fallbackToPassword = true; fallbackToPassword = true;
gpgCard.encryptedPass = ./local/resources/luks-passphrase.gpg; gpgCard.encryptedPass = ./local/resources/luks-passphrase.gpg;
gpgCard.publicKey = ./resources/andrew.asc; gpgCard.publicKey = identity.openpgp.asc;
}; };
}; };
fileSystems."/".options = [ "compress=zstd:2" "discard=async" "noatime" ]; fileSystems."/".options = [ "compress=zstd:2" "discard=async" "noatime" ];

View file

@ -1,5 +1,8 @@
{ config, lib, ... }: { config, lib, ... }:
let
identity = import ./resources/identity.nix;
in
{ {
# Workaround for nix-community/home-manager#2333 # Workaround for nix-community/home-manager#2333
disabledModules = [ "config/i18n.nix" ]; disabledModules = [ "config/i18n.nix" ];
@ -32,8 +35,8 @@
manual.html.enable = true; manual.html.enable = true;
# User # User
home.username = "ak"; home.username = identity.username;
home.homeDirectory = "/home/ak"; home.homeDirectory = "/home/${identity.username}";
home.file.".face".source = ./resources/andrew.jpg; home.file.".face".source = identity.image;
}; };
} }

View file

@ -1,5 +1,8 @@
{ lib, pkgs, ... }: { lib, pkgs, ... }:
let
identity = import ../../common/resources/identity.nix;
in
{ {
imports = [ imports = [
../../common/system.nix ../../common/system.nix
@ -82,7 +85,7 @@
# Wireshark # Wireshark
programs.wireshark.enable = true; programs.wireshark.enable = true;
users.users.ak.extraGroups = [ "usbmux" "wireshark" ]; users.users.${identity.username}.extraGroups = [ "usbmux" "wireshark" ];
# UniFi Network application # UniFi Network application
allowedUnfree = [ "unifi-controller" ]; allowedUnfree = [ "unifi-controller" ];

View file

@ -1,5 +1,5 @@
{ yarn2nix-moretea }: { yarn2nix-moretea }:
(yarn2nix-moretea.mkYarnWorkspace { (yarn2nix-moretea.mkYarnWorkspace {
src = /home/ak/akorg/project/current/andrew.kvalhe.im/andrew.kvalhe.im; src = ~/akorg/project/current/andrew.kvalhe.im/andrew.kvalhe.im;
}).attachments }).attachments

View file

@ -9,7 +9,7 @@ rustPlatform.buildRustPackage rec {
version = "0.2.2"; version = "0.2.2";
src = fetchGit { src = fetchGit {
url = "/home/ak/akorg/project/current/email-hash/email-hash"; url = ~/akorg/project/current/email-hash/email-hash;
ref = "v${version}"; ref = "v${version}";
}; };

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -Eeuo pipefail set -Eeuo pipefail
cd '/home/ak/src/configuration' cd "$HOME/src/configuration"
message='Update spell check word list' message='Update spell check word list'
txt='common/resources/words.txt' txt='common/resources/words.txt'

View file

@ -2,10 +2,10 @@
set -Eeuo pipefail set -Eeuo pipefail
shopt -s nullglob shopt -s nullglob
intermediate_dir='/home/ak/screenshots/.unoptimized' intermediate_dir="$HOME/screenshots/.unoptimized"
screenshots_dir='/home/ak/screenshots' screenshots_dir="$HOME/screenshots"
for source in /home/ak/Downloads/Screen{s,\ S}hot\ *.png; do for source in ~/Downloads/Screen{s,\ S}hot\ *.png; do
while (( $(date +%s) - $(date '+%s' --reference "$source") <= 1 )); do while (( $(date +%s) - $(date '+%s' --reference "$source") <= 1 )); do
echo "Waiting for file to settle: $source" echo "Waiting for file to settle: $source"
sleep 1s sleep 1s