1

feat: initial config setup

This commit is contained in:
Himadri Bhattacharjee
2023-07-08 08:41:07 +05:30
parent 44788db495
commit c932ff9d5c
7 changed files with 456 additions and 0 deletions

300
configuration.nix Normal file
View File

@@ -0,0 +1,300 @@
# Read the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./home.nix
./hardware-configuration.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = false;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.grub = {
enable = true;
device = "nodev";
efiSupport = true;
};
# Setup keyfile
boot.initrd.secrets = {
"/crypto_keyfile.bin" = null;
};
networking.hostName = "cafe"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
networking.nameservers = [
"1.1.1.1"
"9.9.9.9"
];
# Set your time zone.
time.timeZone = "Asia/Kolkata";
powerManagement.powertop.enable = true;
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
services.xserver = {
# Enable the X11 windowing system.
enable = true;
# Enable the GNOME Desktop Environment.
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
# Configure keymap in X11
layout = "us";
xkbVariant = "";
# Enable automatic login for the user.
displayManager.autoLogin.enable = true;
displayManager.autoLogin.user = "h";
excludePackages = [ pkgs.xterm ];
desktopManager.xterm.enable = false;
};
services.flatpak.enable = true;
xdg.portal.enable = true;
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
programs.fish = {
enable = true;
shellAliases = {
ls = "exa -la";
cat = "bat -p";
};
};
users.users.h = {
isNormalUser = true;
description = "Himadri Bhattacharjee";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
aircrack-ng
bettercap
blackbox-terminal
dxvk
feroxbuster
fragments
gcc
gh
gimp
git
gnome.gnome-boxes
gnome-secrets
hashcat
jq
krita
librewolf
lutris
neofetch
nmap
patchelf
pkg-config
pwntools
python312
rustscan
rustup
signal-desktop
wifite2
wine
];
shell = pkgs.fish;
};
# documentation.nixos.enable = false;
# Enable experimental features for searching
nix = {
package = pkgs.nixFlakes;
extraOptions = pkgs.lib.optionalString (config.nix.package == pkgs.nixFlakes)
"experimental-features = nix-command flakes";
# Enable weekly garbage collection
# gc = {
# automatic = true;
# dates = "weekly";
# options = "--delete-older-than 7d";
# };
};
system.autoUpgrade.enable = true;
# Replace sudo with doas
security.sudo.enable = false;
security.doas.enable = true;
security.doas.extraRules = [{
groups = [ "wheel" ];
persist = false;
keepEnv = true;
}];
# Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229
systemd.services."getty@tty1".enable = false;
systemd.services."autovt@tty1".enable = false;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
environment.gnome.excludePackages = with pkgs; [
gnome-tour
gnome-text-editor
gnome.geary
gnome.yelp
epiphany
];
# Set the path for pkg-config to the openssl library
# so that we may compile projects that link to openssl.
# For example, a Rust project depending upon the openssl-sys crate.
environment.variables = rec {
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# Need virtualenv for waydroid-scripts
# this helps us enable libhoudini
adw-gtk3
bat
exa
gnomeExtensions.blur-my-shell
gnomeExtensions.caffeine
gnomeExtensions.rounded-window-corners
helix
mpv
ntfs3g
openssl
openssl.dev
ripgrep
virtualenv
wget
p7zip
pciutils
wl-clipboard
(writeScriptBin "sudo" ''exec doas "$@"'')
];
# Make sure opengl is enabled
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
# NVIDIA drivers are unfree.
nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (pkgs.lib.getName pkg) [
"nvidia-x11"
];
# Tell Xorg to use the nvidia driver
services.xserver.videoDrivers = ["nvidia"];
# Enable syncthing to sync books,
# captured photos and videos with my phone.
services.syncthing = {
enable = true;
user = "h";
dataDir = "/home/h/Sync";
configDir = "/home/h/.config/syncthing";
};
hardware.nvidia = {
# Modesetting is needed for most wayland compositors
modesetting.enable = true;
# Use the open source version of the kernel module
# Only available on driver 515.43.04+
open = true;
# Enable the nvidia settings menu
# nvidiaSettings = true;
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
# Enable waydroid to run android applications in a sandbox
virtualisation = {
waydroid.enable = true;
lxd.enable = true;
};
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
networking.firewall.enable = true;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment?
}

View File

@@ -0,0 +1,41 @@
# 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, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/df4f33a3-3d6c-4e08-af9f-df776984d5c5";
fsType = "btrfs";
options = [ "subvol=@" ];
};
boot.initrd.luks.devices."luks-5c48c31e-0eba-4ed5-bfad-cbb3e8ca8f5f".device = "/dev/disk/by-uuid/5c48c31e-0eba-4ed5-bfad-cbb3e8ca8f5f";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/6AD0-7578";
fsType = "vfat";
};
swapDevices = [ ];
# 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
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp2s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

21
home.nix Normal file
View File

@@ -0,0 +1,21 @@
{ config, pkgs, ... }:
{
imports = [
# nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz home-manager
# nix-channel --update
<home-manager/nixos>
];
home-manager.users.h = {
home.stateVersion = "23.05";
home.file = {
".config/helix/config.toml".source = ./sources/helix/config.toml;
".config/fish" = {
source = ./sources/fish;
recursive = true;
};
};
};
}

12
sources/fish/config.fish Executable file
View File

@@ -0,0 +1,12 @@
set fish_greeting
set --universal --export GOPATH "$HOME/Public/go"
set -U -x GOBIN "$GOPATH/bin"
# Run the following only once for it to take effect.
# fish_add_path --append --path --move $GOBIN
# alias --save l='exa -lah'
# alias --save cat='bat -p'
if status is-interactive
# Commands to run in interactive sessions can go here
end

45
sources/fish/fish_variables Executable file
View File

@@ -0,0 +1,45 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR --export GOBIN:/home/h/Public/go/bin
SETUVAR --export --path GOPATH:/home/h/Public/go
SETUVAR __fish_initialized:3400
SETUVAR fish_color_autosuggestion:707A8C
SETUVAR fish_color_cancel:\x2d\x2dreverse
SETUVAR fish_color_command:5CCFE6
SETUVAR fish_color_comment:5C6773
SETUVAR fish_color_cwd:73D0FF
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:F29E74
SETUVAR fish_color_error:FF3333
SETUVAR fish_color_escape:95E6CB
SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:normal
SETUVAR fish_color_host_remote:\x1d
SETUVAR fish_color_keyword:\x1d
SETUVAR fish_color_match:F28779
SETUVAR fish_color_normal:CBCCC6
SETUVAR fish_color_operator:FFCC66
SETUVAR fish_color_option:\x1d
SETUVAR fish_color_param:CBCCC6
SETUVAR fish_color_quote:BAE67E
SETUVAR fish_color_redirection:D4BFFF
SETUVAR fish_color_search_match:\x2d\x2dbackground\x3dFFCC66
SETUVAR fish_color_selection:\x2d\x2dbackground\x3dFFCC66
SETUVAR fish_color_status:red
SETUVAR fish_color_user:brgreen
SETUVAR fish_color_valid_path:\x2d\x2dunderline
SETUVAR fish_key_bindings:fish_default_key_bindings
SETUVAR fish_pager_color_background:\x1d
SETUVAR fish_pager_color_completion:normal
SETUVAR fish_pager_color_description:B3A06D
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
SETUVAR fish_pager_color_secondary_background:\x1d
SETUVAR fish_pager_color_secondary_completion:\x1d
SETUVAR fish_pager_color_secondary_description:\x1d
SETUVAR fish_pager_color_secondary_prefix:\x1d
SETUVAR fish_pager_color_selected_background:\x2d\x2dbackground\x3dFFCC66
SETUVAR fish_pager_color_selected_completion:\x1d
SETUVAR fish_pager_color_selected_description:\x1d
SETUVAR fish_pager_color_selected_prefix:\x1d
SETUVAR fish_user_paths:/home/h/\x2ecargo/bin\x1e/home/h/Public/go/bin\x1e/home/h/\x2elocal/bin

View File

@@ -0,0 +1,26 @@
function fish_prompt
if not set -q VIRTUAL_ENV_DISABLE_PROMPT
set -g VIRTUAL_ENV_DISABLE_PROMPT true
end
set_color yellow
printf '%s' $USER
set_color normal
printf ' at '
set_color magenta
echo -n (prompt_hostname)
set_color normal
printf ' in '
set_color $fish_color_cwd
printf '%s' (prompt_pwd)
set_color normal
# Line 2
echo
if test -n "$VIRTUAL_ENV"
printf "(%s) " (set_color blue)(basename $VIRTUAL_ENV)(set_color normal)
end
printf '↪ '
set_color normal
end

11
sources/helix/config.toml Normal file
View File

@@ -0,0 +1,11 @@
theme = "adwaita-dark"
[editor.lsp]
display-inlay-hints = true
[editor.cursor-shape]
insert = "bar"
[editor]
line-number = "relative"
idle-timeout = 0