nixos-config/profiles/overlay.nix

124 lines
3.4 KiB
Nix
Raw Normal View History

2020-04-27 04:39:00 +03:00
{ pkgs, config, lib, inputs, ... }:
2020-02-17 16:00:59 +03:00
let
filterGit =
builtins.filterSource (type: name: name != ".git" || type != "directory");
2020-04-28 20:48:57 +03:00
system = "x86_64-linux";
old = import inputs.nixpkgs-old ({
config = config.nixpkgs.config;
localSystem = { inherit system; };
});
2021-05-25 14:04:21 +03:00
mkKeyValue = key: value:
let
mvalue = if builtins.isBool value then
(if value then "true" else "false")
2021-06-12 00:42:08 +03:00
else if builtins.isString value then
2021-05-25 14:04:21 +03:00
value
else
builtins.toString value;
2021-06-03 18:15:00 +03:00
in ''${key}=${mvalue}'';
2021-05-25 14:04:21 +03:00
attrsToList = with builtins;
x:
(map (key: {
name = key;
value = getAttr key x;
}) (attrNames x));
2020-04-28 20:48:57 +03:00
in {
2020-02-17 16:00:59 +03:00
nixpkgs.overlays = [
2021-03-11 01:57:37 +03:00
(import inputs.emacs-overlay)
2020-11-19 13:40:03 +03:00
(self: super: rec {
nix = super.nix // {
meta = super.nix.meta // { platforms = lib.platforms.unix; };
};
2020-04-28 20:48:57 +03:00
2021-05-25 14:04:21 +03:00
my-lib = rec {
genIni = lib.generators.toINI { inherit mkKeyValue; };
genIniOrdered = lst:
(builtins.concatStringsSep "\n" (map ({ name ? "widget", ... }@attrs:
builtins.concatStringsSep "\n" ([ "[${name}]" ]
++ (map ({ name, value }: mkKeyValue name value)
(attrsToList (builtins.removeAttrs attrs [ "name" ]))))) lst))
+ "\n";
thm = config.themes.colors;
splitHex = hexStr:
map (x: builtins.elemAt x 0) (builtins.filter (a: a != "" && a != [ ])
2021-06-10 18:58:51 +03:00
(builtins.split "(.{2})" hexStr));
2021-05-25 14:04:21 +03:00
hex2decDigits = rec {
"0" = 0;
"1" = 1;
"2" = 2;
"3" = 3;
"4" = 4;
"5" = 5;
"6" = 6;
"7" = 7;
"8" = 8;
"9" = 9;
"a" = 10;
"b" = 11;
"c" = 12;
"d" = 13;
"e" = 14;
"f" = 15;
A = a;
B = b;
C = c;
D = d;
E = e;
F = f;
};
doubleDigitHexToDec = hex:
16 * hex2decDigits."${builtins.substring 0 1 hex}"
+ hex2decDigits."${builtins.substring 1 2 hex}";
thmDec = builtins.mapAttrs (name: color: colorHex2Dec color) thm;
2021-06-10 18:58:51 +03:00
thmHash = builtins.mapAttrs (name: color: "#${color}") thm;
2021-05-25 14:04:21 +03:00
colorHex2Dec = color:
builtins.concatStringsSep ","
(map (x: toString (doubleDigitHexToDec x)) (splitHex color));
};
2020-11-19 13:40:03 +03:00
nur = (import inputs.NUR {
pkgs = old;
nurpkgs = pkgs;
}).repos;
2020-02-17 16:00:59 +03:00
2020-11-19 13:40:03 +03:00
inherit (nur.balsoft.pkgs) termNote nix-patch;
2020-06-21 21:48:26 +03:00
2021-06-17 22:39:12 +03:00
lambda-launcher = inputs.lambda-launcher.defaultPackage.${system};
2020-07-03 11:59:36 +03:00
2021-06-17 22:39:12 +03:00
simple-osd = inputs.simple-osd-daemons.packages.${system};
2020-09-14 01:47:04 +03:00
2021-06-17 22:39:12 +03:00
yt-utilities = inputs.yt-utilities.defaultPackage.${system};
2020-02-17 16:00:59 +03:00
2020-11-19 13:40:03 +03:00
nerdfonts = nur.balsoft.pkgs.roboto-mono-nerd;
2020-08-25 13:35:54 +03:00
2021-06-06 10:24:23 +03:00
# inkscape = super.inkscape.overrideAttrs (oa: {
# src = inputs.inkscape;
# buildInputs = oa.buildInputs ++ [
# self.double-conversion
# ];
# postPatch = ''
# patchShebangs share/extensions
# patchShebangs share/templates
# patchShebangs man/fix-roff-punct
# '';
# });
2021-06-17 22:39:12 +03:00
nix-direnv = inputs.nix-direnv.defaultPackage.${system};
2021-06-18 23:48:50 +03:00
2021-06-27 08:17:17 +03:00
mtxclient = super.mtxclient.overrideAttrs (_: {
src = inputs.mtxclient;
2021-06-18 23:48:50 +03:00
});
2021-06-27 08:17:17 +03:00
nheko = (super.nheko.overrideAttrs (oa: {
src = inputs.nheko;
})).override { mtxclient = self.mtxclient; };
2020-11-19 13:40:03 +03:00
})
2020-02-17 16:00:59 +03:00
];
2020-04-27 04:39:00 +03:00
nixpkgs.config = {
allowUnfree = true;
android_sdk.accept_license = true;
};
2020-02-17 16:00:59 +03:00
}