From 2e2a7bb1f640def9d627af8cc194faf7d911d8bf Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sun, 28 Aug 2022 21:14:14 +0300 Subject: 2022-08-28 --- packages/bruh.nix | 6 ++++++ packages/nixfiles.nix | 25 ++++++++----------------- 2 files changed, 14 insertions(+), 17 deletions(-) (limited to 'packages') diff --git a/packages/bruh.nix b/packages/bruh.nix index a555fcc..62fe557 100644 --- a/packages/bruh.nix +++ b/packages/bruh.nix @@ -1,4 +1,5 @@ { + alsa-utils, fetchFromGitHub, stdenv, }: @@ -13,5 +14,10 @@ stdenv.mkDerivation rec { hash = "sha256-Uw6Qes0IZkkfBchFnvnX9l1ZG5T5pyExmV7yUJLPOJ0="; }; + postPatch = '' + substituteInPlace bruh.c \ + --replace "aplay" "${alsa-utils}/bin/aplay" + ''; + makeFlags = ["PREFIX=$(out)"]; } diff --git a/packages/nixfiles.nix b/packages/nixfiles.nix index 90a5865..47b2c49 100644 --- a/packages/nixfiles.nix +++ b/packages/nixfiles.nix @@ -1,9 +1,7 @@ { git, jq, - lib, nix, - nixfilesSrc ? "$HOME/src/nixfiles", openssh, writeShellApplication, }: @@ -11,17 +9,16 @@ writeShellApplication { name = "nixfiles"; runtimeInputs = [git jq nix openssh]; text = '' - nixfiles=${lib.escapeShellArg nixfilesSrc} cmd="$1" shift - case $cmd in + case "$cmd" in update) if (( $# )); then args=() for input do args+=(--update-input "$input"); done - exec nix flake lock "$nixfiles" "''${args[@]}" + exec nix flake lock "." "''${args[@]}" else - exec nix flake update -v "$nixfiles" + exec nix flake update -v "." fi ;; rev) @@ -35,7 +32,7 @@ writeShellApplication { repl|eval|build) args=() for arg do case $arg in - -w|--wip) args+=(--override-flake config "$nixfiles") + -w|--wip) args+=(--override-flake config ".") ;; *) args+=("$arg") esac done @@ -53,29 +50,23 @@ writeShellApplication { home) attr="nixosConfigurations.$HOSTNAME.config.hm.home.activationPackage" export VERBOSE=1 - exec nix shell --verbose "$nixfiles#$attr" "$@" --command home-manager-generation + exec nix shell --verbose ".#$attr" "$@" --command home-manager-generation ;; specialise) - name=$1 + name="$1" shift exec sudo /run/current-system/specialisation/"$name"/bin/switch-to-configuration switch ;; revert) exec sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch ;; - test-headless) - exec nixos-rebuild build-vm --verbose --print-build-logs --flake "$nixfiles#test-headless" "$@" - ;; - test-headful) - exec nixos-rebuild build-vm --verbose --print-build-logs --flake "$nixfiles#test-headful" "$@" - ;; @*) host="''${cmd#@}" hostname="$(ssh -q "$host" 'echo "$HOSTNAME"')" - exec nixos-rebuild -v --flake "$nixfiles#$hostname" --target-host "$host" --use-remote-sudo "$@" + exec nixos-rebuild -v --flake ".#$hostname" --target-host "$host" --use-remote-sudo "$@" ;; *) - exec nixos-rebuild -v --flake "$nixfiles" --use-remote-sudo "$cmd" "$@" + exec nixos-rebuild -v --flake . --use-remote-sudo "$cmd" "$@" ;; esac ''; -- cgit 1.4.1