feat: NixOS | add disko and hashed password for user

This commit is contained in:
2025-01-31 16:49:54 +05:00
parent 6b844a28da
commit e885306bf0
4 changed files with 83 additions and 28 deletions

View File

@@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ inputs, config, pkgs, ... }:
{ inputs, hostname, pkgs, ... }:
{
imports =
@@ -18,7 +18,7 @@
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;
networking.hostName = "rihla"; # Define your hostname.
networking.hostName = hostname; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
@@ -136,6 +136,7 @@
isNormalUser = true;
description = "Shahab Dogar";
extraGroups = [ "networkmanager" "wheel" "input" "libvirtd" ];
hashedPassword = "$6$.ZlYnf2cZph4tCbM$E/JJUDirRV8MZrgX4Rh.Pi1q95tev1ZxcKjPA1I.uURv56qoWcC39MJWO9S2T5MlkPVbSLGiM8Ihfz9mERImo/";
};
# Allow unfree packages

61
nixos/disko-config.nix Normal file
View File

@@ -0,0 +1,61 @@
{
disko.devices = {
disk = {
vdb = {
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
ESP = {
priority = 1;
name = "ESP";
start = "1M";
end = "128M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
luks = {
size = "100%";
content = {
name = "crypted";
type = "luks";
askPassword = true;
content = {
type = "btrfs";
extraArgs = ["-L" "nixos" "-f"];
subvolumes = {
"/root" = {
mountpoint = "/";
mountOptions = ["subvol=root" "compress=zstd" "noatime"];
};
"/home" = {
mountpoint = "/home";
mountOptions = ["subvol=home" "compress=zstd" "noatime"];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = ["subvol=nix" "compress=zstd" "noatime"];
};
"/log" = {
mountpoint = "/var/log";
mountOptions = ["subvol=log" "compress=zstd" "noatime"];
};
"/swap" = {
mountpoint = "/swap";
swap.swapfile.size = "64G";
};
};
};
};
};
};
};
};
};
};
}

View File

@@ -1,37 +1,16 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ config, lib, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/76272a47-955b-4bda-82ec-50418f8210f9";
fsType = "ext4";
};
boot.initrd.luks.devices = {
"luks-d35c44b6-3e25-4e0a-a439-95a786f17cd8".device = "/dev/disk/by-uuid/d35c44b6-3e25-4e0a-a439-95a786f17cd8";
"luks-15c96eaf-c225-4a27-873e-94ed67b04037".device = "/dev/disk/by-uuid/15c96eaf-c225-4a27-873e-94ed67b04037";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/4B7B-782A";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/5b377538-3a2e-4ac9-ba53-a63b65b0f48b"; } ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction