1

Nixos: Remove mkLink + mkEnableOpt and rename mkBoolOpt

This commit is contained in:
2024-10-12 17:31:01 +02:00
parent bd50e4539e
commit 4eddef07be
32 changed files with 156 additions and 172 deletions

View File

@ -46,6 +46,9 @@
inherit system; inherit system;
config.allowUnfree = true; config.allowUnfree = true;
# Alternative to setting config.allowUnfree.
# I read somewhere that this is more suitable when running HM standalone.
config.allowUnfreePredicate = pkg: true; config.allowUnfreePredicate = pkg: true;
# Overlays define changes in the nixpkgs package set. # Overlays define changes in the nixpkgs package set.

View File

@ -5,5 +5,5 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "TEMPLATE"; enable = mkEnableOption "TEMPLATE";
} }

View File

@ -5,5 +5,5 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Enable Alacritty"; enable = mkEnableOption "Enable Alacritty";
} }

View File

@ -5,44 +5,44 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Audio module"; enable = mkEnableOption "Audio module";
# TODO: Group these in categories (like instruments/VSTs or sth) # TODO: Group these in categories (like instruments/VSTs or sth)
# TODO: Make it easier to add many yes/no options, similar to the flatpak stuff # TODO: Make it easier to add many yes/no options, similar to the flatpak stuff
# Hosts/Editing # Hosts/Editing
carla.enable = mkEnableOpt "Carla (VST host)"; carla.enable = mkEnableOption "Carla (VST host)";
bitwig.enable = mkEnableOpt "Bitwig (Digital audio workstation)"; bitwig.enable = mkEnableOption "Bitwig (Digital audio workstation)";
tenacity.enable = mkEnableOpt "Tenacity (Audacity fork)"; tenacity.enable = mkEnableOption "Tenacity (Audacity fork)";
# Instruments/Plugins # Instruments/Plugins
# vcvrack.enable = mkEnableOpt "VCV-Rack (Eurorack simulator)"; # Replaced by cardinal # vcvrack.enable = mkEnableOption "VCV-Rack (Eurorack simulator)"; # Replaced by cardinal
cardinal.enable = mkEnableOpt "Open Source VCV-Rack plugin wrapper"; cardinal.enable = mkEnableOption "Open Source VCV-Rack plugin wrapper";
# vital.enable = mkEnableOpt "Vital (Wavetable synthesizer)"; # Replaced by distrho # vital.enable = mkEnableOption "Vital (Wavetable synthesizer)"; # Replaced by distrho
distrho.enable = mkEnableOpt "Distrho (Linux VST ports)"; distrho.enable = mkEnableOption "Distrho (Linux VST ports)";
# Misc # Misc
faust.enable = mkEnableOpt "Faust (functional DSP language)"; faust.enable = mkEnableOption "Faust (functional DSP language)";
bottles.enable = mkEnableOpt "Bottles (flatpak)"; bottles.enable = mkEnableOption "Bottles (flatpak)";
# TODO: Automatically add the needed paths, depends on the bottle though # TODO: Automatically add the needed paths, depends on the bottle though
# /home/christoph/.var/app/com.usebottles.bottles/data/bottles/bottles/Audio/drive_c/Program Files/Common Files/VST3 # /home/christoph/.var/app/com.usebottles.bottles/data/bottles/bottles/Audio/drive_c/Program Files/Common Files/VST3
# /home/christoph/.var/app/com.usebottles.bottles/data/bottles/bottles/Audio/drive_c/Program Files/VstPlugins # /home/christoph/.var/app/com.usebottles.bottles/data/bottles/bottles/Audio/drive_c/Program Files/VstPlugins
yabridge = { yabridge = {
enable = mkEnableOpt "Yabridge (Windows VST plugin manager)"; enable = mkEnableOption "Yabridge (Windows VST plugin manager)";
autoSync = mkBoolOpt false "Sync yabridge plugins on nixos-rebuild"; autoSync = mkBoolOption false "Sync yabridge plugins on nixos-rebuild";
}; };
noisesuppression = { noisesuppression = {
noisetorch = { noisetorch = {
enable = mkEnableOpt "Noisetorch"; enable = mkEnableOption "Noisetorch";
autostart = mkBoolOpt false "Autoload Noisetorch suppression"; autostart = mkBoolOption false "Autoload Noisetorch suppression";
}; };
# TODO: Store easyeffects presets/config (dconf com/github/wwmm/easyeffects ?) # TODO: Store easyeffects presets/config (dconf com/github/wwmm/easyeffects ?)
easyeffects = { easyeffects = {
enable = mkEnableOpt "EasyEffects"; enable = mkEnableOption "EasyEffects";
autostart = mkBoolOpt false "Autoload EasyEffects suppression profile"; autostart = mkBoolOption false "Autoload EasyEffects suppression profile";
}; };
}; };
} }

View File

@ -5,16 +5,16 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Emacs module"; enable = mkEnableOption "Emacs module";
# TODO: Use an enum for this not individual options # TODO: Use an enum for this not individual options
nixpkgs = mkBoolOpt false "Use Emacs from the official repositories"; nixpkgs = mkBoolOption false "Use Emacs from the official repositories";
nativeComp = mkBoolOpt false "Use Emacs 28.x branch with native comp support"; nativeComp = mkBoolOption false "Use Emacs 28.x branch with native comp support";
pgtkNativeComp = mkBoolOpt false "Use Emacs 29.x branch with native comp and pure gtk support"; pgtkNativeComp = mkBoolOption false "Use Emacs 29.x branch with native comp and pure gtk support";
doom = { doom = {
enable = mkEnableOpt "Doom Emacs framework"; enable = mkEnableOption "Doom Emacs framework";
autoSync = mkBoolOpt false "Sync Doom Emacs on nixos-rebuild"; autoSync = mkBoolOption false "Sync Doom Emacs on nixos-rebuild";
autoUpgrade = mkBoolOpt false "Upgrade Doom Emacs on nixos-rebuild"; autoUpgrade = mkBoolOption false "Upgrade Doom Emacs on nixos-rebuild";
}; };
} }

View File

@ -5,12 +5,12 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Email"; enable = mkEnableOption "Email";
autosync = mkEnableOpt "Automatically call \"notmuch new\" via systemd timer"; autosync = mkEnableOption "Automatically call \"notmuch new\" via systemd timer";
imapnotify = mkEnableOpt "Use imapnotify to sync and index mail automatically"; imapnotify = mkEnableOption "Use imapnotify to sync and index mail automatically";
kmail = { kmail = {
enable = mkEnableOpt "Kmail"; enable = mkEnableOption "Kmail";
autostart = mkEnableOpt "Autostart Kmail"; autostart = mkEnableOption "Autostart Kmail";
}; };
} }

View File

@ -5,22 +5,22 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Flatpak module"; enable = mkEnableOption "Flatpak module";
fontFix = mkBoolOpt true "Link fonts to ~/.local/share/fonts so flatpak apps can find them"; fontFix = mkBoolOption true "Link fonts to ~/.local/share/fonts so flatpak apps can find them";
iconFix = mkBoolOpt true "Link icons to ~/.local/share/icons so flatpak apps can find them"; iconFix = mkBoolOption true "Link icons to ~/.local/share/icons so flatpak apps can find them";
autoUpdate = mkBoolOpt false "Update flatpak apps on nixos-rebuild"; autoUpdate = mkBoolOption false "Update flatpak apps on nixos-rebuild";
autoPrune = mkBoolOpt false "Remove unused packages on nixos-rebuild"; autoPrune = mkBoolOption false "Remove unused packages on nixos-rebuild";
# TODO: Add library function to make this easier # TODO: Add library function to make this easier
# TODO: The flatpak name should be included and a list of all enabled apps should be available # TODO: The flatpak name should be included and a list of all enabled apps should be available
# TODO: Do this for strings + packages # TODO: Do this for strings + packages
discord.enable = mkEnableOpt "Discord"; discord.enable = mkEnableOption "Discord";
spotify.enable = mkEnableOpt "Spotify"; spotify.enable = mkEnableOption "Spotify";
flatseal.enable = mkEnableOpt "Flatseal"; flatseal.enable = mkEnableOption "Flatseal";
bottles.enable = mkEnableOpt "Bottles"; bottles.enable = mkEnableOption "Bottles";
obsidian.enable = mkEnableOpt "Obsidian"; obsidian.enable = mkEnableOption "Obsidian";
jabref.enable = mkEnableOpt "Jabref"; jabref.enable = mkEnableOption "Jabref";
# xwaylandvideobridge = mkEnableOpt "XWayland Video Bridge"; # TODO # xwaylandvideobridge = mkEnableOption "XWayland Video Bridge"; # TODO
# TODO: Can I use extraInstall = { "com.valve.Steam" = true/false; } and pass the module option as value? # TODO: Can I use extraInstall = { "com.valve.Steam" = true/false; } and pass the module option as value?
# This is mainly used by other modules to allow them to use flatpak packages # This is mainly used by other modules to allow them to use flatpak packages

View File

@ -5,19 +5,19 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Gaming module"; enable = mkEnableOption "Gaming module";
# discordElectron.enable = mkEnableOpt "Discord (Electron) (nixpkgs)"; # discordElectron.enable = mkEnableOption "Discord (Electron) (nixpkgs)";
# discordChromium.enable = mkEnableOpt "Discord (Chromium)"; # discordChromium.enable = mkEnableOption "Discord (Chromium)";
prism.enable = mkEnableOpt "PrismLauncher for Minecraft (flatpak)"; prism.enable = mkEnableOption "PrismLauncher for Minecraft (flatpak)";
bottles.enable = mkEnableOpt "Bottles (flatpak)"; bottles.enable = mkEnableOption "Bottles (flatpak)";
# dwarffortress.enable = mkEnableOpt "Dwarf Fortress"; # dwarffortress.enable = mkEnableOption "Dwarf Fortress";
cemu.enable = mkEnableOpt "Cemu (nixpkgs)"; cemu.enable = mkEnableOption "Cemu (nixpkgs)";
steam = { steam = {
enable = mkEnableOpt "Steam (flatpak)"; enable = mkEnableOption "Steam (flatpak)";
gamescope = mkBoolOpt false "Enable the gamescope micro compositor (flatpak)"; gamescope = mkBoolOption false "Enable the gamescope micro compositor (flatpak)";
adwaita = mkBoolOpt false "Enable the adwaita-for-steam skin"; adwaita = mkBoolOption false "Enable the adwaita-for-steam skin";
protonup = mkBoolOpt false "Enable ProtonUP-QT"; protonup = mkBoolOption false "Enable ProtonUP-QT";
}; };
} }

View File

@ -5,5 +5,5 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Helix Editor"; enable = mkEnableOption "Helix Editor";
} }

View File

@ -5,15 +5,15 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Misc module"; enable = mkEnableOption "Misc module";
keepass = { keepass = {
enable = mkEnableOpt "KeePassXC"; enable = mkEnableOption "KeePassXC";
autostart = mkBoolOpt false "Autostart KeePassXC"; autostart = mkBoolOption false "Autostart KeePassXC";
}; };
protonmail = { protonmail = {
enable = mkEnableOpt "ProtonMail"; enable = mkEnableOption "ProtonMail";
autostart = mkBoolOpt false "Autostart ProtonMail Bridge"; autostart = mkBoolOption false "Autostart ProtonMail Bridge";
}; };
} }

View File

@ -5,6 +5,6 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Nextcloud Client"; enable = mkEnableOption "Nextcloud Client";
autostart = mkBoolOpt false "Autostart the Nextcloud client (systemd)"; autostart = mkBoolOption false "Autostart the Nextcloud client (systemd)";
} }

View File

@ -5,6 +5,6 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Ranger"; enable = mkEnableOption "Ranger";
preview = mkBoolOpt false "Enable Ranger image preview"; preview = mkBoolOption false "Enable Ranger image preview";
} }

View File

@ -5,5 +5,5 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Visual Studio Code"; enable = mkEnableOption "Visual Studio Code";
} }

View File

@ -5,6 +5,6 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Chromium"; enable = mkEnableOption "Chromium";
google = mkEnableOpt "Google Chrome"; google = mkEnableOption "Google Chrome";
} }

View File

@ -5,10 +5,10 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Firefox"; enable = mkEnableOption "Firefox";
wayland = mkBoolOpt false "Enable firefox wayland support"; wayland = mkBoolOption false "Enable firefox wayland support";
vaapi = mkBoolOpt false "Enable firefox vaapi support"; vaapi = mkBoolOption false "Enable firefox vaapi support";
disableTabBar = mkBoolOpt false "Disable the firefox tab bar (for TST)"; disableTabBar = mkBoolOption false "Disable the firefox tab bar (for TST)";
defaultBookmarks = mkBoolOpt false "Preset standard bookmarks and folders"; defaultBookmarks = mkBoolOption false "Preset standard bookmarks and folders";
gnomeTheme = mkBoolOpt false "Use Firefox gnome theme (rafaelmardojai)"; gnomeTheme = mkBoolOption false "Use Firefox gnome theme (rafaelmardojai)";
} }

View File

@ -5,5 +5,5 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Fish"; enable = mkEnableOption "Fish";
} }

View File

@ -1,5 +1,6 @@
# TODO: Use the home-manager module instead of generating my own scuffed config files
#
# TODO: The keys to reset the workspaces need to depend on actual workspace config # TODO: The keys to reset the workspaces need to depend on actual workspace config
# TODO: Many of the text file generations can be made simpler with pipe and concatLines functions...
# TODO: The border color does not fit the current theme # TODO: The border color does not fit the current theme
{ {
config, config,
@ -39,7 +40,6 @@ in {
}; };
services = { services = {
# TODO: Make a module out of this
# Notification service # Notification service
dunst = { dunst = {
enable = true; enable = true;
@ -78,14 +78,11 @@ in {
}; };
home = { home = {
# TODO: catppuccin-cursors
pointerCursor = { pointerCursor = {
gtk.enable = true; gtk.enable = true;
x11.enable = true; x11.enable = true;
package = pkgs.bibata-cursors; package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic"; name = "Bibata-Modern-Classic";
# package = pkgs.catppuccin-cursors.latteMauve;
# name = "Catppuccin-Latte-Mauve-Cursors";
size = 16; size = 16;
}; };
@ -118,13 +115,22 @@ in {
# #
file = { file = {
# Polkit # Link the main Hyprland configuration file.
# This file imports all the other generated files.
# TODO: Generate this, so only existing files are imported.
".config/hypr/hyprland.conf".source = ../../../config/hyprland/hyprland.conf;
# Provide a polkit authentication UI.
# This is used for example when running systemd commands without root.
".config/hypr/polkit.conf".text = '' ".config/hypr/polkit.conf".text = ''
exec-once = ${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1 exec-once = ${pkgs.kdePackages.polkit-kde-agent-1}/libexec/polkit-kde-authentication-agent-1
''; '';
# Monitors for different systems # Configure different monitors.
".config/hypr/monitors.conf".text = let ".config/hypr/monitors.conf".text = let
# This function is mapped to the "cfg.monitors" attrSet.
# For each key-value entry in "cfg.monitors",
# the key will be assigned to "name" and the value to "conf".
mkMonitor = name: conf: "monitor = ${name}, ${toString conf.width}x${toString conf.height}@${toString conf.rate}, ${toString conf.x}x${toString conf.y}, ${toString conf.scale}"; mkMonitor = name: conf: "monitor = ${name}, ${toString conf.width}x${toString conf.height}@${toString conf.rate}, ${toString conf.x}x${toString conf.y}, ${toString conf.scale}";
in in
lib.pipe cfg.monitors [ lib.pipe cfg.monitors [
@ -133,7 +139,7 @@ in {
(builtins.concatStringsSep "\n") (builtins.concatStringsSep "\n")
]; ];
# Bind workspaces to monitors # Configure how workspaces are mapped to monitors.
".config/hypr/workspaces.conf".text = let ".config/hypr/workspaces.conf".text = let
mkWorkspace = monitor: workspace: "workspace = ${toString workspace}, monitor:${toString monitor}"; mkWorkspace = monitor: workspace: "workspace = ${toString workspace}, monitor:${toString monitor}";
mkWorkspaces = monitor: workspace-list: map (mkWorkspace monitor) workspace-list; mkWorkspaces = monitor: workspace-list: map (mkWorkspace monitor) workspace-list;
@ -259,14 +265,6 @@ in {
} }
''; '';
}; };
activation = {
# TODO: Don't symlink at all, why not just tell Hyprland where the config is? Much easier
# NOTE: Keep the hyprland config symlinked, to allow easy changes with hotreload
linkHyprlandConfig =
lib.hm.dag.entryAfter ["writeBoundary"]
(mylib.modules.mkLink "~/NixFlake/config/hyprland/hyprland.conf" "~/.config/hypr/hyprland.conf");
};
}; };
}; };
} }

View File

@ -5,7 +5,7 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Hyprland Window Manager + Compositor"; enable = mkEnableOption "Hyprland Window Manager + Compositor";
kb-layout = mkOption { kb-layout = mkOption {
type = types.str; type = types.str;

View File

@ -5,5 +5,5 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Kitty"; enable = mkEnableOption "Kitty";
} }

View File

@ -5,5 +5,5 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Enable LaTeX"; enable = mkEnableOption "Enable LaTeX";
} }

View File

@ -5,7 +5,7 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "NeoVim"; enable = mkEnableOption "NeoVim";
alias = mkBoolOpt false "Link nvim to vim/vi"; alias = mkBoolOption false "Link nvim to vim/vi";
neovide = mkEnableOpt "NeoVide"; neovide = mkEnableOption "NeoVide";
} }

View File

@ -5,5 +5,5 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "NNN File Manager"; enable = mkEnableOption "NNN File Manager";
} }

View File

@ -2,7 +2,6 @@
# VPN and Container modules should use this rofi module to enable their menus then # VPN and Container modules should use this rofi module to enable their menus then
{ {
config, config,
nixosConfig,
lib, lib,
mylib, mylib,
pkgs, pkgs,
@ -34,14 +33,9 @@ in {
}; };
}; };
home.activation = { home.file = {
# NOTE: Keep the rofi config symlinked, to allow easy changes with hotreload ".config/rofi/config.rasi".source = ../../../config/rofi/rofi.rasi;
linkRofiConfig = ".config/rofi/colors.rasi".source = ../../../config/rofi/colors/${cfg.theme}.rasi;
lib.hm.dag.entryAfter ["writeBoundary"]
(mylib.modules.mkLink "~/NixFlake/config/rofi/rofi.rasi" "~/.config/rofi/config.rasi");
linkRofiColors =
lib.hm.dag.entryAfter ["writeBoundary"]
(mylib.modules.mkLink "~/NixFlake/config/rofi/colors/${cfg.theme}.rasi" "~/.config/rofi/colors.rasi");
}; };
}; };
} }

View File

@ -5,7 +5,7 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Rofi"; enable = mkEnableOption "Rofi";
theme = mkOption { theme = mkOption {
type = types.str; type = types.str;

View File

@ -5,7 +5,7 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Waybar"; enable = mkEnableOption "Waybar";
monitor = mkOption { monitor = mkOption {
type = types.str; type = types.str;

View File

@ -5,5 +5,5 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Enable Zathura"; enable = mkEnableOption "Enable Zathura";
} }

View File

@ -4,6 +4,9 @@
lib, lib,
... ...
}: { }: {
# Import my own library functions.
# Those are defined as functions returning sets of library functions,
# so those functions have to be called when importing.
nixos = import ./nixos.nix {inherit inputs pkgs lib;}; nixos = import ./nixos.nix {inherit inputs pkgs lib;};
modules = import ./modules.nix {inherit inputs pkgs lib;}; modules = import ./modules.nix {inherit inputs pkgs lib;};
networking = import ./networking.nix {inherit inputs pkgs lib;}; networking = import ./networking.nix {inherit inputs pkgs lib;};

View File

@ -1,63 +1,44 @@
# TODO: Easier mkLink/mkUnlink (include more hm.dag stuff into the function)
{ {
inputs, inputs,
pkgs, pkgs,
lib, lib,
... ...
}: rec { }: rec {
# Conveniance wrapper for mkOption with boolean type # Convenience wrapper for "mkOption" with boolean type.
mkBoolOpt = def: desc: mkBoolOption = def: desc:
lib.mkOption { lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = def; default = def;
description = desc; description = desc;
}; };
# Alias for consistency # Like "lib.mkIf" but the predicate is inverted.
mkEnableOpt = lib.mkEnableOption; # Returns "do" if "pred" is false.
# Like mkIf but the predicate is inverted
mkElse = pred: do: (lib.mkIf (!pred) do); mkElse = pred: do: (lib.mkIf (!pred) do);
# Creates a symlink if it doesn't exist # Returns "true" if "base" contains "element".
# If it exists renew the link
mkLink = src: dest: ''
if [ -L "${dest}" ]; then
rm ${dest}
fi
ln -sf ${src} ${dest}
'';
# Removes a symlink if it exists
mkUnlink = dest: ''
if [ -L "${dest}" ]; then
rm ${dest}
fi
'';
# Returns true if base contains element
contains = base: element: contains = base: element:
lib.any (x: x == element) base; lib.any (x: x == element) base;
# Returns base without occurences of elements that are also in remove # Returns "base" without occurences of elements that are also in "remove".
without = base: remove: without = base: remove:
lib.filter (x: !(contains remove x)) base; lib.filter (x: !(contains remove x)) base;
# For use with single element sets # Used with attrSets with a single element.
# Returns the name of the single attr.
attrName = set: let attrName = set: let
names = lib.attrNames set; names = lib.attrNames set;
in ( in
if (names != []) if (names != [])
then (lib.head names) then (lib.head names)
else null else null;
);
# For use with single element sets # Used with attrSets with a single element.
# Returns the value of the single attr.
attrValue = set: let attrValue = set: let
values = lib.attrValues set; values = lib.attrValues set;
in ( in
if (values != []) if (values != [])
then (lib.head values) then (lib.head values)
else null else null;
);
} }

View File

@ -14,36 +14,40 @@
lib.nixosSystem { lib.nixosSystem {
inherit system; inherit system;
# Make our inputs available to the configuration.nix (for importing modules) # Values in "specialArgs" are propagated to all system modules.
# specialArgs are propagated to all modules
specialArgs = {inherit inputs hostname mylib system username;}; specialArgs = {inherit inputs hostname mylib system username;};
modules = builtins.concatLists [ modules = builtins.concatLists [
[ [
# Replace the pkgs to include overlays/unfree # Replace the default "pkgs" with my configured version
# to allow installation of unfree software and my own overlays.
{nixpkgs.pkgs = pkgs;} {nixpkgs.pkgs = pkgs;}
# Main config file for all configs/hosts # Import the toplevel system configuration module.
../system ../system
] ]
extraModules extraModules
# HM is installed as a system module # HM is installed as a system module when using mkNixosConfigWithHomeManagerModule.
[ [
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
{ {
# extraSpecialArgs are propagated to all hm config modules home-manager = {
home-manager.extraSpecialArgs = {inherit inputs hostname username mylib;}; # Values in "extraSpecialArgs" are propagated to all HM modules.
extraSpecialArgs = {inherit inputs hostname username mylib;};
# Use systems pkgs, disables nixpkgs.* options in home.nix # Use the "pkgs" from the system configuration.
home-manager.useGlobalPkgs = true; # This disables "nixpkgs.*" options in HM modules.
useGlobalPkgs = true;
# Enable installing packages through users.christoph.packages to /etc/profiles instead of ~/.nix-profile # Packages in "users.${username}.packages" will be installed
home-manager.useUserPackages = true; # to /etc/profiles instead of ~/.nix-profile.
useUserPackages = true;
# User specific config file # Import the user-specific HM toplevel module.
home-manager.users.${username}.imports = [../home/${username}]; users.${username}.imports = [../home/${username}];
};
} }
] ]
]; ];
@ -58,16 +62,16 @@
lib.nixosSystem { lib.nixosSystem {
inherit system; inherit system;
# Make our inputs available to the configuration.nix (for importing modules) # Values in "specialArgs" are propagated to all system modules.
# specialArgs are propagated to all modules
specialArgs = {inherit inputs hostname mylib system;}; specialArgs = {inherit inputs hostname mylib system;};
modules = builtins.concatLists [ modules = builtins.concatLists [
[ [
# Replace the pkgs to include overlays/unfree # Replace the default "pkgs" with my configured version
# to allow installation of unfree software and my own overlays.
{nixpkgs.pkgs = pkgs;} {nixpkgs.pkgs = pkgs;}
# Main config file for all configs/hosts # Import the toplevel system configuration module.
../system ../system
] ]
@ -85,11 +89,12 @@
inputs.home-manager.lib.homeManagerConfiguration { inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
# HM propagates these to every module # Values in "extraSpecialArgs" are propagated to all HM modules.
extraSpecialArgs = {inherit inputs system mylib username hostname;}; extraSpecialArgs = {inherit inputs system mylib username hostname;};
modules = builtins.concatLists [ modules = builtins.concatLists [
[ [
# Import the user-specific HM toplevel module.
../home/${username} ../home/${username}
] ]

View File

@ -9,35 +9,35 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Enable OCI Containers"; enable = mkEnableOption "Enable OCI Containers";
homeassistant = { homeassistant = {
enable = mkEnableOpt "Enable HomeAssistant Container"; enable = mkEnableOption "Enable HomeAssistant Container";
}; };
stablediffusion = { stablediffusion = {
enable = mkEnableOpt "Enable StableDiffusion Container with Automatic1111 WebUI"; enable = mkEnableOption "Enable StableDiffusion Container with Automatic1111 WebUI";
}; };
jellyfin = { jellyfin = {
enable = mkEnableOpt "Enable Jellyfin Container"; enable = mkEnableOption "Enable Jellyfin Container";
}; };
fileflows = { fileflows = {
enable = mkEnableOpt "Enable FileFlows Container"; enable = mkEnableOption "Enable FileFlows Container";
}; };
sonarr = { sonarr = {
enable = mkEnableOpt "Enable Sonarr Container"; enable = mkEnableOption "Enable Sonarr Container";
}; };
radarr = { radarr = {
enable = mkEnableOpt "Enable Radarr Container"; enable = mkEnableOption "Enable Radarr Container";
}; };
hydra = { hydra = {
enable = mkEnableOpt "Enable Hydra Container"; enable = mkEnableOption "Enable Hydra Container";
}; };
sabnzbd = { sabnzbd = {
enable = mkEnableOpt "Enable SabNzbd Container"; enable = mkEnableOption "Enable SabNzbd Container";
}; };
rofiIntegration = { rofiIntegration = {
enable = mkEnableOpt "Enable Rofi Menu for Container Servicing"; enable = mkEnableOption "Enable Rofi Menu for Container Servicing";
hotkey = mkOption { hotkey = mkOption {
type = types.str; type = types.str;
example = '' example = ''

View File

@ -5,7 +5,7 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Polkit"; enable = mkEnableOption "Polkit";
allowed-system-services = mkOption { allowed-system-services = mkOption {
type = types.listOf types.str; type = types.listOf types.str;

View File

@ -5,7 +5,7 @@
}: }:
with lib; with lib;
with mylib.modules; { with mylib.modules; {
enable = mkEnableOpt "Systemd Network Configuration"; enable = mkEnableOption "Systemd Network Configuration";
hostname = mkOption { hostname = mkOption {
type = types.str; type = types.str;