Added NixOS configs

This commit is contained in:
2021-03-31 05:41:15 +05:30
commit 2680d535b5
21 changed files with 1902 additions and 0 deletions

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "Packages/scripts"]
path = Packages/scripts
url = https://github.com/idcretard/custom-scripts

30
Hardware/boot.nix Normal file
View File

@@ -0,0 +1,30 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot = {
initrd={
availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" ];
kernelModules = [ ];
};
kernelModules = [ "kvm-intel" ];
extraModulePackages = [ ];
loader = {
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
grub = {
enable = true;
useOSProber = true;
efiSupport = true;
device = "nodev";
splashImage = "/etc/cirno.png"; #hehe
splashMode = "stretch";
configurationName = "nixbruh";
};
};
kernelParams = [ "nvidia-drm.modeset=1" "intel_pstate=active"];
};
}

30
Hardware/graphicshit.nix Normal file
View File

@@ -0,0 +1,30 @@
{lib, config, pkgs, ... }:
let
nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
export __NV_PRIME_RENDER_OFFLOAD=1
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
exec -a "$0" "$@"
'';
in
{
environment.systemPackages = with pkgs; [
nvidia-offload
];
hardware = {
opengl = {
driSupport32Bit = true;
#package = pkgs.mesa_drivers;
enable = true;
};
nvidia = {
prime = {
offload = { enable = true; };
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
modesetting = { enable = true; };
};
};
}

7
Hardware/power.nix Normal file
View File

@@ -0,0 +1,7 @@
{ config, lib, pkgs, modulesPath, ... }:
{
powerManagement = {
cpuFreqGovernor = lib.mkDefault "powersave";
};
}

26
Hardware/xorg.nix Normal file
View File

@@ -0,0 +1,26 @@
{ config, lib, pkgs, modulesPath, ... }:
{
services = {
xserver = {
enable = true;
libinput= {
enable = true;
mouse = {
accelSpeed = "0";
};
touchpad = {
middleEmulation = false;
clickMethod = "buttonareas";
tapping = true;
naturalScrolling =true;
};
};
displayManager = {startx = {enable = true; }; };
videoDrivers = [ "nvidia" ];
layout = "us";
xkbVariant = "colemak";
};
};
}

1462
Packages/colemak-dh.map Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
{lib,stdenv,fetchFromGitHub}:
stdenv.mkDerivation rec{
name = "customscripts";
src = ./scripts;
unpackPhase = ":";
installPhase = ''
mkdir -p $out/bin
cp -r $src/* $out/bin
for x in $out/bin/*;do chmod +x "$x";done
'';
# src = fetchFromGitHub {
# owner = "idcretard";
# repo = "custom-scripts";
# rev = "86eaba74a01c8bafd8c81885eddbe9cd6f381e64";
# sha256 = "1g1z3mlp7h2ig1rmgabsbhcdnpgy65yki0dj3pr100jw202i6jqq";
# };
}

View File

@@ -0,0 +1,30 @@
/* See LICENSE file for copyright and license details. */
/* Default settings; can be overriden by command line. */
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
static int centered = 1; /* -c option; centers dmenu on screen */
static int min_width = 500; /* minimum width when centered */
/* -fn option overrides fonts[0]; default X11 font or font set */
static const char *fonts[] = {
"Consolas:pixelsize=15"
};
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
static const char *colors[SchemeLast][2] = {
/* fg bg */
[SchemeNorm] = { "#bbbbbb", "#1d2021" },
[SchemeSel] = { "#1d2021", "#ebdbb2" },
// [SchemeSelHighlight] = { "#000080", "#ebdbb2" },
// [SchemeNormHighlight] = { "#ffc978", "#1d2021" },
[SchemeOut] = { "#000000", "#00ffff" },
// Settings[SchemeOutHighlight] = { "#ffc978", "#00ffff" },
};
/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
static unsigned int lines = 0;
/*
* Characters not considered part of a word while deleting words
* for example: " /?\"&[]"
*/
static const char worddelimiters[] = " ";
/* Size of the window border */
static const unsigned int border_width = 4;

View File

@@ -0,0 +1,26 @@
{lib, stdenv, fetchFromGitHub, discord-rpc, cmake, libmpdclient}:
with lib;
stdenv.mkDerivation rec{
name = "mpd_discord_richpresence";
src = fetchFromGitHub {
owner = "justas-d";
repo = "mpd-rich-presence-discord";
rev = "ced628d3eaf3f18c5eff286b0955c605616348ee";
sha256 = "0vl31sdgxalbnc4d4fggzqs2vsssibn53pjm6wj596cfkfpdf4y3";
};
buildInputs = [
libmpdclient
cmake
discord-rpc
];
configurePhase = ''
cmake .
'';
buildPhase = ''
make
'';
installPhase = ''
mkdir -p $out/bin
cp mpd_discord_richpresence $out/bin/
'';
}

37
Packages/override.nix Normal file
View File

@@ -0,0 +1,37 @@
{lib, config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
(callPackage ./customscripts.nix {})
(callPackage ./mpd_discord_richpresence.nix {})
(dwm.overrideAttrs (oldAttrs: rec {
src = fetchFromGitHub {
owner = "idcretard";
repo = "dwm";
rev = "363951cb05142f4c423af561a05658e74be7c768";
sha256 ="003sl6w5dkycw8wcymvhi843xjngsys6qsl3fc5b9vpyd1l7i0sr";
};
}))
(st.overrideAttrs (oldAttrs: rec {
src = fetchFromGitHub {
owner = "idcretard";
repo = "st";
rev = "0cd1e394e6d07c5f605ae23070c40de9690bafb1";
sha256 = "0riqg63aghx71v3rrpic3mxhcxqhry20312bicwbf3ks7ndl13hi";
};
}))
(dmenu.overrideAttrs (oldAttrs: rec {
configFile = writeText "config.def.h" (builtins.readFile ./dmenu/config.def.h);
postPatch = "${oldAttrs.postPatch}\n cp ${configFile} config.def.h";
}))
(kbd.overrideAttrs (oldAttrs: rec{
buildInputs = oldAttrs.buildInputs ++ [ gzip ];
colemak-dh = writeText "colemak-dh.map" (builtins.readFile ./colemak-dh.map);
postInstall = "${oldAttrs.postInstall}\n cp ${colemak-dh} $out/share/keymaps/i386/colemak/colemak-dh.map\n gzip $out/share/keymaps/i386/colemak/colemak-dh.map";
}))
(ncmpcpp.overrideAttrs (_ :{
visualizerSupport = true;
clockSupport = true;
}))
];
}

1
Packages/scripts Submodule

Submodule Packages/scripts added at 51197513c5

6
README.md Normal file
View File

@@ -0,0 +1,6 @@
# Personal Dotfiles
## TODO
1. Add user specific traditional dotfiles.
2. Try home-manager for nix
3. Try nix flakes

10
Stuff/fonts.nix Normal file
View File

@@ -0,0 +1,10 @@
{lib, config, pkgs, ... }:
{
fonts.fonts = with pkgs; [
fira-mono
font-awesome-ttf
powerline-fonts
vistafonts
];
}

22
Stuff/services.nix Normal file
View File

@@ -0,0 +1,22 @@
{lib, config, pkgs, ... }:
{
systemd.services.nbfc = {
wantedBy = [ "multi-user.target" ];
description = "Notebook Fancontrol";
serviceConfig = {
Type = "forking";
Restart = "on-failure";
ExecStart = "${pkgs.mono}/bin/mono-service -l:/run/nbfc.pid -m:NbfcService /opt/nbfc/NbfcService.exe";
ExecStop = "kill -SIGTERM $(cat /run/nbfc.pid)";
PIDFile = "/run/nbfc.pid";
};
};
services.picom = {
enable = true;
fade = true;
shadow = true;
activeOpacity = 0.96;
inactiveOpacity = 0.86;
};
}

28
Stuff/sound.nix Normal file
View File

@@ -0,0 +1,28 @@
{lib, config, pkgs, ... }:
{
#services.pipewire = {
# enable = true;
# pulse.enable = true;
# config.pipewire = {
# context.properties = {
# default.clock.min-quantum = 8;
# };
#};
# config.pipewire-pulse = {
# context.modules = {
# pulse.min.req = "4/48000"; # 0.08ms
# pulse.min.quantum = "4/48000"; # 0.08ms
#};
#stream.properties = {
# node.latency = "4/48000";
# };
#};
#};
sound.enable = true;
hardware = {
pulseaudio.enable = true;
pulseaudio.support32Bit = true;
};
}

10
Stuff/users.nix Normal file
View File

@@ -0,0 +1,10 @@
{lib, config, pkgs, ... }:
{
users.users.otaku619 = {
isNormalUser = true;
shell = pkgs.fish;
home = "/home/otaku619";
extraGroups = [ "wheel" "video" "audio" ];
};
}

12
configuration.nix Normal file
View File

@@ -0,0 +1,12 @@
{lib, config, pkgs, ... }:
{
imports =
[
./hardware.nix
./stuff.nix
./pkgs.nix
./networking.nix
];
system.stateVersion = "20.09";
}

50
hardware.nix Normal file
View File

@@ -0,0 +1,50 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
./Hardware/boot.nix
./Hardware/power.nix
./Hardware/xorg.nix
./Hardware/graphicshit.nix
];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/4c02ddf5-d00e-4d84-856f-c327ae44d047";
fsType = "btrfs";
};
fileSystems."/boot/efi" =
{ device = "/dev/disk/by-uuid/58B1-4631";
fsType = "vfat";
};
fileSystems."/home" =
{ device = "/dev/nvme0n1p6";
fsType = "ext4";
};
fileSystems."/mnt/Stuff" =
{ device = "/dev/sda2";
fsType = "ntfs";
options = ["uid=otaku619" "gid=users" "umask=0022" "rw"];
};
fileSystems."/mnt/Games" =
{ device = "/dev/sda4";
fsType = "ntfs";
options = ["uid=otaku619" "gid=users" "umask=0022" "rw"];
};
fileSystems."/mnt/Extra" =
{ device = "/dev/sda3";
fsType = "ntfs";
options = ["uid=otaku619" "gid=users" "umask=0022" "rw"];
};
fileSystems."/mnt/LinuxGames" =
{ device = "/dev/sda5";
fsType = "btrfs";
options = ["rw"];
};
swapDevices = [ {device = "/dev/nvme0n1p7";} ];
}

13
networking.nix Normal file
View File

@@ -0,0 +1,13 @@
{lib, config, pkgs, ... }:
{
networking = {
hostName = "nixchod";
wireless.enable = true; # Enables wireless support via wpa_supplicant.
useDHCP = false;
interfaces = {
enp7s0.useDHCP = true;
wlp0s20f3.useDHCP = true;
};
};
}

47
pkgs.nix Normal file
View File

@@ -0,0 +1,47 @@
{lib, config, pkgs, ... }:
{
imports = [
./Packages/override.nix
];
environment.systemPackages = with pkgs; [
xclip
dunst
glibc
proxychains
#qt5.qmake
xorg.xmodmap
ffmpeg
p7zip
git
glxinfo
sox
libmpdclient
lxappearance
jq
mono
vim
mpd
wineWowPackages.stable
neofetch
tor-browser-bundle-bin
w3m
gnumake
pciutils
jdk
gcc
ntfs3g
python38
luajit
neovim
htop
nodejs
wget
ripgrep
patchelf
doas
feh
sxiv
mpv
];
}

35
stuff.nix Normal file
View File

@@ -0,0 +1,35 @@
{lib, config, pkgs, ... }:
{
imports = [
./Stuff/sound.nix
./Stuff/fonts.nix
./Stuff/users.nix
./Stuff/services.nix
];
time.timeZone = "Asia/Kolkata";
environment = {
sessionVariables = {
QT_QPA_PLATFORMTHEME = "gtk3";
QT_X11_NO_MITSHM="1";
};
};
security={
sudo.enable = false;
doas = {
enable = true;
extraRules = [
{
users = [ "otaku619" ];
keepEnv = true;
persist = true;
}
];
};
};
nix.gc = {
automatic = true;
dates = "20:15";
};
nixpkgs.config.allowUnfree = true;
programs.fish.enable = true;
}