This repository has been archived on 2025-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
nixos-servers/scripts/default.nix

32 lines
801 B
Nix
Raw Normal View History

2024-10-28 14:12:06 +01:00
{
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
2024-10-28 14:12:06 +01:00
createScript = {
name,
runtimeInputs,
scriptPath,
extraWrapperFlags ? "",
...
}: let
script = (pkgs.writeScriptBin name (builtins.readFile scriptPath)).overrideAttrs (old: {
buildCommand = "${old.buildCommand}\n patchShebangs $out";
});
in
pkgs.symlinkJoin {
2024-03-27 20:10:14 +01:00
inherit name;
2024-10-28 14:12:06 +01:00
paths = [script] ++ runtimeInputs;
buildInputs = [pkgs.makeWrapper];
2024-05-19 14:05:20 +02:00
postBuild = "wrapProgram $out/bin/${name} --set PATH $out/bin ${extraWrapperFlags}";
2024-03-27 20:10:14 +01:00
};
2024-10-28 14:12:06 +01:00
in {
2024-05-19 14:05:20 +02:00
packages.bootstrap = createScript {
name = "bootstrap";
2024-10-28 14:12:06 +01:00
runtimeInputs = with pkgs; [sops coreutils nixos-anywhere];
2024-05-19 14:05:20 +02:00
scriptPath = ./bootstrap.sh;
};
2024-03-27 20:10:14 +01:00
})