Add nixfmt formatter
This commit is contained in:
parent
f08e634bd0
commit
de23766af9
6
flake.lock
generated
6
flake.lock
generated
@ -17,11 +17,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1640223855,
|
||||
"narHash": "sha256-2bOGDrou/P0E85O5CzcZcHrvDBR78kRIwSPMlaLnFb8=",
|
||||
"lastModified": 1721369373,
|
||||
"narHash": "sha256-KomTFhD1yPKYvU7cqJGBRyQACfmGJMMkUWJpvw3K7B8=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e7f5c0a08e442ed5772852b9f832d5d716020ebf",
|
||||
"rev": "9d5188abf958325668881e99aa74866b69214639",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
24
flake.nix
24
flake.nix
@ -1,10 +1,15 @@
|
||||
{
|
||||
description = "A flake of MOTD files.";
|
||||
|
||||
inputs.nixpkgs.url = github:NixOS/nixpkgs;
|
||||
inputs.flake-utils.url = github:numtide/flake-utils;
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
}:
|
||||
let
|
||||
motdFiles = {
|
||||
"40k" = ./40k-thought-for-the-day.txt;
|
||||
@ -13,7 +18,8 @@
|
||||
discordium = ./discordium.txt;
|
||||
};
|
||||
in
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
motd = pkgs.stdenv.mkDerivation {
|
||||
@ -22,17 +28,15 @@
|
||||
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))}
|
||||
${builtins.foldl' (a: b: "${a}\n${b}") "" (
|
||||
map (attr: "cp ${motdFiles.${attr}} $out/${attr}.txt") (builtins.attrNames motdFiles)
|
||||
)}
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
defaultPackage = motd;
|
||||
formatter = pkgs.nixfmt-rfc-style;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user