nixfmt-rfc-style

+211 -176
flake.nix
···
eilean.url = "github:RyanGibb/eilean-nix/main";
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";
nix-rpi5.url = "gitlab:vriska/nix-rpi5?ref=main";
···
hyperbib-eeg.inputs.nixpkgs.follows = "nixpkgs";
};
-
outputs = { self, nixpkgs-compat, nixpkgs, nixpkgs-unstable, home-manager
-
, home-manager-unstable, agenix, deploy-rs, nix-on-droid, eilean, ...
+
outputs =
+
{
+
self,
+
nixpkgs-compat,
+
nixpkgs,
+
nixpkgs-unstable,
+
home-manager,
+
home-manager-unstable,
+
agenix,
+
deploy-rs,
+
nix-on-droid,
+
eilean,
+
...
}@inputs:
let
-
getSystemOverlays = system: nixpkgsConfig:
-
[
-
(final: prev: {
-
# https://github.com/mautrix/whatsapp/issues/749
-
overlay-compat = import nixpkgs-compat {
-
inherit system;
-
# follow stable nixpkgs config
-
config = nixpkgsConfig;
+
getSystemOverlays = system: nixpkgsConfig: [
+
(final: prev: {
+
# https://github.com/mautrix/whatsapp/issues/749
+
overlay-compat = import nixpkgs-compat {
+
inherit system;
+
# follow stable nixpkgs config
+
config = nixpkgsConfig;
+
};
+
overlay-unstable = import nixpkgs-unstable {
+
inherit system;
+
# follow stable nixpkgs config
+
config = nixpkgsConfig;
+
};
+
# to use an unstable version of a package
+
#package = final.overlay-unstable.package;
+
# to use an custom version of a package
+
#package = prev.callPackage ./pkgs/package.nix { };
+
# to use an unstable custom version of a package
+
#package = final.callPackage ./pkgs/package.nix { };
+
# to override attributes of a package
+
# package = prev.package.overrideAttrs
+
# (_: { patches = [ ./pkgs/package.patch ]; });
+
opam = final.overlay-unstable.opam.overrideAttrs (_: {
+
src = final.fetchurl {
+
url = "http://ryan.freumh.org/software/opam-full-2.3.0-nixos-depexts.tar.gz";
+
sha256 = "sha256-mRxxZtWFgQ8v1szVq5g5+qVqa+OffoG1aHzGUiMMvT0=";
};
-
overlay-unstable = import nixpkgs-unstable {
-
inherit system;
-
# follow stable nixpkgs config
-
config = nixpkgsConfig;
+
version = "2.3.0";
+
});
+
immich = final.overlay-unstable.immich;
+
mautrix-whatsapp = final.overlay-compat.mautrix-whatsapp;
+
})
+
];
+
in
+
{
+
nixosConfigurations =
+
let
+
mkMode =
+
mode: host:
+
let
+
host-nixpkgs = nixpkgs;
+
host-home-manager = home-manager;
+
in
+
host-nixpkgs.lib.nixosSystem {
+
# use system from config.localSystem
+
# see https://github.com/NixOS/nixpkgs/blob/5297d584bcc5f95c8e87c631813b4e2ab7f19ecc/nixos/lib/eval-config.nix#L55
+
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 = host-nixpkgs;
+
system.stateVersion = "24.05";
+
# record git revision (can be queried with `nixos-version --json)
+
system.configurationRevision = host-nixpkgs.lib.mkIf (self ? rev) self.rev;
+
nixpkgs = {
+
config.allowUnfree = true;
+
config.permittedInsecurePackages = [
+
# https://github.com/nix-community/nixd/issues/357
+
"nix-2.16.2"
+
# https://github.com/mautrix/go/issues/262
+
"olm-3.2.16"
+
];
+
overlays = getSystemOverlays config.nixpkgs.hostPlatform.system config.nixpkgs.config;
+
# uncomment for cross compilation (https://github.com/NixOS/nix/issues/3843)
+
#buildPlatform.system = "cpu-os";
+
};
+
security.acme-eon.acceptTerms = true;
+
}
+
)
+
host-home-manager.nixosModule
+
eilean.nixosModules.default
+
agenix.nixosModules.default
+
];
};
-
# to use an unstable version of a package
-
#package = final.overlay-unstable.package;
-
# to use an custom version of a package
-
#package = prev.callPackage ./pkgs/package.nix { };
-
# to use an unstable custom version of a package
-
#package = final.callPackage ./pkgs/package.nix { };
-
# to override attributes of a package
-
# package = prev.package.overrideAttrs
-
# (_: { patches = [ ./pkgs/package.patch ]; });
-
opam = final.overlay-unstable.opam.overrideAttrs (_: {
-
src = final.fetchurl {
-
url =
-
"http://ryan.freumh.org/software/opam-full-2.3.0-nixos-depexts.tar.gz";
-
sha256 = "sha256-mRxxZtWFgQ8v1szVq5g5+qVqa+OffoG1aHzGUiMMvT0=";
-
};
-
version = "2.3.0";
-
});
-
immich = final.overlay-unstable.immich;
-
mautrix-whatsapp = final.overlay-compat.mautrix-whatsapp;
-
})
-
];
-
in {
-
nixosConfigurations = let
-
mkMode = mode: host:
-
let
-
host-nixpkgs = nixpkgs;
-
host-home-manager = home-manager;
-
in host-nixpkgs.lib.nixosSystem {
-
# use system from config.localSystem
-
# see https://github.com/NixOS/nixpkgs/blob/5297d584bcc5f95c8e87c631813b4e2ab7f19ecc/nixos/lib/eval-config.nix#L55
-
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 = host-nixpkgs;
-
system.stateVersion = "24.05";
-
# record git revision (can be queried with `nixos-version --json)
-
system.configurationRevision =
-
host-nixpkgs.lib.mkIf (self ? rev) self.rev;
-
nixpkgs = {
-
config.allowUnfree = true;
-
config.permittedInsecurePackages = [
-
# https://github.com/nix-community/nixd/issues/357
-
"nix-2.16.2"
-
# https://github.com/mautrix/go/issues/262
-
"olm-3.2.16"
-
];
-
overlays =
-
getSystemOverlays config.nixpkgs.hostPlatform.system
-
config.nixpkgs.config;
-
# uncomment for cross compilation (https://github.com/NixOS/nix/issues/3843)
-
#buildPlatform.system = "cpu-os";
-
};
-
security.acme-eon.acceptTerms = true;
-
})
-
host-home-manager.nixosModule
-
eilean.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"))
-
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;
-
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;
-
hosts = builtins.attrNames (builtins.readDir ./hosts);
-
in mkHosts hosts;
+
readModes =
+
dir:
+
let
+
files = builtins.readDir dir;
+
in
+
let
+
filtered = nixpkgs.lib.attrsets.filterAttrs (
+
n: v: v == "regular" && (n == "default.nix" || n == "minimal.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;
+
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;
+
hosts = builtins.attrNames (builtins.readDir ./hosts);
+
in
+
mkHosts hosts;
deploy = {
user = "root";
-
nodes = builtins.listToAttrs (builtins.map (name:
-
let
-
machine = self.nixosConfigurations.${name};
-
system = machine.pkgs.system;
-
pkgs = import nixpkgs { inherit system; };
-
# nixpkgs with deploy-rs overlay but force the nixpkgs package
-
deployPkgs = import nixpkgs {
-
inherit system;
-
overlays = [
-
deploy-rs.overlay
-
(self: super: {
-
deploy-rs = {
-
inherit (pkgs) deploy-rs;
-
lib = super.deploy-rs.lib;
+
nodes = builtins.listToAttrs (
+
builtins.map
+
(
+
name:
+
let
+
machine = self.nixosConfigurations.${name};
+
system = machine.pkgs.system;
+
pkgs = import nixpkgs { inherit system; };
+
# nixpkgs with deploy-rs overlay but force the nixpkgs package
+
deployPkgs = import nixpkgs {
+
inherit system;
+
overlays = [
+
deploy-rs.overlay
+
(self: super: {
+
deploy-rs = {
+
inherit (pkgs) deploy-rs;
+
lib = super.deploy-rs.lib;
+
};
+
})
+
];
+
};
+
in
+
{
+
inherit name;
+
value = {
+
# if we're on a different system build on the remote
+
#remoteBuild = machine.config.nixpkgs.hostPlatform.system == builtins.currentSystem;
+
remoteBuild = true;
+
sshUser = "root";
+
hostname = if name == "swan" then "eeg.cl.cam.ac.uk" else machine.config.networking.hostName;
+
profiles.system = {
+
user = "root";
+
path = deployPkgs.deploy-rs.lib.activate.nixos machine;
};
-
})
-
];
-
};
-
in {
-
inherit name;
-
value = {
-
# if we're on a different system build on the remote
-
#remoteBuild = machine.config.nixpkgs.hostPlatform.system == builtins.currentSystem;
-
remoteBuild = true;
-
sshUser = "root";
-
hostname = if name == "swan" then
-
"eeg.cl.cam.ac.uk"
-
else
-
machine.config.networking.hostName;
-
profiles.system = {
-
user = "root";
-
path = deployPkgs.deploy-rs.lib.activate.nixos machine;
-
};
-
};
-
}) [ "capybara" "duck" "elephant" "gecko" "owl" "shrew" "swan" ]);
+
};
+
}
+
)
+
[
+
"capybara"
+
"duck"
+
"elephant"
+
"gecko"
+
"owl"
+
"shrew"
+
"swan"
+
]
+
);
};
-
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"
-
];
-
};
-
};
-
-
homeConfigurations = {
-
rtg24 = let
-
system = "x86_64-linux";
-
pkgs = nixpkgs.legacyPackages.${system};
-
in home-manager.lib.homeManagerConfiguration {
-
inherit pkgs;
-
modules = [
-
./home/default.nix
-
{
-
nix.package = pkgs.nix;
-
nixpkgs.overlays = getSystemOverlays system { };
-
home.username = "rtg24";
-
home.homeDirectory = "/home/rtg24";
-
home.packages = with pkgs; [ home-manager ];
-
custom = {
-
machineColour = "red";
-
nvim-lsps = true;
-
};
-
}
+
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.lib.genAttrs nixpkgs.lib.systems.flakeExposed
-
(system: {
-
nixpkgs = import nixpkgs {
-
inherit system;
-
overlays = getSystemOverlays system { };
+
homeConfigurations = {
+
rtg24 =
+
let
+
system = "x86_64-linux";
+
pkgs = nixpkgs.legacyPackages.${system};
+
in
+
home-manager.lib.homeManagerConfiguration {
+
inherit pkgs;
+
modules = [
+
./home/default.nix
+
{
+
nix.package = pkgs.nix;
+
nixpkgs.overlays = getSystemOverlays system { };
+
home.username = "rtg24";
+
home.homeDirectory = "/home/rtg24";
+
home.packages = with pkgs; [ home-manager ];
+
custom = {
+
machineColour = "red";
+
nvim-lsps = true;
+
};
+
}
+
];
};
-
});
+
};
-
formatter = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed
-
(system: nixpkgs.legacyPackages.${system}.nixfmt);
+
legacyPackages = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (system: {
+
nixpkgs = import nixpkgs {
+
inherit system;
+
overlays = getSystemOverlays system { };
+
};
+
});
+
+
formatter = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (
+
system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style
+
);
};
}
+7 -6
home/aerc-binds.nix
···
-
{ pkgs, ... }: {
+
{ pkgs, ... }:
+
{
global = {
"<C-p>" = ":prev-tab<Enter>";
"<C-PgUp>" = ":prev-tab<Enter>";
···
"<C-a>" = ":mark -a<Enter>";
"e" = ":envelope<Enter>";
"E" = ":envelope -h<Enter>";
-
"s" =
-
":exec mu find --clearlinks --format=links --linksdir=~/mail/search/results<space>";
+
"s" = ":exec mu find --clearlinks --format=links --linksdir=~/mail/search/results<space>";
};
-
"messages:folder=Drafts" = { "<Enter>" = ":recall<Enter>"; };
+
"messages:folder=Drafts" = {
+
"<Enter>" = ":recall<Enter>";
+
};
view = {
"/" = ":toggle-key-passthrough<Enter>/";
···
"O" = ":open<Enter>";
"o" = ":open<Enter>";
"c" = ":pipe khal import --batch";
-
"C" =
-
":open ${pkgs.libsForQt5.kitinerary}/libexec/kf5/kitinerary-extractor -o ical {} | khal import --batch";
+
"C" = ":open ${pkgs.libsForQt5.kitinerary}/libexec/kf5/kitinerary-extractor -o ical {} | khal import --batch";
"S" = ":save<space>";
"|" = ":pipe<space>";
"d" = ":read<Enter>:move Bin<Enter>";
+13 -4
home/battery.nix
···
-
{ config, lib, pkgs, ... }:
+
{
+
config,
+
lib,
+
pkgs,
+
...
+
}:
-
let cfg = config.custom.battery;
-
in {
+
let
+
cfg = config.custom.battery;
+
in
+
{
options.custom.battery.enable = lib.mkEnableOption "battery";
config = lib.mkIf cfg.enable {
systemd.user.services.battery_monitor = {
-
Install = { WantedBy = [ "default.target" ]; };
+
Install = {
+
WantedBy = [ "default.target" ];
+
};
Service = {
ExecStart = pkgs.writeScript "battery_monitor.sh" ''
#!${pkgs.bash}/bin/bash
+25 -10
home/calendar.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
-
let cfg = config.custom.calendar;
-
in {
+
let
+
cfg = config.custom.calendar;
+
in
+
{
options.custom.calendar.enable = lib.mkEnableOption "calendar";
config = lib.mkIf cfg.enable {
···
};
};
-
services = { gpg-agent.enable = true; };
+
services = {
+
gpg-agent.enable = true;
+
};
accounts.calendar = {
basePath = "calendar";
···
enable = true;
color = "white";
};
-
vdirsyncer = { enable = true; };
+
vdirsyncer = {
+
enable = true;
+
};
remote = {
type = "caldav";
-
url =
-
"https://cal.freumh.org/ryan/f497c073-d027-2aa5-1e58-cbec1bf5a8c7/";
-
passwordCommand =
-
[ "${pkgs.pass}/bin/pass" "show" "calendar/ryan@freumh.org" ];
+
url = "https://cal.freumh.org/ryan/f497c073-d027-2aa5-1e58-cbec1bf5a8c7/";
+
passwordCommand = [
+
"${pkgs.pass}/bin/pass"
+
"show"
+
"calendar/ryan@freumh.org"
+
];
userName = "ryan";
};
local = {
···
enable = true;
color = "#CC3333";
};
-
vdirsyncer = { enable = true; };
+
vdirsyncer = {
+
enable = true;
+
};
remote = {
type = "http";
url = "https://talks.cam.ac.uk/show/ics/8316.ics";
+142 -126
home/default.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
-
let cfg = config.custom;
-
in {
+
let
+
cfg = config.custom;
+
in
+
{
imports = [
./mail.nix
./calendar.nix
···
NIX_AUTO_RUN_INTERACTIVE = "y";
GOPATH = "$HOME/.go";
};
-
home.packages = let
-
status = pkgs.stdenv.mkDerivation {
-
name = "status";
+
home.packages =
+
let
+
status = pkgs.stdenv.mkDerivation {
+
name = "status";
-
src = ./status;
+
src = ./status;
-
installPhase = ''
-
mkdir -p $out
-
cp -r * $out
-
'';
-
};
-
in with pkgs; [
-
status
-
tree
-
htop
-
gnumake
-
killall
-
inetutils
-
dnsutils
-
nmap
-
gcc
-
fzf
-
nix-tree
-
jq
-
bc
-
openssh
-
# multicore rust command line utils
-
dua
-
fd
-
bat
-
ripgrep
-
];
+
installPhase = ''
+
mkdir -p $out
+
cp -r * $out
+
'';
+
};
+
in
+
with pkgs;
+
[
+
status
+
tree
+
htop
+
gnumake
+
killall
+
inetutils
+
dnsutils
+
nmap
+
gcc
+
fzf
+
nix-tree
+
jq
+
bc
+
openssh
+
# multicore rust command line utils
+
dua
+
fd
+
bat
+
ripgrep
+
];
home.shellAliases = {
ls = "ls -p --color=auto";
···
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})'";
};
# https://github.com/nix-community/home-manager/issues/1439#issuecomment-1106208294
home.activation = {
linkDesktopApplications = {
-
after = [ "writeBoundary" "createXdgUserDirectories" ];
+
after = [
+
"writeBoundary"
+
"createXdgUserDirectories"
+
];
before = [ ];
data = ''
rm -rf ${config.xdg.dataHome}/"applications/home-manager"
···
programs.gpg = {
enable = true;
-
publicKeys = [{
-
text = ''
-
-----BEGIN PGP PUBLIC KEY BLOCK-----
+
publicKeys = [
+
{
+
text = ''
+
-----BEGIN PGP PUBLIC KEY BLOCK-----
-
mDMEZZ1zrBYJKwYBBAHaRw8BAQdA8Zeb1OFbzEWx3tM7ylO0ILCnDCG2JoA/iay6
-
iWXmB7G0G1J5YW4gR2liYiA8cnlhbkBmcmV1bWgub3JnPoiUBBMWCgA8FiEE67lV
-
Y2amyVrqUoWjGfnbY35Mq3QFAmWdc6wCGwMFCQPCZwAECwkIBwQVCgkIBRYCAwEA
-
Ah4FAheAAAoJEBn522N+TKt0mwcA/AvuKD4dTPj4hJ/cezEWDOFELMaVYZqDS3V1
-
LmRJrdIHAQDYgST8awabyd2Y3PRTFf9ZcWRRompeg0v7c2hCc9/3A7g4BGWdc6wS
-
CisGAQQBl1UBBQEBB0AdJP8T3mGR7SUp9DBlIaVU1ESRC7sLWbm4QFCR1JTfSgMB
-
CAeIfgQYFgoAJhYhBOu5VWNmpsla6lKFoxn522N+TKt0BQJlnXOsAhsMBQkDwmcA
-
AAoJEBn522N+TKt07KwA/10R+ejRZeW0cYScowHAsnDZ09A43bZvdp1X7KeQHMl+
-
AQD+TbceHh393VFc4tkl5pYHfrmkCXMdN0faVWolkc7GCA==
-
=EfP/
-
-----END PGP PUBLIC KEY BLOCK-----
-
'';
-
trust = "ultimate";
-
}];
+
mDMEZZ1zrBYJKwYBBAHaRw8BAQdA8Zeb1OFbzEWx3tM7ylO0ILCnDCG2JoA/iay6
+
iWXmB7G0G1J5YW4gR2liYiA8cnlhbkBmcmV1bWgub3JnPoiUBBMWCgA8FiEE67lV
+
Y2amyVrqUoWjGfnbY35Mq3QFAmWdc6wCGwMFCQPCZwAECwkIBwQVCgkIBRYCAwEA
+
Ah4FAheAAAoJEBn522N+TKt0mwcA/AvuKD4dTPj4hJ/cezEWDOFELMaVYZqDS3V1
+
LmRJrdIHAQDYgST8awabyd2Y3PRTFf9ZcWRRompeg0v7c2hCc9/3A7g4BGWdc6wS
+
CisGAQQBl1UBBQEBB0AdJP8T3mGR7SUp9DBlIaVU1ESRC7sLWbm4QFCR1JTfSgMB
+
CAeIfgQYFgoAJhYhBOu5VWNmpsla6lKFoxn522N+TKt0BQJlnXOsAhsMBQkDwmcA
+
AAoJEBn522N+TKt07KwA/10R+ejRZeW0cYScowHAsnDZ09A43bZvdp1X7KeQHMl+
+
AQD+TbceHh393VFc4tkl5pYHfrmkCXMdN0faVWolkc7GCA==
+
=EfP/
+
-----END PGP PUBLIC KEY BLOCK-----
+
'';
+
trust = "ultimate";
+
}
+
];
};
services.gpg-agent.pinentryPackage = pkgs.pinentry-qt;
programs.git = {
enable = true;
extraConfig = {
-
init = { defaultBranch = "main"; };
+
init = {
+
defaultBranch = "main";
+
};
user = {
email = "ryan@freumh.org";
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";
···
programs.tmux = {
enable = true;
-
extraConfig = let
-
toggle-status-bar = pkgs.writeScript "toggle-status-bar.sh" ''
-
#!/usr/bin/env bash
-
window_count=$(tmux list-windows | wc -l)
-
if [ "$window_count" -ge "2" ]; then
-
tmux set-option status on
-
else
-
tmux set-option status off
-
fi
-
'';
-
# https://github.com/ThePrimeagen/.dotfiles/blob/master/bin/.local/scripts/tmux-sessionizer
-
sessionizer = pkgs.writeScript "sessionizer.sh" ''
-
#!/usr/bin/env bash
+
extraConfig =
+
let
+
toggle-status-bar = pkgs.writeScript "toggle-status-bar.sh" ''
+
#!/usr/bin/env bash
+
window_count=$(tmux list-windows | wc -l)
+
if [ "$window_count" -ge "2" ]; then
+
tmux set-option status on
+
else
+
tmux set-option status off
+
fi
+
'';
+
# https://github.com/ThePrimeagen/.dotfiles/blob/master/bin/.local/scripts/tmux-sessionizer
+
sessionizer = pkgs.writeScript "sessionizer.sh" ''
+
#!/usr/bin/env bash
-
if [[ $# -eq 1 ]]; then
-
selected=$1
-
else
-
selected=$(find ~ -not -path '*/.*' -maxdepth 2 -type d | fzf)
-
fi
+
if [[ $# -eq 1 ]]; then
+
selected=$1
+
else
+
selected=$(find ~ -not -path '*/.*' -maxdepth 2 -type d | fzf)
+
fi
-
if [[ -z $selected ]]; then
-
exit 0
-
fi
+
if [[ -z $selected ]]; then
+
exit 0
+
fi
-
selected_name=$(basename "$selected" | tr . _)
-
tmux_running=$(pgrep tmux)
+
selected_name=$(basename "$selected" | tr . _)
+
tmux_running=$(pgrep tmux)
-
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
-
tmux new-session -s $selected_name -c $selected
-
exit 0
-
fi
+
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
+
tmux new-session -s $selected_name -c $selected
+
exit 0
+
fi
-
if ! tmux has-session -t=$selected_name 2> /dev/null; then
-
tmux new-session -ds $selected_name -c $selected
-
fi
+
if ! tmux has-session -t=$selected_name 2> /dev/null; then
+
tmux new-session -ds $selected_name -c $selected
+
fi
-
tmux switch-client -t $selected_name
-
'';
-
in ''
-
# alternative modifier
-
unbind C-b
-
set-option -g prefix C-a
-
bind-key C-a send-prefix
+
tmux switch-client -t $selected_name
+
'';
+
in
+
''
+
# alternative modifier
+
unbind C-b
+
set-option -g prefix C-a
+
bind-key C-a send-prefix
-
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.urlscan}/bin/urlscan'
-
set-hook -g session-window-changed 'run-shell ${toggle-status-bar}'
-
set-hook -g session-created 'run-shell ${toggle-status-bar}'
-
# 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
-
# locking
-
set -s escape-time 0
-
set -g lock-command ${pkgs.vlock}/bin/vlock
-
set -g lock-after-time 0 # Seconds; 0 = never
-
bind L lock-session
-
# for .zprofile display environment starting https://github.com/tmux/tmux/issues/3483
-
set-option -g update-environment XDG_VTNR
-
# Allow clipboard with OSC-52 work
-
set -s set-clipboard on
-
# toggle
-
bind -r ^ last-window
-
# vim copy
-
bind -T copy-mode-vi v send-keys -X begin-selection
-
bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel
-
# find
-
bind-key -r g run-shell "tmux neww ${sessionizer}"
-
# reload
-
bind-key r source-file ~/.config/tmux/tmux.conf
-
# kill unattached
-
bind-key K run-shell 'tmux ls | grep -v attached | cut -d: -f1 | xargs -I {} tmux kill-window -t {}'
-
'';
+
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.urlscan}/bin/urlscan'
+
set-hook -g session-window-changed 'run-shell ${toggle-status-bar}'
+
set-hook -g session-created 'run-shell ${toggle-status-bar}'
+
# 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
+
# locking
+
set -s escape-time 0
+
set -g lock-command ${pkgs.vlock}/bin/vlock
+
set -g lock-after-time 0 # Seconds; 0 = never
+
bind L lock-session
+
# for .zprofile display environment starting https://github.com/tmux/tmux/issues/3483
+
set-option -g update-environment XDG_VTNR
+
# Allow clipboard with OSC-52 work
+
set -s set-clipboard on
+
# toggle
+
bind -r ^ last-window
+
# vim copy
+
bind -T copy-mode-vi v send-keys -X begin-selection
+
bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel
+
# find
+
bind-key -r g run-shell "tmux neww ${sessionizer}"
+
# reload
+
bind-key r source-file ~/.config/tmux/tmux.conf
+
# kill unattached
+
bind-key K run-shell 'tmux ls | grep -v attached | cut -d: -f1 | xargs -I {} tmux kill-window -t {}'
+
'';
};
programs.less = {
···
home.stateVersion = "22.05";
};
}
-
+12 -5
home/emacs/default.nix
···
-
{ pkgs, lib, config, ... }:
+
{
+
pkgs,
+
lib,
+
config,
+
...
+
}:
-
let cfg = config.custom.emacs;
-
in {
+
let
+
cfg = config.custom.emacs;
+
in
+
{
options.custom.emacs.enable = lib.mkEnableOption "emacs";
config = lib.mkIf cfg.enable {
programs.emacs = {
enable = true;
package = pkgs.emacs29-pgtk;
-
extraPackages = epkgs:
-
with epkgs; [
+
extraPackages =
+
epkgs: with epkgs; [
evil
evil-leader
# https://github.com/emacs-evil/evil-collection/pull/812/commits/149eacce58354f0ee3a55d4c12059148ef4ff953
+63 -50
home/gui.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
-
let cfg = config.custom.gui;
-
in {
+
let
+
cfg = config.custom.gui;
+
in
+
{
options.custom.gui.enable = lib.mkEnableOption "gui";
config = lib.mkIf cfg.enable {
···
sessionVariables = {
# evince workaround
GTK_THEME = "Gruvbox-Dark";
-
WALLPAPER = let wallpaper = ./wallpaper.jpg;
-
in pkgs.runCommand (builtins.baseNameOf wallpaper) { }
-
"cp ${wallpaper} $out";
+
WALLPAPER =
+
let
+
wallpaper = ./wallpaper.jpg;
+
in
+
pkgs.runCommand (builtins.baseNameOf wallpaper) { } "cp ${wallpaper} $out";
TERMINAL = "alacritty";
};
pointerCursor = {
···
};
};
-
programs.firefox = let
-
settings = {
-
"browser.ctrlTab.recentlyUsedOrder" = false;
-
"browser.tabs.warnOnClose" = false;
-
"browser.toolbars.bookmarks.visibility" = "never";
+
programs.firefox =
+
let
+
settings = {
+
"browser.ctrlTab.recentlyUsedOrder" = false;
+
"browser.tabs.warnOnClose" = false;
+
"browser.toolbars.bookmarks.visibility" = "never";
-
# Only hide UI elements on F11 (i.e. don't go fullscreen, leave that to WM)
-
"full-screen-api.ignore-widgets" = true;
-
# Right click issue fix
-
"ui.context_menus.after_mouseup" = true;
+
# Only hide UI elements on F11 (i.e. don't go fullscreen, leave that to WM)
+
"full-screen-api.ignore-widgets" = true;
+
# Right click issue fix
+
"ui.context_menus.after_mouseup" = true;
-
# Use userChrome.css
-
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
+
# 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;
+
# sync toolbar
+
"services.sync.prefs.sync.browser.uiCustomization.state" = true;
-
"extensions.pocket.enabled" = false;
-
};
-
userChrome = ''
-
#webrtcIndicator {
-
display: none;
-
}
+
"extensions.pocket.enabled" = false;
+
};
+
userChrome = ''
+
#webrtcIndicator {
+
display: none;
+
}
-
/* Move find bar to top */
-
.browserContainer > findbar {
-
-moz-box-ordinal-group: 0;
-
}
+
/* Move find bar to top */
+
.browserContainer > findbar {
+
-moz-box-ordinal-group: 0;
+
}
-
#TabsToolbar
-
{
-
visibility: collapse;
-
}
-
'';
-
in {
-
enable = true;
-
profiles.default = {
-
settings = settings;
-
userChrome = userChrome;
-
};
-
profiles.secondary = {
-
id = 1;
-
isDefault = false;
-
settings = settings;
-
userChrome = userChrome;
+
#TabsToolbar
+
{
+
visibility: collapse;
+
}
+
'';
+
in
+
{
+
enable = true;
+
profiles.default = {
+
settings = settings;
+
userChrome = userChrome;
+
};
+
profiles.secondary = {
+
id = 1;
+
isDefault = false;
+
settings = settings;
+
userChrome = userChrome;
+
};
+
package = (
+
pkgs.firefox.override {
+
nativeMessagingHosts = with pkgs; [ tridactyl-native ];
+
}
+
);
};
-
package = (pkgs.firefox.override {
-
nativeMessagingHosts = with pkgs; [ tridactyl-native ];
-
});
-
};
xdg = {
configFile = {
+24 -12
home/i3.nix
···
-
{ pkgs, config, lib, ... }@inputs:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}@inputs:
let
i3-workspace-history =
···
};
util = import ./util.nix { inherit pkgs lib; };
cfg = config.custom.gui.i3;
-
in {
+
in
+
{
options.custom.gui.i3.enable = lib.mkEnableOption "i3";
config = lib.mkIf cfg.enable {
···
'';
};
-
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);
-
"rofi/config.rasi".source = ./rofi.rasi;
-
};
-
in (util.inDirReplace ./wm/scripts "i3/scripts" replacements) // 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);
+
"rofi/config.rasi".source = ./rofi.rasi;
+
};
+
in
+
(util.inDirReplace ./wm/scripts "i3/scripts" replacements) // entries;
services.redshift = {
enable = true;
+44 -19
home/mail.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
let
address-book = pkgs.writeScriptBin "address-book" ''
···
${pkgs.mu}/bin/mu index
'';
cfg = config.custom.mail;
-
in {
+
in
+
{
options.custom.mail.enable = lib.mkEnableOption "mail";
config = lib.mkIf cfg.enable {
···
general.default-save-path = "~/downloads";
ui.mouse-enabled = true;
compose.address-book-cmd = "${address-book}/bin/address-book '%s'";
-
compose.file-picker-cmd =
-
"${pkgs.ranger}/bin/ranger --choosefiles=%f";
+
compose.file-picker-cmd = "${pkgs.ranger}/bin/ranger --choosefiles=%f";
compose.format-flowed = true;
ui.index-columns = "date<=,name<50,flags>=,subject<*";
ui.column-name = "{{index (.From | persons) 0}}";
"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";
···
expunge = "both";
remove = "both";
};
-
msmtp = { enable = true; };
+
msmtp = {
+
enable = true;
+
};
aerc = {
enable = true;
extraAccounts = {
check-mail-cmd = "${sync-mail}/bin/mbsync ryan@freumh.org";
check-mail-timeout = "1m";
check-mail = "1h";
-
folders-sort =
-
[ "Inbox" "Sent" "Drafts" "Archive" "Spam" "Trash" ];
+
folders-sort = [
+
"Inbox"
+
"Sent"
+
"Drafts"
+
"Archive"
+
"Spam"
+
"Trash"
+
];
folder-map = "${pkgs.writeText "folder-map" ''
Spam = Junk
Bin = Trash
···
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";
···
expunge = "both";
remove = "both";
};
-
msmtp = { enable = true; };
+
msmtp = {
+
enable = true;
+
};
aerc = {
enable = true;
extraAccounts = {
···
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";
···
expunge = "both";
remove = "both";
};
-
msmtp = { enable = true; };
+
msmtp = {
+
enable = true;
+
};
aerc = {
enable = true;
extraAccounts = {
···
realName = "Search Index";
address = "search@local";
aerc.enable = true;
-
aerc.extraAccounts = { source = "maildir://~/mail/search"; };
+
aerc.extraAccounts = {
+
source = "maildir://~/mail/search";
+
};
aerc.extraConfig = {
ui = {
index-columns = "flags>4,date<*,to<30,name<30,subject<*";
+58 -41
home/nvim/default.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
let
ltex-ls-nvim = pkgs.vimUtils.buildVimPlugin {
···
meta.homepage = "https://github.com/RyanGibb/calendar.nvim/";
};
cfg = config.custom;
-
in {
+
in
+
{
options.custom.nvim-lsps = lib.mkEnableOption "nvim-lsps";
config = {
···
enable = true;
viAlias = true;
vimAlias = true;
-
extraPackages = with pkgs;
-
[ ripgrep nixd ] ++ lib.lists.optionals cfg.nvim-lsps [
+
extraPackages =
+
with pkgs;
+
[
+
ripgrep
+
nixd
+
]
+
++ lib.lists.optionals cfg.nvim-lsps [
nixfmt-rfc-style
# stop complaining when launching but a devshell is better
ocamlPackages.ocaml-lsp
···
extraLuaConfig = builtins.readFile ./init.lua;
# undo transparent background
# + "colorscheme gruvbox";
-
plugins = with pkgs.vimPlugins;
+
plugins =
+
with pkgs.vimPlugins;
[
gruvbox-nvim
···
{
plugin = pkgs.notmuch;
-
runtime = let
-
notmuch-style = ''
-
let g:notmuch_date_format = '%Y-%m-%d'
-
let g:notmuch_datetime_format = '%Y-%m-%d %I:%M%p'
-
'';
-
in {
-
"ftplugin/notmuch-folders.vim".text = notmuch-style;
-
"ftplugin/notmuch-search.vim".text = notmuch-style;
-
"ftplugin/notmuch-show.vim".text = notmuch-style;
-
"ftplugin/notmuch-compose.vim".text = notmuch-style;
-
};
+
runtime =
+
let
+
notmuch-style = ''
+
let g:notmuch_date_format = '%Y-%m-%d'
+
let g:notmuch_datetime_format = '%Y-%m-%d %I:%M%p'
+
'';
+
in
+
{
+
"ftplugin/notmuch-folders.vim".text = notmuch-style;
+
"ftplugin/notmuch-search.vim".text = notmuch-style;
+
"ftplugin/notmuch-show.vim".text = notmuch-style;
+
"ftplugin/notmuch-compose.vim".text = notmuch-style;
+
};
}
{
···
require('calendar')
'';
}
-
] ++ lib.lists.optionals cfg.nvim-lsps [
+
]
+
++ lib.lists.optionals cfg.nvim-lsps [
{
plugin = nvim-lspconfig;
type = "lua";
config = builtins.readFile ./lsp.lua;
-
runtime = let
-
ml-style = ''
-
setlocal expandtab
-
setlocal shiftwidth=2
-
setlocal tabstop=2
-
setlocal softtabstop=2
-
'';
-
in {
-
"ftplugin/nix.vim".text = ml-style;
-
"ftplugin/ocaml.vim".text = ml-style;
-
"ftplugin/java.lua".text = ''
-
local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t')
-
local workspace_dir = '~/.cache/jdt/' .. project_name
-
require('jdtls').start_or_attach {
-
on_attach = On_attach,
-
capabilities = Capabilities,
-
cmd = { 'jdt-language-server', '-data', workspace_dir, },
-
root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1]),
-
}
-
'';
-
"ftplugin/ledger.vim".text = ''
-
setlocal foldmethod=syntax
-
'';
-
};
+
runtime =
+
let
+
ml-style = ''
+
setlocal expandtab
+
setlocal shiftwidth=2
+
setlocal tabstop=2
+
setlocal softtabstop=2
+
'';
+
in
+
{
+
"ftplugin/nix.vim".text = ml-style;
+
"ftplugin/ocaml.vim".text = ml-style;
+
"ftplugin/java.lua".text = ''
+
local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t')
+
local workspace_dir = '~/.cache/jdt/' .. project_name
+
require('jdtls').start_or_attach {
+
on_attach = On_attach,
+
capabilities = Capabilities,
+
cmd = { 'jdt-language-server', '-data', workspace_dir, },
+
root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1]),
+
}
+
'';
+
"ftplugin/ledger.vim".text = ''
+
setlocal foldmethod=syntax
+
'';
+
};
}
{
plugin = nvim-dap;
+33 -23
home/sway.nix
···
-
{ pkgs, config, lib, ... }@inputs:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}@inputs:
let
i3-workspace-history =
···
};
util = import ./util.nix { inherit pkgs lib; };
cfg = config.custom.gui.sway;
-
in {
+
in
+
{
options.custom.gui.sway.enable = lib.mkEnableOption "sway";
config = lib.mkIf cfg.enable {
···
fi
'';
-
xdg.configFile = let
-
entries = {
-
"fusuma/config.yml".source = ./fusuma.yml;
-
"kanshi/config".source = ./kanshi;
-
"dunst/dunstrc".source = ./dunst;
-
"swaylock/config".source = ./swaylock;
-
"wofi/style.css".source = ./wofi.css;
-
"swappy/config".text = ''
-
[Default]
-
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);
-
};
-
in (util.inDirReplace ./wm/scripts "sway/scripts" replacements) // entries;
+
xdg.configFile =
+
let
+
entries = {
+
"fusuma/config.yml".source = ./fusuma.yml;
+
"kanshi/config".source = ./kanshi;
+
"dunst/dunstrc".source = ./dunst;
+
"swaylock/config".source = ./swaylock;
+
"wofi/style.css".source = ./wofi.css;
+
"swappy/config".text = ''
+
[Default]
+
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);
+
};
+
in
+
(util.inDirReplace ./wm/scripts "sway/scripts" replacements) // entries;
services.gammastep = {
enable = true;
provider = "geoclue2";
temperature.day = 6500;
};
-
systemd.user.services.gammastep.Service.ExecStart =
-
lib.mkForce "${pkgs.gammastep}/bin/gammastep -r";
+
systemd.user.services.gammastep.Service.ExecStart = lib.mkForce "${pkgs.gammastep}/bin/gammastep -r";
};
}
+31 -23
home/util.nix
···
{ pkgs, lib, ... }:
{
-
listFilesInDir = src:
-
lib.attrsets.mapAttrsToList (name: value: "${src}/${name}")
-
(builtins.readDir src);
-
inDirReplace = src: dst: replacements:
+
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)))
+
(
+
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:
+
concatFilesReplace =
+
filenames: replacements:
+
let
+
fromStrings = lib.attrsets.mapAttrsToList (name: value: "@${name}@") replacements;
+
in
+
let
+
toStrings = lib.attrsets.mapAttrsToList (name: value: "${value}") replacements;
+
in
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);
+
fileToString = file: builtins.replaceStrings fromStrings toStrings (builtins.readFile file);
+
in
+
builtins.concatStringsSep "\n" (builtins.map fileToString filenames);
}
+13 -5
hosts/barnacle/default.nix
···
-
{ config, lib, pkgs, nixpkgs, ... }:
+
{
+
config,
+
lib,
+
pkgs,
+
nixpkgs,
+
...
+
}:
{
imports = [
···
# build with:
# nix build /etc/nixos#nixosConfigurations.barnacle.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";
+31 -21
hosts/capybara/default.nix
···
-
{ config, pkgs, lib, nix-rpi5, ... }:
+
{
+
config,
+
pkgs,
+
lib,
+
nix-rpi5,
+
...
+
}:
{
imports = [ ./hardware-configuration.nix ];
···
homeManager.enable = true;
};
-
home-manager.users.${config.custom.username}.config.custom.machineColour =
-
"red";
+
home-manager.users.${config.custom.username}.config.custom.machineColour = "red";
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 = {
+12 -2
hosts/capybara/hardware-configuration.nix
···
-
{ config, lib, pkgs, modulesPath, ... }:
+
{
+
config,
+
lib,
+
pkgs,
+
modulesPath,
+
...
+
}:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
···
boot.loader.grub.efiSupport = true;
boot.loader.grub.efiInstallAsRemovable = true;
boot.loader.efi.canTouchEfiVariables = false;
-
boot.initrd.availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" ];
+
boot.initrd.availableKernelModules = [
+
"xhci_pci"
+
"usbhid"
+
"usb_storage"
+
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
+51 -43
hosts/duck/default.nix
···
-
{ pkgs, config, lib, eilean, eon, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
eilean,
+
eon,
+
...
+
}:
{
imports = [ ./hardware-configuration.nix ];
···
homeManager.enable = true;
};
-
home-manager.users.${config.custom.username}.config.custom.machineColour =
-
"green";
+
home-manager.users.${config.custom.username}.config.custom.machineColour = "green";
environment.systemPackages = with pkgs; [ xe-guest-utilities ];
···
eilean.services.dns = {
zones."cl.freumh.org" = {
soa.serial = lib.mkDefault 3;
-
records = let
-
ipv4 = "128.232.113.136";
-
ipv6 = "2a05:b400:110:1101:d051:f2ff:fe13:3781";
-
in [
-
{
-
name = "@";
-
type = "NS";
-
value = "ns";
-
}
+
records =
+
let
+
ipv4 = "128.232.113.136";
+
ipv6 = "2a05:b400:110:1101:d051:f2ff:fe13:3781";
+
in
+
[
+
{
+
name = "@";
+
type = "NS";
+
value = "ns";
+
}
-
{
-
name = "ns";
-
type = "A";
-
value = ipv4;
-
}
-
{
-
name = "ns";
-
type = "AAAA";
-
value = ipv6;
-
}
+
{
+
name = "ns";
+
type = "A";
+
value = ipv4;
+
}
+
{
+
name = "ns";
+
type = "AAAA";
+
value = ipv6;
+
}
-
{
-
name = "@";
-
type = "A";
-
value = ipv4;
-
}
-
{
-
name = "@";
-
type = "AAAA";
-
value = ipv6;
-
}
-
{
-
name = "vps";
-
type = "A";
-
value = ipv4;
-
}
-
{
-
name = "vps";
-
type = "AAAA";
-
value = ipv6;
-
}
-
];
+
{
+
name = "@";
+
type = "A";
+
value = ipv4;
+
}
+
{
+
name = "@";
+
type = "AAAA";
+
value = ipv6;
+
}
+
{
+
name = "vps";
+
type = "A";
+
value = ipv4;
+
}
+
{
+
name = "vps";
+
type = "AAAA";
+
value = ipv6;
+
}
+
];
};
};
+26 -13
hosts/duck/hardware-configuration.nix
···
-
{ config, lib, pkgs, modulesPath, ... }:
+
{
+
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 = [ ];
···
fsType = "ext4";
};
-
swapDevices = [{
-
device = "/var/swap";
-
size = 2048;
-
}];
+
swapDevices = [
+
{
+
device = "/var/swap";
+
size = 2048;
+
}
+
];
networking = {
useDHCP = false;
interfaces."enX0" = {
-
ipv4.addresses = [{
-
address = "128.232.113.136";
-
prefixLength = 23;
-
}];
+
ipv4.addresses = [
+
{
+
address = "128.232.113.136";
+
prefixLength = 23;
+
}
+
];
};
defaultGateway = {
address = "128.232.112.1";
···
};
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;
}
+35 -12
hosts/elephant/default.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
{
-
imports =
-
[ ./hardware-configuration.nix ./zfs.nix ./services.nix ./owntracks.nix ];
+
imports = [
+
./hardware-configuration.nix
+
./zfs.nix
+
./services.nix
+
./owntracks.nix
+
];
custom = {
enable = true;
···
homeManager.enable = true;
};
-
home-manager.users.${config.custom.username}.config.custom.machineColour =
-
"blue";
+
home-manager.users.${config.custom.username}.config.custom.machineColour = "blue";
environment.systemPackages = with pkgs; [
smartmontools
···
#stig
];
-
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)
···
];
};
nixpkgs.config.packageOverrides = prev: {
-
jellyfin-ffmpeg =
-
prev.jellyfin-ffmpeg.overrideAttrs (_: { withVpl = true; });
-
ffmpeg = prev.ffmpeg.overrideAttrs (_: { withVpl = true; });
+
jellyfin-ffmpeg = prev.jellyfin-ffmpeg.overrideAttrs (_: {
+
withVpl = true;
+
});
+
ffmpeg = prev.ffmpeg.overrideAttrs (_: {
+
withVpl = true;
+
});
};
boot.kernel.sysctl = {
+22 -9
hosts/elephant/hardware-configuration.nix
···
-
{ config, lib, pkgs, modulesPath, ... }:
+
{
+
config,
+
lib,
+
pkgs,
+
modulesPath,
+
...
+
}:
{
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 = [ ];
···
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;
+33 -24
hosts/elephant/owntracks.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
-
let cfg = config.services.owntracks-recorder;
-
in {
+
let
+
cfg = config.services.owntracks-recorder;
+
in
+
{
options.services.owntracks-recorder = {
enable = lib.mkEnableOption "Enable the Owntracks location tracker";
host = lib.mkOption {
···
services.mosquitto = {
enable = true;
logType = [ "debug" ];
-
listeners = [{
-
port = cfg.port;
-
address = cfg.host;
-
acl = [ "topic readwrite #" ];
-
omitPasswordAuth = true;
-
users = { };
-
settings = { allow_anonymous = true; };
-
}];
+
listeners = [
+
{
+
port = cfg.port;
+
address = cfg.host;
+
acl = [ "topic readwrite #" ];
+
omitPasswordAuth = true;
+
users = { };
+
settings = {
+
allow_anonymous = true;
+
};
+
}
+
];
};
systemd.services.owntracks-recorder = {
description = "OwnTracks Recorder Service";
wantedBy = [ "multi-user.target" ];
-
after = [ "network.target" "mosquitto.service" ];
+
after = [
+
"network.target"
+
"mosquitto.service"
+
];
serviceConfig = {
-
ExecStart = "${pkgs.owntracks-recorder}/bin/ot-recorder"
+
ExecStart =
+
"${pkgs.owntracks-recorder}/bin/ot-recorder"
+ " --storage /var/lib/owntracks"
+ " --doc-root ${pkgs.owntracks-recorder.src}/docroot"
+ " --host ${cfg.host} --port ${builtins.toString cfg.port}"
···
virtualHosts."${cfg.domain}" = {
locations = {
"/ws" = {
-
proxyPass =
-
"http://${cfg.httpHost}:${builtins.toString cfg.httpPort}";
+
proxyPass = "http://${cfg.httpHost}:${builtins.toString cfg.httpPort}";
proxyWebsockets = true;
recommendedProxySettings = true;
};
"/" = {
-
proxyPass =
-
"http://${cfg.httpHost}:${builtins.toString cfg.httpPort}/";
+
proxyPass = "http://${cfg.httpHost}:${builtins.toString cfg.httpPort}/";
recommendedProxySettings = true;
};
"/view/" = {
-
proxyPass =
-
"http://${cfg.httpHost}:${builtins.toString cfg.httpPort}/view/";
+
proxyPass = "http://${cfg.httpHost}:${builtins.toString cfg.httpPort}/view/";
recommendedProxySettings = true;
# Chrome fix
extraConfig = "proxy_buffering off;";
};
"/static/" = {
-
proxyPass = "http://${cfg.httpHost}:${
-
builtins.toString cfg.httpPort
-
}/static/";
+
proxyPass = "http://${cfg.httpHost}:${builtins.toString cfg.httpPort}/static/";
recommendedProxySettings = true;
};
"/utils/" = {
-
proxyPass =
-
"http://${cfg.httpHost}:${builtins.toString cfg.httpPort}/utils/";
+
proxyPass = "http://${cfg.httpHost}:${builtins.toString cfg.httpPort}/utils/";
recommendedProxySettings = true;
};
};
+11 -4
hosts/elephant/services.nix
···
-
{ nixpkgs-unstable, config, pkgs, lib, ... }:
+
{
+
nixpkgs-unstable,
+
config,
+
pkgs,
+
lib,
+
...
+
}:
{
custom.nix-cache.enable = true;
···
#requires = [ "tailscaled.service" ];
clientMaxBodySize = "1g";
virtualHosts = {
-
"nix-cache.vpn.freumh.org" = { listenAddresses = [ "100.64.0.9" ]; };
+
"nix-cache.vpn.freumh.org" = {
+
listenAddresses = [ "100.64.0.9" ];
+
};
"jellyfin.vpn.freumh.org" = {
onlySSL = true;
listenAddresses = [ "100.64.0.9" ];
···
#"use sendfile" = "yes";
#"max protocol" = "smb2";
# note: localhost is the ipv6 localhost ::1
-
"hosts allow" =
-
"192.168.1. 192.168.0. 127.0.0.1 localhost 100.64.0.0/10";
+
"hosts allow" = "192.168.1. 192.168.0. 127.0.0.1 localhost 100.64.0.0/10";
"hosts deny" = "0.0.0.0/0";
"guest account" = "nobody";
"map to guest" = "bad user";
+4 -1
hosts/gecko/backups.nix
···
repository = "rest:http://100.64.0.9:8000/${config.networking.hostName}/";
passwordFile = config.age.secrets.restic-gecko.path;
initialize = true;
-
paths = [ "/home/ryan" "/etc/NetworkManager/system-connections" ];
+
paths = [
+
"/home/ryan"
+
"/etc/NetworkManager/system-connections"
+
];
exclude = [
"/home/ryan/videos"
"/home/ryan/.thunderbird"
+17 -3
hosts/gecko/default.nix
···
-
{ pkgs, lib, config, ... }:
+
{
+
pkgs,
+
lib,
+
config,
+
...
+
}:
{
-
imports = [ ./hardware-configuration.nix ./backups.nix ];
+
imports = [
+
./hardware-configuration.nix
+
./backups.nix
+
];
custom = {
enable = true;
···
iamb
spotify
gimp
-
(python3.withPackages (p: with p; [ numpy matplotlib pandas ]))
+
(python3.withPackages (
+
p: with p; [
+
numpy
+
matplotlib
+
pandas
+
]
+
))
lsof
gthumb
restic
+25 -10
hosts/gecko/hardware-configuration.nix
···
-
{ config, lib, pkgs, modulesPath, ... }:
+
{
+
config,
+
lib,
+
pkgs,
+
modulesPath,
+
...
+
}:
{
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 = [ ];
···
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" ];
+
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";
}
+30 -21
hosts/mouse/installer.nix
···
-
{ nixpkgs, lib, pkgs, config, ... }:
+
{
+
nixpkgs,
+
lib,
+
pkgs,
+
config,
+
...
+
}:
# A minimal config for a ARMv6-L Raspberry Pi 1 that can be built to an SD card image with:
# `nix build .#nixosConfigurations.mouse-install.config.system.build.toplevel
···
# 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
···
set -o vi
'';
-
users = let
-
hashedPassword =
-
"$6$IPvnJnu6/fp1Jxfy$U6EnzYDOC2NqE4iqRrkJJbSTHHNWk0KwK1xyk9jEvlu584UWQLyzDVF5I1Sh47wQhSVrvUI4mrqw6XTTjfPj6.";
-
in {
-
mutableUsers = false;
-
users.ryan = {
-
isNormalUser = true;
-
extraGroups = [
-
"wheel" # enable sudo
-
];
-
hashedPassword = hashedPassword;
-
openssh.authorizedKeys.keyFiles = [ ../../modules/authorized_keys ];
-
};
-
users.root = {
-
hashedPassword = hashedPassword;
-
openssh.authorizedKeys.keyFiles = [ ../../modules/authorized_keys ];
+
users =
+
let
+
hashedPassword = "$6$IPvnJnu6/fp1Jxfy$U6EnzYDOC2NqE4iqRrkJJbSTHHNWk0KwK1xyk9jEvlu584UWQLyzDVF5I1Sh47wQhSVrvUI4mrqw6XTTjfPj6.";
+
in
+
{
+
mutableUsers = false;
+
users.ryan = {
+
isNormalUser = true;
+
extraGroups = [
+
"wheel" # enable sudo
+
];
+
hashedPassword = hashedPassword;
+
openssh.authorizedKeys.keyFiles = [ ../../modules/authorized_keys ];
+
};
+
users.root = {
+
hashedPassword = hashedPassword;
+
openssh.authorizedKeys.keyFiles = [ ../../modules/authorized_keys ];
+
};
};
-
};
-
environment.systemPackages = with pkgs; [ vim tmux ];
+
environment.systemPackages = with pkgs; [
+
vim
+
tmux
+
];
services.tailscale = {
enable = true;
+36 -25
hosts/mouse/sd-image.nix
···
-
{ nixpkgs, lib, pkgs, config, ... }:
+
{
+
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.initrd.availableKernelModules = lib.mkForce [ "xhci_pci" "usbhid" ];
+
boot.initrd.availableKernelModules = lib.mkForce [
+
"xhci_pci"
+
"usbhid"
+
];
#boot.initrd.availableKernelModules = lib.mkForce [ ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
-
swapDevices = [{
-
device = "/var/swap";
-
size = 4096;
-
}];
+
swapDevices = [
+
{
+
device = "/var/swap";
+
size = 4096;
+
}
+
];
networking.useDHCP = lib.mkDefault true;
···
networking.hostName = "mouse";
-
users = let
-
hashedPassword =
-
"$6$IPvnJnu6/fp1Jxfy$U6EnzYDOC2NqE4iqRrkJJbSTHHNWk0KwK1xyk9jEvlu584UWQLyzDVF5I1Sh47wQhSVrvUI4mrqw6XTTjfPj6.";
-
in {
-
mutableUsers = false;
-
users.ryan = {
-
isNormalUser = true;
-
extraGroups = [
-
"wheel" # enable sudo
-
];
-
hashedPassword = hashedPassword;
-
openssh.authorizedKeys.keyFiles = [ ../../modules/authorized_keys ];
-
};
-
users.root = {
-
hashedPassword = hashedPassword;
-
openssh.authorizedKeys.keyFiles = [ ../../modules/authorized_keys ];
+
users =
+
let
+
hashedPassword = "$6$IPvnJnu6/fp1Jxfy$U6EnzYDOC2NqE4iqRrkJJbSTHHNWk0KwK1xyk9jEvlu584UWQLyzDVF5I1Sh47wQhSVrvUI4mrqw6XTTjfPj6.";
+
in
+
{
+
mutableUsers = false;
+
users.ryan = {
+
isNormalUser = true;
+
extraGroups = [
+
"wheel" # enable sudo
+
];
+
hashedPassword = hashedPassword;
+
openssh.authorizedKeys.keyFiles = [ ../../modules/authorized_keys ];
+
};
+
users.root = {
+
hashedPassword = hashedPassword;
+
openssh.authorizedKeys.keyFiles = [ ../../modules/authorized_keys ];
+
};
};
-
};
environment.systemPackages = with pkgs; [ vim ];
+43 -34
hosts/owl/default.nix
···
-
{ pkgs, config, lib, eon, ... }@inputs:
+
{
+
pkgs,
+
config,
+
lib,
+
eon,
+
...
+
}@inputs:
let
vpnRecords = [
···
value = "100.64.0.9";
}
];
-
in {
+
in
+
{
imports = [
./hardware-configuration.nix
./minimal.nix
···
{
name = "@";
type = "TXT";
-
value =
-
"google-site-verification=rEvwSqf7RYKRQltY412qMtTuoxPp64O3L7jMotj9Jnc";
+
value = "google-site-verification=rEvwSqf7RYKRQltY412qMtTuoxPp64O3L7jMotj9Jnc";
}
{
name = "_atproto.ryan";
···
{
name = "_25._tcp.mail";
type = "TLSA";
-
value =
-
"3 1 1 2f0fd413f063c75141937dd196a9f4ab66139d599e0dcf2a7ce6d557647e26a6";
+
value = "3 1 1 2f0fd413f063c75141937dd196a9f4ab66139d599e0dcf2a7ce6d557647e26a6";
}
# generate with
# for i in r3 e1 r4-cross-signed e2
···
{
name = "_25._tcp.mail";
type = "TLSA";
-
value =
-
"2 1 1 8d02536c887482bc34ff54e41d2ba659bf85b341a0a20afadb5813dcfbcf286d";
+
value = "2 1 1 8d02536c887482bc34ff54e41d2ba659bf85b341a0a20afadb5813dcfbcf286d";
}
# LE E1
{
name = "_25._tcp.mail";
type = "TLSA";
-
value =
-
"2 1 1 276fe8a8c4ec7611565bf9fce6dcace9be320c1b5bea27596b2204071ed04f10";
+
value = "2 1 1 276fe8a8c4ec7611565bf9fce6dcace9be320c1b5bea27596b2204071ed04f10";
}
# LE R4
{
name = "_25._tcp.mail";
type = "TLSA";
-
value =
-
"2 1 1 e5545e211347241891c554a03934cde9b749664a59d26d615fe58f77990f2d03";
+
value = "2 1 1 e5545e211347241891c554a03934cde9b749664a59d26d615fe58f77990f2d03";
}
# LE E2
{
name = "_25._tcp.mail";
type = "TLSA";
-
value =
-
"2 1 1 bd936e72b212ef6f773102c6b77d38f94297322efc25396bc3279422e0c89270";
+
value = "2 1 1 bd936e72b212ef6f773102c6b77d38f94297322efc25396bc3279422e0c89270";
}
] ++ vpnRecords;
};
···
];
};
};
-
services.bind.zones.${config.networking.domain}.extraConfig = ''
-
dnssec-policy default;
-
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
+
services.bind.zones.${config.networking.domain}.extraConfig =
+
''
+
dnssec-policy default;
+
inline-signing yes;
+
journal "${config.services.bind.directory}/${config.networking.domain}.signed.jnl";
''
-
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;
···
};
};
-
security.acme-eon.nginxCerts = [ "capybara.fn06.org" "shrew.freumh.org" ];
+
security.acme-eon.nginxCerts = [
+
"capybara.fn06.org"
+
"shrew.freumh.org"
+
];
services.nginx.virtualHosts."capybara.fn06.org" = {
forceSSL = true;
locations."/" = {
···
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;
+18 -10
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."/" = {
···
fsType = "ext4";
};
-
swapDevices = [{
-
device = "/var/swap";
-
size = 4096;
-
}];
+
swapDevices = [
+
{
+
device = "/var/swap";
+
size = 4096;
+
}
+
];
networking = {
interfaces."enp1s0" = {
-
ipv6.addresses = [{
-
address = "2a01:4f9:c011:87ad::";
-
prefixLength = 64;
-
}];
+
ipv6.addresses = [
+
{
+
address = "2a01:4f9:c011:87ad::";
+
prefixLength = 64;
+
}
+
];
};
defaultGateway6 = {
address = "fe80::1";
+8 -3
hosts/owl/minimal.nix
···
-
{ pkgs, config, lib, eilean, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
eilean,
+
...
+
}:
{
imports = [ ./hardware-configuration.nix ];
···
homeManager.enable = true;
};
-
home-manager.users.${config.custom.username}.config.custom.machineColour =
-
"yellow";
+
home-manager.users.${config.custom.username}.config.custom.machineColour = "yellow";
boot.tmp.cleanOnBoot = true;
}
+45 -25
hosts/shrew/default.nix
···
-
{ config, pkgs, lib, nixos-hardware, nixpkgs, ... }:
+
{
+
config,
+
pkgs,
+
lib,
+
nixos-hardware,
+
nixpkgs,
+
...
+
}:
{
-
imports = [ ./hardware-configuration.nix "${nixos-hardware}/raspberry-pi/4" ];
+
imports = [
+
./hardware-configuration.nix
+
"${nixos-hardware}/raspberry-pi/4"
+
];
custom = {
enable = true;
···
homeManager.enable = true;
};
-
home-manager.users.${config.custom.username}.config.custom.machineColour =
-
"red";
+
home-manager.users.${config.custom.username}.config.custom.machineColour = "red";
networking.networkmanager.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 = {
···
"google_assistant"
"google_translate"
];
-
customComponents =
-
with pkgs.overlay-unstable.home-assistant-custom-components;
-
[ adaptive_lighting ];
+
customComponents = with pkgs.overlay-unstable.home-assistant-custom-components; [
+
adaptive_lighting
+
];
config = {
# Includes dependencies for a basic setup
# https://www.home-assistant.io/integrations/default_config/
···
project_id = "shrew-25325";
service_account = "!include SERVICE_ACCOUNT.JSON";
report_state = true;
-
exposed_domains = [ "switch" "light" ];
+
exposed_domains = [
+
"switch"
+
"light"
+
];
entity_config = {
"light.room_bed_left" = {
name = "BED_LEFT";
···
adaptive_lighting = {
sunrise_time = "06:00:00";
sunset_time = "18:00:00";
-
lights =
-
[ "light.bed_left" "light.bed_right" "light.ceiling" "light.strip" ];
+
lights = [
+
"light.bed_left"
+
"light.bed_right"
+
"light.ceiling"
+
"light.strip"
+
];
};
};
};
+11 -2
hosts/shrew/hardware-configuration.nix
···
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
-
{ config, lib, pkgs, modulesPath, ... }:
+
{
+
config,
+
lib,
+
pkgs,
+
modulesPath,
+
...
+
}:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
-
boot.initrd.availableKernelModules = [ "xhci_pci" "usbhid" ];
+
boot.initrd.availableKernelModules = [
+
"xhci_pci"
+
"usbhid"
+
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
+15 -5
hosts/shrew/sd-image.nix
···
-
{ config, lib, nixpkgs, ... }:
+
{
+
config,
+
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";
-
custom = { enable = true; };
+
custom = {
+
enable = true;
+
};
networking.wireless = {
enable = true;
-
networks = { "SSID" = { psk = "password"; }; };
+
networks = {
+
"SSID" = {
+
psk = "password";
+
};
+
};
};
}
+137 -107
hosts/swan/default.nix
···
-
{ pkgs, config, lib, hyperbib-eeg, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
hyperbib-eeg,
+
...
+
}:
-
let domain = "eeg.cl.cam.ac.uk";
-
in {
+
let
+
domain = "eeg.cl.cam.ac.uk";
+
in
+
{
imports = [
./hardware-configuration.nix
./minimal.nix
···
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";
-
}];
+
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 {
-
name = "raven-rsa-key";
-
destination = "/pubkey2";
-
text = ''
-
-----BEGIN RSA PUBLIC KEY-----
-
MIGJAoGBAL/2pwBbVcJKTRF8B+K6W9Oi4xkoPiOb32te0whw7Zuf7cTFCk5tvBa6
-
CI7wM0R99LtvNLFmoantTps92LjF9fvrCBYZDqpaLnk5clXShKKqt3do4SykqYkq
-
66kpc42jZ58C3omR0dUfQ7o7yTktVqnrDjLVb9P+vLhAfuSFHFa1AgMBAAE=
-
-----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"; };
-
});
-
in ''
-
AAKeyDir ${keyfile}
-
AACookieKey file:/dev/urandom
-
<Location "/bib/">
-
AuthType Ucam-WebAuth
-
Require valid-user
-
</Location>
+
extraConfig =
+
let
+
keyfile = pkgs.writeTextFile {
+
name = "raven-rsa-key";
+
destination = "/pubkey2";
+
text = ''
+
-----BEGIN RSA PUBLIC KEY-----
+
MIGJAoGBAL/2pwBbVcJKTRF8B+K6W9Oi4xkoPiOb32te0whw7Zuf7cTFCk5tvBa6
+
CI7wM0R99LtvNLFmoantTps92LjF9fvrCBYZDqpaLnk5clXShKKqt3do4SykqYkq
+
66kpc42jZ58C3omR0dUfQ7o7yTktVqnrDjLVb9P+vLhAfuSFHFa1AgMBAAE=
+
-----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";
+
};
+
}
+
);
+
in
+
''
+
AAKeyDir ${keyfile}
+
AACookieKey file:/dev/urandom
+
<Location "/bib/">
+
AuthType Ucam-WebAuth
+
Require valid-user
+
</Location>
-
SSLEngine on
-
ServerName ${domain}
+
SSLEngine on
+
ServerName ${domain}
-
### Matrix config
+
### Matrix config
-
RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
-
AllowEncodedSlashes NoDecode
-
ProxyPreserveHost on
-
ProxyPass /_matrix http://127.0.0.1:8008/_matrix nocanon
-
ProxyPassReverse /_matrix http://127.0.0.1:8008/_matrix
-
ProxyPass /_synapse/client http://127.0.0.1:8008/_synapse/client nocanon
-
ProxyPassReverse /_synapse/client http://127.0.0.1:8008/_synapse/client
+
RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
+
AllowEncodedSlashes NoDecode
+
ProxyPreserveHost on
+
ProxyPass /_matrix http://127.0.0.1:8008/_matrix nocanon
+
ProxyPassReverse /_matrix http://127.0.0.1:8008/_matrix
+
ProxyPass /_synapse/client http://127.0.0.1:8008/_synapse/client nocanon
+
ProxyPassReverse /_synapse/client http://127.0.0.1:8008/_synapse/client
-
Alias /.well-known/matrix/server "${matrixServerConfig}"
-
Alias /.well-known/matrix/client "${matrixClientConfig}"
-
'';
+
Alias /.well-known/matrix/server "${matrixServerConfig}"
+
Alias /.well-known/matrix/client "${matrixClientConfig}"
+
'';
};
virtualHosts."watch.${domain}" = {
forceSSL = true;
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 = [
+24 -11
hosts/swan/hardware-configuration.nix
···
-
{ config, lib, pkgs, ... }:
+
{
+
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 = [ ];
···
fsType = "ext4";
};
-
swapDevices = [{
-
device = "/var/swap";
-
size = 1024;
-
}];
+
swapDevices = [
+
{
+
device = "/var/swap";
+
size = 1024;
+
}
+
];
networking = {
useDHCP = false;
-
interfaces."enX0".ipv4.addresses = [{
-
address = "128.232.98.96";
-
prefixLength = 23;
-
}];
+
interfaces."enX0".ipv4.addresses = [
+
{
+
address = "128.232.98.96";
+
prefixLength = 23;
+
}
+
];
defaultGateway = {
address = "128.232.98.1";
interface = "enX0";
+7 -3
hosts/swan/minimal.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
{
imports = [ ./hardware-configuration.nix ];
···
useNixCache = false;
};
-
home-manager.users.${config.custom.username}.config.custom.machineColour =
-
"green";
+
home-manager.users.${config.custom.username}.config.custom.machineColour = "green";
services.openssh.openFirewall = true;
}
+7 -1
hosts/swan/mod_ucam_webauth.nix
···
-
{ lib, stdenv, fetchFromGitHub, apacheHttpd, openssl }:
+
{
+
lib,
+
stdenv,
+
fetchFromGitHub,
+
apacheHttpd,
+
openssl,
+
}:
stdenv.mkDerivation rec {
pname = "mod_ucam_webauth";
+29 -11
hosts/vulpine/hardware-configuration.nix
···
-
{ config, lib, pkgs, modulesPath, ... }:
+
{
+
config,
+
lib,
+
pkgs,
+
modulesPath,
+
...
+
}:
{
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" ];
+
boot.kernelModules = [
+
"kvm-intel"
+
"wl"
+
];
boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
# loading bcma/b43 at the same time as wl seems to cause issues
-
boot.blacklistedKernelModules = [ "bcma" "b43" ];
+
boot.blacklistedKernelModules = [
+
"bcma"
+
"b43"
+
];
fileSystems."/" = {
device = "/dev/disk/by-uuid/d2afdf21-7a3a-47f0-83e1-31e9cccdad84";
···
];
};
-
swapDevices = [{
-
device = "/swapfile";
-
size = 8192;
-
}];
+
swapDevices = [
+
{
+
device = "/swapfile";
+
size = 8192;
+
}
+
];
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;
+17 -9
modules/alec-website.nix
···
-
{ pkgs, config, lib, alec-website, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
alec-website,
+
...
+
}:
with lib;
-
let cfg = config.custom.website.alec;
-
in {
+
let
+
cfg = config.custom.website.alec;
+
in
+
{
options = {
custom.website.alec = {
enable = mkEnableOption "Alec's website";
···
config = mkIf cfg.enable {
security.acme-eon.nginxCerts = [ cfg.domain ];
-
security.acme-eon.certs.${cfg.domain}.extraDomainNames =
-
[ "www.${cfg.domain}" ];
+
security.acme-eon.certs.${cfg.domain}.extraDomainNames = [ "www.${cfg.domain}" ];
services.nginx = {
enable = true;
virtualHosts = {
"${cfg.domain}" = {
forceSSL = true;
-
root =
-
"${alec-website.packages.${pkgs.stdenv.hostPlatform.system}.default}";
+
root = "${alec-website.packages.${pkgs.stdenv.hostPlatform.system}.default}";
locations."/var/".extraConfig = ''
alias /var/${cfg.domain}/;
'';
···
'';
};
"www.${cfg.domain}" =
-
let certDir = config.security.acme-eon.certs.${cfg.domain}.directory;
-
in {
+
let
+
certDir = config.security.acme-eon.certs.${cfg.domain}.directory;
+
in
+
{
forceSSL = true;
sslCertificate = "${certDir}/fullchain.pem";
sslCertificateKey = "${certDir}/key.pem";
+15 -4
modules/auto-upgrade.nix
···
-
{ pkgs, config, lib, ... }@inputs:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}@inputs:
-
let cfg = config.custom.autoUpgrade;
-
in {
+
let
+
cfg = config.custom.autoUpgrade;
+
in
+
{
options.custom.autoUpgrade.enable = lib.mkEnableOption "autoUpgrade";
config = lib.mkIf cfg.enable {
···
enable = true;
allowReboot = true;
flake = inputs.self.outPath;
-
flags = [ "--update-input" "nixpkgs" "-L" ];
+
flags = [
+
"--update-input"
+
"nixpkgs"
+
"-L"
+
];
dates = "03:00";
randomizedDelaySec = "1hr";
rebootWindow = {
+13 -5
modules/colour-guesser.nix
···
-
{ pkgs, config, lib, options, colour-guesser, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
options,
+
colour-guesser,
+
...
+
}:
-
let cfg = config.custom.website.colour-guesser;
-
in {
+
let
+
cfg = config.custom.website.colour-guesser;
+
in
+
{
options = {
custom.website.colour-guesser = {
enable = lib.mkEnableOption "Colour Guesser";
···
recommendedProxySettings = true;
virtualHosts."${cfg.domain}" = {
forceSSL = true;
-
root =
-
"${colour-guesser.packages.${pkgs.stdenv.hostPlatform.system}.default}";
+
root = "${colour-guesser.packages.${pkgs.stdenv.hostPlatform.system}.default}";
};
};
+75 -58
modules/default.nix
···
-
{ pkgs, config, lib, agenix, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
agenix,
+
...
+
}:
-
let cfg = config.custom;
-
in {
+
let
+
cfg = config.custom;
+
in
+
{
imports = [
./auto-upgrade.nix
./dict.nix
···
};
};
-
config = let nixPath = "/etc/nix-path";
-
in lib.mkIf cfg.enable {
-
console = {
-
font = "Lat2-Terminus16";
-
keyMap = "uk";
-
};
-
i18n.defaultLocale = "en_GB.UTF-8";
+
config =
+
let
+
nixPath = "/etc/nix-path";
+
in
+
lib.mkIf cfg.enable {
+
console = {
+
font = "Lat2-Terminus16";
+
keyMap = "uk";
+
};
+
i18n.defaultLocale = "en_GB.UTF-8";
-
networking.domain = lib.mkDefault "freumh.org";
+
networking.domain = lib.mkDefault "freumh.org";
-
eilean.username = cfg.username;
+
eilean.username = cfg.username;
-
nix = {
-
settings = lib.mkMerge [{
-
experimental-features = [ "nix-command" "flakes" ];
-
auto-optimise-store = true;
-
trusted-users = [ cfg.username ];
-
}];
-
gc = {
-
automatic = true;
-
dates = "weekly";
-
options = "--delete-older-than 30d";
+
nix = {
+
settings = lib.mkMerge [
+
{
+
experimental-features = [
+
"nix-command"
+
"flakes"
+
];
+
auto-optimise-store = true;
+
trusted-users = [ cfg.username ];
+
}
+
];
+
gc = {
+
automatic = true;
+
dates = "weekly";
+
options = "--delete-older-than 30d";
+
};
+
# https://discourse.nixos.org/t/do-flakes-also-set-the-system-channel/19798/16
+
nixPath = [ "nixpkgs=${nixPath}" ];
};
-
# 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}" ];
-
users = let
-
hashedPassword =
-
"$6$IPvnJnu6/fp1Jxfy$U6EnzYDOC2NqE4iqRrkJJbSTHHNWk0KwK1xyk9jEvlu584UWQLyzDVF5I1Sh47wQhSVrvUI4mrqw6XTTjfPj6.";
-
in {
-
mutableUsers = false;
-
groups.plugdev = { };
-
users.${cfg.username} = {
-
isNormalUser = true;
-
extraGroups = [
-
"wheel" # enable sudo
-
"networkmanager"
-
"video"
-
"plugdev"
-
];
-
shell = pkgs.zsh;
-
# we let home manager manager zsh
-
ignoreShellProgramCheck = true;
-
hashedPassword = hashedPassword;
-
};
-
users.root.hashedPassword = hashedPassword;
-
};
+
users =
+
let
+
hashedPassword = "$6$IPvnJnu6/fp1Jxfy$U6EnzYDOC2NqE4iqRrkJJbSTHHNWk0KwK1xyk9jEvlu584UWQLyzDVF5I1Sh47wQhSVrvUI4mrqw6XTTjfPj6.";
+
in
+
{
+
mutableUsers = false;
+
groups.plugdev = { };
+
users.${cfg.username} = {
+
isNormalUser = true;
+
extraGroups = [
+
"wheel" # enable sudo
+
"networkmanager"
+
"video"
+
"plugdev"
+
];
+
shell = pkgs.zsh;
+
# we let home manager manager zsh
+
ignoreShellProgramCheck = true;
+
hashedPassword = hashedPassword;
+
};
+
users.root.hashedPassword = hashedPassword;
+
};
-
environment.systemPackages = with pkgs; [
-
nix
-
git
-
agenix.packages.${system}.default
-
];
+
environment.systemPackages = with pkgs; [
+
nix
+
git
+
agenix.packages.${system}.default
+
];
-
networking = rec {
-
# nameservers = [ "freumh.org" ];
-
nameservers = [ "1.1.1.1" ];
-
# uncomment to stop using DHCP nameservers
-
#networkmanager.dns = "none";
+
networking = rec {
+
# nameservers = [ "freumh.org" ];
+
nameservers = [ "1.1.1.1" ];
+
# uncomment to stop using DHCP nameservers
+
#networkmanager.dns = "none";
+
};
};
-
};
}
+10 -3
modules/dict.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
-
let cfg = config.custom;
-
in {
+
let
+
cfg = config.custom;
+
in
+
{
options.custom.dict = lib.mkOption {
type = lib.types.bool;
default = true;
+73 -62
modules/external-hdd-backup.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
-
let cfg = config.custom;
-
in {
+
let
+
cfg = config.custom;
+
in
+
{
options.custom.external-hdd-backup = {
enable = lib.mkEnableOption "laptop";
disk = lib.mkOption {
···
# 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;
···
'';
services.autofs = {
enable = true;
-
autoMaster = let
-
map = pkgs.writeText "auto.media" ''
-
${cfg.backup.mountname} -fstype=auto :${cfg.backup.disk}
+
autoMaster =
+
let
+
map = pkgs.writeText "auto.media" ''
+
${cfg.backup.mountname} -fstype=auto :${cfg.backup.disk}
+
'';
+
in
+
''
+
${cfg.backup.mountdir} file,sun:${map} -t 60
'';
-
in ''
-
${cfg.backup.mountdir} file,sun:${map} -t 60
-
'';
};
};
}
+17 -9
modules/fn06-website.nix
···
-
{ pkgs, config, lib, fn06-website, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
fn06-website,
+
...
+
}:
with lib;
-
let cfg = config.custom.website.fn06;
-
in {
+
let
+
cfg = config.custom.website.fn06;
+
in
+
{
options = {
custom.website.fn06 = {
enable = mkEnableOption "fn06's website";
···
config = mkIf cfg.enable {
security.acme-eon.nginxCerts = [ cfg.domain ];
-
security.acme-eon.certs.${cfg.domain}.extraDomainNames =
-
[ "www.${cfg.domain}" ];
+
security.acme-eon.certs.${cfg.domain}.extraDomainNames = [ "www.${cfg.domain}" ];
services.nginx = {
enable = true;
virtualHosts = {
"${cfg.domain}" = {
forceSSL = true;
-
root =
-
"${fn06-website.packages.${pkgs.stdenv.hostPlatform.system}.default}";
+
root = "${fn06-website.packages.${pkgs.stdenv.hostPlatform.system}.default}";
locations."/var/".extraConfig = ''
alias /var/${cfg.domain}/;
'';
···
'';
};
"www.${cfg.domain}" =
-
let certDir = config.security.acme-eon.certs.${cfg.domain}.directory;
-
in {
+
let
+
certDir = config.security.acme-eon.certs.${cfg.domain}.directory;
+
in
+
{
forceSSL = true;
sslCertificate = "${certDir}/fullchain.pem";
sslCertificateKey = "${certDir}/key.pem";
+30 -21
modules/freumh.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
-
let cfg = config.custom;
-
in {
+
let
+
cfg = config.custom;
+
in
+
{
options.custom.freumh.enable = lib.mkEnableOption "freumh";
config = lib.mkIf cfg.freumh.enable {
···
enable = true;
virtualHosts."${config.networking.domain}" = {
forceSSL = true;
-
locations."/root" = let
-
random-root = pkgs.writeScript "random-root.php" ''
-
<?php
-
$dir = '/var/roots/';
-
$files = glob($dir . '/*.*');
-
$file = $files[array_rand($files)];
-
header('Content-Type: ' . mime_content_type($file));
-
header('X-Id: ' . pathinfo($file, PATHINFO_FILENAME));
-
readfile($file);
-
?>
-
'';
-
in {
-
extraConfig = ''
-
fastcgi_pass unix:${config.services.phpfpm.pools.freumh.socket};
-
include ${pkgs.nginx}/conf/fastcgi_params;
-
fastcgi_param SCRIPT_FILENAME ${random-root};
-
'';
-
};
+
locations."/root" =
+
let
+
random-root = pkgs.writeScript "random-root.php" ''
+
<?php
+
$dir = '/var/roots/';
+
$files = glob($dir . '/*.*');
+
$file = $files[array_rand($files)];
+
header('Content-Type: ' . mime_content_type($file));
+
header('X-Id: ' . pathinfo($file, PATHINFO_FILENAME));
+
readfile($file);
+
?>
+
'';
+
in
+
{
+
extraConfig = ''
+
fastcgi_pass unix:${config.services.phpfpm.pools.freumh.socket};
+
include ${pkgs.nginx}/conf/fastcgi_params;
+
fastcgi_param SCRIPT_FILENAME ${random-root};
+
'';
+
};
locations."/index.html".root = pkgs.writeTextFile {
name = "freumh";
text = ''
+26 -10
modules/gui/default.nix
···
-
{ pkgs, config, lib, i3-workspace-history, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
i3-workspace-history,
+
...
+
}:
-
let cfg = config.custom.gui;
-
in {
+
let
+
cfg = config.custom.gui;
+
in
+
{
options.custom.gui.enable = lib.mkOption {
type = lib.types.bool;
default = cfg.i3 || cfg.sway || cfg.kde;
};
config = lib.mkIf cfg.enable {
-
home-manager.users.${config.custom.username} = { config, ... }: {
-
config.custom.gui.enable = true;
-
};
+
home-manager.users.${config.custom.username} =
+
{ config, ... }:
+
{
+
config.custom.gui.enable = true;
+
};
networking.networkmanager.enable = true;
···
hardware.bluetooth.enable = true;
services.blueman.enable = true;
-
environment.systemPackages = with pkgs;
+
environment.systemPackages =
+
with pkgs;
let
desktopEntries = [
(pkgs.makeDesktopItem {
···
icon = "feh";
})
];
-
in [
+
in
+
[
jq
playerctl
brightnessctl
···
networkmanagerapplet
pavucontrol
(xfce.thunar.override {
-
thunarPlugins = with xfce; [ thunar-archive-plugin xfconf ];
+
thunarPlugins = with xfce; [
+
thunar-archive-plugin
+
xfconf
+
];
})
# https://discourse.nixos.org/t/sway-wm-configuration-polkit-login-manager/3857/6
polkit_gnome
···
pulseaudio
tridactyl-native
vlc
-
] ++ desktopEntries;
+
]
+
++ desktopEntries;
fonts.packages = with pkgs; [
noto-fonts
+15 -6
modules/gui/i3.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
-
let cfg = config.custom.gui;
-
in {
+
let
+
cfg = config.custom.gui;
+
in
+
{
options.custom.gui.i3 = lib.mkEnableOption "i3";
config = lib.mkIf cfg.i3 {
-
home-manager.users.${config.custom.username} = { config, ... }: {
-
config.custom.gui.i3.enable = true;
-
};
+
home-manager.users.${config.custom.username} =
+
{ config, ... }:
+
{
+
config.custom.gui.i3.enable = true;
+
};
#services.displayManager.lightdm.enable = true;
services.displayManager.defaultSession = "none+i3";
+4 -2
modules/gui/kde.nix
···
{ config, lib, ... }:
-
let cfg = config.custom.gui;
-
in {
+
let
+
cfg = config.custom.gui;
+
in
+
{
options.custom.gui.kde = lib.mkEnableOption "kde";
config = lib.mkIf cfg.kde {
+15 -6
modules/gui/sway.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
-
let cfg = config.custom.gui;
-
in {
+
let
+
cfg = config.custom.gui;
+
in
+
{
options.custom.gui.sway = lib.mkEnableOption "sway";
config = lib.mkIf cfg.sway {
-
home-manager.users.${config.custom.username} = { config, ... }: {
-
config.custom.gui.sway.enable = true;
-
};
+
home-manager.users.${config.custom.username} =
+
{ config, ... }:
+
{
+
config.custom.gui.sway.enable = true;
+
};
programs.sway = {
enable = true;
+4 -2
modules/home-manager.nix
···
{ config, lib, ... }@inputs:
-
let cfg = config.custom.homeManager;
-
in {
+
let
+
cfg = config.custom.homeManager;
+
in
+
{
options.custom.homeManager.enable = lib.mkEnableOption "homeManager";
config = lib.mkIf cfg.enable {
+10 -3
modules/laptop.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
-
let cfg = config.custom;
-
in {
+
let
+
cfg = config.custom;
+
in
+
{
options.custom.laptop = lib.mkEnableOption "laptop";
config = lib.mkIf cfg.laptop {
+11 -6
modules/nix-cache.nix
···
-
{ config, pkgs, lib, ... }:
+
{
+
config,
+
pkgs,
+
lib,
+
...
+
}:
-
let cfg = config.custom;
-
in {
+
let
+
cfg = config.custom;
+
in
+
{
options.custom.nix-cache = {
enable = lib.mkEnableOption "nix-cache";
domain = lib.mkOption {
···
virtualHosts.${cfg.nix-cache.domain} = {
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;
+17 -8
modules/nix-index.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
-
let cfg = config.custom;
-
in {
+
let
+
cfg = config.custom;
+
in
+
{
config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.nix-index ];
programs.command-not-found.enable = false;
-
home-manager.users.${config.custom.username} = { ... }: {
-
programs.zsh.initExtra = ''
-
source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh
-
'';
-
};
+
home-manager.users.${config.custom.username} =
+
{ ... }:
+
{
+
programs.zsh.initExtra = ''
+
source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh
+
'';
+
};
};
}
+14 -4
modules/ocaml.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
-
let cfg = config.custom;
-
in {
+
let
+
cfg = config.custom;
+
in
+
{
options.custom.ocaml = lib.mkEnableOption "ocaml";
config = lib.mkIf cfg.ocaml {
-
environment.systemPackages = with pkgs; [ opam pkg-config ];
+
environment.systemPackages = with pkgs; [
+
opam
+
pkg-config
+
];
};
}
+4 -2
modules/printing.nix
···
{ config, lib, ... }:
-
let cfg = config.custom;
-
in {
+
let
+
cfg = config.custom;
+
in
+
{
options.custom.printing = lib.mkEnableOption "printing";
config = lib.mkIf cfg.printing {
+16 -9
modules/rmfakecloud.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
with lib;
let
cfg = config.custom.rmfakecloud;
domain = config.networking.domain;
-
in {
+
in
+
{
options.custom.rmfakecloud = {
enable = mkEnableOption "rmfakecloud";
port = mkOption {
···
};
};
-
mailserver.loginAccounts."misc@${domain}".aliases =
-
[ "remarkable@${domain}" ];
+
mailserver.loginAccounts."misc@${domain}".aliases = [ "remarkable@${domain}" ];
security.acme-eon.nginxCerts = [ cfg.domain ];
services.nginx = {
···
};
};
-
eilean.services.dns.zones.${config.networking.domain}.records = [{
-
name = "rmfakecloud";
-
type = "CNAME";
-
value = "vps";
-
}];
+
eilean.services.dns.zones.${config.networking.domain}.records = [
+
{
+
name = "rmfakecloud";
+
type = "CNAME";
+
value = "vps";
+
}
+
];
};
}
+16 -7
modules/ryan-website.nix
···
-
{ pkgs, config, lib, ryan-website, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
ryan-website,
+
...
+
}:
with lib;
-
let cfg = config.custom.website.ryan;
-
in {
+
let
+
cfg = config.custom.website.ryan;
+
in
+
{
options = {
custom.website.ryan = {
enable = mkEnableOption "ryan's website";
···
config = mkIf cfg.enable {
security.acme-eon.nginxCerts = [ cfg.domain ];
-
security.acme-eon.certs.${cfg.domain}.extraDomainNames =
-
[ "www.${cfg.domain}" ];
+
security.acme-eon.certs.${cfg.domain}.extraDomainNames = [ "www.${cfg.domain}" ];
services.nginx = {
enable = true;
···
'';
};
"www.${cfg.domain}" =
-
let certDir = config.security.acme-eon.certs.${cfg.domain}.directory;
-
in {
+
let
+
certDir = config.security.acme-eon.certs.${cfg.domain}.directory;
+
in
+
{
forceSSL = true;
sslCertificate = "${certDir}/fullchain.pem";
sslCertificateKey = "${certDir}/key.pem";
+4 -2
modules/scripts.nix
···
{ config, lib, ... }:
-
let cfg = config.custom;
-
in {
+
let
+
cfg = config.custom;
+
in
+
{
config = lib.mkIf cfg.enable {
environment.interactiveShellInit = "export PATH=$PATH:/etc/nixos/scripts";
};
+11 -5
modules/ssh.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
-
let cfg = config.custom;
-
in {
+
let
+
cfg = config.custom;
+
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;
+4 -2
modules/tailscale.nix
···
with lib;
-
let cfg = config.custom;
-
in {
+
let
+
cfg = config.custom;
+
in
+
{
options.custom.tailscale = mkEnableOption "tailscale";
config = lib.mkIf cfg.tailscale {
+4 -2
modules/use-nix-cache.nix
···
{ config, lib, ... }:
-
let cfg = config.custom;
-
in {
+
let
+
cfg = config.custom;
+
in
+
{
options.custom.useNixCache = lib.mkOption {
type = lib.types.bool;
default = true;
+10 -3
modules/workstation.nix
···
-
{ pkgs, config, lib, ... }@inputs:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}@inputs:
-
let cfg = config.custom;
-
in {
+
let
+
cfg = config.custom;
+
in
+
{
options.custom.workstation = lib.mkEnableOption "custom";
config = lib.mkIf cfg.workstation {
+10 -3
modules/zsa.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
-
let cfg = config.custom.zsa;
-
in {
+
let
+
cfg = config.custom.zsa;
+
in
+
{
options.custom.zsa = lib.mkOption {
type = lib.types.bool;
default = false;
+45 -33
nix-on-droid/default.nix
···
-
{ pkgs, config, lib, ... }:
+
{
+
pkgs,
+
config,
+
lib,
+
...
+
}:
{
user.shell = "${pkgs.zsh}/bin/zsh";
···
home-manager = {
useGlobalPkgs = true;
-
config = { pkgs, lib, ... }: {
-
imports = [ ../home/default.nix ];
+
config =
+
{ pkgs, lib, ... }:
+
{
+
imports = [ ../home/default.nix ];
-
# Use the same overlays as the system packages
-
nixpkgs = { inherit (config.nixpkgs) overlays; };
+
# Use the same overlays as the system packages
+
nixpkgs = { inherit (config.nixpkgs) overlays; };
-
nix = {
-
package = pkgs.nix;
-
settings.experimental-features = [ "nix-command" "flakes" ];
-
};
+
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";
-
};
+
# 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";
+
};
-
home.file = {
-
".ssh/authorized_keys".source = ../modules/authorized_keys;
-
};
+
home.file = {
+
".ssh/authorized_keys".source = ../modules/authorized_keys;
+
};
+
+
programs.ssh = {
+
enable = true;
+
extraConfig = ''
+
User ryan
+
'';
+
};
-
programs.ssh = {
-
enable = true;
-
extraConfig = ''
-
User ryan
-
'';
-
};
+
home.sessionVariables = {
+
LEDGER_FILE = ''~/storage/Documents/vault/ledger/`date "+%Y"`.ledger'';
+
};
-
home.sessionVariables = {
-
LEDGER_FILE = ''~/storage/Documents/vault/ledger/`date "+%Y"`.ledger'';
+
home.stateVersion = "22.05";
};
-
-
home.stateVersion = "22.05";
-
};
};
system.stateVersion = "22.05";
}
+8 -5
pkgs/hmrc-paye-tool.nix
···
-
{ pkgs ? import <nixpkgs> { } }:
+
{
+
pkgs ? import <nixpkgs> { },
+
}:
with pkgs;
let
···
inherit version;
src = fetchurl {
-
url =
-
"https://www.gov.uk/government/uploads/uploaded/hmrc/payetools-rti-${version}-linux.zip";
+
url = "https://www.gov.uk/government/uploads/uploaded/hmrc/payetools-rti-${version}-linux.zip";
hash = "sha256-QOW6Loqg001AcqWX/TOH6wvI2uAY4qNyFvQzCVEe8VU=";
};
···
mv prefix $out
'';
};
-
in buildFHSUserEnv {
+
in
+
buildFHSUserEnv {
name = "hmrc-paye-tools-fhs";
-
targetPkgs = pkgs:
+
targetPkgs =
+
pkgs:
(with pkgs; [
glibc
zlib
+83 -36
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
-
# Used by the NixOS module:
-
, isNixOS ? false, enableXWayland ? true, xorg
-
, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
-
, trayEnabled ? systemdSupport }:
+
{
+
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,
+
systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd,
+
systemd,
+
trayEnabled ? systemdSupport,
+
}:
stdenv.mkDerivation (finalAttrs: {
pname = "sway-unwrapped";
version = "im";
-
inherit enableXWayland isNixOS systemdSupport trayEnabled;
+
inherit
+
enableXWayland
+
isNixOS
+
systemdSupport
+
trayEnabled
+
;
src = fetchFromGitHub {
owner = "Decodetalkers";
repo = "sway";
···
sha256 = "sha256-UqmdwCTV5LgAQ6z94ZrHBX/QPmBi29fruUzeQk5Vhto=";
};
-
patches = [
-
./load-configuration-from-etc.patch
+
patches =
+
[
+
./load-configuration-from-etc.patch
-
(substituteAll {
-
src = ./fix-paths.patch;
-
inherit swaybg;
-
})
-
] ++ lib.optionals (!finalAttrs.isNixOS) [
-
# References to /nix/store/... will get GC'ed which causes problems when
-
# copying the default configuration:
-
./sway-config-no-nix-store-references.patch
-
] ++ lib.optionals finalAttrs.isNixOS [
-
# Use /run/current-system/sw/share and /etc instead of /nix/store
-
# references:
-
./sway-config-nixos-paths.patch
-
];
+
(substituteAll {
+
src = ./fix-paths.patch;
+
inherit swaybg;
+
})
+
]
+
++ lib.optionals (!finalAttrs.isNixOS) [
+
# References to /nix/store/... will get GC'ed which causes problems when
+
# copying the default configuration:
+
./sway-config-no-nix-store-references.patch
+
]
+
++ lib.optionals finalAttrs.isNixOS [
+
# Use /run/current-system/sw/share and /etc instead of /nix/store
+
# references:
+
./sway-config-nixos-paths.patch
+
];
strictDeps = true;
depsBuildBuild = [ pkg-config ];
-
nativeBuildInputs = [ meson ninja pkg-config wayland-scanner scdoc ];
+
nativeBuildInputs = [
+
meson
+
ninja
+
pkg-config
+
wayland-scanner
+
scdoc
+
];
buildInputs = [
libGL
···
(wlroots.override { inherit (finalAttrs) enableXWayland; })
] ++ lib.optionals finalAttrs.enableXWayland [ xorg.xcbutilwm ];
-
mesonFlags = let
-
# The "sd-bus-provider" meson option does not include a "none" option,
-
# but it is silently ignored iff "-Dtray=disabled". We use "basu"
-
# (which is not in nixpkgs) instead of "none" to alert us if this
-
# changes: https://github.com/swaywm/sway/issues/6843#issuecomment-1047288761
-
# assert trayEnabled -> systemdSupport && dbusSupport;
+
mesonFlags =
+
let
+
# The "sd-bus-provider" meson option does not include a "none" option,
+
# but it is silently ignored iff "-Dtray=disabled". We use "basu"
+
# (which is not in nixpkgs) instead of "none" to alert us if this
+
# 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;
···
changelog = "https://github.com/swaywm/sway/releases/tag/${version}";
license = licenses.mit;
platforms = platforms.linux;
-
maintainers = with maintainers; [ primeos synthetica ];
+
maintainers = with maintainers; [
+
primeos
+
synthetica
+
];
mainProgram = "sway";
};
})
+48 -10
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";
···
};
# $out for the library and $examples for the example programs (in examples):
-
outputs = [ "out" "examples" ];
+
outputs = [
+
"out"
+
"examples"
+
];
strictDeps = true;
depsBuildBuild = [ pkg-config ];
-
nativeBuildInputs = [ meson ninja pkg-config wayland-scanner glslang ];
+
nativeBuildInputs = [
+
meson
+
ninja
+
pkg-config
+
wayland-scanner
+
glslang
+
];
buildInputs = [
libGL
···
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 ];
+
maintainers = with lib.maintainers; [
+
primeos
+
synthetica
+
rewine
+
];
};
})
+10 -2
pkgs/wlroots/protocols.nix
···
-
{ lib, stdenv, fetchFromGitLab, wayland-scanner }:
+
{
+
lib,
+
stdenv,
+
fetchFromGitLab,
+
wayland-scanner,
+
}:
stdenv.mkDerivation rec {
pname = "wlr-protocols";
···
doCheck = true;
checkTarget = "check";
-
installFlags = [ "DESTDIR=$(out)" "PREFIX=" ];
+
installFlags = [
+
"DESTDIR=$(out)"
+
"PREFIX="
+
];
meta = with lib; {
description = "Wayland roots protocol extensions";
+27 -14
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 ++ [ elephant ];
-
"email-ryan.age".publicKeys = user ++ [ gecko owl ];
-
"email-system.age".publicKeys = user ++ [ gecko owl elephant ];
+
"email-ryan.age".publicKeys = user ++ [
+
gecko
+
owl
+
];
+
"email-system.age".publicKeys = user ++ [
+
gecko
+
owl
+
elephant
+
];
"matrix-shared-secret.age".publicKeys = user ++ [ owl ];
"matrix-turn-shared-secret.age".publicKeys = user ++ [ owl ];
"coturn.age".publicKeys = user ++ [ owl ];
"website-phd.age".publicKeys = user ++ [ owl ];
"rmfakecloud.age".publicKeys = user ++ [ owl ];
-
"restic-owl.age".publicKeys = user ++ [ owl elephant ];
-
"restic-gecko.age".publicKeys = user ++ [ gecko elephant ];
-
"restic-shrew.age".publicKeys = user ++ [ shrew elephant ];
+
"restic-owl.age".publicKeys = user ++ [
+
owl
+
elephant
+
];
+
"restic-gecko.age".publicKeys = user ++ [
+
gecko
+
elephant
+
];
+
"restic-shrew.age".publicKeys = user ++ [
+
shrew
+
elephant
+
];
"restic-elephant.age".publicKeys = user ++ [ elephant ];
"restic.env.age".publicKeys = user ++ [ elephant ];
"restic-repo.age".publicKeys = user ++ [ elephant ];