My NixOS configuration and dotfiles
1{
2 config,
3 lib,
4 ...
5}:
6{
7 options.hostOptions = {
8 hostName = lib.mkOption {
9 type = lib.types.str;
10 };
11 };
12
13 config = {
14 nixpkgs.config.allowUnfree = true;
15
16 console.useXkbConfig = true;
17
18 boot.loader = {
19 systemd-boot.enable = true;
20 efi.canTouchEfiVariables = true;
21 };
22
23 boot.initrd.systemd.enable = true;
24
25 networking = {
26 networkmanager.enable = true;
27 hostName = config.hostOptions.hostName;
28 #firewall = {
29 # enable = true;
30 # allowedTCPPorts = [ 9000 ];
31 # allowedUDPPorts = [ 9000 ];
32 #};
33 };
34
35 services.blueman.enable = true;
36 hardware.bluetooth.enable = true;
37
38 # for better battery life keep it at 80%
39 systemd.services.battery-threshold-control = {
40 script = ''
41 echo "80" > /sys/class/power_supply/BAT0/charge_control_end_threshold
42 '';
43 wantedBy = [ "multi-user.target" ];
44 };
45
46 services.auto-cpufreq = {
47 enable = true;
48 settings = {
49 battery = {
50 governor = "powersave";
51 turbo = "never";
52 };
53 charger = {
54 governor = "powersave";
55 turbo = "auto";
56 };
57 };
58 };
59
60 time.timeZone = "Asia/Kolkata";
61 i18n.defaultLocale = "en_US.UTF-8";
62
63 nix.settings = {
64 trusted-users = [
65 "duskyelf"
66 ];
67
68 substituters = [
69 "https://cache.nixos.org"
70 "https://cuda-maintainers.cachix.org"
71 ];
72
73 trusted-public-keys = [
74 "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
75 ];
76
77 experimental-features = [
78 "nix-command"
79 "flakes"
80 ];
81 };
82
83 i18n.extraLocaleSettings = {
84 LC_ADDRESS = "en_IN";
85 LC_IDENTIFICATION = "en_IN";
86 LC_MEASUREMENT = "en_IN";
87 LC_MONETARY = "en_IN";
88 LC_NAME = "en_IN";
89 LC_NUMERIC = "en_IN";
90 LC_PAPER = "en_IN";
91 LC_TELEPHONE = "en_IN";
92 LC_TIME = "en_IN";
93 };
94
95 security.sudo.extraRules = [
96 {
97 users = [ "duskyelf" ];
98 commands = [
99 {
100 command = "/home/duskyelf/.config/scripts/power.sh";
101 options = [ "NOPASSWD" ];
102 }
103 ];
104 }
105 ];
106
107 system.stateVersion = "25.11"; # Leave it as it is
108 };
109}