Format project using nixfmt rfc candidate.
This commit is contained in:
parent
1f63817684
commit
a9f7fe416f
91 changed files with 1347 additions and 1000 deletions
|
@ -4,7 +4,8 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; {
|
with lib;
|
||||||
|
{
|
||||||
environment.etc = mkIf (elem "etcfiles" config.machine.conffiles) {
|
environment.etc = mkIf (elem "etcfiles" config.machine.conffiles) {
|
||||||
"rofi.rasi".source = import ./etc/rofi.rasi.nix { inherit pkgs; };
|
"rofi.rasi".source = import ./etc/rofi.rasi.nix { inherit pkgs; };
|
||||||
"i3/py3status".source = ./etc/i3/py3status;
|
"i3/py3status".source = ./etc/i3/py3status;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{pkgs, ...}: (pkgs.writeText "config" ''
|
{ pkgs, ... }:
|
||||||
|
(pkgs.writeText "config" ''
|
||||||
# i3 config file (v4)
|
# i3 config file (v4)
|
||||||
#
|
#
|
||||||
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
|
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
{pkgs}: let
|
{ pkgs }:
|
||||||
tabMode = pkgs.writeScript "tab-finder.sh" (with pkgs; /* bash */ ''
|
let
|
||||||
|
tabMode = pkgs.writeScript "tab-finder.sh" (
|
||||||
|
with pkgs; # bash
|
||||||
|
''
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
if [ -z ''${1} ]; then
|
if [ -z ''${1} ]; then
|
||||||
${brotab}/bin/bt list;
|
${brotab}/bin/bt list;
|
||||||
|
@ -12,7 +15,8 @@
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
exit 0;
|
exit 0;
|
||||||
'');
|
''
|
||||||
|
);
|
||||||
in
|
in
|
||||||
pkgs.writeText "rofi.rasi" ''
|
pkgs.writeText "rofi.rasi" ''
|
||||||
configuration {
|
configuration {
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
# TODO/FIX: pkgs.sway-unwrapped is not the same sway derivation as the one running the desktop
|
# TODO/FIX: pkgs.sway-unwrapped is not the same sway derivation as the one running the desktop
|
||||||
grim-wrapper = pkgs.writeShellScript "grim-wrapper" /* bash */ ''
|
grim-wrapper =
|
||||||
|
pkgs.writeShellScript "grim-wrapper" # bash
|
||||||
|
''
|
||||||
OUTPUT_DIR="$(${pkgs.xdg-user-dirs}/bin/xdg-user-dir PICTURES)"
|
OUTPUT_DIR="$(${pkgs.xdg-user-dirs}/bin/xdg-user-dir PICTURES)"
|
||||||
DATE="$(${pkgs.coreutils}/bin/date +'%Y-%m-%d;%H:%M:%S;')";
|
DATE="$(${pkgs.coreutils}/bin/date +'%Y-%m-%d;%H:%M:%S;')";
|
||||||
WINDOW_LIST="$(${pkgs.sway-unwrapped}/bin/swaymsg -t get_tree | ${pkgs.jq}/bin/jq -r '.. | select(.pid? and .visible?) | "\(.rect.x+.window_rect.x),\(.rect.y+.window_rect.y) \(.window_rect.width)x\(.window_rect.height) \(.app_id):\(.name)"' | ${pkgs.coreutils}/bin/tr -d '"/;\\')";
|
WINDOW_LIST="$(${pkgs.sway-unwrapped}/bin/swaymsg -t get_tree | ${pkgs.jq}/bin/jq -r '.. | select(.pid? and .visible?) | "\(.rect.x+.window_rect.x),\(.rect.y+.window_rect.y) \(.window_rect.width)x\(.window_rect.height) \(.app_id):\(.name)"' | ${pkgs.coreutils}/bin/tr -d '"/;\\')";
|
||||||
|
@ -29,8 +31,8 @@ let
|
||||||
;;
|
;;
|
||||||
esac;
|
esac;
|
||||||
'';
|
'';
|
||||||
in pkgs.writeText "config"
|
in
|
||||||
''
|
pkgs.writeText "config" ''
|
||||||
include /etc/sway/config.d/*
|
include /etc/sway/config.d/*
|
||||||
|
|
||||||
# Read `man 5 sway` for a complete reference.
|
# Read `man 5 sway` for a complete reference.
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
console.keyMap = "de";
|
console.keyMap = "de";
|
||||||
i18n = {
|
i18n = {
|
||||||
defaultLocale = "en_US.UTF-8";
|
defaultLocale = "en_US.UTF-8";
|
||||||
|
@ -13,7 +14,11 @@
|
||||||
type = "fcitx5";
|
type = "fcitx5";
|
||||||
fcitx5 = {
|
fcitx5 = {
|
||||||
waylandFrontend = true;
|
waylandFrontend = true;
|
||||||
addons = with pkgs; [fcitx5-chinese-addons fcitx5-mozc fcitx5-table-extra];
|
addons = with pkgs; [
|
||||||
|
fcitx5-chinese-addons
|
||||||
|
fcitx5-mozc
|
||||||
|
fcitx5-table-extra
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib;
|
||||||
|
let
|
||||||
inherit (config.machine) networkD;
|
inherit (config.machine) networkD;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
networking = {
|
networking = {
|
||||||
inherit (config.machine) hostName;
|
inherit (config.machine) hostName;
|
||||||
useNetworkd = networkD.enable;
|
useNetworkd = networkD.enable;
|
||||||
|
@ -16,14 +18,19 @@ in {
|
||||||
# https://github.com/NixOS/nixpkgs/issues/10001#issuecomment-905532069
|
# https://github.com/NixOS/nixpkgs/issues/10001#issuecomment-905532069
|
||||||
systemd.network = mkIf networkD.enable {
|
systemd.network = mkIf networkD.enable {
|
||||||
enable = true;
|
enable = true;
|
||||||
networks = let
|
networks =
|
||||||
|
let
|
||||||
networkConfig = {
|
networkConfig = {
|
||||||
DHCP = "yes";
|
DHCP = "yes";
|
||||||
DNSSEC = "yes";
|
DNSSEC = "yes";
|
||||||
DNSOverTLS = "yes";
|
DNSOverTLS = "yes";
|
||||||
DNS = ["1.1.1.1" "1.0.0.1"];
|
DNS = [
|
||||||
|
"1.1.1.1"
|
||||||
|
"1.0.0.1"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
"40-wired" = {
|
"40-wired" = {
|
||||||
enable = true;
|
enable = true;
|
||||||
name = "en*";
|
name = "en*";
|
||||||
|
|
|
@ -6,10 +6,12 @@
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
cfg = config.machine;
|
cfg = config.machine;
|
||||||
emptyGlobalRegistry = pkgs.writeText "registry.json" ''{ "flakes": [], "version": 2 }'';
|
emptyGlobalRegistry = pkgs.writeText "registry.json" ''{ "flakes": [], "version": 2 }'';
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
nix = {
|
nix = {
|
||||||
package = pkgs.nix;
|
package = pkgs.nix;
|
||||||
registry = {
|
registry = {
|
||||||
|
@ -22,18 +24,14 @@ in {
|
||||||
cores = 1;
|
cores = 1;
|
||||||
sandbox = true;
|
sandbox = true;
|
||||||
auto-optimise-store = true;
|
auto-optimise-store = true;
|
||||||
trusted-substituters =
|
trusted-substituters = [
|
||||||
[
|
|
||||||
"https://cache.nixos.org"
|
"https://cache.nixos.org"
|
||||||
]
|
] ++ cfg.binaryCaches;
|
||||||
++ cfg.binaryCaches;
|
|
||||||
# TODO: integrate into sops
|
# TODO: integrate into sops
|
||||||
# trusted-public-keys = [ (lib.fileContents "${cfg.secretPath}/hydra_cache.pub") ];
|
# trusted-public-keys = [ (lib.fileContents "${cfg.secretPath}/hydra_cache.pub") ];
|
||||||
substituters =
|
substituters = [
|
||||||
[
|
|
||||||
"https://cache.nixos.org"
|
"https://cache.nixos.org"
|
||||||
]
|
] ++ cfg.binaryCaches;
|
||||||
++ cfg.binaryCaches;
|
|
||||||
allowed-users = [ "root" ] ++ (map (n: n.name) cfg.administrators);
|
allowed-users = [ "root" ] ++ (map (n: n.name) cfg.administrators);
|
||||||
};
|
};
|
||||||
extraOptions = ''
|
extraOptions = ''
|
||||||
|
|
|
@ -5,15 +5,18 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib;
|
||||||
|
let
|
||||||
withDocker = config.virtualisation.docker.enable;
|
withDocker = config.virtualisation.docker.enable;
|
||||||
withPodman = config.virtualisation.podman.enable;
|
withPodman = config.virtualisation.podman.enable;
|
||||||
administrators = user: {
|
administrators = user: {
|
||||||
inherit (user) name;
|
inherit (user) name;
|
||||||
value = let
|
value =
|
||||||
|
let
|
||||||
cfg = config.services;
|
cfg = config.services;
|
||||||
passPath = config.sops.secrets."users/${user.name}/password".path;
|
passPath = config.sops.secrets."users/${user.name}/password".path;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
inherit (user) name;
|
inherit (user) name;
|
||||||
uid = user.id;
|
uid = user.id;
|
||||||
|
@ -30,9 +33,19 @@ with lib; let
|
||||||
description = "Administrative user ${user.name}.";
|
description = "Administrative user ${user.name}.";
|
||||||
group = user.name;
|
group = user.name;
|
||||||
extraGroups =
|
extraGroups =
|
||||||
["audio" "wheel" "network"]
|
[
|
||||||
++ (optionals (lib.elem "desktop" config.machine.services) ["input" "video"])
|
"audio"
|
||||||
++ (optionals cfg.printing.enable ["cups" "lp"])
|
"wheel"
|
||||||
|
"network"
|
||||||
|
]
|
||||||
|
++ (optionals (lib.elem "desktop" config.machine.services) [
|
||||||
|
"input"
|
||||||
|
"video"
|
||||||
|
])
|
||||||
|
++ (optionals cfg.printing.enable [
|
||||||
|
"cups"
|
||||||
|
"lp"
|
||||||
|
])
|
||||||
++ (optional (withDocker && !withPodman) "docker")
|
++ (optional (withDocker && !withPodman) "docker")
|
||||||
++ (optional withPodman "podman");
|
++ (optional withPodman "podman");
|
||||||
shell = "${pkgs.zsh}/bin/zsh";
|
shell = "${pkgs.zsh}/bin/zsh";
|
||||||
|
@ -48,12 +61,11 @@ with lib; let
|
||||||
members = [ user.name ];
|
members = [ user.name ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
sops.secrets =
|
{
|
||||||
fn.sopsHelper
|
sops.secrets = fn.sopsHelper (user: "users/${user.name}/password") config.machine.administrators {
|
||||||
(user: "users/${user.name}/password")
|
neededForUsers = true;
|
||||||
config.machine.administrators
|
};
|
||||||
{neededForUsers = true;};
|
|
||||||
users = {
|
users = {
|
||||||
mutableUsers = false;
|
mutableUsers = false;
|
||||||
users = listToAttrs (map administrators config.machine.administrators);
|
users = listToAttrs (map administrators config.machine.administrators);
|
||||||
|
|
|
@ -31,7 +31,16 @@ with lib;
|
||||||
|
|
||||||
ohMyZsh = {
|
ohMyZsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
plugins = ["cabal" "docker" "gitfast" "python" "pip" "sudo" "systemd" "man"];
|
plugins = [
|
||||||
|
"cabal"
|
||||||
|
"docker"
|
||||||
|
"gitfast"
|
||||||
|
"python"
|
||||||
|
"pip"
|
||||||
|
"sudo"
|
||||||
|
"systemd"
|
||||||
|
"man"
|
||||||
|
];
|
||||||
theme = "gentoo";
|
theme = "gentoo";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
44
flake.nix
44
flake.nix
|
@ -18,7 +18,8 @@
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
outputs = {
|
outputs =
|
||||||
|
{
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
flake-utils,
|
flake-utils,
|
||||||
|
@ -28,7 +29,8 @@
|
||||||
...
|
...
|
||||||
}@attrs:
|
}@attrs:
|
||||||
flake-utils.lib.eachDefaultSystem (
|
flake-utils.lib.eachDefaultSystem (
|
||||||
system: let
|
system:
|
||||||
|
let
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
fn = import ./fn.nix { inherit lib; };
|
fn = import ./fn.nix { inherit lib; };
|
||||||
pkgs = nixpkgs.legacyPackages."${system}";
|
pkgs = nixpkgs.legacyPackages."${system}";
|
||||||
|
@ -39,7 +41,8 @@
|
||||||
};
|
};
|
||||||
nixosSystemFor = machine: {
|
nixosSystemFor = machine: {
|
||||||
name = machine;
|
name = machine;
|
||||||
value = let
|
value =
|
||||||
|
let
|
||||||
configFiles = fn.lst {
|
configFiles = fn.lst {
|
||||||
p = toString ./config;
|
p = toString ./config;
|
||||||
b = true;
|
b = true;
|
||||||
|
@ -52,33 +55,38 @@
|
||||||
p = toString ./services;
|
p = toString ./services;
|
||||||
b = true;
|
b = true;
|
||||||
};
|
};
|
||||||
machinePath = lib.concatStringsSep "/" [(toString ./.) "machines" machine];
|
machinePath = lib.concatStringsSep "/" [
|
||||||
machineFiles = lib.filter (lib.strings.hasSuffix ".nix") (fn.lst {
|
(toString ./.)
|
||||||
|
"machines"
|
||||||
|
machine
|
||||||
|
];
|
||||||
|
machineFiles = lib.filter (lib.strings.hasSuffix ".nix") (
|
||||||
|
fn.lst {
|
||||||
p = machinePath;
|
p = machinePath;
|
||||||
b = true;
|
b = true;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
in
|
in
|
||||||
nixpkgs.lib.nixosSystem {
|
nixpkgs.lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
specialArgs =
|
specialArgs = attrs // {
|
||||||
attrs
|
|
||||||
// {
|
|
||||||
inherit system;
|
inherit system;
|
||||||
inherit fn;
|
inherit fn;
|
||||||
};
|
};
|
||||||
modules =
|
modules = [
|
||||||
[
|
(
|
||||||
({config, ...}: {config.nixpkgs.overlays = [nixpkgs-wayland.overlay];})
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
config.nixpkgs.overlays = [ nixpkgs-wayland.overlay ];
|
||||||
|
}
|
||||||
|
)
|
||||||
(toString ./options/machine.nix)
|
(toString ./options/machine.nix)
|
||||||
sops-nix.nixosModules.sops
|
sops-nix.nixosModules.sops
|
||||||
]
|
] ++ machineFiles ++ configFiles ++ pkgsFiles ++ serviceFiles;
|
||||||
++ machineFiles
|
|
||||||
++ configFiles
|
|
||||||
++ pkgsFiles
|
|
||||||
++ serviceFiles;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
apps = {
|
apps = {
|
||||||
"lint" = {
|
"lint" = {
|
||||||
type = "app";
|
type = "app";
|
||||||
|
|
145
fn.nix
145
fn.nix
|
@ -1,73 +1,82 @@
|
||||||
{ lib }:
|
{ lib }:
|
||||||
with builtins;
|
with builtins;
|
||||||
with lib; rec {
|
with lib;
|
||||||
ifelse = a: b: c:
|
rec {
|
||||||
if a
|
ifelse =
|
||||||
then b
|
a: b: c:
|
||||||
else c;
|
if a then b else c;
|
||||||
fileContentsOr = a: b: (ifelse
|
fileContentsOr = a: b: (ifelse (pathIsRegularFile a) a b);
|
||||||
(pathIsRegularFile a)
|
|
||||||
a
|
|
||||||
b);
|
|
||||||
cwd = builtins.getEnv "PWD";
|
cwd = builtins.getEnv "PWD";
|
||||||
|
|
||||||
# lst (string PATH) (string FILETYPE) (bool RETURNFULLPATH)
|
# lst (string PATH) (string FILETYPE) (bool RETURNFULLPATH)
|
||||||
lst = {
|
lst =
|
||||||
|
{
|
||||||
p ? cwd,
|
p ? cwd,
|
||||||
t ? "regular",
|
t ? "regular",
|
||||||
b ? false,
|
b ? false,
|
||||||
}: (lists.forEach
|
}:
|
||||||
(attrNames
|
(lists.forEach (attrNames (filterAttrs (n: v: v == t) (readDir p))) (
|
||||||
(filterAttrs (n: v: v == t)
|
v: ((optionalString b "${p}/") + v)
|
||||||
(readDir p)))
|
));
|
||||||
(v: ((optionalString b "${p}/") + v)));
|
|
||||||
lsf = p: (lst { inherit p; });
|
lsf = p: (lst { inherit p; });
|
||||||
lsd = p: (lst {
|
lsd =
|
||||||
|
p:
|
||||||
|
(lst {
|
||||||
inherit p;
|
inherit p;
|
||||||
t = "directory";
|
t = "directory";
|
||||||
b = true;
|
b = true;
|
||||||
});
|
});
|
||||||
lsfRec = p: b:
|
lsfRec =
|
||||||
flatten ((map (np: lsfRec np b) (lsd p))
|
p: b:
|
||||||
|
flatten (
|
||||||
|
(map (np: lsfRec np b) (lsd p))
|
||||||
++ (lst {
|
++ (lst {
|
||||||
inherit p;
|
inherit p;
|
||||||
inherit b;
|
inherit b;
|
||||||
}));
|
})
|
||||||
hasAttrs = aList: d: (map
|
);
|
||||||
(a: (ifelse (isList a)
|
hasAttrs = aList: d: (map (a: (ifelse (isList a) (hasAttrByPath a d) (hasAttr a d))) aList);
|
||||||
(hasAttrByPath a d)
|
|
||||||
(hasAttr a d)))
|
|
||||||
aList);
|
|
||||||
|
|
||||||
# Not sure how list operations are implemented in Nix
|
# Not sure how list operations are implemented in Nix
|
||||||
# This might be a tad bit inefficient.
|
# This might be a tad bit inefficient.
|
||||||
# TODO: look for better implementation (map is a builtin function so checking that probably won't help)
|
# TODO: look for better implementation (map is a builtin function so checking that probably won't help)
|
||||||
# Sequentially checks elements of list (l) for condition (cond) and executes do on first match.
|
# Sequentially checks elements of list (l) for condition (cond) and executes do on first match.
|
||||||
meetsConDo = cond: do: l:
|
meetsConDo =
|
||||||
ifelse (l == []) false
|
cond: do: l:
|
||||||
(let
|
ifelse (l == [ ]) false (
|
||||||
|
let
|
||||||
h = head l;
|
h = head l;
|
||||||
t = tail l;
|
t = tail l;
|
||||||
in
|
in
|
||||||
ifelse (cond h) (do h)
|
ifelse (cond h) (do h) (meetsConDo cond do t)
|
||||||
(meetsConDo cond do t));
|
);
|
||||||
deps = p:
|
deps =
|
||||||
ifelse (isAttrs p) (
|
p:
|
||||||
filter isAttrs
|
ifelse (isAttrs p) (filter isAttrs (
|
||||||
(p.buildInputs ++ p.nativeBuildInputs ++ p.propagatedBuildInputs ++ p.propagatedNativeBuildInputs)
|
p.buildInputs ++ p.nativeBuildInputs ++ p.propagatedBuildInputs ++ p.propagatedNativeBuildInputs
|
||||||
) [];
|
)) [ ];
|
||||||
importFilter = l: filter (n: elem (nameFromURL (toString n) ".") l);
|
importFilter = l: filter (n: elem (nameFromURL (toString n) ".") l);
|
||||||
depsRec = ld: ifelse (ld == []) [] ((toList ld) ++ (depsRec (lists.unique (lists.flatten (map deps (toList ld))))));
|
depsRec =
|
||||||
isBroken = p:
|
ld:
|
||||||
meetsConDo (s: ((hasAttrByPath s.path p) && (s.check (getAttrFromPath s.path p)))) (s: s.msg)
|
ifelse (ld == [ ]) [ ] (
|
||||||
[
|
(toList ld) ++ (depsRec (lists.unique (lists.flatten (map deps (toList ld)))))
|
||||||
|
);
|
||||||
|
isBroken =
|
||||||
|
p:
|
||||||
|
meetsConDo (s: ((hasAttrByPath s.path p) && (s.check (getAttrFromPath s.path p)))) (s: s.msg) [
|
||||||
{
|
{
|
||||||
path = ["meta" "broken"];
|
path = [
|
||||||
|
"meta"
|
||||||
|
"broken"
|
||||||
|
];
|
||||||
msg = warn "Package ${p.name} is marked as broken." true;
|
msg = warn "Package ${p.name} is marked as broken." true;
|
||||||
check = m: m;
|
check = m: m;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
path = ["meta" "knownVulnerabilities"];
|
path = [
|
||||||
|
"meta"
|
||||||
|
"knownVulnerabilities"
|
||||||
|
];
|
||||||
msg = warn "Package ${p.name} has known Vulnerabilities.." true;
|
msg = warn "Package ${p.name} has known Vulnerabilities.." true;
|
||||||
check = m: m != [ ];
|
check = m: m != [ ];
|
||||||
}
|
}
|
||||||
|
@ -87,35 +96,45 @@ with lib; rec {
|
||||||
depsBroken = p: lists.any (p: (isBroken p)) (deps p);
|
depsBroken = p: lists.any (p: (isBroken p)) (deps p);
|
||||||
# No more magic 🧙 here 😢
|
# No more magic 🧙 here 😢
|
||||||
# But at least it now (hopefully) checks ONLY dependencies (and all of them at that).
|
# But at least it now (hopefully) checks ONLY dependencies (and all of them at that).
|
||||||
depsBrokenRec = p: (
|
depsBrokenRec =
|
||||||
meetsConDo
|
p: (meetsConDo (p: ifelse (depsBroken p) true (depsBrokenRec (deps p))) (p: true) (deps p));
|
||||||
(p: ifelse (depsBroken p) true (depsBrokenRec (deps p)))
|
sopsHelper =
|
||||||
(p: true) (deps p)
|
template: names: options:
|
||||||
);
|
let
|
||||||
sopsHelper = template: names: options: let
|
|
||||||
optionsIsFunction = (typeOf options) == "lambda";
|
optionsIsFunction = (typeOf options) == "lambda";
|
||||||
in
|
in
|
||||||
listToAttrs (map
|
listToAttrs (
|
||||||
(name: {
|
map (name: {
|
||||||
name = template name;
|
name = template name;
|
||||||
value = ifelse optionsIsFunction (options name) options;
|
value = ifelse optionsIsFunction (options name) options;
|
||||||
})
|
}) names
|
||||||
names);
|
);
|
||||||
pkgFilter = ld: (filter
|
pkgFilter =
|
||||||
(p: (
|
ld:
|
||||||
ifelse (isBroken p)
|
(filter (
|
||||||
false
|
p:
|
||||||
(ifelse (depsBrokenRec p)
|
(ifelse (isBroken p) false (
|
||||||
(warn "Dependency of ${p.name} is marked as broken." false)
|
ifelse (depsBrokenRec p) (warn "Dependency of ${p.name} is marked as broken." false) true
|
||||||
true)
|
|
||||||
))
|
))
|
||||||
ld);
|
) ld);
|
||||||
makeOptionTypeList = path: (
|
makeOptionTypeList =
|
||||||
lists.forEach
|
path:
|
||||||
|
(lists.forEach
|
||||||
# get a list of all files ending in .nix in path
|
# get a list of all files ending in .nix in path
|
||||||
(filter (hasSuffix ".nix")
|
(filter (hasSuffix ".nix") (lsfRec path true))
|
||||||
(lsfRec path true))
|
|
||||||
# remove leading path and trailing ".nix", replace every slash with "::"
|
# remove leading path and trailing ".nix", replace every slash with "::"
|
||||||
(replaceStrings ["${path}/" "/" ".nix"] ["" "::" ""])
|
(
|
||||||
|
replaceStrings
|
||||||
|
[
|
||||||
|
"${path}/"
|
||||||
|
"/"
|
||||||
|
".nix"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
""
|
||||||
|
"::"
|
||||||
|
""
|
||||||
|
]
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
services.cron.enable = false;
|
services.cron.enable = false;
|
||||||
|
|
||||||
networking.dhcpcd.extraConfig = "noarp";
|
networking.dhcpcd.extraConfig = "noarp";
|
||||||
|
@ -64,7 +65,12 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
boot = {
|
boot = {
|
||||||
kernelModules = ["snd-usb-audio" "snd-aloop" "snd-seq" "snd-rawmidi"];
|
kernelModules = [
|
||||||
|
"snd-usb-audio"
|
||||||
|
"snd-aloop"
|
||||||
|
"snd-seq"
|
||||||
|
"snd-rawmidi"
|
||||||
|
];
|
||||||
kernelParams = [ "threadirq" ];
|
kernelParams = [ "threadirq" ];
|
||||||
extraModprobeConfig = ''
|
extraModprobeConfig = ''
|
||||||
options snd-usb-audio nrpacks=1
|
options snd-usb-audio nrpacks=1
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
cfg = config.machine;
|
cfg = config.machine;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
imports = [ "${nixpkgs}/nixos/modules/installer/scan/not-detected.nix" ];
|
imports = [ "${nixpkgs}/nixos/modules/installer/scan/not-detected.nix" ];
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
|
@ -22,8 +24,18 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
kernelPackages = pkgs.linuxPackages_latest;
|
kernelPackages = pkgs.linuxPackages_latest;
|
||||||
initrd.availableKernelModules = ["xhci_pci" "ahci" "sd_mod" "rtsx_pci_sdmmc"];
|
initrd.availableKernelModules = [
|
||||||
kernelModules = ["acpi_call" "i915" "kvm-intel" "uinput"];
|
"xhci_pci"
|
||||||
|
"ahci"
|
||||||
|
"sd_mod"
|
||||||
|
"rtsx_pci_sdmmc"
|
||||||
|
];
|
||||||
|
kernelModules = [
|
||||||
|
"acpi_call"
|
||||||
|
"i915"
|
||||||
|
"kvm-intel"
|
||||||
|
"uinput"
|
||||||
|
];
|
||||||
# 5_10 breaks my touchpad/mouse buttons
|
# 5_10 breaks my touchpad/mouse buttons
|
||||||
# https://bbs.archlinux.org/viewtopic.php?id=254885
|
# https://bbs.archlinux.org/viewtopic.php?id=254885
|
||||||
# maybe modprobe hid_rmi or i2c_i801
|
# maybe modprobe hid_rmi or i2c_i801
|
||||||
|
@ -57,7 +69,9 @@ in {
|
||||||
ksm.enable = true;
|
ksm.enable = true;
|
||||||
graphics = {
|
graphics = {
|
||||||
extraPackages = with pkgs; [ (intel-vaapi-driver.override { enableHybridCodec = true; }) ];
|
extraPackages = with pkgs; [ (intel-vaapi-driver.override { enableHybridCodec = true; }) ];
|
||||||
extraPackages32 = with pkgs.pkgsi686Linux; [ (intel-vaapi-driver.override { enableHybridCodec = true; }) ];
|
extraPackages32 = with pkgs.pkgsi686Linux; [
|
||||||
|
(intel-vaapi-driver.override { enableHybridCodec = true; })
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
pulseaudio = {
|
pulseaudio = {
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; {
|
with lib;
|
||||||
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../options/copySysConf.nix
|
../../options/copySysConf.nix
|
||||||
];
|
];
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
sops = {
|
sops = {
|
||||||
defaultSopsFile = ./secrets.yaml;
|
defaultSopsFile = ./secrets.yaml;
|
||||||
age = {
|
age = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{pkgs, ...}: {
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
services.cron.enable = false;
|
services.cron.enable = false;
|
||||||
security.pki.certificateFiles = [
|
security.pki.certificateFiles = [
|
||||||
./certs/proxy
|
./certs/proxy
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
modulesPath,
|
modulesPath,
|
||||||
...
|
...
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
cfg = config.machine;
|
cfg = config.machine;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
|
@ -19,7 +21,13 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
kernelPackages = pkgs.linuxPackages_latest;
|
kernelPackages = pkgs.linuxPackages_latest;
|
||||||
initrd.availableKernelModules = ["nvme" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"];
|
initrd.availableKernelModules = [
|
||||||
|
"nvme"
|
||||||
|
"xhci_pci"
|
||||||
|
"usb_storage"
|
||||||
|
"sd_mod"
|
||||||
|
"rtsx_pci_sdmmc"
|
||||||
|
];
|
||||||
kernelModules = [ "kvm-amd" ];
|
kernelModules = [ "kvm-amd" ];
|
||||||
kernelParams = [
|
kernelParams = [
|
||||||
# get backlight service to work part one (fixes systemd backlight service)
|
# get backlight service to work part one (fixes systemd backlight service)
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; {
|
with lib;
|
||||||
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../options/copySysConf.nix
|
../../options/copySysConf.nix
|
||||||
];
|
];
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
sops = {
|
sops = {
|
||||||
defaultSopsFile = ./secrets.yaml;
|
defaultSopsFile = ./secrets.yaml;
|
||||||
age = {
|
age = {
|
||||||
|
|
|
@ -2,13 +2,20 @@
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
imports = [
|
imports = [
|
||||||
"${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
|
"${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
|
||||||
];
|
];
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "sd_mod" "sr_mod"];
|
initrd.availableKernelModules = [
|
||||||
|
"ata_piix"
|
||||||
|
"uhci_hcd"
|
||||||
|
"virtio_pci"
|
||||||
|
"sd_mod"
|
||||||
|
"sr_mod"
|
||||||
|
];
|
||||||
kernelPackages = pkgs.linuxPackages_latest;
|
kernelPackages = pkgs.linuxPackages_latest;
|
||||||
kernelModules = [ ];
|
kernelModules = [ ];
|
||||||
extraModulePackages = [ ];
|
extraModulePackages = [ ];
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib;
|
||||||
|
let
|
||||||
cfg = config.machine;
|
cfg = config.machine;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
config.machine = rec {
|
config.machine = rec {
|
||||||
hostName = "Ophanim";
|
hostName = "Ophanim";
|
||||||
domain = "ophanim.de";
|
domain = "ophanim.de";
|
||||||
|
@ -18,7 +20,10 @@ in {
|
||||||
mailAccounts = [
|
mailAccounts = [
|
||||||
{
|
{
|
||||||
name = "derped";
|
name = "derped";
|
||||||
aliases = ["postmaster" "baensch"];
|
aliases = [
|
||||||
|
"postmaster"
|
||||||
|
"baensch"
|
||||||
|
];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
allowUnfree = true;
|
allowUnfree = true;
|
||||||
|
@ -42,9 +47,11 @@ in {
|
||||||
"nginx"
|
"nginx"
|
||||||
"openssh"
|
"openssh"
|
||||||
];
|
];
|
||||||
vHosts = let
|
vHosts =
|
||||||
|
let
|
||||||
base = domain;
|
base = domain;
|
||||||
in [
|
in
|
||||||
|
[
|
||||||
{
|
{
|
||||||
domain = base;
|
domain = base;
|
||||||
service = "simple";
|
service = "simple";
|
||||||
|
@ -71,8 +78,17 @@ in {
|
||||||
firewall = {
|
firewall = {
|
||||||
enable = true;
|
enable = true;
|
||||||
allowPing = false;
|
allowPing = false;
|
||||||
allowedUDPPorts = [22 80 443 7776];
|
allowedUDPPorts = [
|
||||||
allowedTCPPorts = [80 443 7776];
|
22
|
||||||
|
80
|
||||||
|
443
|
||||||
|
7776
|
||||||
|
];
|
||||||
|
allowedTCPPorts = [
|
||||||
|
80
|
||||||
|
443
|
||||||
|
7776
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
sops = {
|
sops = {
|
||||||
defaultSopsFile = ./secrets.yaml;
|
defaultSopsFile = ./secrets.yaml;
|
||||||
age = {
|
age = {
|
||||||
|
|
|
@ -18,7 +18,11 @@
|
||||||
};
|
};
|
||||||
fileSystems."/home/august/Videos" = {
|
fileSystems."/home/august/Videos" = {
|
||||||
device = "/mnt/WD/Videos/Movies/";
|
device = "/mnt/WD/Videos/Movies/";
|
||||||
options = [ "nofail" "bind" "x-systemd.automount" ];
|
options = [
|
||||||
|
"nofail"
|
||||||
|
"bind"
|
||||||
|
"x-systemd.automount"
|
||||||
|
];
|
||||||
neededForBoot = false;
|
neededForBoot = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{...}: {
|
{ ... }:
|
||||||
|
{
|
||||||
services = {
|
services = {
|
||||||
avahi = {
|
avahi = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -13,12 +14,14 @@
|
||||||
};
|
};
|
||||||
# udp5353 1024-65535
|
# udp5353 1024-65535
|
||||||
|
|
||||||
networking.firewall = let
|
networking.firewall =
|
||||||
|
let
|
||||||
range = {
|
range = {
|
||||||
from = 1024;
|
from = 1024;
|
||||||
to = 65535;
|
to = 65535;
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
allowedUDPPorts = [ 5353 ];
|
allowedUDPPorts = [ 5353 ];
|
||||||
allowedUDPPortRanges = [ range ];
|
allowedUDPPortRanges = [ range ];
|
||||||
allowedTCPPortRanges = [ range ];
|
allowedTCPPortRanges = [ range ];
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
{nixos-hardware, ...}: {
|
{ nixos-hardware, ... }:
|
||||||
|
{
|
||||||
imports = [
|
imports = [
|
||||||
nixos-hardware.nixosModules.raspberry-pi-5
|
nixos-hardware.nixosModules.raspberry-pi-5
|
||||||
];
|
];
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
kernelParams = [ "8250.nr_uarts=11" "console=ttyAMA10,9600" "console=tty0" ];
|
kernelParams = [
|
||||||
|
"8250.nr_uarts=11"
|
||||||
|
"console=ttyAMA10,9600"
|
||||||
|
"console=tty0"
|
||||||
|
];
|
||||||
supportedFilesystems = [ "btrfs" ];
|
supportedFilesystems = [ "btrfs" ];
|
||||||
initrd.systemd.enableTpm2 = false;
|
initrd.systemd.enableTpm2 = false;
|
||||||
loader.systemd-boot.enable = true;
|
loader.systemd-boot.enable = true;
|
||||||
|
@ -14,7 +19,12 @@
|
||||||
"/" = {
|
"/" = {
|
||||||
device = "none";
|
device = "none";
|
||||||
fsType = "tmpfs";
|
fsType = "tmpfs";
|
||||||
options = ["defaults" "size=2G" "mode=755" "noexec"];
|
options = [
|
||||||
|
"defaults"
|
||||||
|
"size=2G"
|
||||||
|
"mode=755"
|
||||||
|
"noexec"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
"/boot" = {
|
"/boot" = {
|
||||||
device = "/dev/disk/by-uuid/F8BB-8019";
|
device = "/dev/disk/by-uuid/F8BB-8019";
|
||||||
|
@ -23,25 +33,40 @@
|
||||||
"/nix" = {
|
"/nix" = {
|
||||||
device = "/dev/disk/by-uuid/7741fa2e-ce5d-4aef-bf3c-8e283e973409";
|
device = "/dev/disk/by-uuid/7741fa2e-ce5d-4aef-bf3c-8e283e973409";
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
options = ["subvol=nix" "compress=zstd" "noatime"];
|
options = [
|
||||||
|
"subvol=nix"
|
||||||
|
"compress=zstd"
|
||||||
|
"noatime"
|
||||||
|
];
|
||||||
neededForBoot = true;
|
neededForBoot = true;
|
||||||
};
|
};
|
||||||
"/persist" = {
|
"/persist" = {
|
||||||
device = "/dev/disk/by-uuid/7741fa2e-ce5d-4aef-bf3c-8e283e973409";
|
device = "/dev/disk/by-uuid/7741fa2e-ce5d-4aef-bf3c-8e283e973409";
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
options = ["subvol=persist" "compress=zstd" "noexec"];
|
options = [
|
||||||
|
"subvol=persist"
|
||||||
|
"compress=zstd"
|
||||||
|
"noexec"
|
||||||
|
];
|
||||||
neededForBoot = true;
|
neededForBoot = true;
|
||||||
};
|
};
|
||||||
"/snapshots" = {
|
"/snapshots" = {
|
||||||
device = "/dev/disk/by-uuid/7741fa2e-ce5d-4aef-bf3c-8e283e973409";
|
device = "/dev/disk/by-uuid/7741fa2e-ce5d-4aef-bf3c-8e283e973409";
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
options = ["subvol=snapshots" "compress=zstd" "noexec"];
|
options = [
|
||||||
|
"subvol=snapshots"
|
||||||
|
"compress=zstd"
|
||||||
|
"noexec"
|
||||||
|
];
|
||||||
neededForBoot = false;
|
neededForBoot = false;
|
||||||
};
|
};
|
||||||
"/mnt/WD" = {
|
"/mnt/WD" = {
|
||||||
device = "/dev/disk/by-uuid/EA2866C92866947B";
|
device = "/dev/disk/by-uuid/EA2866C92866947B";
|
||||||
fsType = "ntfs";
|
fsType = "ntfs";
|
||||||
options = ["nofail" "x-systemd.automount"];
|
options = [
|
||||||
|
"nofail"
|
||||||
|
"x-systemd.automount"
|
||||||
|
];
|
||||||
neededForBoot = false;
|
neededForBoot = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{impermanence, ...}: {
|
{ impermanence, ... }:
|
||||||
|
{
|
||||||
imports = [
|
imports = [
|
||||||
impermanence.nixosModules.impermanence
|
impermanence.nixosModules.impermanence
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{...}: {
|
{ ... }:
|
||||||
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../options/copySysConf.nix
|
../../options/copySysConf.nix
|
||||||
];
|
];
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
sops = {
|
sops = {
|
||||||
defaultSopsFile = ./secrets.yaml;
|
defaultSopsFile = ./secrets.yaml;
|
||||||
age = {
|
age = {
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib;
|
||||||
|
let
|
||||||
cfg = config.system.copySysConf;
|
cfg = config.system.copySysConf;
|
||||||
cfgPath = ../.;
|
cfgPath = ../.;
|
||||||
copySysConf =
|
copySysConf =
|
||||||
if !(isStorePath cfgPath)
|
if !(isStorePath cfgPath) then
|
||||||
then
|
|
||||||
pkgs.stdenv.mkDerivation rec {
|
pkgs.stdenv.mkDerivation rec {
|
||||||
name = "NixOS_Configuration-${version}";
|
name = "NixOS_Configuration-${version}";
|
||||||
version = commitIdFromGitRepo (cfgPath + "/.git");
|
version = commitIdFromGitRepo (cfgPath + "/.git");
|
||||||
|
@ -20,8 +20,10 @@ with lib; let
|
||||||
cp -R ./. $out
|
cp -R ./. $out
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
else (builtins.toPath ../.);
|
else
|
||||||
in {
|
(builtins.toPath ../.);
|
||||||
|
in
|
||||||
|
{
|
||||||
options.system.copySysConf = {
|
options.system.copySysConf = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with builtins;
|
with builtins;
|
||||||
with lib; let
|
with lib;
|
||||||
|
let
|
||||||
cfg = config.machine;
|
cfg = config.machine;
|
||||||
pkgsetList = fn.makeOptionTypeList (toString ../pkgsets);
|
pkgsetList = fn.makeOptionTypeList (toString ../pkgsets);
|
||||||
serviceList = fn.makeOptionTypeList (toString ../services);
|
serviceList = fn.makeOptionTypeList (toString ../services);
|
||||||
|
@ -13,7 +14,12 @@ with lib; let
|
||||||
name = pname;
|
name = pname;
|
||||||
value = rec {
|
value = rec {
|
||||||
pkgwrap = mkOption {
|
pkgwrap = mkOption {
|
||||||
type = with types; oneOf [package (listOf package)];
|
type =
|
||||||
|
with types;
|
||||||
|
oneOf [
|
||||||
|
package
|
||||||
|
(listOf package)
|
||||||
|
];
|
||||||
default = fn.pkgFilter cfg.pkgsets."${pname}".pkgs;
|
default = fn.pkgFilter cfg.pkgsets."${pname}".pkgs;
|
||||||
description = ''
|
description = ''
|
||||||
Package Wrapper for packages using a wrapper function (like python, haskell, ...)
|
Package Wrapper for packages using a wrapper function (like python, haskell, ...)
|
||||||
|
@ -28,7 +34,8 @@ with lib; let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.machine = {
|
options.machine = {
|
||||||
pkgs = mkOption {
|
pkgs = mkOption {
|
||||||
type = types.listOf (types.enum pkgsetList);
|
type = types.listOf (types.enum pkgsetList);
|
||||||
|
@ -118,7 +125,26 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
imports = [
|
imports = [
|
||||||
(mkAliasOptionModule ["machine" "firewall"] ["networking" "firewall"])
|
(mkAliasOptionModule
|
||||||
(mkAliasOptionModule ["machine" "allowUnfree"] ["nixpkgs" "config" "allowUnfree"])
|
[
|
||||||
|
"machine"
|
||||||
|
"firewall"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"networking"
|
||||||
|
"firewall"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
(mkAliasOptionModule
|
||||||
|
[
|
||||||
|
"machine"
|
||||||
|
"allowUnfree"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"nixpkgs"
|
||||||
|
"config"
|
||||||
|
"allowUnfree"
|
||||||
|
]
|
||||||
|
)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,10 @@ buildPythonPackage rec {
|
||||||
sha256 = "0k5kjqa3x6gvwwxyzb2vwi1g1i6asm1zw5fivylxz3d583y4kid2";
|
sha256 = "0k5kjqa3x6gvwwxyzb2vwi1g1i6asm1zw5fivylxz3d583y4kid2";
|
||||||
};
|
};
|
||||||
|
|
||||||
propagatedBuildInputs = [atpublic zope_interface];
|
propagatedBuildInputs = [
|
||||||
|
atpublic
|
||||||
|
zope_interface
|
||||||
|
];
|
||||||
|
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,10 @@ buildPythonPackage rec {
|
||||||
sha256 = "1rdnl85j9ayp8n85l0ciip621j9dcziz5qnmv2m7krgwgcn31vfx";
|
sha256 = "1rdnl85j9ayp8n85l0ciip621j9dcziz5qnmv2m7krgwgcn31vfx";
|
||||||
};
|
};
|
||||||
|
|
||||||
propagatedBuildInputs = [nose zope_interface];
|
propagatedBuildInputs = [
|
||||||
|
nose
|
||||||
|
zope_interface
|
||||||
|
];
|
||||||
|
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib;
|
||||||
|
let
|
||||||
mailman3 = import ./release.nix { };
|
mailman3 = import ./release.nix { };
|
||||||
cfg = config.services.mailman3;
|
cfg = config.services.mailman3;
|
||||||
usePostgresql = cfg.database.type == "postgresql";
|
usePostgresql = cfg.database.type == "postgresql";
|
||||||
|
@ -75,7 +76,8 @@ with lib; let
|
||||||
|
|
||||||
${cfg.extraConfig}
|
${cfg.extraConfig}
|
||||||
'';
|
'';
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.services.mailman3 = {
|
options.services.mailman3 = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
|
@ -104,7 +106,11 @@ in {
|
||||||
|
|
||||||
database = {
|
database = {
|
||||||
type = mkOption {
|
type = mkOption {
|
||||||
type = types.enum ["sqlite3" "mysql" "postgres"];
|
type = types.enum [
|
||||||
|
"sqlite3"
|
||||||
|
"mysql"
|
||||||
|
"postgres"
|
||||||
|
];
|
||||||
default = "sqlite3";
|
default = "sqlite3";
|
||||||
example = "mysql";
|
example = "mysql";
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -273,7 +279,10 @@ in {
|
||||||
mta = {
|
mta = {
|
||||||
# TODO: add Sentmail and qmail
|
# TODO: add Sentmail and qmail
|
||||||
type = mkOption {
|
type = mkOption {
|
||||||
type = types.enum ["postfix" "exim4"];
|
type = types.enum [
|
||||||
|
"postfix"
|
||||||
|
"exim4"
|
||||||
|
];
|
||||||
default = "postfix";
|
default = "postfix";
|
||||||
example = "exim4";
|
example = "exim4";
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -371,30 +380,43 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
services.postfix.recipientDelimiter = mkIf usePostfix (mkDefault "+");
|
services.postfix.recipientDelimiter = mkIf usePostfix (mkDefault "+");
|
||||||
services.postfix.mapFiles."transport_maps" = mkIf usePostfix (mkDefault "${cfg.paths.data_dir}/postfix_lmtp");
|
services.postfix.mapFiles."transport_maps" = mkIf usePostfix (
|
||||||
services.postfix.mapFiles."local_recipient_maps" = mkIf usePostfix (mkDefault "${cfg.paths.data_dir}/postfix_lmtp");
|
mkDefault "${cfg.paths.data_dir}/postfix_lmtp"
|
||||||
services.postfix.mapFiles."relay_domains" = mkIf usePostfix (mkDefault "${cfg.paths.data_dir}/postfix_domains");
|
);
|
||||||
|
services.postfix.mapFiles."local_recipient_maps" = mkIf usePostfix (
|
||||||
|
mkDefault "${cfg.paths.data_dir}/postfix_lmtp"
|
||||||
|
);
|
||||||
|
services.postfix.mapFiles."relay_domains" = mkIf usePostfix (
|
||||||
|
mkDefault "${cfg.paths.data_dir}/postfix_domains"
|
||||||
|
);
|
||||||
|
|
||||||
warnings =
|
warnings = optional (cfg.database.password != "") ''
|
||||||
optional (cfg.database.password != "")
|
config.services.mailman3.database.password will be stored as plaintext
|
||||||
'' config.services.mailman3.database.password will be stored as plaintext
|
|
||||||
in the Nix store. Use database.passwordFile instead.'';
|
in the Nix store. Use database.passwordFile instead.'';
|
||||||
|
|
||||||
# Create database passwordFile default when password is configured.
|
# Create database passwordFile default when password is configured.
|
||||||
services.mailman3.database.passwordFile = mkDefault (toString (pkgs.writeTextFile {
|
services.mailman3.database.passwordFile = mkDefault (
|
||||||
|
toString (
|
||||||
|
pkgs.writeTextFile {
|
||||||
name = "mailman3-database-password";
|
name = "mailman3-database-password";
|
||||||
text = cfg.database.password;
|
text = cfg.database.password;
|
||||||
}));
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
systemd.services.mailman3 = {
|
systemd.services.mailman3 = {
|
||||||
description = "GNU Mailing List Manager";
|
description = "GNU Mailing List Manager";
|
||||||
after = ["network.target"] ++ lib.optional usePostgresql "postgresql.service" ++ lib.optional useMysql "mysql.service";
|
after = [
|
||||||
|
"network.target"
|
||||||
|
] ++ lib.optional usePostgresql "postgresql.service" ++ lib.optional useMysql "mysql.service";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
preStart = let
|
preStart =
|
||||||
|
let
|
||||||
dbpass = fileContents cfg.database.passwordFile;
|
dbpass = fileContents cfg.database.passwordFile;
|
||||||
smtppass = fileContents cfg.mta.smtp_passFile;
|
smtppass = fileContents cfg.mta.smtp_passFile;
|
||||||
in ''
|
in
|
||||||
|
''
|
||||||
mkdir -p ${cfg.paths.etc_dir}
|
mkdir -p ${cfg.paths.etc_dir}
|
||||||
cp ${configFile} ${cfg.paths.etc_dir}/mailman.cfg
|
cp ${configFile} ${cfg.paths.etc_dir}/mailman.cfg
|
||||||
${optionalString (useMysql || usePostgresql) ''
|
${optionalString (useMysql || usePostgresql) ''
|
||||||
|
|
|
@ -1,11 +1,22 @@
|
||||||
{
|
{
|
||||||
pkgs ? import <nixpkgs> { },
|
pkgs ? import <nixpkgs> { },
|
||||||
python3Packages ? pkgs.python3Packages,
|
python3Packages ? pkgs.python3Packages,
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
mailman3 = {
|
mailman3 = {
|
||||||
core = python3Packages.callPackage ./core.nix (with deps; {
|
core = python3Packages.callPackage ./core.nix (
|
||||||
inherit aiosmtpd atpublic flufl_bounce flufl_i18n flufl_lock lazr_config;
|
with deps;
|
||||||
});
|
{
|
||||||
|
inherit
|
||||||
|
aiosmtpd
|
||||||
|
atpublic
|
||||||
|
flufl_bounce
|
||||||
|
flufl_i18n
|
||||||
|
flufl_lock
|
||||||
|
lazr_config
|
||||||
|
;
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
deps = rec {
|
deps = rec {
|
||||||
aiosmtpd = python3Packages.callPackage ./extraPackages/aiosmtpd.nix {
|
aiosmtpd = python3Packages.callPackage ./extraPackages/aiosmtpd.nix {
|
||||||
|
|
|
@ -6,9 +6,11 @@
|
||||||
nixpkgs-stable,
|
nixpkgs-stable,
|
||||||
nixpkgs-git,
|
nixpkgs-git,
|
||||||
...
|
...
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
inherit (pkgs) callPackage;
|
inherit (pkgs) callPackage;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
nixpkgs = {
|
nixpkgs = {
|
||||||
config = {
|
config = {
|
||||||
allowUnfree = true;
|
allowUnfree = true;
|
||||||
|
|
|
@ -18,5 +18,8 @@ buildPythonApplication rec {
|
||||||
substituteInPlace setup.py --replace '"click>=6.0,<=6.7.99",' ""
|
substituteInPlace setup.py --replace '"click>=6.0,<=6.7.99",' ""
|
||||||
substituteInPlace setup.py --replace '"pyusb==1.0.0",' ""
|
substituteInPlace setup.py --replace '"pyusb==1.0.0",' ""
|
||||||
'';
|
'';
|
||||||
propagatedBuildInputs = [click pyusb];
|
propagatedBuildInputs = [
|
||||||
|
click
|
||||||
|
pyusb
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,22 +5,20 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib;
|
||||||
|
let
|
||||||
cfg = config.machine;
|
cfg = config.machine;
|
||||||
pkgsets = fn.lst {
|
pkgsets = fn.lst {
|
||||||
p = toString ../pkgsets;
|
p = toString ../pkgsets;
|
||||||
b = true;
|
b = true;
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
imports = pkgsets;
|
imports = pkgsets;
|
||||||
|
|
||||||
environment.systemPackages =
|
environment.systemPackages = flatten (
|
||||||
flatten
|
lists.forEach (attrVals (filter (v: !(strings.hasInfix "::" v)) cfg.pkgs) cfg.pkgsets) (
|
||||||
(lists.forEach
|
v: v.pkgwrap
|
||||||
(attrVals
|
)
|
||||||
(filter
|
);
|
||||||
(v: !(strings.hasInfix "::" v))
|
|
||||||
cfg.pkgs)
|
|
||||||
cfg.pkgsets)
|
|
||||||
(v: v.pkgwrap));
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
config.machine.pkgsets.base.pkgs = with pkgs; [
|
config.machine.pkgsets.base.pkgs = with pkgs; [
|
||||||
age
|
age
|
||||||
sops
|
sops
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
config.machine.pkgsets.cpp.pkgs = with pkgs; [
|
config.machine.pkgsets.cpp.pkgs = with pkgs; [
|
||||||
clang
|
clang
|
||||||
cmake
|
cmake
|
||||||
|
|
|
@ -2,10 +2,24 @@
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
config.machine.pkgsets.dict.pkgs = with pkgs; [
|
config.machine.pkgsets.dict.pkgs = with pkgs; [
|
||||||
translate-shell
|
translate-shell
|
||||||
(hunspellWithDicts (with pkgs.hunspellDicts; [de-de en-us]))
|
(hunspellWithDicts (
|
||||||
(aspellWithDicts (d: with d; [de en en-computers en-science]))
|
with pkgs.hunspellDicts;
|
||||||
|
[
|
||||||
|
de-de
|
||||||
|
en-us
|
||||||
|
]
|
||||||
|
))
|
||||||
|
(aspellWithDicts (
|
||||||
|
d: with d; [
|
||||||
|
de
|
||||||
|
en
|
||||||
|
en-computers
|
||||||
|
en-science
|
||||||
|
]
|
||||||
|
))
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
config.machine.pkgsets.extra.pkgs = with pkgs; [
|
config.machine.pkgsets.extra.pkgs = with pkgs; [
|
||||||
alsaUtils
|
alsaUtils
|
||||||
binutils-unwrapped
|
binutils-unwrapped
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
config.machine.pkgsets.haskell-tools.pkgs = with pkgs; [cabal-install hlint]; # ghcid
|
{
|
||||||
|
config.machine.pkgsets.haskell-tools.pkgs = with pkgs; [
|
||||||
|
cabal-install
|
||||||
|
hlint
|
||||||
|
]; # ghcid
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,11 @@
|
||||||
fn,
|
fn,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
config.machine.pkgsets.haskell.pkgwrap = pkgs.haskellPackages.ghcWithPackages (pkgs: (fn.pkgFilter config.machine.pkgsets.haskell.pkgs));
|
{
|
||||||
|
config.machine.pkgsets.haskell.pkgwrap = pkgs.haskellPackages.ghcWithPackages (
|
||||||
|
pkgs: (fn.pkgFilter config.machine.pkgsets.haskell.pkgs)
|
||||||
|
);
|
||||||
config.machine.pkgsets.haskell.pkgs = with pkgs.haskellPackages; [
|
config.machine.pkgsets.haskell.pkgs = with pkgs.haskellPackages; [
|
||||||
hindent
|
hindent
|
||||||
mtl
|
mtl
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; {
|
with lib;
|
||||||
|
{
|
||||||
config.machine.pkgsets.latex.pkgs = with pkgs; [
|
config.machine.pkgsets.latex.pkgs = with pkgs; [
|
||||||
texlive.combined.scheme-full
|
texlive.combined.scheme-full
|
||||||
texlab
|
texlab
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
config.machine.pkgsets.mail_utils.pkgs = with pkgs; [
|
config.machine.pkgsets.mail_utils.pkgs = with pkgs; [
|
||||||
aerc
|
aerc
|
||||||
abook
|
abook
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
{pkgs, ...}: {
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
config.machine.pkgsets.nodejs.pkgs =
|
config.machine.pkgsets.nodejs.pkgs =
|
||||||
(with pkgs; [nodejs yarn deno])
|
(with pkgs; [
|
||||||
|
nodejs
|
||||||
|
yarn
|
||||||
|
deno
|
||||||
|
])
|
||||||
++ (with pkgs.nodePackages; [
|
++ (with pkgs.nodePackages; [
|
||||||
autoprefixer
|
autoprefixer
|
||||||
mermaid-cli
|
mermaid-cli
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
fn,
|
fn,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
config.machine.pkgsets.php.pkgwrap = fn.pkgFilter config.machine.pkgsets.php.pkgs;
|
config.machine.pkgsets.php.pkgwrap = fn.pkgFilter config.machine.pkgsets.php.pkgs;
|
||||||
config.machine.pkgsets.php.pkgs =
|
config.machine.pkgsets.php.pkgs =
|
||||||
(with pkgs.php82Packages; [
|
(with pkgs.php82Packages; [
|
||||||
|
|
|
@ -5,8 +5,11 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; {
|
with lib;
|
||||||
config.machine.pkgsets.python3.pkgwrap = pkgs.python3.withPackages (ps: (fn.pkgFilter config.machine.pkgsets.python3.pkgs));
|
{
|
||||||
|
config.machine.pkgsets.python3.pkgwrap = pkgs.python3.withPackages (
|
||||||
|
ps: (fn.pkgFilter config.machine.pkgsets.python3.pkgs)
|
||||||
|
);
|
||||||
config.machine.pkgsets.python3.pkgs = with pkgs.python3Packages; [
|
config.machine.pkgsets.python3.pkgs = with pkgs.python3Packages; [
|
||||||
bpython
|
bpython
|
||||||
flake8
|
flake8
|
||||||
|
|
|
@ -1,11 +1,18 @@
|
||||||
{config, ...}: let
|
{ config, ... }:
|
||||||
mozRust = with builtins;
|
let
|
||||||
(map (p:
|
mozRust =
|
||||||
import ((fetchTarball {
|
with builtins;
|
||||||
|
(map (
|
||||||
|
p:
|
||||||
|
import (
|
||||||
|
(fetchTarball {
|
||||||
url = "https://github.com/mozilla/nixpkgs-mozilla/archive/e912ed4.tar.gz";
|
url = "https://github.com/mozilla/nixpkgs-mozilla/archive/e912ed4.tar.gz";
|
||||||
sha256 = "08fvzb8w80bkkabc1iyhzd15f4sm7ra10jn32kfch5klgl0gj3j3";
|
sha256 = "08fvzb8w80bkkabc1iyhzd15f4sm7ra10jn32kfch5klgl0gj3j3";
|
||||||
})
|
})
|
||||||
+ p))) [
|
+ p
|
||||||
|
)
|
||||||
|
))
|
||||||
|
[
|
||||||
(toPath "/lib-overlay.nix")
|
(toPath "/lib-overlay.nix")
|
||||||
(toPath "/rust-overlay.nix")
|
(toPath "/rust-overlay.nix")
|
||||||
];
|
];
|
||||||
|
@ -27,18 +34,26 @@
|
||||||
"rustfmt-preview"
|
"rustfmt-preview"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
// {src = nightly.rust-src;};
|
// {
|
||||||
|
src = nightly.rust-src;
|
||||||
|
};
|
||||||
inherit (nightly) cargo;
|
inherit (nightly) cargo;
|
||||||
};
|
};
|
||||||
rustPNightly = stablepkgs.recurseIntoAttrs (stablepkgs.makeRustPlatform {
|
rustPNightly = stablepkgs.recurseIntoAttrs (
|
||||||
|
stablepkgs.makeRustPlatform {
|
||||||
inherit (rustNightly) rustc cargo;
|
inherit (rustNightly) rustc cargo;
|
||||||
});
|
}
|
||||||
in {
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
config.machine.pkgsets.rustpkgs.pkgs =
|
config.machine.pkgsets.rustpkgs.pkgs =
|
||||||
(with stablepkgs; [
|
(with stablepkgs; [
|
||||||
diesel-cli
|
diesel-cli
|
||||||
carnix
|
carnix
|
||||||
rustracer
|
rustracer
|
||||||
])
|
])
|
||||||
++ (with rustNightly; [rustc cargo]);
|
++ (with rustNightly; [
|
||||||
|
rustc
|
||||||
|
cargo
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
config.machine.pkgsets.server.pkgs = with pkgs; [
|
config.machine.pkgsets.server.pkgs = with pkgs; [
|
||||||
audit
|
audit
|
||||||
certbot
|
certbot
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; {
|
with lib;
|
||||||
|
{
|
||||||
config.machine.pkgsets.tracking.pkgs = with pkgs; [
|
config.machine.pkgsets.tracking.pkgs = with pkgs; [
|
||||||
aw-qt
|
aw-qt
|
||||||
aw-server-rust
|
aw-server-rust
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
config.machine.pkgsets.uniProgs.pkgs = with pkgs; [ qucs ];
|
config.machine.pkgsets.uniProgs.pkgs = with pkgs; [ qucs ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,11 @@
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
cfg = config.machine;
|
cfg = config.machine;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
config.machine.pkgsets.xpkgs.pkgs = with pkgs; [
|
config.machine.pkgsets.xpkgs.pkgs = with pkgs; [
|
||||||
acpilight
|
acpilight
|
||||||
feh
|
feh
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with builtins;
|
with builtins;
|
||||||
with lib; let
|
with lib;
|
||||||
|
let
|
||||||
cfg = config.machine;
|
cfg = config.machine;
|
||||||
in
|
in
|
||||||
mkIf (elem "acme" cfg.services) {
|
mkIf (elem "acme" cfg.services) {
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with builtins;
|
with builtins;
|
||||||
with lib; let
|
with lib;
|
||||||
|
let
|
||||||
cfg = config.machine;
|
cfg = config.machine;
|
||||||
in
|
in
|
||||||
mkIf (elem "bind" cfg.services) {
|
mkIf (elem "bind" cfg.services) {
|
||||||
|
|
|
@ -10,6 +10,11 @@ with lib;
|
||||||
enable = true;
|
enable = true;
|
||||||
browsed.enable = false;
|
browsed.enable = false;
|
||||||
startWhenNeeded = true;
|
startWhenNeeded = true;
|
||||||
drivers = with pkgs; [gutenprint hplip splix samsung-unified-linux-driver];
|
drivers = with pkgs; [
|
||||||
|
gutenprint
|
||||||
|
hplip
|
||||||
|
splix
|
||||||
|
samsung-unified-linux-driver
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib;
|
||||||
|
let
|
||||||
cfg = config.machine;
|
cfg = config.machine;
|
||||||
desktopFiles = fn.lst {
|
desktopFiles = fn.lst {
|
||||||
p = toString ./desktop;
|
p = toString ./desktop;
|
||||||
|
|
|
@ -20,5 +20,9 @@ with lib;
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
machine.pkgsets.python3.pkgs = with pkgs.python3Packages; [py3status pytz tzlocal];
|
machine.pkgsets.python3.pkgs = with pkgs.python3Packages; [
|
||||||
|
py3status
|
||||||
|
pytz
|
||||||
|
tzlocal
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,9 @@ with lib;
|
||||||
# Disable live restore as it tends to delay/block system shutdown
|
# Disable live restore as it tends to delay/block system shutdown
|
||||||
liveRestore = false;
|
liveRestore = false;
|
||||||
};
|
};
|
||||||
environment.systemPackages = with pkgs; [docker-compose docker-machine cntr];
|
environment.systemPackages = with pkgs; [
|
||||||
|
docker-compose
|
||||||
|
docker-machine
|
||||||
|
cntr
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib;
|
||||||
|
let
|
||||||
cfg = config.machine;
|
cfg = config.machine;
|
||||||
active = name: (elem name cfg.services);
|
active = name: (elem name cfg.services);
|
||||||
in
|
in
|
||||||
|
|
|
@ -6,10 +6,12 @@
|
||||||
with lib;
|
with lib;
|
||||||
mkIf (elem "forgejo" config.machine.services) {
|
mkIf (elem "forgejo" config.machine.services) {
|
||||||
services = {
|
services = {
|
||||||
forgejo = let
|
forgejo =
|
||||||
|
let
|
||||||
cfg = config.machine;
|
cfg = config.machine;
|
||||||
inherit ((findFirst (s: s.service == "forgejo") cfg cfg.vHosts)) domain;
|
inherit ((findFirst (s: s.service == "forgejo") cfg cfg.vHosts)) domain;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
enable = true;
|
enable = true;
|
||||||
user = "git";
|
user = "git";
|
||||||
database = {
|
database = {
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
}:
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
mkIf (elem "fprintd" config.machine.services) {
|
mkIf (elem "fprintd" config.machine.services) {
|
||||||
security.pam.services = let
|
security.pam.services =
|
||||||
|
let
|
||||||
unlock = [
|
unlock = [
|
||||||
"sudo"
|
"sudo"
|
||||||
"i3lock"
|
"i3lock"
|
||||||
|
@ -13,10 +14,14 @@ with lib;
|
||||||
"lightdm"
|
"lightdm"
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
listToAttrs (forEach unlock (n: {
|
listToAttrs (
|
||||||
|
forEach unlock (n: {
|
||||||
name = n;
|
name = n;
|
||||||
value = {fprintAuth = true;};
|
value = {
|
||||||
}));
|
fprintAuth = true;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
services.fprintd = {
|
services.fprintd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
# https://qfpl.io/posts/nix/starting-simple-hydra/
|
# https://qfpl.io/posts/nix/starting-simple-hydra/
|
||||||
# also for reference a well written hydra config:
|
# also for reference a well written hydra config:
|
||||||
# https://github.com/NixOS/nixos-org-configurations/blob/master/delft/hydra.nix
|
# https://github.com/NixOS/nixos-org-configurations/blob/master/delft/hydra.nix
|
||||||
with lib; let
|
with lib;
|
||||||
|
let
|
||||||
cacheDir = "/var/cache/hydra";
|
cacheDir = "/var/cache/hydra";
|
||||||
in
|
in
|
||||||
mkIf (elem "hydra" config.machine.services) {
|
mkIf (elem "hydra" config.machine.services) {
|
||||||
|
@ -18,15 +19,22 @@ in
|
||||||
{
|
{
|
||||||
hostName = "localhost";
|
hostName = "localhost";
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
supportedFeatures = ["kvm" "nixos-test" "big-parallel" "benchmark"];
|
supportedFeatures = [
|
||||||
|
"kvm"
|
||||||
|
"nixos-test"
|
||||||
|
"big-parallel"
|
||||||
|
"benchmark"
|
||||||
|
];
|
||||||
maxJobs = 8;
|
maxJobs = 8;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
services = let
|
services =
|
||||||
|
let
|
||||||
cfg = config.machine;
|
cfg = config.machine;
|
||||||
inherit ((findFirst (s: s.service == "hydra") cfg cfg.vHosts)) domain;
|
inherit ((findFirst (s: s.service == "hydra") cfg cfg.vHosts)) domain;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
hydra = {
|
hydra = {
|
||||||
enable = true;
|
enable = true;
|
||||||
hydraURL = domain; # externally visible URL
|
hydraURL = domain; # externally visible URL
|
||||||
|
@ -42,7 +50,9 @@ in
|
||||||
# hydra.conf: binary_cache_secret_key_file is deprecated and ignored. use store_uri=...?secret-key= instead
|
# hydra.conf: binary_cache_secret_key_file is deprecated and ignored. use store_uri=...?secret-key= instead
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
max_output_size = 4294967296
|
max_output_size = 4294967296
|
||||||
store_uri = file://${cacheDir}?secret-key=${config.sops.secrets."services.hydra.secretKey".path}&write-nar-listing=1&ls-compression=br&log-compression=br
|
store_uri = file://${cacheDir}?secret-key=${
|
||||||
|
config.sops.secrets."services.hydra.secretKey".path
|
||||||
|
}&write-nar-listing=1&ls-compression=br&log-compression=br
|
||||||
# add ?local-nar-cache= to set nar cache location
|
# add ?local-nar-cache= to set nar cache location
|
||||||
server_store_uri = https://cache.${cfg.domain}
|
server_store_uri = https://cache.${cfg.domain}
|
||||||
binary_cache_public_uri https://cache.${cfg.domain}
|
binary_cache_public_uri https://cache.${cfg.domain}
|
||||||
|
|
|
@ -12,11 +12,15 @@ with lib;
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
// mkIf (elem "mailserver" config.machine.services) {
|
// mkIf (elem "mailserver" config.machine.services) {
|
||||||
mailserver = let
|
mailserver =
|
||||||
|
let
|
||||||
cfg = config.machine;
|
cfg = config.machine;
|
||||||
inherit (cfg) domain;
|
inherit (cfg) domain;
|
||||||
fdomain = (findFirst (s: s.service == "mail") cfg cfg.vHosts).domain;
|
fdomain = (findFirst (s: s.service == "mail") cfg cfg.vHosts).domain;
|
||||||
mkFqdnAlias = name: ["${name}@${domain}" "${name}@${fdomain}"];
|
mkFqdnAlias = name: [
|
||||||
|
"${name}@${domain}"
|
||||||
|
"${name}@${fdomain}"
|
||||||
|
];
|
||||||
mkExDomAlias = name: (map (exDom: "${name}@${exDom}") cfg.extraDomains);
|
mkExDomAlias = name: (map (exDom: "${name}@${exDom}") cfg.extraDomains);
|
||||||
mkUser = user: rec {
|
mkUser = user: rec {
|
||||||
name = "${user.name}@${domain}";
|
name = "${user.name}@${domain}";
|
||||||
|
@ -28,10 +32,14 @@ with lib;
|
||||||
++ (flatten (map mkExDomAlias ([ user.name ] ++ user.aliases)));
|
++ (flatten (map mkExDomAlias ([ user.name ] ++ user.aliases)));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in rec {
|
in
|
||||||
|
rec {
|
||||||
enable = true;
|
enable = true;
|
||||||
fqdn = fdomain;
|
fqdn = fdomain;
|
||||||
domains = [fdomain domain] ++ cfg.extraDomains;
|
domains = [
|
||||||
|
fdomain
|
||||||
|
domain
|
||||||
|
] ++ cfg.extraDomains;
|
||||||
loginAccounts = listToAttrs (map mkUser cfg.mailAccounts);
|
loginAccounts = listToAttrs (map mkUser cfg.mailAccounts);
|
||||||
|
|
||||||
# Use Let's Encrypt certificates. Note that this needs to set up a stripped
|
# Use Let's Encrypt certificates. Note that this needs to set up a stripped
|
||||||
|
@ -55,9 +63,5 @@ with lib;
|
||||||
# 1 Gb RAM for the server. Without virus scanning 256 MB RAM should be plenty)
|
# 1 Gb RAM for the server. Without virus scanning 256 MB RAM should be plenty)
|
||||||
virusScanning = false;
|
virusScanning = false;
|
||||||
};
|
};
|
||||||
sops.secrets =
|
sops.secrets = fn.sopsHelper (user: "users/${user.name}/mail") config.machine.mailAccounts { };
|
||||||
fn.sopsHelper
|
|
||||||
(user: "users/${user.name}/mail")
|
|
||||||
config.machine.mailAccounts
|
|
||||||
{};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,12 @@
|
||||||
}:
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
mkIf (elem "nextcloud" config.machine.services) {
|
mkIf (elem "nextcloud" config.machine.services) {
|
||||||
services = let
|
services =
|
||||||
|
let
|
||||||
cfg = config.machine;
|
cfg = config.machine;
|
||||||
inherit ((findFirst (s: s.service == "nextcloud") cfg cfg.vHosts)) domain;
|
inherit ((findFirst (s: s.service == "nextcloud") cfg cfg.vHosts)) domain;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
nextcloud = {
|
nextcloud = {
|
||||||
enable = true;
|
enable = true;
|
||||||
home = "/var/lib/nextcloud";
|
home = "/var/lib/nextcloud";
|
||||||
|
@ -55,9 +57,11 @@ with lib;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
sops.secrets =
|
sops.secrets =
|
||||||
fn.sopsHelper
|
fn.sopsHelper (name: "services/nextcloud/${name}")
|
||||||
(name: "services/nextcloud/${name}")
|
[
|
||||||
["adminPass" "dbPass"]
|
"adminPass"
|
||||||
|
"dbPass"
|
||||||
|
]
|
||||||
{
|
{
|
||||||
owner = "nextcloud";
|
owner = "nextcloud";
|
||||||
group = "nextcloud";
|
group = "nextcloud";
|
||||||
|
|
|
@ -16,27 +16,34 @@
|
||||||
with lib;
|
with lib;
|
||||||
with builtins;
|
with builtins;
|
||||||
mkIf (elem "nginx" config.machine.services) {
|
mkIf (elem "nginx" config.machine.services) {
|
||||||
services.nginx = let
|
services.nginx =
|
||||||
vHostConfigs = listToAttrs (map
|
let
|
||||||
(name: {
|
vHostConfigs = listToAttrs (
|
||||||
|
map (name: {
|
||||||
name = replaceStrings [ ".nix" ] [ "" ] name;
|
name = replaceStrings [ ".nix" ] [ "" ] name;
|
||||||
value = import (./. + (toPath "/nginx_vHosts/${name}")) {inherit options config lib pkgs;};
|
value = import (./. + (toPath "/nginx_vHosts/${name}")) {
|
||||||
})
|
inherit
|
||||||
(attrNames (readDir ./nginx_vHosts)));
|
options
|
||||||
|
config
|
||||||
|
lib
|
||||||
|
pkgs
|
||||||
|
;
|
||||||
|
};
|
||||||
|
}) (attrNames (readDir ./nginx_vHosts))
|
||||||
|
);
|
||||||
|
|
||||||
mkVHost = vHost: {
|
mkVHost = vHost: {
|
||||||
name = vHost.domain;
|
name = vHost.domain;
|
||||||
value =
|
value = {
|
||||||
{
|
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
acmeRoot = "/var/lib/acme/acme-challenge";
|
acmeRoot = "/var/lib/acme/acme-challenge";
|
||||||
}
|
} // vHostConfigs."${vHost.service}";
|
||||||
// vHostConfigs."${vHost.service}";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
vHosts = listToAttrs (map mkVHost config.machine.vHosts);
|
vHosts = listToAttrs (map mkVHost config.machine.vHosts);
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
enable = true;
|
enable = true;
|
||||||
recommendedGzipSettings = true;
|
recommendedGzipSettings = true;
|
||||||
recommendedOptimisation = true;
|
recommendedOptimisation = true;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
vHost =
|
vHost =
|
||||||
if config.services.nix-serve.enable
|
if config.services.nix-serve.enable then
|
||||||
then {
|
{
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://${config.services.nix-serve.bindAddress}:${toString config.services.nix-serve.port};
|
proxy_pass http://${config.services.nix-serve.bindAddress}:${toString config.services.nix-serve.port};
|
||||||
|
@ -18,6 +18,7 @@ with lib;
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
else {};
|
else
|
||||||
|
{ };
|
||||||
}
|
}
|
||||||
.vHost
|
.vHost
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
vHost =
|
vHost =
|
||||||
if config.services.forgejo.enable
|
if config.services.forgejo.enable then
|
||||||
then {
|
{
|
||||||
root = "${config.services.forgejo.stateDir}/public";
|
root = "${config.services.forgejo.stateDir}/public";
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
location / {
|
location / {
|
||||||
|
@ -28,6 +28,7 @@ with lib;
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
else {};
|
else
|
||||||
|
{ };
|
||||||
}
|
}
|
||||||
.vHost
|
.vHost
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
vHost =
|
vHost =
|
||||||
if config.services.hydra.enable
|
if config.services.hydra.enable then
|
||||||
then {
|
{
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://${config.services.hydra.listenHost}:${toString config.services.hydra.port};
|
proxy_pass http://${config.services.hydra.listenHost}:${toString config.services.hydra.port};
|
||||||
|
@ -18,6 +18,7 @@ with lib;
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
else {};
|
else
|
||||||
|
{ };
|
||||||
}
|
}
|
||||||
.vHost
|
.vHost
|
||||||
|
|
|
@ -6,12 +6,13 @@
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
vHost =
|
vHost =
|
||||||
if config.mailserver.enable
|
if config.mailserver.enable then
|
||||||
then {
|
{
|
||||||
serverName = config.mailserver.fqdn;
|
serverName = config.mailserver.fqdn;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
}
|
}
|
||||||
else {};
|
else
|
||||||
|
{ };
|
||||||
}
|
}
|
||||||
.vHost
|
.vHost
|
||||||
|
|
|
@ -6,8 +6,7 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
if config.services.nextcloud.enable
|
if config.services.nextcloud.enable then
|
||||||
then
|
|
||||||
{
|
{
|
||||||
vHost = {
|
vHost = {
|
||||||
enableACME = config.services.nextcloud.https;
|
enableACME = config.services.nextcloud.https;
|
||||||
|
@ -15,4 +14,5 @@ with lib;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
.vHost
|
.vHost
|
||||||
else {}
|
else
|
||||||
|
{ }
|
||||||
|
|
|
@ -6,10 +6,11 @@
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
tandoor = config.services.tandoor-recipes;
|
tandoor = config.services.tandoor-recipes;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
vHost =
|
vHost =
|
||||||
if tandoor.enable
|
if tandoor.enable then
|
||||||
then {
|
{
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
location /media/ {
|
location /media/ {
|
||||||
alias ${tandoor.extraConfig.MEDIA_ROOT};
|
alias ${tandoor.extraConfig.MEDIA_ROOT};
|
||||||
|
@ -24,6 +25,7 @@ in {
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
else {};
|
else
|
||||||
|
{ };
|
||||||
}
|
}
|
||||||
.vHost
|
.vHost
|
||||||
|
|
|
@ -12,18 +12,23 @@ with lib;
|
||||||
services.openssh = {
|
services.openssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings.KexAlgorithms = [ "curve25519-sha256@libssh.org" ];
|
settings.KexAlgorithms = [ "curve25519-sha256@libssh.org" ];
|
||||||
sftpFlags = ["-f AUTHPRIV" "-l INFO"];
|
sftpFlags = [
|
||||||
|
"-f AUTHPRIV"
|
||||||
|
"-l INFO"
|
||||||
|
];
|
||||||
startWhenNeeded = false;
|
startWhenNeeded = false;
|
||||||
settings = {
|
settings = {
|
||||||
KbdInteractiveAuthentication = false;
|
KbdInteractiveAuthentication = false;
|
||||||
PasswordAuthentication = false;
|
PasswordAuthentication = false;
|
||||||
PermitRootLogin = "no";
|
PermitRootLogin = "no";
|
||||||
};
|
};
|
||||||
extraConfig = let
|
extraConfig =
|
||||||
|
let
|
||||||
users =
|
users =
|
||||||
concatMapStrings (user: "${user.name} ") config.machine.administrators
|
concatMapStrings (user: "${user.name} ") config.machine.administrators
|
||||||
+ (optionalString config.services.forgejo.enable (config.services.forgejo.user + " "));
|
+ (optionalString config.services.forgejo.enable (config.services.forgejo.user + " "));
|
||||||
in ''
|
in
|
||||||
|
''
|
||||||
UsePAM no
|
UsePAM no
|
||||||
AllowUsers ${users}
|
AllowUsers ${users}
|
||||||
LogLevel VERBOSE
|
LogLevel VERBOSE
|
||||||
|
@ -32,9 +37,7 @@ with lib;
|
||||||
# Add public keys to /etc/ssh/authorized_keys.d
|
# Add public keys to /etc/ssh/authorized_keys.d
|
||||||
# This replaces users.users.*.openssh.authorizedKeys.*
|
# This replaces users.users.*.openssh.authorizedKeys.*
|
||||||
sops.secrets =
|
sops.secrets =
|
||||||
fn.sopsHelper
|
fn.sopsHelper (user: "users/${user.name}/publicKey") config.machine.administrators
|
||||||
(user: "users/${user.name}/publicKey")
|
|
||||||
config.machine.administrators
|
|
||||||
(user: {
|
(user: {
|
||||||
path = "/etc/ssh/authorized_keys.d/${user.name}";
|
path = "/etc/ssh/authorized_keys.d/${user.name}";
|
||||||
mode = "444";
|
mode = "444";
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib;
|
||||||
|
let
|
||||||
withDocker = elem "docker" config.machine.services;
|
withDocker = elem "docker" config.machine.services;
|
||||||
in
|
in
|
||||||
mkIf (elem "podman" config.machine.services) {
|
mkIf (elem "podman" config.machine.services) {
|
||||||
|
@ -17,6 +18,11 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
environment.systemPackages =
|
environment.systemPackages =
|
||||||
(with pkgs; [podman-compose cntr img skopeo])
|
(with pkgs; [
|
||||||
|
podman-compose
|
||||||
|
cntr
|
||||||
|
img
|
||||||
|
skopeo
|
||||||
|
])
|
||||||
++ (optional withDocker pkgs.docker-compose);
|
++ (optional withDocker pkgs.docker-compose);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue