This commit is contained in:
m3tam3re 2025-04-01 11:43:00 +02:00
commit e1407c6468
5 changed files with 255 additions and 0 deletions

48
configuration.nix Normal file
View File

@ -0,0 +1,48 @@
{
lib,
pkgs,
isImageTarget,
...
}: {
imports = lib.optionals (!isImageTarget) [
./hardware-configuration.nix
./disko-config.nix
];
# boot.loader.grub = {
# enable = true;
# device = "/dev/vda";
# };
# Enable X server and Plasma 6 desktop environment
# services.xserver.enable = true;
services.desktopManager.plasma6.enable = true;
# Enable SDDM
services.displayManager.sddm.enable = true;
# Define the "nixos" user
users.users.nixos = {
isNormalUser = true;
extraGroups = ["wheel" "networkmanager"]; # "wheel" for sudo, "networkmanager" for networking
initialPassword = "nixos"; # Default password (changeable on first login)
};
# Allow passwordless sudo for the "wheel" group
security.sudo.wheelNeedsPassword = false;
# Install essential packages
environment.systemPackages = with pkgs; [
brave
vlc
];
# Enable networking with NetworkManager
networking.networkmanager.enable = true;
# Set the time zone (optional)
time.timeZone = "UTC";
# Specify the system state version
system.stateVersion = "23.05";
}

39
disko-config.nix Normal file
View File

@ -0,0 +1,39 @@
{
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/sda"; # CHANGE ME
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02"; # for GRUB MBR
priority = 1;
};
esp = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = ["defaults" "umask=0077"];
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
mountOptions = ["noatime" "nodiratime" "discard"];
};
};
};
};
};
};
};
}

85
flake.lock generated Normal file
View File

@ -0,0 +1,85 @@
{
"nodes": {
"disko": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1741786315,
"narHash": "sha256-VT65AE2syHVj6v/DGB496bqBnu1PXrrzwlw07/Zpllc=",
"owner": "nix-community",
"repo": "disko",
"rev": "0d8c6ad4a43906d14abd5c60e0ffe7b587b213de",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"nixlib": {
"locked": {
"lastModified": 1736643958,
"narHash": "sha256-tmpqTSWVRJVhpvfSN9KXBvKEXplrwKnSZNAoNPf/S/s=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "1418bc28a52126761c02dd3d89b2d8ca0f521181",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixos-generators": {
"inputs": {
"nixlib": "nixlib",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1742568034,
"narHash": "sha256-QaMEhcnscfF2MqB7flZr+sLJMMYZPnvqO4NYf9B4G38=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "42ee229088490e3777ed7d1162cb9e9d8c3dbb11",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-generators",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1743315132,
"narHash": "sha256-6hl6L/tRnwubHcA4pfUUtk542wn2Om+D4UnDhlDW9BE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "52faf482a3889b7619003c0daec593a1912fddc1",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"disko": "disko",
"nixos-generators": "nixos-generators",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

54
flake.nix Normal file
View File

@ -0,0 +1,54 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
nixpkgs,
nixos-generators,
...
} @ inputs: {
nixosConfigurations = {
m3-zelda = nixpkgs.lib.nixosSystem {
modules = [
./configuration.nix
inputs.disko.nixosModules.disko
];
specialArgs = {
isImageTarget = false;
};
};
};
packages.x86_64-linux = {
iso = nixos-generators.nixosGenerate {
system = "x86_64-linux";
modules = [
./configuration.nix
];
specialArgs = {
isImageTarget = true;
};
format = "iso";
};
qcow = nixos-generators.nixosGenerate {
system = "x86_64-linux";
modules = [
./configuration.nix
];
specialArgs = {
isImageTarget = true;
};
format = "qcow";
};
};
};
}

View File

@ -0,0 +1,29 @@
# 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 + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk"];
boot.initrd.kernelModules = [];
boot.extraModulePackages = [];
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.enp1s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}