Compare commits

...

7 commits

Author SHA1 Message Date
teutat3s e1052d75cd
teutat3s: remove hashicorp CLIs
They are no longer open source ;(
2024-04-18 13:02:11 +02:00
teutat3s 74dfae9076
nix: use version 2.21 2024-04-18 13:01:12 +02:00
teutat3s 746c8d19ac
dumpyourvms: use DNS for wg5 2024-04-18 13:00:32 +02:00
teutat3s b81890d769
nixos-unstable: fixes for NixOS 24.05
Wireplumber config changes for bluetooth
pinentryFlavor -> pinentryPackage
alacritty config changed to TOML
alacritty deprecated config fixes
Nix registry now gets generated from flake inputs ->
(nixpkgs.flake.setFlakeRegistry)
nssmdns -> nssmdns4
2024-04-18 12:57:14 +02:00
teutat3s 08bd4c519a
flake: switch to nixos-unstable (early NixOS 24.05) 2024-04-18 12:55:24 +02:00
teutat3s def1b53712
ble.sh use ~ as normal vi mode indicator 2024-04-18 12:53:44 +02:00
teutat3s f45fa35e90
paperless: init scan2paperless script 2024-04-18 12:53:25 +02:00
16 changed files with 101 additions and 116 deletions

View file

@ -166,27 +166,27 @@
]
},
"locked": {
"lastModified": 1712386041,
"narHash": "sha256-dA82pOMQNnCJMAsPG7AXG35VmCSMZsJHTFlTHizpKWQ=",
"lastModified": 1713391096,
"narHash": "sha256-5xkzsy+ILgQlmvDDipL5xqAehnjWBenAQXV4/NLg2dE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "d6bb9f934f2870e5cbc5b94c79e9db22246141ff",
"rev": "f46814ec7cbef9c2aef18ca1cbe89f2bb1e8c394",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-23.11",
"ref": "master",
"repo": "home-manager",
"type": "github"
}
},
"master": {
"locked": {
"lastModified": 1713124637,
"narHash": "sha256-RU0SoHGn2aYXYcnjCBg4/1S+zMZx9tA1dPUE+P2IH9g=",
"lastModified": 1713276496,
"narHash": "sha256-qhImB8hRIRh2eMLqBSlUPKb870s4N8WJNqGfJfhSfMg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ec2cb66cbeac92550b324009773b83401a9e2477",
"rev": "e2ce6703871b62a77f5939d5967833b43c928ed0",
"type": "github"
},
"original": {
@ -265,16 +265,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1713013257,
"narHash": "sha256-ZEfGB3YCBVggvk0BQIqVY7J8XF/9jxQ68fCca6nib+8=",
"lastModified": 1713248628,
"narHash": "sha256-NLznXB5AOnniUtZsyy/aPWOk8ussTuePp2acb9U+ISA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "90055d5e616bd943795d38808c94dbf0dd35abe8",
"rev": "5672bc9dbf9d88246ddab5ac454e82318d094bb8",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-23.11",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
@ -329,7 +329,6 @@
"nixpkgs": "nixpkgs",
"triton-vmtools": "triton-vmtools",
"tritonshell": "tritonshell",
"unstable": "unstable",
"wayland-pipewire-idle-inhibit": "wayland-pipewire-idle-inhibit"
}
},
@ -400,7 +399,7 @@
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"unstable"
"nixpkgs"
]
},
"locked": {
@ -425,7 +424,7 @@
"devshell": "devshell",
"flake-utils": "flake-utils_2",
"nixpkgs": [
"unstable"
"nixpkgs"
]
},
"locked": {
@ -443,22 +442,6 @@
"url": "https://git.pub.solar/teutat3s/tritonshell"
}
},
"unstable": {
"locked": {
"lastModified": 1712963716,
"narHash": "sha256-WKm9CvgCldeIVvRz87iOMi8CFVB1apJlkUT4GGvA0iM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "cfd6b5fc90b15709b780a5a1619695a88505a176",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems_2"

View file

@ -6,8 +6,8 @@
inputs = {
# Track channels with commits tested and built by hydra
nixos-22-05.url = "github:nixos/nixpkgs/nixos-22.05";
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
unstable.url = "github:nixos/nixpkgs/nixos-unstable";
#nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
master.url = "github:nixos/nixpkgs/master";
fork.url = "github:teutat3s/nixpkgs/fix-element-desktop-screen-sharing-23.11";
@ -18,7 +18,7 @@
nix-darwin.url = "github:lnl7/nix-darwin/master";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager/release-23.11";
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
@ -37,10 +37,10 @@
# PubSolarOS additions
triton-vmtools.url = "git+https://git.pub.solar/pub-solar/infra-vintage?ref=main&dir=vmtools";
triton-vmtools.inputs.nixpkgs.follows = "unstable";
triton-vmtools.inputs.nixpkgs.follows = "nixpkgs";
tritonshell.url = "git+https://git.pub.solar/teutat3s/tritonshell?ref=main";
tritonshell.inputs.nixpkgs.follows = "unstable";
tritonshell.inputs.nixpkgs.follows = "nixpkgs";
wayland-pipewire-idle-inhibit.url = "github:rafaelrc7/wayland-pipewire-idle-inhibit";
wayland-pipewire-idle-inhibit.inputs.nixpkgs.follows = "nixpkgs";

View file

@ -133,8 +133,7 @@
publicKey = "UhPW8jebAPaMYqjJfSFO9QAMhk0E+dq4i6lB4Wjg91Q=";
presharedKeyFile = "/etc/wireguard/wg5.presharedkey";
allowedIPs = [ "192.168.13.0/24" ];
#endpoint = "ktjh20jr89gkcqwr.myfritz.net:59538";
endpoint = "[2001:4dd0:af08:5725:9ec7:a6ff:feff:e14d]:51820";
endpoint = "ktjh20jr89gkcqwr.myfritz.net:59538";
persistentKeepalive = 25;
}
];

View file

@ -13,33 +13,6 @@ with lib; let
backupDir = "${xdg.dataHome}/PaperlessBackup";
consumptionDir = "/home/${psCfg.user.name}/.local/share/scandir";
scan2paperless = with pkgs; writeShellScriptBin "scan2paperless" ''
DEVICE=$1
NUM_PAGES=$2
NAME=$3
if [ -z "''${DEVICE}" ] || [ -z "''${NUM_PAGES}" ] || [ -z "''${NAME}" ]; then
echo "Usage: scan2paperless <device> <num_pages> <name>"
exit 1
fi
tmpDir=$(${coreutils}/bin/mktemp -d)
files=()
for i in $(seq 1 $NUM_PAGES); do
fileName=$(${openssl}/bin/openssl rand -hex 12)
file="$tmpDir/$fileName.jpg"
echo "Start scanning page $i/$NUM_PAGES";
${sane-backends}/bin/scanimage -d $DEVICE --format=jpeg --resolution 300 --progress -o $file
echo "Finished scanning page $i";
files+=($file)
done
pdf="${consumptionDir}/$NAME.pdf"
${python3Packages.img2pdf}/bin/img2pdf --output $pdf ''${files[@]}
echo "PDF written to $pdf"
'';
in {
services.paperless = {
enable = true;
@ -60,11 +33,6 @@ in {
#brscan5.enable = true;
};
users.users."${psCfg.user.name}".packages = with pkgs; [
scan2paperless
python3Packages.img2pdf
];
home-manager.users."${psCfg.user.name}" = {
home.sessionVariables = {
SCANNER_OUTPUT_DIR = consumptionDir;

View file

@ -22,14 +22,15 @@
};
services.blueman.enable = true;
environment.etc."wireplumber/bluetooth.lua.d/51-bluez-config.lua" = {
text = ''
bluez_monitor.properties = {
["bluez5.enable-sbc-xq"] = true,
["bluez5.enable-msbc"] = true,
["bluez5.enable-hw-volume"] = true,
["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
services.pipewire.wireplumber.configPackages = [
# https://pipewire.pages.freedesktop.org/wireplumber/daemon/configuration/bluetooth.html
(pkgs.writeTextDir "share/wireplumber/wireplumber.conf.d/10-bluez.conf" ''
monitor.bluez.properties = {
bluez5.enable-hw-volume = true
bluez5.enable-msbc = true
bluez5.enable-sbc-xq = true
bluez5.headset-roles = [ hsp_hs hsp_ag hfp_hf hfp_ag ]
}
'';
};
'')
];
}

View file

@ -22,7 +22,7 @@ in {
services.gpg-agent = {
enable = true;
pinentryFlavor = lib.mkDefault "gnome3";
pinentryPackage = lib.mkDefault pkgs.pinentry-gnome3;
verbose = true;
};

View file

@ -30,9 +30,6 @@
multiplier = 3;
};
# When true, bold text is drawn using the bright variant of colors.
draw_bold_text_with_bright_colors = true;
font = {
# The normal (roman) font face to use.
normal = {
@ -68,7 +65,7 @@
};
};
key_bindings = [
keyboard.bindings = [
{
key = "V";
mods = "Control|Super";
@ -172,6 +169,9 @@
# Base16 Burn 256 - alacritty color config
# Benjamin Bädorf
colors = {
# When true, bold text is drawn using the bright variant of colors.
draw_bold_text_with_bright_colors = true;
# Default colors
primary = {
background = "0x1a181a";

View file

@ -6,7 +6,7 @@
}:
with lib; let
psCfg = config.pub-solar;
yamlFormat = pkgs.formats.yaml {};
tomlFormat = pkgs.formats.toml {};
sessionVariables = {
WLR_RENDERER =
if psCfg.graphical.wayland.software-renderer.enable
@ -101,7 +101,7 @@ in {
home-manager.users."${psCfg.user.name}" = {
home.file."xinitrc".source = ./.xinitrc;
xdg.configFile."alacritty/alacritty.yml".source = yamlFormat.generate "alacritty.yml" (import ./alacritty.nix);
xdg.configFile."alacritty/alacritty.toml".source = tomlFormat.generate "alacritty.toml" (import ./alacritty.nix);
xdg.configFile."xmodmap".source = ./.config/xmodmap;
xdg.configFile."user-dirs.dirs".source = ./.config/user-dirs.dirs;
xdg.configFile."user-dirs.locale".source = ./.config/user-dirs.locale;

View file

@ -11,7 +11,6 @@
"brscan5"
"brscan5-etc-files"
"facetimehd-firmware"
"nomad"
"slack"
"veracrypt"
"zoom"
@ -30,17 +29,10 @@
nix = {
# Use default version alias for nix package
package = pkgs.nixVersions.nix_2_20;
package = pkgs.nixVersions.nix_2_21;
gc.automatic = true;
optimise.automatic = true;
registry = {
nixpkgs.flake = flake.inputs.nixpkgs;
unstable.flake = flake.inputs.unstable;
master.flake = flake.inputs.master;
system.flake = flake.self;
};
settings = {
# Improve nix store disk usage
auto-optimise-store = true;

View file

@ -10,7 +10,7 @@ with lib; let
in {
services.avahi.enable = true;
services.avahi.ipv6 = true;
services.avahi.nssmdns = true;
services.avahi.nssmdns4 = true;
services.avahi.publish.enable = true;
services.avahi.publish.userServices = true;

View file

@ -88,9 +88,6 @@ in {
# Specify \q{ferdinandyb/mode-indicator} in the mode-indicator prompt
bleopt prompt_vi_mode_indicator='\q{ferdinandyb/mode-indicator}'
# In case you would like to show "-- NORMAL --" instead of "~"
bleopt keymap_vi_mode_string_nmap=$'\e[1m-- NORMAL --\e[m'
}
blehook/eval-after-load keymap_vi ferdinandyb/set-up-mode-indicator

View file

@ -26,14 +26,7 @@
};
in
{
direnv = unstable.direnv;
element-desktop = fork.element-desktop;
nixVersions = prev.nixVersions // {inherit (unstable.nixVersions) nix_2_20;};
nix-direnv = unstable.nix-direnv;
_1password = unstable._1password;
_1password-cli = unstable._1password-cli;
wayland-pipewire-idle-inhibit = unstable.wayland-pipewire-idle-inhibit;
wlvncc = unstable.wlvncc;
#vimPlugins = prev.vimPlugins // {inherit (unstable.vimPlugins) nvim-lspconfig;};
})
(import ../pkgs)

View file

@ -13,6 +13,7 @@ with prev; {
psos = writeShellScriptBin "psos" (import ./psos.nix final);
psos-docs = import ./psos-docs.nix final;
s = writeShellScriptBin "s" (import ./s.nix final);
scan2paperless = writeShellScriptBin "scan2paperless" (import ./scan2paperless.nix final);
sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final);
swaylock-bg = writeShellScriptBin "swaylock-bg" (import ./swaylock-bg.nix final);
toggle-kbd-layout = writeShellScriptBin "toggle-kbd-layout" (import ./toggle-kbd-layout.nix final);

59
pkgs/scan2paperless.nix Normal file
View file

@ -0,0 +1,59 @@
self:
with self; ''
echo "$@"
DUPLEX=,Duplex
removeempty="true"
[[ $1 == "-s" ]] && {
DUPLEX=""
removeempty=false
shift
}
[[ $1 == "-a" ]] && {
DUPLEX=,Duplex
removeempty="true"
shift
}
[[ $1 == "-d" ]] && {
DUPLEX=,Duplex
shift
}
cleanup() {
echo finalizing pdf file.
${img2pdf}/bin/img2pdf --pdfa --output /tmp/scan2paperless_$$.pdf /tmp/scan2paperless_$$_*.png && \
rm -f /tmp/scan2paperless_$$_*.png
scp /tmp/scan2paperless_$$.pdf pub-solar@paperless.faenix.eu:~/.local/share/scandir \
&& rm -f /tmp/scan2paperless_$$* \
|| echo upload failed, retaining file /tmp/scan2paperless_$$.pdf >&2
}
trap 'cleanup; exit 1' EXIT
${sane-backends}/bin/scanimage --device 'brother5:bus1;dev5' --format=png --resolution 300 --batch=/tmp/scan2paperless_$$_%d.png --AutoDeskew=yes --batch-start=10 --source="Automatic Document Feeder(left aligned''${DUPLEX})" -x 210 -y 297
if $removeempty
then
threshold=99
images=( )
values=( )
for f in /tmp/scan2paperless_$$_*.png
do
images[''${#images[@]}]=$f
values[''${#values[@]}]=$(${imagemagick}/bin/convert "$f" -fuzz 02% -fill black +opaque white -fill white -opaque white -format "%[fx:100*mean]" info:)
done
for ((i=0;i<''${#images[@]};i++))
do
if [[ $(echo "''${values[i]} > $threshold" | ${bc}/bin/bc -l) == "1" ]]
then
# bc will output 1 if the comparison is true, 0 otherwise
echo image "''${images[i]}" was found to be mostly white, removing.
rm "''${images[i]}"
fi
done
fi
''

View file

@ -1,4 +1,4 @@
{config, ...}: {
{config, pkgs, ...}: {
pub-solar = {
# These are your personal settings
# The only required settings are `name` and `password`,
@ -15,5 +15,5 @@
];
};
};
home-manager.users.pub-solar.services.gpg-agent.pinentryFlavor = "curses";
home-manager.users.pub-solar.services.gpg-agent.pinentryPackage = pkgs.pinentry-curses;
}

View file

@ -66,20 +66,16 @@ in {
home.packages = with pkgs; [
AusweisApp2
consul
drone-docker-runner
gpu-switch
ifmetric
ipmitool
#keybase-gui
nomad
thunderbird
vault
veracrypt
waypoint
age-plugin-yubikey
#cockroach-bin
obs-studio
scan2paperless
wlvncc
];
programs.bash.initExtra = ''
@ -127,11 +123,7 @@ in {
}
complete -F _tailscale tailscale
complete -C ${pkgs.consul}/bin/consul consul
complete -C ${pkgs.nomad}/bin/nomad nomad
complete -C ${pkgs.vault}/bin/vault vault
complete -C ${flake.inputs.nixos-22-05.legacyPackages.${pkgs.system}.terraform}/bin/terraform terraform
complete -C ${pkgs.waypoint}/bin/waypoint waypoint
complete -C ${pkgs.opentofu}/bin/tofu tofu
'';