Reformat nix code with alejandra

This commit is contained in:
Jacob Hinkle 2022-09-08 12:27:21 -04:00
parent 3f7ad45ebe
commit a897038529
10 changed files with 244 additions and 217 deletions

View File

@ -24,15 +24,20 @@
}; };
}; };
outputs = inputs @ { self, nixpkgs, nixos-hardware, home-manager, sops-nix, ... }: outputs = inputs @ {
let self,
nixpkgs,
nixos-hardware,
home-manager,
sops-nix,
...
}: let
system = "x86_64-linux"; system = "x86_64-linux";
homeManagerConfFor = config: {...}: { homeManagerConfFor = config: {...}: {
#nixpkgs.overlays = [ nur.overlay ]; #nixpkgs.overlays = [ nur.overlay ];
imports = [config]; imports = [config];
}; };
in { in {
nixosConfigurations = { nixosConfigurations = {
# Thinkpad T470 laptop # Thinkpad T470 laptop
buck = nixpkgs.lib.nixosSystem { buck = nixpkgs.lib.nixosSystem {
@ -40,7 +45,8 @@
modules = [ modules = [
nixos-hardware.nixosModules.lenovo-thinkpad-t470s nixos-hardware.nixosModules.lenovo-thinkpad-t470s
./machines/buck/configuration.nix ./machines/buck/configuration.nix
home-manager.nixosModules.home-manager { home-manager.nixosModules.home-manager
{
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.users.jacob = homeManagerConfFor ./home/jacob.nix; home-manager.users.jacob = homeManagerConfFor ./home/jacob.nix;
} }
@ -54,7 +60,8 @@
nixos-hardware.nixosModules.common-pc-hdd nixos-hardware.nixosModules.common-pc-hdd
nixos-hardware.nixosModules.common-cpu-intel-cpu-only nixos-hardware.nixosModules.common-cpu-intel-cpu-only
./machines/pedro/configuration.nix ./machines/pedro/configuration.nix
home-manager.nixosModules.home-manager { home-manager.nixosModules.home-manager
{
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.users.jacob = homeManagerConfFor ./home/jacob.nix; home-manager.users.jacob = homeManagerConfFor ./home/jacob.nix;
} }

View File

@ -1,11 +1,11 @@
pkgs : pkgs: rec {
rec {
menu = "${pkgs.dmenu}/bin/dmenu_run"; menu = "${pkgs.dmenu}/bin/dmenu_run";
modifier = "Mod1"; modifier = "Mod1";
terminal = "kitty"; terminal = "kitty";
keybindings = let keybindings = let
browser = "qutebrowser"; browser = "qutebrowser";
scrot2clip = pkgs.writeShellScript "scrot2clip" scrot2clip =
pkgs.writeShellScript "scrot2clip"
"${pkgs.scrot}/bin/scrot -s - | ${pkgs.xclip}/bin/xclip -selection primary -i -t image/png"; "${pkgs.scrot}/bin/scrot -s - | ${pkgs.xclip}/bin/xclip -selection primary -i -t image/png";
in { in {
"${modifier}+Return" = "exec ${terminal} tmux new"; "${modifier}+Return" = "exec ${terminal} tmux new";
@ -54,31 +54,20 @@ rec {
"${modifier}+9" = "workspace number 9"; "${modifier}+9" = "workspace number 9";
"${modifier}+0" = "workspace number 10"; "${modifier}+0" = "workspace number 10";
"${modifier}+Shift+1" = "${modifier}+Shift+1" = "move container to workspace number 1";
"move container to workspace number 1"; "${modifier}+Shift+2" = "move container to workspace number 2";
"${modifier}+Shift+2" = "${modifier}+Shift+3" = "move container to workspace number 3";
"move container to workspace number 2"; "${modifier}+Shift+4" = "move container to workspace number 4";
"${modifier}+Shift+3" = "${modifier}+Shift+5" = "move container to workspace number 5";
"move container to workspace number 3"; "${modifier}+Shift+6" = "move container to workspace number 6";
"${modifier}+Shift+4" = "${modifier}+Shift+7" = "move container to workspace number 7";
"move container to workspace number 4"; "${modifier}+Shift+8" = "move container to workspace number 8";
"${modifier}+Shift+5" = "${modifier}+Shift+9" = "move container to workspace number 9";
"move container to workspace number 5"; "${modifier}+Shift+0" = "move container to workspace number 10";
"${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+c" = "reload";
"${modifier}+Shift+r" = "restart"; "${modifier}+Shift+r" = "restart";
"${modifier}+Shift+e" = "${modifier}+Shift+e" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
"exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
"${modifier}+r" = "mode resize"; "${modifier}+r" = "mode resize";
}; };

View File

@ -1,8 +1,12 @@
{ config, pkgs, ... }:
{ {
config,
pkgs,
...
}: {
imports = [ imports = [
({lib, ...}: { ({lib, ...}: {
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
"zoom" "zoom"
]; ];
}) })
@ -58,8 +62,8 @@
stateVersion = "22.05"; stateVersion = "22.05";
}; };
accounts.email = { accounts.email.accounts = {
accounts.gmail = { gmail = {
address = "jacob.hinkle@gmail.com"; address = "jacob.hinkle@gmail.com";
passwordCommand = "${pkgs.coreutils}/bin/cat /run/secrets/email/gmail/password"; passwordCommand = "${pkgs.coreutils}/bin/cat /run/secrets/email/gmail/password";
flavor = "gmail.com"; flavor = "gmail.com";
@ -71,7 +75,7 @@
primary = true; primary = true;
realName = "Jacob Hinkle"; realName = "Jacob Hinkle";
}; };
accounts.jhink = { jhink = {
address = "jacob.hinkle@jhink.org"; address = "jacob.hinkle@jhink.org";
imap.host = "mail.privateemail.com"; imap.host = "mail.privateemail.com";
smtp.host = "mail.privateemail.com"; smtp.host = "mail.privateemail.com";
@ -132,6 +136,7 @@
vim-nix vim-nix
]; ];
}; };
#notmuch.enable = true;
qutebrowser = import ./qutebrowser.nix; qutebrowser = import ./qutebrowser.nix;
rbw = { rbw = {
enable = true; enable = true;
@ -223,7 +228,8 @@
xmonad = { xmonad = {
enable = true; enable = true;
enableContribAndExtras = true; enableContribAndExtras = true;
extraPackages = haskellPackages: with haskellPackages; [ extraPackages = haskellPackages:
with haskellPackages; [
#dbus #dbus
#List #List
#monad-logger #monad-logger

View File

@ -1,12 +1,14 @@
# Edit this configuration file to define what should be installed on # Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, sops, ... }:
{ {
imports = config,
[ # Include the results of the hardware scan. pkgs,
sops,
...
}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
@ -61,7 +63,6 @@
# Select internationalisation properties. # Select internationalisation properties.
i18n.defaultLocale = "en_US.utf8"; i18n.defaultLocale = "en_US.utf8";
# Allow unfree packages # Allow unfree packages
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;

View File

@ -1,11 +1,15 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/installer/scan/not-detected.nix") 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.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"];
@ -13,13 +17,13 @@
boot.kernelModules = ["kvm-intel"]; boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/cc13728f-a446-49db-98fc-51db875bba20"; device = "/dev/disk/by-uuid/cc13728f-a446-49db-98fc-51db875bba20";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot/efi" = fileSystems."/boot/efi" = {
{ device = "/dev/disk/by-uuid/164F-882B"; device = "/dev/disk/by-uuid/164F-882B";
fsType = "vfat"; fsType = "vfat";
}; };

View File

@ -1,9 +1,13 @@
# 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). # 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, ... }: config,
pkgs,
{ imports = options,
[ # Include the results of the hardware scan. sops,
...
}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration-zfs.nix ./hardware-configuration-zfs.nix
]; ];
@ -36,7 +40,8 @@
}; };
# ZFS settings # ZFS settings
initrd.availableKernelModules = [ "usbhid" "usb_storage" ]; initrd.supportedFilesystems = [ "zfs" ]; # boot from zfs supportedFilesystems = [ "zfs" ]; zfs.devNodes = "/dev/"; initrd.availableKernelModules = ["usbhid" "usb_storage"];
initrd.supportedFilesystems = ["zfs"]; # boot from zfs supportedFilesystems = [ "zfs" ]; zfs.devNodes = "/dev/";
}; };
# Set your time zone. # Set your time zone.
@ -63,21 +68,37 @@
}; };
firewall = { firewall = {
allowedTCPPorts = [ allowedTCPPorts = [
8384 22000 # syncthing 8384
8080 8443 6789 8880 8843 27117 # unifi controller: https://help.ui.com/hc/en-us/articles/218506997-UniFi-Network-Required-Ports-Reference 22000 # syncthing
53 8088 # pihole 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 #3000 # gitea
#8081 # vaultwarden #8081 # vaultwarden
#8000 # paperless #8000 # paperless
80 443 # reverse proxy 80
443 # reverse proxy
]; ];
allowedUDPPorts = [ allowedUDPPorts = [
22000 21027 # syncthing 22000
3478 5514 10001 1900 123 # unifi 21027 # syncthing
3478
5514
10001
1900
123 # unifi
53 # pihole 53 # pihole
]; ];
allowedUDPPortRanges = [ allowedUDPPortRanges = [
{ from = 5656; to = 5699; } # unifi {
from = 5656;
to = 5699;
} # unifi
]; ];
}; };
timeServers = ["192.168.88.1"] ++ options.networking.timeServers.default; timeServers = ["192.168.88.1"] ++ options.networking.timeServers.default;
@ -93,7 +114,6 @@
hardware.bluetooth.enable = false; hardware.bluetooth.enable = false;
services.blueman.enable = false; services.blueman.enable = false;
# Enable CUPS to print documents. # Enable CUPS to print documents.
services.printing.enable = false; services.printing.enable = false;
@ -234,4 +254,3 @@
nix.settings.experimental-features = ["nix-command" "flakes"]; nix.settings.experimental-features = ["nix-command" "flakes"];
} }

View File

@ -1,11 +1,15 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/installer/scan/not-detected.nix") lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"]; boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"];
@ -18,83 +22,82 @@
# high-resolution display # high-resolution display
hardware.video.hidpi.enable = lib.mkDefault true; hardware.video.hidpi.enable = lib.mkDefault true;
fileSystems."/" = fileSystems."/" = {
{ device = "none"; device = "none";
fsType = "tmpfs"; fsType = "tmpfs";
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{
device = "/dev/disk/by-partuuid/e7ebac1e-eb4c-4a7d-8893-49a95f6014d4"; device = "/dev/disk/by-partuuid/e7ebac1e-eb4c-4a7d-8893-49a95f6014d4";
fsType = "vfat"; fsType = "vfat";
}; };
fileSystems."/nix" = fileSystems."/nix" = {
{ device = "rpool/nixos/nix"; device = "rpool/nixos/nix";
fsType = "zfs"; fsType = "zfs";
options = ["zfsutil"]; options = ["zfsutil"];
}; };
fileSystems."/etc" = fileSystems."/etc" = {
{ device = "rpool/nixos/etc"; device = "rpool/nixos/etc";
fsType = "zfs"; fsType = "zfs";
options = ["zfsutil"]; options = ["zfsutil"];
}; };
fileSystems."/var" = fileSystems."/var" = {
{ device = "rpool/nixos/var"; device = "rpool/nixos/var";
fsType = "zfs"; fsType = "zfs";
options = ["zfsutil"]; options = ["zfsutil"];
}; };
fileSystems."/var/lib" = fileSystems."/var/lib" = {
{ device = "rpool/nixos/var/lib"; device = "rpool/nixos/var/lib";
fsType = "zfs"; fsType = "zfs";
options = ["zfsutil"]; options = ["zfsutil"];
}; };
fileSystems."/var/log" = fileSystems."/var/log" = {
{ device = "rpool/nixos/var/log"; device = "rpool/nixos/var/log";
fsType = "zfs"; fsType = "zfs";
options = ["zfsutil"]; options = ["zfsutil"];
}; };
fileSystems."/var/spool" = fileSystems."/var/spool" = {
{ device = "rpool/nixos/var/spool"; device = "rpool/nixos/var/spool";
fsType = "zfs"; fsType = "zfs";
options = ["zfsutil"]; options = ["zfsutil"];
}; };
fileSystems."/serverdata/pihole" = fileSystems."/serverdata/pihole" = {
{ device = "rpool/serverdata/pihole"; device = "rpool/serverdata/pihole";
fsType = "zfs"; fsType = "zfs";
options = ["zfsutil"]; options = ["zfsutil"];
}; };
fileSystems."/serverdata/gitea" = fileSystems."/serverdata/gitea" = {
{ device = "rpool/serverdata/gitea"; device = "rpool/serverdata/gitea";
fsType = "zfs"; fsType = "zfs";
options = ["zfsutil"]; options = ["zfsutil"];
}; };
fileSystems."/serverdata/home-assistant" = fileSystems."/serverdata/home-assistant" = {
{ device = "rpool/serverdata/home-assistant"; device = "rpool/serverdata/home-assistant";
fsType = "zfs"; fsType = "zfs";
options = ["zfsutil"]; options = ["zfsutil"];
}; };
fileSystems."/home" = fileSystems."/home" = {
{ device = "rpool/userdata/home"; device = "rpool/userdata/home";
fsType = "zfs"; fsType = "zfs";
options = ["zfsutil"]; options = ["zfsutil"];
}; };
fileSystems."/root" = fileSystems."/root" = {
{ device = "rpool/userdata/home/root"; device = "rpool/userdata/home/root";
fsType = "zfs"; fsType = "zfs";
options = ["zfsutil"]; options = ["zfsutil"];
}; };
fileSystems."/home/jacob" = fileSystems."/home/jacob" = {
{ device = "rpool/userdata/home/jacob"; device = "rpool/userdata/home/jacob";
fsType = "zfs"; fsType = "zfs";
options = ["zfsutil"]; options = ["zfsutil"];
}; };
@ -105,5 +108,4 @@
randomEncryption = true; randomEncryption = true;
} }
]; ];
} }

View File

@ -1,5 +1,4 @@
serverIP : serverIP: {
{
image = "pihole/pihole:2022.07.1"; image = "pihole/pihole:2022.07.1";
ports = [ ports = [
"${serverIP}:53:53/tcp" "${serverIP}:53:53/tcp"