full restructure of flake.nix
- split flake into "submodules" - make "submodules" independent of systemmain
parent
08e73d0dec
commit
e9255c43d0
@ -0,0 +1,17 @@
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
self,
|
||||
...
|
||||
}@flakeArg:
|
||||
{ system, ... }@sysArg:
|
||||
{
|
||||
|
||||
# shortcut to fully configured secrix
|
||||
secrix =
|
||||
assert lib.assertMsg (system == "x86_64-linux") ''
|
||||
secrix is currently only compatible with x86_64-linux
|
||||
'';
|
||||
inputs.secrix.secrix self;
|
||||
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
{ outputs, ... }@flakeArg:
|
||||
{ pkgs_unstable, system, ... }@sysArg:
|
||||
let
|
||||
pkgs = pkgs_unstable;
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
packages =
|
||||
(with pkgs; [
|
||||
curl
|
||||
mkpasswd
|
||||
rsync
|
||||
opentofu
|
||||
terranix
|
||||
# tooling for services
|
||||
wireguard-tools
|
||||
])
|
||||
++ [
|
||||
# flake stuff
|
||||
outputs.packages.${system}.secrix-wrapper
|
||||
];
|
||||
# TODO magic
|
||||
shellHook = ''
|
||||
export SECRIX_ID=~/".ssh/id_ed25519"
|
||||
'';
|
||||
};
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
{ lib, outputs, ... }@flakeArg:
|
||||
{ pkgs, system, ... }@sysArg:
|
||||
let
|
||||
inherit (lib) assertMsg;
|
||||
in
|
||||
{
|
||||
|
||||
secrix-wrapper =
|
||||
assert assertMsg (system == "x86_64-linux") "secrix is currently only compatible with x86_64-linux";
|
||||
let
|
||||
secrixExe = outputs.apps.${system}.secrix.program;
|
||||
in
|
||||
pkgs.writeShellApplication {
|
||||
name = "secr";
|
||||
text = ''
|
||||
secrix() {
|
||||
set -x
|
||||
exec ${secrixExe} "$@"
|
||||
}
|
||||
|
||||
help() {
|
||||
echo "Usages:"
|
||||
echo " $0 [create|rekey|edit|encrypt] <system> [<args> …] <file>"
|
||||
echo " $0 decrypt [<args> …] <file>"
|
||||
}
|
||||
|
||||
main() {
|
||||
if [[ $# -lt 1 ]]; then
|
||||
help
|
||||
exit 0
|
||||
fi
|
||||
cmd="$1"
|
||||
shift 1
|
||||
case "$cmd" in
|
||||
help|-h|--help)
|
||||
help
|
||||
;;
|
||||
create)
|
||||
secrix "$cmd" --all-users --system "$@"
|
||||
;;
|
||||
rekey|edit)
|
||||
secrix "$cmd" --identity "$SECRIX_ID" --all-users --system "$@"
|
||||
;;
|
||||
encrypt)
|
||||
secrix "$cmd" --all-users --system "$@"
|
||||
;;
|
||||
decrypt)
|
||||
secrix "$cmd" --identity "$SECRIX_ID" "$@"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main "$@"
|
||||
'';
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue