From de23766af93711ed5de782e684b41e483119a809 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Thu, 18 Jul 2024 23:20:16 -0700 Subject: [PATCH] Add nixfmt formatter --- flake.lock | 6 +++--- flake.nix | 24 ++++++++++++++---------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/flake.lock b/flake.lock index 06fa618..df8a7c0 100644 --- a/flake.lock +++ b/flake.lock @@ -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": { diff --git a/flake.nix b/flake.nix index 6511ac8..40242d0 100644 --- a/flake.nix +++ b/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; } ); }