summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Vink <mike1994vink@gmail.com>2023-06-30 13:45:31 +0200
committerMike Vink <mike1994vink@gmail.com>2023-06-30 13:45:31 +0200
commitb244546935672b604ab9e46bbb4284638dbef509 (patch)
treeb9ecc30dbd6d681745a4e9f2c713789425809c3d
parent702cdf6d41bc2bcd3fdad00ba49bb19f7fd36fb6 (diff)
stuff
-rw-r--r--configuration.nix6
-rw-r--r--email/mailsync.nix2
-rw-r--r--flake.lock54
-rw-r--r--flake.nix10
-rw-r--r--home.nix25
-rw-r--r--home/packages.nix14
-rwxr-xr-xshell-scripts/kakup2
-rw-r--r--shell-scripts/lfub24
-rw-r--r--shell-scripts/mailsync16
-rw-r--r--shell-scripts/transadd9
10 files changed, 138 insertions, 24 deletions
diff --git a/configuration.nix b/configuration.nix
index 85ba615..a0a3032 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -5,7 +5,7 @@
}: {
users.users.mike = {
isNormalUser = true;
- extraGroups = ["wheel" "networkmanager" "docker"];
+ extraGroups = ["wheel" "networkmanager" "docker" "transmission"];
};
virtualisation.docker.enable = true;
@@ -120,6 +120,10 @@
pulse.enable = true;
};
+ services.transmission = {
+ enable = true;
+ };
+
hardware.bluetooth.enable = true;
services.blueman.enable = true;
diff --git a/email/mailsync.nix b/email/mailsync.nix
index dbf5d7f..3280f19 100644
--- a/email/mailsync.nix
+++ b/email/mailsync.nix
@@ -29,7 +29,7 @@
Type = "oneshot";
RemainAfterExit = "no";
ExecSearchPath = "${config.home.profileDirectory}/bin:/run/current-system/sw/bin";
- ExecStart = "mailsync";
+ ExecStart = "${pkgs.coreutils}/bin/env mailsync";
};
};
}
diff --git a/flake.lock b/flake.lock
index 1e7488a..cfcee72 100644
--- a/flake.lock
+++ b/flake.lock
@@ -68,12 +68,64 @@
"type": "github"
}
},
+ "nixpkgs-stable_2": {
+ "locked": {
+ "lastModified": 1687031877,
+ "narHash": "sha256-yMFcVeI+kZ6KD2QBrFPNsvBrLq2Gt//D0baHByMrjFY=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "e2e2059d19668dab1744301b8b0e821e3aae9c99",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "release-23.05",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs_2": {
+ "locked": {
+ "lastModified": 1686979235,
+ "narHash": "sha256-gBlBtk+KrezFkfMrZw6uwTuA7YWtbFciiS14mEoTCo0=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "7cc30fd5372ddafb3373c318507d9932bd74aafe",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
"root": {
"inputs": {
"home-manager": "home-manager",
"mvinkio": "mvinkio",
"nixpkgs": "nixpkgs",
- "nixpkgs-stable": "nixpkgs-stable"
+ "nixpkgs-stable": "nixpkgs-stable",
+ "sops-nix": "sops-nix"
+ }
+ },
+ "sops-nix": {
+ "inputs": {
+ "nixpkgs": "nixpkgs_2",
+ "nixpkgs-stable": "nixpkgs-stable_2"
+ },
+ "locked": {
+ "lastModified": 1687398569,
+ "narHash": "sha256-e/umuIKFcFtZtWeX369Hbdt9r+GQ48moDmlTcyHWL28=",
+ "owner": "Mic92",
+ "repo": "sops-nix",
+ "rev": "2ff6973350682f8d16371f8c071a304b8067f192",
+ "type": "github"
+ },
+ "original": {
+ "owner": "Mic92",
+ "repo": "sops-nix",
+ "type": "github"
}
}
},
diff --git a/flake.nix b/flake.nix
index 9f12edc..c64d078 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,15 +1,12 @@
{
description = "Home Manager configuration";
- # Specify the source of Home Manager and Nixpkgs and vim plugins.
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
mvinkio.url = "github:mvinkio/nixpkgs/nixpkgs-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-22.05";
- home-manager = {
- url = "github:nix-community/home-manager";
- inputs.nixpkgs.follows = "nixpkgs";
- };
+ sops-nix.url = "github:Mic92/sops-nix";
+ home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; };
};
outputs = {
@@ -18,6 +15,7 @@
mvinkio,
nixpkgs-stable,
home-manager,
+ sops-nix,
...
}: let
home = builtins.getEnv "HOME";
@@ -42,7 +40,7 @@
in {
nixosConfigurations.lemptop = nixpkgs.lib.nixosSystem {
inherit system;
- modules = [./configuration.nix ./lemptop.nix];
+ modules = [./configuration.nix ./lemptop.nix sops-nix.nixosModules.sops];
};
homeConfigurations.mvinkio = home-manager.lib.homeManagerConfiguration {
diff --git a/home.nix b/home.nix
index 82af766..fe9b67b 100644
--- a/home.nix
+++ b/home.nix
@@ -6,9 +6,11 @@
pkgs,
...
}: {
+ programs.home-manager.enable = true;
home.homeDirectory = "/home/${username}";
home.username = username;
home.stateVersion = "23.05";
+ fonts.fontconfig.enable = true;
xdg = {
enable = true;
mimeApps = {
@@ -31,12 +33,27 @@
"inode/directory" = ["file.desktop"];
};
};
+ mime.enable = true;
desktopEntries = {
+ text= { type = "Application"; name = "Text editor"; exec = "${pkgs.st}/bin/st -e kak %u"; };
+ file = { type = "Application"; name = "File Manager"; exec = "${pkgs.st}/bin/st -e lfub %u"; };
+ torrent = { type = "Application"; name = "Torrent"; exec = "${pkgs.coreutils}/bin/env transadd %U"; };
+ img = { type = "Application"; name = "Image Viewer"; exec = "${pkgs.sxiv}/bin/sxiv -a %u"; };
+ video = { type = "Application"; name = "Video Viewer"; exec = "${pkgs.mpv}/bin/mpv -quiet %f"; };
+ mail = { type = "Application"; name = "Mail"; exec = "${pkgs.st}/bin/st -e neomutt %u"; };
+ pdf = { type = "Application"; name = "PDF reader"; exec = "${pkgs.zathura}/bin/zathura %u"; };
+ rss = { type = "Application"; name = "RSS feed addition"; exec = "${pkgs.coreutils}/bin/env rssadd %u"; };
};
};
- fonts.fontconfig.enable = true;
- programs.home-manager.enable = true;
+ programs.ssh = {
+ enable = true;
+ matchBlocks = {
+ "*" = {
+ identityFile = "${config.home.homeDirectory}/.ssh/id_ed25519";
+ };
+ };
+ };
home.sessionVariables = {
EDITOR = "kak";
@@ -156,8 +173,8 @@
};
services.gpg-agent = {
enable = true;
- defaultCacheTtl = 34560000;
- maxCacheTtl = 34560000;
+ defaultCacheTtl = 34550000;
+ maxCacheTtl = 34550000;
};
programs.password-store = {
enable = true;
diff --git a/home/packages.nix b/home/packages.nix
index 075736a..b3e65a3 100644
--- a/home/packages.nix
+++ b/home/packages.nix
@@ -8,6 +8,9 @@
}: let
core-packages = with pkgs;
[
+ # nixopsnixops
+ age
+ sops
# k8s and friends
kubernetes-helm
kubectl
@@ -17,9 +20,16 @@
yq-go
dasel
initool
- nnn
python311Packages.editorconfig
- # shell tools
+ # other stuff
+ coreutils
+ dnsutils
+ iputils
+ profanity
+ file
+ lf
+ ueberzug
+ lynx
pstree
pywal
bashInteractive
diff --git a/shell-scripts/kakup b/shell-scripts/kakup
index f2f894b..df9b17f 100755
--- a/shell-scripts/kakup
+++ b/shell-scripts/kakup
@@ -29,7 +29,7 @@ session-or-client() {
search() {
if tty -s
then
- fd -d1 "." -t d $HOME $HOME/projects | fzf -1
+ project="$(fd -d1 "." -t d $HOME $HOME/projects | fzf -1)"
else
output=$(mktemp -d /tmp/kakup.XXXXXXXX)/fifo
mkfifo ${output}
diff --git a/shell-scripts/lfub b/shell-scripts/lfub
new file mode 100644
index 0000000..9012f50
--- /dev/null
+++ b/shell-scripts/lfub
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# This is a wrapper script for lb that allows it to create image previews with
+# ueberzug. This works in concert with the lf configuration file and the
+# lf-cleaner script.
+
+set -e
+
+cleanup() {
+ exec 3>&-
+ rm "$FIFO_UEBERZUG"
+}
+
+if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
+ lf "$@"
+else
+ [ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf"
+ export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$"
+ mkfifo "$FIFO_UEBERZUG"
+ ueberzug layer -s <"$FIFO_UEBERZUG" -p json &
+ exec 3>"$FIFO_UEBERZUG"
+ trap cleanup HUP INT QUIT TERM PWR EXIT
+ lf "$@" 3>&-
+fi
diff --git a/shell-scripts/mailsync b/shell-scripts/mailsync
index 52d1fff..426e5b7 100644
--- a/shell-scripts/mailsync
+++ b/shell-scripts/mailsync
@@ -83,23 +83,23 @@ syncandnotify() {
esac
}
-allchannels="$(grep -hs "Channel" "$MBSYNCRC" "$MPOPRC" | sort -u)"
+allgroups="$(grep -hs "Group" "$MBSYNCRC" "$MPOPRC" | sort -u)"
# Get accounts to sync. All if no argument. Prefix with `error` if non-existent.
IFS='
'
if [ -z "$1" ]; then
- tosync="$allchannels"
+ tosync="$allgroups"
else
- tosync="$(for arg in "$@"; do for availacc in $allchannels; do
- [ "$arg" = "${availacc##* }" ] && echo "$availacc" && break
+ tosync="$(for arg in "$@"; do for grp in $allgroups; do
+ [ "$arg" = "${grp##* }" ] && echo "$grp" && break
done || echo "error $arg"; done)"
fi
-for channel in $tosync; do
- case $channel in
- Channel*) syncandnotify imap "${channel##* }" & ;;
- account*) syncandnotify pop "${channel##* }" & ;;
+for grp in $tosync; do
+ case $grp in
+ Group*) syncandnotify imap "${grp##* }" & ;;
+ account*) syncandnotify pop "${grp##* }" & ;;
error*) echo "ERROR: Account ${channelt##* } not found." ;;
esac
done
diff --git a/shell-scripts/transadd b/shell-scripts/transadd
new file mode 100644
index 0000000..a598fad
--- /dev/null
+++ b/shell-scripts/transadd
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Mimeapp script for adding torrent to transmission-daemon, but will also start the daemon first if not running.
+
+# transmission-daemon sometimes fails to take remote requests in its first moments, hence the sleep.
+
+pidof transmission-daemon >/dev/null || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}")
+
+transmission-remote -a "$@" && notify-send "🔽 Torrent added."