use namespace for my options

This commit is contained in:
Osman Faruk Bayram 2025-02-04 23:53:13 +03:00
parent 64fcba43f0
commit 1b1e7f792f
9 changed files with 49 additions and 50 deletions

View file

@ -74,7 +74,7 @@
}; };
ymir = nixpkgs.lib.nixosSystem { ymir = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;}; specialArgs = {inherit inputs outputs;};
modules = [ ./hosts/ymir/configuration.nix ]; modules = [./hosts/ymir/configuration.nix];
}; };
harmonica = nixpkgs.lib.nixosSystem { harmonica = nixpkgs.lib.nixosSystem {
modules = [ modules = [
@ -131,7 +131,5 @@
}; };
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
formatter.aarch64-linux = nixpkgs.legacyPackages.aarch64-linux.alejandra; formatter.aarch64-linux = nixpkgs.legacyPackages.aarch64-linux.alejandra;
description = "My system configuration";
}; };
} }

View file

@ -21,14 +21,13 @@ in {
sshUser = "osbm"; sshUser = "osbm";
} }
]; ];
myModules = {
enableKDE = false; enableKDE = false;
enableFonts = false; enableFonts = false;
blockYoutube = false;
blockYoutube = false; blockTwitter = false;
blockTwitter = false; enableTailscale = true;
};
enableTailscale = true;
i18n.inputMethod.enable = lib.mkForce false; # no need for japanese input method i18n.inputMethod.enable = lib.mkForce false; # no need for japanese input method
programs.firefox.enable = lib.mkForce false; # no need for firefox programs.firefox.enable = lib.mkForce false; # no need for firefox

View file

@ -13,13 +13,13 @@ in {
../../modules ../../modules
]; ];
blockYoutube = false; myModules = {
blockTwitter = true; blockYoutube = false;
blockBluesky = false; blockTwitter = true;
blockBluesky = false;
enableKDE = true; enableKDE = true;
enableTailscale = true;
enableTailscale = true; };
boot.binfmt.emulatedSystems = ["aarch64-linux"]; boot.binfmt.emulatedSystems = ["aarch64-linux"];
nix.settings.extra-platforms = config.boot.binfmt.emulatedSystems; nix.settings.extra-platforms = config.boot.binfmt.emulatedSystems;

View file

@ -17,13 +17,13 @@ in {
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
]; ];
blockYoutube = false; myModules = {
blockTwitter = true; blockYoutube = false;
blockBluesky = false; blockTwitter = true;
blockBluesky = false;
enableKDE = true; enableKDE = true;
enableTailscale = true;
enableTailscale = true; };
# Bootloader. # Bootloader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;

View file

@ -5,7 +5,7 @@
... ...
}: { }: {
options = { options = {
arduinoSetup = lib.mkOption { myModules.arduinoSetup = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = false; default = false;
description = "Installs arduino-ide and adafruit-nrfutil and sets udev rules"; description = "Installs arduino-ide and adafruit-nrfutil and sets udev rules";
@ -13,7 +13,7 @@
}; };
config = lib.mkMerge [ config = lib.mkMerge [
(lib.mkIf config.arduinoSetup { (lib.mkIf config.myModules.arduinoSetup {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
arduino-ide arduino-ide
adafruit-nrfutil adafruit-nrfutil

View file

@ -5,25 +5,27 @@
... ...
}: { }: {
options = { options = {
blockYoutube = lib.mkOption { myModules = {
type = lib.types.bool; blockYoutube = lib.mkOption {
default = true; type = lib.types.bool;
description = "Disables youtube using /etc/hosts file"; default = true;
}; description = "Disables youtube using /etc/hosts file";
blockTwitter = lib.mkOption { };
type = lib.types.bool; blockTwitter = lib.mkOption {
default = true; type = lib.types.bool;
description = "Disables twitter using /etc/hosts file"; default = true;
}; description = "Disables twitter using /etc/hosts file";
blockBluesky = lib.mkOption { };
type = lib.types.bool; blockBluesky = lib.mkOption {
default = true; type = lib.types.bool;
description = "Disables bluesky using /etc/hosts file"; default = true;
description = "Disables bluesky using /etc/hosts file";
};
}; };
}; };
config = lib.mkMerge [ config = lib.mkMerge [
(lib.mkIf config.blockYoutube { (lib.mkIf config.myModules.blockYoutube {
networking.extraHosts = '' networking.extraHosts = ''
0.0.0.0 youtube.com 0.0.0.0 youtube.com
::0 youtube.com ::0 youtube.com
@ -32,7 +34,7 @@
::0 www.youtube.com ::0 www.youtube.com
''; '';
}) })
(lib.mkIf config.blockTwitter { (lib.mkIf config.myModules.blockTwitter {
networking.extraHosts = '' networking.extraHosts = ''
0.0.0.0 twitter.com 0.0.0.0 twitter.com
::0 twitter.com ::0 twitter.com
@ -41,7 +43,7 @@
::0 www.twitter.com ::0 www.twitter.com
''; '';
}) })
(lib.mkIf config.blockBluesky { (lib.mkIf config.myModules.blockBluesky {
networking.extraHosts = '' networking.extraHosts = ''
0.0.0.0 bsky.app 0.0.0.0 bsky.app
::0 bsky.app ::0 bsky.app

View file

@ -5,7 +5,7 @@
... ...
}: { }: {
options = { options = {
enableFonts = lib.mkOption { myModules.enableFonts = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = true; default = true;
description = "Enable my favorite fonts"; description = "Enable my favorite fonts";
@ -13,7 +13,7 @@
}; };
config = lib.mkMerge [ config = lib.mkMerge [
(lib.mkIf config.enableFonts { (lib.mkIf config.myModules.enableFonts {
fonts.packages = with pkgs; [ fonts.packages = with pkgs; [
noto-fonts noto-fonts
noto-fonts-cjk-sans noto-fonts-cjk-sans

View file

@ -5,7 +5,7 @@
... ...
}: { }: {
options = { options = {
enableKDE = lib.mkOption { myModules.enableKDE = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = false; default = false;
description = "Enable KDE Plasma Desktop Environment with my favorite packages"; description = "Enable KDE Plasma Desktop Environment with my favorite packages";
@ -13,7 +13,7 @@
}; };
config = lib.mkMerge [ config = lib.mkMerge [
(lib.mkIf config.enableKDE { (lib.mkIf config.myModules.enableKDE {
# Enable the X11 windowing system. # Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session. # You can disable this if you're only using the Wayland session.
services.xserver.enable = true; services.xserver.enable = true;

View file

@ -5,7 +5,7 @@
... ...
}: { }: {
options = { options = {
enableTailscale = lib.mkOption { myModules.enableTailscale = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = false; default = false;
description = "Enable Tailscale VPN"; description = "Enable Tailscale VPN";
@ -19,7 +19,7 @@
# and i have a laptop named tartarus # and i have a laptop named tartarus
config = lib.mkMerge [ config = lib.mkMerge [
(lib.mkIf config.enableTailscale { (lib.mkIf config.myModules.enableTailscale {
services.tailscale = { services.tailscale = {
enable = true; enable = true;
port = 51513; port = 51513;