motd/flake.nix

43 lines
1.0 KiB
Nix
Raw Normal View History

2021-12-23 02:15:44 +00:00
{
description = "A flake of MOTD files.";
2024-07-19 06:20:16 +00:00
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
2021-12-23 02:15:44 +00:00
2024-07-19 06:20:16 +00:00
outputs =
{
self,
nixpkgs,
flake-utils,
}:
2021-12-23 02:15:44 +00:00
let
motdFiles = {
"40k" = ./40k-thought-for-the-day.txt;
rebirth = ./boi-rebirth-fortunes.txt;
2024-04-02 04:19:43 +00:00
bofh = ./bofh-excuses.txt;
discordium = ./discordium.txt;
2021-12-23 02:15:44 +00:00
};
in
2024-07-19 06:20:16 +00:00
flake-utils.lib.eachDefaultSystem (
system:
2021-12-23 02:15:44 +00:00
let
pkgs = nixpkgs.legacyPackages.${system};
motd = pkgs.stdenv.mkDerivation {
pname = "motd";
version = "1.0";
builder = builtins.toFile "motd-builder.sh" ''
source $stdenv/setup
mkdir -p $out
2024-07-19 06:20:16 +00:00
${builtins.foldl' (a: b: "${a}\n${b}") "" (
map (attr: "cp ${motdFiles.${attr}} $out/${attr}.txt") (builtins.attrNames motdFiles)
)}
2021-12-23 02:15:44 +00:00
'';
};
in
{
defaultPackage = motd;
2024-07-19 06:20:16 +00:00
formatter = pkgs.nixfmt-rfc-style;
2021-12-23 02:15:44 +00:00
}
);
}