Restructured how the config is managed

This commit is contained in:
2025-05-05 22:05:32 +02:00
parent fa8f769068
commit 4ac3450ec5
7 changed files with 191 additions and 4 deletions

View File

@@ -1,5 +1,8 @@
HOSTNAME ?= $(hostname)
all:
echo "No command provided"
switch:
sudo nixos-rebuild switch --flake ".#${HOSTNAME}"

View File

@@ -32,9 +32,9 @@ let
# The config files for this system.
nixConfig = ../modules/nix-config/default.nix;
machineConfig = ../machines/${name}.nix;
OSConfig = ../modules/${if isDarwin then "darwin" else "nixos"}.nix;
HMConfig = ../modules/home-manager.nix;
systemPackages = ../modules/packages.nix;
# OSConfig = ../modules/${if isDarwin then "darwin" else "nixos"}.nix;
HMConfig = ../home;
# systemPackages = ../modules/packages.nix;
# TODO: make this cleaner
nix-homebrew = lib.optionalAttrs isDarwin inputs.nix-homebrew.darwinModules.nix-homebrew;
nix-homebrew-config = lib.optionalAttrs isDarwin {
@@ -85,7 +85,7 @@ systemFunc {
nix-homebrew
nix-homebrew-config
systemPackages
OSConfig
# OSConfig
# TODO: make user config & home-manager optional
home-manager.home-manager
{

View File

@@ -0,0 +1,43 @@
# 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 = [ "vmd" "xhci_pci" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/fcad34c3-e876-44ad-a1d0-a775c936efbf";
fsType = "ext4";
};
boot.initrd.luks.devices."luks-e7fe6c3f-b251-40bf-b053-493097907383".device = "/dev/disk/by-uuid/e7fe6c3f-b251-40bf-b053-493097907383";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/78EA-8347";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/6a9710ed-3f74-40f3-8e3e-e1afaf4cb118"; }
];
# 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.enp3s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@@ -1,4 +1,8 @@
{ ... }:
{
imports = [
./hardware/katana.nix
];
system.stateVersion = "24.05"; # Did you read the comment?
}

View File

@@ -0,0 +1,137 @@
{ pkgs, ... }:
{
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 1w";
};
# Remove old gtkrc file, otherwise it will not work
system.userActivationScripts = {
removeConflictingFiles = {
text = ''
rm -f /home/r3ddy/.gtkrc-2.0.backup
'';
};
};
networking.hostName = "nixos"; # Define your hostname.
networking.networkmanager.enable = true;
networking.firewall.allowedUDPPorts = [ 25565 ];
networking.firewall.allowedTCPPorts = [ 25565 ];
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;
time.timeZone = "Europe/Rome";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "it_IT.UTF-8";
LC_IDENTIFICATION = "it_IT.UTF-8";
LC_MEASUREMENT = "it_IT.UTF-8";
LC_MONETARY = "it_IT.UTF-8";
LC_NAME = "it_IT.UTF-8";
LC_NUMERIC = "it_IT.UTF-8";
LC_PAPER = "it_IT.UTF-8";
LC_TELEPHONE = "it_IT.UTF-8";
LC_TIME = "it_IT.UTF-8";
};
environment.sessionVariables = {
NIXOS_OZONE_WL = "1"; # Use Wayland when possible (this does not seem to work)
ELECTRON_OZONE_PLATFORM_HINT = "wayland";
GOPATH = "$HOME/.go";
};
# Enable sound with pipewire.
services.pulseaudio.enable = false;
security.rtkit.enable = true;
programs.fish.enable = true; # This must be true before initializing my user
users.users.r3ddy = {
isNormalUser = true;
description = "Patrick Canal";
extraGroups = [ "networkmanager" "wheel" "docker" ];
shell = pkgs.fish;
};
fonts.packages = with pkgs; [
nerd-fonts.jetbrains-mono
];
nixpkgs.config.allowUnfree = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
environment.systemPackages = with pkgs; [
# CLI utils
appimage-run
btop
busybox
distrobox
docker
fish
fzf
git
gnumake
htop
jq
killall
md2pdf
nmap
python3
ripgrep
tree
unzip
wget
wl-clipboard
xdotool
xorg.xwininfo
yad
zip
zoxide
zulu
# Man pages
man-pages
vim # The only and one great editor
# neovim # The only and one great editor improved even further
# Video card
vulkan-tools
# Gaming
dolphin-emu
heroic
mangohud
prismlauncher
steam
vesktop
# GUI applications
baobab
brave
kdePackages.xdg-desktop-portal-kde
kitty
libresprite
mpv
nextcloud-client
spotube
telegram-desktop
];
programs.steam.enable = true;
programs.steam.remotePlay.openFirewall = true;
virtualisation.podman.enable = true;
virtualisation.podman.dockerCompat = true;
programs.virt-manager.enable = true;
users.groups.libvirtd.members = ["r3ddy"];
virtualisation.libvirtd.enable = true;
virtualisation.spiceUSBRedirection.enable = true;
}