Add initial configuration.

This commit is contained in:
Jacob Hinkle 2022-08-30 12:29:32 -04:00
parent 2165cc1f4f
commit e81a1bd530
8 changed files with 1065 additions and 0 deletions

113
flake.lock generated Normal file
View File

@ -0,0 +1,113 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"narHash": "sha256-Nlnm4jeQWEGjYrE6hxi/7HYHjBSZ/E0RtjCYifnNsWk=",
"type": "tarball",
"url": "https://github.com/nix-community/home-manager/archive/release-22.05.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/nix-community/home-manager/archive/release-22.05.tar.gz"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1660407119,
"narHash": "sha256-04lWO0pDbhAXFdL4v2VzzwgxrZ5IefKn+TmZPiPeKxg=",
"owner": "nixos",
"repo": "nixos-hardware",
"rev": "12620020f76b1b5d2b0e6fbbda831ed4f5fe56e1",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "master",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1661788116,
"narHash": "sha256-bLPHlcCGZYojB/Z7L/lmbLAMsxGgqrFhlxF0jMsIm/I=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "cc634d9aa08ed89c9ff655de06ab2e593c72ebc1",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-22.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-22_05": {
"locked": {
"lastModified": 1661656705,
"narHash": "sha256-1ujNuL1Tx1dt8dC/kuYS329ZZgiXXmD96axwrqsUY7w=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "290dbaacc1f0b783fd8e271b585ec2c8c3b03954",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "release-22.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1661353537,
"narHash": "sha256-1E2IGPajOsrkR49mM5h55OtYnU0dGyre6gl60NXKITE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0e304ff0d9db453a4b230e9386418fd974d5804a",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs",
"sops-nix": "sops-nix"
}
},
"sops-nix": {
"inputs": {
"nixpkgs": "nixpkgs_2",
"nixpkgs-22_05": "nixpkgs-22_05"
},
"locked": {
"lastModified": 1661660105,
"narHash": "sha256-3ITdkYwsNDh2DRqi7FZOJ92ui92NmcO6Nhj49u+JjWY=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "d92fba1bfc9f64e4ccb533701ddd8590c0d8c74a",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "sops-nix",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

54
flake.nix Normal file
View File

@ -0,0 +1,54 @@
{
description = "NixOS configurations for my machines";
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixos-22.05;
nixos-hardware.url = github:nixos/nixos-hardware/master;
home-manager = {
#url = "github:nix-community/home-manager";
url = "https://github.com/nix-community/home-manager/archive/release-22.05.tar.gz";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix.url = github:Mic92/sops-nix;
};
outputs = inputs @ { self, nixpkgs, nixos-hardware, home-manager, sops-nix, ... }:
let
system = "x86_64-linux";
homeManagerConfFor = config: { ... }: {
#nixpkgs.overlays = [ nur.overlay ];
imports = [ config ];
};
in {
nixosConfigurations = {
# Thinkpad T470 laptop
buck = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
nixos-hardware.nixosModules.lenovo-thinkpad-t470s
./machines/buck/configuration.nix
home-manager.nixosModules.home-manager {
home-manager.useUserPackages = true;
home-manager.users.jacob = homeManagerConfFor ./home/jacob.nix;
}
sops-nix.nixosModules.sops
];
};
# ThinkCentre M700 mini-pc (server)
pedro = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
nixos-hardware.nixosModules.common-pc-hdd
nixos-hardware.nixosModules.common-cpu-intel-cpu-only
./machines/pedro/configuration.nix
home-manager.nixosModules.home-manager {
home-manager.useUserPackages = true;
home-manager.users.jacob = homeManagerConfFor ./home/jacob.nix;
}
sops-nix.nixosModules.sops
];
};
};
};
}

85
home/i3.nix Normal file
View File

@ -0,0 +1,85 @@
pkgs :
rec {
menu = "${pkgs.dmenu}/bin/dmenu_run";
modifier = "Mod1";
terminal = "kitty";
keybindings = let
browser = "firefox";
scrot2clip = pkgs.writeShellScript "scrot2clip"
"${pkgs.scrot}/bin/scrot -s - | ${pkgs.xclip}/bin/xclip -selection primary -i -t image/png";
in {
"${modifier}+Return" = "exec ${terminal} tmux new";
"${modifier}+Shift+Return" = "exec ${terminal}";
"${modifier}+Shift+q" = "kill";
"${modifier}+d" = "exec ${menu}";
"${modifier}+apostrophe" = "exec ${browser}";
"${modifier}+j" = "focus left";
"${modifier}+k" = "focus down";
"${modifier}+l" = "focus up";
"${modifier}+semicolon" = "focus right";
"${modifier}+Shift+j" = "move left";
"${modifier}+Shift+k" = "move down";
"${modifier}+Shift+l" = "move up";
"${modifier}+Shift+semicolon" = "move right";
"${modifier}+h" = "split h";
"${modifier}+v" = "split v";
"${modifier}+f" = "fullscreen toggle";
"${modifier}+s" = "layout stacking";
"${modifier}+w" = "layout tabbed";
"${modifier}+e" = "layout toggle split";
"${modifier}+Shift+space" = "floating toggle";
"${modifier}+space" = "focus mode_toggle";
"${modifier}+a" = "focus parent";
"${modifier}+z" = "focus child";
"${modifier}+Shift+s" = "exec ${scrot2clip}";
"${modifier}+Shift+minus" = "move scratchpad";
"${modifier}+minus" = "scratchpad show";
"${modifier}+1" = "workspace number 1";
"${modifier}+2" = "workspace number 2";
"${modifier}+3" = "workspace number 3";
"${modifier}+4" = "workspace number 4";
"${modifier}+5" = "workspace number 5";
"${modifier}+6" = "workspace number 6";
"${modifier}+7" = "workspace number 7";
"${modifier}+8" = "workspace number 8";
"${modifier}+9" = "workspace number 9";
"${modifier}+0" = "workspace number 10";
"${modifier}+Shift+1" =
"move container to workspace number 1";
"${modifier}+Shift+2" =
"move container to workspace number 2";
"${modifier}+Shift+3" =
"move container to workspace number 3";
"${modifier}+Shift+4" =
"move container to workspace number 4";
"${modifier}+Shift+5" =
"move container to workspace number 5";
"${modifier}+Shift+6" =
"move container to workspace number 6";
"${modifier}+Shift+7" =
"move container to workspace number 7";
"${modifier}+Shift+8" =
"move container to workspace number 8";
"${modifier}+Shift+9" =
"move container to workspace number 9";
"${modifier}+Shift+0" =
"move container to workspace number 10";
"${modifier}+Shift+c" = "reload";
"${modifier}+Shift+r" = "restart";
"${modifier}+Shift+e" =
"exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
"${modifier}+r" = "mode resize";
};
}

236
home/jacob.nix Normal file
View File

@ -0,0 +1,236 @@
{ config, pkgs, ... }:
{
imports = [
({ lib, ...}: {
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"zoom"
];
})
];
# Home Manager needs a bit of information about you and the
# paths it should manage.
home = {
username = "jacob";
homeDirectory = "/home/jacob";
keyboard = {
layout = "us";
options = [ "caps:swapescape" "ctrl:ralt_rctrl" ];
};
packages = with pkgs; [
age
bitwarden
chromium
feh
file
#freecad
#gnumake
hack-font
inconsolata
libreoffice
logseq
mupdf
#nyxt
#openscad
#pandoc
pavucontrol
scli
scrot
signal-desktop
sops
spotify-tui
sxiv
#texlive.combined.scheme-full
xclip
zoom-us
];
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
stateVersion = "22.05";
};
accounts.email = {
accounts.gmail = {
address = "jacob.hinkle@gmail.com";
passwordCommand = "${pkgs.coreutils}/bin/cat /run/secrets/email/gmail/password";
flavor = "gmail.com";
mbsync = {
enable = false;
create = "maildir";
};
notmuch.enable = false;
primary = true;
realName = "Jacob Hinkle";
};
accounts.jhink = {
address = "jacob.hinkle@jhink.org";
imap.host = "mail.privateemail.com";
smtp.host = "mail.privateemail.com";
flavor = "plain";
userName = "jacob.hinkle@jhink.org";
passwordCommand = "${pkgs.coreutils}/bin/cat /run/secrets/email/jhink/password";
mbsync = {
enable = true;
create = "maildir";
};
notmuch.enable = true;
realName = "Jacob Hinkle";
};
};
programs = {
bat = {
enable = true;
};
direnv = {
enable = true;
enableZshIntegration = true;
};
firefox = {
enable = true;
package = pkgs.firefox.override {
cfg = {
enableTridactylNative = true;
};
};
};
git = {
enable = true;
userName = "Jacob Hinkle";
userEmail = "jacob.hinkle@jhink.org";
lfs.enable = true;
delta.enable = true;
};
htop = {
enable = true;
};
kitty = {
enable = true;
font = {
name = "Hack";
size = 26;
};
};
mbsync = {
enable = true;
};
neovim = {
enable = true;
plugins = with pkgs.vimPlugins; [
vim-nix
];
};
rbw = {
enable = true;
settings.email = "jacob.hinkle@gmail.com";
};
ssh = {
enable = true;
matchBlocks = {
login1 = {
hostname = "login1.ornl.gov";
user = "4jh";
};
lucky = {
hostname = "lucky.ornl.gov";
user = "4jh";
proxyJump = "login1";
};
murdock = {
hostname = "murdock.ornl.gov";
user = "4jh";
proxyJump = "login1";
};
};
};
tmux = {
enable = true;
aggressiveResize = true;
clock24 = true;
escapeTime = 0;
historyLimit = 10000;
keyMode = "vi";
shortcut = "a";
terminal = "kitty";
extraConfig = ''
unbind [
bind Escape copy-mode
bind f set-option status
bind c new-window -c "#{pane_current_path}"
# Set status bar
set -g status-position bottom
set -g status-style fg=white
set -g status-left '#[fg=green]#(who -s | awk "{ print \$1}" | sort -u | grep -v 4jh | xargs echo) #[fg=black,bright]#H'
# TODO: highlighted for nested local session as well
wg_is_keys_off="#[fg=red,bright]#([ $(tmux show-option -qv key-table) = 'off' ] && echo 'PASSTHRU')#[default]"
set -g status-right "#[fg=yellow,bright]#S $wg_is_keys_off #[fg=green,dim]%H:%M"
set-window-option -g window-status-current-style fg=red
# align center the window list
set -g status-justify centre
'';
};
zsh = {
enable = true;
enableSyntaxHighlighting = true;
shellAliases = {
vim = "nvim";
};
sessionVariables = {
EDITOR = "nvim";
};
oh-my-zsh = {
enable = true;
plugins = [
"git" "sudo" "vi-mode"
];
theme = "clean";
};
};
};
services = {
spotifyd = {
enable = true;
settings = {
global = {
username_cmd = "${pkgs.coreutils}/bin/cat /run/secrets/spotify/username";
password_cmd = "${pkgs.coreutils}/bin/cat /run/secrets/spotify/password";
backend = "pulseaudio";
device = "pipewire";
device_name = "pedro";
device_type = "computer";
};
};
};
syncthing = {
enable = true;
# cause the tray command to wait for the service and tray manager to start
#extraOptions = [ "--wait" ];
tray.enable = false;
};
unclutter = {
enable = true;
};
};
xsession = {
enable = true;
windowManager.i3 = {
enable = true;
config = import ./i3.nix pkgs;
};
};
}

View File

@ -0,0 +1,182 @@
# 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).
{ config, pkgs, sops, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
sops = {
# This will add secrets.yml to the nix store
# You can avoid this by adding a string to the full path instead, i.e.
# sops.defaultSopsFile = "/root/.sops/secrets/example.yaml";
defaultSopsFile = ../../secrets.yaml;
# This will automatically import SSH keys as age keys
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
# This is using an age key that is expected to already be in the filesystem
#age.keyFile = "/var/lib/sops-nix/key.txt";
# This will generate a new key if the key specified above does not exist
#age.generateKey = true;
# This is the actual specification of the secrets.
secrets."pihole/webpassword" = {};
secrets."spotify/username".owner = "jacob";
secrets."spotify/password".owner = "jacob";
secrets."email/gmail/password".owner = "jacob";
secrets."email/jhink/password".owner = "jacob";
secrets."wifi.env" = {};
};
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot/efi";
networking.hostName = "buck"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.wireless = {
enable = true;
userControlled.enable = true;
environmentFile = "/run/secrets/wifi.env";
networks = {
"@SSID_HOME@" = {
pskRaw = "@PSK_HOME@";
};
};
};
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
#networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "America/New_York";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.utf8";
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
programs = {
gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
};
# List services that you want to enable:
# Enable sound.
sound.enable = true;
#hardware.raspberry-pi."4".fkms-3d.enable = true;
# Enable touchpad support (enabled default in most desktopManager). services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.jacob = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable sudo for the user.
shell = pkgs.zsh;
};
security.rtkit.enable = true; # recommended for pipewire
# List services that you want to enable:
services = {
# Enable the OpenSSH daemon.
openssh.enable = true;
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Enable the X11 windowing system. services.xserver.enable = true;
xserver = {
enable = true;
#dpi = 180;
displayManager = {
defaultSession = "none+i3";
autoLogin = {
enable = true;
user = "jacob";
};
lightdm = {
enable = true;
greeter.enable = false;
};
};
libinput = {
enable = true;
touchpad = {
naturalScrolling = true;
disableWhileTyping = true;
};
};
windowManager.i3 = {
enable = true;
extraPackages = with pkgs; [
dmenu #application launcher most people use
i3status # gives you the default i3 status bar
i3lock #default i3 screen locker
i3blocks #if you are planning on using i3blocks over i3status
];
};
};
};
services.acpid.enable = true;
services.thermald.enable = true;
services.fwupd.enable = true;
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# 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 = "22.05"; # Did you read the comment?
nix = {
maxJobs = 8;
gc = {
automatic = true;
};
settings.experimental-features = [ "nix-command" "flakes" ];
};
}

View File

@ -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" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/cc13728f-a446-49db-98fc-51db875bba20";
fsType = "ext4";
};
fileSystems."/boot/efi" =
{ device = "/dev/disk/by-uuid/164F-882B";
fsType = "vfat";
};
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.enp0s31f6.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true;
hardware.video.hidpi.enable = true;
powerManagement.cpuFreqGovernor = "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@ -0,0 +1,246 @@
# 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).
{ config, pkgs, options, sops, ... }:
{ imports =
[ # Include the results of the hardware scan.
./hardware-configuration-zfs.nix
];
sops = {
# This will add secrets.yml to the nix store
# You can avoid this by adding a string to the full path instead, i.e.
# sops.defaultSopsFile = "/root/.sops/secrets/example.yaml";
defaultSopsFile = ../../secrets.yaml;
# This will automatically import SSH keys as age keys
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
# This is using an age key that is expected to already be in the filesystem
#age.keyFile = "/var/lib/sops-nix/key.txt";
# This will generate a new key if the key specified above does not exist
#age.generateKey = true;
# This is the actual specification of the secrets.
secrets."pihole/webpassword" = {};
secrets."spotify/username".owner = "jacob";
secrets."spotify/password".owner = "jacob";
secrets."email/gmail/password".owner = "jacob";
secrets."email/jhink/password".owner = "jacob";
};
boot = {
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
loader = {
# Enables the generation of /extlinux/extlinux.conf grub.enable = true;
#grub.version = 2; grub.device = "/dev/sda"; grub.efiSupport = true;
systemd-boot.enable = true;
};
# ZFS settings
initrd.availableKernelModules = [ "usbhid" "usb_storage" ]; initrd.supportedFilesystems = [ "zfs" ]; # boot from zfs supportedFilesystems = [ "zfs" ]; zfs.devNodes = "/dev/";
};
# Set your time zone.
time.timeZone = "America/New_York";
networking = {
hostName = "pedro"; # Define your hostname.
# networking.hostId is required for ZFS
hostId = "d9aef7b3";
# The global useDHCP flag is deprecated, therefore explicitly set to false here. Per-interface useDHCP will be mandatory in the future, so this generated config replicates the default behaviour.
useDHCP = false;
interfaces.eth0.useDHCP = true;
interfaces.wlan0.useDHCP = true;
wireless = {
enable = true;
userControlled.enable = true;
environmentFile = "/run/secrets/wifi.env";
networks = {
"@SSID_HOME@" = {
pskRaw = "@PSK_HOME@";
};
};
};
firewall = {
allowedTCPPorts = [
8384 22000 # syncthing
8080 8443 6789 8880 8843 27117 # unifi controller: https://help.ui.com/hc/en-us/articles/218506997-UniFi-Network-Required-Ports-Reference
53 8088 # pihole
3000 # gitea
];
allowedUDPPorts = [
22000 21027 # syncthing
3478 5514 10001 1900 123 # unifi
53 # pihole
];
allowedUDPPortRanges = [
{ from = 5656; to = 5699; } # unifi
];
};
timeServers = [ "192.168.88.1" ] ++ options.networking.timeServers.default;
};
hardware.video.hidpi.enable = false;
hardware.enableRedistributableFirmware = true;
#hardware.pulseaudio = {
#enable = true;
#extraModules = [ pkgs.pulseaudio-modules-bt ];
#package = pkgs.pulseaudioFull;
#};
hardware.bluetooth.enable = false;
services.blueman.enable = false;
# Enable CUPS to print documents.
services.printing.enable = false;
# Enable sound.
sound.enable = false;
# Define a user account. Don't forget to set a password with passwd.
users.users.jacob = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable sudo for the user.
shell = pkgs.zsh;
};
# List packages installed in system profile. To search, run: $ nix search wget
environment.systemPackages = with pkgs; [ vim git wget ];
#environment.variables = {
#GDK_SCALE = "2";
#GDK_DPI_SCALE = "0.5";
#_JAVA_OPTIONS = "-Dsun.java2d.uiScale=2";
#};
# Some programs need SUID wrappers, can be configured further or are started in user sessions. programs.mtr.enable = true; programs.gnupg.agent = {
# enable = true; enableSSHSupport = true;
# };
security.rtkit.enable = true; # recommended for pipewire
virtualisation.oci-containers.containers = let
serverIP = "192.168.88.21";
in {
pihole = {
image = "pihole/pihole:2022.07.1";
ports = [
"${serverIP}:53:53/tcp"
"${serverIP}:53:53/udp"
"8088:80"
"4438:443"
];
environment = {
TZ = "America/New_York";
ServerIP = serverIP;
WEBPASSWORD_FILE = "/run/secrets/pihole/webpassword";
};
#extraDockerOptions = [
##"--cap-add=NET_ADMIN"
#"--dns=127.0.0.1"
#"--dns=1.1.1.1"
#];
volumes = [
"/serverdata/pihole/etc/pihole:/etc/pihole"
"/serverdata/pihole/etc/dnsmasq.d:/etc/dnsmasq.d"
"/run/secrets/pihole:/run/secrets/pihole"
];
#workdir = "/serverdata/pihole/etc/pihole";
};
};
# List services that you want to enable:
services = {
chrony.enable = true;
gitea = {
enable = true;
lfs = {
enable = true;
contentDir = "/serverdata/gitea/lfs_content";
};
stateDir = "/serverdata/gitea";
};
# Enable the OpenSSH daemon.
openssh.enable = true;
paperless = {
enable = true;
};
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
unifi = {
enable = true;
openFirewall = true;
unifiPackage = pkgs.unifiStable;
};
# Enable the X11 windowing system.
xserver = {
enable = true;
dpi = 180;
displayManager = {
defaultSession = "none+i3";
autoLogin = {
enable = true;
user = "jacob";
};
lightdm = {
enable = true;
greeter.enable = false;
};
};
layout = "us";
libinput.enable = true;
windowManager.i3 = {
enable = true;
extraPackages = with pkgs; [
dmenu #application launcher most people use
i3status # gives you the default i3 status bar
i3lock #default i3 screen locker
i3blocks #if you are planning on using i3blocks over i3status
];
};
};
# ZFS services
zfs = {
trim.enable = true;
autoScrub = {
enable = true;
pools = [ "rpool" ];
};
autoSnapshot = {
enable = true;
frequent = 8;
monthly = 1;
};
};
};
# Due to bug in home assistant, this workaround is suggested temporarily as of May 6, 2022
# https://github.com/nix-community/home-manager/issues/2942#issuecomment-1119760100
#nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnfreePredicate = ( pkg: true );
powerManagement.cpuFreqGovernor = "ondemand";
# 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 = "22.05"; # Did you read the comment?
nix.settings.experimental-features = [ "nix-command" "flakes" ];
}

View File

@ -0,0 +1,109 @@
# 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" "ahci" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
# high-resolution display
hardware.video.hidpi.enable = lib.mkDefault true;
fileSystems."/" =
{ device = "none";
fsType = "tmpfs";
};
fileSystems."/boot" =
{
device = "/dev/disk/by-partuuid/e7ebac1e-eb4c-4a7d-8893-49a95f6014d4";
fsType = "vfat";
};
fileSystems."/nix" =
{ device = "rpool/nixos/nix";
fsType = "zfs";
options = [ "zfsutil" ];
};
fileSystems."/etc" =
{ device = "rpool/nixos/etc";
fsType = "zfs";
options = [ "zfsutil" ];
};
fileSystems."/var" =
{ device = "rpool/nixos/var";
fsType = "zfs";
options = [ "zfsutil" ];
};
fileSystems."/var/lib" =
{ device = "rpool/nixos/var/lib";
fsType = "zfs";
options = [ "zfsutil" ];
};
fileSystems."/var/log" =
{ device = "rpool/nixos/var/log";
fsType = "zfs";
options = [ "zfsutil" ];
};
fileSystems."/var/spool" =
{ device = "rpool/nixos/var/spool";
fsType = "zfs";
options = [ "zfsutil" ];
};
fileSystems."/serverdata/pihole" =
{ device = "rpool/serverdata/pihole";
fsType = "zfs";
options = [ "zfsutil" ];
};
fileSystems."/serverdata/gitea" =
{ device = "rpool/serverdata/gitea";
fsType = "zfs";
options = [ "zfsutil" ];
};
fileSystems."/serverdata/home-assistant" =
{ device = "rpool/serverdata/home-assistant";
fsType = "zfs";
options = [ "zfsutil" ];
};
fileSystems."/home" =
{ device = "rpool/userdata/home";
fsType = "zfs";
options = [ "zfsutil" ];
};
fileSystems."/root" =
{ device = "rpool/userdata/home/root";
fsType = "zfs";
options = [ "zfsutil" ];
};
fileSystems."/home/jacob" =
{ device = "rpool/userdata/home/jacob";
fsType = "zfs";
options = [ "zfsutil" ];
};
swapDevices = [
{
device = "/dev/disk/by-partuuid/6bf463d0-107f-489e-be29-704442ea3150";
randomEncryption = true;
}
];
}