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: lib: let
with 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 # 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 # convert rrggbb hex to rgba(r, g, b, a) css
rgba = c: alpha: let rgba = c: alpha: let
color = removePrefix "#" c; color = removePrefix "#" c;
r = toString (hexToDec (__substring 0 2 color)); r = toString (hexToDec (substring 0 2 color));
g = toString (hexToDec (__substring 2 2 color)); g = toString (hexToDec (substring 2 2 color));
b = toString (hexToDec (__substring 4 2 color)); b = toString (hexToDec (substring 4 2 color));
a = toString alpha; a = toString alpha;
res = "rgba(${r}, ${g}, ${b}, ${a})"; res = "rgba(${r}, ${g}, ${b}, ${a})";
in in
res; res;
blurImage = pkgs: path: blurImage = pkgs: path:
pkgs.runCommand "${builtins.baseNameOf path}-blurred" { pkgs.runCommand "${baseNameOf path}-blurred" {
buildInputs = [pkgs.imagemagick]; buildInputs = [pkgs.imagemagick];
} }
'' ''

View file

@ -1,7 +1,12 @@
lib: let lib: let
# toGtk3Ini , formatGtk2Option , and finalGtk2Text are all taken from https://github.com/nix-community/home-manager, with some minor modifications to their function. # 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. # 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 formatGtk2Option = n: v: let
v' = v' =
if isBool v if isBool v
@ -11,7 +16,7 @@ lib: let
else toString v; else toString v;
in "${escape ["="] n} = ${v'}"; in "${escape ["="] n} = ${v'}";
in { in {
toGtk3Ini = generators.toINI { toGtk3Ini = toINI {
mkKeyValue = key: value: let mkKeyValue = key: value: let
value' = value' =
if isBool value if isBool value

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -6,13 +6,17 @@
config, config,
... ...
}: let }: let
inherit (lib) mkIf; inherit (builtins) mapAttrs;
inherit (lib.modules) mkIf;
inherit (lib') rgba;
inherit (lib'.generators) toHyprConf; inherit (lib'.generators) toHyprConf;
inherit (config.local.systemVars) username;
inherit (inputs.hyprlock.packages.${pkgs.system}) hyprlock; inherit (inputs.hyprlock.packages.${pkgs.system}) hyprlock;
inherit (config.local.systemVars) username;
styleCfg = config.local.style; 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 { in {
config = mkIf config.local.modules.hyprland.enable { config = mkIf config.local.modules.hyprland.enable {
hjem.users.${username} = { hjem.users.${username} = {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -8,11 +8,14 @@
}: }:
# thanks https://git.jacekpoz.pl/poz/niksos/src/commit/f8d5e7ccd9c769f7c0b564f10dff419285e75248/modules/services/greetd.nix # thanks https://git.jacekpoz.pl/poz/niksos/src/commit/f8d5e7ccd9c769f7c0b564f10dff419285e75248/modules/services/greetd.nix
let let
inherit (builtins) concatStringsSep filter toString;
inherit (lib.attrsets) optionalAttrs; inherit (lib.attrsets) optionalAttrs;
inherit (lib.meta) getExe getExe'; inherit (lib.meta) getExe getExe';
inherit (lib.modules) mkIf;
inherit (lib'.generators) toHyprConf;
inherit (inputs.hyprland.packages.${pkgs.stdenv.system}) hyprland; inherit (inputs.hyprland.packages.${pkgs.stdenv.system}) hyprland;
inherit (lib'.generators) toHyprConf;
styleCfg = config.local.style; styleCfg = config.local.style;
@ -50,7 +53,7 @@ let
}); });
in { in {
# TODO: perhaps turn this into a more generic module if we wanna use other wayland compositors # 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 = { services.greetd = {
enable = true; enable = true;
settings = { settings = {
@ -83,6 +86,6 @@ in {
} }
]; ];
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', lib',
... ...
}: let }: let
inherit (lib.lists) singleton;
inherit (lib.gvariant) mkInt32; inherit (lib.gvariant) mkInt32;
inherit (lib.lists) singleton;
inherit (lib.modules) mkIf;
inherit (lib'.generators.gtk) finalGtk2Text toGtk3Ini; inherit (lib'.generators.gtk) finalGtk2Text toGtk3Ini;
inherit (config.local.systemVars) username; inherit (config.local.systemVars) username;
styleCfg = config.local.style; styleCfg = config.local.style;
@ -21,7 +24,7 @@
}; };
in { in {
config = with styleCfg; config = with styleCfg;
lib.mkIf styleCfg.enable { mkIf styleCfg.enable {
hjem.users.${username} = let hjem.users.${username} = let
gtkCss = pkgs.writeText "gtk-colors" (import ./style.nix lib' styleCfg.scheme.palette); gtkCss = pkgs.writeText "gtk-colors" (import ./style.nix lib' styleCfg.scheme.palette);
in { in {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,12 +4,14 @@
pkgs, pkgs,
config, config,
... ...
}: { }: let
inherit (lib.modules) mkIf;
in {
imports = [ imports = [
inputs.agenix.nixosModules.default 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; age.secrets.searx-env-file.file = ../../secrets/searx-env-file.age;
services = { services = {
searx = { searx = {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,6 +3,7 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (lib.strings) makeLibraryPath;
name = "mcuxpressoide"; name = "mcuxpressoide";
version = "24.9.25"; version = "24.9.25";
description = "MCUXpresso IDE"; description = "MCUXpresso IDE";
@ -104,7 +105,7 @@
pkgs.libudev-zero pkgs.libudev-zero
]; ];
profile = '' 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 = '' extraBuildCommands = ''