Created
December 28, 2024 19:22
-
-
Save kayvank/e8a7e8aab2c883fbf6bd31fda52b25c5 to your computer and use it in GitHub Desktop.
Revisions
-
kayvank created this gist
Dec 28, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ { description = "A better simple script flake"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs"; flake-utils.url = "github:numtide/flake-utils"; }; outputs = {self, nixpkgs, flake-utils}: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs {system = system;}; my-name = "my-script"; my-src = builtins.readFile ./simple-script.sh; my-script = (pkgs.writeScriptBin my-name my-src).overrideAttrs(old: { buildCommand = "${old.buildCommand}\n patchShebangs $out"; }); ## create a variable to store the list of dependencies my-buildInputs = with pkgs; [cowsay ddate]; in rec { defaultPackage = packages.my-script; packages.my-script = pkgs.symlinkJoin { name = my-name; paths = [ my-script ] ++ my-buildInputs; buildInputs = [ pkgs.makeWrapper ]; postBuild = "wrapProgram $out/bin/${my-name} --prefix PATH : $out/bin"; }; }); }