From 0fbc5c8d8d45149ebdd48a00c143351037d1ad9f Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Sat, 27 Apr 2024 00:26:02 +0200 Subject: [PATCH] package release script --- flake.nix | 1 + release.nix | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 release.nix diff --git a/flake.nix b/flake.nix index 2de4b25..50ad703 100644 --- a/flake.nix +++ b/flake.nix @@ -21,5 +21,6 @@ ./blog-pim.nix ./forgejo-nix-action.nix ./atticd.nix + ./release.nix ]; } diff --git a/release.nix b/release.nix new file mode 100644 index 0000000..ba68cc9 --- /dev/null +++ b/release.nix @@ -0,0 +1,19 @@ +{ nixpkgs, flutils, ... }: flutils.lib.eachDefaultSystem (system: +let + pkgs = nixpkgs.legacyPackages.${system}; + createScript = name: runtimeInputs: scriptPath: + let + script = (pkgs.writeScriptBin name (builtins.readFile scriptPath)).overrideAttrs (old: { + buildCommand = "${old.buildCommand}\n patchShebangs $out"; + }); + in + pkgs.symlinkJoin { + inherit name; + paths = [ script ] ++ runtimeInputs; + buildInputs = [ pkgs.makeWrapper ]; + postBuild = "wrapProgram $out/bin/${name} --set PATH $out/bin"; + }; +in +{ + packages.release = createScript "release" (with pkgs; [ nix docker-client git ]) ./release.sh; +})