From a5da0abbc2a76b53c14e47e88db43e6dbcaaea02 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 16 Mar 2023 11:41:30 +0000 Subject: [PATCH] pkgs: diff-flake: 0.3.0 -> 0.3.1 Add all dev shells when run without any arguments. --- pkgs/diff-flake/default.nix | 2 +- pkgs/diff-flake/diff-flake | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/pkgs/diff-flake/default.nix b/pkgs/diff-flake/default.nix index f24bc59..ce38934 100644 --- a/pkgs/diff-flake/default.nix +++ b/pkgs/diff-flake/default.nix @@ -1,7 +1,7 @@ { lib, coreutils, git, gnused, makeWrapper, stdenvNoCC }: stdenvNoCC.mkDerivation rec { pname = "diff-flake"; - version = "0.3.0"; + version = "0.3.1"; src = ./diff-flake; diff --git a/pkgs/diff-flake/diff-flake b/pkgs/diff-flake/diff-flake index ffb5c65..fa4a88f 100755 --- a/pkgs/diff-flake/diff-flake +++ b/pkgs/diff-flake/diff-flake @@ -20,11 +20,13 @@ sanitize_output() { fi } +current_system() { + nix eval --raw --impure --expr 'builtins.currentSystem' +} + add_shell() { - local SYSTEM - SYSTEM="$(nix eval --raw --impure --expr 'builtins.currentSystem')" # Use 'inputDerivation' attribute to make sure that it is build-able - FLAKE_OUTPUTS+=("devShells.$SYSTEM.$1.inputDerivation") + FLAKE_OUTPUTS+=("devShells.$(current_system).\"$1\".inputDerivation") } add_host() { @@ -58,7 +60,7 @@ usage() { print_err " if no name is given, defaults to 'default'" print_err "" print_err "when no flake outputs are specified, automatically queries for" - print_err "all NixOS configurations, and devShell for current system" + print_err "all NixOS configurations, and devShells for current system" } is_option() { @@ -126,6 +128,12 @@ list_nixos_configurations() { --raw } +list_dev_shells() { + nix eval ".#devShells.$(current_system)" \ + --apply 'attrs: with builtins; concatStringsSep "\n" (attrNames attrs)' \ + --raw +} + diff_output() { local PREV NEW; PREV="$(mktemp --dry-run)" @@ -148,7 +156,9 @@ if [ "${#FLAKE_OUTPUTS[@]}" -eq 0 ]; then for host in $(list_nixos_configurations); do add_host "$host" done - add_shell "default" + for shell in $(list_dev_shells); do + add_shell "$shell" + done fi for out in "${FLAKE_OUTPUTS[@]}"; do