nix run github:astro/deadnix

This commit is contained in:
Motiejus Jakštys 2023-09-30 17:06:41 +03:00
parent 305eba5d2e
commit 0e9f90a960
18 changed files with 16 additions and 30 deletions

View File

@ -48,7 +48,7 @@
system = "x86_64-linux"; system = "x86_64-linux";
overlays = [ overlays = [
deploy-rs.overlay deploy-rs.overlay
(self: super: { (_self: super: {
deploy-rs = { deploy-rs = {
inherit (pkgsIA64) deploy-rs; inherit (pkgsIA64) deploy-rs;
lib = super.deploy-rs.lib; lib = super.deploy-rs.lib;
@ -60,7 +60,7 @@
system = "aarch64-linux"; system = "aarch64-linux";
overlays = [ overlays = [
deploy-rs.overlay deploy-rs.overlay
(self: super: { (_self: super: {
deploy-rs = { deploy-rs = {
inherit (pkgsArm64) deploy-rs; inherit (pkgsArm64) deploy-rs;
lib = super.deploy-rs.lib; lib = super.deploy-rs.lib;
@ -225,7 +225,9 @@
}; };
}; };
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; checks = builtins.mapAttrs (_system: deployLib:
deployLib.deployChecks self.deploy)
deploy-rs.lib;
} }
// flake-utils.lib.eachDefaultSystem (system: let // flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;}; pkgs = import nixpkgs {inherit system;};

View File

@ -1,6 +1,5 @@
{ {
config, config,
pkgs,
myData, myData,
modulesPath, modulesPath,
... ...

View File

@ -1,6 +1,5 @@
{ {
config, config,
pkgs,
myData, myData,
... ...
}: let }: let

View File

@ -1,7 +1,5 @@
{ {
config,
pkgs, pkgs,
lib,
myData, myData,
... ...
}: let }: let

View File

@ -4,7 +4,7 @@
... ...
}: let }: let
cfg = config.zfs-root.fileSystems; cfg = config.zfs-root.fileSystems;
inherit (lib) mkIf types mkDefault mkOption mkMerge mapAttrsToList; inherit (lib) types mkDefault mkOption mkMerge mapAttrsToList;
in { in {
options.zfs-root.fileSystems = { options.zfs-root.fileSystems = {
datasets = mkOption { datasets = mkOption {

View File

@ -23,7 +23,7 @@
}; };
extraArgs = ["--verbose"]; extraArgs = ["--verbose"];
datasets = let datasets = let
fs_zfs = lib.filterAttrs (n: v: v.fsType == "zfs") config.fileSystems; fs_zfs = lib.filterAttrs (_: v: v.fsType == "zfs") config.fileSystems;
mountpoint2fs = mountpoint2fs =
builtins.listToAttrs builtins.listToAttrs
(map (mountpoint: { (map (mountpoint: {
@ -32,7 +32,7 @@
}) })
config.mj.base.snapshot.mountpoints); config.mj.base.snapshot.mountpoints);
s_datasets = s_datasets =
lib.mapAttrs' (mountpoint: fs: { lib.mapAttrs' (_mountpoint: fs: {
name = fs.device; name = fs.device;
value = {use_template = ["prod"];}; value = {use_template = ["prod"];};
}) })

View File

@ -14,8 +14,8 @@
}; };
programs.mosh.enable = true; programs.mosh.enable = true;
programs.ssh.knownHosts = let programs.ssh.knownHosts = let
sshAttrs = lib.genAttrs ["extraHostNames" "publicKey"] (name: null); sshAttrs = lib.genAttrs ["extraHostNames" "publicKey"] (_: null);
in in
lib.mapAttrs (name: cfg: builtins.intersectAttrs sshAttrs cfg) myData.hosts; lib.mapAttrs (_name: cfg: builtins.intersectAttrs sshAttrs cfg) myData.hosts;
}; };
} }

View File

@ -55,7 +55,7 @@
passwd.motiejus or {}; passwd.motiejus or {};
root = assert lib.assertMsg (passwd ? root) "root password needs to be defined"; root = assert lib.assertMsg (passwd ? root) "root password needs to be defined";
lib.filterAttrs (n: v: v != null) passwd.root; lib.filterAttrs (_: v: v != null) passwd.root;
}; };
}; };

View File

@ -4,7 +4,7 @@
pkgs, pkgs,
... ...
}: let }: let
mkPreHook = mountpoint: zfs_name: i: '' mkPreHook = zfs_name: i: ''
set -x set -x
sleep ${toString i} sleep ${toString i}
mkdir "$RUNTIME_DIRECTORY/snapshot" mkdir "$RUNTIME_DIRECTORY/snapshot"
@ -79,7 +79,7 @@ in {
extraArgs = "--remote-path=borg1"; extraArgs = "--remote-path=borg1";
compression = "auto,lzma"; compression = "auto,lzma";
startAt = attrs.backup_at; startAt = attrs.backup_at;
preHook = mkPreHook mountpoint fs.device i; preHook = mkPreHook fs.device i;
prune.keep = { prune.keep = {
within = "1d"; within = "1d";
daily = 7; daily = 7;

View File

@ -1,6 +1,5 @@
{ {
config, config,
lib,
pkgs, pkgs,
... ...
}: { }: {

View File

@ -1,9 +1,4 @@
{ {...}: {
config,
lib,
pkgs,
...
}: {
imports = [ imports = [
./borgstor ./borgstor
./certget ./certget

View File

@ -4,7 +4,6 @@
pkgs, pkgs,
... ...
}: let }: let
cfg = config.mj.services.deployerbot;
mkOptional = { mkOptional = {
derivationTarget, derivationTarget,
pingTarget, pingTarget,

View File

@ -1,7 +1,6 @@
{ {
config, config,
lib, lib,
myData,
... ...
}: { }: {
options.mj.services.friendlyport = with lib.types; { options.mj.services.friendlyport = with lib.types; {

View File

@ -1,7 +1,6 @@
{ {
config, config,
lib, lib,
pkgs,
myData, myData,
... ...
}: let }: let

View File

@ -2,7 +2,6 @@
config, config,
lib, lib,
pkgs, pkgs,
myData,
... ...
}: { }: {
options.mj.services.matrix-synapse = with lib.types; { options.mj.services.matrix-synapse = with lib.types; {

View File

@ -6,7 +6,6 @@
}: let }: let
cfg = config.mj.services.nsd-acme; cfg = config.mj.services.nsd-acme;
mkHook = zone: let mkHook = zone: let
rc = config.services.nsd.remoteControl;
fullZone = "_acme-endpoint.${zone}"; fullZone = "_acme-endpoint.${zone}";
in in
pkgs.writeShellScript "nsd-acme-hook" '' pkgs.writeShellScript "nsd-acme-hook" ''
@ -188,7 +187,7 @@ in {
systemd.timers = systemd.timers =
lib.mapAttrs' lib.mapAttrs'
( (
zone: cfg: zone: _:
lib.nameValuePair "nsd-acme-${zone}" { lib.nameValuePair "nsd-acme-${zone}" {
description = "nsd-acme for zone ${zone}"; description = "nsd-acme for zone ${zone}";
wantedBy = ["timers.target"]; wantedBy = ["timers.target"];

View File

@ -1,7 +1,6 @@
{ {
config, config,
lib, lib,
pkgs,
myData, myData,
... ...
}: let }: let

View File

@ -3,7 +3,7 @@ let
motiejus_yk2 = "age1yubikey1qgyvs2ul0enzqf4sscq96zyxk73jnj4lknpemak2hp39lejdwc0s5uzzhpc"; motiejus_yk2 = "age1yubikey1qgyvs2ul0enzqf4sscq96zyxk73jnj4lknpemak2hp39lejdwc0s5uzzhpc";
motiejus_bk1 = "age1kyehn8yr9tfu3w0z4d9p9qrj0tjjh92ljxmz2nyr6xnm7y8kpv5spwwc9n"; motiejus_bk1 = "age1kyehn8yr9tfu3w0z4d9p9qrj0tjjh92ljxmz2nyr6xnm7y8kpv5spwwc9n";
motiejus_bk2 = "age14f39j0wx84n93lgqn6d9gcd3yhuwak6qwrxy8v83ydn7266uafts09ecva"; motiejus_bk2 = "age14f39j0wx84n93lgqn6d9gcd3yhuwak6qwrxy8v83ydn7266uafts09ecva";
motiejus = [motiejus_yk1 motiejus_yk2 motiejus_bk1]; motiejus = [motiejus_yk1 motiejus_yk2 motiejus_bk1 motiejus_bk2];
fwminex = (import ./data.nix).hosts."fwminex.motiejus.jakst".publicKey; fwminex = (import ./data.nix).hosts."fwminex.motiejus.jakst".publicKey;
fra1-a = (import ./data.nix).hosts."fra1-a.servers.jakst".publicKey; fra1-a = (import ./data.nix).hosts."fra1-a.servers.jakst".publicKey;