Compare commits
No commits in common. "9e621aea661862a30055dd991e9a616eeb92e12b" and "f08e634bd09be51c30ebb69a849b694bc3f45544" have entirely different histories.
9e621aea66
...
f08e634bd0
|
@ -2,14 +2,11 @@
|
||||||
|
|
||||||
Repository of lists of one-liners to use as a message-of-the-day.
|
Repository of lists of one-liners to use as a message-of-the-day.
|
||||||
|
|
||||||
|
This repository was a learning exercise; this is not a good example to follow of how to distribute text files with Nix.
|
||||||
|
|
||||||
## flake
|
## flake
|
||||||
|
|
||||||
Package `motd` is a folder of the MOTD files in `motd/`. Each file's path is also accessible as a passthru attribute on the package.
|
The defaultPackage output of this repository's flake is a derivation containing the motd files in this repository.
|
||||||
|
|
||||||
```
|
|
||||||
$ nix eval --raw .#motd.rebirth
|
|
||||||
/nix/store/ikp1hxb1hrzific5wyghm2lvzv27qqxp-motd/boi-rebirth-fortunes.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
## sources
|
## sources
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721369373,
|
"lastModified": 1640223855,
|
||||||
"narHash": "sha256-KomTFhD1yPKYvU7cqJGBRyQACfmGJMMkUWJpvw3K7B8=",
|
"narHash": "sha256-2bOGDrou/P0E85O5CzcZcHrvDBR78kRIwSPMlaLnFb8=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "9d5188abf958325668881e99aa74866b69214639",
|
"rev": "e7f5c0a08e442ed5772852b9f832d5d716020ebf",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
55
flake.nix
55
flake.nix
|
@ -1,39 +1,38 @@
|
||||||
{
|
{
|
||||||
description = "A flake of MOTD files.";
|
description = "A flake of MOTD files.";
|
||||||
|
|
||||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
|
inputs.nixpkgs.url = github:NixOS/nixpkgs;
|
||||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
inputs.flake-utils.url = github:numtide/flake-utils;
|
||||||
|
|
||||||
outputs =
|
outputs = { self, nixpkgs, flake-utils }:
|
||||||
{
|
let
|
||||||
self,
|
motdFiles = {
|
||||||
nixpkgs,
|
"40k" = ./40k-thought-for-the-day.txt;
|
||||||
flake-utils,
|
rebirth = ./boi-rebirth-fortunes.txt;
|
||||||
}:
|
bofh = ./bofh-excuses.txt;
|
||||||
flake-utils.lib.eachDefaultSystem (
|
discordium = ./discordium.txt;
|
||||||
system:
|
};
|
||||||
|
in
|
||||||
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
inherit (pkgs) symlinkJoin;
|
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))}
|
||||||
|
'';
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
formatter = pkgs.nixfmt-rfc-style;
|
defaultPackage = motd;
|
||||||
|
|
||||||
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