create a machine for my desktop

it's a clone of lappy, except with different fs uuids.

i'll work to fold some of these in a bit.
This commit is contained in:
colin 2022-05-22 01:27:02 -07:00
parent 0557a2b700
commit 8f903d5214
6 changed files with 281 additions and 0 deletions

120
desko/colin.nix Normal file
View File

@ -0,0 +1,120 @@
# docs:
# https://rycee.gitlab.io/home-manager/
# man home-configuration.nix
{ config, pkgs, ... }:
{
home.stateVersion = "21.11";
home.username = "colin";
home.homeDirectory = "/home/colin";
programs.home-manager.enable = true;
programs.zsh.enable = true;
programs.git = {
enable = true;
userName = "colin";
userEmail = "colin@uninsane.org";
};
programs.firefox = {
enable = true;
# profiles.default = {
# settings = {
# "browser.urlbar.placeholderName" = "DuckDuckGo";
# };
# };
# extensions = [
# ];
};
programs.vim = {
enable = true;
extraConfig = ''
" wtf vim project: NOBODY LIKES MOUSE FOR VISUAL MODE
set mouse-=a
" copy/paste to system clipboard
set clipboard=unnamedplus
" <tab> completion menu settings
set wildmenu
set wildmode=longest,list,full
" highlight all matching searches (using / and ?)
set hlsearch
" allow backspace to delete empty lines in insert mode
set backspace=indent,eol,start
" built-in syntax highlighting
syntax enable
" show line/col number in bottom right
set ruler
" highlight trailing space & related syntax errors (does this work?)
let c_space_errors=1
let python_space_errors=1
'';
};
dconf.settings = {
# control alt-tab behavior
"org/gnome/desktop/wm/keybindings" = {
switch-applications = [ "<Super>Tab" ];
switch-applications-backward=[];
switch-windows=["<Alt>Tab"];
switch-windows-backward=["<Super><Alt>Tab"];
};
# idle power savings
"org/gnome/settings-deamon/plugins/power" = {
idle-brigthness = 50;
sleep-inactive-ac-type = "nothing";
sleep-inactive-battery-timeout = 5400; # seconds
};
};
# xsession.enable = true;
# xsession.windowManager.command = "…";
home.packages = [
pkgs.btrfs-progs
pkgs.gnumake
pkgs.dig
pkgs.duplicity
pkgs.fatresize
pkgs.fd
pkgs.file
pkgs.gptfdisk
pkgs.hdparm
pkgs.htop
pkgs.iftop
pkgs.iotop
pkgs.iptables
pkgs.jq
pkgs.killall
pkgs.lm_sensors # for sensors-detect
pkgs.lsof
pkgs.pciutils
pkgs.matrix-synapse
pkgs.mix2nix
pkgs.netcat
pkgs.nixUnstable
# pkgs.nixos-generators
# pkgs.nettools
pkgs.nmap
pkgs.parted
pkgs.powertop
pkgs.python3
pkgs.ripgrep
pkgs.smartmontools
pkgs.snapper
pkgs.socat
pkgs.sudo
pkgs.telnet
pkgs.usbutils
pkgs.wireguard
pkgs.zola
pkgs.clinfo
pkgs.discord
pkgs.element-desktop
pkgs.gnome.dconf-editor
pkgs.mesa-demos
pkgs.tdesktop
];
}

4
desko/default.nix Normal file
View File

@ -0,0 +1,4 @@
{ home-manager, config, pkgs, ... }:
{
imports = [ ./homes.nix ./users.nix ./hardware.nix ];
}

84
desko/hardware.nix Normal file
View File

@ -0,0 +1,84 @@
{ config, pkgs, lib, ... }:
{
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.initrd.supportedFilesystems = [ "ext4" "btrfs" "ext2" "ext3" "vfat" ];
# find more of these with sensors-detect
boot.kernelModules = [
"coretemp"
"kvm-intel"
"kvm-amd" # desktop
"amdgpu" # desktop
];
boot.extraModulePackages = [ ];
boot.kernelParams = [ "boot.shell_on_fail" ];
boot.consoleLogLevel = 7;
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# enable cross compilation
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
powerManagement.cpuFreqGovernor = "powersave";
hardware.enableRedistributableFirmware = true;
hardware.cpu.amd.updateMicrocode = true; # desktop
hardware.cpu.intel.updateMicrocode = true; # laptop
powerManagement.powertop.enable = true;
services.fwupd.enable = true;
hardware.opengl.extraPackages = [
# laptop
pkgs.intel-compute-runtime
pkgs.intel-media-driver # new
pkgs.libvdpau-va-gl # new
pkgs.vaapiIntel
# desktop
pkgs.rocm-opencl-icd
pkgs.rocm-opencl-runtime
];
hardware.opengl.driSupport = true;
# For 32 bit applications
hardware.opengl.driSupport32Bit = true;
fileSystems."/" = lib.mkDefault {
device = "/dev/disk/by-uuid/d969ee61-12cf-4490-be07-4440c7be593f";
fsType = "btrfs";
options = [
"compress=zstd"
"defaults"
];
};
fileSystems."/boot" = {
device = lib.mkDefault "/dev/disk/by-uuid/F826-6192";
fsType = "vfat";
};
swapDevices = [ ];
time.timeZone = "America/Los_Angeles";
# start gnome/gdm on boot
services.xserver.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.xserver.displayManager.gdm.enable = true;
# services.snapper.configs = {
# root = {
# subvolume = "/";
# extraConfig = {
# ALLOW_USERS = "colin";
# };
# };
# };
# services.snapper.snapshotInterval = "daily";
networking.useDHCP = false;
networking.networkmanager.enable = true;
networking.wireless.enable = lib.mkForce false;
}

8
desko/homes.nix Normal file
View File

@ -0,0 +1,8 @@
{ home-manager, config, pkgs, ... }:
{
imports = [ home-manager.nixosModule ];
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.colin.imports = [ ./colin.nix ];
}

60
desko/users.nix Normal file
View File

@ -0,0 +1,60 @@
{ config, pkgs, lib, ... }:
# installer docs: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/profiles/installation-device.nix
{
# Users are exactly these specified here;
# old ones will be deleted (from /etc/passwd, etc) upon upgrade.
users.mutableUsers = false;
# docs: https://nixpkgs-manual-sphinx-markedown-example.netlify.app/generated/options-db.xml.html#users-users
users.users.colin = {
# sets group to "users" (?)
isNormalUser = true;
home = "/home/colin";
uid = 1000;
# XXX colin: this is what the installer has, but is it necessary?
# group = "users";
extraGroups = [ "wheel" "networkmanager" ];
initialHashedPassword = "";
# shell = pkgs.bashInteractive;
# XXX colin: create ssh key for THIS user by logging in and running:
# ssh-keygen -t ed25519
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGSDe/y0e9PSeUwYlMPjzhW0UhNsGAGsW3lCG3apxrD5 colin@colin.desktop"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG+MZ/l5d8g5hbxMB9ed1uyvhV85jwNrSVNVxb5ujQjw colin@colin.laptop"
];
};
# automatically log in at the virtual consoles.
# using root here makes sure we always have an escape hatch
# services.getty.autologinUser = "root";
security.sudo = {
enable = true;
wheelNeedsPassword = false;
};
services.openssh = {
enable = true;
permitRootLogin = "no";
passwordAuthentication = false;
};
programs.vim.defaultEditor = true;
# gitea doesn't create the git user
# users.users.git = {
# description = "Gitea Service";
# home = "/var/lib/gitea";
# useDefaultShell = true;
# group = "gitea";
# isSystemUser = true;
# # sendmail access (not 100% sure if this is necessary)
# extraGroups = [ "postdrop" ];
# };
# # this is required to allow pleroma to send email.
# # raw `sendmail` works, but i think pleroma's passing it some funny flags or something, idk.
# # hack to fix that.
# users.users.pleroma.extraGroups = [ "postdrop" ];
}

View File

@ -30,6 +30,11 @@
extraModules = [ ./uninsane ];
};
nixosConfigurations.desko = self.decl-machine {
system = "x86_64-linux";
extraModules = [ ./desko ];
};
nixosConfigurations.lappy = self.decl-machine {
system = "x86_64-linux";
extraModules = [ ./lappy ];