From 2a98e4f8dbe372bc79084e3032aa3857cdf93eac Mon Sep 17 00:00:00 2001 From: Christoph Schmatzler Date: Thu, 5 Mar 2026 16:05:14 +0000 Subject: [PATCH] update script --- apps/aarch64-darwin/update | 21 +++++++++++++++++++++ apps/x86_64-linux/update | 21 +++++++++++++++++++++ modules/apps.nix | 3 ++- 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100755 apps/aarch64-darwin/update create mode 100755 apps/x86_64-linux/update diff --git a/apps/aarch64-darwin/update b/apps/aarch64-darwin/update new file mode 100755 index 0000000..371f30e --- /dev/null +++ b/apps/aarch64-darwin/update @@ -0,0 +1,21 @@ +#!/usr/bin/env nu + +use ../common.nu * + +def main [...inputs: string] { + if ($inputs | is-empty) { + print_info "Updating all flake inputs" + nix flake update + } else { + print_info $"Updating flake inputs: ($inputs | str join ', ')" + nix flake update ...$inputs + } + + print_info "Regenerating flake.nix" + nix run .#write-flake + + print_info "Formatting" + alejandra . + + print_success "Flake updated" +} diff --git a/apps/x86_64-linux/update b/apps/x86_64-linux/update new file mode 100755 index 0000000..371f30e --- /dev/null +++ b/apps/x86_64-linux/update @@ -0,0 +1,21 @@ +#!/usr/bin/env nu + +use ../common.nu * + +def main [...inputs: string] { + if ($inputs | is-empty) { + print_info "Updating all flake inputs" + nix flake update + } else { + print_info $"Updating flake inputs: ($inputs | str join ', ')" + nix flake update ...$inputs + } + + print_info "Regenerating flake.nix" + nix run .#write-flake + + print_info "Formatting" + alejandra . + + print_success "Flake updated" +} diff --git a/modules/apps.nix b/modules/apps.nix index 2e3249d..6051cc5 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -9,6 +9,7 @@ build = "Build configuration"; build-switch = "Build and switch configuration"; rollback = "Rollback to previous generation"; + update = "Update flake inputs and regenerate flake.nix"; }; mkApp = name: { type = "app"; @@ -19,7 +20,7 @@ '')}/bin/${name}"; meta.description = descriptions.${name}; }; - appNames = ["apply" "build" "build-switch" "rollback"]; + appNames = ["apply" "build" "build-switch" "rollback" "update"]; in { apps = pkgs.lib.genAttrs appNames mkApp