vivi
/
nix
1
0
Fork 0

help I am a dumb dog

main
Vivi Dog 2024-03-11 23:37:45 -05:00
commit a924664ef4
6 changed files with 615 additions and 0 deletions

41
chromebook-ucm-conf.nix Normal file
View File

@ -0,0 +1,41 @@
{ lib, stdenv, fetchFromGitHub }:
stdenv.mkDerivation rec {
pname = "chromebook-ucm-conf";
version = "0.1";
src = fetchFromGitHub {
owner = "WeirdTreeThing";
repo = "chromebook-ucm-conf";
rev = "6d8835f89c7c7e5fac7b6aaea0e36a6b1d1e4be5";
hash = "sha256-XQ/kRN1xHEAcykbKpE26mNZXwqEbkh++ZuJeCAiu9ho=";
};
dontBuild = true;
installPhase = ''
runHook preInstall
#mkdir -p $out/share/alsa
#cp -r ucm ucm2 $out/share/alsa
mkdir -p $out/share/alsa/ucm2/conf.d
cp -r common/pcm adl/* $out/share/alsa/ucm2/conf.d
runHook postInstall
'';
meta = with lib; {
homepage = "https://www.alsa-project.org/";
description = "ALSA Use Case Manager configuration";
longDescription = ''
The Advanced Linux Sound Architecture (ALSA) provides audio and
MIDI functionality to the Linux-based operating system.
'';
license = licenses.bsd3;
maintainers = [ maintainers.vivithecanine ];
platforms = platforms.linux;
};
}

350
configuration.nix Normal file
View File

@ -0,0 +1,350 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running `nixos-help`).
{ pkgs, lib, ... }:
{
imports =
[
./disks.nix
./hardware-configuration.nix
];
nix = {
settings = {
allowed-users = [ "@wheel" ];
auto-optimise-store = true;
experimental-features = [ "nix-command" "flakes" ];
};
};
boot = {
extraModprobeConfig = ''
options snd-intel-dspcfg dsp_driver=3
'';
initrd.systemd.enable = true;
kernelPackages = pkgs.linuxPackages_latest;
kernelParams = [ "ia32_emulation=false" ];
#kernelModules = lib.mkBefore [ "intel-pmc-mux" "cros-ec-typec" ];
#blacklistedKernelModules = [ "" ];
loader = {
systemd-boot.enable = true;
systemd-boot.memtest86.enable = true;
efi.canTouchEfiVariables = true;
};
};
zramSwap = {
enable = true;
memoryMax = (256 * 1048576);
};
time.timeZone = "America/Chicago";
environment.persistence."/persist" = {
files = [
"/etc/machine-id"
"/etc/ssh/ssh_host_rsa_key"
"/etc/ssh/ssh_host_rsa_key.pub"
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
];
directories = [
{ directory="/var/lib/iwd"; mode="0700"; }
#{ directory="/var/lib/tailscale"; mode="0700"; }
];
users.user = {
directories = [
{ directory=".config/mpv"; mode="0700"; }
{ directory=".config/sway"; mode="0700"; }
{ directory=".config/waybar"; mode="0700"; }
{ directory=".local/bin"; mode="0700"; }
{ directory=".mozilla"; mode="0700"; }
{ directory=".passage"; mode="0700"; }
{ directory=".ssh"; mode="0700"; }
{ directory="keep"; mode="0700"; }
];
};
};
networking = {
hostName = "puppy";
useDHCP = false;
wireless.iwd.enable = true;
firewall.enable = false;
nftables.enable = true;
networkmanager.enable = false;
};
systemd.network = {
enable = true;
wait-online.anyInterface = true;
networks = {
"10-wired" = {
matchConfig.Name = "en*";
networkConfig.DHCP = "yes";
dhcpV4Config.UseDNS = false;
dhcpV6Config.UseDNS = false;
ipv6AcceptRAConfig.UseDNS = false;
};
"20-wireless" = {
matchConfig.Name = "wlan0";
networkConfig.DHCP = "yes";
dhcpV4Config.UseDNS = false;
dhcpV6Config.UseDNS = false;
ipv6AcceptRAConfig.UseDNS = false;
};
};
};
users = {
mutableUsers = false;
users.user = {
initialHashedPassword = "$y$j9T$2EblDvSSqdo9.OzBSVgI10$YJNxraJBOKji.KiAY857Sm6FWE.Phi.mxGkJtpK.a75";
isNormalUser = true;
extraGroups = [ "adbusers" "wheel" ];
packages = with pkgs; [
age
age-plugin-yubikey
android-tools
bc
cbmem
ffmpeg
flyctl
fw-ectool
lftp
mpv
nil
nixpkgs-fmt
nix-prefetch
nmap
passage
pciutils
pulsemixer
scrcpy
streamlink
vlc
waybar
whois
wl-clipboard
yt-dlp
xdg-utils
];
openssh.authorizedKeys.keys = [
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIC/az8vkq+0ap64Yb6XbioN50qEzr66irdOtF2RfQPx/AAAACHNzaDp1c2Vy"
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIDZMqzSOWu7ypYL6+KdIirn1ItrJy525Ghaspy6XZYMsAAAACHNzaDp1c2Vy"
];
};
};
fonts.packages = with pkgs; [
font-awesome
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
];
nixpkgs.overlays = with pkgs; [ ( final: prev:
{
keyd = prev.keyd.overrideAttrs (old: {
src = (fetchFromGitHub {
owner = "rvaiya";
repo = "keyd";
rev = "2c288d0e998c4f0c59cd748aa0630f6be5330af5";
hash = "sha256-D7nf1SWT23Ytw+gHeEd5bXqc021JI2GN05WJNW78mQU=";
});
});
# alsa-ucm-conf = prev.alsa-ucm-conf.overrideAttrs (old: {
# wttsrc = (fetchFromGitHub {
# owner = "WeirdTreeThing";
# repo = "chromebook-ucm-conf";
# rev = "6d8835f89c7c7e5fac7b6aaea0e36a6b1d1e4be5";
# hash = "sha256-XQ/kRN1xHEAcykbKpE26mNZXwqEbkh++ZuJeCAiu9ho=";
# });
# installPhase = ''
# runHook preInstall
#
# mkdir -p $out/share/alsa
# cp -r ucm ucm2 $out/share/alsa
#
# mkdir -p $out/share/alsa/ucm2/conf.d
# cp -r $wttsrc/common/pcm $wttsrc/adl/* $out/share/alsa/ucm2/conf.d
#
# runHook postInstall
# '';
# });
})];
environment.sessionVariables = {
ALSA_CONFIG_UCM2 = "${pkgs.alsa-ucm-conf}/share/alsa/ucm2";
};
environment.systemPackages = with pkgs; [
(callPackage ./chromebook-ucm-conf.nix {})
#alsa-ucm-conf
brightnessctl
dig
dmidecode
git
keyd
mosh
ncdu
pciutils
strace
tmux
usbutils
unzip
util-linux
];
services = {
avahi = {
enable = false;
nssmdns4 = true;
openFirewall = true;
publish.enable = false;
};
#fwupd.enable = true;
#hardware.bolt.enable = true;
keyd = {
enable = true;
keyboards.internal = {
ids = [ "0001:0001" ];
settings = {
main = {
back = "f1";
refresh = "f2";
zoom = "f3";
scale = "f4";
sysrq = "f5";
brightnessdown = "f6";
brightnessup = "f7";
kbdillumtoggle = "f8";
playpause = "f9";
mute = "f10";
volumedown = "f11";
volumeup = "f12";
};
meta = {
f1 = "f1";
f2 = "f2";
f3 = "f3";
f4 = "f4";
f5 = "f5";
f6 = "f6";
f7 = "f7";
f8 = "f8";
f9 = "f9";
f10 = "f10";
f11 = "f11";
f12 = "f12";
up = "pageup";
down = "pagedown";
left = "back";
right = "forward";
backspace = "delete";
};
};
};
};
openssh.enable = true;
pcscd.enable = true;
pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
printing.enable = false;
resolved = {
llmnr = "false";
};
tailscale = {
enable = false;
useRoutingFeatures = "client";
};
auto-cpufreq.enable = true;
thermald.enable = true;
tlp.enable = lib.mkForce false;
};
powerManagement.powertop.enable = true;
programs = {
adb.enable = true;
htop = {
enable = true;
settings = {
hide_kernel_threads=0;
hide_userland_threads=1;
show_program_path=0;
tree_view=1;
};
};
firefox.enable = true;
mtr.enable = true;
nano.enable = false;
nix-ld.enable = true;
neovim = {
enable = true;
viAlias = true;
vimAlias = true;
configure = {
customRC = ''
set backupdir=~/.vim/backups
'';
packages.myPlugins = with pkgs.vimPlugins; {
start = [ "vim-nix" ];
};
};
};
sway.enable = true;
};
hardware = {
bluetooth.enable = true;
bluetooth.powerOnBoot = true;
#enableAllFirmware = true;
enableRedistributableFirmware = true;
};
#sound.enable = true;
services.blueman.enable = true;
environment.etc = {
"libinput/local-overrides.quirks".text = ''
[Google Chromebook Banshee]
MatchUdevType=touchpad
MatchName=PNP0C50:00 093A:0274 Touchpad
MatchDMIModalias=dmi:*svnGoogle:*pnBanshee*
ModelChromebook=1
AttrPressureRange=6:4
'';
"wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
bluez_monitor.properties = {
["bluez5.enable-sbc-xq"] = true,
["bluez5.enable-msbc"] = true,
["bluez5.enable-hw-volume"] = true,
["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
}
'';
};
security = {
sudo-rs = {
enable = true;
wheelNeedsPassword = false;
execWheelOnly = true;
};
rtkit.enable = true;
};
# 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?
}

80
disks.nix Normal file
View File

@ -0,0 +1,80 @@
{
disko.devices = {
disk = {
nvme = {
type = "disk";
device = "/dev/disk/by-id/nvme-eui.e8238fa6bf530001001b448b4b3750aa";
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
label = "boot";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "fmask=0077" "dmask=0077" "defaults" ];
};
};
luks = {
size = "100%";
content = {
type = "luks";
name = "crypted";
passwordFile = "/tmp/secret.key";
settings = {
allowDiscards = true;
};
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "defaults" "compress=zstd" "noatime" ];
};
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "defaults" "compress=zstd" "noatime" ];
};
"/nixos-config" = {
mountpoint = "/etc/nixos";
mountOptions = [ "defaults" "compress=zstd" "noatime" ];
};
};
};
};
};
};
};
};
};
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
"mode=755"
];
};
};
};
fileSystems."/persist" = {
neededForBoot = true;
};
services = {
btrfs.autoScrub = {
enable = false;
interval = "weekly";
};
fstrim.enable = true;
};
#system.activationScripts = {
# fix-var-run-bad.text = ''
# mkdir -p /var
# ln -sf /var/run /run
# '';
#};
}

95
flake.lock Normal file
View File

@ -0,0 +1,95 @@
{
"nodes": {
"disko": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1706302763,
"narHash": "sha256-Le1wk75qlzOSfzDk8vqYxSdoEyr/ORIbMhziltVNGYw=",
"owner": "nix-community",
"repo": "disko",
"rev": "f7424625dc1f2e4eceac3009cbd1203d566feebc",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"impermanence": {
"locked": {
"lastModified": 1703656108,
"narHash": "sha256-hCSUqdFJKHHbER8Cenf5JRzjMlBjIdwdftGQsO0xoJs=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "033643a45a4a920660ef91caa391fbffb14da466",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "impermanence",
"type": "github"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1706182238,
"narHash": "sha256-Ti7CerGydU7xyrP/ow85lHsOpf+XMx98kQnPoQCSi1g=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "f84eaffc35d1a655e84749228cde19922fcf55f1",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "master",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1706173671,
"narHash": "sha256-lciR7kQUK2FCAYuszyd7zyRRmTaXVeoZsCyK6QFpGdk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4fddc9be4eaf195d631333908f2a454b03628ee5",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1706371002,
"narHash": "sha256-dwuorKimqSYgyu8Cw6ncKhyQjUDOyuXoxDTVmAXq88s=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c002c6aa977ad22c60398daaa9be52f2203d0006",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"disko": "disko",
"impermanence": "impermanence",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_2"
}
}
},
"root": "root",
"version": 7
}

23
flake.nix Normal file
View File

@ -0,0 +1,23 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
disko.url = "github:nix-community/disko";
impermanence.url = "github:nix-community/impermanence";
};
outputs = { nixpkgs, nixos-hardware, disko, impermanence, ... }: {
nixosConfigurations = {
"puppy" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
disko.nixosModules.disko
impermanence.nixosModules.impermanence
nixos-hardware.nixosModules.common-cpu-intel
#nixos-hardware.nixosModules.common-pc-laptop-ssd
./configuration.nix
];
};
};
};
}

View File

@ -0,0 +1,26 @@
# 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 = [ ];
# 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.enp0s20f0u3.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}