Skip to content

Instantly share code, notes, and snippets.

@nixinator
Created March 24, 2023 04:31
Show Gist options
  • Save nixinator/ce6a123825772f191bd22427ae0fa1d4 to your computer and use it in GitHub Desktop.
Save nixinator/ce6a123825772f191bd22427ae0fa1d4 to your computer and use it in GitHub Desktop.
lief try building this
[nix-shell:~/src/cowsay]$ cat flake.nix
{
description = "A simple script that runs cowsay";
outputs = { self, nixpkgs }: {
defaultPackage.x86_64-linux = self.packages.x86_64-linux.my-script;
packages.x86_64-linux.my-script =
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
in
pkgs.writeShellScriptBin "my-script" ''
DATE="$(\${pkgs.coreutils}/bin/date +'the %d of %m, %Y')"
\${pkgs.cowsay}/bin/cowsay Hello, world! Today is $DATE.
'';
};
}
copy this to a flake.nix
and do
nix build
and you'll get a new script in result/bin/my-script ...
enjoy!
it will work! it's impossible for it not to!
@nixinator
Copy link
Author

I can help with that, if you got questions or get stuck, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment