Script WIP
This commit is contained in:
parent
466aac913a
commit
0f53134dba
31
dotfiles/home-manager/desktop/scripts/init-keys.nix
Normal file
31
dotfiles/home-manager/desktop/scripts/init-keys.nix
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{ pkgs, ... }: {
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
( writeShellApplication {
|
||||||
|
name = "init-keys";
|
||||||
|
runtimeInputs = [
|
||||||
|
ssh-to-age
|
||||||
|
];
|
||||||
|
text = ''
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Asserts all keys are where they belong.
|
||||||
|
|
||||||
|
assert() {
|
||||||
|
TEST_FILE="$1"
|
||||||
|
FILE_HASH="$2"
|
||||||
|
|
||||||
|
if [ ! -f "$1" ]; then
|
||||||
|
echo "Error: Missing file $1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
TEST_HASH="$(sha256sum "$TEST_FILE" | cut -d' ' -f1)"
|
||||||
|
if [ ! "$HASH" == "$FILE_HASH" ]; then
|
||||||
|
echo "Error: File hash mismatch $1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
} )
|
||||||
|
];
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user