Archived
0
0
Fork 0

break up nix config

This commit is contained in:
Daryl Ronningen 2022-12-31 01:27:24 -08:00
parent 1ae05d66a8
commit 2b9725807d
Signed by: Daryl Ronningen
GPG key ID: FD23F0C934A5EC6B
16 changed files with 240 additions and 212 deletions

5
common/desktop/apps.nix Normal file
View file

@ -0,0 +1,5 @@
{...}:
{
services.flatpak.enable = true;
}

View file

@ -0,0 +1,12 @@
{ pkgs, ... }:
{
hardware.opengl.extraPackages = with pkgs; [
intel-compute-runtime
mesa_drivers
vaapiIntel
vaapiVdpau
libvdpau-va-gl
intel-media-driver
];
}

10
common/desktop/fonts.nix Normal file
View file

@ -0,0 +1,10 @@
{ pkgs, ... }:
{
fonts = {
enableDefaultFonts = true;
enableGhostscriptFonts = true;
fontDir.enable = true;
fonts = [ pkgs.nerdfonts ];
};
}

14
common/desktop/gnome.nix Normal file
View file

@ -0,0 +1,14 @@
{...}:
{
services = {
xserver = {
desktopManager.gnome.enable = true;
displayManager.gdm.enable = true;
};
gnome = {
core-utilities.enable = false;
gnome-browser-connector.enable = true;
};
};
}

14
common/desktop/media.nix Normal file
View file

@ -0,0 +1,14 @@
{ ... }:
{
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
}

9
common/desktop/xorg.nix Normal file
View file

@ -0,0 +1,9 @@
{ pkgs, ... }:
{
services.xserver = {
enable = true;
autorun = true;
excludePackages = [ pkgs.xterm ];
};
}

5
common/dev/docker.nix Normal file
View file

@ -0,0 +1,5 @@
{...}:
{
virtualisation.docker.enable = true;
}

16
common/nix.nix Normal file
View file

@ -0,0 +1,16 @@
{
nixpkgs.config = {
allowUnfree = true;
};
nix = {
settings = {
auto-optimise-store = true;
trusted-users = ["root" "relms"];
};
extraOptions = ''
experimental-features = nix-command flakes
'';
};
}

15
common/personal.nix Normal file
View file

@ -0,0 +1,15 @@
{ pkgs, ... }:
{
users.users.relms = {
isNormalUser = true;
description = "Daryl Ronningen";
extraGroups = [ "networkmanager" "wheel" "docker" "adbusers" ];
shell = pkgs.fish;
};
programs = {
fish.enable = true;
adb.enable = true;
};
}

29
devices/common.nix Normal file
View file

@ -0,0 +1,29 @@
{pkgs, ...}:
{
boot = {
loader = {
grub = {
enable = true;
device = "nodev";
useOSProber = true;
efiSupport = true;
};
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
};
kernelPackages = pkgs.linuxPackages_latest;
};
hardware = {
xpadneo.enable = true;
};
time.timeZone = "America/Los_Angeles";
zramSwap.enable = true;
system.stateVersion = "23.05";
}

21
devices/skynet/base.nix Normal file
View file

@ -0,0 +1,21 @@
{ config, pkgs, lib, ... }:
{
networking.hostName = "skynet";
services.fprintd.enable = true;
systemd.services.fprintd = {
wantedBy = [ "multi-user.target" ];
serviceConfig.Type = "simple";
};
services.fwupd.enable = true;
services.fwupd.enableTestRemote = true;
services.fwupd.extraRemotes = [ "lvfs-testing" ];
environment.etc."fwupd/uefi_capsule.conf".text = lib.mkForce ''
[uefi_capsule]
DisableCapsuleUpdateOnDisk=true
OverrideESPMountPoint=/boot/efi
'';
}

View file

@ -0,0 +1,30 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot = {
initrd = {
availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ];
kernelModules = [];
};
kernelModules = [ "kvm-intel" ];
extraModulePackages = [];
};
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/d0dfd8f7-355c-4d81-a20b-52b522914b96";
fsType = "xfs";
};
"/boot/efi" = {
device = "/dev/disk/by-uuid/FD80-0AEA";
fsType = "vfat";
};
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -47,11 +47,11 @@
},
"locked": {
"dir": "contrib",
"lastModified": 1672331788,
"narHash": "sha256-gjdJWT/f+gGfz168xZkR9NkRakzIIdzWpWyIHBFgvms=",
"lastModified": 1672440083,
"narHash": "sha256-CsOplUdX18GGb190pRN1SuEqCqcFluUy4BoZ/W5/ou4=",
"owner": "neovim",
"repo": "neovim",
"rev": "4703e561d5bc0eef13da171c4f8f8b6e02ae4883",
"rev": "99cf111289bfcd14981255e805da43bac5139141",
"type": "github"
},
"original": {
@ -63,11 +63,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1672262501,
"narHash": "sha256-ZNXqX9lwYo1tOFAqrVtKTLcJ2QMKCr3WuIvpN8emp7I=",
"lastModified": 1672350804,
"narHash": "sha256-jo6zkiCabUBn3ObuKXHGqqORUMH27gYDIFFfLq5P4wg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e182da8622a354d44c39b3d7a542dc12cd7baa5f",
"rev": "677ed08a50931e38382dbef01cba08a8f7eac8f6",
"type": "github"
},
"original": {
@ -79,11 +79,11 @@
},
"nur": {
"locked": {
"lastModified": 1672375592,
"narHash": "sha256-SwiWuNLy1yC4gXe/J6a42Wq85UaPsynuVXMq7AUCzr0=",
"lastModified": 1672476334,
"narHash": "sha256-y1Hb9FrF/PJaaEneN9x73BIR8eAl5jBn8Fafc+1FoI4=",
"owner": "nix-community",
"repo": "NUR",
"rev": "b474be30e1e798aa6e821ca92ce6d23f808979c2",
"rev": "c960f8caf6b26f6f43b9a38b4e21c8e4bd6f5090",
"type": "github"
},
"original": {

View file

@ -14,22 +14,59 @@
utils.url = "github:gytis-ivaskevicius/flake-utils-plus";
};
outputs = inputs@{ self, nixpkgs, utils, home-manager, neovim, nur, ... }: utils.lib.mkFlake {
inherit self inputs;
hostDefaults.system = "x86_64-linux";
hosts.skynet.modules = [ ./hosts/skynet/configuration.nix ];
homeConfigurations.relms = home-manager.lib.homeManagerConfiguration {
outputs = { self, nixpkgs, utils, home-manager, neovim, nur, ... }: let
modules = {
home = [
./users/relms/home.nix
];
nixos = {
common = [
./common/personal.nix
./common/nix.nix
./devices/common.nix
];
dev = [
./common/dev/docker.nix
];
desktops = {
common = [
./common/desktop/apps.nix
./common/desktop/fonts.nix
./common/desktop/media.nix
./common/desktop/xorg.nix
];
gnome = [
./common/desktop/gnome.nix
];
};
};
};
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [nur.overlay (utils.lib.genPkgOverlay neovim "neovim")];
};
modules = [
./users/relms/home.nix
in {
nixosConfigurations = {
skynet = nixpkgs.lib.nixosSystem {
inherit pkgs;
system = "x86_64-linux";
modules =
modules.nixos.common
++ modules.nixos.dev
++ modules.nixos.desktops.common
++ modules.nixos.desktops.gnome
++ [
./common/desktop/drivers/skynet.nix
./devices/skynet/base.nix
./devices/skynet/hardware.nix
];
};
};
homeConfigurations.relms = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = modules.home;
};
};
}

View file

@ -1,148 +0,0 @@
{ config, pkgs, lib, ... }:
{
imports = [ ./hardware-configuration.nix ];
# Bootloader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "nodev";
boot.loader.grub.useOSProber = true;
boot.loader.grub.efiSupport = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot/efi";
boot.kernelPackages = pkgs.linuxPackages_latest;
# Enable XBox Controller
hardware.xpadneo.enable = true;
# Networking
networking.hostName = "skynet";
# Set your time zone.
time.timeZone = "America/Los_Angeles";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
# Enable the X11 windowing system.
services.xserver.enable = true;
services.xserver.autorun = true;
services.xserver.excludePackages = [ pkgs.xterm ];
# Install various graphics drivers
hardware.opengl.extraPackages = with pkgs; [
intel-compute-runtime
mesa_drivers
vaapiIntel
vaapiVdpau
libvdpau-va-gl
intel-media-driver
];
# Enable the GNOME Desktop Environment.
services.xserver.desktopManager.gnome.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.gnome.core-utilities.enable = false;
services.gnome.gnome-browser-connector.enable = true;
# Configure keymap in X11
services.xserver = {
layout = "us";
xkbVariant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
# Define a user account. Don't forget to set a password with passwd.
users.users.relms = {
isNormalUser = true;
description = "Daryl Ronningen";
extraGroups = [ "networkmanager" "wheel" "docker" "adbusers" ];
shell = pkgs.fish;
};
# Install fish
programs.fish.enable = true;
# Install ADB
programs.adb.enable = true;
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Manage CPU speed
services.cpupower-gui.enable = true;
# Fingerprint
services.fprintd.enable = true;
systemd.services.fprintd = {
wantedBy = [ "multi-user.target" ];
serviceConfig.Type = "simple";
};
# Thermals
services.thermald.enable = true;
# Flatpak
services.flatpak.enable = true;
# Firmware Updater
services.fwupd.enable = true;
services.fwupd.enableTestRemote = true;
services.fwupd.extraRemotes = [ "lvfs-testing" ];
# Docker
virtualisation.docker.enable = true;
# Enable ZRAM
zramSwap.enable = true;
zramSwap.priority = 100;
# Setup some basic fonts
fonts = {
enableDefaultFonts = true;
enableGhostscriptFonts = true;
fontDir.enable = true;
fonts = [ pkgs.nerdfonts ];
};
# Fix firmware update on framework laptop
environment.etc."fwupd/uefi_capsule.conf".text = lib.mkForce ''
[uefi_capsule]
DisableCapsuleUpdateOnDisk=true
OverrideESPMountPoint=/boot/efi
'';
# 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.05"; # Did you read the comment?
}

View file

@ -1,41 +0,0 @@
# 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" "thunderbolt" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/d0dfd8f7-355c-4d81-a20b-52b522914b96";
fsType = "xfs";
};
fileSystems."/boot/efi" = {
device = "/dev/disk/by-uuid/FD80-0AEA";
fsType = "vfat";
};
fileSystems."/tmp" = {
device = "tmpfs";
fsType = "tmpfs";
};
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.wlp166s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}