Compare commits
13 commits
3feb7fe10d
...
b9b105a957
| Author | SHA1 | Date | |
|---|---|---|---|
| b9b105a957 | |||
| f80dc3f707 | |||
| 6c9cb5d5d8 | |||
| 515f4c58c9 | |||
| 22e4f07baf | |||
| 99b5412f83 | |||
| 09f20619ce | |||
| 1c1f20a324 | |||
| 59e3c9a128 | |||
| 649eb89742 | |||
| b553d21e56 | |||
| db9d8e76cf | |||
| 29fb7c5066 |
2 changed files with 63 additions and 14 deletions
|
|
@ -1,8 +1,6 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.my.home.discord;
|
cfg = config.my.home.discord;
|
||||||
|
|
||||||
jsonFormat = pkgs.formats.json { };
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.my.home.discord = with lib; {
|
options.my.home.discord = with lib; {
|
||||||
|
|
@ -12,14 +10,15 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
home.packages = with pkgs; [
|
programs.discord = {
|
||||||
cfg.package
|
enable = true;
|
||||||
];
|
|
||||||
|
|
||||||
xdg.configFile."discord/settings.json".source =
|
inherit (cfg) package;
|
||||||
jsonFormat.generate "discord.json" {
|
|
||||||
|
settings = {
|
||||||
# Do not keep me from using the app just to force an update
|
# Do not keep me from using the app just to force an update
|
||||||
SKIP_HOST_UPDATE = true;
|
SKIP_HOST_UPDATE = true;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,15 @@ current_system() {
|
||||||
nix eval --raw --impure --expr 'builtins.currentSystem'
|
nix eval --raw --impure --expr 'builtins.currentSystem'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_darwin() {
|
||||||
|
FLAKE_OUTPUTS+=("darwinConfigurations.\"$1\".config.system.build.toplevel")
|
||||||
|
}
|
||||||
|
|
||||||
add_home() {
|
add_home() {
|
||||||
FLAKE_OUTPUTS+=("homeConfigurations.\"$1\".activationPackage")
|
FLAKE_OUTPUTS+=("homeConfigurations.\"$1\".activationPackage")
|
||||||
}
|
}
|
||||||
|
|
||||||
add_host() {
|
add_nixos() {
|
||||||
FLAKE_OUTPUTS+=("nixosConfigurations.\"$1\".config.system.build.toplevel")
|
FLAKE_OUTPUTS+=("nixosConfigurations.\"$1\".config.system.build.toplevel")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -37,6 +41,10 @@ add_shell() {
|
||||||
FLAKE_OUTPUTS+=("devShells.\"$(current_system)\".\"$1\".inputDerivation")
|
FLAKE_OUTPUTS+=("devShells.\"$(current_system)\".\"$1\".inputDerivation")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_system() {
|
||||||
|
FLAKE_OUTPUTS+=("systemConfigs.\"$1\".config.system.build.toplevel")
|
||||||
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
print_err "Usage: $0 [option]... [-- [nix build option]...]"
|
print_err "Usage: $0 [option]... [-- [nix build option]...]"
|
||||||
print_err ""
|
print_err ""
|
||||||
|
|
@ -54,11 +62,15 @@ usage() {
|
||||||
print_err " -p, --previous-rev"
|
print_err " -p, --previous-rev"
|
||||||
print_err " which git revision should be considered the 'previous' state,"
|
print_err " which git revision should be considered the 'previous' state,"
|
||||||
print_err " defaults to HEAD~"
|
print_err " defaults to HEAD~"
|
||||||
|
print_err " --darwin [name]"
|
||||||
|
print_err " specify the name of a nix-darwin 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 " --home [name]"
|
print_err " --home [name]"
|
||||||
print_err " specify the name of a home-manager output configuration whose"
|
print_err " specify the name of a home-manager output configuration whose"
|
||||||
print_err " closure should be diffed, can be used multiple times"
|
print_err " closure should be diffed, can be used multiple times"
|
||||||
print_err " if no configuration name is given, defaults to current username"
|
print_err " if no configuration name is given, defaults to current username"
|
||||||
print_err " --host [name]"
|
print_err " --nixos [name]"
|
||||||
print_err " specify the name of a NixOS output configuration whose"
|
print_err " specify the name of a NixOS output configuration whose"
|
||||||
print_err " closure should be diffed, can be used multiple times"
|
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 " if no host name is given, defaults to current hostname"
|
||||||
|
|
@ -66,6 +78,10 @@ usage() {
|
||||||
print_err " specify a specific devShell configuration name whose closure"
|
print_err " specify a specific devShell configuration name whose closure"
|
||||||
print_err " should be diffed, can be used multiple times"
|
print_err " should be diffed, can be used multiple times"
|
||||||
print_err " if no name is given, defaults to 'default'"
|
print_err " if no name is given, defaults to 'default'"
|
||||||
|
print_err " --system [name]"
|
||||||
|
print_err " specify the name of a system-manager 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 ""
|
print_err ""
|
||||||
print_err "when no flake outputs are specified, automatically queries for"
|
print_err "when no flake outputs are specified, automatically queries for"
|
||||||
print_err "all NixOS configurations, and devShells for current system"
|
print_err "all NixOS configurations, and devShells for current system"
|
||||||
|
|
@ -101,6 +117,14 @@ parse_args() {
|
||||||
PREVIOUS_REV="$(git rev-parse "$1")"
|
PREVIOUS_REV="$(git rev-parse "$1")"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--darwin)
|
||||||
|
if [ $# -gt 0 ] && ! is_option "$1"; then
|
||||||
|
add_darwin "$1"
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
add_darwin "$(hostname)"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
--home)
|
--home)
|
||||||
if [ $# -gt 0 ] && ! is_option "$1"; then
|
if [ $# -gt 0 ] && ! is_option "$1"; then
|
||||||
add_home "$1"
|
add_home "$1"
|
||||||
|
|
@ -109,12 +133,12 @@ parse_args() {
|
||||||
add_home "$USER"
|
add_home "$USER"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
--host)
|
--nixos)
|
||||||
if [ $# -gt 0 ] && ! is_option "$1"; then
|
if [ $# -gt 0 ] && ! is_option "$1"; then
|
||||||
add_host "$1"
|
add_nixos "$1"
|
||||||
shift
|
shift
|
||||||
else
|
else
|
||||||
add_host "$(hostname)"
|
add_nixos "$(hostname)"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
--shell)
|
--shell)
|
||||||
|
|
@ -125,6 +149,14 @@ parse_args() {
|
||||||
add_shell "default"
|
add_shell "default"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
--system)
|
||||||
|
if [ $# -gt 0 ] && ! is_option "$1"; then
|
||||||
|
add_system "$1"
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
add_system "$(hostname)"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
--)
|
--)
|
||||||
NIX_BUILD_ARGS=("$@")
|
NIX_BUILD_ARGS=("$@")
|
||||||
break
|
break
|
||||||
|
|
@ -138,6 +170,12 @@ parse_args() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list_darwin_configurations() {
|
||||||
|
nix eval '.#darwinConfigurations' \
|
||||||
|
--apply 'attrs: with builtins; concatStringsSep "\n" (attrNames attrs)' \
|
||||||
|
--raw
|
||||||
|
}
|
||||||
|
|
||||||
list_home_configurations() {
|
list_home_configurations() {
|
||||||
nix eval '.#homeConfigurations' \
|
nix eval '.#homeConfigurations' \
|
||||||
--apply 'attrs: with builtins; concatStringsSep "\n" (attrNames attrs)' \
|
--apply 'attrs: with builtins; concatStringsSep "\n" (attrNames attrs)' \
|
||||||
|
|
@ -156,6 +194,12 @@ list_dev_shells() {
|
||||||
--raw
|
--raw
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list_system_configurations() {
|
||||||
|
nix eval '.#systemConfigs' \
|
||||||
|
--apply 'attrs: with builtins; concatStringsSep "\n" (attrNames attrs)' \
|
||||||
|
--raw
|
||||||
|
}
|
||||||
|
|
||||||
diff_output() {
|
diff_output() {
|
||||||
local PREV NEW
|
local PREV NEW
|
||||||
PREV="$(mktemp --dry-run)"
|
PREV="$(mktemp --dry-run)"
|
||||||
|
|
@ -175,15 +219,21 @@ diff_output() {
|
||||||
parse_args "$@"
|
parse_args "$@"
|
||||||
|
|
||||||
if [ "${#FLAKE_OUTPUTS[@]}" -eq 0 ]; then
|
if [ "${#FLAKE_OUTPUTS[@]}" -eq 0 ]; then
|
||||||
|
for darwin in $(list_darwin_configurations); do
|
||||||
|
add_darwin "$darwin"
|
||||||
|
done
|
||||||
for home in $(list_home_configurations); do
|
for home in $(list_home_configurations); do
|
||||||
add_home "$home"
|
add_home "$home"
|
||||||
done
|
done
|
||||||
for host in $(list_nixos_configurations); do
|
for nixos in $(list_nixos_configurations); do
|
||||||
add_host "$host"
|
add_nixos "$nixos"
|
||||||
done
|
done
|
||||||
for shell in $(list_dev_shells); do
|
for shell in $(list_dev_shells); do
|
||||||
add_shell "$shell"
|
add_shell "$shell"
|
||||||
done
|
done
|
||||||
|
for system in $(list_system_configurations); do
|
||||||
|
add_system "$system"
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for out in "${FLAKE_OUTPUTS[@]}"; do
|
for out in "${FLAKE_OUTPUTS[@]}"; do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue