Add base system flake and configuration

Signed-off-by: George Kaklamanos <gkaklas@gkaklas.gr>
This commit is contained in:
George Kaklamanos 2024-04-28 22:10:39 +03:00
parent 6da51a6b1f
commit 22548339a9
No known key found for this signature in database
GPG key ID: C0CAB8A6BDC9399D
5 changed files with 217 additions and 0 deletions

79
nixos/configuration.nix Normal file
View file

@ -0,0 +1,79 @@
{
config,
lib,
pkgs,
...
}: {
imports = [
./hardware-configuration.nix
"${builtins.fetchTarball {
url = "https://github.com/nix-community/disko/archive/refs/tags/v1.5.0.tar.gz";
sha256 = "sha256:1d03a0wb710by1m2c3rx758vy67f8r71gnv2h3qn4jj1bx10sdg4";
}}/module.nix"
./disko.nix
];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "kelly";
networking.networkmanager.enable = true;
time.timeZone = "Europe/Athens";
system.copySystemConfiguration = false;
system.stateVersion = "23.11";
programs.fish.enable = true;
users.users.gkaklas = {
isNormalUser = true;
extraGroups = ["wheel" "uinput"];
shell = pkgs.fish;
};
users.users.gkaklas.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHRvzNjXbCJ1/lIcZXdJSzkadYOIoAzZ2G2stoxZY7qz gkaklas@onyx"
];
#users.groups.uinput = {};
security.sudo.wheelNeedsPassword = false;
security.pam.services.gkaklas.kwallet.enable = true;
services.xserver.enable = true;
services.desktopManager.plasma6.enable = true;
services.displayManager = {
sddm.enable = true;
sddm.autoLogin.relogin = true;
autoLogin.enable = true;
autoLogin.user = "gkaklas";
defaultSession = "plasma";
sddm.wayland.enable = true;
};
services = {
openssh.enable = true;
openssh.settings.PasswordAuthentication = false;
pipewire.enable = true;
pipewire.pulse.enable = true;
flatpak.enable = true;
fprintd.enable = true;
fwupd.enable = true;
};
hardware = {
bluetooth.enable = true;
sensor.iio.enable = true;
};
powerManagement.enable = true;
xdg.portal.enable = true;
virtualisation.podman.enable = true;
nix = {
package = pkgs.nixFlakes;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
}

61
nixos/disko.nix Normal file
View file

@ -0,0 +1,61 @@
{
disko.devices.disk.ssd.type = "disk";
disko.devices.disk.ssd.device = "/dev/nvme0n1";
disko.devices.disk.ssd.content.type = "gpt";
disko.devices.disk.ssd.content.partitions.ESP = {
# For storing live images in the future,
# instead of creating a bootable USB drive
size = "10G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"defaults"
];
};
};
disko.devices.disk.ssd.content.partitions.luks = {
size = "100%";
content = {
type = "luks";
name = "cryptroot";
content = {
type = "lvm_pv";
vg = "VolGroup0";
};
};
};
disko.devices.lvm_vg.VolGroup0.type = "lvm_vg";
disko.devices.lvm_vg.VolGroup0.lvs.root = {
size = "50G";
content = {
type = "filesystem";
format = "btrfs";
mountpoint = "/";
};
};
disko.devices.lvm_vg.VolGroup0.lvs.home = {
size = "100G";
content = {
type = "btrfs";
subvolumes = {
"gkaklas/.local/share/flatpak" = {
mountpoint = "/home/gkaklas/.local/share/flatpak";
mountOptions = ["defaults" "user"];
};
};
mountpoint = "/home";
};
};
disko.devices.lvm_vg.VolGroup0.lvs.storage = {
size = "200G";
content = {
type = "filesystem";
format = "btrfs";
mountpoint = "/mnt/storage";
mountOptions = ["defaults" "user"];
};
};
}

27
nixos/flake.lock generated Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1714253743,
"narHash": "sha256-mdTQw2XlariysyScCv2tTE45QSU9v/ezLcHJ22f0Nxc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "58a1abdbae3217ca6b702f03d3b35125d88a2994",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

20
nixos/flake.nix Normal file
View file

@ -0,0 +1,20 @@
{
description = "NixOS configuration flake";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
outputs = inputs @ {nixpkgs, ...}: let
hostname = "kelly";
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
in {
nixosConfigurations = {
"kelly" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
];
};
};
};
}

View file

@ -0,0 +1,30 @@
# 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 = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod"];
boot.initrd.kernelModules = ["dm-snapshot"];
boot.kernelModules = ["kvm-amd"];
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.enp193s0f3u2c2.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}