Add syncthing base
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
31
users/configs/console/bluetooth/default.nix
Normal file
31
users/configs/console/bluetooth/default.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
user ? throw "user argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
home-manager.users.${user.name}.systemd.user.services.mpris-proxy = {
|
||||
Unit = {
|
||||
Description = "MPRIS proxy";
|
||||
Requires = [ "sound.target" ];
|
||||
After = [
|
||||
"network.target"
|
||||
"sound.target"
|
||||
];
|
||||
};
|
||||
|
||||
Service.ExecStart = lib.meta.getExe (
|
||||
pkgs.writeShellApplication {
|
||||
name = "init-mpris-proxy";
|
||||
runtimeInputs = with pkgs; [ bluez ];
|
||||
text = "exec mpris-proxy";
|
||||
}
|
||||
);
|
||||
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
};
|
||||
}
|
7
users/configs/console/brightnessctl/default.nix
Normal file
7
users/configs/console/brightnessctl/default.nix
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
user ? throw "user argument is required",
|
||||
}:
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
home-manager.users.${user.name}.home.packages = with pkgs; [ brightnessctl ];
|
||||
}
|
19
users/configs/console/btop/default.nix
Normal file
19
users/configs/console/btop/default.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
user ? throw "user argument is required",
|
||||
}:
|
||||
{ ... }:
|
||||
{
|
||||
home-manager.users.${user.name}.programs.btop = {
|
||||
enable = true;
|
||||
settings = {
|
||||
theme_background = false;
|
||||
presets = "";
|
||||
vim_keys = true;
|
||||
shown_boxes = "cpu mem net proc gpu0 gpu1";
|
||||
update_ms = 1000;
|
||||
proc_tree = true;
|
||||
cpu_single_graph = true;
|
||||
disks_filter = "/ /nix /persist /cache";
|
||||
};
|
||||
};
|
||||
}
|
3
users/configs/console/git/commit-msg.sh
Normal file
3
users/configs/console/git/commit-msg.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
git interpret-trailers --if-exists doNothing --trailer \
|
||||
"Signed-off-by: $(git config user.name) <$(git config user.email)>" \
|
||||
--in-place "$1"
|
44
users/configs/console/git/default.nix
Normal file
44
users/configs/console/git/default.nix
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
user ? throw "user argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${user.name};
|
||||
in
|
||||
{
|
||||
home-manager.users.${user.name} = {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
lfs.enable = true;
|
||||
userName = user.fullName;
|
||||
userEmail = user.email;
|
||||
|
||||
signing = {
|
||||
signByDefault = true;
|
||||
key = null;
|
||||
};
|
||||
|
||||
extraConfig = {
|
||||
credential.helper = "store";
|
||||
push.autoSetupRemote = true;
|
||||
};
|
||||
|
||||
hooks = {
|
||||
commit-msg = lib.meta.getExe (
|
||||
pkgs.writeShellApplication {
|
||||
name = "git-commit-msg-hook";
|
||||
runtimeInputs = with pkgs; [ git ];
|
||||
text = builtins.readFile ./commit-msg.sh;
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
sops.secrets."git".path = "${hmConfig.xdg.configHome}/git/credentials";
|
||||
};
|
||||
}
|
75
users/configs/console/gpg-agent/default.nix
Normal file
75
users/configs/console/gpg-agent/default.nix
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
user ? throw "user argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${user.name};
|
||||
gpgPath = "${hmConfig.xdg.dataHome}/gnupg";
|
||||
in
|
||||
{
|
||||
home-manager.users.${user.name} = {
|
||||
programs.gpg = {
|
||||
enable = true;
|
||||
homedir = gpgPath;
|
||||
};
|
||||
|
||||
services.gpg-agent = {
|
||||
enable = true;
|
||||
defaultCacheTtl = 31536000;
|
||||
maxCacheTtl = 31536000;
|
||||
};
|
||||
|
||||
systemd.user = {
|
||||
services.gpg-agent-import =
|
||||
let
|
||||
init = lib.meta.getExe (
|
||||
pkgs.writeShellApplication {
|
||||
name = "import-gpg-keys";
|
||||
runtimeInputs = with pkgs; [
|
||||
coreutils
|
||||
gnugrep
|
||||
gnupg
|
||||
];
|
||||
runtimeEnv = {
|
||||
GNUPGHOME = gpgPath;
|
||||
HOME = user.home;
|
||||
};
|
||||
text = builtins.readFile ./import-gpg-keys.sh;
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
Unit = {
|
||||
Description = "Auto-import GPG keys";
|
||||
Requires = [
|
||||
"sops-nix.service"
|
||||
"gpg-agent.socket"
|
||||
];
|
||||
After = [
|
||||
"sops-nix.service"
|
||||
"gpg-agent.socket"
|
||||
];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = init;
|
||||
};
|
||||
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
};
|
||||
|
||||
tmpfiles.rules = [ "d ${gpgPath} 0700 ${user.name} users -" ];
|
||||
};
|
||||
|
||||
sops.secrets = {
|
||||
"gpg-agent/pgp.key" = { };
|
||||
"gpg-agent/pgp.pass" = { };
|
||||
};
|
||||
};
|
||||
}
|
16
users/configs/console/gpg-agent/import-gpg-keys.sh
Normal file
16
users/configs/console/gpg-agent/import-gpg-keys.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
for keyfile in "$HOME"/.config/sops-nix/secrets/gpg-agent/*.key; do
|
||||
passfile="${keyfile%.key}.pass"
|
||||
|
||||
if [ -f "$passfile" ]; then
|
||||
gpg2 --batch --yes --pinentry-mode loopback --passphrase-file "$passfile" --import "$keyfile"
|
||||
else
|
||||
gpg2 --batch --yes --import "$keyfile"
|
||||
fi
|
||||
|
||||
gpg2 --with-colons --import-options show-only --import "$keyfile" | grep '^fpr' | cut -d: -f10 | while read -r KEY_ID; do
|
||||
echo "$KEY_ID:6:" >> "$GNUPGHOME"/otrust.txt
|
||||
done
|
||||
done
|
||||
|
||||
gpg2 --import-ownertrust "$GNUPGHOME"/otrust.txt
|
||||
rm "$GNUPGHOME"/otrust.txt
|
21
users/configs/console/neovim/default.nix
Normal file
21
users/configs/console/neovim/default.nix
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
user ? throw "user argument is required",
|
||||
}:
|
||||
{ ... }:
|
||||
{
|
||||
home-manager.users.${user.name} = {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
vimdiffAlias = true;
|
||||
extraConfig = ''
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set expandtab
|
||||
set smartindent
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
13
users/configs/console/pipewire/default.nix
Normal file
13
users/configs/console/pipewire/default.nix
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
user ? throw "user argument is required",
|
||||
}:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home-manager.users.${user.name} = {
|
||||
home.packages = with pkgs; [
|
||||
wireplumber
|
||||
playerctl
|
||||
];
|
||||
services.playerctld.enable = true;
|
||||
};
|
||||
}
|
35
users/configs/console/syncthing/default.nix
Normal file
35
users/configs/console/syncthing/default.nix
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
user ? throw "user argument is required",
|
||||
}:
|
||||
{ config, ... }:
|
||||
{
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [ 22000 ];
|
||||
allowedUDPPorts = [
|
||||
21027
|
||||
22000
|
||||
];
|
||||
};
|
||||
|
||||
sops.secrets = {
|
||||
# openssl ecparam -name prime256v1 -genkey -noout -out key.pem
|
||||
"syncthing/key" = {
|
||||
owner = user.name;
|
||||
group = "users";
|
||||
};
|
||||
# openssl req -new -x509 -key key.pem -out cert.pem -days 3650
|
||||
"syncthing/cert" = {
|
||||
owner = user.name;
|
||||
group = "users";
|
||||
};
|
||||
};
|
||||
|
||||
home-manager.users.${user.name}.services.syncthing = {
|
||||
enable = true;
|
||||
key = config.sops.secrets."syncthing/key".path;
|
||||
cert = config.sops.secrets."syncthing/cert".path;
|
||||
extraOptions = [ "-no-default-folder" ];
|
||||
|
||||
settings.options.urAccepted = -1;
|
||||
};
|
||||
}
|
25
users/configs/console/zsh/default.nix
Normal file
25
users/configs/console/zsh/default.nix
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
user ? throw "user argument is required",
|
||||
}:
|
||||
{ config, ... }:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${user.name};
|
||||
in
|
||||
{
|
||||
home-manager.users.${user.name} = {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
dotDir = "${hmConfig.xdg.relativeConfigHome}/zsh";
|
||||
autocd = true;
|
||||
history = {
|
||||
path = "${hmConfig.xdg.dataHome}/zsh/history";
|
||||
expireDuplicatesFirst = true;
|
||||
};
|
||||
historySubstringSearch.enable = true;
|
||||
autosuggestion.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
};
|
||||
|
||||
home.persistence."/persist${user.home}".directories = [ "${hmConfig.xdg.relativeDataHome}/zsh" ];
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user