mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-25 09:36:14 +01:00
Improve Nix wrapper
Signed-off-by: magic_rb <richard@brezak.sk>
This commit is contained in:
parent
0443c69a77
commit
3ad614d4a5
19
flake.nix
19
flake.nix
|
@ -284,31 +284,32 @@
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
${pkgs.lib.getExe pkgs.nixUnstable} "''${new_args[@]}"
|
( exec -a $0 .nix-unwrapped "''${new_args[@]}" )
|
||||||
|
|
||||||
post_lock_hash="$(sha256sum flake-secret.lock | cut -f1 -d' ')"
|
post_lock_hash="$(sha256sum flake-secret.lock | cut -f1 -d' ')"
|
||||||
|
|
||||||
if ! [[ "$pre_lock_hash" == "$post_lock_hash" ]] ; then
|
if ! [[ "$pre_lock_hash" == "$post_lock_hash" ]] ; then
|
||||||
cp flake-secret.lock flake.lock
|
cp flake-secret.lock flake.lock
|
||||||
${pkgs.lib.getExe pkgs.nixUnstable} flake lock --override-input secret path:///var/empty
|
.nix-unwrapped flake lock --override-input secret path:///var/empty
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
nix-unwrapped = pkgs.writeShellScriptBin "nix-unwrapped" ''
|
|
||||||
exec ${pkgs.lib.getExe pkgs.nixUnstable} "$@"
|
|
||||||
'';
|
|
||||||
nix-with-wrapper = pkgs.symlinkJoin {
|
nix-with-wrapper = pkgs.symlinkJoin {
|
||||||
name = "nix";
|
name = "nix";
|
||||||
paths = [ # pkgs.nixUnstable
|
paths = [ pkgs.nixUnstable ];
|
||||||
nix-unwrapped
|
buildInputs = [ pkgs.makeWrapper ];
|
||||||
nix-wrapped ];
|
postBuild = ''
|
||||||
|
mv $out/bin/nix $out/bin/.nix-unwrapped
|
||||||
|
cp ${nix-wrapped}/bin/nix $out/bin/nix
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
nixos-rebuild = pkgs.nixos-rebuild.override { nix = nix-with-wrapper; };
|
||||||
in
|
in
|
||||||
pkgs.mkShell {
|
pkgs.mkShell {
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
(pkgs.writeShellScriptBin "update-secret" ''
|
(pkgs.writeShellScriptBin "update-secret" ''
|
||||||
nix flake lock --update-input secret
|
nix flake lock --update-input secret
|
||||||
'')
|
'')
|
||||||
nil nix-with-wrapper
|
nil nix-with-wrapper nixos-rebuild
|
||||||
nomad consul vault
|
nomad consul vault
|
||||||
|
|
||||||
haskell.compiler.ghc946
|
haskell.compiler.ghc946
|
||||||
|
|
Loading…
Reference in a new issue