Split everything up

This commit is contained in:
ItsDrike 2024-02-24 22:24:22 +01:00
parent cb2e2f3906
commit ebe0e83f92
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
9 changed files with 99 additions and 104 deletions

View file

@ -1,103 +0,0 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "nixos"; # Define your hostname.
# networking.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";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/Bratislava";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "sk_SK.UTF-8";
LC_IDENTIFICATION = "sk_SK.UTF-8";
LC_MEASUREMENT = "sk_SK.UTF-8";
LC_MONETARY = "sk_SK.UTF-8";
LC_NAME = "sk_SK.UTF-8";
LC_NUMERIC = "sk_SK.UTF-8";
LC_PAPER = "sk_SK.UTF-8";
LC_TELEPHONE = "sk_SK.UTF-8";
LC_TIME = "sk_SK.UTF-8";
};
# Configure keymap in X11
services.xserver = {
layout = "us";
xkbVariant = "";
};
# Define a user account. Don't forget to set a password with passwd.
users.users.itsdrike = {
isNormalUser = true;
description = "ItsDrike";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
vim
git
gnupg
delta
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
];
# 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:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
nix.package = pkgs.nixUnstable;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
}

View file

@ -17,7 +17,7 @@
flake = {
nixosConfigurations = {
nixos = nixpkgs.lib.nixosSystem {
modules = [ ./configuration.nix ];
modules = [ ./system ./hosts/vbox_nix ];
};
};
};

View file

@ -0,0 +1,17 @@
{lib, ...}:
{
imports = [ ./hardware-configuration.nix ];
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
timeout = 3;
};
networking.hostName = "nixos";
# NixOS release from which this machine was first installed.
# (for stateful data, like file locations and db versions)
# Leave this alone!
system.stateVersion = lib.mkForce "23.11";
}

13
system/default.nix Normal file
View file

@ -0,0 +1,13 @@
{lib, ...}:
{
imports = [
./network.nix
./users.nix
./nix.nix
./packages.nix
];
# Internationalisation properties
time.timeZone = "CET";
i18n.defaultLocale = "en_US.UTF-8";
}

16
system/network.nix Normal file
View file

@ -0,0 +1,16 @@
{lib, ...}:
{
networking = {
firewall.enable = false;
networkmanager = {
enable = true;
dns = "systemd-resolved";
};
};
services.resolved.enable = true;
# Don't wait for network manager startup
systemd.services.NetworkManager-wait-online.enable = lib.mkForce false;
}

35
system/nix.nix Normal file
View file

@ -0,0 +1,35 @@
{pkgs, ...}:
{
nix = {
settings = {
# nix often takes up a lot of space, with /nix/store growing beyond reasonable sizes
# this turns on automatic optimisation of the nix store that will run during every build
# (alternatively, you can do this manually with `nix-store --optimise`)
auto-optimise-store = true;
# enable flakes support
experimental-features = [ "nix-command" "flakes" ];
};
# Enable automatic garbage collection, deleting entries older than 14 days
# you can also run this manually with `nix-store --gc --delete-older-than 14d`.
# If a result still exists in the file system, all the dependencies used to build
# it will be kept.
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 14d";
};
# Also run garbage colleciton whenever there is not enough space left,
# freeing up to 1 GiB whenever there is less than 512MiB left.
extraOptions = ''
min-free = ${toString (512 * 1024 * 1024)}
max-free = ${toString (1024 * 1024 * 1024)}
'';
};
nixpkgs.config.allowUnfree = true;
# Git is needed for flakes
environment.systemPackages = with pkgs; [git];
}

9
system/packages.nix Normal file
View file

@ -0,0 +1,9 @@
{pkgs, ...}:
{
# Basic list of must-have packages for all systems
environment.systemPackages = with pkgs; [
vim
gnupg
delta
];
}

8
system/users.nix Normal file
View file

@ -0,0 +1,8 @@
{pkgs, ...}:
{
users.users.itsdrike = {
isNormalUser = true;
extraGroups = [ "wheel" ];
initialPassword = "itsdrike";
};
}