2022-11-09 19:59:49 +01:00
|
|
|
inputs:
|
|
|
|
let
|
|
|
|
system = "x86_64-linux";
|
|
|
|
hostname = "morpheus";
|
2022-11-14 00:19:51 +01:00
|
|
|
swapUUID = "93bdadfc-961a-4ea6-aef0-d3cd50847f0b";
|
2023-10-29 09:30:47 +01:00
|
|
|
overlay-unstable = final: prev: {
|
|
|
|
unstable = inputs.nixpkgs-unstable.legacyPackages.${prev.system};
|
|
|
|
};
|
2022-11-09 19:59:49 +01:00
|
|
|
in
|
|
|
|
inputs.nixpkgs.lib.nixosSystem {
|
|
|
|
inherit system;
|
|
|
|
modules = [
|
2023-10-29 09:30:47 +01:00
|
|
|
({ config, pkgs, ... } : {
|
|
|
|
system.stateVersion = "22.05";
|
|
|
|
nixpkgs.overlays = [ overlay-unstable ];
|
|
|
|
})
|
2022-11-09 19:59:49 +01:00
|
|
|
(import ./common.nix inputs)
|
2024-08-10 12:27:56 +02:00
|
|
|
(import ./sway.nix inputs)
|
2024-08-01 16:24:21 +02:00
|
|
|
(import ./morpheus/btrbk.nix inputs)
|
2022-11-09 19:59:49 +01:00
|
|
|
(import ./dev.nix inputs)
|
|
|
|
(import ./entertainment.nix inputs)
|
|
|
|
(import ./office.nix inputs)
|
|
|
|
({ pkgs, lib, ... }: {
|
|
|
|
system.autoUpgrade = {
|
2024-09-01 14:54:58 +02:00
|
|
|
enable = false;
|
|
|
|
flake = inputs.self.outPath;
|
|
|
|
flags = [
|
|
|
|
"--update-input"
|
|
|
|
"nixpkgs"
|
|
|
|
"--update-input"
|
|
|
|
"nixpkgs-unstable"
|
|
|
|
"--update-input"
|
|
|
|
"home-manager"
|
|
|
|
"--update-input"
|
|
|
|
"flake-utils"
|
|
|
|
"-L" # print build logs
|
|
|
|
];
|
2022-11-09 19:59:49 +01:00
|
|
|
allowReboot = false;
|
|
|
|
};
|
|
|
|
|
2022-11-09 20:17:29 +01:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
# automatic btrfs snapshots
|
|
|
|
snapper
|
|
|
|
snapper-gui
|
|
|
|
];
|
|
|
|
|
2022-11-09 19:59:49 +01:00
|
|
|
networking = {
|
|
|
|
hostName = hostname;
|
|
|
|
interfaces.enp1s0.useDHCP = true;
|
|
|
|
interfaces.wlp2s0.useDHCP = true;
|
|
|
|
};
|
2022-11-09 20:17:29 +01:00
|
|
|
services = {
|
2022-12-18 11:56:46 +01:00
|
|
|
# enable touchpad support
|
2024-06-15 16:02:25 +02:00
|
|
|
libinput.enable = true;
|
2022-12-18 11:56:46 +01:00
|
|
|
blueman.enable = true;
|
2022-11-09 20:17:29 +01:00
|
|
|
snapper.configs = {
|
|
|
|
home = {
|
2023-08-04 12:46:54 +02:00
|
|
|
SUBVOLUME = "/home";
|
|
|
|
ALLOW_USERS = [ "me" ];
|
|
|
|
TIMELINE_CREATE = true;
|
|
|
|
TIMELINE_CLEANUP = true;
|
2022-11-09 20:17:29 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2022-11-09 19:59:49 +01:00
|
|
|
users.users.me = {
|
|
|
|
isNormalUser = true;
|
|
|
|
createHome = true;
|
|
|
|
extraGroups = [
|
|
|
|
"adbusers"
|
|
|
|
"audio"
|
|
|
|
"davfs2"
|
|
|
|
"disk"
|
|
|
|
"docker"
|
2024-07-10 12:59:26 +02:00
|
|
|
"libvirtd" # virt-manager
|
2022-11-09 19:59:49 +01:00
|
|
|
"networkmanager"
|
|
|
|
"plugdev"
|
2023-05-12 17:15:29 +02:00
|
|
|
"podman"
|
2022-11-09 19:59:49 +01:00
|
|
|
"users"
|
|
|
|
"uucp"
|
|
|
|
"vboxusers"
|
|
|
|
"video"
|
|
|
|
"wheel"
|
|
|
|
];
|
|
|
|
shell = pkgs.zsh;
|
|
|
|
};
|
|
|
|
boot = {
|
|
|
|
initrd = {
|
|
|
|
#availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
|
|
|
|
availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ];
|
|
|
|
kernelModules = [ ];
|
2023-12-03 14:02:35 +01:00
|
|
|
luks.devices."system" = {
|
|
|
|
device = "/dev/disk/by-uuid/06549d22-b96c-44f2-bb27-45200d5feda5";
|
|
|
|
# better SSD performance
|
|
|
|
# https://wiki.archlinux.org/title/Dm-crypt/Specialties#Disable_workqueue_for_increased_solid_state_drive_(SSD)_performance
|
|
|
|
bypassWorkqueues = true;
|
|
|
|
};
|
2022-11-09 19:59:49 +01:00
|
|
|
};
|
|
|
|
kernelModules = [ "kvm-amd" ];
|
|
|
|
# use latest kernel
|
|
|
|
kernelPackages = pkgs.linuxPackages_latest;
|
2022-11-14 00:19:51 +01:00
|
|
|
kernelParams = [
|
|
|
|
/* enable hibernation with swapfile */
|
|
|
|
/* https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Hibernation_into_swap_file */
|
|
|
|
("resume=UUID=" + swapUUID)
|
|
|
|
/* sudo filefrag -v /swap/swapfile | awk '$1=="0:" {print substr($4, 1, length($4)-2)}' */
|
|
|
|
"resume_offset=269568"
|
|
|
|
];
|
2022-11-09 19:59:49 +01:00
|
|
|
kernel.sysctl = {
|
|
|
|
# function keys on keychron keyboard won't work otherwise
|
|
|
|
"module.hid_apple.parameters.fnmode" = "2";
|
|
|
|
};
|
|
|
|
# Use the systemd-boot EFI boot loader.
|
|
|
|
loader = {
|
|
|
|
systemd-boot.enable = true;
|
|
|
|
efi = {
|
|
|
|
canTouchEfiVariables = true;
|
|
|
|
efiSysMountPoint = "/boot/efi";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
# mount tmp as tmpfs
|
2023-04-21 00:16:02 +02:00
|
|
|
tmp.useTmpfs = true;
|
2022-11-09 19:59:49 +01:00
|
|
|
# Enable NTFS support
|
|
|
|
supportedFilesystems = [ "ntfs" ];
|
|
|
|
};
|
|
|
|
|
2023-10-31 12:34:22 +01:00
|
|
|
# btrf autoscrub
|
|
|
|
services.btrfs.autoScrub = {
|
|
|
|
enable = true;
|
|
|
|
# multiple subvolumes of the same fs are mounted. only scrub '/' to prevent multiple runs
|
|
|
|
fileSystems = [ "/" ];
|
|
|
|
};
|
|
|
|
|
2022-11-09 19:59:49 +01:00
|
|
|
fileSystems."/" =
|
|
|
|
{ device = "/dev/disk/by-uuid/93bdadfc-961a-4ea6-aef0-d3cd50847f0b";
|
|
|
|
fsType = "btrfs";
|
|
|
|
options = [ "subvol=root" "compress=zstd" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems."/boot/efi" =
|
|
|
|
{ device = "/dev/disk/by-uuid/4CD4-D5AB";
|
|
|
|
fsType = "vfat";
|
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems."/nix" =
|
|
|
|
{ device = "/dev/disk/by-uuid/93bdadfc-961a-4ea6-aef0-d3cd50847f0b";
|
|
|
|
fsType = "btrfs";
|
|
|
|
options = [ "subvol=nix" "compress=zstd" "noatime" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems."/home" =
|
|
|
|
{ device = "/dev/disk/by-uuid/93bdadfc-961a-4ea6-aef0-d3cd50847f0b";
|
|
|
|
fsType = "btrfs";
|
|
|
|
options = [ "subvol=home" "compress=zstd" ];
|
|
|
|
};
|
|
|
|
|
2023-03-06 12:10:39 +01:00
|
|
|
fileSystems."/home/me/media" =
|
|
|
|
{ device = "/dev/disk/by-uuid/93bdadfc-961a-4ea6-aef0-d3cd50847f0b";
|
|
|
|
fsType = "btrfs";
|
|
|
|
options = [ "subvol=home/me/media" "compress=zstd" ];
|
|
|
|
};
|
|
|
|
|
2022-11-09 19:59:49 +01:00
|
|
|
fileSystems."/swap" =
|
2022-11-14 00:19:51 +01:00
|
|
|
{ device = "/dev/disk/by-uuid/" + swapUUID;
|
2022-11-09 19:59:49 +01:00
|
|
|
fsType = "btrfs";
|
|
|
|
options = [ "subvol=swap" "noatime" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
swapDevices = [
|
|
|
|
{ device = "/swap/swapfile"; }
|
|
|
|
];
|
|
|
|
|
|
|
|
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
|
|
|
|
|
|
|
hardware = {
|
2022-12-18 11:56:46 +01:00
|
|
|
bluetooth.enable = true;
|
2022-11-09 19:59:49 +01:00
|
|
|
#opengl = {
|
|
|
|
#extraPackages = with pkgs; [
|
|
|
|
#rocm-opencl-icd
|
|
|
|
#rocm-opencl-runtime
|
|
|
|
#];
|
|
|
|
#};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
inputs.home-manager.nixosModules.home-manager
|
|
|
|
{
|
|
|
|
home-manager = {
|
|
|
|
useGlobalPkgs = true;
|
|
|
|
useUserPackages = true;
|
|
|
|
extraSpecialArgs = {
|
|
|
|
inherit inputs;
|
|
|
|
inherit system;
|
|
|
|
hostname = hostname;
|
|
|
|
};
|
|
|
|
users.me = import ../users/me.nix;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|