From b56674728f91cb0dc811ac1c0b5ab93cc977e819 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 16 Mar 2023 11:33:19 +0000 Subject: [PATCH] pkgs: diff-flake: 0.2.0 -> 0.3.0 Change how `devShells` is handled: always build for the current system and instead query for the name of the shell that should be built. --- pkgs/diff-flake/default.nix | 2 +- pkgs/diff-flake/diff-flake | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/pkgs/diff-flake/default.nix b/pkgs/diff-flake/default.nix index 39e8921..f24bc59 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.2.0"; + version = "0.3.0"; src = ./diff-flake; diff --git a/pkgs/diff-flake/diff-flake b/pkgs/diff-flake/diff-flake index 7c106c1..ffb5c65 100755 --- a/pkgs/diff-flake/diff-flake +++ b/pkgs/diff-flake/diff-flake @@ -22,13 +22,9 @@ sanitize_output() { add_shell() { local SYSTEM - if [ $# -gt 0 ] && [ -n "$1" ]; then - SYSTEM="$1" - else - SYSTEM="$(nix eval --raw --impure --expr 'builtins.currentSystem')" - fi + SYSTEM="$(nix eval --raw --impure --expr 'builtins.currentSystem')" # Use 'inputDerivation' attribute to make sure that it is build-able - FLAKE_OUTPUTS+=("devShells.$SYSTEM.default.inputDerivation") + FLAKE_OUTPUTS+=("devShells.$SYSTEM.$1.inputDerivation") } add_host() { @@ -56,10 +52,10 @@ usage() { print_err " specify the name of a NixOS output configuration whose" print_err " closure should be diffed, can be used multiple times" print_err " if no host name is given, defaults to current hostname" - print_err " --shell [system]" - print_err " specify a specific system's devShell output whose closure" + print_err " --shell [name]" + print_err " specify a specific devShell configuration name whose closure" print_err " should be diffed, can be used multiple times" - print_err " if no system is given, defaults to current system" + 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" @@ -108,7 +104,7 @@ parse_args() { add_shell "$1" shift else - add_shell + add_shell "default" fi ;; --) @@ -152,7 +148,7 @@ if [ "${#FLAKE_OUTPUTS[@]}" -eq 0 ]; then for host in $(list_nixos_configurations); do add_host "$host" done - add_shell + add_shell "default" fi for out in "${FLAKE_OUTPUTS[@]}"; do