use modules

This commit is contained in:
Osman Faruk Bayram 2025-01-13 20:40:38 +03:00
parent 69ab407977
commit 7a0bf61d06
11 changed files with 18 additions and 22 deletions

View file

@ -0,0 +1,78 @@
{
pkgs,
lib,
config,
...
}: {
environment.systemPackages = with pkgs; [
# vim
wget
git
git-lfs
gnumake
zip
fish
trash-cli
tmux
zoxide
htop
unzip
tlrc
wakeonlan
# neovim
ani-cli
btop
pciutils
nodePackages.npm
nodejs
cloc
neofetch
cbonsai
cowsay
fortune
lolcat
cmatrix
inxi
age
sops
jq
onefetch
just
gh
starship
tree
ffmpeg
nix-output-monitor
yazi
ripgrep
nh
comma
];
programs.steam = {
enable = true;
# Open ports in the firewall for Steam Remote Play
remotePlay.openFirewall = true;
# Open ports in the firewall for Source Dedicated Server
dedicatedServer.openFirewall = true;
# Open ports in the firewall for Steam Local Network Game Transfers
localNetworkGameTransfers.openFirewall = true;
};
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
programs.direnv = {
enable = true;
package = pkgs.direnv;
silent = false;
loadInNixShell = true;
direnvrcExtra = "";
nix-direnv = {
enable = true;
package = pkgs.nix-direnv;
};
};
}

54
modules/concentration.nix Normal file
View file

@ -0,0 +1,54 @@
{
pkgs,
lib,
config,
...
}: {
options = {
blockYoutube = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Disables youtube using /etc/hosts file";
};
blockTwitter = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Disables twitter using /etc/hosts file";
};
blockBluesky = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Disables bluesky using /etc/hosts file";
};
};
config = lib.mkMerge [
(lib.mkIf config.blockYoutube {
networking.extraHosts = ''
0.0.0.0 youtube.com
::0 youtube.com
0.0.0.0 www.youtube.com
::0 www.youtube.com
'';
})
(lib.mkIf config.blockTwitter {
networking.extraHosts = ''
0.0.0.0 twitter.com
::0 twitter.com
0.0.0.0 www.twitter.com
::0 www.twitter.com
'';
})
(lib.mkIf config.blockBluesky {
networking.extraHosts = ''
0.0.0.0 bsky.app
::0 bsky.app
0.0.0.0 www.bsky.app
::0 www.bsky.app
'';
})
];
}

12
modules/default.nix Normal file
View file

@ -0,0 +1,12 @@
{
imports = [
./arduino.nix
./common-packages.nix
./concentration.nix
./firefox.nix
./fonts.nix
./i18n.nix
./nix-settings.nix
./secrets.nix
];
}

102
modules/firefox.nix Normal file
View file

@ -0,0 +1,102 @@
{
pkgs,
lib,
config,
...
}: let
lock-false = {
Value = false;
Status = "locked";
};
lock-true = {
Value = true;
Status = "locked";
};
in {
# Install firefox.
programs.firefox = {
enable = true;
languagePacks = [
"ja"
"tr"
"en-US"
];
# profiles.osbm = {
# Check about:policies#documentation for options.
policies = {
DisableTelemetry = true;
DisableFirefoxStudies = true;
EnableTrackingProtection = {
Value = true;
Locked = true;
Cryptomining = true;
Fingerprinting = true;
};
# DisablePocket = true;
DisableFirefoxAccounts = true;
DisableAccounts = true;
DisableFirefoxScreenshots = true;
StartPage = "previous-session";
# OverrideFirstRunPage = "";
# OverridePostUpdatePage = "";
# DontCheckDefaultBrowser = true;
DisplayBookmarksToolbar = "always"; # alternatives: "never" or "newtab"
# DisplayMenuBar = "default-off"; # alternatives: "always", "never" or "default-on"
# SearchBar = "unified"; # alternat
ExtensionSettings = with builtins; let
extension = shortId: uuid: {
name = uuid;
value = {
install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
installation_mode = "normal_installed";
};
};
in
listToAttrs [
(extension "tree-style-tab" "treestyletab@piro.sakura.ne.jp")
(extension "ublock-origin" "uBlock0@raymondhill.net")
(extension "bitwarden-password-manager" "{446900e4-71c2-419f-a6a7-df9c091e268b}")
(extension "motivation-new-tab" "")
(extension "return-youtube-dislikes" "{762f9885-5a13-4abd-9c77-433dcd38b8fd}")
# (extension "tabliss" "extension@tabliss.io")
# (extension "umatrix" "uMatrix@raymondhill.net")
# (extension "libredirect" "7esoorv3@alefvanoon.anonaddy.me")
# (extension "clearurls" "{74145f27-f039-47ce-a470-a662b129930a}")
];
# To add additional extensions, find it on addons.mozilla.org, find
# the short ID in the url (like https://addons.mozilla.org/en-US/firefox/addon/!SHORT_ID!/)
# Then, download the XPI by filling it in to the install_url template, unzip it,
# run `jq .browser_specific_settings.gecko.id manifest.json` or
# `jq .applications.gecko.id manifest.json` to get the UUID
};
/*
---- PREFERENCES ----
*/
# Check about:config for options.
preferences = {
"browser.contentblocking.category" = true;
"extensions.pocket.enabled" = false;
"extensions.screenshots.disabled" = true;
"browser.topsites.contile.enabled" = false;
"browser.formfill.enable" = false;
"browser.search.suggest.enabled" = false;
"browser.search.suggest.enabled.private" = false;
"browser.urlbar.suggest.searches" = false;
"browser.urlbar.showSearchSuggestionsFirst" = false;
"browser.newtabpage.activity-stream.feeds.section.topstories" = false;
"browser.newtabpage.activity-stream.feeds.snippets" = false;
"browser.newtabpage.activity-stream.section.highlights.includePocket" = false;
"browser.newtabpage.activity-stream.section.highlights.includeBookmarks" = false;
"browser.newtabpage.activity-stream.section.highlights.includeDownloads" = false;
"browser.newtabpage.activity-stream.section.highlights.includeVisited" = false;
"browser.newtabpage.activity-stream.showSponsored" = false;
"browser.newtabpage.activity-stream.system.showSponsored" = false;
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
};
};
}

26
modules/fonts.nix Normal file
View file

@ -0,0 +1,26 @@
{
pkgs,
lib,
config,
...
}: {
fonts.packages = with pkgs; [
noto-fonts
noto-fonts-cjk-sans
noto-fonts-emoji
liberation_ttf
fira-code
fira-code-symbols
mplus-outline-fonts.githubRelease
dina-font
nerd-fonts.fira-code
nerd-fonts.ubuntu
proggyfonts
source-sans
source-sans-pro
source-serif-pro
font-awesome
font-awesome_5
roboto
];
}

35
modules/home.nix Normal file
View file

@ -0,0 +1,35 @@
{
config,
pkgs,
stateVersion
...
}: {
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = "osbm";
home.homeDirectory = "/home/osbm";
# Packages that should be installed to the user profile.
home.packages = [
];
programs.git = {
enable = true;
userEmail = "osmanfbayram@gmail.com";
userName = "osbm";
};
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = stateVersion;
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}

38
modules/i18n.nix Normal file
View file

@ -0,0 +1,38 @@
{
pkgs,
lib,
config,
...
}: {
time.timeZone = "Europe/Istanbul";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "tr_TR.UTF-8";
LC_IDENTIFICATION = "tr_TR.UTF-8";
LC_MEASUREMENT = "tr_TR.UTF-8";
LC_MONETARY = "tr_TR.UTF-8";
LC_NAME = "tr_TR.UTF-8";
LC_NUMERIC = "tr_TR.UTF-8";
LC_PAPER = "tr_TR.UTF-8";
LC_TELEPHONE = "tr_TR.UTF-8";
LC_TIME = "ja_JP.UTF-8";
};
services.xserver.xkb = {
layout = "us";
variant = "";
};
i18n.inputMethod = {
type = "fcitx5";
enable = true;
fcitx5.addons = with pkgs; [
fcitx5-mozc
fcitx5-gtk
fcitx5-nord # a color theme
];
};
}

25
modules/nix-settings.nix Normal file
View file

@ -0,0 +1,25 @@
{
pkgs,
lib,
config,
...
}: {
# Allow unfree packages
nixpkgs.config.allowUnfree = true; # TODO: replace this with allowUnfreePredicate
# enable nix flakes
nix.settings.experimental-features = ["nix-command" "flakes"];
nix.settings.trusted-users = ["root" "osbm"];
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
nix.nixPath = ["nixpkgs=${pkgs.path}"];
# disable the database error TODO add nix-index search
programs.command-not-found.enable = false;
}

5
modules/secrets.nix Normal file
View file

@ -0,0 +1,5 @@
{
age.secrets = {
network-manager.file = ../secrets/network-manager.age;
};
}