treewide: pedantic inherits

This fixes inherits and library functions usage, to inherit them
explicitely at top level of the file.
This commit is contained in:
Anthony Rodriguez 2025-02-23 00:01:57 +01:00
parent 559e23faae
commit b944193615
Signed by: nezia
SSH key fingerprint: SHA256:Ihfpl0rUpqDevYqnzSR34OYfVLbDNkBiUjs3CpX4ykA
58 changed files with 269 additions and 127 deletions

View file

@ -1,19 +1,23 @@
lib:
with lib; let
lib: let
inherit (builtins) baseNameOf length toString;
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.lists) foldl imap0;
inherit (lib.strings) concatLines removePrefix stringToCharacters substring;
# thanks fufexan https://github.com/fufexan/dotfiles/blob/2947f27791e97ea33c48af4ee2d0188fe03f80dd/lib/colors/default.nix#L8-L66
# convert rrggbb hex to rgba(r, g, b, a) css
rgba = c: alpha: let
color = removePrefix "#" c;
r = toString (hexToDec (__substring 0 2 color));
g = toString (hexToDec (__substring 2 2 color));
b = toString (hexToDec (__substring 4 2 color));
r = toString (hexToDec (substring 0 2 color));
g = toString (hexToDec (substring 2 2 color));
b = toString (hexToDec (substring 4 2 color));
a = toString alpha;
res = "rgba(${r}, ${g}, ${b}, ${a})";
in
res;
blurImage = pkgs: path:
pkgs.runCommand "${builtins.baseNameOf path}-blurred" {
pkgs.runCommand "${baseNameOf path}-blurred" {
buildInputs = [pkgs.imagemagick];
}
''

View file

@ -1,7 +1,12 @@
lib: let
# toGtk3Ini , formatGtk2Option , and finalGtk2Text are all taken from https://github.com/nix-community/home-manager, with some minor modifications to their function.
# All of the gtk generator functions are available under the MIT License.
inherit (lib) generators isBool boolToString mapAttrsToList concatMapStrings isString escape;
inherit (builtins) isBool;
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.generators) toINI;
inherit (lib.strings) concatMapStrings escape isString;
inherit (lib.trivial) boolToString;
formatGtk2Option = n: v: let
v' =
if isBool v
@ -11,7 +16,7 @@ lib: let
else toString v;
in "${escape ["="] n} = ${v'}";
in {
toGtk3Ini = generators.toINI {
toGtk3Ini = toINI {
mkKeyValue = key: value: let
value' =
if isBool value

View file

@ -3,6 +3,7 @@ lib: {
indentLevel ? 0,
importantPrefixes ? ["$" "bezier" "name"],
}: let
inherit (builtins) removeAttrs;
inherit
(lib)
all
@ -26,7 +27,7 @@ lib: {
filterAttrs (_: v: isAttrs v || (isList v && all isAttrs v)) attrs;
mkSection = n: attrs:
if lib.isList attrs
if isList attrs
then (concatMapStringsSep "\n" (a: mkSection n a) attrs)
else ''
${indent}${n} {
@ -53,7 +54,7 @@ lib: {
importantFields = filterAttrs isImportantField allFields;
fields =
builtins.removeAttrs allFields
removeAttrs allFields
(mapAttrsToList (n: _: n) importantFields);
in
mkFields importantFields

View file

@ -1,4 +1,6 @@
{lib, ...}: {
{lib, ...}: let
inherit (lib.modules) mkDefault;
in {
imports = [
./hardware
@ -10,6 +12,6 @@
./users.nix
./security.nix
];
system.stateVersion = lib.mkDefault "24.05";
system.stateVersion = mkDefault "24.05";
zramSwap.enable = true;
}

View file

@ -3,8 +3,10 @@
pkgs,
config,
...
}: {
config = lib.mkIf config.local.profiles.desktop.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf config.local.profiles.desktop.enable {
fonts = {
enableDefaultPackages = false;
packages = [

View file

@ -2,8 +2,10 @@
lib,
config,
...
}: {
config = lib.mkIf config.local.profiles.laptop.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf config.local.profiles.laptop.enable {
services.fprintd.enable = true;
};
}

View file

@ -2,8 +2,10 @@
lib,
config,
...
}: {
config = lib.mkIf config.local.profiles.desktop.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf config.local.profiles.desktop.enable {
services.fwupd.enable = true;
};
}

View file

@ -3,8 +3,10 @@
pkgs,
config,
...
}: {
config = lib.mkIf config.local.profiles.desktop.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf config.local.profiles.desktop.enable {
services = {
# setup printing service
printing.enable = true;

View file

@ -3,8 +3,10 @@
pkgs,
config,
...
}: {
config = lib.mkIf config.local.profiles.gaming.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf config.local.profiles.gaming.enable {
hardware.keyboard.qmk.enable = true;
environment.systemPackages = with pkgs; [
via

View file

@ -2,8 +2,10 @@
lib,
config,
...
}: {
config = lib.mkIf (!config.local.profiles.server.enable) {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf (!config.local.profiles.server.enable) {
networking = {
inherit (config.local.systemVars) hostName;
nameservers = ["1.1.1.1" "1.0.0.1"];

View file

@ -3,8 +3,10 @@
pkgs,
config,
...
}: {
config = lib.mkIf config.local.profiles.desktop.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf config.local.profiles.desktop.enable {
security = {
polkit.enable = true;
polkit = {

View file

@ -3,13 +3,14 @@
config,
...
}: let
inherit (lib) mkEnableOption;
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption;
in {
options = {
local.profiles.desktop.enable = mkEnableOption "the desktop profile";
};
config.assertions = lib.mkIf config.local.profiles.desktop.enable [
config.assertions = mkIf config.local.profiles.desktop.enable [
{
assertion = !config.local.profiles.server.enable;
message = "The desktop profile cannot be enabled if `local.profiles.server.enable` is set to true.";

View file

@ -3,13 +3,14 @@
config,
...
}: let
inherit (lib) mkEnableOption;
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption;
in {
options = {
local.profiles.gaming.enable = mkEnableOption "the gaming profile";
};
config.assertions = lib.mkIf config.local.profiles.gaming.enable [
config.assertions = mkIf config.local.profiles.gaming.enable [
{
assertion = !config.local.profiles.server.enable;
message = "The gaming profile cannot be enabled if `local.profiles.server.enable` is set to true.";

View file

@ -3,13 +3,14 @@
config,
...
}: let
inherit (lib) mkEnableOption;
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption;
in {
options = {
local.profiles.laptop.enable = mkEnableOption "the laptop profile";
};
config.assertions = lib.mkIf config.local.profiles.laptop.enable [
config.assertions = mkIf config.local.profiles.laptop.enable [
{
assertion = !config.local.profiles.server.enable;
message = "The laptop profile cannot be enabled if `local.profiles.server.enable` is set to true.";

View file

@ -3,13 +3,14 @@
config,
...
}: let
inherit (lib) mkEnableOption;
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption;
in {
options = {
local.profiles.server.enable = mkEnableOption "the server profile";
};
config.assertions = lib.mkIf config.local.profiles.server.enable [
config.assertions = mkIf config.local.profiles.server.enable [
{
assertion = !config.local.profiles.desktop.enable;
message = "The server profile cannot be enabled if `local.profiles.desktop.enable` is set to true.";

View file

@ -6,9 +6,12 @@
inputs,
...
}: let
inherit (lib) attrNames mkEnableOption mkOption pathExists;
inherit (lib.types) attrs bool enum package path str;
inherit (builtins) pathExists toString;
inherit (lib.attrsets) attrNames;
inherit (lib.lists) singleton;
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) attrs bool enum package path str;
cfg = config.local.style;
in {
@ -136,7 +139,7 @@ in {
};
};
config = lib.mkIf cfg.enable {
config = mkIf cfg.enable {
assertions = [
(let
themePath = cfg.gtk.theme.package + /share/themes + "/${cfg.gtk.theme.name}";

View file

@ -5,13 +5,18 @@
config,
...
}: let
inherit (lib.attrsets) optionalAttrs;
inherit (lib.lists) singleton;
inherit (lib.modules) mkIf;
inherit (config.local.systemVars) username;
styleCfg = config.local.style;
customNeovim = inputs.nvf.lib.neovimConfiguration {
inherit pkgs;
modules = lib.singleton {
config.vim = lib.mkMerge [
modules = singleton {
config.vim =
{
viAlias = true;
vimAlias = true;
@ -245,19 +250,18 @@
telescope.enable = true;
}
(lib.mkIf styleCfg.enable {
// (optionalAttrs styleCfg.enable {
theme = {
enable = true;
name = "base16";
base16-colors = styleCfg.scheme.palette;
};
})
];
});
};
};
in {
imports = [./basedpyright-fix.nix];
config = lib.mkIf config.local.profiles.desktop.enable {
config = mkIf config.local.profiles.desktop.enable {
hjem.users.${username} = {
packages = [customNeovim.neovim];
};

View file

@ -4,17 +4,22 @@
config,
...
}: let
inherit (builtins) fetchurl;
inherit (lib.generators) toJSON;
inherit (lib.modules) mkIf;
inherit (config.local.systemVars) username;
logo = builtins.fetchurl {
logo = fetchurl {
url = "https://raw.githubusercontent.com/gytis-ivaskevicius/high-quality-nix-content/refs/heads/master/emoji/nix-owo-transparent.png";
sha256 = "137k3i7z4va68v4rvrazy26szc7p2w59h7bc2h8japzjyj6xjs71";
};
in {
config = lib.mkIf config.local.profiles.desktop.enable {
config = mkIf config.local.profiles.desktop.enable {
hjem.users.${username} = {
packages = [pkgs.fastfetch];
files = {
".config/fastfetch/config.jsonc".text = builtins.toJSON {
".config/fastfetch/config.jsonc".text = toJSON {} {
logo = {
source = logo;
type = "kitty";

View file

@ -4,7 +4,9 @@
config,
...
}: let
inherit (builtins) readFile;
inherit (builtins) concatStringsSep readFile;
inherit (lib.modules) mkIf;
inherit (config.local.systemVars) username;
betterfox = pkgs.fetchFromGitHub {
@ -14,7 +16,7 @@
hash = "sha256-hpkEO5BhMVtINQG8HN4xqfas/R6q5pYPZiFK8bilIDs=";
};
in {
config = lib.mkIf config.local.profiles.desktop.enable {
config = mkIf config.local.profiles.desktop.enable {
hjem.users.${username} = {
programs.firefox = {
enable = true;
@ -153,7 +155,7 @@ in {
};
};
extraConfig = builtins.concatStringsSep "\n" [
extraConfig = concatStringsSep "\n" [
(readFile "${betterfox}/user.js")
(readFile "${betterfox}/Securefox.js")
(readFile "${betterfox}/Fastfox.js")

View file

@ -6,13 +6,17 @@
config,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib'.generators) toHyprConf;
inherit (config.local.systemVars) username;
inherit (inputs.hypridle.packages.${pkgs.system}) hypridle;
hyprlock = "${inputs.hyprlock.packages.${pkgs.system}.hyprlock}/bin/hyprlock";
in {
config = lib.mkIf config.local.modules.hyprland.enable {
config = mkIf config.local.modules.hyprland.enable {
hjem.users.${username} = {
packages = [hypridle];
files = {

View file

@ -1,7 +1,9 @@
lib: let
inherit (builtins) substring;
# thanks https://github.com/fufexan/dotfiles/blob/c0b3c77d95ce1f574a87e7f7ead672ca0d951245/home/programs/wayland/hyprland/binds.nix#L16-L20
toggle = program: uwsm: let
prog = builtins.substring 0 14 program;
prog = substring 0 14 program;
in "pkill ${prog} || ${lib.optionalString uwsm "uwsm app -- "} ${program}";
runOnce = program: "pgrep ${program} || uwsm app -- ${program}";
run = program: "uwsm app -- ${program}";

View file

@ -6,13 +6,17 @@
config,
...
}: let
inherit (lib) mkIf;
inherit (builtins) mapAttrs;
inherit (lib.modules) mkIf;
inherit (lib') rgba;
inherit (lib'.generators) toHyprConf;
inherit (config.local.systemVars) username;
inherit (inputs.hyprlock.packages.${pkgs.system}) hyprlock;
inherit (config.local.systemVars) username;
styleCfg = config.local.style;
rgbaPalette = builtins.mapAttrs (_: c: (lib'.rgba c 1)) styleCfg.scheme.palette;
rgbaPalette = mapAttrs (_: c: (rgba c 1)) styleCfg.scheme.palette;
in {
config = mkIf config.local.modules.hyprland.enable {
hjem.users.${username} = {

View file

@ -6,12 +6,16 @@
config,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib'.generators) toHyprConf;
inherit (config.local.systemVars) username;
inherit (config.local.style) wallpaper;
inherit (inputs.hyprpaper.packages.${pkgs.system}) hyprpaper;
inherit (config.local.style) wallpaper;
inherit (config.local.systemVars) username;
in {
config = lib.mkIf config.local.modules.hyprland.enable {
config = mkIf config.local.modules.hyprland.enable {
hjem.users.${username} = {
packages = [hyprpaper];
files = {

View file

@ -4,6 +4,8 @@
config,
...
}: let
inherit (lib.modules) mkIf;
inherit (config.local.systemVars) username;
in {
imports = [
@ -11,7 +13,7 @@ in {
./zathura.nix
];
config = lib.mkIf config.local.profiles.desktop.enable {
config = mkIf config.local.profiles.desktop.enable {
hjem.users.${username}.packages = [
pkgs.gnome-calculator
pkgs.gthumb

View file

@ -4,16 +4,19 @@
pkgs,
...
}: let
inherit (lib.modules) mkIf;
inherit (config.local.systemVars) username;
styleCfg = config.local.style;
in {
config = lib.mkIf config.local.profiles.desktop.enable {
config = mkIf config.local.profiles.desktop.enable {
hjem.users.${username} = {
packages = [pkgs.tidal-hifi];
files = {
# based on https://github.com/rose-pine/tidal. adapted to work with base16 colors.
"tidal-hifi/themes/base16.css".text = with styleCfg.scheme.palette;
lib.mkIf styleCfg.enable ''
mkIf styleCfg.enable ''
:root {
--glass-white-1: ${base05};
--glass-white-1-hover: ${base06};

View file

@ -4,12 +4,16 @@
config,
...
}: let
inherit (builtins) concatStringsSep toString;
inherit (lib.modules) mkIf;
inherit (config.local.systemVars) username;
toZathura = attrs:
builtins.concatStringsSep "\n"
concatStringsSep "\n"
(lib.mapAttrsToList (option: value: "set ${option} \"${toString value}\"") attrs);
in {
config = lib.mkIf config.local.profiles.desktop.enable {
config = mkIf config.local.profiles.desktop.enable {
hjem.users.${username} = {
packages = [pkgs.zathura];
files = {

View file

@ -4,12 +4,16 @@
config,
...
}: let
inherit (lib) optionalAttrs;
inherit (builtins) mapAttrs;
inherit (lib.attrsets) optionalAttrs;
inherit (lib.modules) mkIf;
inherit (config.local.systemVars) username;
styleCfg = config.local.style;
# because someone thought this was a great idea: https://github.com/tinted-theming/schemes/commit/61058a8d2e2bd4482b53d57a68feb56cdb991f0b
palette = builtins.mapAttrs (_: color: lib.removePrefix "#" color) styleCfg.scheme.palette;
palette = mapAttrs (_: color: lib.removePrefix "#" color) styleCfg.scheme.palette;
toINI = lib.generators.toINI {};
mkColors = palette: {
background = palette.base00;
@ -38,7 +42,7 @@
"21" = palette.base06;
};
in {
config = lib.mkIf config.local.modules.hyprland.enable {
config = mkIf config.local.modules.hyprland.enable {
hjem.users.${username} = {
packages = [pkgs.foot];
files = {

View file

@ -4,12 +4,16 @@
config,
...
}: let
inherit (builtins) concatStringsSep;
inherit (lib.modules) mkIf;
inherit (config.local.systemVars) username;
toConf = attrs:
builtins.concatStringsSep "\n"
concatStringsSep "\n"
(lib.mapAttrsToList (option: value: "--${option}=\"${value}\"") attrs);
in {
config = lib.mkIf config.local.profiles.desktop.enable {
config = mkIf config.local.profiles.desktop.enable {
hjem.users.${username} = {
packages = [
pkgs.bat

View file

@ -2,8 +2,10 @@
lib,
config,
...
}: {
config = lib.mkIf config.local.profiles.desktop.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf config.local.profiles.desktop.enable {
programs.direnv.enable = true;
};
}

View file

@ -4,11 +4,14 @@
config,
...
}: let
inherit (config.local.systemVars) username;
inherit (lib.modules) mkIf;
inherit (config.local.homeVars) signingKey;
inherit (config.local.systemVars) username;
toINI = lib.generators.toINI {};
in {
config = lib.mkIf config.local.profiles.desktop.enable {
config = mkIf config.local.profiles.desktop.enable {
hjem.users.${username} = {
packages = with pkgs; [git lazygit];
files = {

View file

@ -4,9 +4,11 @@
config,
...
}: let
inherit (lib.modules) mkIf;
inherit (config.local.systemVars) username;
in {
config = lib.mkIf config.local.profiles.desktop.enable {
config = mkIf config.local.profiles.desktop.enable {
hjem.users.${username} = {
packages = with pkgs; [
# archives

View file

@ -3,8 +3,10 @@
pkgs,
osConfig,
...
}: {
config = lib.mkIf osConfig.local.profiles.desktop.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf osConfig.local.profiles.desktop.enable {
programs.tmux = {
enable = true;
prefix = "C-space";

View file

@ -4,11 +4,14 @@
config,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.strings) concatStrings;
toTOML = (pkgs.formats.toml {}).generate;
inherit (config.local.systemVars) username;
toTOML = (pkgs.formats.toml {}).generate;
in {
config = lib.mkIf config.local.profiles.desktop.enable {
config = mkIf config.local.profiles.desktop.enable {
hjem.users.${username} = {
packages = [pkgs.starship];
files = {

View file

@ -4,9 +4,11 @@
config,
...
}: let
inherit (lib.modules) mkIf;
inherit (config.local.systemVars) username;
in {
config = lib.mkIf config.local.profiles.desktop.enable {
config = mkIf config.local.profiles.desktop.enable {
hjem.users.${username} = {
packages = [pkgs.zoxide];
};

View file

@ -4,6 +4,10 @@
config,
...
}: let
inherit (builtins) concatStringsSep map;
inherit (lib.meta) getExe';
inherit (lib.modules) mkIf;
inherit (config.local.systemVars) username;
mkLayout = items: let
@ -15,15 +19,15 @@
"keybind" : "${item.keybind}"
}'';
in
builtins.concatStringsSep "\n" (map formatItem items);
concatStringsSep "\n" (map formatItem items);
in {
config = lib.mkIf config.local.modules.hyprland.enable {
config = mkIf config.local.modules.hyprland.enable {
hjem.users.${username} = {
packages = [pkgs.wlogout];
files = {
".config/wlogout/layout".text = let
loginctl = lib.getExe' pkgs.systemd "loginctl";
systemctl = lib.getExe' pkgs.systemd "systemctl";
loginctl = getExe' pkgs.systemd "loginctl";
systemctl = getExe' pkgs.systemd "systemctl";
in
mkLayout [
{

View file

@ -4,9 +4,11 @@
config,
...
}: let
inherit (lib.modules) mkIf;
inherit (config.local.systemVars) username;
in {
config = lib.mkIf config.local.profiles.desktop.enable {
config = mkIf config.local.profiles.desktop.enable {
hjem.users.${username} = {
files = {
".config/mimeapps.list".text = ''

View file

@ -2,8 +2,10 @@
lib,
config,
...
}: {
config = lib.mkIf config.local.profiles.laptop.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf config.local.profiles.laptop.enable {
hardware.brillo.enable = true;
};
}

View file

@ -3,8 +3,10 @@
pkgs,
config,
...
}: {
config = lib.mkIf config.local.profiles.desktop.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf config.local.profiles.desktop.enable {
virtualisation.podman = {
enable = true;
dockerCompat = true;

View file

@ -2,8 +2,10 @@
lib,
config,
...
}: {
config = lib.mkIf config.local.profiles.desktop.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf config.local.profiles.desktop.enable {
documentation = {
enable = true;

View file

@ -2,8 +2,10 @@
lib,
config,
...
}: {
config = lib.mkIf config.local.profiles.desktop.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf config.local.profiles.desktop.enable {
services.flatpak.enable = true;
};
}

View file

@ -4,7 +4,10 @@
pkgs,
...
}: let
inherit (lib) mkAfter removePrefix removeSuffix;
inherit (builtins) attrNames concatStringsSep map readDir toString;
inherit (lib.modules) mkAfter mkIf;
inherit (lib.strings) removePrefix removeSuffix;
srv = config.services.forgejo.settings.server;
# https://github.com/isabelroses/dotfiles/blob/06f8f70914c8e672541a52563ee624ce2e62adfb/modules/nixos/services/selfhosted/forgejo.nix#L19-L23
@ -14,7 +17,7 @@
stripRoot = false;
};
in {
config = lib.mkIf config.local.profiles.server.enable {
config = mkIf config.local.profiles.server.enable {
services = {
forgejo = {
enable = true;
@ -40,10 +43,10 @@ in {
};
ui = {
DEFAULT_THEME = "catppuccin-mocha-lavender";
THEMES = builtins.concatStringsSep "," (
THEMES = concatStringsSep "," (
["auto,forgejo-auto,forgejo-dark,forgejo-light,arc-gree,gitea"]
++ (map (name: removePrefix "theme-" (removeSuffix ".css" name)) (
builtins.attrNames (builtins.readDir theme)
attrNames (readDir theme)
))
);
};

View file

@ -4,10 +4,13 @@
config,
...
}: let
inherit (lib.modules) mkIf;
inherit (config.local.systemVars) username;
toINI = lib.generators.toINI {};
in {
config = lib.mkIf config.local.profiles.desktop.enable {
config = mkIf config.local.profiles.desktop.enable {
hjem.users.${username} = {
packages = [pkgs.gammastep];
files = {

View file

@ -3,8 +3,10 @@
pkgs,
config,
...
}: {
config = lib.mkIf config.local.profiles.desktop.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf config.local.profiles.desktop.enable {
services = {
# needed for GNOME services outside of GNOME Desktop
dbus.packages = with pkgs; [

View file

@ -8,11 +8,14 @@
}:
# thanks https://git.jacekpoz.pl/poz/niksos/src/commit/f8d5e7ccd9c769f7c0b564f10dff419285e75248/modules/services/greetd.nix
let
inherit (builtins) concatStringsSep filter toString;
inherit (lib.attrsets) optionalAttrs;
inherit (lib.meta) getExe getExe';
inherit (lib.modules) mkIf;
inherit (lib'.generators) toHyprConf;
inherit (inputs.hyprland.packages.${pkgs.stdenv.system}) hyprland;
inherit (lib'.generators) toHyprConf;
styleCfg = config.local.style;
@ -50,7 +53,7 @@ let
});
in {
# TODO: perhaps turn this into a more generic module if we wanna use other wayland compositors
config = lib.mkIf config.local.modules.hyprland.enable {
config = mkIf config.local.modules.hyprland.enable {
services.greetd = {
enable = true;
settings = {
@ -83,6 +86,6 @@ in {
}
];
in
builtins.concatStringsSep "\n" (map (env: env.name) (builtins.filter (env: env.condition) environments));
concatStringsSep "\n" (map (env: env.name) (filter (env: env.condition) environments));
};
}

View file

@ -6,9 +6,12 @@
lib',
...
}: let
inherit (lib.lists) singleton;
inherit (lib.gvariant) mkInt32;
inherit (lib.lists) singleton;
inherit (lib.modules) mkIf;
inherit (lib'.generators.gtk) finalGtk2Text toGtk3Ini;
inherit (config.local.systemVars) username;
styleCfg = config.local.style;
@ -21,7 +24,7 @@
};
in {
config = with styleCfg;
lib.mkIf styleCfg.enable {
mkIf styleCfg.enable {
hjem.users.${username} = let
gtkCss = pkgs.writeText "gtk-colors" (import ./style.nix lib' styleCfg.scheme.palette);
in {

View file

@ -3,8 +3,10 @@
pkgs,
config,
...
}: {
config = lib.mkIf config.local.profiles.desktop.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf config.local.profiles.desktop.enable {
services.keyd = {
enable = true;
keyboards.default = {

View file

@ -3,8 +3,10 @@
pkgs,
config,
...
}: {
config = lib.mkIf config.local.profiles.desktop.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf config.local.profiles.desktop.enable {
services.kmscon = {
enable = true;
fonts = [

View file

@ -2,8 +2,10 @@
lib,
config,
...
}: {
config = lib.mkIf config.local.modules.hyprland.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf config.local.modules.hyprland.enable {
location.provider = "geoclue2";
services.geoclue2 = {

View file

@ -2,8 +2,10 @@
lib,
config,
...
}: {
config = lib.mkIf config.local.profiles.laptop.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf config.local.profiles.laptop.enable {
services.logind = {
lidSwitch = "suspend";
extraConfig = ''

View file

@ -3,12 +3,14 @@
inputs,
config,
...
}: {
}: let
inherit (lib.modules) mkIf;
in {
imports = [
inputs.nix-gaming.nixosModules.pipewireLowLatency
];
config = lib.mkIf config.local.profiles.desktop.enable {
config = mkIf config.local.profiles.desktop.enable {
services = {
pulseaudio.enable = false;
pipewire = {

View file

@ -2,8 +2,10 @@
lib,
config,
...
}: {
config = lib.mkIf config.local.profiles.laptop.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf config.local.profiles.laptop.enable {
services = {
power-profiles-daemon.enable = true;

View file

@ -4,12 +4,14 @@
pkgs,
config,
...
}: {
}: let
inherit (lib.modules) mkIf;
in {
imports = [
inputs.agenix.nixosModules.default
];
config = lib.mkIf config.local.profiles.server.enable {
config = mkIf config.local.profiles.server.enable {
age.secrets.searx-env-file.file = ../../secrets/searx-env-file.age;
services = {
searx = {

View file

@ -3,9 +3,11 @@
config,
...
}: let
inherit (lib.modules) mkIf;
inherit (config.local.systemVars) username;
in {
config = lib.mkIf config.local.profiles.desktop.enable {
config = mkIf config.local.profiles.desktop.enable {
programs.ssh = {
startAgent = true;
};

View file

@ -5,11 +5,14 @@
lib',
...
}: let
inherit (builtins) toJSON;
inherit (config.local.systemVars) username;
inherit (builtins) readFile toJSON;
inherit (lib.modules) mkIf;
inherit (lib') generateGtkColors;
inherit (config.local.systemVars) username;
in {
config = lib.mkIf config.local.modules.hyprland.enable {
config = mkIf config.local.modules.hyprland.enable {
hjem.users.${username} = {
files = {
".config/swaync/config.json".text = toJSON {
@ -29,7 +32,7 @@ in {
notification-body-image-height = 100;
notification-body-image-width = 200;
};
".config/swaync/style.css".text = (generateGtkColors config.local.style.scheme.palette) + builtins.readFile ./style.css;
".config/swaync/style.css".text = (generateGtkColors config.local.style.scheme.palette) + readFile ./style.css;
};
packages = [pkgs.swaynotificationcenter];

View file

@ -4,8 +4,10 @@
pkgs,
config,
...
}: {
config = lib.mkIf config.local.profiles.server.enable {
}: let
inherit (lib.modules) mkIf;
in {
config = mkIf config.local.profiles.server.enable {
services.caddy.enable = true;
services.caddy.virtualHosts = {
"www.nezia.dev" = {

View file

@ -4,6 +4,7 @@
config,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) attrs lines package str;
@ -57,7 +58,7 @@ in {
'';
};
};
config = lib.mkIf cfg.enable {
config = mkIf cfg.enable {
packages = [firefox];
files = {
".mozilla/firefox/profiles.ini".text = toINI {

View file

@ -4,15 +4,17 @@
pkgs,
...
}: let
inherit (builtins) concatStringsSep;
inherit (lib.attrsets) isAttrs mapAttrs' mapAttrsToList nameValuePair;
inherit (lib.generators) mkKeyValueDefault mkValueStringDefault toINIWithGlobalSection;
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) attrs attrsOf package;
mkKeyValue = key: value:
if isAttrs value
# ghostty's configuration format supports (so far) one level of nested keys as key1=key2=value
then builtins.concatStringsSep "\n" (mapAttrsToList (k: v: "${key}=${k}=${v}") value)
then concatStringsSep "\n" (mapAttrsToList (k: v: "${key}=${k}=${v}") value)
else (mkKeyValueDefault {mkValueString = mkValueStringDefault {};} "=" key value);
toGhosttyConf = toINIWithGlobalSection {
@ -96,7 +98,7 @@ in {
};
};
config = lib.mkIf cfg.enable {
config = mkIf cfg.enable {
packages = [cfg.package];
files =
{

View file

@ -3,6 +3,7 @@
pkgs,
...
}: let
inherit (lib.strings) makeLibraryPath;
name = "mcuxpressoide";
version = "24.9.25";
description = "MCUXpresso IDE";
@ -104,7 +105,7 @@
pkgs.libudev-zero
];
profile = ''
export LD_LIBRARY_PATH=${lib.makeLibraryPath [pkgs.ncurses5 pkgs.ncurses]}:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=${makeLibraryPath [pkgs.ncurses5 pkgs.ncurses]}:$LD_LIBRARY_PATH
'';
extraBuildCommands = ''