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, ... }:
let
outputs = inputs @ {
self,
nixpkgs,
nixos-hardware,
home-manager,
sops-nix,
...
}: let
system = "x86_64-linux";
homeManagerConfFor = config: { ... }: {
homeManagerConfFor = config: {...}: {
#nixpkgs.overlays = [ nur.overlay ];
imports = [ config ];
imports = [config];
};
in {
nixosConfigurations = {
# Thinkpad T470 laptop
buck = nixpkgs.lib.nixosSystem {
@ -40,7 +45,8 @@
modules = [
nixos-hardware.nixosModules.lenovo-thinkpad-t470s
./machines/buck/configuration.nix
home-manager.nixosModules.home-manager {
home-manager.nixosModules.home-manager
{
home-manager.useUserPackages = true;
home-manager.users.jacob = homeManagerConfFor ./home/jacob.nix;
}
@ -54,7 +60,8 @@
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.nixosModules.home-manager
{
home-manager.useUserPackages = true;
home-manager.users.jacob = homeManagerConfFor ./home/jacob.nix;
}

View File

@ -1,11 +1,11 @@
pkgs :
rec {
pkgs: rec {
menu = "${pkgs.dmenu}/bin/dmenu_run";
modifier = "Mod1";
terminal = "kitty";
keybindings = let
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";
in {
"${modifier}+Return" = "exec ${terminal} tmux new";
@ -54,31 +54,20 @@ rec {
"${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+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}+Shift+e" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
"${modifier}+r" = "mode resize";
};

View File

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

View File

@ -1,12 +1,14 @@
# 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.
config,
pkgs,
sops,
...
}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
];
@ -16,7 +18,7 @@
# 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" ];
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
@ -61,7 +63,6 @@
# Select internationalisation properties.
i18n.defaultLocale = "en_US.utf8";
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
@ -93,7 +94,7 @@
# 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.
extraGroups = ["wheel"]; # Enable sudo for the user.
shell = pkgs.zsh;
};
@ -179,6 +180,6 @@
gc = {
automatic = true;
};
settings.experimental-features = [ "nix-command" "flakes" ];
settings.experimental-features = ["nix-command" "flakes"];
};
}

View File

@ -1,29 +1,33 @@
# 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")
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 = [ ];
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";
fileSystems."/" = {
device = "/dev/disk/by-uuid/cc13728f-a446-49db-98fc-51db875bba20";
fsType = "ext4";
};
fileSystems."/boot/efi" =
{ device = "/dev/disk/by-uuid/164F-882B";
fileSystems."/boot/efi" = {
device = "/dev/disk/by-uuid/164F-882B";
fsType = "vfat";
};
swapDevices = [ ];
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

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).
{ config, pkgs, options, sops, ... }:
{ imports =
[ # Include the results of the hardware scan.
{
config,
pkgs,
options,
sops,
...
}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration-zfs.nix
];
@ -13,7 +17,7 @@
# 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" ];
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
@ -36,7 +40,8 @@
};
# 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.
@ -63,24 +68,40 @@
};
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
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
#8081 # vaultwarden
#8000 # paperless
80 443 # reverse proxy
80
443 # reverse proxy
];
allowedUDPPorts = [
22000 21027 # syncthing
3478 5514 10001 1900 123 # unifi
22000
21027 # syncthing
3478
5514
10001
1900
123 # unifi
53 # pihole
];
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;
};
hardware.video.hidpi.enable = false;
@ -93,7 +114,6 @@
hardware.bluetooth.enable = false;
services.blueman.enable = false;
# Enable CUPS to print documents.
services.printing.enable = false;
@ -103,12 +123,12 @@
# 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.
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.systemPackages = with pkgs; [vim git wget];
#environment.variables = {
#GDK_SCALE = "2";
@ -211,7 +231,7 @@
trim.enable = true;
autoScrub = {
enable = true;
pools = [ "rpool" ];
pools = ["rpool"];
};
autoSnapshot = {
enable = true;
@ -224,7 +244,7 @@
# 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 );
nixpkgs.config.allowUnfreePredicate = (pkg: true);
powerManagement.cpuFreqGovernor = "ondemand";
@ -232,6 +252,5 @@
# 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" ];
nix.settings.experimental-features = ["nix-command" "flakes"];
}

View File

@ -1,102 +1,105 @@
# 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")
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 = [ ];
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";
fileSystems."/" = {
device = "none";
fsType = "tmpfs";
};
fileSystems."/boot" =
{
fileSystems."/boot" = {
device = "/dev/disk/by-partuuid/e7ebac1e-eb4c-4a7d-8893-49a95f6014d4";
fsType = "vfat";
};
fileSystems."/nix" =
{ device = "rpool/nixos/nix";
fileSystems."/nix" = {
device = "rpool/nixos/nix";
fsType = "zfs";
options = [ "zfsutil" ];
options = ["zfsutil"];
};
fileSystems."/etc" =
{ device = "rpool/nixos/etc";
fileSystems."/etc" = {
device = "rpool/nixos/etc";
fsType = "zfs";
options = [ "zfsutil" ];
options = ["zfsutil"];
};
fileSystems."/var" =
{ device = "rpool/nixos/var";
fileSystems."/var" = {
device = "rpool/nixos/var";
fsType = "zfs";
options = [ "zfsutil" ];
options = ["zfsutil"];
};
fileSystems."/var/lib" =
{ device = "rpool/nixos/var/lib";
fileSystems."/var/lib" = {
device = "rpool/nixos/var/lib";
fsType = "zfs";
options = [ "zfsutil" ];
options = ["zfsutil"];
};
fileSystems."/var/log" =
{ device = "rpool/nixos/var/log";
fileSystems."/var/log" = {
device = "rpool/nixos/var/log";
fsType = "zfs";
options = [ "zfsutil" ];
options = ["zfsutil"];
};
fileSystems."/var/spool" =
{ device = "rpool/nixos/var/spool";
fileSystems."/var/spool" = {
device = "rpool/nixos/var/spool";
fsType = "zfs";
options = [ "zfsutil" ];
options = ["zfsutil"];
};
fileSystems."/serverdata/pihole" =
{ device = "rpool/serverdata/pihole";
fileSystems."/serverdata/pihole" = {
device = "rpool/serverdata/pihole";
fsType = "zfs";
options = [ "zfsutil" ];
options = ["zfsutil"];
};
fileSystems."/serverdata/gitea" =
{ device = "rpool/serverdata/gitea";
fileSystems."/serverdata/gitea" = {
device = "rpool/serverdata/gitea";
fsType = "zfs";
options = [ "zfsutil" ];
options = ["zfsutil"];
};
fileSystems."/serverdata/home-assistant" =
{ device = "rpool/serverdata/home-assistant";
fileSystems."/serverdata/home-assistant" = {
device = "rpool/serverdata/home-assistant";
fsType = "zfs";
options = [ "zfsutil" ];
options = ["zfsutil"];
};
fileSystems."/home" =
{ device = "rpool/userdata/home";
fileSystems."/home" = {
device = "rpool/userdata/home";
fsType = "zfs";
options = [ "zfsutil" ];
options = ["zfsutil"];
};
fileSystems."/root" =
{ device = "rpool/userdata/home/root";
fileSystems."/root" = {
device = "rpool/userdata/home/root";
fsType = "zfs";
options = [ "zfsutil" ];
options = ["zfsutil"];
};
fileSystems."/home/jacob" =
{ device = "rpool/userdata/home/jacob";
fileSystems."/home/jacob" = {
device = "rpool/userdata/home/jacob";
fsType = "zfs";
options = [ "zfsutil" ];
options = ["zfsutil"];
};
swapDevices = [
@ -105,5 +108,4 @@
randomEncryption = true;
}
];
}

View File

@ -2,7 +2,7 @@
enable = true;
recommendedProxySettings = true;
virtualHosts = let
simpleProxy = ip : {
simpleProxy = ip: {
forceSSL = true;
enableACME = true;
extraConfig = ''

View File

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