Add nix flake support
This commit is contained in:
parent
c592951636
commit
cab6072bd8
11
README.md
11
README.md
|
@ -2,6 +2,13 @@
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
`boi-rebirth-fortunes.txt` is taken from The Binding of Isaac: Rebirth.
|
## flake
|
||||||
|
|
||||||
|
The defaultPackage output of this repository's flake is a derivation containing the motd files in this repository.
|
||||||
|
|
||||||
|
## sources
|
||||||
|
|
||||||
|
* `boi-rebirth-fortunes.txt` is taken from the Fortune Telling Machine messages from The Binding of Isaac: Rebirth.
|
||||||
|
|
||||||
|
* `40k-thought-for-the-day.txt` is sourced from 40k Lexicanum.
|
||||||
|
|
||||||
`40k-thought-for-the-day.txt` is sourced from 40k Lexicanum.
|
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1638122382,
|
||||||
|
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1640223855,
|
||||||
|
"narHash": "sha256-2bOGDrou/P0E85O5CzcZcHrvDBR78kRIwSPMlaLnFb8=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "e7f5c0a08e442ed5772852b9f832d5d716020ebf",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
description = "A flake of MOTD files.";
|
||||||
|
|
||||||
|
inputs.nixpkgs.url = github:NixOS/nixpkgs;
|
||||||
|
inputs.flake-utils.url = github:numtide/flake-utils;
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils }:
|
||||||
|
let
|
||||||
|
motdFiles = {
|
||||||
|
"40k" = ./40k-thought-for-the-day.txt;
|
||||||
|
rebirth = ./boi-rebirth-fortunes.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))}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
defaultPackage = motd;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in New Issue