Skip to content
This repository was archived by the owner on Apr 24, 2026. It is now read-only.

Commit 4ccd57b

Browse files
committed
format with nixpkgs-fmt
1 parent 493d113 commit 4ccd57b

11 files changed

Lines changed: 50 additions & 27 deletions

File tree

default.nix

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ let
99
sha256 = locked.narHash;
1010
};
1111

12-
in { nixpkgs-lib ? import ((fromFlake "nixpkgs-lib") + "/lib")
13-
, base16-schemes ? fromFlake "base16-schemes", ... }: rec {
12+
in
13+
{ nixpkgs-lib ? import ((fromFlake "nixpkgs-lib") + "/lib")
14+
, base16-schemes ? fromFlake "base16-schemes"
15+
, ...
16+
}: rec {
1417
lib = import ./lib;
1518
lib-contrib = import ./lib/contrib;
1619
lib-core = import ./lib/core { inherit nixpkgs-lib; };

lib/contrib/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{pkgs ? (builtins.trace "nix-colors/lib-contrib: using <nixpkgs> as pkgs because the pkgs parameter was not provided" (import <nixpkgs> {}))}:
1+
{ pkgs ? (builtins.trace "nix-colors/lib-contrib: using <nixpkgs> as pkgs because the pkgs parameter was not provided" (import <nixpkgs> { })) }:
22
rec {
33
# Takes a scheme, resulting wallpaper height and width, plus logo scale, and ouputs the generated wallpaper path
44
# Example:

lib/contrib/gtk-theme.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ let
66
mkdir -p $out/bin
77
ln -s ${pkgs.resvg}/bin/resvg $out/bin/rendersvg
88
'';
9-
in pkgs.stdenv.mkDerivation rec {
9+
in
10+
pkgs.stdenv.mkDerivation rec {
1011
name = "generated-gtk-theme-${scheme.slug}";
1112
src = pkgs.fetchFromGitHub {
1213
owner = "nana-4";

lib/contrib/vim-theme.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
let
44
c = scheme.colors;
55
slug = scheme.slug;
6-
in pkgs.writeTextDir "colors/nix-${slug}.vim" ''
6+
in
7+
pkgs.writeTextDir "colors/nix-${slug}.vim" ''
78
let g:colors_name="nix-${slug}"
89
910
set termguicolors

lib/core/conversions.nix

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,15 @@ let
6060
let
6161
inherit (nixpkgs-lib) toLower;
6262
lowerHex = toLower hex;
63-
in if builtins.stringLength hex != 1 then
63+
in
64+
if builtins.stringLength hex != 1 then
6465
throw "Function only accepts a single character."
6566
else if hexToDecMap ? ${lowerHex} then
6667
hexToDecMap."${lowerHex}"
6768
else
6869
throw "Character ${hex} is not a hexadecimal value.";
69-
in rec {
70+
in
71+
rec {
7072
/* Converts from hexadecimal to decimal.
7173
7274
Type: hexToDec :: string -> int
@@ -88,7 +90,8 @@ in rec {
8890
decimals = builtins.map hexCharToDec (stringToCharacters hex);
8991
decimalsAscending = reverseList decimals;
9092
decimalsPowered = imap0 base16To10 decimalsAscending;
91-
in foldl builtins.add 0 decimalsPowered;
93+
in
94+
foldl builtins.add 0 decimalsPowered;
9295

9396
/* Converts a 6 character hexadecimal string to RGB values.
9497
@@ -110,7 +113,8 @@ in rec {
110113
rgbStartIndex = [ 0 2 4 ];
111114
hexList = builtins.map (x: builtins.substring x 2 hex) rgbStartIndex;
112115
hexLength = builtins.stringLength hex;
113-
in if hexLength != 6 then
116+
in
117+
if hexLength != 6 then
114118
throw ''
115119
Unsupported hex string length of ${builtins.toString hexLength}.
116120
Length must be exactly 6.
@@ -133,5 +137,6 @@ in rec {
133137
inherit (nixpkgs-lib) concatStringsSep;
134138
hexInRGB = hexToRGB hex;
135139
hexInRGBString = map toString hexInRGB;
136-
in concatStringsSep sep hexInRGBString;
140+
in
141+
concatStringsSep sep hexInRGBString;
137142
}

lib/core/math.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
let
2626
x = pow base (exponent / 2);
2727
odd_exp = mod exponent 2 == 1;
28-
in x * x * (if odd_exp then base else 1)
28+
in
29+
x * x * (if odd_exp then base else 1)
2930
else if exponent == 1 then
3031
base
3132
else if exponent == 0 && base == 0 then

lib/core/schemeFromYAML.nix

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ let
1616
sep = builtins.unsafeDiscardStringContext _sep;
1717
s = builtins.unsafeDiscardStringContext _s;
1818
splits = filter builtins.isString (builtins.split (escapeRegex sep) s);
19-
in map (v: addContextFrom _sep (addContextFrom _s v)) splits;
19+
in
20+
map (v: addContextFrom _sep (addContextFrom _s v)) splits;
2021
nameValuePair = name: value: { inherit name value; };
2122

2223
# From https://github.com/arcnmx/nixexprs
@@ -41,7 +42,8 @@ let
4142
lines = splitString "\n" yaml;
4243
lines' = map stripLine lines;
4344
lines'' = filter usefulLine lines';
44-
in mapListToAttrs attrLine lines'';
45+
in
46+
mapListToAttrs attrLine lines'';
4547

4648
convertScheme = slug: set: {
4749
name = set.scheme;
@@ -55,4 +57,5 @@ let
5557
};
5658

5759
schemeFromYAML = slug: content: convertScheme slug (fromYAML content);
58-
in schemeFromYAML
60+
in
61+
schemeFromYAML

lib/core/schemeToYAML.nix

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,7 @@ let
2828
scheme: "${scheme.name}"
2929
author: "${scheme.author}"
3030
'' + concatMapStrings # Add a line for each base0X color
31-
(color: ''${color}: "${scheme.colors.${color}}"'') colorNames;
32-
in schemeToYAML
31+
(color: ''${color}: "${scheme.colors.${color}}"'')
32+
colorNames;
33+
in
34+
schemeToYAML

lib/core/tests/conversions.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
let
66
conversions = import ../conversions.nix { inherit nixpkgs-lib; };
77
inherit (nixpkgs-lib) runTests;
8-
in runTests {
8+
in
9+
runTests {
910
testHexToDec_1 = {
1011
expr = conversions.hexToDec "12";
1112
expected = 18;

lib/core/tests/math.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
let
66
math = import ../math.nix { inherit nixpkgs-lib; };
77
inherit (nixpkgs-lib) runTests;
8-
in runTests {
8+
in
9+
runTests {
910
testPow_1 = {
1011
expr = math.pow 0 1000;
1112
expected = 0;

0 commit comments

Comments
 (0)