Compare commits

..

2 commits

Author SHA1 Message Date
Lukas Wurzinger 2d2bdcf955
puter 2024-12-29 00:09:07 +01:00
Lukas Wurzinger 5d0c0b9757
puter 2024-12-29 00:06:13 +01:00
3 changed files with 97 additions and 12 deletions

72
common/puter/puter.bash Normal file
View file

@ -0,0 +1,72 @@
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
progname=$0
error() {
for line in "$@"; do
printf '%s\n' "$progname: $line" 1>&2
done
exit 1
}
args=$(getopt --options f --longoptions=flake: --name "$progname" -- "$@")
eval set -- "$args"
flake=git+https://forgejo@tea.wrz.one/lukas/puter.git#$(hostname)
flags=(
--refresh
--use-remote-sudo
--no-write-lock-file
)
while true; do
case $1 in
(-f | --flake)
flake=$2
shift 2
;;
(-v | --verbose)
flags+=(--verbose)
shift
;;
(--)
shift
break
;;
esac
done
if (( $# == 0 )); then
error 'a subcommand is required'
fi
subcommand=$1
case $subcommand in
(s | switch)
shift
if (( $# > 0 )); then
error 'too many arguments'
fi
nixos-rebuild switch "${flags[@]}" --flake "$flake"
;;
(b | boot)
shift
if (( $# > 0 )); then
error 'too many arguments'
fi
nixos-rebuild boot "${flags[@]}" --flake "$flake"
;;
(*)
error 'invalid subcommand'
;;
esac

13
common/puter/puter.nix Normal file
View file

@ -0,0 +1,13 @@
{pkgs, ...}: let
puter = pkgs.writeShellScriptBin {
name = "puter";
runtimeInputs = [
pkgs.nixos-rebuild
];
text = builtins.readFile ./puter.bash;
};
in {
environment.systemPackages = [
puter
];
}

View file

@ -405,11 +405,11 @@
},
"hardware": {
"locked": {
"lastModified": 1734954597,
"narHash": "sha256-QIhd8/0x30gEv8XEE1iAnrdMlKuQ0EzthfDR7Hwl+fk=",
"lastModified": 1735388221,
"narHash": "sha256-e5IOgjQf0SZcFCEV/gMGrsI0gCJyqOKShBQU0iiM3Kg=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "def1d472c832d77885f174089b0d34854b007198",
"rev": "7c674c6734f61157e321db595dbfcd8523e04e19",
"type": "github"
},
"original": {
@ -570,11 +570,11 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1735263434,
"narHash": "sha256-5Bn1c2sWzedpGV+PNfXtoainQ3uUKkx/v7T3N6lKKms=",
"lastModified": 1735362320,
"narHash": "sha256-nNPTwaTLwMFX4Y0ugxwubIw2LJ+qt2g2FrwBVjRr1zI=",
"owner": "lilyinstarlight",
"repo": "nixos-cosmic",
"rev": "e5fdfe023742172ec0e7af0ca6d88362228d14b7",
"rev": "7da43ac24467b538ae5f07117709665b189887fd",
"type": "github"
},
"original": {
@ -753,11 +753,11 @@
},
"nixpkgs_9": {
"locked": {
"lastModified": 1734649271,
"narHash": "sha256-4EVBRhOjMDuGtMaofAIqzJbg4Ql7Ai0PSeuVZTHjyKQ=",
"lastModified": 1735291276,
"narHash": "sha256-NYVcA06+blsLG6wpAbSPTCyLvxD/92Hy4vlY9WxFI1M=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d70bd19e0a38ad4790d3913bf08fcbfc9eeca507",
"rev": "634fd46801442d760e09493a794c4f15db2d0cbb",
"type": "github"
},
"original": {
@ -790,11 +790,11 @@
]
},
"locked": {
"lastModified": 1735180071,
"narHash": "sha256-ceUDFBsLf5Cz3GlhQAdaJsEfi5s1MDjDsO9VvPFoKAE=",
"lastModified": 1735266518,
"narHash": "sha256-2XkWYGgT+911gOLjgBj+8W8ZJk6P0qHJNz8RfKgT/5o=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "550e1f10be4a504747a7894c35e887e61235763b",
"rev": "e0b3654b716098b47f3643c65fbb75ef49c033e1",
"type": "github"
},
"original": {