laptop config, flakes config #1

Merged
david merged 1 commits from laptop into main 2023-08-11 22:59:38 +00:00
19 changed files with 2134 additions and 97 deletions
+2 -1
View File
@@ -1 +1,2 @@
hardware-configuration.nix secrets/*
result
-96
View File
@@ -1,96 +0,0 @@
{ config, pkgs, ... }:
{
imports =
[
./hardware-configuration.nix
];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.initrd.secrets = {
"/crypto_keyfile.bin" = null;
};
boot.initrd.luks.devices."luks-3d0f669d-7bb4-49e4-abe2-03872cc1d507".keyFile = "/crypto_keyfile.bin";
networking.hostName = "desktop";
networking.networkmanager.enable = true;
time.timeZone = "America/New_York";
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";
};
services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.xserver = {
layout = "us";
xkbVariant = "";
};
services.printing.enable = true;
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
users.users.david = {
isNormalUser = true;
description = "David";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
firefox
thunderbird
sparrow
freecad
];
};
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
vim
wget
git
gnome.gnome-tweaks
gnomeExtensions.appindicator
];
environment.udev.packages = with pkgs; [
gnome.gnome-settings-daemon
];
environment.gnome.excludePackages = (with pkgs; [
gnome-tour
]) ++ (with pkgs.gnome; [
cheese
gnome-music
epiphany
geary
tali
iagno
hitori
atomix
]);
system.stateVersion = "23.05";
}
Generated
+48
View File
@@ -0,0 +1,48 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1691672736,
"narHash": "sha256-HNPA/dKHerA0p4OsToEcW/DtTSXBcK5gFRsy/yPgV/Y=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "6e1eff9aac0e8d84bda7f2d60ba6108eea9b7e79",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1691654369,
"narHash": "sha256-gSILTEx1jRaJjwZxRlnu3ZwMn1FVNk80qlwiCX8kmpo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ce5e4a6ef2e59d89a971bc434ca8ca222b9c7f5e",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
+21
View File
@@ -0,0 +1,21 @@
{
description = "NixOS Configuration Files";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ { self, nixpkgs, home-manager, ... }:
let
username = "david";
in
{
nixosConfigurations = (
import ./machines { inherit (nixpkgs) lib; inherit inputs nixpkgs home-manager username; }
);
};
}
+77
View File
@@ -0,0 +1,77 @@
{ config, lib, pkgs, inputs, username, ... }:
{
imports = [ ../modules/services/gpg.nix ];
nixpkgs.config.allowUnfree = true;
programs.zsh.enable = true;
users.users.${username} = {
isNormalUser = true;
extraGroups = [ "networkmanager" "wheel" ];
shell = pkgs.zsh;
};
environment.systemPackages = with pkgs; [
git
htop
lsof
tree
unzip
wget
zip
];
time.timeZone = "America/New_York";
i18n.defaultLocale = "en_US.utf8";
nix = {
package = pkgs.nixFlakes;
settings.auto-optimise-store = true;
registry.nixpkgs.flake = inputs.nixpkgs;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
services = {
pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
};
xserver = {
enable = true;
layout = "us";
xkbVariant = "";
libinput.enable = true;
displayManager = {
defaultSession = "xsession";
session = [{
manage = "desktop";
name = "xsession";
start = ''
exec $HOME/.xsession &
waitPID=$!
'';
}];
};
};
};
fonts.packages = [ pkgs.corefonts ];
sound.enable = true;
hardware.pulseaudio.enable = false;
modules.gpg.enable = true;
system.stateVersion = "23.05";
}
+38
View File
@@ -0,0 +1,38 @@
{ lib, inputs, nixpkgs, home-manager, username, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; config.allowUnfree = true; };
lib = nixpkgs.lib;
in
{
desktop = lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs username; };
modules = [
./desktop
./configuration.nix
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit username; };
home-manager.users.${username}.imports = [(import ./home.nix)] ++ [(import ./desktop/home.nix)];
}
];
};
laptop = lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs username; };
modules = [
./laptop
./configuration.nix
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit username; };
home-manager.users.${username}.imports = [(import ./home.nix)] ++ [(import ./laptop/home.nix)];
}
];
};
}
+30
View File
@@ -0,0 +1,30 @@
{ pkgs, lib, username, ... }:
{
imports = [ ./hardware-configuration.nix ./services.nix ];
networking.hostName = "desktop";
networking.networkmanager.enable = true;
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ ];
networking.firewall.allowedUDPPorts = [ ];
hardware.bluetooth.enable = false;
boot.loader = {
systemd-boot.enable = true;
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
};
boot.initrd = {
secrets."/crypto_keyfile.bin" = null;
luks.devices."luks-3d0f669d-7bb4-49e4-abe2-03872cc1d507" = {
device = "/dev/disk/by-uuid/3d0f669d-7bb4-49e4-abe2-03872cc1d507";
keyFile = "/crypto_keyfile.bin";
};
};
}
@@ -0,0 +1,45 @@
# 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" "ahci" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/f6edfa5b-399b-45d2-bc71-8f91ce6b78cf";
fsType = "ext4";
};
boot.initrd.luks.devices."luks-345b2b05-ff46-438a-bc0e-033afd29b7d5".device = "/dev/disk/by-uuid/345b2b05-ff46-438a-bc0e-033afd29b7d5";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/1DDD-79E1";
fsType = "vfat";
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/1ecc48d0-d935-4170-9708-784f5745cbea";
fsType = "ext4";
};
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.enp6s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp5s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
+11
View File
@@ -0,0 +1,11 @@
{ pkgs, ... }:
{
imports = [
../../modules/home/git.nix
../../modules/home/zsh.nix
];
modules.git.enable = true;
modules.zsh.enable = true;
}
+5
View File
@@ -0,0 +1,5 @@
{ pkgs, ... }:
{
imports = [];
}
+29
View File
@@ -0,0 +1,29 @@
{ config, lib, pkgs, username, ... }:
{
programs.home-manager.enable = true;
programs.keychain.enable = true;
programs.keychain.enableZshIntegration = true;
programs.direnv.enable = true;
programs.direnv.enableZshIntegration = true;
home = {
username = "${username}";
homeDirectory = "/home/${username}";
stateVersion = "23.05";
file.".config/nixpkgs/config.nix" = {
text = ''
{ allowUnfree = true; }
'';
};
sessionPath = [
"$HOME/go/bin"
"$HOME/.local/bin"
"$HOME/bin"
];
};
}
+34
View File
@@ -0,0 +1,34 @@
{ pkgs, lib, username, ... }:
{
imports = [ ./hardware-configuration.nix ./services.nix ];
networking.hostName = "laptop";
networking.networkmanager.enable = true;
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ ];
networking.firewall.allowedUDPPorts = [ ];
hardware.bluetooth.enable = true;
boot.loader = {
systemd-boot.enable = true;
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
};
boot.initrd = {
secrets."/crypto_keyfile.bin" = null;
luks.devices."luks-ff01c3e8-9da4-42d8-8be9-e92713f1bebf" = {
device = "/dev/disk/by-uuid/dff01c3e8-9da4-42d8-8be9-e92713f1bebf";
keyFile = "/crypto_keyfile.bin";
};
luks.devices."luks-7e6d719a-de54-44fe-a70b-6077a8a78003" = {
device = "/dev/disk/by-uuid/7e6d719a-de54-44fe-a70b-6077a8a78003";
keyFile = "/root/swap.key";
};
};
}
@@ -0,0 +1,40 @@
# 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" "nvme" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/d4974532-75bd-468d-9128-a340ae38c6d5";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/ADC9-9731";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/fdcdd6df-b1d5-45e2-9e2a-8249473868b3"; }
];
# 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.wlp0s20f3.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;
}
+11
View File
@@ -0,0 +1,11 @@
{ pkgs, ... }:
{
imports = [
../../modules/home/git.nix
../../modules/home/zsh.nix
];
modules.git.enable = true;
modules.zsh.enable = true;
}
+5
View File
@@ -0,0 +1,5 @@
{ pkgs, ... }:
{
imports = [];
}
+35
View File
@@ -0,0 +1,35 @@
{ config, lib, pkgs, ... }:
with lib;
{
options.modules.git = {
enable = mkOption { type = types.bool; default = false; };
};
config = mkIf config.modules.git.enable {
home.packages = with pkgs; [ git ];
home.file.".gitconfig" = {
executable = false;
text = ''
[user]
email = david@dvdt.dev
name = David Lick
[color]
ui = true
'';
};
home.file.".ssh/config" = {
executable = false;
text = ''
Host git.dvdt.dev
User git
Hostname git.dvdt.dev
IdentityFile ~/.ssh/gitea_ed25519
IdentitiesOnly true
'';
};
};
}
+39
View File
@@ -0,0 +1,39 @@
{ config, lib, pkgs, ... }:
with lib;
{
options.modules.zsh = {
enable = mkOption { type = types.bool; default = false; };
};
config = mkIf config.modules.zsh.enable {
home.packages = with pkgs; [ zsh ];
home.file.".p10k.zsh".source = ./zsh/.p10k.zsh;
programs.zsh = {
enable = true;
autocd = true;
enableCompletion = true;
enableAutosuggestions = true;
prezto = {
enable = true;
prompt.theme = "powerlevel10k";
editor.keymap = "vi";
syntaxHighlighting.highlighters = [ "main" "brackets" "pattern" "line" "cursor" "root" ];
terminal = {
autoTitle = true;
multiplexerTitleFormat = "%s";
tabTitleFormat = "%s";
windowTitleFormat = "%s";
};
utility.safeOps = true;
};
initExtraFirst = ''
if [ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then . "$HOME/.nix-profile/etc/profile.d/nix.sh"; fi
'';
};
};
}
File diff suppressed because it is too large Load Diff
+19
View File
@@ -0,0 +1,19 @@
{ pkgs, lib, config, ... }:
with lib;
{
options.modules.gpg = {
enable = mkOption { type = types.bool; default = false; };
openFirewall = mkOption { type = types.bool; default = false; };
};
config = mkIf config.modules.gpg.enable {
environment.systemPackages = [ pkgs.pinentry-curses ];
services.pcscd.enable = true;
programs.gnupg.agent = {
enable = true;
pinentryFlavor = "curses";
enableSSHSupport = true;
};
};
}