nixfmt

+129 -131
flake.nix
···
nix-on-droid.url = "github:nix-community/nix-on-droid/release-23.05";
eeww.url = "github:RyanGibb/eeww/nixos";
eon.url = "github:RyanGibb/eon";
-
eilean.url ="github:RyanGibb/eilean-nix/main";
+
eilean.url = "github:RyanGibb/eilean-nix/main";
ryan-website.url = "git+ssh://git@github.com/RyanGibb/website.git";
alec-website.url = "github:alexanderhthompson/website";
fn06-website.url = "github:RyanGibb/fn06";
-
colour-guesser.url = "git+ssh://git@github.com/ryangibb/colour-guesser.git?ref=develop";
+
colour-guesser.url =
+
"git+ssh://git@github.com/ryangibb/colour-guesser.git?ref=develop";
i3-workspace-history.url = "github:RyanGibb/i3-workspace-history";
hyperbib-eeg.url = "github:RyanGibb/hyperbib?ref=nixify";
-
neovim.url = "github:neovim/neovim/f40df63bdca33d343cada6ceaafbc8b765ed7cc6?dir=contrib";
+
neovim.url =
+
"github:neovim/neovim/f40df63bdca33d343cada6ceaafbc8b765ed7cc6?dir=contrib";
nix-rpi5.url = "gitlab:vriska/nix-rpi5?ref=main";
# deduplicate flake inputs
···
hyperbib-eeg.inputs.nixpkgs.follows = "nixpkgs";
};
-
outputs = {
-
self,
-
nixpkgs,
-
nixpkgs-unstable,
-
nixos-hardware,
-
home-manager,
-
agenix,
-
nix-on-droid,
-
eeww,
-
eon,
-
eilean,
-
fn06-website,
-
i3-workspace-history,
-
hyperbib-eeg,
-
neovim,
-
...
-
}@inputs:
+
outputs = { self, nixpkgs, nixpkgs-unstable, nixos-hardware, home-manager
+
, agenix, nix-on-droid, eeww, eon, eilean, fn06-website
+
, i3-workspace-history, hyperbib-eeg, neovim, ... }@inputs:
let
getSystemOverlays = system: nixpkgsConfig:
[
···
eeww = eeww.defaultPackage.${system};
eon = eon.defaultPackage.${system};
mautrix-signal = final.overlay-unstable.mautrix-signal;
-
i3-workspace-history = i3-workspace-history.packages.${system}.default;
-
maildir-rank-addr = final.callPackage ./pkgs/maildir-rank-addr.nix { };
+
i3-workspace-history =
+
i3-workspace-history.packages.${system}.default;
+
maildir-rank-addr =
+
final.callPackage ./pkgs/maildir-rank-addr.nix { };
# https://github.com/NixOS/nixpkgs/issues/86349#issuecomment-624489806
-
aerc = (prev.callPackage "${prev.path}/pkgs/applications/networking/mailreaders/aerc/default.nix" {
-
buildGoModule = args: prev.buildGoModule (args // {
-
src = prev.fetchFromSourcehut {
-
owner = "~rjarry";
-
repo = "aerc";
-
rev = "930e50328c3a57faeec7fd23881e044257eda157";
-
hash = "sha256-V1cjjJBAGqfBZIizAweMUYl7X3QorgLh/8J4HulmKAE=";
-
};
-
vendorHash = "sha256-IzQKgNilBq53w41gNLXCd1BgYXW/aUuQQtFeKEI/dKw=";
+
aerc = (prev.callPackage
+
"${prev.path}/pkgs/applications/networking/mailreaders/aerc/default.nix" {
+
buildGoModule = args:
+
prev.buildGoModule (args // {
+
src = prev.fetchFromSourcehut {
+
owner = "~rjarry";
+
repo = "aerc";
+
rev = "930e50328c3a57faeec7fd23881e044257eda157";
+
hash =
+
"sha256-V1cjjJBAGqfBZIizAweMUYl7X3QorgLh/8J4HulmKAE=";
+
};
+
vendorHash =
+
"sha256-IzQKgNilBq53w41gNLXCd1BgYXW/aUuQQtFeKEI/dKw=";
+
});
});
-
});
# https://github.com/swaywm/sway/pull/7226
sway-unwrapped = prev.callPackage ./pkgs/sway-im/package.nix {
libdrm = final.overlay-unstable.libdrm;
wlroots = prev.callPackage ./pkgs/wlroots/default.nix {
# for libdrm >=2.4.120
mesa = final.overlay-unstable.mesa;
-
wayland-protocols = prev.wayland-protocols.overrideAttrs (old: rec {
-
pname = "wayland-protocols";
-
version = "1.33";
-
src = prev.fetchurl {
-
url = "https://gitlab.freedesktop.org/wayland/${pname}/-/releases/${version}/downloads/${pname}-${version}.tar.xz";
-
hash = "sha256-lPDFCwkNbmGgP2IEhGexmrvoUb5OEa57NvZfi5jDljo=";
-
};
-
});
+
wayland-protocols = prev.wayland-protocols.overrideAttrs
+
(old: rec {
+
pname = "wayland-protocols";
+
version = "1.33";
+
src = prev.fetchurl {
+
url =
+
"https://gitlab.freedesktop.org/wayland/${pname}/-/releases/${version}/downloads/${pname}-${version}.tar.xz";
+
hash =
+
"sha256-lPDFCwkNbmGgP2IEhGexmrvoUb5OEa57NvZfi5jDljo=";
+
};
+
});
};
};
neovim-unwrapped = neovim.packages.${system}.default;
# https://github.com/NixOS/nixpkgs/pull/291559
-
libvpl = final.overlay-unstable.libvpl.overrideAttrs (_: {
-
patches = [ ./pkgs/opengl-driver-lib.patch ];
-
});
+
libvpl = final.overlay-unstable.libvpl.overrideAttrs
+
(_: { patches = [ ./pkgs/opengl-driver-lib.patch ]; });
# https://github.com/jellyfin/jellyfin-media-player/issues/165#issuecomment-1966131861
-
jellyfin-media-player = prev.jellyfin-media-player.overrideAttrs (old: {
-
buildInputs =
-
(prev.lib.filter (input: input != prev.mpv) old.buildInputs) ++ [
-
(prev.mpv-unwrapped.overrideAttrs (old: {
-
buildInputs =
-
(prev.lib.filter (input: input != prev.libva) old.buildInputs) ++ [
-
(prev.libva.overrideAttrs (_: {
-
src = prev.fetchFromGitHub {
-
owner = "emersion";
-
repo = "libva";
-
rev = "linux-dmabuf";
-
hash = "sha256-d1cT6zOZHnrBBWjxOtSMAijPr4Tab+0GetZ6aqzhvrQ=";
-
};
+
jellyfin-media-player = prev.jellyfin-media-player.overrideAttrs
+
(old: {
+
buildInputs =
+
(prev.lib.filter (input: input != prev.mpv) old.buildInputs)
+
++ [
+
(prev.mpv-unwrapped.overrideAttrs (old: {
+
buildInputs =
+
(prev.lib.filter (input: input != prev.libva)
+
old.buildInputs) ++ [
+
(prev.libva.overrideAttrs (_: {
+
src = prev.fetchFromGitHub {
+
owner = "emersion";
+
repo = "libva";
+
rev = "linux-dmabuf";
+
hash =
+
"sha256-d1cT6zOZHnrBBWjxOtSMAijPr4Tab+0GetZ6aqzhvrQ=";
+
};
+
}))
+
];
}))
];
-
}))
-
];
-
});
+
});
})
];
-
in rec {
-
nixosConfigurations =
-
let
+
in rec {
+
nixosConfigurations = let
mkMode = mode: host:
nixpkgs.lib.nixosSystem {
# use system from config.localSystem
···
system = null;
pkgs = null;
specialArgs = inputs;
-
modules =
-
[
-
./hosts/${host}/${mode}.nix
-
./modules/default.nix
-
({ config, ... }: {
-
networking.hostName = "${host}";
-
# pin nix command's nixpkgs flake to the system flake to avoid unnecessary downloads
-
nix.registry.nixpkgs.flake = nixpkgs;
-
system.stateVersion = "22.05";
-
# record git revision (can be queried with `nixos-version --json)
-
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
-
nixpkgs = {
-
config.allowUnfree = true;
-
config.permittedInsecurePackages = [
-
# obsidian
-
"electron-25.9.0"
-
# https://github.com/nix-community/nixd/issues/357
-
"nix-2.16.2"
-
];
-
overlays = getSystemOverlays config.nixpkgs.hostPlatform.system config.nixpkgs.config;
-
# uncomment for cross compilation (https://github.com/NixOS/nix/issues/3843)
-
#buildPlatform.system = "cpu-os";
-
};
-
})
-
home-manager.nixosModule
-
eilean.nixosModules.default
-
eon.nixosModules.default
-
hyperbib-eeg.nixosModules.default
-
agenix.nixosModules.default
-
];
-
};
+
modules = [
+
./hosts/${host}/${mode}.nix
+
./modules/default.nix
+
({ config, ... }: {
+
networking.hostName = "${host}";
+
# pin nix command's nixpkgs flake to the system flake to avoid unnecessary downloads
+
nix.registry.nixpkgs.flake = nixpkgs;
+
system.stateVersion = "22.05";
+
# record git revision (can be queried with `nixos-version --json)
+
system.configurationRevision =
+
nixpkgs.lib.mkIf (self ? rev) self.rev;
+
nixpkgs = {
+
config.allowUnfree = true;
+
config.permittedInsecurePackages = [
+
# obsidian
+
"electron-25.9.0"
+
# https://github.com/nix-community/nixd/issues/357
+
"nix-2.16.2"
+
];
+
overlays =
+
getSystemOverlays config.nixpkgs.hostPlatform.system
+
config.nixpkgs.config;
+
# uncomment for cross compilation (https://github.com/NixOS/nix/issues/3843)
+
#buildPlatform.system = "cpu-os";
+
};
+
})
+
home-manager.nixosModule
+
eilean.nixosModules.default
+
eon.nixosModules.default
+
hyperbib-eeg.nixosModules.default
+
agenix.nixosModules.default
+
];
+
};
readModes = dir:
-
let files = builtins.readDir dir; in
-
let filtered = nixpkgs.lib.attrsets.filterAttrs (n: v:
-
v == "regular" && (
-
n == "default.nix" ||
-
n == "minimal.nix" ||
-
n == "sd-image.nix"
-
)
-
) files; in
-
let names = nixpkgs.lib.attrNames filtered; in
-
builtins.map (f: nixpkgs.lib.strings.removeSuffix ".nix" f) names;
+
let files = builtins.readDir dir;
+
in let
+
filtered = nixpkgs.lib.attrsets.filterAttrs (n: v:
+
v == "regular" && (n == "default.nix" || n == "minimal.nix" || n
+
== "sd-image.nix")) files;
+
in let names = nixpkgs.lib.attrNames filtered;
+
in builtins.map (f: nixpkgs.lib.strings.removeSuffix ".nix" f) names;
mkModes = host: modes:
-
builtins.map (mode:
-
{
-
name = "${host}${if mode == "default" then "" else "-${mode}"}";
-
value = mkMode mode host;
-
}
-
) modes;
+
builtins.map (mode: {
+
name = "${host}${if mode == "default" then "" else "-${mode}"}";
+
value = mkMode mode host;
+
}) modes;
mkHosts = hosts:
-
let nestedList = builtins.map (host: mkModes host (readModes ./hosts/${host})) hosts; in
-
let list = nixpkgs.lib.lists.flatten nestedList; in
-
builtins.listToAttrs list;
+
let
+
nestedList =
+
builtins.map (host: mkModes host (readModes ./hosts/${host}))
+
hosts;
+
in let list = nixpkgs.lib.lists.flatten nestedList;
+
in builtins.listToAttrs list;
hosts = builtins.attrNames (builtins.readDir ./hosts);
in mkHosts hosts;
-
nixOnDroidConfigurations.default = nix-on-droid.lib.nixOnDroidConfiguration {
-
modules = [ ./nix-on-droid/default.nix ];
-
pkgs = import nixpkgs {
-
overlays = getSystemOverlays "aarch64-linux" { };
-
config.permittedInsecurePackages = [
-
# https://github.com/nix-community/nixd/issues/357
-
"nix-2.16.2"
-
];
-
};
-
};
+
nixOnDroidConfigurations.default =
+
nix-on-droid.lib.nixOnDroidConfiguration {
+
modules = [ ./nix-on-droid/default.nix ];
+
pkgs = import nixpkgs {
+
overlays = getSystemOverlays "aarch64-linux" { };
+
config.permittedInsecurePackages = [
+
# https://github.com/nix-community/nixd/issues/357
+
"nix-2.16.2"
+
];
+
};
+
};
-
legacyPackages = {
-
nixpkgs =
-
nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (system:
-
nixpkgs.legacyPackages.${system}
-
);
-
nixpkgs-unstable =
-
nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (system:
-
nixpkgs-unstable.legacyPackages.${system}
-
);
+
legacyPackages = {
+
nixpkgs = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed
+
(system: nixpkgs.legacyPackages.${system});
+
nixpkgs-unstable = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed
+
(system: nixpkgs-unstable.legacyPackages.${system});
};
+
+
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt;
};
}
+5 -11
hosts/barnacle/default.nix
···
networking.wireless = {
# so we can use NetworkManager
enable = lib.mkForce false;
-
networks = {
-
"SSID" = {
-
psk = "password";
-
};
-
};
+
networks = { "SSID" = { psk = "password"; }; };
};
# build with:
# nix build '/etc/nixos?submodules=1#nixosConfigurations.iso.config.system.build.isoImage'
-
isoImage.contents = [
-
{
-
source = ../..;
-
target = "nixos";
-
}
-
];
+
isoImage.contents = [{
+
source = ../..;
+
target = "nixos";
+
}];
# comment this out to make a smaller image
isoImage.squashfsCompression = "gzip -Xcompression-level 1";
+20 -27
hosts/capybara/default.nix
···
{ config, pkgs, lib, nix-rpi5, ... }:
{
-
imports = [
-
./hardware-configuration.nix
-
];
+
imports = [ ./hardware-configuration.nix ];
personal = {
enable = true;
···
networking.networkmanager.enable = true;
-
boot.kernelPackages = nix-rpi5.legacyPackages.aarch64-linux.linuxPackages_rpi5;
+
boot.kernelPackages =
+
nix-rpi5.legacyPackages.aarch64-linux.linuxPackages_rpi5;
networking.firewall.enable = false;
networking.firewall.allowedTCPPorts = [ 44 ];
···
user = "zigbee2mqtt";
password = "test";
};
-
serial = {
-
port = "/dev/ttyUSB0";
-
};
-
frontend = {
-
port = 15606;
-
};
+
serial = { port = "/dev/ttyUSB0"; };
+
frontend = { port = 15606; };
homeassistant = true;
-
advanced = {
-
channel = 15;
-
};
+
advanced = { channel = 15; };
};
};
services.mosquitto = {
enable = true;
-
listeners = [
-
{
-
users = {
-
zigbee2mqtt = {
-
acl = [ "readwrite #" ];
-
hashedPassword = "$6$nuDIW/ZPVsrDHyBe$JffJJvvMG+nH8GH9V5h4FqJkU0nfiFkDzAsdYNTHeJMgBXEX9epPkQTUdLG9L47K54vMxm/+toeMAiKD63Dfkw==";
-
};
-
homeassistant = {
-
acl = [ "readwrite #" ];
-
hashedPassword = "$7$101$wGQZPdVdeW7iQFmH$bK/VOR6LXCLJKbb6M4PNeVptocjBAWXCLMtEU5fQNBr0Y5UAWlhVg8UAu4IkIXgnViI51NnhXKykdlWF63VkVQ==";
-
};
+
listeners = [{
+
users = {
+
zigbee2mqtt = {
+
acl = [ "readwrite #" ];
+
hashedPassword =
+
"$6$nuDIW/ZPVsrDHyBe$JffJJvvMG+nH8GH9V5h4FqJkU0nfiFkDzAsdYNTHeJMgBXEX9epPkQTUdLG9L47K54vMxm/+toeMAiKD63Dfkw==";
+
};
+
homeassistant = {
+
acl = [ "readwrite #" ];
+
hashedPassword =
+
"$7$101$wGQZPdVdeW7iQFmH$bK/VOR6LXCLJKbb6M4PNeVptocjBAWXCLMtEU5fQNBr0Y5UAWlhVg8UAu4IkIXgnViI51NnhXKykdlWF63VkVQ==";
};
-
}
-
];
+
};
+
}];
};
services.home-assistant = {
···
config = {
# Includes dependencies for a basic setup
# https://www.home-assistant.io/integrations/default_config/
-
default_config = {};
+
default_config = { };
http.use_x_forwarded_for = true;
http.trusted_proxies = "100.64.0.2";
};
+10 -14
hosts/capybara/hardware-configuration.nix
···
{ config, lib, pkgs, modulesPath, ... }:
{
-
imports =
-
[ (modulesPath + "/installer/scan/not-detected.nix")
-
];
+
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.loader.grub.device = "nodev";
boot.loader.grub.efiSupport = true;
···
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
-
fileSystems."/" =
-
{ device = "/dev/disk/by-uuid/4cef5b18-2c69-4f92-835d-52ac0b96256c";
-
fsType = "ext4";
-
};
+
fileSystems."/" = {
+
device = "/dev/disk/by-uuid/4cef5b18-2c69-4f92-835d-52ac0b96256c";
+
fsType = "ext4";
+
};
-
fileSystems."/boot" =
-
{ device = "/dev/disk/by-uuid/63BC-60B5";
-
fsType = "vfat";
-
};
+
fileSystems."/boot" = {
+
device = "/dev/disk/by-uuid/63BC-60B5";
+
fsType = "vfat";
+
};
swapDevices = [ ];
networking.useDHCP = lib.mkDefault true;
-
boot.kernelParams = [
-
"video=HDMI-A-1:1024x768M@60D"
-
];
+
boot.kernelParams = [ "video=HDMI-A-1:1024x768M@60D" ];
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
}
+58 -25
hosts/duck/default.nix
···
{ pkgs, config, lib, eilean, ryan-website, ... }:
{
-
imports = [
-
./hardware-configuration.nix
-
];
+
imports = [ ./hardware-configuration.nix ];
personal = {
enable = true;
···
machineColour = "green";
};
-
swapDevices = [ { device = "/var/swap"; size = 2048; } ];
+
swapDevices = [{
+
device = "/var/swap";
+
size = 2048;
+
}];
-
environment.systemPackages = with pkgs; [
-
xe-guest-utilities
-
];
+
environment.systemPackages = with pkgs; [ xe-guest-utilities ];
eilean.services.dns = {
zones."cl.freumh.org" = {
soa.serial = lib.mkDefault 1;
-
records =
-
let
-
ipv4 = "128.232.113.136";
-
ipv6 = "2a05:b400:110:1101:d051:f2ff:fe13:3781";
-
in [
-
{ name = "@"; type = "NS"; data = "ns"; }
+
records = let
+
ipv4 = "128.232.113.136";
+
ipv6 = "2a05:b400:110:1101:d051:f2ff:fe13:3781";
+
in [
+
{
+
name = "@";
+
type = "NS";
+
data = "ns";
+
}
-
{ name = "ns"; type = "A"; data = ipv4; }
-
{ name = "ns"; type = "AAAA"; data = ipv6; }
+
{
+
name = "ns";
+
type = "A";
+
data = ipv4;
+
}
+
{
+
name = "ns";
+
type = "AAAA";
+
data = ipv6;
+
}
-
{ name = "@"; type = "A"; data = ipv4; }
-
{ name = "@"; type = "AAAA"; data = ipv6; }
-
{ name = "vps"; type = "A"; data = ipv4; }
-
{ name = "vps"; type = "AAAA"; data = ipv6; }
+
{
+
name = "@";
+
type = "A";
+
data = ipv4;
+
}
+
{
+
name = "@";
+
type = "AAAA";
+
data = ipv6;
+
}
+
{
+
name = "vps";
+
type = "A";
+
data = ipv4;
+
}
+
{
+
name = "vps";
+
type = "AAAA";
+
data = ipv6;
+
}
];
};
};
···
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${pkgs.eeww}/main.exe -p 80";
-
WorkingDirectory = "${ryan-website.packages.${config.nixpkgs.hostPlatform.system}.default}";
+
WorkingDirectory =
+
"${ryan-website.packages.${config.nixpkgs.hostPlatform.system}.default}";
Restart = "always";
RestartSec = "10s";
AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" ];
···
isSystemUser = true;
};
-
users.groups."eeww" = {};
+
users.groups."eeww" = { };
networking.firewall = {
allowedTCPPorts = [
-
80 # HTTP
-
443 # HTTPS
+
80 # HTTP
+
443 # HTTPS
];
allowedUDPPorts = [
-
80 # HTTP
+
80 # HTTP
];
};
···
enable = true;
# TODO make this zonefile derivation a config parameter `services.eilean.services.dns.zonefile`
# TODO add module in eilean for eon
-
zoneFile = "${import "${eilean}/modules/services/dns/zonefile.nix" { inherit pkgs config lib; zonename = "cl.freumh.org"; zone = config.eilean.services.dns.zones."cl.freumh.org"; }}/cl.freumh.org";
+
zoneFile = "${
+
import "${eilean}/modules/services/dns/zonefile.nix" {
+
inherit pkgs config lib;
+
zonename = "cl.freumh.org";
+
zone = config.eilean.services.dns.zones."cl.freumh.org";
+
}
+
}/cl.freumh.org";
logLevel = 1;
application = "tund";
};
+8 -6
hosts/duck/hardware-configuration.nix
···
{ config, lib, pkgs, modulesPath, ... }:
{
-
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "sr_mod" "xen_blkfront" ];
+
boot.initrd.availableKernelModules =
+
[ "ata_piix" "uhci_hcd" "sr_mod" "xen_blkfront" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
boot.loader.grub.device = "/dev/xvda"; # or "nodev" for efi only
-
fileSystems."/" =
-
{ device = "/dev/disk/by-uuid/426b9528-ccde-4438-8338-10d35cea9d16";
-
fsType = "ext4";
-
};
+
fileSystems."/" = {
+
device = "/dev/disk/by-uuid/426b9528-ccde-4438-8338-10d35cea9d16";
+
fsType = "ext4";
+
};
networking.useDHCP = false;
···
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
-
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
+
hardware.cpu.intel.updateMicrocode =
+
lib.mkDefault config.hardware.enableRedistributableFirmware;
}
+5 -21
hosts/elephant/default.nix
···
{ pkgs, config, lib, ... }:
{
-
imports = [
-
./hardware-configuration.nix
-
./zfs.nix
-
./services.nix
-
];
+
imports = [ ./hardware-configuration.nix ./zfs.nix ./services.nix ];
personal = {
enable = true;
···
restic
];
-
eilean = {
-
publicInterface = "enp1s0";
-
};
+
eilean = { publicInterface = "enp1s0"; };
powerManagement = {
powertop.enable = true;
···
repositoryFile = config.age.secrets.restic-repo.path;
passwordFile = config.age.secrets.restic-elephant.path;
initialize = true;
-
paths = [
-
"/tank/family/mp4/"
-
"/tank/family/other/"
-
"/tank/photos/"
-
];
-
timerConfig = {
-
OnCalendar = "03:00";
-
};
-
pruneOpts = [
-
"--keep-daily 7"
-
"--keep-weekly 4"
-
"--keep-yearly 10"
-
];
+
paths = [ "/tank/family/mp4/" "/tank/family/other/" "/tank/photos/" ];
+
timerConfig = { OnCalendar = "03:00"; };
+
pruneOpts = [ "--keep-daily 7" "--keep-weekly 4" "--keep-yearly 10" ];
};
# Add hardware transcoding support to `ffmpeg_6` and derived packages (like jellyfin-ffmpeg)
+17 -14
hosts/elephant/hardware-configuration.nix
···
{ config, lib, pkgs, modulesPath, ... }:
{
-
imports =
-
[ (modulesPath + "/installer/scan/not-detected.nix")
-
];
+
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
-
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
+
boot.initrd.availableKernelModules =
+
[ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
-
fileSystems."/" =
-
{ device = "/dev/disk/by-uuid/d1b7f032-9c43-4a57-b531-4b1d6f88c999";
-
fsType = "ext4";
-
};
+
fileSystems."/" = {
+
device = "/dev/disk/by-uuid/d1b7f032-9c43-4a57-b531-4b1d6f88c999";
+
fsType = "ext4";
+
};
-
fileSystems."/boot" =
-
{ device = "/dev/disk/by-uuid/0CC6-561D";
-
fsType = "vfat";
-
};
+
fileSystems."/boot" = {
+
device = "/dev/disk/by-uuid/0CC6-561D";
+
fsType = "vfat";
+
};
-
swapDevices = [ { device = "/var/swap"; size = 16384; } ];
+
swapDevices = [{
+
device = "/var/swap";
+
size = 16384;
+
}];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
-
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
+
hardware.cpu.intel.updateMicrocode =
+
lib.mkDefault config.hardware.enableRedistributableFirmware;
boot.loader.grub = {
enable = true;
+6 -6
hosts/elephant/services.nix
···
#backups.owl = {
# repository = "${config.services.restic.server.dataDir}/owl";
# passwordFile = "${config.custom.secretsDir}/restic-password-owl";
-
# timerConfig = {
-
# OnCalendar = "02:00";
-
# };
+
# timerConfig = {
+
# OnCalendar = "02:00";
+
# };
# pruneOpts = [
# "--keep-daily 7"
# "--keep-weekly 5"
···
#backups.gecko = {
# repository = "${config.services.restic.server.dataDir}/gecko";
# passwordFile = "${config.custom.secretsDir}/restic-password-gecko";
-
# timerConfig = {
-
# OnCalendar = "02:00";
-
# };
+
# timerConfig = {
+
# OnCalendar = "02:00";
+
# };
# pruneOpts = [
# "--keep-daily 7"
# "--keep-weekly 5"
+8 -16
hosts/gecko/default.nix
···
{ pkgs, lib, config, ... }:
{
-
imports = [
-
./hardware-configuration.nix
-
];
+
imports = [ ./hardware-configuration.nix ];
personal = {
enable = true;
···
environment.systemPackages = with pkgs; [
dell-command-configure
-
(python3.withPackages (p: with p; [
-
numpy
-
matplotlib
-
pandas
-
]))
+
(python3.withPackages (p: with p; [ numpy matplotlib pandas ]))
python39Packages.pip
jupyter
#vagrant
···
#system.includeBuildDependencies = true;
nix = {
-
buildMachines = [ {
+
buildMachines = [{
hostName = "rtg24@daintree.cl.cam.ac.uk";
system = "x86_64-linux";
protocol = "ssh-ng";
···
speedFactor = 2;
supportedFeatures = [ "benchmark" "big-parallel" "kvm" ];
mandatoryFeatures = [ ];
-
}] ;
+
}];
distributedBuilds = true;
extraOptions = ''
builders-use-substitutes = true
-
'';
+
'';
};
age.secrets.restic-gecko.file = ../../secrets/restic-gecko.age;
···
"/home/${config.custom.username}/.cache"
"/home/${config.custom.username}/.local/share/Steam"
];
-
timerConfig = {
-
OnUnitActiveSec = "1d";
-
};
+
timerConfig = { OnUnitActiveSec = "1d"; };
extraBackupArgs = [ "-vv" ];
};
···
};
environment.DBUS_SESSION_BUS_ADDRESS = "unix:path=/run/user/${
-
toString config.users.users.${config.custom.username}.uid
-
}/bus";
+
toString config.users.users.${config.custom.username}.uid
+
}/bus";
script = ''
${pkgs.libnotify}/bin/notify-send --urgency=critical \
+17 -14
hosts/gecko/hardware-configuration.nix
···
{ config, lib, pkgs, modulesPath, ... }:
{
-
imports =
-
[ (modulesPath + "/installer/scan/not-detected.nix")
-
];
+
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
-
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usbhid" "rtsx_pci_sdmmc" ];
+
boot.initrd.availableKernelModules =
+
[ "xhci_pci" "thunderbolt" "nvme" "usbhid" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
-
fileSystems."/" =
-
{ device = "/dev/disk/by-uuid/b949a6f8-8f30-4f68-9622-ae0f013bce8a";
-
fsType = "ext4";
-
};
+
fileSystems."/" = {
+
device = "/dev/disk/by-uuid/b949a6f8-8f30-4f68-9622-ae0f013bce8a";
+
fsType = "ext4";
+
};
-
fileSystems."/boot" =
-
{ device = "/dev/disk/by-uuid/A49E-420F";
-
fsType = "vfat";
-
};
+
fileSystems."/boot" = {
+
device = "/dev/disk/by-uuid/A49E-420F";
+
fsType = "vfat";
+
};
-
swapDevices = [ { device = "/var/swap"; size = 16384; } ];
+
swapDevices = [{
+
device = "/var/swap";
+
size = 16384;
+
}];
boot.resumeDevice = "/dev/disk/by-label/nixos";
# https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Hibernation_into_swap_file
boot.kernelParams = [ "mem_sleep_default=deep" "resume_offset=142587904" ];
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
-
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
+
hardware.cpu.intel.updateMicrocode =
+
lib.mkDefault config.hardware.enableRedistributableFirmware;
nixpkgs.hostPlatform = "x86_64-linux";
}
+9 -10
hosts/mouse/installer.nix
···
# To automatically join a Tailscale network at freumh.org add the secret in a `headscale` file
# in the project root.
{
-
imports = [
-
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-raspberrypi.nix"
-
];
+
imports =
+
[ "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-raspberrypi.nix" ];
# from hardware-configuration.nix
# https://github.com/NixOS/nixpkgs/issues/141470#issuecomment-996202318
···
'';
users = let
-
hashedPassword = "$6$IPvnJnu6/fp1Jxfy$U6EnzYDOC2NqE4iqRrkJJbSTHHNWk0KwK1xyk9jEvlu584UWQLyzDVF5I1Sh47wQhSVrvUI4mrqw6XTTjfPj6.";
+
hashedPassword =
+
"$6$IPvnJnu6/fp1Jxfy$U6EnzYDOC2NqE4iqRrkJJbSTHHNWk0KwK1xyk9jEvlu584UWQLyzDVF5I1Sh47wQhSVrvUI4mrqw6XTTjfPj6.";
in {
mutableUsers = false;
users.ryan = {
···
"wheel" # enable sudo
];
hashedPassword = hashedPassword;
-
openssh.authorizedKeys.keyFiles = [ ../../modules/personal/authorized_keys ];
+
openssh.authorizedKeys.keyFiles =
+
[ ../../modules/personal/authorized_keys ];
};
users.root = {
hashedPassword = hashedPassword;
-
openssh.authorizedKeys.keyFiles = [ ../../modules/personal/authorized_keys ];
+
openssh.authorizedKeys.keyFiles =
+
[ ../../modules/personal/authorized_keys ];
};
};
-
environment.systemPackages = with pkgs; [
-
vim
-
tmux
-
];
+
environment.systemPackages = with pkgs; [ vim tmux ];
services.tailscale = {
enable = true;
+30 -40
hosts/mouse/sd-image.nix
···
{ nixpkgs, lib, pkgs, config, ... }:
{
-
imports = [
-
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-raspberrypi.nix"
-
];
+
imports =
+
[ "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-raspberrypi.nix" ];
# from hardware-configuration.nix
# https://github.com/NixOS/nixpkgs/issues/141470#issuecomment-996202318
···
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
-
swapDevices = [ { device = "/var/swap"; size = 4096; } ];
+
swapDevices = [{
+
device = "/var/swap";
+
size = 4096;
+
}];
networking.useDHCP = lib.mkDefault true;
hardware.enableRedistributableFirmware = lib.mkDefault true;
-
# https://discourse.nixos.org/t/building-libcamera-for-raspberry-pi/26133/7
nixpkgs.hostPlatform = {
···
networking.hostName = "mouse";
users = let
-
hashedPassword = "$6$IPvnJnu6/fp1Jxfy$U6EnzYDOC2NqE4iqRrkJJbSTHHNWk0KwK1xyk9jEvlu584UWQLyzDVF5I1Sh47wQhSVrvUI4mrqw6XTTjfPj6.";
+
hashedPassword =
+
"$6$IPvnJnu6/fp1Jxfy$U6EnzYDOC2NqE4iqRrkJJbSTHHNWk0KwK1xyk9jEvlu584UWQLyzDVF5I1Sh47wQhSVrvUI4mrqw6XTTjfPj6.";
in {
mutableUsers = false;
users.ryan = {
···
"wheel" # enable sudo
];
hashedPassword = hashedPassword;
-
openssh.authorizedKeys.keyFiles = [ ../../modules/personal/authorized_keys ];
+
openssh.authorizedKeys.keyFiles =
+
[ ../../modules/personal/authorized_keys ];
};
users.root = {
hashedPassword = hashedPassword;
-
openssh.authorizedKeys.keyFiles = [ ../../modules/personal/authorized_keys ];
+
openssh.authorizedKeys.keyFiles =
+
[ ../../modules/personal/authorized_keys ];
};
};
-
environment.systemPackages = with pkgs; [
-
vim
-
];
+
environment.systemPackages = with pkgs; [ vim ];
services.tailscale = {
enable = true;
···
user = "zigbee2mqtt";
password = "test";
};
-
serial = {
-
port = "/dev/ttyUSB0";
-
};
+
serial = { port = "/dev/ttyUSB0"; };
frontend = {
port = 15606;
url = "http://mouse";
};
homeassistant = true;
-
advanced = {
-
channel = 15;
-
};
+
advanced = { channel = 15; };
};
};
services.mosquitto = {
enable = true;
-
listeners = [
-
{
-
users = {
-
zigbee2mqtt = {
-
acl = [ "readwrite #" ];
-
hashedPassword = "$6$nuDIW/ZPVsrDHyBe$JffJJvvMG+nH8GH9V5h4FqJkU0nfiFkDzAsdYNTHeJMgBXEX9epPkQTUdLG9L47K54vMxm/+toeMAiKD63Dfkw==";
-
};
-
homeassistant = {
-
acl = [ "readwrite #" ];
-
hashedPassword = "$7$101$wGQZPdVdeW7iQFmH$bK/VOR6LXCLJKbb6M4PNeVptocjBAWXCLMtEU5fQNBr0Y5UAWlhVg8UAu4IkIXgnViI51NnhXKykdlWF63VkVQ==";
-
};
+
listeners = [{
+
users = {
+
zigbee2mqtt = {
+
acl = [ "readwrite #" ];
+
hashedPassword =
+
"$6$nuDIW/ZPVsrDHyBe$JffJJvvMG+nH8GH9V5h4FqJkU0nfiFkDzAsdYNTHeJMgBXEX9epPkQTUdLG9L47K54vMxm/+toeMAiKD63Dfkw==";
+
};
+
homeassistant = {
+
acl = [ "readwrite #" ];
+
hashedPassword =
+
"$7$101$wGQZPdVdeW7iQFmH$bK/VOR6LXCLJKbb6M4PNeVptocjBAWXCLMtEU5fQNBr0Y5UAWlhVg8UAu4IkIXgnViI51NnhXKykdlWF63VkVQ==";
};
-
}
-
];
+
};
+
}];
};
services.home-assistant = {
enable = true;
-
extraComponents = [
-
"esphome"
-
"met"
-
"radio_browser"
-
"mqtt"
-
"zha"
-
];
-
config = {
-
default_config = {};
-
};
+
extraComponents = [ "esphome" "met" "radio_browser" "mqtt" "zha" ];
+
config = { default_config = { }; };
};
}
+143 -53
hosts/owl/default.nix
···
${config.networking.domain} = {
soa.serial = 2018011658;
records = [
-
{ name = "@"; type = "TXT"; data = "google-site-verification=rEvwSqf7RYKRQltY412qMtTuoxPp64O3L7jMotj9Jnc"; }
-
{ name = "teapot"; type = "CNAME"; data = "vps"; }
+
{
+
name = "@";
+
type = "TXT";
+
data =
+
"google-site-verification=rEvwSqf7RYKRQltY412qMtTuoxPp64O3L7jMotj9Jnc";
+
}
+
{
+
name = "teapot";
+
type = "CNAME";
+
data = "vps";
+
}
-
{ name = "@"; type = "NS"; data = "ns1"; }
-
{ name = "@"; type = "NS"; data = "ns2"; }
+
{
+
name = "@";
+
type = "NS";
+
data = "ns1";
+
}
+
{
+
name = "@";
+
type = "NS";
+
data = "ns2";
+
}
-
{ name = "ns1"; type = "A"; data = config.eilean.serverIpv4; }
-
{ name = "ns1"; type = "AAAA"; data = config.eilean.serverIpv6; }
-
{ name = "ns2"; type = "A"; data = config.eilean.serverIpv4; }
-
{ name = "ns2"; type = "AAAA"; data = config.eilean.serverIpv6; }
+
{
+
name = "ns1";
+
type = "A";
+
data = config.eilean.serverIpv4;
+
}
+
{
+
name = "ns1";
+
type = "AAAA";
+
data = config.eilean.serverIpv6;
+
}
+
{
+
name = "ns2";
+
type = "A";
+
data = config.eilean.serverIpv4;
+
}
+
{
+
name = "ns2";
+
type = "AAAA";
+
data = config.eilean.serverIpv6;
+
}
-
{ name = "@"; type = "A"; data = config.eilean.serverIpv4; }
-
{ name = "@"; type = "AAAA"; data = config.eilean.serverIpv6; }
-
{ name = "vps"; type = "A"; data = config.eilean.serverIpv4; }
-
{ name = "vps"; type = "AAAA"; data = config.eilean.serverIpv6; }
+
{
+
name = "@";
+
type = "A";
+
data = config.eilean.serverIpv4;
+
}
+
{
+
name = "@";
+
type = "AAAA";
+
data = config.eilean.serverIpv6;
+
}
+
{
+
name = "vps";
+
type = "A";
+
data = config.eilean.serverIpv4;
+
}
+
{
+
name = "vps";
+
type = "AAAA";
+
data = config.eilean.serverIpv6;
+
}
-
{ name = "@"; type = "LOC"; data = "52 12 40.4 N 0 5 31.9 E 22m 10m 10m 10m"; }
+
{
+
name = "@";
+
type = "LOC";
+
data = "52 12 40.4 N 0 5 31.9 E 22m 10m 10m 10m";
+
}
-
{ name = "ns.cl"; type = "A"; data = "128.232.113.136"; }
-
{ name = "cl"; type = "NS"; data = "ns.cl"; }
+
{
+
name = "ns.cl";
+
type = "A";
+
data = "128.232.113.136";
+
}
+
{
+
name = "cl";
+
type = "NS";
+
data = "ns.cl";
+
}
-
{ name = "ns1.eilean"; type = "A"; data = "65.109.10.223"; }
-
{ name = "eilean"; type = "NS"; data = "ns1.eilean"; }
+
{
+
name = "ns1.eilean";
+
type = "A";
+
data = "65.109.10.223";
+
}
+
{
+
name = "eilean";
+
type = "NS";
+
data = "ns1.eilean";
+
}
-
{ name = "shrew"; type = "CNAME"; data = "vps"; }
+
{
+
name = "shrew";
+
type = "CNAME";
+
data = "vps";
+
}
# generate with
# sudo openssl x509 -in /var/lib/acme/mail.freumh.org/fullchain.pem -pubkey -noout | openssl pkey -pubin -outform der | sha256sum | awk '{print "3 1 1", $1}'
-
{ name = "_25._tcp.mail"; type = "TLSA"; data = "3 1 1 2f0fd413f063c75141937dd196a9f4ab66139d599e0dcf2a7ce6d557647e26a6"; }
+
{
+
name = "_25._tcp.mail";
+
type = "TLSA";
+
data =
+
"3 1 1 2f0fd413f063c75141937dd196a9f4ab66139d599e0dcf2a7ce6d557647e26a6";
+
}
# generate with
# for i in r3 e1 r4-cross-signed e2
# openssl x509 -in ~/downloads/lets-encrypt-$i.pem -pubkey -noout | openssl pkey -pubin -outform der | sha256sum | awk '{print "2 1 1", $1}'
# LE R3
-
{ name = "_25._tcp.mail"; type = "TLSA"; data = "2 1 1 8d02536c887482bc34ff54e41d2ba659bf85b341a0a20afadb5813dcfbcf286d"; }
+
{
+
name = "_25._tcp.mail";
+
type = "TLSA";
+
data =
+
"2 1 1 8d02536c887482bc34ff54e41d2ba659bf85b341a0a20afadb5813dcfbcf286d";
+
}
# LE E1
-
{ name = "_25._tcp.mail"; type = "TLSA"; data = "2 1 1 276fe8a8c4ec7611565bf9fce6dcace9be320c1b5bea27596b2204071ed04f10"; }
+
{
+
name = "_25._tcp.mail";
+
type = "TLSA";
+
data =
+
"2 1 1 276fe8a8c4ec7611565bf9fce6dcace9be320c1b5bea27596b2204071ed04f10";
+
}
# LE R4
-
{ name = "_25._tcp.mail"; type = "TLSA"; data = "2 1 1 e5545e211347241891c554a03934cde9b749664a59d26d615fe58f77990f2d03"; }
+
{
+
name = "_25._tcp.mail";
+
type = "TLSA";
+
data =
+
"2 1 1 e5545e211347241891c554a03934cde9b749664a59d26d615fe58f77990f2d03";
+
}
# LE E2
-
{ name = "_25._tcp.mail"; type = "TLSA"; data = "2 1 1 bd936e72b212ef6f773102c6b77d38f94297322efc25396bc3279422e0c89270"; }
+
{
+
name = "_25._tcp.mail";
+
type = "TLSA";
+
data =
+
"2 1 1 bd936e72b212ef6f773102c6b77d38f94297322efc25396bc3279422e0c89270";
+
}
];
};
"fn06.org" = {
soa.serial = 1706745601;
-
records = [
-
{
-
name = "capybara.fn06.org";
-
type = "CNAME";
-
data = "fn06.org";
-
}
-
];
+
records = [{
+
name = "capybara.fn06.org";
+
type = "CNAME";
+
data = "fn06.org";
+
}];
};
};
services.bind.zones.${config.networking.domain}.extraConfig = ''
···
inline-signing yes;
journal "${config.services.bind.directory}/${config.networking.domain}.signed.jnl";
'' +
-
# dig ns org +short | xargs dig +short
-
# replace with `checkds true;` in bind 9.20
-
''
-
parental-agents {
-
199.19.56.1;
-
199.249.112.1;
-
199.19.54.1;
-
199.249.120.1;
-
199.19.53.1;
-
199.19.57.1;
-
};
-
'';
+
# dig ns org +short | xargs dig +short
+
# replace with `checkds true;` in bind 9.20
+
''
+
parental-agents {
+
199.19.56.1;
+
199.249.112.1;
+
199.19.54.1;
+
199.249.120.1;
+
199.19.53.1;
+
199.19.57.1;
+
};
+
'';
-
services.nginx.commonHttpConfig = ''
add_header Strict-Transport-Security max-age=31536000 always;
add_header X-Frame-Options SAMEORIGIN always;
···
repository = "rest:http://100.64.0.9:8000/${config.networking.hostName}/";
passwordFile = config.age.secrets.restic-owl.path;
initialize = true;
-
paths = [
-
"/var/"
-
"/run/"
-
"/etc/"
-
];
+
paths = [ "/var/" "/run/" "/etc/" ];
timerConfig = {
OnCalendar = "03:00";
randomizedDelaySec = "1hr";
···
age.secrets.email-ryan.file = ../../secrets/email-ryan.age;
age.secrets.email-system.file = ../../secrets/email-system.age;
-
eilean.mailserver.systemAccountPasswordFile = config.age.secrets.email-system.path;
+
eilean.mailserver.systemAccountPasswordFile =
+
config.age.secrets.email-system.path;
mailserver.loginAccounts = {
"${config.eilean.username}@${config.networking.domain}" = {
passwordFile = config.age.secrets.email-ryan.path;
···
];
sieveScript = ''
require ["fileinto", "mailbox"];
-
+
if header :contains ["to", "cc"] ["~rjarry/aerc-discuss@lists.sr.ht"] {
fileinto :create "lists.aerc";
stop;
···
catchAll = [ "${config.networking.domain}" ];
};
"system@${config.networking.domain}" = {
-
aliases = [
-
"nas@${config.networking.domain}"
-
];
+
aliases = [ "nas@${config.networking.domain}" ];
};
};
}
+6 -2
hosts/owl/hardware-configuration.nix
···
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.loader.grub.device = "/dev/sda";
-
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ];
+
boot.initrd.availableKernelModules =
+
[ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ];
boot.initrd.kernelModules = [ "nvme" ];
-
fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; };
+
fileSystems."/" = {
+
device = "/dev/sda1";
+
fsType = "ext4";
+
};
networking = {
interfaces."enp1s0" = {
ipv6.addresses = [{
+5 -4
hosts/owl/minimal.nix
···
{ pkgs, config, lib, eilean, ... }:
{
-
imports = [
-
./hardware-configuration.nix
-
];
+
imports = [ ./hardware-configuration.nix ];
personal = {
enable = true;
···
boot.tmp.cleanOnBoot = true;
zramSwap.enable = true;
-
swapDevices = [ { device = "/var/swap"; size = 2048; } ];
+
swapDevices = [{
+
device = "/var/swap";
+
size = 2048;
+
}];
}
+17 -24
hosts/shrew/default.nix
···
{ config, pkgs, lib, nixos-hardware, nixpkgs, ... }:
{
-
imports = [
-
./hardware-configuration.nix
-
"${nixos-hardware}/raspberry-pi/4"
-
];
+
imports = [ ./hardware-configuration.nix "${nixos-hardware}/raspberry-pi/4" ];
personal = {
enable = true;
···
user = "zigbee2mqtt";
password = "test";
};
-
serial = {
-
port = "/dev/ttyUSB0";
-
};
+
serial = { port = "/dev/ttyUSB0"; };
frontend = {
port = 15606;
url = "http://shrew";
};
homeassistant = true;
-
advanced = {
-
channel = 15;
-
};
+
advanced = { channel = 15; };
};
};
services.mosquitto = {
enable = true;
-
listeners = [
-
{
-
users = {
-
zigbee2mqtt = {
-
acl = [ "readwrite #" ];
-
hashedPassword = "$6$nuDIW/ZPVsrDHyBe$JffJJvvMG+nH8GH9V5h4FqJkU0nfiFkDzAsdYNTHeJMgBXEX9epPkQTUdLG9L47K54vMxm/+toeMAiKD63Dfkw==";
-
};
-
homeassistant = {
-
acl = [ "readwrite #" ];
-
hashedPassword = "$7$101$wGQZPdVdeW7iQFmH$bK/VOR6LXCLJKbb6M4PNeVptocjBAWXCLMtEU5fQNBr0Y5UAWlhVg8UAu4IkIXgnViI51NnhXKykdlWF63VkVQ==";
-
};
+
listeners = [{
+
users = {
+
zigbee2mqtt = {
+
acl = [ "readwrite #" ];
+
hashedPassword =
+
"$6$nuDIW/ZPVsrDHyBe$JffJJvvMG+nH8GH9V5h4FqJkU0nfiFkDzAsdYNTHeJMgBXEX9epPkQTUdLG9L47K54vMxm/+toeMAiKD63Dfkw==";
+
};
+
homeassistant = {
+
acl = [ "readwrite #" ];
+
hashedPassword =
+
"$7$101$wGQZPdVdeW7iQFmH$bK/VOR6LXCLJKbb6M4PNeVptocjBAWXCLMtEU5fQNBr0Y5UAWlhVg8UAu4IkIXgnViI51NnhXKykdlWF63VkVQ==";
};
-
}
-
];
+
};
+
}];
};
services.home-assistant = {
···
config = {
# Includes dependencies for a basic setup
# https://www.home-assistant.io/integrations/default_config/
-
default_config = {};
+
default_config = { };
automation = "!include automations.yaml";
scene = "!include scenes.yaml";
http = {
+5 -7
hosts/shrew/hardware-configuration.nix
···
{ config, lib, pkgs, modulesPath, ... }:
{
-
imports =
-
[ (modulesPath + "/installer/scan/not-detected.nix")
-
];
+
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "xhci_pci" "usbhid" ];
boot.initrd.kernelModules = [ ];
···
# https://github.com/NixOS/nixpkgs/issues/191095#issuecomment-1320982678
boot.kernelPackages = pkgs.linuxKernel.packages.linux_rpi4;
-
fileSystems."/" =
-
{ device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888";
-
fsType = "ext4";
-
};
+
fileSystems."/" = {
+
device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888";
+
fsType = "ext4";
+
};
swapDevices = [ ];
+3 -8
hosts/shrew/sd-image.nix
···
{ lib, nixpkgs, ... }:
{
-
imports = [
-
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
-
];
+
imports =
+
[ "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" ];
nixpkgs.hostPlatform = "aarch64-linux";
···
networking.wireless = {
enable = true;
-
networks = {
-
"SSID" = {
-
psk = "password";
-
};
-
};
+
networks = { "SSID" = { psk = "password"; }; };
};
}
+129 -132
hosts/swan/default.nix
···
{ pkgs, config, lib, eilean, ... }:
-
let domain = "eeg.cl.cam.ac.uk"; in
-
{
-
imports = [
-
./hardware-configuration.nix
-
./minimal.nix
-
];
+
let domain = "eeg.cl.cam.ac.uk";
+
in {
+
imports = [ ./hardware-configuration.nix ./minimal.nix ];
security.acme = {
defaults.email = "${config.eilean.username}@${config.networking.domain}";
acceptTerms = true;
};
-
environment.systemPackages = with pkgs; [
-
xe-guest-utilities
-
];
+
environment.systemPackages = with pkgs; [ xe-guest-utilities ];
services.hyperbib = {
enable = true;
···
services.nginx.enable = lib.mkForce false;
services.httpd = {
enable = true;
-
extraModules = let
-
mod_ucam_webauth = pkgs.callPackage ./mod_ucam_webauth.nix { };
-
in [ {
-
name = "ucam_webauth";
-
path = "${mod_ucam_webauth}/modules/mod_ucam_webauth.so";
-
} ];
+
extraModules =
+
let mod_ucam_webauth = pkgs.callPackage ./mod_ucam_webauth.nix { };
+
in [{
+
name = "ucam_webauth";
+
path = "${mod_ucam_webauth}/modules/mod_ucam_webauth.so";
+
}];
virtualHosts."${domain}" = {
forceSSL = true;
enableACME = true;
documentRoot = "/var/www/eeg/";
locations."/bib/" = {
-
proxyPass = "http://127.0.0.1:${builtins.toString config.services.hyperbib.port}/bib/";
+
proxyPass = "http://127.0.0.1:${
+
builtins.toString config.services.hyperbib.port
+
}/bib/";
};
extraConfig = let
keyfile = pkgs.writeTextFile {
···
-----END RSA PUBLIC KEY-----
'';
};
-
matrixServerConfig = pkgs.writeText "matrix-server-config.json" (builtins.toJSON {
-
"m.server" = "${domain}:443";
-
});
-
matrixClientConfig = pkgs.writeText "matrix-server-config.json" (builtins.toJSON {
-
"m.homeserver" = { "base_url" = "https://${domain}"; };
-
"m.identity_server" = { "base_url" = "https://vector.im"; };
-
});
+
matrixServerConfig = pkgs.writeText "matrix-server-config.json"
+
(builtins.toJSON { "m.server" = "${domain}:443"; });
+
matrixClientConfig = pkgs.writeText "matrix-server-config.json"
+
(builtins.toJSON {
+
"m.homeserver" = { "base_url" = "https://${domain}"; };
+
"m.identity_server" = { "base_url" = "https://vector.im"; };
+
});
in ''
AAKeyDir ${keyfile}
AACookieKey file:/dev/urandom
···
enableACME = true;
locations."/" = {
extraConfig = ''
-
ProxyPass http://127.0.0.1:${builtins.toString config.services.peertube.listenHttp}/ upgrade=websocket
-
ProxyPassReverse http://127.0.0.1:${builtins.toString config.services.peertube.listenHttp}/
+
ProxyPass http://127.0.0.1:${
+
builtins.toString config.services.peertube.listenHttp
+
}/ upgrade=websocket
+
ProxyPassReverse http://127.0.0.1:${
+
builtins.toString config.services.peertube.listenHttp
+
}/
'';
};
extraConfig = ''
···
services.matrix-synapse = {
enable = true;
-
settings = lib.mkMerge [
-
{
-
server_name = domain;
-
enable_registration = false;
-
auto_join_rooms = [ "#EEG:eeg.cl.cam.ac.uk" ];
-
password_config.enabled = false;
-
listeners = [
-
{
-
port = 8008;
-
bind_addresses = [ "::1" "127.0.0.1" ];
-
type = "http";
-
tls = false;
-
x_forwarded = true;
-
resources = [
-
{
-
names = [ "client" "federation" ];
-
compress = false;
-
}
-
];
-
}
-
];
-
max_upload_size = "100M";
-
saml2_config = {
-
sp_config = {
-
metadata.remote = [ { url = "https://shib.raven.cam.ac.uk/shibboleth"; } ];
-
description = [ "Energy and Environment Group Computer Lab Matrix Server" "en" ];
-
name = [ "EEG CL Matrix Server" "en" ];
-
# generate keys with
-
# sudo nix shell nixpkgs#openssl nixpkgs#shibboleth-sp -c sh -c '`nix eval --raw nixpkgs#shibboleth-sp`/etc/shibboleth/keygen.sh -h matrix.eeg.cl.cam.ac.uk -o /secrets/matrix-shibboleth/'
-
# chown -R matrix-synapse /secrets/matrix-shibboleth/
-
key_file = "/secrets/matrix-shibboleth/sp-key.pem";
-
cert_file = "/secrets/matrix-shibboleth/sp-cert.pem";
-
encryption_keypairs = [
-
{ key_file = "/secrets/matrix-shibboleth/sp-key.pem"; }
-
{ cert_file = "/secrets/matrix-shibboleth/sp-cert.pem"; }
-
];
-
attribute_map_dir = pkgs.writeTextDir "map.py" ''
-
MAP = {
-
"identifier": "urn:oasis:names:tc:SAML:2.0:attrname-format:uri",
-
"fro": {
-
'urn:oid:0.9.2342.19200300.100.1.1': 'uid',
-
'urn:oid:0.9.2342.19200300.100.1.3': 'email',
-
'urn:oid:2.16.840.1.113730.3.1.241': 'displayName',
-
},
-
"to": {
-
'uid': 'urn:oid:0.9.2342.19200300.100.1.1',
-
'email': 'urn:oid:0.9.2342.19200300.100.1.3',
-
'displayName': 'urn:oid:2.16.840.1.113730.3.1.241',
-
},
-
}
-
'';
-
};
+
settings = lib.mkMerge [{
+
server_name = domain;
+
enable_registration = false;
+
auto_join_rooms = [ "#EEG:eeg.cl.cam.ac.uk" ];
+
password_config.enabled = false;
+
listeners = [{
+
port = 8008;
+
bind_addresses = [ "::1" "127.0.0.1" ];
+
type = "http";
+
tls = false;
+
x_forwarded = true;
+
resources = [{
+
names = [ "client" "federation" ];
+
compress = false;
+
}];
+
}];
+
max_upload_size = "100M";
+
saml2_config = {
+
sp_config = {
+
metadata.remote =
+
[{ url = "https://shib.raven.cam.ac.uk/shibboleth"; }];
+
description =
+
[ "Energy and Environment Group Computer Lab Matrix Server" "en" ];
+
name = [ "EEG CL Matrix Server" "en" ];
+
# generate keys with
+
# sudo nix shell nixpkgs#openssl nixpkgs#shibboleth-sp -c sh -c '`nix eval --raw nixpkgs#shibboleth-sp`/etc/shibboleth/keygen.sh -h matrix.eeg.cl.cam.ac.uk -o /secrets/matrix-shibboleth/'
+
# chown -R matrix-synapse /secrets/matrix-shibboleth/
+
key_file = "/secrets/matrix-shibboleth/sp-key.pem";
+
cert_file = "/secrets/matrix-shibboleth/sp-cert.pem";
+
encryption_keypairs = [
+
{ key_file = "/secrets/matrix-shibboleth/sp-key.pem"; }
+
{ cert_file = "/secrets/matrix-shibboleth/sp-cert.pem"; }
+
];
+
attribute_map_dir = pkgs.writeTextDir "map.py" ''
+
MAP = {
+
"identifier": "urn:oasis:names:tc:SAML:2.0:attrname-format:uri",
+
"fro": {
+
'urn:oid:0.9.2342.19200300.100.1.1': 'uid',
+
'urn:oid:0.9.2342.19200300.100.1.3': 'email',
+
'urn:oid:2.16.840.1.113730.3.1.241': 'displayName',
+
},
+
"to": {
+
'uid': 'urn:oid:0.9.2342.19200300.100.1.1',
+
'email': 'urn:oid:0.9.2342.19200300.100.1.3',
+
'displayName': 'urn:oid:2.16.840.1.113730.3.1.241',
+
},
+
}
+
'';
};
-
app_service_config_files = [ "/var/lib/heisenbridge/registration.yml" ];
-
}
-
];
+
};
+
app_service_config_files = [ "/var/lib/heisenbridge/registration.yml" ];
+
}];
};
networking.firewall.allowedTCPPorts = [
-
80 # HTTP
-
443 # HTTPS
+
80 # HTTP
+
443 # HTTPS
6667
];
···
storage.videos = "/tank/peertube/videos";
};
secrets.secretsFile = "/secrets/peertube";
-
serviceEnvironmentFile = "/secrets/peertube.env";
+
serviceEnvironmentFile = "/secrets/peertube.env";
dataDirs = [ "/tank/peertube/videos" ];
};
···
services.inspircd = {
enable = true;
config = ''
-
<module name="ssl_gnutls">
+
<module name="ssl_gnutls">
-
<server
-
name="eeg.cl.cam.ac.uk"
-
description="EEG Lab IRC Server at Cambridge"
-
network="EEGLabNetwork"
-
>
+
<server
+
name="eeg.cl.cam.ac.uk"
+
description="EEG Lab IRC Server at Cambridge"
+
network="EEGLabNetwork"
+
>
-
<admin
-
name="Ryan Gibb"
-
nick="rtg24"
-
email="rtg24@eeg.cl.cam.ac.uk"
-
>
+
<admin
+
name="Ryan Gibb"
+
nick="rtg24"
+
email="rtg24@eeg.cl.cam.ac.uk"
+
>
-
<bind
-
address="128.232.98.96"
-
port="6667"
-
type="clients"
-
>
+
<bind
+
address="128.232.98.96"
+
port="6667"
+
type="clients"
+
>
-
<oper
-
name="RyanGibb"
-
password="securepassword"
-
host="*@*"
-
type="NetAdmin"
-
>
+
<oper
+
name="RyanGibb"
+
password="securepassword"
+
host="*@*"
+
type="NetAdmin"
+
>
-
<type
-
name="NetAdmin"
-
classes="ServerLink ClientLink"
-
>
+
<type
+
name="NetAdmin"
+
classes="ServerLink ClientLink"
+
>
-
<class
-
name="ServerLink"
-
commands="300"
-
usermodes="300"
-
maxtime="0"
-
>
+
<class
+
name="ServerLink"
+
commands="300"
+
usermodes="300"
+
maxtime="0"
+
>
-
<class
-
name="ClientLink"
-
commands="20"
-
usermodes="20"
-
maxtime="90"
-
>
+
<class
+
name="ClientLink"
+
commands="20"
+
usermodes="20"
+
maxtime="90"
+
>
-
<channels
-
users="20"
-
op="@"
-
halfop="%"
-
voice="+"
-
>
+
<channels
+
users="20"
+
op="@"
+
halfop="%"
+
voice="+"
+
>
-
<log method="stdout"
-
type="*"
-
level="default"
-
flush="1">
-
'';
+
<log method="stdout"
+
type="*"
+
level="default"
+
flush="1">
+
'';
};
}
+16 -15
hosts/swan/hardware-configuration.nix
···
{ config, lib, pkgs, ... }:
{
-
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "sr_mod" "xen_blkfront" ];
+
boot.initrd.availableKernelModules =
+
[ "ata_piix" "uhci_hcd" "sr_mod" "xen_blkfront" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
···
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/xvda"; # or "nodev" for efi only
-
fileSystems."/" =
-
{ device = "/dev/disk/by-uuid/a0a1f9cf-78b3-402d-996d-68950326e7d0";
-
fsType = "ext4";
-
};
+
fileSystems."/" = {
+
device = "/dev/disk/by-uuid/a0a1f9cf-78b3-402d-996d-68950326e7d0";
+
fsType = "ext4";
+
};
fileSystems."/tank" = {
device = "/dev/pool/tank";
···
swapDevices = [ ];
networking = {
-
useDHCP = false;
-
interfaces."enX0".ipv4.addresses = [{
-
address = "128.232.98.96";
-
prefixLength = 23;
-
}];
-
defaultGateway = {
-
address = "128.232.98.1";
-
interface = "enX0";
-
};
-
nameservers = [ "1.1.1.1" ];
+
useDHCP = false;
+
interfaces."enX0".ipv4.addresses = [{
+
address = "128.232.98.96";
+
prefixLength = 23;
+
}];
+
defaultGateway = {
+
address = "128.232.98.1";
+
interface = "enX0";
+
};
+
nameservers = [ "1.1.1.1" ];
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
+5 -4
hosts/swan/minimal.nix
···
{ pkgs, config, lib, eilean, ... }:
{
-
imports = [
-
./hardware-configuration.nix
-
];
+
imports = [ ./hardware-configuration.nix ];
personal = {
enable = true;
···
services.openssh.openFirewall = true;
-
swapDevices = [ { device = "/var/swap"; size = 1024; } ];
+
swapDevices = [{
+
device = "/var/swap";
+
size = 1024;
+
}];
}
+1 -1
hosts/swan/mod_ucam_webauth.nix
···
hash = "sha256-NbwHRy0SYXvpVBzJGhgI3IAAY+uVr9yRvFfMACKK4MU=";
};
-
buildInputs = [ openssl.dev ];
+
buildInputs = [ openssl.dev ];
buildPhase = ''
make APXS=${apacheHttpd.dev}/bin/apxs
+6 -5
hosts/vulpine/default.nix
···
{ pkgs, ... }:
{
-
imports = [
-
./hardware-configuration.nix
-
];
+
imports = [ ./hardware-configuration.nix ];
personal = {
enable = true;
···
device = "nodev";
efiSupport = true;
};
-
-
swapDevices = [ { device = "/swapfile"; size = 8192; } ];
+
+
swapDevices = [{
+
device = "/swapfile";
+
size = 8192;
+
}];
boot.supportedFilesystems = [ "ntfs" ];
+22 -17
hosts/vulpine/hardware-configuration.nix
···
{ config, lib, pkgs, modulesPath, ... }:
{
-
imports =
-
[ (modulesPath + "/installer/scan/not-detected.nix")
-
];
+
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
-
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "sd_mod" ];
+
boot.initrd.availableKernelModules =
+
[ "xhci_pci" "ehci_pci" "ahci" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
# kvm for virtualisation, wl for broadcom_sta kernel module
boot.kernelModules = [ "kvm-intel" "wl" ];
···
# loading bcma/b43 at the same time as wl seems to cause issues
boot.blacklistedKernelModules = [ "bcma" "b43" ];
-
fileSystems."/" =
-
{ device = "/dev/disk/by-uuid/d2afdf21-7a3a-47f0-83e1-31e9cccdad84";
-
fsType = "ext4";
-
};
+
fileSystems."/" = {
+
device = "/dev/disk/by-uuid/d2afdf21-7a3a-47f0-83e1-31e9cccdad84";
+
fsType = "ext4";
+
};
-
fileSystems."/boot" =
-
{ device = "/dev/disk/by-uuid/43FD-8669";
-
fsType = "vfat";
-
};
+
fileSystems."/boot" = {
+
device = "/dev/disk/by-uuid/43FD-8669";
+
fsType = "vfat";
+
};
-
fileSystems."/media/hdd" =
-
{ device = "/dev/disk/by-label/HDD";
-
options = [ "nofail" "x-systemd.device-timeout=1ms" "x-systemd.automount" "x-systemd.idle-timeout=10min" ];
-
};
+
fileSystems."/media/hdd" = {
+
device = "/dev/disk/by-label/HDD";
+
options = [
+
"nofail"
+
"x-systemd.device-timeout=1ms"
+
"x-systemd.automount"
+
"x-systemd.idle-timeout=10min"
+
];
+
};
swapDevices = [ ];
networking.useDHCP = lib.mkDefault true;
-
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
+
hardware.cpu.intel.updateMicrocode =
+
lib.mkDefault config.hardware.enableRedistributableFirmware;
# high-resolution display
# hardware.video.hidpi.enable = lib.mkDefault true;
+8 -10
modules/default.nix
···
default = "ryan";
};
-
config = let nixPath = "/etc/nix-path"; in {
+
config = let nixPath = "/etc/nix-path";
+
in {
eilean = {
username = config.custom.username;
serverIpv4 = "135.181.100.27";
···
# https://discourse.nixos.org/t/do-flakes-also-set-the-system-channel/19798/16
nixPath = [ "nixpkgs=${nixPath}" ];
};
-
systemd.tmpfiles.rules = [
-
"L+ ${nixPath} - - - - ${pkgs.path}"
-
];
+
systemd.tmpfiles.rules = [ "L+ ${nixPath} - - - - ${pkgs.path}" ];
system.autoUpgrade = {
enable = true;
allowReboot = true;
flake = inputs.self.outPath;
-
flags = [
-
"--update-input"
-
"nixpkgs"
-
"-L"
-
];
+
flags = [ "--update-input" "nixpkgs" "-L" ];
dates = "03:00";
randomizedDelaySec = "1hr";
-
rebootWindow = { lower = "03:00"; upper = "05:00"; };
+
rebootWindow = {
+
lower = "03:00";
+
upper = "05:00";
+
};
};
systemd.services.nixos-upgrade.preStart = with pkgs; ''
DIR=/etc/nixos
+6 -7
modules/hosting/eeww.nix
···
with lib;
-
let cfg = config.services.eeww; in
-
{
+
let cfg = config.services.eeww;
+
in {
options = {
services.eeww = {
enable = mkEnableOption "eeww";
-
domain = lib.mkOption {
-
type = lib.types.str;
-
};
+
domain = lib.mkOption { type = lib.types.str; };
port = lib.mkOption {
type = lib.types.port;
default = 8081;
···
config = lib.mkIf cfg.enable {
# TODO use unix socket?
-
services.nginx.virtualHosts."${cfg.domain}".locations."/".proxyPass = "http://localhost:${builtins.toString cfg.port}";
+
services.nginx.virtualHosts."${cfg.domain}".locations."/".proxyPass =
+
"http://localhost:${builtins.toString cfg.port}";
systemd.services.eeww = {
enable = true;
···
isSystemUser = true;
};
-
users.groups."${cfg.group}" = {};
+
users.groups."${cfg.group}" = { };
};
}
+21 -21
modules/hosting/freumh.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.hosting; in
-
{
+
let cfg = config.hosting;
+
in {
options.hosting.freumh.enable = lib.mkEnableOption "freumh";
-
+
config = lib.mkIf cfg.freumh.enable {
security.acme = {
defaults.email = "${config.eilean.username}@${config.networking.domain}";
···
locations."/index.html".root = pkgs.writeTextFile {
name = "freumh";
text = ''
-
<html>
-
<body>
-
<pre>
-
||
-
\\
-
_ || __
-
\ / \\ / \
-
\__/ \\/
-
\\ __
-
_ / \\ / \_/
-
_/ \ || \__/
-
\// \
-
// \
-
|| \_
-
</html>
-
</body>
-
</pre>
+
<html>
+
<body>
+
<pre>
+
||
+
\\
+
_ || __
+
\ / \\ / \
+
\__/ \\/
+
\\ __
+
_ / \\ / \_/
+
_/ \ || \__/
+
\// \
+
// \
+
|| \_
+
</html>
+
</body>
+
</pre>
'';
destination = "/index.html";
};
···
locations."/.well-known/security.txt".root = pkgs.writeTextFile {
name = "freumh-security.txt";
text = ''
-
Contact: mailto:security@freumh.org
+
Contact: mailto:security@freumh.org
'';
destination = "/.well-known/security.txt";
};
+10 -10
modules/hosting/nix-cache.nix
···
{ config, pkgs, lib, ... }:
-
let cfg = config.hosting; in
-
{
+
let cfg = config.hosting;
+
in {
options.hosting.nix-cache.enable = lib.mkEnableOption "nix-cache";
config = lib.mkIf cfg.nix-cache.enable {
···
enableACME = true;
forceSSL = true;
locations."/".extraConfig = ''
-
proxy_pass http://localhost:${toString config.services.nix-serve.port};
+
proxy_pass http://localhost:${
+
toString config.services.nix-serve.port
+
};
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
···
};
};
-
eilean.services.dns.zones.${config.networking.domain}.records = [
-
{
-
name = "binarycache";
-
type = "CNAME";
-
data = "vps";
-
}
-
];
+
eilean.services.dns.zones.${config.networking.domain}.records = [{
+
name = "binarycache";
+
type = "CNAME";
+
data = "vps";
+
}];
};
}
+9 -11
modules/hosting/rmfakecloud.nix
···
let
cfg = config.hosting.rmfakecloud;
domain = config.networking.domain;
-
in
-
{
+
in {
options.hosting.rmfakecloud = {
enable = mkEnableOption "rmfakecloud";
port = mkOption {
···
extraSettings = {
RM_SMTP_SERVER = "mail.freumh.org:465";
RM_SMTP_USERNAME = "misc@${domain}";
-
RM_SMTP_FROM="remarkable@${domain}";
+
RM_SMTP_FROM = "remarkable@${domain}";
};
};
-
mailserver.loginAccounts."misc@${domain}".aliases = [ "remarkable@${domain}" ];
+
mailserver.loginAccounts."misc@${domain}".aliases =
+
[ "remarkable@${domain}" ];
# nginx handles letsencrypt
services.nginx = {
···
};
};
-
eilean.services.dns.zones.${config.networking.domain}.records = [
-
{
-
name = "rmfakecloud";
-
type = "CNAME";
-
data = "vps";
-
}
-
];
+
eilean.services.dns.zones.${config.networking.domain}.records = [{
+
name = "rmfakecloud";
+
type = "CNAME";
+
data = "vps";
+
}];
};
}
+14 -14
modules/personal/default.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal; in
-
{
-
options.personal = {
-
enable = lib.mkEnableOption "personal";
-
};
+
let cfg = config.personal;
+
in {
+
options.personal = { enable = lib.mkEnableOption "personal"; };
config = lib.mkIf cfg.enable {
console = {
···
};
users = let
-
hashedPassword = "$6$IPvnJnu6/fp1Jxfy$U6EnzYDOC2NqE4iqRrkJJbSTHHNWk0KwK1xyk9jEvlu584UWQLyzDVF5I1Sh47wQhSVrvUI4mrqw6XTTjfPj6.";
+
hashedPassword =
+
"$6$IPvnJnu6/fp1Jxfy$U6EnzYDOC2NqE4iqRrkJJbSTHHNWk0KwK1xyk9jEvlu584UWQLyzDVF5I1Sh47wQhSVrvUI4mrqw6XTTjfPj6.";
in {
mutableUsers = false;
groups.plugdev = { };
···
inhibit-lid = "systemd-inhibit --what=handle-lid-switch sleep 1d";
tmux = "tmux -2";
feh = "feh --scale-down --auto-zoom";
-
nix-stray-roots = "nix-store --gc --print-roots | egrep -v '^(/nix/var|/run|/proc|{censored})'";
+
nix-stray-roots =
+
"nix-store --gc --print-roots | egrep -v '^(/nix/var|/run|/proc|{censored})'";
};
sessionVariables = {
NIX_AUTO_RUN = "y";
NIX_AUTO_RUN_INTERACTIVE = "y";
-
BROWSER="firefox"; # urlview
+
BROWSER = "firefox"; # urlview
};
};
-
+
networking = rec {
# nameservers = [ ${config.eilean.serverIpv4} ];
nameservers = [ "1.1.1.1" ];
···
programs.git = {
enable = true;
config = {
-
init = {
-
defaultBranch = "main";
-
};
+
init = { defaultBranch = "main"; };
user = {
email = "${config.custom.username}@${config.networking.domain}";
name = "Ryan Gibb";
···
l = "log";
lg = "log -p";
lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
-
lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all";
+
lola =
+
"log --graph --decorate --pretty=oneline --abbrev-commit --all";
ls = "ls-files";
a = "add";
aa = "add --all";
···
else
tmux set-option status off
fi
-
''; in ''
+
'';
+
in ''
set-window-option -g mode-keys vi
set-option -g mouse on
set-option -g set-titles on
+3 -5
modules/personal/dict.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal; in
-
{
+
let cfg = config.personal;
+
in {
options.personal.dict = lib.mkOption {
type = types.bool;
default = true;
···
config = lib.mkIf cfg.dict {
services.dictd.enable = true;
-
environment.systemPackages = with pkgs; [
-
dict
-
];
+
environment.systemPackages = with pkgs; [ dict ];
};
}
+64 -58
modules/personal/external-hdd-backup.nix
···
-
{ pkgs, config, lib, ... }:
-
let cfg = config.personal; in
-
{
+
let cfg = config.personal;
+
in {
options.personal.backup = {
enable = lib.mkEnableOption "laptop";
disk = lib.mkOption {
···
default = "external-hdd";
};
};
-
+
config = lib.mkIf cfg.backup.enable {
systemd.services.backup = {
description = "Backup service";
···
# Error mounting /dev/sda1: GDBus.Error:org.freedesktop.UDisks2.Error.NotAuthorizedCanObtain: Not authorized to perform operation
# And in order to communicate with GUI prompts, e.g. yad, we need to run as user
# udisks is still use for on-demand mountin, but we'll use the autofs for mounting the backup disk
-
script = let backup = pkgs.writeShellScript "backup.sh" ''
-
# TODO make nixos module with options
-
DISK="${cfg.backup.disk}"
-
LAST_RUN_FILE="$HOME/.cache/last_backup"
+
script = let
+
backup = pkgs.writeShellScript "backup.sh" ''
+
# TODO make nixos module with options
+
DISK="${cfg.backup.disk}"
+
LAST_RUN_FILE="$HOME/.cache/last_backup"
+
+
if [ -f "$LAST_RUN_FILE" ] && [ "$(( $(date +%s) - $(date +%s -r "$LAST_RUN_FILE") ))" -lt 86400 ]; then
+
echo "<24hrs"
+
exit 0
+
fi
-
if [ -f "$LAST_RUN_FILE" ] && [ "$(( $(date +%s) - $(date +%s -r "$LAST_RUN_FILE") ))" -lt 86400 ]; then
-
echo "<24hrs"
+
# if no external-hdd
+
if [ ! -e $DISK ]; then
+
echo "no $DISK"
exit 0
-
fi
+
fi
-
# if no external-hdd
-
if [ ! -e $DISK ]; then
-
echo "no $DISK"
-
exit 0
-
fi
-
-
export DISPLAY=:0
-
${pkgs.xorg.xhost}/bin/xhost +local:${config.custom.username}
-
export GTK_R2_FILES=$HOME/.gtkrc-2.0
-
timeout 60 ${pkgs.yad}/bin/yad --question --title "backup" --text "Backup now? Will autostart in 60s."
-
prompt_status=$?
-
${pkgs.xorg.xhost}/bin/xhost -local:${config.custom.username}
-
# if not success or timeout
-
if [ ! $prompt_status -eq 0 -a ! $prompt_status -eq 124 ]; then
-
echo "backup cancelled"
-
${pkgs.libnotify}/bin/notify-send "backup cancelled"
-
exit 0
-
fi
+
export DISPLAY=:0
+
${pkgs.xorg.xhost}/bin/xhost +local:${config.custom.username}
+
export GTK_R2_FILES=$HOME/.gtkrc-2.0
+
timeout 60 ${pkgs.yad}/bin/yad --question --title "backup" --text "Backup now? Will autostart in 60s."
+
prompt_status=$?
+
${pkgs.xorg.xhost}/bin/xhost -local:${config.custom.username}
+
# if not success or timeout
+
if [ ! $prompt_status -eq 0 -a ! $prompt_status -eq 124 ]; then
+
echo "backup cancelled"
+
${pkgs.libnotify}/bin/notify-send "backup cancelled"
+
exit 0
+
fi
-
DIR="${cfg.backup.mountdir}/${cfg.backup.mountname}"
-
cd "$DIR"
-
TEST_DIR=`${pkgs.util-linux}/bin/findmnt -nr -o target -S $DISK`
-
status=$?
-
if [ ! $status -eq 0 ]; then
-
echo "backup failed to find mount"
-
${pkgs.libnotify}/bin/notify-send "backup failed to find mount"
+
DIR="${cfg.backup.mountdir}/${cfg.backup.mountname}"
+
cd "$DIR"
+
TEST_DIR=`${pkgs.util-linux}/bin/findmnt -nr -o target -S $DISK`
+
status=$?
+
if [ ! $status -eq 0 ]; then
+
echo "backup failed to find mount"
+
${pkgs.libnotify}/bin/notify-send "backup failed to find mount"
+
exit $status
+
fi
+
if [ "$DIR" != "$TEST_DIR" ]; then
+
echo "backup disk mounted at unexpected path: $TEST_DIR"
+
${pkgs.libnotify}/bin/notify-send "backup disk mounted at unexpected path: $TEST_DIR"
+
exit 1
+
fi
+
${pkgs.libnotify}/bin/notify-send "backup starting"
+
${pkgs.rsync}/bin/rsync -va --exclude={".cache",".local/share/Steam/"} ~/ $DIR/home/ −−delete−after
+
status=$?
+
if [ $status -eq 0 ]; then
+
touch "$LAST_RUN_FILE"
+
echo "backup finished"
+
${pkgs.libnotify}/bin/notify-send "backup finished"
+
else
+
echo "backup failed"
+
${pkgs.libnotify}/bin/notify-send "backup failed"
+
fi
exit $status
-
fi
-
if [ "$DIR" != "$TEST_DIR" ]; then
-
echo "backup disk mounted at unexpected path: $TEST_DIR"
-
${pkgs.libnotify}/bin/notify-send "backup disk mounted at unexpected path: $TEST_DIR"
-
exit 1
-
fi
-
${pkgs.libnotify}/bin/notify-send "backup starting"
-
${pkgs.rsync}/bin/rsync -va --exclude={".cache",".local/share/Steam/"} ~/ $DIR/home/ −−delete−after
-
status=$?
-
if [ $status -eq 0 ]; then
-
touch "$LAST_RUN_FILE"
-
echo "backup finished"
-
${pkgs.libnotify}/bin/notify-send "backup finished"
-
else
-
echo "backup failed"
-
${pkgs.libnotify}/bin/notify-send "backup failed"
-
fi
-
exit $status
-
''; in "${backup}";
+
'';
+
in "${backup}";
serviceConfig = {
Type = "oneshot";
User = config.custom.username;
};
# trigger on wake
-
wantedBy = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" "suspend-then-hibernate.target" ];
+
wantedBy = [
+
"suspend.target"
+
"hibernate.target"
+
"hybrid-sleep.target"
+
"suspend-then-hibernate.target"
+
];
environment.DBUS_SESSION_BUS_ADDRESS = "unix:path=/run/user/1000/bus";
};
# trigger backup on hard drive connection
···
# but we just assume the Seagate Expansion Desk is the same as /dev/disk/by-label/external-hdd
# UDEV has crap support for detecting devices
''
-
ACTION=="add", SUBSYSTEM=="block", KERNEL=="sd[a-z]*[0-9]*", ATTRS{model}=="Expansion Desk ", ATTRS{vendor}=="Seagate ", TAG+="systemd", ENV{SYSTEMD_WANTS}+="backup"
-
'';
+
ACTION=="add", SUBSYSTEM=="block", KERNEL=="sd[a-z]*[0-9]*", ATTRS{model}=="Expansion Desk ", ATTRS{vendor}=="Seagate ", TAG+="systemd", ENV{SYSTEMD_WANTS}+="backup"
+
'';
services.autofs = {
enable = true;
autoMaster = let
+81 -84
modules/personal/gui/default.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal.gui; in
-
{
+
let cfg = config.personal.gui;
+
in {
options.personal.gui.enable = lib.mkOption {
type = lib.types.bool;
default = cfg.i3 || cfg.sway || cfg.kde;
···
nixpkgs.config.allowUnfree = true;
-
home-manager = {
-
useGlobalPkgs = true;
-
};
+
home-manager = { useGlobalPkgs = true; };
environment.systemPackages = with pkgs;
let
-
desktopEntries = [
-
(pkgs.makeDesktopItem {
-
name = "feh.desktop";
-
desktopName = "feh";
-
exec = "feh --scale-down --auto-zoom";
-
icon = "feh";
+
desktopEntries = [
+
(pkgs.makeDesktopItem {
+
name = "feh.desktop";
+
desktopName = "feh";
+
exec = "feh --scale-down --auto-zoom";
+
icon = "feh";
+
})
+
];
+
in [
+
jq
+
playerctl
+
brightnessctl
+
xdg-utils
+
yad
+
networkmanagerapplet
+
pavucontrol
+
(xfce.thunar.override {
+
thunarPlugins = with xfce; [ thunar-archive-plugin xfconf ];
})
-
];
-
in [
-
jq
-
playerctl
-
brightnessctl
-
xdg-utils
-
yad
-
networkmanagerapplet
-
pavucontrol
-
(xfce.thunar.override { thunarPlugins = with xfce; [
-
thunar-archive-plugin
-
xfconf
-
]; })
-
gnome.file-roller
-
gnome.cheese
-
# https://discourse.nixos.org/t/sway-wm-configuration-polkit-login-manager/3857/6
-
polkit_gnome
-
glib
-
feh
-
libnotify
+
gnome.file-roller
+
gnome.cheese
+
# https://discourse.nixos.org/t/sway-wm-configuration-polkit-login-manager/3857/6
+
polkit_gnome
+
glib
+
feh
+
libnotify
-
# https://nixos.wiki/wiki/PipeWire#pactl_not_found
-
pulseaudio
+
# https://nixos.wiki/wiki/PipeWire#pactl_not_found
+
pulseaudio
-
(firefox.override {
-
nativeMessagingHosts = with pkgs; [
-
tridactyl-native
-
];
-
})
-
tridactyl-native
-
chromium
-
gparted
-
vlc
-
(vscode-with-extensions.override {
-
vscode = vscodium;
-
vscodeExtensions = with vscode-extensions; [
-
asvetliakov.vscode-neovim
-
james-yu.latex-workshop
-
ocamllabs.ocaml-platform
-
streetsidesoftware.code-spell-checker
-
jdinhlife.gruvbox
-
bbenoist.nix
-
];
-
})
-
vscode
+
(firefox.override {
+
nativeMessagingHosts = with pkgs; [ tridactyl-native ];
+
})
+
tridactyl-native
+
chromium
+
gparted
+
vlc
+
(vscode-with-extensions.override {
+
vscode = vscodium;
+
vscodeExtensions = with vscode-extensions; [
+
asvetliakov.vscode-neovim
+
james-yu.latex-workshop
+
ocamllabs.ocaml-platform
+
streetsidesoftware.code-spell-checker
+
jdinhlife.gruvbox
+
bbenoist.nix
+
];
+
})
+
vscode
-
i3-workspace-history
-
] ++ desktopEntries;
+
i3-workspace-history
+
] ++ desktopEntries;
fonts.packages = with pkgs; [
noto-fonts
···
services.tumbler.enable = true;
# ZSA Moonlander udev rules
-
services.udev.packages = [ (pkgs.writeTextFile {
-
name = "zsa-udev-rules";
-
text = ''
-
# Rules for Oryx web flashing and live training
-
KERNEL=="hidraw*", ATTRS{idVendor}=="16c0", MODE="0664", GROUP="plugdev"
-
KERNEL=="hidraw*", ATTRS{idVendor}=="3297", MODE="0664", GROUP="plugdev"
-
-
# Legacy rules for live training over webusb (Not needed for firmware v21+)
-
# Rule for all ZSA keyboards
-
SUBSYSTEM=="usb", ATTR{idVendor}=="3297", GROUP="plugdev"
-
# Rule for the Moonlander
-
SUBSYSTEM=="usb", ATTR{idVendor}=="3297", ATTR{idProduct}=="1969", GROUP="plugdev"
-
# Rule for the Ergodox EZ
-
SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="1307", GROUP="plugdev"
-
# Rule for the Planck EZ
-
SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="6060", GROUP="plugdev"
-
-
# Wally Flashing rules for the Ergodox EZ
-
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1"
-
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1"
-
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", MODE:="0666"
-
KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", MODE:="0666"
-
-
# Wally Flashing rules for the Moonlander and Planck EZ
-
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE:="0666", SYMLINK+="stm32_dfu"
-
'';
-
destination = "/lib/udev/rules.d/50-zsa.rules";
-
}) ];
+
services.udev.packages = [
+
(pkgs.writeTextFile {
+
name = "zsa-udev-rules";
+
text = ''
+
# Rules for Oryx web flashing and live training
+
KERNEL=="hidraw*", ATTRS{idVendor}=="16c0", MODE="0664", GROUP="plugdev"
+
KERNEL=="hidraw*", ATTRS{idVendor}=="3297", MODE="0664", GROUP="plugdev"
+
+
# Legacy rules for live training over webusb (Not needed for firmware v21+)
+
# Rule for all ZSA keyboards
+
SUBSYSTEM=="usb", ATTR{idVendor}=="3297", GROUP="plugdev"
+
# Rule for the Moonlander
+
SUBSYSTEM=="usb", ATTR{idVendor}=="3297", ATTR{idProduct}=="1969", GROUP="plugdev"
+
# Rule for the Ergodox EZ
+
SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="1307", GROUP="plugdev"
+
# Rule for the Planck EZ
+
SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="6060", GROUP="plugdev"
+
+
# Wally Flashing rules for the Ergodox EZ
+
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1"
+
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1"
+
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", MODE:="0666"
+
KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", MODE:="0666"
+
+
# Wally Flashing rules for the Moonlander and Planck EZ
+
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE:="0666", SYMLINK+="stm32_dfu"
+
'';
+
destination = "/lib/udev/rules.d/50-zsa.rules";
+
})
+
];
# sets $WORLDLIST
environment.wordlist.enable = true;
+2 -2
modules/personal/gui/extra.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal.gui; in
-
{
+
let cfg = config.personal.gui;
+
in {
options.personal.gui.extra = lib.mkEnableOption "extra";
config = lib.mkIf cfg.extra {
+2 -2
modules/personal/gui/i3.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal.gui; in
-
{
+
let cfg = config.personal.gui;
+
in {
options.personal.gui.i3 = lib.mkEnableOption "i3";
config = lib.mkIf cfg.i3 {
+2 -2
modules/personal/gui/kde.nix
···
{ config, lib, ... }:
-
let cfg = config.personal.gui; in
-
{
+
let cfg = config.personal.gui;
+
in {
options.personal.gui.kde = lib.mkEnableOption "kde";
config = lib.mkIf cfg.kde {
+2 -2
modules/personal/gui/sway.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal.gui; in
-
{
+
let cfg = config.personal.gui;
+
in {
options.personal.gui.sway = lib.mkEnableOption "sway";
config = lib.mkIf cfg.sway {
+18 -25
modules/personal/home/default.nix
···
{ pkgs, config, ... }:
{
-
imports = [
-
./mail/default.nix
-
];
+
imports = [ ./mail/default.nix ];
gtk = {
enable = true;
···
# evince workaround
home.sessionVariables.GTK_THEME = "gruvbox-dark";
-
home.sessionVariables.WALLPAPER =
-
let wallpaper = ./wallpaper.jpg; in
-
pkgs.runCommand (builtins.baseNameOf wallpaper) {} "cp ${wallpaper} $out";
+
home.sessionVariables.WALLPAPER = let wallpaper = ./wallpaper.jpg;
+
in pkgs.runCommand (builtins.baseNameOf wallpaper) { } "cp ${wallpaper} $out";
home.sessionVariables.GOPATH = "$HOME/.go";
home.pointerCursor = {
-
name = "Adwaita";
-
package = pkgs.gnome.adwaita-icon-theme;
-
size = 32;
+
name = "Adwaita";
+
package = pkgs.gnome.adwaita-icon-theme;
+
size = 32;
};
home.file.".profile".text = ''
source "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
'';
-
programs.firefox =
-
let
+
programs.firefox = let
settings = {
"browser.ctrlTab.recentlyUsedOrder" = false;
"browser.tabs.warnOnClose" = false;
···
# Use userChrome.css
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
-
"browser.shell.checkDefaultBrowser" = false;
+
"browser.shell.checkDefaultBrowser" = false;
# sync toolbar
"services.sync.prefs.sync.browser.uiCustomization.state" = true;
···
visibility: collapse;
}
'';
-
in
-
{
+
in {
enable = true;
profiles.default = {
settings = settings;
···
userChrome = userChrome;
};
package = (pkgs.firefox.override {
-
nativeMessagingHosts = with pkgs; [
-
tridactyl-native
-
];
+
nativeMessagingHosts = with pkgs; [ tridactyl-native ];
});
};
···
userDirs = {
enable = true;
createDirectories = true;
-
download = "$HOME/downloads";
-
pictures = "$HOME/pictures";
-
videos = "$HOME/videos";
-
documents = "$HOME/documents/";
-
music = "$HOME/";
+
download = "$HOME/downloads";
+
pictures = "$HOME/pictures";
+
videos = "$HOME/videos";
+
documents = "$HOME/documents/";
+
music = "$HOME/";
# https://bugzilla.mozilla.org/show_bug.cgi?id=1082717
-
desktop = "$HOME/";
-
templates = "$HOME/";
+
desktop = "$HOME/";
+
templates = "$HOME/";
publicShare = "$HOME/";
};
};
-
+
# https://github.com/nix-community/home-manager/issues/1439#issuecomment-1106208294
home.activation = {
linkDesktopApplications = {
+35 -34
modules/personal/home/i3.nix
···
{ pkgs, lib, ... }:
-
let replacements = {
-
wm = "i3";
-
wmmsg = "i3-msg";
-
rofi = "rofi";
-
app_id = "class";
-
bar_extra = "";
-
locked = "";
-
polkit_gnome = "${pkgs.polkit_gnome}";
-
locker = "xsecurelock";
-
enable_output = "xrandr --output $laptop_output --auto";
-
disable_output = "xrandr --output $laptop_output --off";
-
drun = "rofi -i -modi drun -show drun";
-
run = "rofi -i -modi run -show run";
-
dmenu = "rofi -i -dmenu -p";
-
displays = "arandr";
-
bar = "i3bar";
-
notification_deamon = "dunst";
-
i3-workspace-history = "${pkgs.i3-workspace-history}";
-
i3-workspace-history-args = "";
-
}; in
-
let util = import ./util.nix { inherit pkgs lib; }; in
-
{
+
let
+
replacements = {
+
wm = "i3";
+
wmmsg = "i3-msg";
+
rofi = "rofi";
+
app_id = "class";
+
bar_extra = "";
+
locked = "";
+
polkit_gnome = "${pkgs.polkit_gnome}";
+
locker = "xsecurelock";
+
enable_output = "xrandr --output $laptop_output --auto";
+
disable_output = "xrandr --output $laptop_output --off";
+
drun = "rofi -i -modi drun -show drun";
+
run = "rofi -i -modi run -show run";
+
dmenu = "rofi -i -dmenu -p";
+
displays = "arandr";
+
bar = "i3bar";
+
notification_deamon = "dunst";
+
i3-workspace-history = "${pkgs.i3-workspace-history}";
+
i3-workspace-history-args = "";
+
};
+
in let util = import ./util.nix { inherit pkgs lib; };
+
in {
# TODO
# idling
···
'';
};
-
xdg.configFile =
-
let entries = {
+
xdg.configFile = let
+
entries = {
"dunst/dunstrc".source = ./dunst;
-
"i3/config".text =
-
let wmFilenames = util.listFilesInDir ./wm/config.d; in
-
let i3Filenames = util.listFilesInDir ./wm/i3; in
-
(util.concatFilesReplace ([ ./wm/config ] ++ wmFilenames ++ i3Filenames) replacements);
+
"i3/config".text = let wmFilenames = util.listFilesInDir ./wm/config.d;
+
in let i3Filenames = util.listFilesInDir ./wm/i3;
+
in (util.concatFilesReplace
+
([ ./wm/config ] ++ wmFilenames ++ i3Filenames) replacements);
"i3blocks".source = ./i3blocks;
"rofi/config.rasi".source = ./rofi.rasi;
-
}; in
-
(util.inDirReplace ./wm/scripts "i3/scripts" replacements) // entries;
+
};
+
in (util.inDirReplace ./wm/scripts "i3/scripts" replacements) // entries;
-
services.redshift = {
-
enable = true;
-
provider = "geoclue2";
-
};
+
services.redshift = {
+
enable = true;
+
provider = "geoclue2";
+
};
}
+1 -3
modules/personal/home/mail/aerc-binds.nix
···
"E" = ":envelope -h<Enter>";
};
-
"messages:folder=Drafts" = {
-
"<Enter>" = ":recall<Enter>";
-
};
+
"messages:folder=Drafts" = { "<Enter>" = ":recall<Enter>"; };
view = {
"/" = ":toggle-key-passthrough<Enter>/";
+30 -26
modules/personal/home/mail/default.nix
···
${pkgs.ugrep}/bin/ugrep -jPh -m 100 --color=never "$1"\
${config.accounts.email.maildirBasePath}/addressbook/maildir\
${config.accounts.email.maildirBasePath}/addressbook/cam-ldap
-
'';
+
'';
sync-mail = pkgs.writeScriptBin "sync-mail" ''
#!/usr/bin/env bash
${pkgs.isync}/bin/mbsync "$1"
···
"ui:folder=Sent".index-columns = "date<=,to<50,flags>=,subject<*";
"ui:folder=Sent".column-to = "{{index (.To | persons) 0}}";
openers."text/html" = "firefox --new-window";
-
hooks.mail-recieved = ''notify-send "[$AERC_ACCOUNT/$AERC_FOLDER] mail from $AERC_FROM_NAME" "$AERC_SUBJECT"'';
+
hooks.mail-recieved = ''
+
notify-send "[$AERC_ACCOUNT/$AERC_FOLDER] mail from $AERC_FROM_NAME" "$AERC_SUBJECT"'';
filters = {
"text/plain" = "wrap -w 90 | colorize";
"text/calendar" = "calendar";
···
"mu find"
macro index <F9> "<change-folder-readonly>˜/Maildir/search" \
"mu find results"
-
'';
+
'';
};
};
···
imapnotify = {
enable = true;
boxes = [ "Inbox" ];
-
onNotify = "${pkgs.isync}/bin/mbsync ryan@freumh.org && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
+
onNotify =
+
"${pkgs.isync}/bin/mbsync ryan@freumh.org && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
};
mbsync = {
enable = true;
···
expunge = "both";
remove = "both";
};
-
msmtp = {
-
enable = true;
-
};
+
msmtp = { enable = true; };
aerc = {
enable = true;
extraAccounts = {
-
check-mail-cmd = "${pkgs.isync}/bin/mbsync ryan@freumh.org && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
+
check-mail-cmd =
+
"${pkgs.isync}/bin/mbsync ryan@freumh.org && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
check-mail-timeout = "1m";
check-mail = "1h";
folders-sort = [ "Inbox" "Sent" "Drafts" "Archive" "Spam" "Trash" ];
···
imapnotify = {
enable = true;
boxes = [ "Inbox" ];
-
onNotify = "${pkgs.isync}/bin/mbsync misc@freumh.org && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
+
onNotify =
+
"${pkgs.isync}/bin/mbsync misc@freumh.org && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
};
mbsync = {
enable = true;
···
expunge = "both";
remove = "both";
};
-
msmtp = {
-
enable = true;
-
};
+
msmtp = { enable = true; };
neomutt = {
enable = true;
extraConfig = ''
···
userName = "rtg24@fm.cl.cam.ac.uk";
address = "ryan.gibb@cl.cam.ac.uk";
realName = "Ryan Gibb";
-
passwordCommand = "${pkgs.pass}/bin/pass show email/ryan.gibb@cl.cam.ac.uk";
+
passwordCommand =
+
"${pkgs.pass}/bin/pass show email/ryan.gibb@cl.cam.ac.uk";
flavor = "fastmail.com";
folders = {
drafts = "Drafts";
···
imapnotify = {
enable = true;
boxes = [ "Inbox" ];
-
onNotify = "${pkgs.isync}/bin/mbsync ryan.gibb@cl.cam.ac.uk && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
+
onNotify =
+
"${pkgs.isync}/bin/mbsync ryan.gibb@cl.cam.ac.uk && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
};
mbsync = {
enable = true;
···
expunge = "both";
remove = "both";
};
-
msmtp = {
-
enable = true;
-
};
+
msmtp = { enable = true; };
aerc = {
enable = true;
extraAccounts = {
-
check-mail-cmd = "${pkgs.isync}/bin/mbsync ryan.gibb@cl.cam.ac.uk && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
+
check-mail-cmd =
+
"${pkgs.isync}/bin/mbsync ryan.gibb@cl.cam.ac.uk && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
check-mail-timeout = "1m";
check-mail = "1h";
aliases = "rtg24@cam.ac.uk";
-
folders-sort = [ "Inbox" "Sidebox" "Sent" "Drafts" "Archive" "Spam" "Trash" ];
+
folders-sort =
+
[ "Inbox" "Sidebox" "Sent" "Drafts" "Archive" "Spam" "Trash" ];
folder-map = "${pkgs.writeText "folder-map" ''
Bin = Trash
''}";
···
userName = "ryangibb321@gmail.com";
address = "ryangibb321@gmail.com";
realName = "Ryan Gibb";
-
passwordCommand = "${pkgs.pass}/bin/pass show email/ryangibb321@gmail.com";
+
passwordCommand =
+
"${pkgs.pass}/bin/pass show email/ryangibb321@gmail.com";
flavor = "gmail.com";
folders = {
drafts = "Drafts";
···
imapnotify = {
enable = true;
boxes = [ "Inbox" ];
-
onNotify = "${pkgs.isync}/bin/mbsync ryangibb321@gmail.com && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
+
onNotify =
+
"${pkgs.isync}/bin/mbsync ryangibb321@gmail.com && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
};
mbsync = {
enable = true;
···
expunge = "both";
remove = "both";
};
-
msmtp = {
-
enable = true;
-
};
+
msmtp = { enable = true; };
aerc = {
enable = true;
extraAccounts = {
-
check-mail-cmd = "${pkgs.isync}/bin/mbsync ryangibb321@gmail.com && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
+
check-mail-cmd =
+
"${pkgs.isync}/bin/mbsync ryangibb321@gmail.com && ${pkgs.mu}/bin/mu index && ${pkgs.procps}/bin/pkill -RTMIN+13 i3blocks";
check-mail-timeout = "1m";
check-mail = "1h";
-
folders-sort = [ "Inbox" "Sidebox" "Sent" "Drafts" "Archive" "Spam" "Trash" ];
+
folders-sort =
+
[ "Inbox" "Sidebox" "Sent" "Drafts" "Archive" "Spam" "Trash" ];
folder-map = "${pkgs.writeText "folder-map" ''
* = [Gmail]/*
Sent = 'Sent Mail'
+37 -36
modules/personal/home/sway.nix
···
{ pkgs, lib, ... }:
-
let replacements = {
-
wm = "sway";
-
wmmsg = "swaymsg";
-
rofi = "wofi";
-
app_id = "app_id";
-
bar_extra = ''
-
icon_theme Papirus
-
'';
-
locked = "--locked";
-
polkit_gnome = "${pkgs.polkit_gnome}";
-
locker = "swaylock -f -i $WALLPAPER";
-
enable_output = "swaymsg output $laptop_output enable";
-
disable_output = "swaymsg output $laptop_output disable";
-
drun = "wofi -i --show drun --allow-images -a";
-
run = "wofi -i --show run";
-
dmenu = "wofi -d -i -p";
-
displays = "wdisplays";
-
bar = "swaybar";
-
notification_deamon = "mako";
-
i3-workspace-history = "${pkgs.i3-workspace-history}";
-
i3-workspace-history-args = "-sway";
-
}; in
-
let util = import ./util.nix { inherit pkgs lib; }; in
-
{
+
let
+
replacements = {
+
wm = "sway";
+
wmmsg = "swaymsg";
+
rofi = "wofi";
+
app_id = "app_id";
+
bar_extra = ''
+
icon_theme Papirus
+
'';
+
locked = "--locked";
+
polkit_gnome = "${pkgs.polkit_gnome}";
+
locker = "swaylock -f -i $WALLPAPER";
+
enable_output = "swaymsg output $laptop_output enable";
+
disable_output = "swaymsg output $laptop_output disable";
+
drun = "wofi -i --show drun --allow-images -a";
+
run = "wofi -i --show run";
+
dmenu = "wofi -d -i -p";
+
displays = "wdisplays";
+
bar = "swaybar";
+
notification_deamon = "mako";
+
i3-workspace-history = "${pkgs.i3-workspace-history}";
+
i3-workspace-history-args = "-sway";
+
};
+
in let util = import ./util.nix { inherit pkgs lib; };
+
in {
home.sessionVariables = {
QT_QPA_PLATFORM = "wayland";
SDL_VIDEODRIVER = "wayland";
···
fi
'';
-
xdg.configFile =
-
let entries = {
+
xdg.configFile = let
+
entries = {
"fusuma/config.yml".source = ./fusuma.yml;
"kanshi/config".source = ./kanshi;
"mako/config".source = ./mako;
···
save_dir=$XDG_PICTURES_DIR/capture/
save_filename_format=screenshot_%Y-%m-%dT%H:%M:%S%z.png
'';
-
"sway/config".text =
-
let wmFilenames = util.listFilesInDir ./wm/config.d; in
-
let swayFilenames = util.listFilesInDir ./wm/sway; in
-
(util.concatFilesReplace ([ ./wm/config ] ++ wmFilenames ++ swayFilenames) replacements);
+
"sway/config".text = let wmFilenames = util.listFilesInDir ./wm/config.d;
+
in let swayFilenames = util.listFilesInDir ./wm/sway;
+
in (util.concatFilesReplace
+
([ ./wm/config ] ++ wmFilenames ++ swayFilenames) replacements);
"i3blocks".source = ./i3blocks;
-
}; in
-
(util.inDirReplace ./wm/scripts "sway/scripts" replacements) // entries;
-
-
services.gammastep = {
-
enable = true;
-
provider = "geoclue2";
};
+
in (util.inDirReplace ./wm/scripts "sway/scripts" replacements) // entries;
+
+
services.gammastep = {
+
enable = true;
+
provider = "geoclue2";
+
};
}
+30 -16
modules/personal/home/util.nix
···
{ pkgs, lib, ... }:
{
-
listFilesInDir = src: lib.attrsets.mapAttrsToList (name: value: "${src}/${name}") (builtins.readDir src);
-
inDirReplace = src: dst: replacements: lib.pipe src [
-
# get filenames in src directory
-
builtins.readDir
-
(lib.attrsets.mapAttrsToList (name: value: "${name}"))
-
# call `substituteAll` on all files
-
(
-
let substitutedSource = file: { source = (pkgs.substituteAll ({src="/${src}/${file}"; isExecutable = true;} // replacements)); }; in
-
builtins.map (file: lib.attrsets.nameValuePair "${dst}/${file}" (substitutedSource file))
-
)
-
builtins.listToAttrs
-
];
+
listFilesInDir = src:
+
lib.attrsets.mapAttrsToList (name: value: "${src}/${name}")
+
(builtins.readDir src);
+
inDirReplace = src: dst: replacements:
+
lib.pipe src [
+
# get filenames in src directory
+
builtins.readDir
+
(lib.attrsets.mapAttrsToList (name: value: "${name}"))
+
# call `substituteAll` on all files
+
(let
+
substitutedSource = file: {
+
source = (pkgs.substituteAll ({
+
src = "/${src}/${file}";
+
isExecutable = true;
+
} // replacements));
+
};
+
in builtins.map (file:
+
lib.attrsets.nameValuePair "${dst}/${file}" (substitutedSource file)))
+
builtins.listToAttrs
+
];
concatFilesReplace = filenames: replacements:
-
let fromStrings = lib.attrsets.mapAttrsToList (name: value: "@${name}@") replacements; in
-
let toStrings = lib.attrsets.mapAttrsToList (name: value: "${value}") replacements; in
-
let fileToString = file: builtins.replaceStrings fromStrings toStrings (builtins.readFile file); in
-
builtins.concatStringsSep "\n" (builtins.map fileToString filenames);
+
let
+
fromStrings =
+
lib.attrsets.mapAttrsToList (name: value: "@${name}@") replacements;
+
in let
+
toStrings =
+
lib.attrsets.mapAttrsToList (name: value: "${value}") replacements;
+
in let
+
fileToString = file:
+
builtins.replaceStrings fromStrings toStrings (builtins.readFile file);
+
in builtins.concatStringsSep "\n" (builtins.map fileToString filenames);
}
+3 -3
modules/personal/laptop.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal; in
-
{
+
let cfg = config.personal;
+
in {
options.personal.laptop = lib.mkEnableOption "laptop";
-
+
config = lib.mkIf cfg.laptop {
users.users.${config.custom.username}.extraGroups = [ "input" ];
+2 -2
modules/personal/nix-index.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal; in
-
{
+
let cfg = config.personal;
+
in {
config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.nix-index ];
programs.command-not-found.enable = false;
+38 -43
modules/personal/nvim/default.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal; in
-
let
-
obsidian-nvim =
-
(pkgs.vimUtils.buildVimPlugin {
-
pname = "obsidian.nvim";
-
version = "2.6.0";
-
src = pkgs.fetchFromGitHub {
-
owner = "epwalsh";
-
repo = "obsidian.nvim";
-
rev = "v2.6.0";
-
sha256 = "sha256-+w3XYoobuH17oinPfQxhrizbmQB5IbbulUK69674/Wg=";
-
};
-
});
-
ltex-ls-nvim =
-
(pkgs.vimUtils.buildVimPlugin {
-
pname = "ltex-ls.nvim";
-
version = "2.6.0";
-
src = pkgs.fetchFromGitHub {
-
owner = "vigoux";
-
repo = "ltex-ls.nvim";
-
rev = "c8139ea6b7f3d71adcff121e16ee8726037ffebd";
-
sha256 = "sha256-jY3ALr6h88xnWN2QdKe3R0vvRcSNhFWDW56b2NvnTCs=";
-
};
-
});
-
in
-
{
+
let cfg = config.personal;
+
in let
+
obsidian-nvim = (pkgs.vimUtils.buildVimPlugin {
+
pname = "obsidian.nvim";
+
version = "2.6.0";
+
src = pkgs.fetchFromGitHub {
+
owner = "epwalsh";
+
repo = "obsidian.nvim";
+
rev = "v2.6.0";
+
sha256 = "sha256-+w3XYoobuH17oinPfQxhrizbmQB5IbbulUK69674/Wg=";
+
};
+
});
+
ltex-ls-nvim = (pkgs.vimUtils.buildVimPlugin {
+
pname = "ltex-ls.nvim";
+
version = "2.6.0";
+
src = pkgs.fetchFromGitHub {
+
owner = "vigoux";
+
repo = "ltex-ls.nvim";
+
rev = "c8139ea6b7f3d71adcff121e16ee8726037ffebd";
+
sha256 = "sha256-jY3ALr6h88xnWN2QdKe3R0vvRcSNhFWDW56b2NvnTCs=";
+
};
+
});
+
in {
options.personal.nvim-lsps = lib.mkEnableOption "nvim-lsps";
config = lib.mkIf cfg.enable {
-
environment.systemPackages = with pkgs; [
-
ripgrep
-
nixd
-
] ++ lib.lists.optionals cfg.nvim-lsps [
-
alejandra
-
# stop complaining when launching but a devshell is better
-
ocamlPackages.ocaml-lsp
-
ocamlPackages.ocamlformat
-
lua-language-server
-
pyright
-
black
-
ltex-ls
-
jdt-language-server
-
nodejs_18
-
clang-tools
-
typst-lsp
-
];
+
environment.systemPackages = with pkgs;
+
[ ripgrep nixd ] ++ lib.lists.optionals cfg.nvim-lsps [
+
nixfmt
+
# stop complaining when launching but a devshell is better
+
ocamlPackages.ocaml-lsp
+
ocamlPackages.ocamlformat
+
lua-language-server
+
pyright
+
black
+
ltex-ls
+
jdt-language-server
+
nodejs_18
+
clang-tools
+
typst-lsp
+
];
programs.neovim = {
enable = true;
viAlias = true;
+3 -3
modules/personal/ocaml.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal; in
-
{
+
let cfg = config.personal;
+
in {
options.personal.ocaml = lib.mkEnableOption "ocaml";
-
+
config = lib.mkIf cfg.ocaml {
environment.systemPackages = with pkgs; [
ocaml
+3 -3
modules/personal/printing.nix
···
{ config, lib, ... }:
-
let cfg = config.personal; in
-
{
+
let cfg = config.personal;
+
in {
options.personal.printing = lib.mkEnableOption "printing";
-
+
config = lib.mkIf cfg.printing {
networking.firewall = {
allowedTCPPorts = [ 631 ];
+2 -2
modules/personal/scripts.nix
···
{ config, lib, ... }:
-
let cfg = config.personal; in
-
{
+
let cfg = config.personal;
+
in {
config = lib.mkIf cfg.enable {
environment.interactiveShellInit = "export PATH=$PATH:/etc/nixos/scripts";
};
+4 -6
modules/personal/shell.nix
···
{ config, lib, ... }:
-
let cfg = config.personal; in
-
{
+
let cfg = config.personal;
+
in {
options.personal.machineColour = lib.mkOption {
type = lib.types.str;
default = "cyan";
};
-
+
config = lib.mkIf cfg.enable {
programs.zsh = {
enable = true;
···
enable = true;
highlightStyle = "fg=5";
};
-
syntaxHighlighting = {
-
enable = true;
-
};
+
syntaxHighlighting = { enable = true; };
autosuggestions.strategy = [ "match_prev_cmd" "completion" "history" ];
promptInit = ''
PROMPT='%(?..%F{red}%3?%f )%F{${config.personal.machineColour}}%n@%m%f:%~ %#'$'\n'
+4 -3
modules/personal/ssh.nix
···
{ pkgs, config, lib, ... }:
-
let cfg = config.personal; in
-
{
+
let cfg = config.personal;
+
in {
config = lib.mkIf cfg.enable {
users.mutableUsers = false;
-
users.users.${config.custom.username}.openssh.authorizedKeys.keyFiles = [ ./authorized_keys ];
+
users.users.${config.custom.username}.openssh.authorizedKeys.keyFiles =
+
[ ./authorized_keys ];
users.users.root.openssh.authorizedKeys.keyFiles = [ ./authorized_keys ];
programs.mosh.enable = true;
+2 -2
modules/personal/tailscale.nix
···
with lib;
-
let cfg = config.personal; in
-
{
+
let cfg = config.personal;
+
in {
options.personal.tailscale = mkEnableOption "tailscale";
config = lib.mkIf cfg.tailscale {
+2 -2
modules/personal/wireguard-hosts.nix
···
{ config, lib, ... }:
-
let cfg = config.personal; in
-
{
+
let cfg = config.personal;
+
in {
config.wireguard.hosts = lib.mkIf cfg.enable {
"vps" = {
ip = "10.0.0.1";
+180 -183
nix-on-droid/default.nix
···
home-manager = {
useGlobalPkgs = true;
-
config =
-
{ pkgs, lib, ... }:
-
{
-
# Use the same overlays as the system packages
-
nixpkgs = { inherit (config.nixpkgs) overlays; };
+
config = { pkgs, lib, ... }: {
+
# Use the same overlays as the system packages
+
nixpkgs = { inherit (config.nixpkgs) overlays; };
-
nix = {
-
package = pkgs.nix;
-
settings.experimental-features = [ "nix-command" "flakes" ];
-
};
-
-
# https://github.com/nix-community/nix-on-droid/issues/185
-
home.shellAliases = {
-
sshd =
-
let config = pkgs.writeText "sshd_config" ''
-
HostKey /data/data/com.termux.nix/files/home/.ssh/id_ed25519
-
Port 9022
-
'';
-
in "$(readlink $(whereis sshd)) -f ${config}";
-
ping = "/android/system/bin/linker64 /android/system/bin/ping";
-
};
+
nix = {
+
package = pkgs.nix;
+
settings.experimental-features = [ "nix-command" "flakes" ];
+
};
-
programs.zsh = {
-
enable = true;
-
history.size = 100000;
-
enableAutosuggestions = true;
-
syntaxHighlighting.enable = true;
-
initExtraFirst = ''
-
export ZSH_AUTOSUGGEST_STRATEGY=(match_prev_cmd completion history)
-
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=5"
-
PROMPT='%(?..%F{red}%3?%f )%F{blue}%n@%m%f:%~ %#'$'\n'
+
# https://github.com/nix-community/nix-on-droid/issues/185
+
home.shellAliases = {
+
sshd = let
+
config = pkgs.writeText "sshd_config" ''
+
HostKey /data/data/com.termux.nix/files/home/.ssh/id_ed25519
+
Port 9022
'';
-
initExtra = builtins.readFile ../modules/personal/zsh.cfg + ''
-
bindkey "^[[A" up-line-or-beginning-search
-
bindkey "^[[B" down-line-or-beginning-search
-
'';
-
};
+
in "$(readlink $(whereis sshd)) -f ${config}";
+
ping = "/android/system/bin/linker64 /android/system/bin/ping";
+
};
-
programs.git = {
-
enable = true;
-
userEmail = "ryan@$freumh.org";
-
userName = "Ryan Gibb";
-
aliases = {
-
s = "status";
-
c = "commit";
-
cm = "commit --message";
-
ca = "commit --amend";
-
cu = "commit --message update";
-
ci = "commit --message initial";
-
br = "branch";
-
co = "checkout";
-
df = "diff";
-
l = "log";
-
lg = "log -p";
-
lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
-
lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all";
-
ls = "ls-files";
-
a = "add";
-
aa = "add --all";
-
au = "add -u";
-
ap = "add --patch";
-
ps = "push";
-
pf = "push --force";
-
pu = "push --set-upstream";
-
pl = "pull";
-
pr = "pull --rebase";
-
acp = "!git add --all && git commit --message update && git push";
-
};
+
programs.zsh = {
+
enable = true;
+
history.size = 100000;
+
enableAutosuggestions = true;
+
syntaxHighlighting.enable = true;
+
initExtraFirst = ''
+
export ZSH_AUTOSUGGEST_STRATEGY=(match_prev_cmd completion history)
+
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=5"
+
PROMPT='%(?..%F{red}%3?%f )%F{blue}%n@%m%f:%~ %#'$'\n'
+
'';
+
initExtra = builtins.readFile ../modules/personal/zsh.cfg + ''
+
bindkey "^[[A" up-line-or-beginning-search
+
bindkey "^[[B" down-line-or-beginning-search
+
'';
+
};
+
+
programs.git = {
+
enable = true;
+
userEmail = "ryan@$freumh.org";
+
userName = "Ryan Gibb";
+
aliases = {
+
s = "status";
+
c = "commit";
+
cm = "commit --message";
+
ca = "commit --amend";
+
cu = "commit --message update";
+
ci = "commit --message initial";
+
br = "branch";
+
co = "checkout";
+
df = "diff";
+
l = "log";
+
lg = "log -p";
+
lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
+
lola =
+
"log --graph --decorate --pretty=oneline --abbrev-commit --all";
+
ls = "ls-files";
+
a = "add";
+
aa = "add --all";
+
au = "add -u";
+
ap = "add --patch";
+
ps = "push";
+
pf = "push --force";
+
pu = "push --set-upstream";
+
pl = "pull";
+
pr = "pull --rebase";
+
acp = "!git add --all && git commit --message update && git push";
};
+
};
-
programs.neovim = {
-
enable = true;
-
viAlias = true;
-
vimAlias = true;
-
extraPackages = with pkgs; [
-
ripgrep
-
nixd
-
alejandra
-
# stop complaining when launching but a devshell is better
-
#ocamlPackages.ocaml-lsp
-
#ocamlPackages.ocamlformat
-
marksman
-
lua-language-server
-
#pyright
-
#black
-
ltex-ls
-
];
-
extraLuaConfig = builtins.readFile ../modules/personal/nvim/nvim.lua;
-
# undo transparent background
-
# + "colorscheme gruvbox";
-
plugins = let
-
obsidian-nvim =
-
(pkgs.vimUtils.buildVimPlugin {
-
pname = "obsidian.nvim";
-
version = "2.6.0";
-
src = pkgs.fetchFromGitHub {
-
owner = "epwalsh";
-
repo = "obsidian.nvim";
-
rev = "v2.6.0";
-
sha256 = "sha256-+w3XYoobuH17oinPfQxhrizbmQB5IbbulUK69674/Wg=";
-
};
-
});
-
ltex-ls-nvim =
-
(pkgs.vimUtils.buildVimPlugin {
-
pname = "ltex-ls.nvim";
-
version = "2.6.0";
-
src = pkgs.fetchFromGitHub {
-
owner = "vigoux";
-
repo = "ltex-ls.nvim";
-
rev = "c8139ea6b7f3d71adcff121e16ee8726037ffebd";
-
sha256 = "sha256-jY3ALr6h88xnWN2QdKe3R0vvRcSNhFWDW56b2NvnTCs=";
-
};
-
});
-
in with pkgs.vimPlugins; [
-
gruvbox-nvim
+
programs.neovim = {
+
enable = true;
+
viAlias = true;
+
vimAlias = true;
+
extraPackages = with pkgs; [
+
ripgrep
+
nixd
+
alejandra
+
# stop complaining when launching but a devshell is better
+
#ocamlPackages.ocaml-lsp
+
#ocamlPackages.ocamlformat
+
marksman
+
lua-language-server
+
#pyright
+
#black
+
ltex-ls
+
];
+
extraLuaConfig = builtins.readFile ../modules/personal/nvim/nvim.lua;
+
# undo transparent background
+
# + "colorscheme gruvbox";
+
plugins = let
+
obsidian-nvim = (pkgs.vimUtils.buildVimPlugin {
+
pname = "obsidian.nvim";
+
version = "2.6.0";
+
src = pkgs.fetchFromGitHub {
+
owner = "epwalsh";
+
repo = "obsidian.nvim";
+
rev = "v2.6.0";
+
sha256 = "sha256-+w3XYoobuH17oinPfQxhrizbmQB5IbbulUK69674/Wg=";
+
};
+
});
+
ltex-ls-nvim = (pkgs.vimUtils.buildVimPlugin {
+
pname = "ltex-ls.nvim";
+
version = "2.6.0";
+
src = pkgs.fetchFromGitHub {
+
owner = "vigoux";
+
repo = "ltex-ls.nvim";
+
rev = "c8139ea6b7f3d71adcff121e16ee8726037ffebd";
+
sha256 = "sha256-jY3ALr6h88xnWN2QdKe3R0vvRcSNhFWDW56b2NvnTCs=";
+
};
+
});
+
in with pkgs.vimPlugins; [
+
gruvbox-nvim
-
telescope-nvim
-
telescope-fzf-native-nvim
-
trouble-nvim
+
telescope-nvim
+
telescope-fzf-native-nvim
+
trouble-nvim
-
obsidian-nvim
-
plenary-nvim
-
pkgs.ripgrep
+
obsidian-nvim
+
plenary-nvim
+
pkgs.ripgrep
-
{
-
plugin = nvim-lspconfig;
-
runtime = let
-
ml-style = ''
-
setlocal expandtab
-
setlocal shiftwidth=2
-
setlocal tabstop=2
-
setlocal softtabstop=2
-
'';
-
in {
-
"ftplugin/mail.vim".text = ''
-
let b:did_ftplugin = 1
-
'';
-
"ftplugin/nix.vim".text = ml-style;
-
"ftplugin/ocaml.vim".text = ml-style;
-
"after/ftplugin/markdown.vim".text = ''
-
set com-=fb:-
-
set com+=b:-
-
set formatoptions+=ro
-
'';
-
};
-
}
+
{
+
plugin = nvim-lspconfig;
+
runtime = let
+
ml-style = ''
+
setlocal expandtab
+
setlocal shiftwidth=2
+
setlocal tabstop=2
+
setlocal softtabstop=2
+
'';
+
in {
+
"ftplugin/mail.vim".text = ''
+
let b:did_ftplugin = 1
+
'';
+
"ftplugin/nix.vim".text = ml-style;
+
"ftplugin/ocaml.vim".text = ml-style;
+
"after/ftplugin/markdown.vim".text = ''
+
set com-=fb:-
+
set com+=b:-
+
set formatoptions+=ro
+
'';
+
};
+
}
-
cmp-nvim-lsp
-
cmp-nvim-lsp-signature-help
-
cmp-path
-
cmp-buffer
-
cmp-cmdline
-
cmp-spell
-
luasnip
-
nvim-cmp
+
cmp-nvim-lsp
+
cmp-nvim-lsp-signature-help
+
cmp-path
+
cmp-buffer
+
cmp-cmdline
+
cmp-spell
+
luasnip
+
nvim-cmp
-
vimtex
-
nvim-surround
-
comment-nvim
+
vimtex
+
nvim-surround
+
comment-nvim
-
ltex-ls-nvim
-
nvim-jdtls
-
# TODO nvim-dap
+
ltex-ls-nvim
+
nvim-jdtls
+
# TODO nvim-dap
-
copilot-vim
-
];
-
};
-
-
programs.tmux = {
-
enable = true;
-
extraConfig = ''
-
set-window-option -g mode-keys vi
-
set-option -g mouse on
-
set-option -g set-titles on
-
set-option -g set-titles-string "#T"
-
bind-key t capture-pane -S -\; new-window '(tmux show-buffer; tmux delete-buffer) | nvim -c $'
-
bind-key u capture-pane\; new-window '(tmux show-buffer; tmux delete-buffer) | ${pkgs.urlview}/bin/urlview'
-
# Fixes C-Up/Down in TUIs
-
set-option default-terminal tmux
-
# https://stackoverflow.com/questions/62182401/neovim-screen-lagging-when-switching-mode-from-insert-to-normal
-
set -s escape-time 0
-
set -g lock-command vlock
-
set -g lock-after-time 0 # Seconds; 0 = never
-
bind L lock-session
-
'';
-
};
+
copilot-vim
+
];
+
};
-
home.file = {
-
".ssh/authorized_keys".source = ../modules/personal/authorized_keys;
-
};
+
programs.tmux = {
+
enable = true;
+
extraConfig = ''
+
set-window-option -g mode-keys vi
+
set-option -g mouse on
+
set-option -g set-titles on
+
set-option -g set-titles-string "#T"
+
bind-key t capture-pane -S -\; new-window '(tmux show-buffer; tmux delete-buffer) | nvim -c $'
+
bind-key u capture-pane\; new-window '(tmux show-buffer; tmux delete-buffer) | ${pkgs.urlview}/bin/urlview'
+
# Fixes C-Up/Down in TUIs
+
set-option default-terminal tmux
+
# https://stackoverflow.com/questions/62182401/neovim-screen-lagging-when-switching-mode-from-insert-to-normal
+
set -s escape-time 0
+
set -g lock-command vlock
+
set -g lock-after-time 0 # Seconds; 0 = never
+
bind L lock-session
+
'';
+
};
-
programs.ssh = {
-
enable = true;
-
extraConfig = ''
-
User ryan
-
'';
-
};
+
home.file = {
+
".ssh/authorized_keys".source = ../modules/personal/authorized_keys;
+
};
-
home.stateVersion = "22.05";
+
programs.ssh = {
+
enable = true;
+
extraConfig = ''
+
User ryan
+
'';
};
+
+
home.stateVersion = "22.05";
+
};
};
system.stateVersion = "22.05";
}
+4 -13
pkgs/cctk/default.nix
···
-
{
-
stdenv,
-
lib,
-
fetchurl,
-
dpkg,
-
autoPatchelfHook,
-
patchelf,
-
openssl,
-
}:
+
{ stdenv, lib, fetchurl, dpkg, autoPatchelfHook, patchelf, openssl, }:
# Use techniques described in https://web.archive.org/web/20220904051329/https://tapesoftware.net/replace-symbol/
# Uses patchelf-raphi to do this
···
unpacked = stdenv.mkDerivation rec {
inherit version;
pname = "dell-command-configure-unpacked";
-
+
src = fetchurl {
url =
"https://dl.dell.com/FOLDER08911312M/1/command-configure_${version}.ubuntu20_amd64.tar.gz";
···
};
dontBuild = true;
-
+
nativeBuildInputs = [ dpkg ];
-
+
unpackPhase = ''
tar -xzf ${src}
dpkg-deb -x command-configure_${version}.ubuntu20_amd64.deb command-configure
···
cp -r . $out
'';
};
-
# Contains a fopen() wrapper for finding the firmware package
wrapperLibName = "wrapper-lib.so";
+3 -5
pkgs/maildir-rank-addr.nix
···
-
{ lib
-
, buildGoModule
-
, fetchFromGitHub
-
}:
+
{ lib, buildGoModule, fetchFromGitHub }:
buildGoModule rec {
pname = "maildir-rank-addr";
···
vendorHash = "sha256-Mqx938j8LwM+bDnrK3V46FFy86JbVoh9Zxr/CA/egk8=";
meta = with lib; {
-
description = "Creates a ranked list of email addresses from maildir folders";
+
description =
+
"Creates a ranked list of email addresses from maildir folders";
homepage = "https://github.com/ferdinandyb/maildir-rank-addr/";
maintainers = with maintainers; [ ryangibb ];
mainProgram = "maildir-rank-addr";
+3 -15
pkgs/mautrix-instagram.nix
···
# https://gitlab.com/coffeetables/nix-matrix-appservices/-/blob/main/pkgs/mautrix-instagram/default.nix
-
{ stdenv
-
, lib
-
, python3
-
, makeWrapper
-
, fetchFromGitHub
-
}:
+
{ stdenv, lib, python3, makeWrapper, fetchFromGitHub }:
with python3.pkgs;
···
# sqlite driver is already shipped with python by default
];
-
in
-
-
buildPythonApplication rec {
+
in buildPythonApplication rec {
pname = "mautrix-instagram";
version = "unstable-2021-11-15";
···
setuptools
] ++ dbDrivers;
-
checkInputs = [
-
pytest
-
pytestrunner
-
pytest-mock
-
pytest-asyncio
-
];
+
checkInputs = [ pytest pytestrunner pytest-mock pytest-asyncio ];
doCheck = false;
+2 -1
pkgs/mautrix-meta.nix
···
meta = with lib; {
homepage = "https://github.com/mautrix/meta";
-
description = " A Matrix-Facebook Messenger and Instagram DM puppeting bridge.";
+
description =
+
" A Matrix-Facebook Messenger and Instagram DM puppeting bridge.";
license = licenses.agpl3Plus;
mainProgram = "mautrix-meta";
};
+1 -8
pkgs/onevpl-intel-gpu.nix
···
# https://github.com/NixOS/nixpkgs/pull/264621/
-
{ lib
-
, stdenv
-
, fetchFromGitHub
-
, cmake
-
, pkg-config
-
, libdrm
-
, libva
-
}:
+
{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, libdrm, libva }:
stdenv.mkDerivation rec {
pname = "onevpl-intel-gpu";
+31 -34
pkgs/sway-im/package.nix
···
-
{ lib, stdenv, fetchFromGitHub, fetchpatch, substituteAll, swaybg
-
, meson, ninja, pkg-config, wayland-scanner, scdoc
-
, libGL, wayland, libxkbcommon, pcre2, json_c, libevdev
-
, pango, cairo, libinput, gdk-pixbuf, librsvg
-
, wlroots, wayland-protocols, libdrm
-
, nixosTests
+
{ lib, stdenv, fetchFromGitHub, fetchpatch, substituteAll, swaybg, meson, ninja
+
, pkg-config, wayland-scanner, scdoc, libGL, wayland, libxkbcommon, pcre2
+
, json_c, libevdev, pango, cairo, libinput, gdk-pixbuf, librsvg, wlroots
+
, wayland-protocols, libdrm, nixosTests
# Used by the NixOS module:
-
, isNixOS ? false
-
, enableXWayland ? true, xorg
+
, isNixOS ? false, enableXWayland ? true, xorg
, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
-
, trayEnabled ? systemdSupport
-
}:
+
, trayEnabled ? systemdSupport }:
stdenv.mkDerivation (finalAttrs: {
pname = "sway-unwrapped";
···
];
strictDeps = true;
-
depsBuildBuild = [
-
pkg-config
-
];
+
depsBuildBuild = [ pkg-config ];
-
nativeBuildInputs = [
-
meson ninja pkg-config wayland-scanner scdoc
-
];
+
nativeBuildInputs = [ meson ninja pkg-config wayland-scanner scdoc ];
buildInputs = [
-
libGL wayland libxkbcommon pcre2 json_c libevdev
-
pango cairo libinput gdk-pixbuf librsvg
-
wayland-protocols libdrm
+
libGL
+
wayland
+
libxkbcommon
+
pcre2
+
json_c
+
libevdev
+
pango
+
cairo
+
libinput
+
gdk-pixbuf
+
librsvg
+
wayland-protocols
+
libdrm
(wlroots.override { inherit (finalAttrs) enableXWayland; })
-
] ++ lib.optionals finalAttrs.enableXWayland [
-
xorg.xcbutilwm
-
];
+
] ++ lib.optionals finalAttrs.enableXWayland [ xorg.xcbutilwm ];
mesonFlags = let
# The "sd-bus-provider" meson option does not include a "none" option,
···
# changes: https://github.com/swaywm/sway/issues/6843#issuecomment-1047288761
# assert trayEnabled -> systemdSupport && dbusSupport;
-
sd-bus-provider = if systemdSupport then "libsystemd" else "basu";
-
in
-
[ "-Dsd-bus-provider=${sd-bus-provider}" ]
-
++ [ "-Dwerror=false" ]
-
++ lib.optional (!finalAttrs.enableXWayland) "-Dxwayland=disabled"
-
++ lib.optional (!finalAttrs.trayEnabled) "-Dtray=disabled"
-
;
+
sd-bus-provider = if systemdSupport then "libsystemd" else "basu";
+
in [ "-Dsd-bus-provider=${sd-bus-provider}" ] ++ [ "-Dwerror=false" ]
+
++ lib.optional (!finalAttrs.enableXWayland) "-Dxwayland=disabled"
+
++ lib.optional (!finalAttrs.trayEnabled) "-Dtray=disabled";
passthru.tests.basic = nixosTests.sway;
-
+
meta = with lib; {
description = "An i3-compatible tiling Wayland compositor";
longDescription = ''
···
maximizes the efficiency of your screen and can be quickly manipulated
using only the keyboard.
'';
-
homepage = "https://swaywm.org";
-
changelog = "https://github.com/swaywm/sway/releases/tag/${version}";
-
license = licenses.mit;
-
platforms = platforms.linux;
+
homepage = "https://swaywm.org";
+
changelog = "https://github.com/swaywm/sway/releases/tag/${version}";
+
license = licenses.mit;
+
platforms = platforms.linux;
maintainers = with maintainers; [ primeos synthetica ];
mainProgram = "sway";
};
+9 -36
pkgs/wlroots/default.nix
···
-
{ lib
-
, stdenv
-
, fetchFromGitLab
-
, fetchpatch
-
, meson
-
, ninja
-
, pkg-config
-
, wayland-scanner
-
, libGL
-
, wayland
-
, wayland-protocols
-
, libinput
-
, libxkbcommon
-
, pixman
-
, libcap
-
, mesa
-
, xorg
-
, libpng
-
, ffmpeg_4
-
, ffmpeg
-
, hwdata
-
, seatd
-
, vulkan-loader
-
, glslang
-
, libliftoff
-
, libdisplay-info
-
, nixosTests
+
{ lib, stdenv, fetchFromGitLab, fetchpatch, meson, ninja, pkg-config
+
, wayland-scanner, libGL, wayland, wayland-protocols, libinput, libxkbcommon
+
, pixman, libcap, mesa, xorg, libpng, ffmpeg_4, ffmpeg, hwdata, seatd
+
, vulkan-loader, glslang, libliftoff, libdisplay-info, nixosTests
-
, enableXWayland ? true
-
, xwayland ? null
-
}:
+
, enableXWayland ? true, xwayland ? null }:
stdenv.mkDerivation (finalAttrs: rec {
pname = "wlroots";
···
hwdata
libliftoff
libdisplay-info
-
]
-
++ lib.optional finalAttrs.enableXWayland xwayland;
+
] ++ lib.optional finalAttrs.enableXWayland xwayland;
-
mesonFlags =
-
lib.optional (!finalAttrs.enableXWayland) "-Dxwayland=disabled"
-
;
+
mesonFlags = lib.optional (!finalAttrs.enableXWayland) "-Dxwayland=disabled";
postFixup = ''
# Install ALL example programs to $examples:
···
compositor; or about 50,000 lines of code you were going to write anyway.
'';
inherit (finalAttrs.src.meta) homepage;
-
changelog = "https://gitlab.freedesktop.org/wlroots/wlroots/-/tags/${version}";
+
changelog =
+
"https://gitlab.freedesktop.org/wlroots/wlroots/-/tags/${version}";
license = lib.licenses.mit;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ primeos synthetica rewine ];
+3 -3
pkgs/wlroots/protocols.nix
···
extend the functionality of some other protocol either in Wayland core,
or some other protocol in wayland-protocols.
'';
-
homepage = "https://gitlab.freedesktop.org/wlroots/wlr-protocols";
-
license = licenses.mit; # See file headers
-
platforms = platforms.linux;
+
homepage = "https://gitlab.freedesktop.org/wlroots/wlr-protocols";
+
license = licenses.mit; # See file headers
+
platforms = platforms.linux;
maintainers = with maintainers; [ twitchyliquid64 ];
};
}
+9 -6
secrets/secrets.nix
···
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAGNcdBuEeoJiMH8TMO4k/w3OVKfiSZ9IZ3xrzFOZEi8 ryan@dell-xps"
];
-
gecko = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGLEtqkSlJx219h1aYRXRjP60vBmJmhrCp0Mj1FIF25N root@gecko";
-
owl = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILP6Cgm/BWnJvuGgU1SjWwjOCjuE5AXGqEdQonWYR7BA root@owl";
-
elephant = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+ddohsRFrypCVJqIhI3p3R12pJI8iwuMfRu0TJWuPe root@elephant";
-
shrew = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHLiZ0xdXSlF1eMibrs320lVQaushEpEDMrR6lp9uFkx root@shrew";
-
in
-
{
+
gecko =
+
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGLEtqkSlJx219h1aYRXRjP60vBmJmhrCp0Mj1FIF25N root@gecko";
+
owl =
+
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILP6Cgm/BWnJvuGgU1SjWwjOCjuE5AXGqEdQonWYR7BA root@owl";
+
elephant =
+
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+ddohsRFrypCVJqIhI3p3R12pJI8iwuMfRu0TJWuPe root@elephant";
+
shrew =
+
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHLiZ0xdXSlF1eMibrs320lVQaushEpEDMrR6lp9uFkx root@shrew";
+
in {
"cache-priv-key.pem.age".publicKeys = user ++ [ owl ];
"email-ryan.age".publicKeys = user ++ [ gecko owl ];
"email-system.age".publicKeys = user ++ [ gecko owl elephant ];