home

My NixOS systems configurations.
Log | Files | Refs | LICENSE

commit e5005819742f1a723140a8c8ab334bbde3d83c07
parent 6d329df6218e1406b59922b33032be6ecc6a007c
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Mon, 29 Aug 2022 17:44:41 +0200

tools: remove unused tools

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Mbin/__dispatch.sh | 6------
Dbin/system | 2--
Dbin/univ | 2--
Dtools/system/default.nix | 11-----------
Dtools/system/system | 69---------------------------------------------------------------------
Dtools/univ/default.nix | 11-----------
Dtools/univ/univ.sh | 58----------------------------------------------------------
7 files changed, 0 insertions(+), 159 deletions(-)

diff --git a/bin/__dispatch.sh b/bin/__dispatch.sh @@ -10,12 +10,6 @@ readonly REPO_ROOT=$(dirname "$0")/.. TARGET_TOOL=$(basename "$0") case "${TARGET_TOOL}" in - univ) - attr="tools.univ" - ;; - system) - attr="tools.system" - ;; bus) attr="tools.bus" ;; diff --git a/bin/system b/bin/system @@ -1 +0,0 @@ -__dispatch.sh- \ No newline at end of file diff --git a/bin/univ b/bin/univ @@ -1 +0,0 @@ -__dispatch.sh- \ No newline at end of file diff --git a/tools/system/default.nix b/tools/system/default.nix @@ -1,11 +0,0 @@ -{ stdenv }: - -stdenv.mkDerivation { - name = "system"; - src = ./.; - phases = [ "installPhase" "fixupPhase" ]; - installPhase = '' - mkdir -p $out $out/bin - cp $src/system $out/bin/system - ''; -} diff --git a/tools/system/system b/tools/system/system @@ -1,69 +0,0 @@ -#! /usr/bin/env bash -set -o pipefail -o noclobber -o nounset - -WORK_DIR=${WORK_DIR-} -if [[ -z "${WORK_DIR}" ]]; then - WORK_DIR="$(mktemp --tmpdir -u nix-config-sync.XXXXXXXXXX)" - # shellcheck disable=2064 - trap "rm -rf '$WORK_DIR'" EXIT -fi -function error() { - local red - local reset - red="$(tput -Txterm setaf 1)" - reset="$(tput -Txterm sgr0)" - - printf "%s%s%s\n" "$red" "$*" "$reset" - exit 1 -} - -function dry-build() { - [ "$#" -eq 0 ] || error "build" - local machine - machine="$(hostname)" - unset NIX_PATH - nix build -L systems.nix --show-trace --dry-run --out-link "$WORK_DIR" "$machine" || - error "Failed to build system" -} - -function build() { - [ "$#" -eq 0 ] || error "build" - local machine - machine="$(hostname)" - unset NIX_PATH - nix build -L -f systems.nix --show-trace --out-link "$WORK_DIR" "$machine" || - error "Failed to build system" -} - -function switch() { - [ "$#" -eq 0 ] || error "switch" - build - local switch_bin="$WORK_DIR/bin/switch-to-configuration" - sudo nix-env --set \ - --profile "/nix/var/nix/profiles/system" \ - "$WORK_DIR" || - error "Failed to activate profile" - sudo "$switch_bin" "switch" || - error "Failed to activate system" -} - -function boot() { - [ "$#" -eq 0 ] || error "switch" - build - local switch_bin="$WORK_DIR/bin/switch-to-configuration" - sudo nix-env --set \ - --profile "/nix/var/nix/profiles/system" \ - "$WORK_DIR" || - error "Failed to activate profile" - sudo "$switch_bin" "boot" || - error "Failed to activate system" -} - -function main() { - for target in $@; do - $target - done - exit 0 -} - -main "$@" diff --git a/tools/univ/default.nix b/tools/univ/default.nix @@ -1,11 +0,0 @@ -{ stdenv }: - -stdenv.mkDerivation { - name = "univ"; - src = ./.; - phases = [ "installPhase" "fixupPhase" ]; - installPhase = '' - mkdir -p $out $out/bin - cp $src/univ.sh $out/bin/univ - ''; -} diff --git a/tools/univ/univ.sh b/tools/univ/univ.sh @@ -1,58 +0,0 @@ -#!/usr/bin/env bash -# univ: update niv (and generate a nice commit) - -set -euo pipefail - -SOURCES=nix/sources.json - -error() { - echo "::error::$*" - exit 1 -} - -update() { - local dep=$1 - echo "checking for update: $dep" >&2 - owner=$(jq -r ".\"$dep\".owner" < ${SOURCES}) - repo=$(jq -r ".\"$dep\".repo" < ${SOURCES}) - old_rev=$(jq -r ".\"$dep\".rev" < ${SOURCES}) - dep_url=$(jq -r ".\"$dep\".url // empty" < "${SOURCES}" | { grep github.com || true; }) - [[ -n $dep_url ]] && is_github="yes" || is_github="" - niv update $dep 1>&2 - new_rev=$(jq -r ".\"$dep\".rev" < ${SOURCES}) - if [[ $old_rev == $new_rev ]]; then - echo "… no updates" >&2 - return - fi - echo "$dep: ${old_rev} to ${new_rev}" - if [[ -z $is_github ]]; then - echo "$dep not using github.com, no changelog" - else - merges_filter="" - hub api "/repos/$owner/$repo/compare/${old_rev}...${new_rev}" \ - | jq -r '.commits[] '"$merges_filter"' | "* [`\(.sha[0:8])`](\(.html_url)) \(.commit.message | split("\n") | first)"' \ - | sed "s~\(#[0-9]\+\)~$owner/$repo\1~g" - fi -} - -main() { - message=$(mktemp) - commit_msg=$(mktemp) - for dep in $(jq -r 'keys[]' < ${SOURCES}); do - update $dep >> $message - echo "" >> $message - done - echo $message $commit_msg - content=$(cat $message | tr -d '\n') - if [[ -z "$content" ]]; then - echo "No updates, do nothing" - exit 0 - fi - echo "nix: niv update(s)" > $commit_msg - echo "" >> $commit_msg - cat $message >> $commit_msg - git add nix - git commit -F $commit_msg -} - -main $@