Sudo Blog – Telegram
65 subscribers
61 photos
2 videos
32 files
123 links
Linuxdagi hayotim
Download Telegram
Operatsion tizim shunaqa narsaki qariganing sayin uning stabilligiga o'rganib qolasan. Masalan menga har qanday linux based distro bilan ishlash umuman muammo emas. Arch, fedora, gentoo...

Muammo shundaki sen unga kun tartibingdagi asosiy vaqtingni sarflab qo'ymasliging lozim.

Chiroyli themelar, turlicha desktop enviromentlarni yoshlik, o'rganish davrida sinash bu ok, ammo sening asosiy ishing kutadigan vaziyat bo'lsa luchshe bunga ovora bo'lib vaqt sarflamagan maqul.

Aslida linuxning hammasi bir go'r, odatda ularni bir biridan build system va paket menejerlari farqlantiradi. Ammo asosiy nuqta ham shunda.

Masalan fedora ishlatayotganimda men uchun eng noqulay bo'lgan vaziyat bu x264 codec, telegram binary update bo'lishi, klaviatura va mishka uchun custom eventlar ulashimda /dev/input nostabilligi, window protocol va remi paketlar kabi holatlar. Archda minimallik yoqadi ammo 3 kun otpusk olib os tayyorlar bu uje banalno.

Debian based distrolarda esa odatda juda ko'p narsalarni tezkor va muammosiz topishing mumkin (build in tayyor ham) Bu ishni tezroq amalga oshirishga yordam beradi.

Gnu/Linuxni bu istalgancha sozlash mumkin bo'lgan operatsion tizim. Ammo yosh o'tgan sari bunga umr qisqalik qilishini tushunib yetasan. Yoki juda sozlash yoqsa, eksperimentlarga qiziqsang bunaqa ish uchun BSD aslida yaxshiroq variant ekanini tushunib yetasan (uyer bu borada haqiqiy jinnixona). Ammo ikkala holatdayam qachondir zerikasan va sen uchun birinchi install qilganda tezroq va to'laqonli run bo'la oladigan narsaga yopishishni boshlaysan.

Masalan fedora uchun x264 paketni qaytadan moslash, yetmay qolgan biror driverni yozish men uchun qiyin emas. Shunchaki bu endi menga kayf bermaydi. Undan boshqa tuzukroq muammoga yopishish ancha foydali (masalan yaqinda dsi protokoldagi ekran uchun 0dan kernel driver yozishga to'g'ri kelgandi)

Serverlar masalasidayam xuddi shunday. Sen arch linuxga butun boshli phpni qaytadan build qilayotgan vaqtinga debianda Sury degan aka phpni hamma modulini chiroyli qilib yig'ib qo'ygan.

Yosh va imkon bo'lsa eksperimentlar qiling, katta bo'lib muammo ortsa bu energiyani yaxshisi boshqa joyga sarflang.

@yetimdasturchi
sening sen uchun serverni boshqarishga qulay qilib sozlab beraman degan sysadmin do'sting:

@vodiylik aka 🧑‍💻
Oramizda nix o'rganayotgan yoki habari bor volontyorlar bo'lsa o'qib feedback berib ketamiz. Yaxshi bulardi undanam fix ni PR qivorsaular xinux-org/website repo ga:
https://xinux.uz/learn
Forwarded from shakhzod's lab (Schachsod)
notes about nix and nixos (nixos.org)

i want to make it clearer. nix is a package manager. just like apt, pacman, brew and etc. its job is to make sure that when you request nodejs 22 lts, it gets you that. in most package managers its done by fetching compiled binary for your system and architecture. well, nix does the same, but it can also build it from sources or fetch from the official website, unpack it, and copy to the suitable locations, so it feels like you installed it with installation wizard. it achieves this result by writing something like dockerfile or aur pkgbuild config, but in a nix language.

short summary: nix is a package manager, and a language. i mean there is a package manager called nix, and its packages are build noscripts written in a nix language.

the largest nix packages repository is, well, nixpkgs. located in github.com/nixos/nixpkgs. to search from there you have a search.nixos.org website. it contains the very same build noscripts i mentioned above. there is also hydra (hydra.nixos.org) build system which monitors nixpkgs and builds them, so we have a ready-to-fetch pre built binaries, so you don't have to build them and spend an hour or more.

nixos on the other side is a linux distribution which includes nix package manager and some nice features like nixos modules and generations. that's said, you don't need to manually set up your system or use tools like ansible. the downside of this is you cannot use installation bash noscripts like rustup or nvm. practically you can do that, but nixos not meant for that. instead you have nixos modules, which helps you use higher level abstractions, set the domain, login, password and ports.

as a good analogy you can think of a nix project (a package, a module, a development environment) as a regular programming language project: npm or cargo. instead of writing an http server, you describe what should be installed and how it should be configured. you can set dependencies, for example the nixpkgs or some fancy helper library in your github repo, and use it. the output of your nix project would be just files and directories with ready to copy-and-paste into root of your file system (the sudo rm --rf / one)

in conclusion think about docker, but without any overhead. it is your system and you can write your systems all configurations (or dotfiles) in one place. everything you can do in ubuntu or arch linux can also be done in nixos, but a bit different.

nix as a package manager is available outside of linux, for example macos. i was using nix in macos (project is called nix-darwin, darwin is not about charles darwin the evolution theory one, just macos architecture is called darwin) and liked it. it means you can apply the nix paradigm in other os, or maybe not constrained with os only.

you can start your nix/nixos journey on xinux.uz

wish you luck!
Forwarded from ㅤㅤㅤㅤㅤ
Livestream NixOS #2 | Improving Flake configuration.mp4
378.4 MB
Orzklv ning NixOS streamlari #1 va #2
(Orzklv ning o'chib ketgan YouTube kanalidan arxiv)
Nix os o'rnatib flakeni o'rganishni boshlaganimdan so'ng manabu muammoga duch keldim, xullas linux ishga tushib parol kiritganimdan so'ng birdan ushbu oyna chiqib 2minut shu holatda qotib keyin ishga tushayotgan edi, biroz gpt qilgan edim ushbu yechimni berdi. Senda dual video karta qaysi birini avtomatik boshlashni bilmaydi. Uni o'zing qo'lda sozla dedi avval video karta bus id sini aniqlash kerakligini aytdi.

video karta bus id'sini aniqlash

 nix --extra-experimental-features "nix-command flakes" shell nixpkgs#pciutils --command lspci | grep -E 'VGA|3D'


so'nga /etc/configuration.nix faylga ushbu qismni qo'shish kerak

hardware.opengl.enable = true;

services.xserver.videoDrivers = [ "nvidia" ];

hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = true;
powerManagement.finegrained = false;
open = false; # GTX 1650 Mobile uchun to‘g‘ri
nvidiaSettings = true;

prime = {
offload.enable = true;

intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:2:0:0";
};
};
Linuxda SSH Key orqali GitHub-ga bog‘lanish

1️⃣ SSH kalitni tekshirish

ls -l ~/.ssh



2️⃣ Yangi SSH kalit yaratish

Kalit yaratish uchun:
ssh-keygen -t ed25519 -C "youremail@example.com"


Standart joyda (~/.ssh/id_ed25519) saqlang.

Parol qo‘yish mumkin yoki bo‘sh qoldirish mumkin.

3️⃣ SSH agentni ishga tushirish va kalitni qo‘shish
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
# yoki agar o'z nom bilan bo'lsa
ssh-add ~/.ssh/my_ssh_key


Kalit muvaffaqiyatli qo‘shilgandan keyin ssh-add -l bilan ro‘yxatini tekshirishingiz mumkin.

4️⃣ GitHub-ga public key-ni qo‘shish

Public key-ni ko‘rsatish:
cat ~/.ssh/id_ed25519.pub
# yoki
cat ~/.ssh/my_ssh_key.pub


Chiqqan matnni GitHub → Settings → SSH and GPG keys → New SSH key → joylashtiring.
ssh -T git@github.com

Muvaffaqiyatli bo‘lsa quyidagi xabar chiqadi:
Hi username! You've successfully authenticated, but GitHub does not provide shell access.


#ssh #github
Forwarded from Shaxzod Qudratov
Official ma'lumotlar:

NixOS Manual: https://nixos.org/manual/nixos/stable/

Nixpkgs Manual: https://nixos.org/manual/nixpkgs/stable/

Nix dasturlash tili Manual: https://nix.dev/tutorials/first-steps/

Nixpkgs Search: search.nixos.org

Unofficial:

NixOS Wiki: nixos.wiki
Bunaqangi sodda tushuntirishlarni har doim topish qiyin.

#nixos
Forwarded from Shaxzod Qudratov
Home Manager bu nima?

Ko'pchilik .dotfiles deb avvalasi turli-xil configlarni yig'ib yurishar edi. Uning ichida vim, alacritty, kitty, kde, ... larning turi fayl formatlarda (.toml, .yaml, .json, .cfg, .ini, ...) yozib va har yangi tizim o'rnatganda shu fayllarni ko'chirib yurishar edi.

Xullas, Home Manager huddi shu muammoni Nix dasturlash tili va Nix package manager bilan yechishga yordam beradi.

Home Manager va NixOS Modules/Nix Darwin Modules orasida nima farq?

NixOS Modules va Nix Darwin Modules asosan operatsion tizimni sozlashga moslashgan bo'lib, u aniq bir tizim foydalanuvchisiga (system user) bog'lanmay global ish tutadi. Home Manager esa doim aniq bir foydalanuvchiga bog'langan bo'ladi, va uning sozlamalari boshqa foydalanuvchilarga ta'sir qilmaydi (agar ta'sir qiladigan config yozmasangiz albatta).

GitHub: https://github.com/nix-community/home-manager/
Manual: https://nix-community.github.io/home-manager/
Search: https://home-manager-options.extranix.com/
Savol: Xinuxni 0dan yozib chiqganmisizlar yoki kerneldi ustiga qurilganmi ?

Javob: Xinux ustida quyidagi qatlamlar mavjud:

1. Linux
2. NixOs
3. GNOME DE
4. nix tilida yozilgan sozlamalar. O'zimiz qo'shgan yoki olib tashalagan dasturlar, orqa fon va boshqa.

Xinux shu 4-qadamdan boshlanadi. Qolgan tepadagi loyihalarni shunchaki olib qo'shib qo'yamiz.

Barcha sozlamar shu modules degan repoda turadi. Bularni tushunish uchun nix paket manageri yoki NixOS ishlatish talab etiladi.

Post egasi: asl post manbasi
cooking