update nix config to allow remote sudo without password

This commit is contained in:
2025-09-07 09:31:52 +05:00
parent a54f6df462
commit 4dfcf1c5cf

View File

@@ -5,12 +5,11 @@
{ pkgs, meta, ... }: { pkgs, meta, ... }:
{ {
imports = imports = [ ./hardware-configuration.nix ];
[ # Include the results of the hardware scan.
];
nix = { nix = {
package = pkgs.nixFlakes; package = pkgs.nixFlakes;
settings.require-sigs = false;
extraOptions = '' extraOptions = ''
experimental-features = nix-command flakes experimental-features = nix-command flakes
''; '';
@@ -43,16 +42,11 @@
# Set your time zone. # Set your time zone.
time.timeZone = "Asia/Karachi"; time.timeZone = "Asia/Karachi";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties. # Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";
console = { console = {
font = "Lat2-Terminus16"; font = "Lat2-Terminus16";
keyMap = "us"; keyMap = "us";
#useXkbConfig = true; # use xkb.options in tty.
}; };
# Fixes for longhorn # Fixes for longhorn
@@ -61,12 +55,6 @@
]; ];
virtualisation.docker.logDriver = "json-file"; virtualisation.docker.logDriver = "json-file";
# Enable the X11 windowing system.
# services.xserver.enable = true;
# Configure keymap in X11
# services.xserver.xkb.layout = "us";
# services.xserver.xkb.options = "eurosign:e,caps:escape";
services.k3s = { services.k3s = {
enable = true; enable = true;
role = "server"; role = "server";
@@ -77,7 +65,6 @@
"--disable servicelb" "--disable servicelb"
"--disable traefik" "--disable traefik"
"--disable local-storage" "--disable local-storage"
"--tls-san homelab-0"
] ++ (if meta.hostname == "homelab-0" then [] else [ ] ++ (if meta.hostname == "homelab-0" then [] else [
"--server https://192.168.18.10:6443" "--server https://192.168.18.10:6443"
])); ]));
@@ -89,16 +76,6 @@
name = "iqn.2016-04.com.open-iscsi:${meta.hostname}"; name = "iqn.2016-04.com.open-iscsi:${meta.hostname}";
}; };
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# sound.enable = true;
# hardware.pulseaudio.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. # Define a user account. Don't forget to set a password with passwd.
users.users.shahab = { users.users.shahab = {
isNormalUser = true; isNormalUser = true;
@@ -114,6 +91,15 @@
]; ];
}; };
security.sudo.extraRules = [
{
users = ["shahab"];
commands = [
{ command = "ALL"; options = ["NOPASSWD"]; }
];
}
];
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@@ -124,14 +110,6 @@
git git
]; ];
# 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: # List services that you want to enable:
# Enable the OpenSSH daemon. # Enable the OpenSSH daemon.