Skip to content

Commit

Permalink
minimal nixos setup for FW16 (iGPU) with kde
Browse files Browse the repository at this point in the history
  • Loading branch information
seb314 committed Apr 12, 2024
0 parents commit a643c27
Show file tree
Hide file tree
Showing 9 changed files with 342 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
watch_file flake.nix
use flake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.direnv/
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This is a rather minimal nixos configuration for the Framework Laptop 16
(iGPU-only version).
**Intended only as a sanity check to get a config with working graphics.**

Boots successfully, KDE seems to work, wifi works.

(Installed on ZFS on LUKS, partitioned and formatted with disko).
65 changes: 65 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
description = "Pruned Nixos Config for FW16 Standalone";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";

nixos-hardware.url = "github:NixOS/nixos-hardware/master";

disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
};

outputs =
{ self
, nixpkgs
, ...
} @ inputs:
let
inherit (self) outputs;
systems = [
#"aarch64-linux"
#"i686-linux"
"x86_64-linux"
#"aarch64-darwin"
#"x86_64-darwin"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
in
{
nixosConfigurations = {
FW16 = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
./hosts/FW16/default.nix
];
};
};

devShells = forAllSystems (system:
let pkgs = (import nixpkgs {inherit system; });
in {
default = pkgs.mkShell {
buildInputs = [
pkgs.nil
pkgs.nixos-anywhere
];
};
}
);
};
}
50 changes: 50 additions & 0 deletions hosts/FW16/configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
inputs,
outputs,
lib,
config,
pkgs,
...
}: {
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.initrd.supportedFilesystems = [ "zfs" ];
boot.supportedFilesystems = [ "zfs" ];
services.zfs.autoScrub.enable = true;
networking.hostId = "8dabc8e2";

networking.hostName = "FW16";
networking.networkmanager.enable = true;

services.openssh = {
openFirewall = true;
enable = true;
settings = {
PasswordAuthentication = lib.mkDefault false;
KbdInteractiveAuthentication = lib.mkDefault false;
};
};
users.users.root.openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6Rb9XzpoStRNCqOeY7NCTprq/+NSlTiha6gDtslZJxX/YmmufoPtPwNA/F+32SFTCt2EXSoXhUL5/jzYH3+6uWdCVmZd1nSChCKV3AiyEJ7CK3I/41O7ljw3XoP2TtODnf6xSZKWUc3Eo2SEbuswzTE4yBJ5Pew3CvA1RUpqUDfFDFEi0RuzcbEx6zSbKQLDJja6v6s3dxijTNaFeH4JcnISx4X/3OjhRzmJ/44dcIjwjJwhDx/QkPRzm+HnthrjGUO3zrsX43NyNqfz9eu+YKT9iZmHIJlOKt1SCADDn3PspjXqrpb/LdYaAgjxLmK4bm7tIPryH5Xg6hKtTE7jJ sebastian@oldlaptop"
];

services.xserver.enable = true;
services.xserver.displayManager.sddm.enable = true;
services.xserver.desktopManager.plasma5.enable = true;

users.mutableUsers = true;
users.users.nixos = {
password = "nixos";
isNormalUser = true;
extraGroups = [ "wheel" ];
};

# 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. It‘s 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?
}

15 changes: 15 additions & 0 deletions hosts/FW16/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{ config, lib, pkgs,
inputs,
... }:
{
imports = [
./hardware-configuration.nix

inputs.nixos-hardware.nixosModules.framework-13-7040-amd

./disko.nix
inputs.disko.nixosModules.disko

./configuration.nix
];
}
123 changes: 123 additions & 0 deletions hosts/FW16/disko.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
disko.devices = {
disk = {
nvme0n1 = {
type = "disk";
#device = "/dev/nvme0n1";
device = "/dev/disk/by-id/nvme-WD_BLACK_SN850X_2000GB_23509Q446109_1";
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"defaults"
];
};
};
ESP2 = { # spare in case we need to install a second os or so
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = null;
mountOptions = [
"defaults"
];
};
};
luks = {
end = "-100G";
content = {
type = "luks";
name = "crypted";
extraOpenArgs = [ ];
askPassword = true;
settings = {
# if you want to use the key for interactive login be sure there is no trailing newline
# for example use `echo -n "password" > /tmp/secret.key`
#keyFile = "/tmp/secret.key";
allowDiscards = true; # TODO?
#crypttabExtraOpts = [ "tpm2-device=auto" ];
};
#additionalKeyFiles = [ "/tmp/additionalSecret.key" ];
content = {
type = "zfs";
pool = "zroot";
# zpool = {
# zroot = {
# type = "zpool";
# datasets = {
# "root" = {
# type = "zfs_fs";
# options.mountpoint = "none";
# };
# "root/root" = {
# type = "zfs_fs";
# mountpoint = "/";
# #options."com.sun:auto-snapshot" = "true";
# };
# "root/home" = {
# type = "zfs_fs";
# mountpoint = "/home";
# #options."com.sun:auto-snapshot" = "true";
# };
# "root/nix" = {
# type = "zfs_fs";
# mountpoint = "/nix";
# #options."com.sun:auto-snapshot" = "true";
# };
# "root/var" = {
# type = "zfs_fs";
# mountpoint = "/var";
# #options."com.sun:auto-snapshot" = "true";
# };
# };
# };
# };
};
};
};
};
};
};
};
zpool = {
zroot = {
type = "zpool";
datasets = {
"root" = {
type = "zfs_fs";
options.mountpoint = "none";
};
"root/root" = {
type = "zfs_fs";
mountpoint = "/";
#options."com.sun:auto-snapshot" = "true";
};
"root/home" = {
type = "zfs_fs";
mountpoint = "/home";
#options."com.sun:auto-snapshot" = "true";
};
"root/nix" = {
type = "zfs_fs";
mountpoint = "/nix";
#options."com.sun:auto-snapshot" = "true";
};
"root/var" = {
type = "zfs_fs";
mountpoint = "/var";
#options."com.sun:auto-snapshot" = "true";
};
};
};
};
};
}
28 changes: 28 additions & 0 deletions hosts/FW16/hardware-configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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" "usbhid" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];

# NOTE file systems handled by disko

# 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.enp195s0f3u1.useDHCP = lib.mkDefault true;
# networking.interfaces.vboxnet0.useDHCP = lib.mkDefault true;

nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

0 comments on commit a643c27

Please sign in to comment.