Refactor to symlinkJoin with passthru
This commit is contained in:
parent
de23766af9
commit
e16e492695
37
flake.nix
37
flake.nix
@ -10,33 +10,30 @@
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
}:
|
||||
let
|
||||
motdFiles = {
|
||||
"40k" = ./40k-thought-for-the-day.txt;
|
||||
rebirth = ./boi-rebirth-fortunes.txt;
|
||||
bofh = ./bofh-excuses.txt;
|
||||
discordium = ./discordium.txt;
|
||||
};
|
||||
in
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
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
|
||||
${builtins.foldl' (a: b: "${a}\n${b}") "" (
|
||||
map (attr: "cp ${motdFiles.${attr}} $out/${attr}.txt") (builtins.attrNames motdFiles)
|
||||
)}
|
||||
'';
|
||||
};
|
||||
inherit (pkgs) symlinkJoin;
|
||||
in
|
||||
{
|
||||
defaultPackage = motd;
|
||||
formatter = pkgs.nixfmt-rfc-style;
|
||||
|
||||
packages.default = self.packages.${system}.motd;
|
||||
packages.motd = symlinkJoin {
|
||||
name = "motd";
|
||||
paths = [ ./motd ];
|
||||
passthru =
|
||||
let
|
||||
motd = "${self.packages.${system}.motd}";
|
||||
in
|
||||
{
|
||||
"40k" = "${motd}/40k-thought-for-the-day.txt";
|
||||
rebirth = "${motd}/boi-rebirth-fortunes.txt";
|
||||
bofh = "${motd}/bofh-excuses.txt";
|
||||
discordium = "${motd}/discordium.txt";
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user