Skip to content

Commit

Permalink
fix: enable sudo password - proxmox
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan4yin committed Mar 7, 2024
1 parent 13c71b8 commit c5c8fbf
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 29 deletions.
15 changes: 10 additions & 5 deletions hosts/12kingdoms_rakushun/hardware-configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@
(modulesPath + "/installer/scan/not-detected.nix")
];

# Use the EFI boot loader.
boot.loader.efi.canTouchEfiVariables = true;
# depending on how you configured your disk mounts, change this to /boot or /boot/efi.
boot.loader.efi.efiSysMountPoint = "/boot";
boot.loader.systemd-boot.enable = true;
boot.loader = {
# depending on how you configured your disk mounts, change this to /boot or /boot/efi.
efi.efiSysMountPoint = "/boot/";
efi.canTouchEfiVariables = true;
# do not use systemd-boot here, it has problems when running `nixos-install`
grub = {
device = "nodev";
efiSupport = true;
};
};
# clear /tmp on boot to get a stateless /tmp directory.
boot.tmp.cleanOnBoot = true;

Expand Down
1 change: 1 addition & 0 deletions hosts/12kingdoms_suzu/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ in {
nixos-rk3588.nixosModules.orangepi5plus.core
disko.nixosModules.default
./disko-fs.nix
./hardware-configuration.nix
];

networking = {
Expand Down
6 changes: 3 additions & 3 deletions hosts/12kingdoms_suzu/disko-fs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot/efi";
mountpoint = "/boot";
mountOptions = [
"defaults"
];
Expand All @@ -28,7 +28,7 @@
type = "luks";
name = "crypted";
settings = {
keyFile = "/dev/disk/by-label/OPI5P_DSC"; # The keyfile is stored on a USB stick
keyFile = "/dev/disk/by-label/OPI5_DSC"; # The keyfile is stored on a USB stick
# The maxium size of the keyfile is 8192 bytes
keyFileSize = 512 * 64; # match the `bs * count` of the `dd` command
keyFileOffset = 512 * 128; # match the `bs * skip` of the `dd` command
Expand Down Expand Up @@ -84,7 +84,7 @@
};
"@swap" = {
mountpoint = "/swap";
swap.swapfile.size = "16384M";
swap.swapfile.size = "8192M";
};
};
};
Expand Down
39 changes: 39 additions & 0 deletions hosts/12kingdoms_suzu/hardware-configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];

boot.loader = {
# depending on how you configured your disk mounts, change this to /boot or /boot/efi.
efi.efiSysMountPoint = "/boot/";
efi.canTouchEfiVariables = true;
# do not use systemd-boot here, it has problems when running `nixos-install`
grub = {
device = "nodev";
efiSupport = true;
};
};
# clear /tmp on boot to get a stateless /tmp directory.
boot.tmp.cleanOnBoot = true;

boot.initrd.availableKernelModules = ["nvme" "usbhid" "usb_storage"];
boot.initrd.kernelModules = [];
boot.kernelModules = [];
boot.extraModulePackages = [];

# 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.enP3p49s0.useDHCP = lib.mkDefault true;
# networking.interfaces.enP4p65s0.useDHCP = lib.mkDefault true;

nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
}
22 changes: 1 addition & 21 deletions modules/nixos/server/proxmox-hardware-configuration.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
config,
lib,
username,
...
}:
{lib, ...}:
##############################################################################
#
# Template for Proxmox's VM, mainly based on:
Expand All @@ -13,21 +8,6 @@
#
##############################################################################
{
# DO NOT promote ryan to input password for sudo.
# this is a workaround for the issue of remote deploy:
# https://github.com/NixOS/nixpkgs/issues/118655
security.sudo.extraRules = [
{
users = [username];
commands = [
{
command = "ALL";
options = ["NOPASSWD"];
}
];
}
];

boot = {
# after resize the disk, it will grow partition automatically.
growPartition = true;
Expand Down

0 comments on commit c5c8fbf

Please sign in to comment.