nix machine / user configurations

style(treewide): go my formatter

ptr.pet 4556170d 6a8b8352

verified
+20 -12
flake.nix
···
tlib = import ./lib lib;
l = lib;
-
makePkgsSet = system: import ./pkgs-set {
-
inherit system lib tlib flakeInputs;
-
};
+
makePkgsSet =
+
system:
+
import ./pkgs-set {
+
inherit
+
system
+
lib
+
tlib
+
flakeInputs
+
;
+
};
allPkgsSets = tlib.genSystems makePkgsSet;
miscApps =
l.mapAttrs
(
-
_: l.mapAttrs (_: cmd: {
-
type = "app";
-
program = cmd;
-
})
+
_:
+
l.mapAttrs (
+
_: cmd: {
+
type = "app";
+
program = cmd;
+
}
+
)
)
(
-
l.mapAttrs
-
(_: set: {
+
l.mapAttrs (_: set: {
deploy-ncr = l.getExe set.terra.deploy-ncr;
dns = l.getExe set.terra.dnsmngmt;
-
})
-
allPkgsSets
+
}) allPkgsSets
);
in
{
···
nixosConfigurations = import ./hosts { inherit lib tlib allPkgsSets; };
homeConfigurations = import ./users { inherit lib tlib allPkgsSets; };
-
legacyPackages = l.mapAttrs (_: set: set.pkgs // {inherit (set) inputs;}) allPkgsSets;
+
legacyPackages = l.mapAttrs (_: set: set.pkgs // { inherit (set) inputs; }) allPkgsSets;
packages = l.mapAttrs (_: set: set.exported) allPkgsSets;
apps = miscApps;
+12 -13
hosts/tkaronto/default.nix
···
4995
];
# musikcube
-
networking.firewall.allowedTCPPorts =
-
[
-
7905
-
7906
-
]
-
++ [
-
6695
-
6696
-
6697
-
6698
-
6699
-
]
-
++ [ 50300 ];
+
networking.firewall.allowedTCPPorts = [
+
7905
+
7906
+
]
+
++ [
+
6695
+
6696
+
6697
+
6698
+
6699
+
]
+
++ [ 50300 ];
# for tailscale
networking.firewall.checkReversePath = "loose";
+2 -1
hosts/wolumonde/default.nix
···
"${inputs.agenix}/modules/age.nix"
"${inputs.ncr}/firewall"
"${inputs.ncr}/firewall/hetzner"
-
] ++ (tlib.importFolder (toString ./modules));
+
]
+
++ (tlib.importFolder (toString ./modules));
environment.systemPackages = with pkgs; [
magic-wormhole-rs
+13 -14
hosts/wolumonde/modules/atproto.nix
···
};
in
{
-
services.nginx.virtualHosts =
-
{
-
# "gaze.systems" = mkWellKnownCfg {
-
# "atproto-did" = pkgs.writeText "server" "did:plc:dfl62fgb7wtjj3fcbb72naae";
-
# };
-
"poor.dog" = mkWellKnownCfg {
-
"atproto-did" = pkgs.writeText "server" "did:plc:dfl62fgb7wtjj3fcbb72naae";
-
};
-
# "9.0.0.0.8.e.f.1.5.0.7.4.0.1.0.0.2.ip6.arpa" = mkWellKnownCfg {
-
# "atproto-did" = pkgs.writeText "server" "did:plc:dfl62fgb7wtjj3fcbb72naae";
-
# };
-
}
-
// (mkDidWebCfg "dawn.gaze.systems")
-
// (mkDidWebCfg "guestbook.gaze.systems");
+
services.nginx.virtualHosts = {
+
# "gaze.systems" = mkWellKnownCfg {
+
# "atproto-did" = pkgs.writeText "server" "did:plc:dfl62fgb7wtjj3fcbb72naae";
+
# };
+
"poor.dog" = mkWellKnownCfg {
+
"atproto-did" = pkgs.writeText "server" "did:plc:dfl62fgb7wtjj3fcbb72naae";
+
};
+
# "9.0.0.0.8.e.f.1.5.0.7.4.0.1.0.0.2.ip6.arpa" = mkWellKnownCfg {
+
# "atproto-did" = pkgs.writeText "server" "did:plc:dfl62fgb7wtjj3fcbb72naae";
+
# };
+
}
+
// (mkDidWebCfg "dawn.gaze.systems")
+
// (mkDidWebCfg "guestbook.gaze.systems");
# // (mkDidWebCfg "9.0.0.0.8.e.f.1.5.0.7.4.0.1.0.0.2.ip6.arpa");
}
+1 -1
hosts/wolumonde/modules/blog.nix
···
}:
let
PUBLIC_BASE_URL = "https://gaze.systems";
-
modules = (pkgs.callPackage "${inputs.blog}/nix/modules.nix" {}).overrideAttrs (_: {
+
modules = (pkgs.callPackage "${inputs.blog}/nix/modules.nix" { }).overrideAttrs (_: {
outputHash = "sha256-CO0bFv5WbNBSgucHCb+I9kIZEkh6QqWngRra0luMtSI=";
});
pkg = pkgs.callPackage "${inputs.blog}/nix" {
+12 -4
hosts/wolumonde/modules/headplane.nix
···
-
{lib, config, pkgs, terra, inputs, ...}:
+
{
+
lib,
+
config,
+
pkgs,
+
terra,
+
inputs,
+
...
+
}:
let
-
format = pkgs.formats.yaml {};
+
format = pkgs.formats.yaml { };
# A workaround generate a valid Headscale config accepted by Headplane when `config_strict == true`.
settings = lib.recursiveUpdate config.services.headscale.settings {
···
headscaleConfig = format.generate "headscale.yml" settings;
cfg = config.services.headplane.settings;
-
in {
-
imports = ["${inputs.headplane}/nix/module.nix"];
+
in
+
{
+
imports = [ "${inputs.headplane}/nix/module.nix" ];
services.headplane = {
enable = true;
+10 -3
hosts/wolumonde/modules/headscale.nix/default.nix
···
-
{config, ...}: let
+
{ config, ... }:
+
let
rootDomain = "gaze.systems";
domain = "vpn.${rootDomain}";
-
in {
+
in
+
{
age.secrets.headscaleOidcSecret = {
file = ../../../../secrets/headscaleOidcSecret.age;
mode = "600";
···
};
dns = {
base_domain = "lan.${rootDomain}";
-
nameservers.global = ["1.1.1.1" "1.0.0.1" "9.9.9.9" "149.112.112.112"];
+
nameservers.global = [
+
"1.1.1.1"
+
"1.0.0.1"
+
"9.9.9.9"
+
"149.112.112.112"
+
];
};
oidc = {
issuer = config.services.pocket-id.settings.APP_URL;
+1 -1
hosts/wolumonde/modules/limbusart.nix
···
...
}:
let
-
pkg = pkgs.callPackage "${inputs.limbusart}/package.nix" {};
+
pkg = pkgs.callPackage "${inputs.limbusart}/package.nix" { };
in
{
systemd.services.limbusart = {
+2 -2
hosts/wolumonde/modules/nginx.nix
···
statusPage = true;
};
-
networking.firewall.public."http".allowedTCPPorts = [80];
-
networking.firewall.public."https".allowedTCPPorts = [443];
+
networking.firewall.public."http".allowedTCPPorts = [ 80 ];
+
networking.firewall.public."https".allowedTCPPorts = [ 443 ];
# output json logs so we can consume them more easily
services.nginx.appendHttpConfig = ''
+4 -4
hosts/wolumonde/modules/nsid-tracker.nix
···
}:
let
client-modules =
-
(pkgs.callPackage "${inputs.nsid-tracker}/nix/client-modules.nix" {})
-
.overrideAttrs (_: {
-
outputHash = "sha256-TzTafbNTng/mMyf0yR9Rc6XS9/zzipwmK9SUWm2XxeY=";
-
});
+
(pkgs.callPackage "${inputs.nsid-tracker}/nix/client-modules.nix" { }).overrideAttrs
+
(_: {
+
outputHash = "sha256-TzTafbNTng/mMyf0yR9Rc6XS9/zzipwmK9SUWm2XxeY=";
+
});
client = pkgs.callPackage "${inputs.nsid-tracker}/nix/client.nix" {
PUBLIC_API_URL = "gaze.systems/nsid-tracker/api";
inherit client-modules;
+29 -30
hosts/wolumonde/modules/pds.nix
···
services.nginx.virtualHosts.${config.services.pds.settings.PDS_HOSTNAME} = {
useACMEHost = "gaze.systems";
forceSSL = true;
-
locations =
-
{
-
# we need to proxy /xrpc for pds to work
-
# silly but i want root domain >:3
-
"/xrpc" = {
-
proxyPass = pdsLocalhost;
-
proxyWebsockets = true;
-
# pass ws headers so we can actually proxy the ws
-
extraConfig = ''
-
proxy_set_header id $request_id;
-
client_max_body_size 100M;
-
'';
-
# higher prio just to make sure
-
priority = 100;
-
};
-
}
-
# others
-
// (lib.genAttrs
-
[
-
"/@atproto"
-
"/oauth"
-
"=/.well-known/oauth-protected-resource"
-
"=/.well-known/oauth-authorization-server"
-
]
-
(_: {
-
proxyPass = pdsLocalhost;
-
# higher prio just to make sure
-
priority = 100;
-
})
-
);
+
locations = {
+
# we need to proxy /xrpc for pds to work
+
# silly but i want root domain >:3
+
"/xrpc" = {
+
proxyPass = pdsLocalhost;
+
proxyWebsockets = true;
+
# pass ws headers so we can actually proxy the ws
+
extraConfig = ''
+
proxy_set_header id $request_id;
+
client_max_body_size 100M;
+
'';
+
# higher prio just to make sure
+
priority = 100;
+
};
+
}
+
# others
+
// (lib.genAttrs
+
[
+
"/@atproto"
+
"/oauth"
+
"=/.well-known/oauth-protected-resource"
+
"=/.well-known/oauth-authorization-server"
+
]
+
(_: {
+
proxyPass = pdsLocalhost;
+
# higher prio just to make sure
+
priority = 100;
+
})
+
);
};
# setup pds stuff
services.pds = {
+15 -8
hosts/wolumonde/modules/perses.nix/default.nix
···
-
{ pkgs, terra, config, ... }:
+
{
+
pkgs,
+
terra,
+
config,
+
...
+
}:
let
domain = "dash.gaze.systems";
port = 7412;
···
security = {
enable_auth = true;
authentication = {
-
providers.oidc = [{
-
slug_id = "pocketid";
-
name = "Pocket ID";
-
client_id = "aa583db6-e03c-4490-853a-7f2b3e089fbe";
-
issuer = config.services.pocket-id.settings.APP_URL;
-
scopes = ["openid profile email"];
-
}];
+
providers.oidc = [
+
{
+
slug_id = "pocketid";
+
name = "Pocket ID";
+
client_id = "aa583db6-e03c-4490-853a-7f2b3e089fbe";
+
issuer = config.services.pocket-id.settings.APP_URL;
+
scopes = [ "openid profile email" ];
+
}
+
];
disable_sign_up = true;
};
cookie = {
+1 -1
hosts/wolumonde/modules/ssh.nix
···
users.users.root.openssh.authorizedKeys.keys = [
(builtins.readFile "${inputs.self}/secrets/yusdacra.key.pub")
];
-
networking.firewall.public."ssh".allowedTCPPorts = [22];
+
networking.firewall.public."ssh".allowedTCPPorts = [ 22 ];
}
+2 -1
hosts/wolumonde/modules/tailscale.nix
···
-
{config, ...}: {
+
{ config, ... }:
+
{
age.secrets.tailscaleAuthKey.file = ../../../secrets/tailscaleAuthKey.age;
services.tailscale = {
+10 -4
hosts/wolumonde/modules/tangled.nix
···
-
{ lib, config, inputs, terra, ... }:
+
{
+
lib,
+
config,
+
inputs,
+
terra,
+
...
+
}:
let
knotCfg = config.services.tangled-knot;
spindleCfg = config.services.tangled-spindle;
···
group = "spindle";
isSystemUser = true;
};
-
users.groups.spindle = {};
-
users.groups.podman.members = ["spindle"];
+
users.groups.spindle = { };
+
users.groups.podman.members = [ "spindle" ];
systemd.services.spindle = {
-
after = lib.mkForce ["network.target"];
+
after = lib.mkForce [ "network.target" ];
serviceConfig = {
User = "spindle";
Group = "spindle";
+6 -4
hosts/wolumonde/modules/unbound.nix
···
-
{config, lib, ...}: let
+
{ config, lib, ... }:
+
let
cfg = config.services.unbound.settings;
-
in {
+
in
+
{
services.unbound = {
enable = true;
enableRootTrustAnchor = false;
···
};
};
networking.firewall = {
-
allowedTCPPorts = [cfg.server.port];
-
allowedUDPPorts = [cfg.server.port];
+
allowedTCPPorts = [ cfg.server.port ];
+
allowedUDPPorts = [ cfg.server.port ];
};
}
+2 -1
hosts/wsl/default.nix
···
../../users/firewatch
"${inputs.nixos-wsl}/modules"
"${inputs.agenix}/modules/age.nix"
-
] ++ (tlib.importFolder (toString ./modules));
+
]
+
++ (tlib.importFolder (toString ./modules));
wsl.enable = true;
wsl.defaultUser = "firewatch";
+27 -26
pkgs-set/default.nix
···
# config.permittedInsecurePackages = ["electron-25.9.0"];
};
_inputs = import ../_sources/generated.nix {
-
inherit (_pkgs) fetchgit fetchurl fetchFromGitHub dockerTools;
+
inherit (_pkgs)
+
fetchgit
+
fetchurl
+
fetchFromGitHub
+
dockerTools
+
;
};
-
inputs = (l.mapAttrs (_: inp: inp // {__toString = s: toString s.src;}) _inputs) // flakeInputs;
+
inputs = (l.mapAttrs (_: inp: inp // { __toString = s: toString s.src; }) _inputs) // flakeInputs;
pkgs = _pkgs.appendOverlays (
l.flatten (
-
l.mapAttrsToList
-
(
+
l.mapAttrsToList (
name: _:
-
if name != "disabled"
-
then
-
let
-
o = import "${./overlays}/${name}";
-
in
-
if (l.functionArgs o) ? inputs
-
then o { inherit inputs; }
-
else o
-
else
-
[]
-
)
-
(l.readDir ./overlays)
+
if name != "disabled" then
+
let
+
o = import "${./overlays}/${name}";
+
in
+
if (l.functionArgs o) ? inputs then o { inherit inputs; } else o
+
else
+
[ ]
+
) (l.readDir ./overlays)
+
)
+
);
+
terraPkgs = pkgs.lib.makeScope pkgs.newScope (
+
self:
+
l.genAttrs (l.map (l.removeSuffix ".nix") (l.attrNames (l.readDir ./pkgs))) (
+
name:
+
self.callPackage "${./pkgs}/${name}.nix" {
+
inherit inputs tlib;
+
}
)
);
-
terraPkgs =
-
pkgs.lib.makeScope pkgs.newScope (
-
self:
-
l.genAttrs
-
(l.map (l.removeSuffix ".nix") (l.attrNames (l.readDir ./pkgs)))
-
(name: self.callPackage "${./pkgs}/${name}.nix" {
-
inherit inputs tlib;
-
})
-
);
pkgsToExport = pkgs.lib.getAttrs (import ./exported.nix) (pkgs // terraPkgs);
-
in {
+
in
+
{
inherit pkgs inputs;
terra = terraPkgs;
exported = pkgsToExport;
+8 -5
pkgs-set/overlays/_lix.nix
···
-
{inputs}: final: prev:
-
(import "${inputs.lix-module}/overlay.nix" {lix = null;})
-
final (prev // {
-
lix = final.lixPackageSets.latest.lix;
-
})
+
{ inputs }:
+
final: prev:
+
(import "${inputs.lix-module}/overlay.nix" { lix = null; }) final (
+
prev
+
// {
+
lix = final.lixPackageSets.latest.lix;
+
}
+
)
+1 -1
pkgs-set/pkgs/buildGoApplication.nix
···
-
{callPackage, inputs, ...}:
+
{ callPackage, inputs, ... }:
(callPackage "${inputs.gomod2nix}/builder" {
gomod2nix = null;
}).buildGoApplication
+1 -1
pkgs-set/pkgs/headplane.nix
···
-
{callPackage, inputs, ...}: callPackage "${inputs.headplane}/nix/package.nix" {}
+
{ callPackage, inputs, ... }: callPackage "${inputs.headplane}/nix/package.nix" { }
+1 -1
pkgs-set/pkgs/nsid-tracker-server.nix
···
-
{callPackage, inputs, ...}: callPackage "${inputs.nsid-tracker}/nix/server.nix" {}
+
{ callPackage, inputs, ... }: callPackage "${inputs.nsid-tracker}/nix/server.nix" { }
+12 -10
pkgs-set/pkgs/tangled-knot.nix
···
...
}:
let
-
unwrapped = (callPackage "${inputs.tangled}/nix/pkgs/knot-unwrapped.nix" {
-
modules = tangled-modules;
-
sqlite-lib = tangled-sqlite-lib;
-
gitignoreSource = null;
-
}).overrideAttrs (_: {
-
src = inputs.tangled;
-
});
+
unwrapped =
+
(callPackage "${inputs.tangled}/nix/pkgs/knot-unwrapped.nix" {
+
modules = tangled-modules;
+
sqlite-lib = tangled-sqlite-lib;
+
gitignoreSource = null;
+
}).overrideAttrs
+
(_: {
+
src = inputs.tangled;
+
});
in
-
callPackage "${inputs.tangled}/nix/pkgs/knot.nix" {
-
knot-unwrapped = unwrapped;
-
}
+
callPackage "${inputs.tangled}/nix/pkgs/knot.nix" {
+
knot-unwrapped = unwrapped;
+
}
+1 -1
pkgs-set/pkgs/tangled-modules.nix
···
-
{inputs, ...}: "${inputs.tangled}/nix/gomod2nix.toml"
+
{ inputs, ... }: "${inputs.tangled}/nix/gomod2nix.toml"
+4 -3
pkgs-set/pkgs/tangled-spindle.nix
···
modules = tangled-modules;
sqlite-lib = tangled-sqlite-lib;
gitignoreSource = null;
-
}).overrideAttrs (_: {
-
src = inputs.tangled;
-
})
+
}).overrideAttrs
+
(_: {
+
src = inputs.tangled;
+
})
+1 -1
pkgs-set/pkgs/tangled-sqlite-lib.nix
···
-
{callPackage, inputs, ...}:
+
{ callPackage, inputs, ... }:
callPackage "${inputs.tangled}/nix/pkgs/sqlite-lib.nix" {
sqlite-lib-src = inputs.tangled-sqlite-lib;
}
+3 -5
shells/default.nix
···
allPkgsSets,
...
}:
-
lib.mapAttrs
-
(
+
lib.mapAttrs (
system: set:
let
inherit (set) pkgs;
-
agenix = pkgs.callPackage "${set.inputs.agenix}/pkgs/agenix.nix" {};
+
agenix = pkgs.callPackage "${set.inputs.agenix}/pkgs/agenix.nix" { };
agenix-wrapped = pkgs.writeShellApplication {
name = "agenix";
runtimeInputs = [ agenix ];
···
'';
};
}
-
)
-
allPkgsSets
+
) allPkgsSets
+2 -2
users/dusk@devel.mobi/default.nix
···
PATH = "${pkgs.coreutils-full}/bin:$PATH";
};
-
age.identityPaths = ["${config.home.homeDirectory}/.ssh/id_ed25519"];
+
age.identityPaths = [ "${config.home.homeDirectory}/.ssh/id_ed25519" ];
home = {
homeDirectory = "/home/dusk";
username = "dusk";
···
enable = true;
controlServer = "https://vpn.gaze.systems";
authKeyFile = config.age.secrets.tailscaleAuthKey.path;
-
extraUpFlags = ["--hostname=dusk-devel-mobi"];
+
extraUpFlags = [ "--hostname=dusk-devel-mobi" ];
};
programs = {
+1 -1
users/dusk@devel.mobi/nsid-tracker.nix
···
};
Service = {
-
ExecStartPre="${pkgs.coreutils-full}/bin/mkdir -p %D/nsid-tracker";
+
ExecStartPre = "${pkgs.coreutils-full}/bin/mkdir -p %D/nsid-tracker";
ExecStart = "${pkgs.dash}/bin/dash -c 'cd %D/nsid-tracker && ${server}/bin/server'";
Restart = "on-failure";
RestartSec = 5;
+13 -3
users/modules/netbird/default.nix
···
-
{lib, config, pkgs, ...}: let
+
{
+
lib,
+
config,
+
pkgs,
+
...
+
}:
+
let
l = lib;
t = l.types;
cfg = config.services.netbird;
···
wrappedProxychains = pkgs.writers.writeBashBin "netbird-proxychains" ''
${pkgs.proxychains-ng}/bin/proxychains4 -f "${proxychainsCfg}" $@
'';
-
in {
+
in
+
{
options = {
services.netbird = {
enable = l.mkEnableOption "netbird client";
···
};
};
config = l.mkIf cfg.enable {
-
home.packages = [ wrapped wrappedProxychains ];
+
home.packages = [
+
wrapped
+
wrappedProxychains
+
];
services.netbird.proxyScript = wrappedProxychains;
systemd.user.services.netbird = {
Unit = {
+2 -1
users/modules/nushell/default.nix
···
-
{pkgs, lib, ...}: {
+
{ pkgs, lib, ... }:
+
{
programs.carapace.enable = true;
programs.carapace.enableNushellIntegration = true;
programs.nushell = {
+16 -5
users/modules/tailscale/default.nix
···
-
{lib, config, pkgs, ...}: let
+
{
+
lib,
+
config,
+
pkgs,
+
...
+
}:
+
let
l = lib;
t = l.types;
cfg = config.services.tailscale;
···
wrapped = pkgs.writers.writeBashBin "tailscale" ''
${pkgs.tailscale}/bin/tailscale --socket $XDG_RUNTIME_DIR/tailscaled.sock $@
'';
-
in {
+
in
+
{
options = {
services.tailscale = {
enable = l.mkEnableOption "tailscale client";
···
};
extraUpFlags = l.mkOption {
type = t.listOf t.str;
-
default = [];
+
default = [ ];
description = "Extra flags to pass to tailscale up";
};
proxyScript = l.mkOption {
···
};
};
config = l.mkIf cfg.enable {
-
home.packages = [ wrapped wrappedProxychains ];
+
home.packages = [
+
wrapped
+
wrappedProxychains
+
];
services.tailscale.proxyScript = wrappedProxychains;
systemd.user.services.tailscaled = {
Unit = {
···
ExecStart = "${pkgs.tailscale}/bin/tailscaled --tun=userspace-networking --socks5-server=localhost:1055 --outbound-http-proxy-listen=localhost:1055 --socket %t/tailscaled.sock";
Restart = "on-failure";
RestartSec = "5s";
-
} // l.optionalAttrs (cfg.authKeyFile != null) {
+
}
+
// l.optionalAttrs (cfg.authKeyFile != null) {
ExecStartPost = "${wrapped}/bin/tailscale up --reset --login-server=${cfg.controlServer} --auth-key=file:${cfg.authKeyFile} ${l.concatStringsSep " " cfg.extraUpFlags}";
};
+2 -2
users/root/default.nix
···
{ pkgs, ... }:
{
users.users.root.initialHashedPassword = "$6$XLWo1sPpgp63Zm$XHBbULH9q1gb/.yalPPU/I7EgTcW80bM.moCjIe/qGyOwE47VcXNVbTHloBZdIWQq0MfIG0IxInAu59.oJyos/";
-
environment.systemPackages = [pkgs.nushell];
+
environment.systemPackages = [ pkgs.nushell ];
users.users.root.shell = pkgs.nushell;
home-manager.users.root = {
-
imports = [../modules/nushell];
+
imports = [ ../modules/nushell ];
};
}