1
0
Fork 0

Improve testing PATHs

This commit is contained in:
Malte Brandy 2021-05-20 14:54:46 +02:00
parent a76cf77130
commit 8c219b0bf2

View file

@ -1,6 +1,7 @@
{ pkgs, lib, config, ... }: { pkgs, lib, config, ... }:
let let
bins = [ pkgs.nix pkgs.laminar ]; bins = lib.attrValues { inherit (pkgs) git nix niv gnutar gzip openssh laminar; };
standardPath = lib.makeBinPath bins;
imports = [ "Control.Exception (onException)" ]; imports = [ "Control.Exception (onException)" ];
haskellBody = name: drv: '' haskellBody = name: drv: ''
main = do main = do
@ -35,10 +36,9 @@ let
haskellBody "home" haskellBody "home"
''paths ++ [[i|#{configDir}/home-manager/target.nix|], "-A", hostname]'' ''paths ++ [[i|#{configDir}/home-manager/target.nix|], "-A", hostname]''
); );
path = [ pkgs.git pkgs.nix pkgs.gnutar pkgs.gzip pkgs.openssh pkgs.laminar ];
common = '' common = ''
set -e set -e
export PATH=${lib.makeBinPath path}:$PATH export PATH=${standardPath}:$PATH
export NIX_PATH="/etc/nix-path:nixos-config=/etc/nixos/configuration.nix" export NIX_PATH="/etc/nix-path:nixos-config=/etc/nixos/configuration.nix"
''; '';
checkout = '' checkout = ''
@ -94,19 +94,19 @@ in
HOMES = lib.concatStringsSep " " homes; HOMES = lib.concatStringsSep " " homes;
SYSTEMS = lib.concatStringsSep " " systems; SYSTEMS = lib.concatStringsSep " " systems;
DEPLOY = deployCommand; DEPLOY = deployCommand;
PATH = "${lib.makeBinPath [ pkgs.laminar pkgs.git pkgs.nix pkgs.gnutar ]}:$PATH"; PATH = "${standardPath}:$PATH";
}; };
ghcArgs = [ "-threaded" ]; ghcArgs = [ "-threaded" ];
} }
(builtins.readFile ./test-config.hs); (builtins.readFile ./test-config.hs);
in in
pkgs.writeShellScript "test-config" '' pkgs.writeShellScript "test-config" ''
FLAGS="" PATH=${lib.makeBinPath [ pkgs.gnutar pkgs.nix pkgs.laminar]}:$PATH ${test-config} FLAGS="" PATH=${standardPath}:$PATH ${test-config}
''; '';
"bump-config.run" = pkgs.writeHaskell "bump-config" "bump-config.run" = pkgs.writeHaskell "bump-config"
{ {
libraries = builtins.attrValues pkgs.myHaskellScriptPackages; libraries = builtins.attrValues pkgs.myHaskellScriptPackages;
ghcEnv.PATH = "${lib.makeBinPath [ pkgs.git pkgs.niv pkgs.nix ]}:$PATH"; ghcEnv.PATH = "${standardPath}:$PATH";
ghcArgs = [ "-threaded" ]; ghcArgs = [ "-threaded" ];
} }
(builtins.readFile ./bump-config.hs); (builtins.readFile ./bump-config.hs);