nixos-configuration/justfile
2025-04-09 10:20:44 +02:00

34 lines
1 KiB
Makefile

usb_ram_disk := "/dev/disk/by-label/RAM_USB"
usb_ram_mountpoint := shell("findmnt -n -o TARGET $1 || true", usb_ram_disk)
boot:
nixos-rebuild boot --flake . --use-remote-sudo
which fwupdmgr >/dev/null 2>&1 && fwupdmgr update || true
switch:
nixos-rebuild switch --flake . --use-remote-sudo
which fwupdmgr >/dev/null 2>&1 && fwupdmgr update || true
build:
nixos-rebuild build --flake .
update:
nix flake update --commit-lock-file
which fwupdmgr >/dev/null 2>&1 && fwupdmgr refresh || true
repl:
nix repl --expr "\
let \
flake = builtins.getFlake \"$(git rev-parse --show-toplevel)\"; in \
flake // (with flake; { \
lib = inputs.nixpkgs.lib; \
pkgs = inputs.nixpkgs.legacyPackages."\${builtins.currentSystem}".extend(import ./pkgs inputs); \
}) \
"
luks-pass host:
@if [ -d "{{usb_ram_mountpoint}}" ]; then \
gpg -d hosts/{{host}}/luks-passfile.gpg > "{{usb_ram_mountpoint}}/{{host}}.key"; \
else \
echo "Mount point not found. Is the usb device plugged and mounted?" >&2; \
fi