diff --git a/nix/nixos-modules/allCommon.nix b/nix/nixos-modules/allCommon.nix index b613f0e..116a49f 100644 --- a/nix/nixos-modules/allCommon.nix +++ b/nix/nixos-modules/allCommon.nix @@ -149,7 +149,7 @@ in text = '' if [[ -e /run/current-system ]]; then echo "--- diff to current-system" - ${pkgs.nvd}/bin/nvd --nix-bin-dir=${config.nix.package}/bin diff /run/current-system "$systemConfig" + ${lib.getExe pkgs.nvd} --nix-bin-dir=${config.nix.package}/bin diff /run/current-system "$systemConfig" echo "---" fi ''; @@ -158,7 +158,7 @@ in # ensure activation scripts are fine # TODO upstream, probably replacing https://github.com/NixOS/nixpkgs/pull/149932 system.activatableSystemBuilderCommands = lib.mkAfter '' - ${pkgs.shellcheck}/bin/shellcheck --check-sourced --external-sources --norc --severity=warning $out/activate $out/dry-activate + ${lib.getExe pkgs.shellcheck} --check-sourced --external-sources --norc --severity=warning $out/activate $out/dry-activate ''; time = { diff --git a/nix/nixos-modules/frontend/default.nix b/nix/nixos-modules/frontend/default.nix index d3020e7..7a7fcbe 100644 --- a/nix/nixos-modules/frontend/default.nix +++ b/nix/nixos-modules/frontend/default.nix @@ -287,7 +287,7 @@ in let hostName = config.networking.hostName; figlet = pkgs.runCommandLocal "static-figlet-${hostName}" { } '' - echo '${hostName}' | ${pkgs.figlet}/bin/figlet -f slant > $out + echo '${hostName}' | ${lib.getExe pkgs.figlet} -f slant > $out ''; in { diff --git a/nix/nixos-modules/frontend/home.nix b/nix/nixos-modules/frontend/home.nix index d87ffc5..37ef40f 100644 --- a/nix/nixos-modules/frontend/home.nix +++ b/nix/nixos-modules/frontend/home.nix @@ -144,14 +144,9 @@ in difftool = { prompt = false; }; - "difftool \"vscode\"" = - let - vscode = config.programs.vscode.package; - main = pkg: "${pkg}/bin/${pkg.meta.mainProgram}"; - in - { - cmd = "${main vscode} --wait --diff $LOCAL $REMOTE"; - }; + "difftool \"vscode\"" = { + cmd = "${lib.getExe config.programs.vscode.package} --wait --diff $LOCAL $REMOTE"; + }; }; userName = "Felix Stupp"; userEmail = "felix.stupp@banananet.work"; @@ -260,10 +255,10 @@ in "editor.defaultFormatter" = "ms-python.black-formatter"; }; - "ansible.ansibleLint.path" = "${pkgs.ansible-lint}/bin/ansible-lint"; + "ansible.ansibleLint.path" = "${lib.getExe pkgs.ansible-lint}"; - "dev.containers.dockerComposePath" = "${pkgs.podman-compose}/bin/podman-compose"; - "dev.containers.dockerPath" = "${pkgs.podman}/bin/podman"; + "dev.containers.dockerComposePath" = "${lib.getExe pkgs.podman-compose}"; + "dev.containers.dockerPath" = "${lib.getExe pkgs.podman}"; "diffEditor.ignoreTrimWhitespace" = false; "diffEditor.renderSideBySide" = false; @@ -326,10 +321,10 @@ in }; "nix.enableLanguageServer" = true; - "nix.serverPath" = "${pkgs.nil}/bin/nil"; + "nix.serverPath" = "${lib.getExe pkgs.nil}"; "nix.serverSettings" = { nil = { - formatting.command = [ "${pkgs.nixfmt-rfc-style}/bin/nixfmt" ]; + formatting.command = [ (lib.getExe pkgs.nixfmt-rfc-style) ]; }; }; @@ -337,7 +332,7 @@ in "python.analysis.autoImportCompletions" = true; "python.analysis.stubPath" = "./typings/"; - "python.defaultInterpreterPath" = "${pkgs.python3}/bin/python"; + "python.defaultInterpreterPath" = lib.getExe pkgs.python3; "python.linting.enabled" = false; "python.showStartPage" = false; @@ -354,7 +349,7 @@ in "update.mode" = "none"; "update.showReleaseNotes" = false; - "vscode-neovim.neovimPath" = "${pkgs.neovim}/bin/nvim"; + "vscode-neovim.neovimPath" = lib.getExe pkgs.neovim; "vsintellicode.modify.editor.suggestSelection" = "automaticallyOverrodeDefaultValue"; diff --git a/nix/nixos-modules/vmCommon.nix b/nix/nixos-modules/vmCommon.nix index c340aec..6a2a0e5 100644 --- a/nix/nixos-modules/vmCommon.nix +++ b/nix/nixos-modules/vmCommon.nix @@ -10,7 +10,7 @@ let cfg = config.x-banananetwork.vmCommon; # Based on https://unix.stackexchange.com/questions/16578/resizable-serial-console-window resize = pkgs.writeShellScriptBin "resize" '' - export PATH="${pkgs.coreutils}/bin" + export PATH="${lib.getBin pkgs.coreutils}/bin" if [ ! -t 0 ]; then # not a interactive... exit 0 @@ -200,7 +200,7 @@ in # - NixOS test: ssh-audit # - networking.useNetworkd # - networking.tcpcrypt - # environment.loginShellInit = "${resize}/bin/resize"; (see https://github.com/nix-community/srvos/blob/main/nixos/common/serial.nix) + # environment.loginShellInit = "${lib.getExe resize}"; (see https://github.com/nix-community/srvos/blob/main/nixos/common/serial.nix) }