🧹 Moved almost all files to /modules. Moved some code to separate files
This commit is contained in:
19
modules/default.nix
Normal file
19
modules/default.nix
Normal file
@ -0,0 +1,19 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./development.nix
|
||||
./fonts.nix
|
||||
./gnome
|
||||
./hardware
|
||||
./locale.nix
|
||||
./networking.nix
|
||||
./nix-helper.nix
|
||||
./hyprland
|
||||
./sddm.nix
|
||||
./security.nix
|
||||
./steam.nix
|
||||
./stylix.nix
|
||||
./terminal
|
||||
];
|
||||
}
|
27
modules/development.nix
Normal file
27
modules/development.nix
Normal file
@ -0,0 +1,27 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
# IDEs
|
||||
jetbrains.rust-rover
|
||||
jetbrains.webstorm
|
||||
vscodium # TODO set up extensions
|
||||
# Tools
|
||||
git
|
||||
rustup
|
||||
nodejs
|
||||
pnpm
|
||||
gcc # Required for C, Rust and others
|
||||
# Formatters
|
||||
nixd
|
||||
];
|
||||
|
||||
virtualisation.docker = {
|
||||
enable = true;
|
||||
storageDriver = "btrfs";
|
||||
rootless = {
|
||||
enable = true;
|
||||
setSocketVariable = true;
|
||||
};
|
||||
};
|
||||
}
|
14
modules/fonts.nix
Normal file
14
modules/fonts.nix
Normal file
@ -0,0 +1,14 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
|
||||
fonts = {
|
||||
fontconfig.enable = true;
|
||||
packages = with pkgs; [
|
||||
(nerdfonts.override { fonts = [ "JetBrainsMono" ]; })
|
||||
jetbrains-mono
|
||||
# The line below will replace the lines above in 25.05
|
||||
# nerd-fonts.jetbrains-mono
|
||||
];
|
||||
};
|
||||
|
||||
}
|
28
modules/gnome/default.nix
Normal file
28
modules/gnome/default.nix
Normal file
@ -0,0 +1,28 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./nautilus.nix
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
adw-gtk3
|
||||
glib
|
||||
adwaita-icon-theme
|
||||
gnomeExtensions.appindicator
|
||||
# gnome-extension-manager
|
||||
loupe
|
||||
gnome-calculator
|
||||
gnome-disk-utility
|
||||
];
|
||||
|
||||
programs = {
|
||||
dconf.enable = true; # Required for some gnome applications
|
||||
};
|
||||
|
||||
services = {
|
||||
gnome.gnome-keyring.enable = true;
|
||||
gvfs.enable = true; # Gnome Virtual File-system. Required for various things in nautilus
|
||||
udev.packages = with pkgs; [ gnome-settings-daemon ];
|
||||
};
|
||||
}
|
13
modules/gnome/nautilus.nix
Normal file
13
modules/gnome/nautilus.nix
Normal file
@ -0,0 +1,13 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
nautilus
|
||||
ffmpegthumbnailer
|
||||
];
|
||||
|
||||
programs.nautilus-open-any-terminal = {
|
||||
enable = true;
|
||||
terminal = "kitty";
|
||||
};
|
||||
}
|
37
modules/hardware/audio.nix
Normal file
37
modules/hardware/audio.nix
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
gst_all_1.gstreamer
|
||||
gst_all_1.gst-plugins-base
|
||||
gst_all_1.gst-plugins-good
|
||||
gst_all_1.gst-plugins-bad
|
||||
|
||||
wireplumber
|
||||
playerctl # Interaction with audioplayers and browsers
|
||||
pavucontrol # GUI
|
||||
spotify
|
||||
];
|
||||
|
||||
hardware.pulseaudio.enable = false; # Will be moved to services
|
||||
|
||||
security.rtkit.enable = true; # Enable RealtimeKit for audio purposes
|
||||
|
||||
services = {
|
||||
pipewire = {
|
||||
enable = true;
|
||||
alsa = {
|
||||
enable = true;
|
||||
support32Bit = true;
|
||||
};
|
||||
pulse.enable = true;
|
||||
# Uncomment the following line if you want to use JACK applications
|
||||
# jack.enable = true;
|
||||
};
|
||||
# pulseaudio.enable = false;
|
||||
};
|
||||
}
|
10
modules/hardware/default.nix
Normal file
10
modules/hardware/default.nix
Normal file
@ -0,0 +1,10 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./audio.nix
|
||||
./graphics
|
||||
./hardware-configuration.nix
|
||||
./keyboard.nix
|
||||
];
|
||||
}
|
19
modules/hardware/graphics/default.nix
Normal file
19
modules/hardware/graphics/default.nix
Normal file
@ -0,0 +1,19 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./nvidia.nix
|
||||
];
|
||||
|
||||
# For hardware acceleration
|
||||
environment.sessionVariables.LIBVA_DRIVER_NAME = "iHD";
|
||||
|
||||
# Enable OpenGL
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
extraPackages = with pkgs; [
|
||||
# Used for hardware-acceleration
|
||||
intel-media-driver # For Broadwell (2014) or newer processors. LIBVA_DRIVER_NAME=iHD
|
||||
];
|
||||
};
|
||||
}
|
15
modules/hardware/graphics/nvidia.nix
Normal file
15
modules/hardware/graphics/nvidia.nix
Normal file
@ -0,0 +1,15 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
hardware.nvidia = {
|
||||
# Required
|
||||
modesetting.enable = true;
|
||||
# Use closed-source drivers
|
||||
open = false;
|
||||
# Enable the Nvidia settings menu
|
||||
nvidiaSettings = true;
|
||||
};
|
||||
|
||||
# Load Nvidia driver for Xorg and Wayland
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
}
|
58
modules/hardware/hardware-configuration.nix
Normal file
58
modules/hardware/hardware-configuration.nix
Normal file
@ -0,0 +1,58 @@
|
||||
# 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 = [
|
||||
"xhci_pci"
|
||||
"ahci"
|
||||
"nvme"
|
||||
"usb_storage"
|
||||
"usbhid"
|
||||
"sd_mod"
|
||||
"sr_mod"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/5e3f0f97-4bb4-4a53-ace2-9ed19ff9e8ea";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=@" ];
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/D188-48A9";
|
||||
fsType = "vfat";
|
||||
options = [
|
||||
"fmask=0077"
|
||||
"dmask=0077"
|
||||
];
|
||||
};
|
||||
|
||||
swapDevices = [ ];
|
||||
|
||||
# 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.eno1.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp0s20f0u8.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.wlp6s0.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
11
modules/hardware/keyboard.nix
Normal file
11
modules/hardware/keyboard.nix
Normal file
@ -0,0 +1,11 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
via
|
||||
];
|
||||
|
||||
hardware.keyboard.qmk.enable = true;
|
||||
|
||||
services.udev.packages = with pkgs; [ via ];
|
||||
}
|
25
modules/hyprland/default.nix
Normal file
25
modules/hyprland/default.nix
Normal file
@ -0,0 +1,25 @@
|
||||
# System configurations for Hyprland. For home configs, see ./home/hyprland
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./waybar.nix
|
||||
./wallpaper.nix
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
xdg-desktop-portal-hyprland
|
||||
hyprpolkitagent # Auth deamon providing modals for password auth
|
||||
hyprshot # Screenshots
|
||||
];
|
||||
|
||||
programs = {
|
||||
hyprland = {
|
||||
enable = true;
|
||||
xwayland.enable = true;
|
||||
};
|
||||
hyprlock.enable = true; # Lock screen
|
||||
};
|
||||
|
||||
services.hypridle.enable = true; # Lock when unused
|
||||
}
|
8
modules/hyprland/wallpaper.nix
Normal file
8
modules/hyprland/wallpaper.nix
Normal file
@ -0,0 +1,8 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
swww
|
||||
waypaper
|
||||
];
|
||||
}
|
12
modules/hyprland/waybar.nix
Normal file
12
modules/hyprland/waybar.nix
Normal file
@ -0,0 +1,12 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
waybar
|
||||
font-awesome # Icons
|
||||
];
|
||||
|
||||
fonts.packages = with pkgs; [
|
||||
font-awesome
|
||||
];
|
||||
}
|
36
modules/locale.nix
Normal file
36
modules/locale.nix
Normal file
@ -0,0 +1,36 @@
|
||||
{ ... }:
|
||||
|
||||
# TODO move locale config for hyprland here
|
||||
{
|
||||
# Configure console keymap
|
||||
console.keyMap = "uk";
|
||||
|
||||
# Select internationalisation properties.
|
||||
i18n = {
|
||||
defaultLocale = "en_GB.UTF-8";
|
||||
supportedLocales = [
|
||||
"en_GB.UTF-8/UTF-8"
|
||||
"nb_NO.UTF-8/UTF-8"
|
||||
];
|
||||
extraLocaleSettings = {
|
||||
LC_ADDRESS = "nb_NO.UTF-8";
|
||||
LC_IDENTIFICATION = "nb_NO.UTF-8";
|
||||
LC_MEASUREMENT = "nb_NO.UTF-8";
|
||||
LC_MONETARY = "nb_NO.UTF-8";
|
||||
LC_NAME = "nb_NO.UTF-8";
|
||||
LC_NUMERIC = "nb_NO.UTF-8";
|
||||
LC_PAPER = "nb_NO.UTF-8";
|
||||
LC_TELEPHONE = "nb_NO.UTF-8";
|
||||
LC_TIME = "nb_NO.UTF-8";
|
||||
};
|
||||
};
|
||||
|
||||
# Configure keymaps
|
||||
services.xserver.xkb = {
|
||||
layout = "gb,no";
|
||||
options = "grp:alt_shift_toggle"; # Toggle using ALT + SHIFT
|
||||
};
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "Europe/Oslo";
|
||||
}
|
20
modules/networking.nix
Normal file
20
modules/networking.nix
Normal file
@ -0,0 +1,20 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
networking = {
|
||||
networkmanager.enable = true;
|
||||
hostName = "nixos";
|
||||
# wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
||||
};
|
||||
|
||||
# Configure network proxy if necessary
|
||||
# networking.proxy.default = "http://user:password@proxy:port/";
|
||||
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
||||
# Open ports in the firewall.
|
||||
# networking.firewall.allowedTCPPorts = [ ... ];
|
||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||
# Or disable the firewall altogether.
|
||||
# networking.firewall.enable = false;
|
||||
|
||||
services.tailscale.enable = true;
|
||||
}
|
9
modules/nix-helper.nix
Normal file
9
modules/nix-helper.nix
Normal file
@ -0,0 +1,9 @@
|
||||
# Nix-Helper: swgithub.com/viperML/nh
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
programs.nh = {
|
||||
enable = true;
|
||||
flake = ./.;
|
||||
};
|
||||
}
|
21
modules/sddm.nix
Normal file
21
modules/sddm.nix
Normal file
@ -0,0 +1,21 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
(catppuccin-sddm.override {
|
||||
flavor = "mocha";
|
||||
font = "Noto Sans";
|
||||
fontSize = "9";
|
||||
background = "${../catppuccin_high.png}";
|
||||
loginBackground = true;
|
||||
})
|
||||
];
|
||||
|
||||
services.displayManager.sddm = {
|
||||
enable = true;
|
||||
theme = "catppuccin-mocha";
|
||||
autoNumlock = true; # Enable numlock at login # TODO doesn't work
|
||||
wayland.enable = true;
|
||||
package = pkgs.kdePackages.sddm;
|
||||
};
|
||||
}
|
29
modules/security.nix
Normal file
29
modules/security.nix
Normal file
@ -0,0 +1,29 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
gnupg
|
||||
yubioath-flutter
|
||||
];
|
||||
|
||||
programs.gnupg.agent.enable = true;
|
||||
|
||||
security.pam = {
|
||||
services = {
|
||||
login.u2fAuth = false; # U2F and password
|
||||
sudo.u2fAuth = true; # U2F or password
|
||||
};
|
||||
u2f = {
|
||||
enable = true;
|
||||
settings = {
|
||||
cue = true; # Prompt: Please touch the device
|
||||
interactive = false; # Prompt: Insert your U2F device, then press ENTER.
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services = {
|
||||
pcscd.enable = true;
|
||||
udev.packages = with pkgs; [ yubikey-personalization ];
|
||||
};
|
||||
}
|
10
modules/steam.nix
Normal file
10
modules/steam.nix
Normal file
@ -0,0 +1,10 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
programs.steam = {
|
||||
enable = true;
|
||||
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
|
||||
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
|
||||
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
|
||||
};
|
||||
}
|
16
modules/stylix.nix
Normal file
16
modules/stylix.nix
Normal file
@ -0,0 +1,16 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
stylix = {
|
||||
enable = true;
|
||||
image = ../catppuccin.png;
|
||||
base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml";
|
||||
polarity = "dark";
|
||||
opacity.terminal = 0.8;
|
||||
override = {
|
||||
base02 = "b0b0b0"; # Comments in shell
|
||||
base03 = "b0b0b0"; # Comments in nvim
|
||||
base04 = "b0b0b0"; # Secondary text in shell
|
||||
};
|
||||
};
|
||||
}
|
11
modules/terminal/default.nix
Normal file
11
modules/terminal/default.nix
Normal file
@ -0,0 +1,11 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./shell.nix
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
kitty
|
||||
];
|
||||
}
|
28
modules/terminal/shell.nix
Normal file
28
modules/terminal/shell.nix
Normal file
@ -0,0 +1,28 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
programs = {
|
||||
bash = {
|
||||
# Starts the OS using Bash, then starts fish if it's not running
|
||||
interactiveShellInit = ''
|
||||
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]]
|
||||
then
|
||||
shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=""
|
||||
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
fish = {
|
||||
enable = true;
|
||||
# Start starship when creating a new shell
|
||||
interactiveShellInit = ''
|
||||
starship init fish | source
|
||||
'';
|
||||
shellAliases = {
|
||||
# Transfer shell config to target device
|
||||
ssh = "kitty +kitten ssh";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user