nix fmt .
This commit is contained in:
parent
03629e8561
commit
aadf1c170b
@ -1,6 +1,9 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{
|
||||||
|
config,
|
||||||
let
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
gitea_uidgid = 995;
|
gitea_uidgid = 995;
|
||||||
|
|
||||||
tailscale_subnet = {
|
tailscale_subnet = {
|
||||||
@ -16,7 +19,7 @@ let
|
|||||||
ssh_pubkeys = {
|
ssh_pubkeys = {
|
||||||
motiejus = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC+qpaaD+FCYPcUU1ONbw/ff5j0xXu5DNvp/4qZH/vOYwG13uDdfI5ISYPs8zNaVcFuEDgNxWorVPwDw4p6+1JwRLlhO4J/5tE1w8Gt6C7y76LRWnp0rCdva5vL3xMozxYIWVOAiN131eyirV2FdOaqTwPy4ouNMmBFbibLQwBna89tbFMG/jwR7Cxt1I6UiYOuCXIocI5YUbXlsXoK9gr5yBRoTjl2OfH2itGYHz9xQCswvatmqrnteubAbkb6IUFYz184rnlVntuZLwzM99ezcG4v8/485gWkotTkOgQIrGNKgOA7UNKpQNbrwdPAMugqfSTo6g8fEvy0Q+6OXdxw5X7en2TJE+BLVaXp4pVMdOAzKF0nnssn64sRhsrUtFIjNGmOWBOR2gGokaJcM6x9R72qxucuG5054pSibs32BkPEg6Qzp+Bh77C3vUmC94YLVg6pazHhLroYSP1xQjfOvXyLxXB1s9rwJcO+s4kqmInft2weyhfaFE0Bjcoc+1/dKuQYfPCPSB//4zvktxTXud80zwWzMy91Q4ucRrHTBz3PrhO8ys74aSGnKOiG3ccD3HbaT0Ff4qmtIwHcAjrnNlINAcH/A2mpi0/2xA7T8WpFnvgtkQbcMF0kEKGnNS5ULZXP/LC8BlLXxwPdqTzvKikkTb661j4PhJhinhVwnQ==";
|
motiejus = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC+qpaaD+FCYPcUU1ONbw/ff5j0xXu5DNvp/4qZH/vOYwG13uDdfI5ISYPs8zNaVcFuEDgNxWorVPwDw4p6+1JwRLlhO4J/5tE1w8Gt6C7y76LRWnp0rCdva5vL3xMozxYIWVOAiN131eyirV2FdOaqTwPy4ouNMmBFbibLQwBna89tbFMG/jwR7Cxt1I6UiYOuCXIocI5YUbXlsXoK9gr5yBRoTjl2OfH2itGYHz9xQCswvatmqrnteubAbkb6IUFYz184rnlVntuZLwzM99ezcG4v8/485gWkotTkOgQIrGNKgOA7UNKpQNbrwdPAMugqfSTo6g8fEvy0Q+6OXdxw5X7en2TJE+BLVaXp4pVMdOAzKF0nnssn64sRhsrUtFIjNGmOWBOR2gGokaJcM6x9R72qxucuG5054pSibs32BkPEg6Qzp+Bh77C3vUmC94YLVg6pazHhLroYSP1xQjfOvXyLxXB1s9rwJcO+s4kqmInft2weyhfaFE0Bjcoc+1/dKuQYfPCPSB//4zvktxTXud80zwWzMy91Q4ucRrHTBz3PrhO8ys74aSGnKOiG3ccD3HbaT0Ff4qmtIwHcAjrnNlINAcH/A2mpi0/2xA7T8WpFnvgtkQbcMF0kEKGnNS5ULZXP/LC8BlLXxwPdqTzvKikkTb661j4PhJhinhVwnQ==";
|
||||||
vno1_root = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMiWb7yeSeuFCMZWarKJD6ZSxIlpEHbU++MfpOIy/2kh";
|
vno1_root = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMiWb7yeSeuFCMZWarKJD6ZSxIlpEHbU++MfpOIy/2kh";
|
||||||
};
|
};
|
||||||
|
|
||||||
backup_paths = {
|
backup_paths = {
|
||||||
var_lib = {
|
var_lib = {
|
||||||
@ -32,7 +35,7 @@ let
|
|||||||
var_log = {
|
var_log = {
|
||||||
mountpoint = "/var/log";
|
mountpoint = "/var/log";
|
||||||
zfs_name = "rpool/nixos/var/log";
|
zfs_name = "rpool/nixos/var/log";
|
||||||
paths = [ "/var/log/.snapshot-latest/caddy/" ];
|
paths = ["/var/log/.snapshot-latest/caddy/"];
|
||||||
patterns = [
|
patterns = [
|
||||||
"+ /var/log/.snapshot-latest/caddy/access-jakstys.lt.log-*.zst"
|
"+ /var/log/.snapshot-latest/caddy/access-jakstys.lt.log-*.zst"
|
||||||
"- *"
|
"- *"
|
||||||
@ -44,8 +47,11 @@ let
|
|||||||
turn_cert_dir = "/var/lib/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/turn.jakstys.lt";
|
turn_cert_dir = "/var/lib/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/turn.jakstys.lt";
|
||||||
|
|
||||||
# functions
|
# functions
|
||||||
mountLatest = ({mountpoint, zfs_name}:
|
mountLatest = (
|
||||||
''
|
{
|
||||||
|
mountpoint,
|
||||||
|
zfs_name,
|
||||||
|
}: ''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
${pkgs.util-linux}/bin/umount ${mountpoint}/.snapshot-latest &>/dev/null || :
|
${pkgs.util-linux}/bin/umount ${mountpoint}/.snapshot-latest &>/dev/null || :
|
||||||
mkdir -p ${mountpoint}/.snapshot-latest
|
mkdir -p ${mountpoint}/.snapshot-latest
|
||||||
@ -53,29 +59,31 @@ let
|
|||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
umountLatest = ({mountpoint, ...}:
|
umountLatest = (
|
||||||
''set -euo pipefail
|
{mountpoint, ...}: '' set -euo pipefail
|
||||||
${pkgs.util-linux}/bin/umount ${mountpoint}/.snapshot-latest
|
${pkgs.util-linux}/bin/umount ${mountpoint}/.snapshot-latest
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
in {
|
in {
|
||||||
imports =
|
imports = [
|
||||||
[
|
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
./zfs.nix
|
./zfs.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
nixpkgs.overlays = [ (self: super: {
|
nixpkgs.overlays = [
|
||||||
|
(self: super: {
|
||||||
systemd = super.systemd.overrideAttrs (old: {
|
systemd = super.systemd.overrideAttrs (old: {
|
||||||
patches = (old.patches or []) ++ [
|
patches =
|
||||||
|
(old.patches or [])
|
||||||
|
++ [
|
||||||
(super.fetchpatch {
|
(super.fetchpatch {
|
||||||
url = "https://github.com/systemd/systemd/commit/e7f64b896201da4a11da158c35865604cf02062f.patch";
|
url = "https://github.com/systemd/systemd/commit/e7f64b896201da4a11da158c35865604cf02062f.patch";
|
||||||
sha256 = "sha256-AvBkrD9n5ux1o167yKg1eJK8C300vBS/ks3Gbvy5vjw=";
|
sha256 = "sha256-AvBkrD9n5ux1o167yKg1eJK8C300vBS/ks3Gbvy5vjw=";
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
} ) ];
|
})
|
||||||
|
];
|
||||||
|
|
||||||
boot.initrd.network = {
|
boot.initrd.network = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@ -83,7 +91,7 @@ in {
|
|||||||
enable = true;
|
enable = true;
|
||||||
port = 22;
|
port = 22;
|
||||||
authorizedKeys = builtins.attrValues ssh_pubkeys;
|
authorizedKeys = builtins.attrValues ssh_pubkeys;
|
||||||
hostKeys = [ "/etc/secrets/initrd/ssh_host_ed25519_key" ];
|
hostKeys = ["/etc/secrets/initrd/ssh_host_ed25519_key"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -111,9 +119,9 @@ in {
|
|||||||
|
|
||||||
motiejus = {
|
motiejus = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
extraGroups = [ "wheel" ];
|
extraGroups = ["wheel"];
|
||||||
uid = 1000;
|
uid = 1000;
|
||||||
openssh.authorizedKeys.keys = [ ssh_pubkeys.motiejus ];
|
openssh.authorizedKeys.keys = [ssh_pubkeys.motiejus];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -170,7 +178,7 @@ in {
|
|||||||
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHtYsaht57g2sp6UmLHqsCK+fHjiiZ0rmGceFmFt88pY";
|
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHtYsaht57g2sp6UmLHqsCK+fHjiiZ0rmGceFmFt88pY";
|
||||||
};
|
};
|
||||||
"hel1-a.servers.jakst" = {
|
"hel1-a.servers.jakst" = {
|
||||||
extraHostNames = ["hel1-a.jakstys.lt" "git.jakstys.lt" "vpn.jakstys.lt" "jakstys.lt" "www.jakstys.lt" ];
|
extraHostNames = ["hel1-a.jakstys.lt" "git.jakstys.lt" "vpn.jakstys.lt" "jakstys.lt" "www.jakstys.lt"];
|
||||||
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF6Wd2lKrpP2Gqul10obMo2dc1xKaaLv0I4FAnfIaFKu";
|
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF6Wd2lKrpP2Gqul10obMo2dc1xKaaLv0I4FAnfIaFKu";
|
||||||
};
|
};
|
||||||
"mtwork.motiejus.jakst" = {
|
"mtwork.motiejus.jakst" = {
|
||||||
@ -220,20 +228,25 @@ in {
|
|||||||
autosnap = true;
|
autosnap = true;
|
||||||
autoprune = true;
|
autoprune = true;
|
||||||
};
|
};
|
||||||
datasets = lib.mapAttrs' (name: value: {
|
datasets =
|
||||||
|
lib.mapAttrs' (name: value: {
|
||||||
name = value.zfs_name;
|
name = value.zfs_name;
|
||||||
value = { use_template = ["prod"]; };
|
value = {use_template = ["prod"];};
|
||||||
}) backup_paths;
|
})
|
||||||
extraArgs = [ "--verbose" ];
|
backup_paths;
|
||||||
|
extraArgs = ["--verbose"];
|
||||||
};
|
};
|
||||||
|
|
||||||
borgbackup.jobs = lib.mapAttrs' (name: value:
|
borgbackup.jobs = lib.mapAttrs' (name: value: let
|
||||||
let
|
snapshot = {
|
||||||
snapshot = { mountpoint = value.mountpoint; zfs_name = value.zfs_name; };
|
mountpoint = value.mountpoint;
|
||||||
|
zfs_name = value.zfs_name;
|
||||||
|
};
|
||||||
rwpath = value.mountpoint + "/.snapshot-latest";
|
rwpath = value.mountpoint + "/.snapshot-latest";
|
||||||
in {
|
in {
|
||||||
name = name;
|
name = name;
|
||||||
value = {
|
value =
|
||||||
|
{
|
||||||
doInit = true;
|
doInit = true;
|
||||||
repo = "zh2769@zh2769.rsync.net:hel1-a.servers.jakst";
|
repo = "zh2769@zh2769.rsync.net:hel1-a.servers.jakst";
|
||||||
encryption = {
|
encryption = {
|
||||||
@ -244,7 +257,7 @@ in {
|
|||||||
extraArgs = "--remote-path=borg1";
|
extraArgs = "--remote-path=borg1";
|
||||||
compression = "auto,lzma";
|
compression = "auto,lzma";
|
||||||
startAt = value.backup_at;
|
startAt = value.backup_at;
|
||||||
readWritePaths = [ rwpath ];
|
readWritePaths = [rwpath];
|
||||||
preHook = mountLatest snapshot;
|
preHook = mountLatest snapshot;
|
||||||
postHook = umountLatest snapshot;
|
postHook = umountLatest snapshot;
|
||||||
prune.keep = {
|
prune.keep = {
|
||||||
@ -253,12 +266,12 @@ in {
|
|||||||
weekly = 4;
|
weekly = 4;
|
||||||
monthly = 3;
|
monthly = 3;
|
||||||
};
|
};
|
||||||
} // lib.optionalAttrs (value ? patterns) {
|
}
|
||||||
|
// lib.optionalAttrs (value ? patterns) {
|
||||||
patterns = value.patterns;
|
patterns = value.patterns;
|
||||||
};
|
};
|
||||||
}) backup_paths;
|
}) backup_paths;
|
||||||
|
|
||||||
|
|
||||||
headscale = {
|
headscale = {
|
||||||
enable = true;
|
enable = true;
|
||||||
serverUrl = "https://vpn.jakstys.lt";
|
serverUrl = "https://vpn.jakstys.lt";
|
||||||
@ -273,7 +286,7 @@ in {
|
|||||||
"fd7a:115c:a1e0:59b0::/64"
|
"fd7a:115c:a1e0:59b0::/64"
|
||||||
];
|
];
|
||||||
dns_config = {
|
dns_config = {
|
||||||
nameservers = [ "1.1.1.1" "8.8.4.4" ];
|
nameservers = ["1.1.1.1" "8.8.4.4"];
|
||||||
magic_dns = true;
|
magic_dns = true;
|
||||||
base_domain = "jakst";
|
base_domain = "jakst";
|
||||||
};
|
};
|
||||||
@ -404,7 +417,7 @@ in {
|
|||||||
enable_registration = false;
|
enable_registration = false;
|
||||||
report_stats = true;
|
report_stats = true;
|
||||||
signing_key_path = "/run/matrix-synapse/jakstys.lt.signing.key";
|
signing_key_path = "/run/matrix-synapse/jakstys.lt.signing.key";
|
||||||
extraConfigFiles = [ "/run/matrix-synapse/secrets.yaml" ];
|
extraConfigFiles = ["/run/matrix-synapse/secrets.yaml"];
|
||||||
log_config = pkgs.writeText "log.config" ''
|
log_config = pkgs.writeText "log.config" ''
|
||||||
version: 1
|
version: 1
|
||||||
formatters:
|
formatters:
|
||||||
@ -442,11 +455,31 @@ in {
|
|||||||
federation_rc_concurrent = 3;
|
federation_rc_concurrent = 3;
|
||||||
allow_profile_lookup_over_federation = false;
|
allow_profile_lookup_over_federation = false;
|
||||||
thumbnail_sizes = [
|
thumbnail_sizes = [
|
||||||
{ width = 32; height = 32; method = "crop"; }
|
{
|
||||||
{ width = 96; height = 96; method = "crop"; }
|
width = 32;
|
||||||
{ width = 320; height = 240; method = "scale"; }
|
height = 32;
|
||||||
{ width = 640; height = 480; method = "scale"; }
|
method = "crop";
|
||||||
{ width = 800; height = 600; method = "scale"; }
|
}
|
||||||
|
{
|
||||||
|
width = 96;
|
||||||
|
height = 96;
|
||||||
|
method = "crop";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
width = 320;
|
||||||
|
height = 240;
|
||||||
|
method = "scale";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
width = 640;
|
||||||
|
height = 480;
|
||||||
|
method = "scale";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
width = 800;
|
||||||
|
height = 600;
|
||||||
|
method = "scale";
|
||||||
|
}
|
||||||
];
|
];
|
||||||
user_directory = {
|
user_directory = {
|
||||||
enabled = true;
|
enabled = true;
|
||||||
@ -469,7 +502,7 @@ in {
|
|||||||
postfix = {
|
postfix = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableSmtp = true;
|
enableSmtp = true;
|
||||||
networks = [ "127.0.0.1/8" "[::ffff:127.0.0.0]/104" "[::1]/128" tailscale_subnet.cidr ];
|
networks = ["127.0.0.1/8" "[::ffff:127.0.0.0]/104" "[::1]/128" tailscale_subnet.cidr];
|
||||||
hostname = "${config.networking.hostName}.${config.networking.domain}";
|
hostname = "${config.networking.hostName}.${config.networking.domain}";
|
||||||
relayHost = "smtp.sendgrid.net";
|
relayHost = "smtp.sendgrid.net";
|
||||||
relayPort = 587;
|
relayPort = 587;
|
||||||
@ -551,23 +584,30 @@ in {
|
|||||||
semantic-checks: on
|
semantic-checks: on
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "hel1-a";
|
hostName = "hel1-a";
|
||||||
domain = "jakstys.lt";
|
domain = "jakstys.lt";
|
||||||
firewall = let
|
firewall = let
|
||||||
coturn = with config.services.coturn; [ { from = min-port; to = max-port; } ];
|
coturn = with config.services.coturn; [
|
||||||
|
{
|
||||||
|
from = min-port;
|
||||||
|
to = max-port;
|
||||||
|
}
|
||||||
|
];
|
||||||
in {
|
in {
|
||||||
allowedTCPPorts = [
|
allowedTCPPorts = [
|
||||||
53
|
53
|
||||||
80 443
|
80
|
||||||
3478 5349 5350 # coturn
|
443
|
||||||
|
3478
|
||||||
|
5349
|
||||||
|
5350 # coturn
|
||||||
];
|
];
|
||||||
allowedUDPPorts = [
|
allowedUDPPorts = [
|
||||||
53 443
|
53
|
||||||
|
443
|
||||||
41641
|
41641
|
||||||
];
|
];
|
||||||
allowedUDPPortRanges = coturn;
|
allowedUDPPortRanges = coturn;
|
||||||
@ -602,7 +642,8 @@ in {
|
|||||||
"d /run/matrix-synapse 0700 matrix-synapse matrix-synapse -"
|
"d /run/matrix-synapse 0700 matrix-synapse matrix-synapse -"
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.services = {
|
systemd.services =
|
||||||
|
{
|
||||||
"make-snapshot-dirs" = let
|
"make-snapshot-dirs" = let
|
||||||
vals = builtins.attrValues backup_paths;
|
vals = builtins.attrValues backup_paths;
|
||||||
mountpoints = builtins.catAttrs "mountpoint" vals;
|
mountpoints = builtins.catAttrs "mountpoint" vals;
|
||||||
@ -646,7 +687,7 @@ in {
|
|||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
in {
|
in {
|
||||||
serviceConfig.ExecStartPre = [ "" secretsScript ];
|
serviceConfig.ExecStartPre = ["" secretsScript];
|
||||||
serviceConfig.LoadCredential = [
|
serviceConfig.LoadCredential = [
|
||||||
"jakstys.lt.signing.key:/var/src/secrets/synapse/jakstys.lt.signing.key"
|
"jakstys.lt.signing.key:/var/src/secrets/synapse/jakstys.lt.signing.key"
|
||||||
"registration_shared_secret:/var/src/secrets/synapse/registration_shared_secret"
|
"registration_shared_secret:/var/src/secrets/synapse/registration_shared_secret"
|
||||||
@ -700,14 +741,14 @@ in {
|
|||||||
|
|
||||||
zfs-scrub.unitConfig.OnFailure = "unit-status-mail@zfs-scrub.service";
|
zfs-scrub.unitConfig.OnFailure = "unit-status-mail@zfs-scrub.service";
|
||||||
nixos-upgrade.unitConfig.OnFailure = "unit-status-mail@nixos-upgrade.service";
|
nixos-upgrade.unitConfig.OnFailure = "unit-status-mail@nixos-upgrade.service";
|
||||||
|
}
|
||||||
} // lib.mapAttrs' (name: value: {
|
// lib.mapAttrs' (name: value: {
|
||||||
name = "borgbackup-job-${name}";
|
name = "borgbackup-job-${name}";
|
||||||
value = {
|
value = {
|
||||||
unitConfig.OnFailure = "unit-status-mail@borgbackup-job-${name}.service";
|
unitConfig.OnFailure = "unit-status-mail@borgbackup-job-${name}.service";
|
||||||
};
|
};
|
||||||
}) backup_paths;
|
})
|
||||||
|
backup_paths;
|
||||||
|
|
||||||
systemd.paths = {
|
systemd.paths = {
|
||||||
cert-watcher = {
|
cert-watcher = {
|
||||||
@ -722,4 +763,3 @@ in {
|
|||||||
# Do not change
|
# Do not change
|
||||||
system.stateVersion = "22.11";
|
system.stateVersion = "22.11";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
25
flake.nix
25
flake.nix
@ -9,10 +9,15 @@
|
|||||||
deploy-rs.inputs.utils.follows = "flake-utils";
|
deploy-rs.inputs.utils.follows = "flake-utils";
|
||||||
|
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, deploy-rs, flake-utils }: {
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
deploy-rs,
|
||||||
|
flake-utils,
|
||||||
|
}:
|
||||||
|
{
|
||||||
nixosConfigurations.hel1-a = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.hel1-a = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
@ -36,15 +41,15 @@
|
|||||||
|
|
||||||
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:
|
// flake-utils.lib.eachDefaultSystem (system: let
|
||||||
let
|
pkgs = import nixpkgs {inherit system;};
|
||||||
pkgs = import nixpkgs { inherit system; };
|
in {
|
||||||
in
|
devShells.default = with pkgs;
|
||||||
{
|
mkShell {
|
||||||
devShells.default = with pkgs; mkShell {
|
|
||||||
name = "rules_nixpkgs_shell";
|
name = "rules_nixpkgs_shell";
|
||||||
packages = [ bash ];
|
packages = [bash];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
formatter = pkgs.alejandra;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,43 +1,51 @@
|
|||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
imports =
|
config,
|
||||||
[ (modulesPath + "/profiles/qemu-guest.nix") ];
|
lib,
|
||||||
boot.initrd.availableKernelModules = [ "ata_piix" "virtio_pci" "virtio_scsi" "xhci_pci" "sd_mod" "sr_mod" ];
|
pkgs,
|
||||||
boot.initrd.kernelModules = [ ];
|
modulesPath,
|
||||||
boot.kernelModules = [ ];
|
...
|
||||||
boot.extraModulePackages = [ ];
|
}: {
|
||||||
|
imports = [(modulesPath + "/profiles/qemu-guest.nix")];
|
||||||
|
boot.initrd.availableKernelModules = ["ata_piix" "virtio_pci" "virtio_scsi" "xhci_pci" "sd_mod" "sr_mod"];
|
||||||
|
boot.initrd.kernelModules = [];
|
||||||
|
boot.kernelModules = [];
|
||||||
|
boot.extraModulePackages = [];
|
||||||
|
|
||||||
fileSystems."/" =
|
fileSystems."/" = {
|
||||||
{ device = "rpool/nixos/root";
|
device = "rpool/nixos/root";
|
||||||
fsType = "zfs"; options = [ "zfsutil" "X-mount.mkdir" ];
|
fsType = "zfs";
|
||||||
|
options = ["zfsutil" "X-mount.mkdir"];
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/home" =
|
fileSystems."/home" = {
|
||||||
{ device = "rpool/nixos/home";
|
device = "rpool/nixos/home";
|
||||||
fsType = "zfs"; options = [ "zfsutil" "X-mount.mkdir" ];
|
fsType = "zfs";
|
||||||
|
options = ["zfsutil" "X-mount.mkdir"];
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/var/lib" =
|
fileSystems."/var/lib" = {
|
||||||
{ device = "rpool/nixos/var/lib";
|
device = "rpool/nixos/var/lib";
|
||||||
fsType = "zfs"; options = [ "zfsutil" "X-mount.mkdir" ];
|
fsType = "zfs";
|
||||||
|
options = ["zfsutil" "X-mount.mkdir"];
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/var/log" =
|
fileSystems."/var/log" = {
|
||||||
{ device = "rpool/nixos/var/log";
|
device = "rpool/nixos/var/log";
|
||||||
fsType = "zfs"; options = [ "zfsutil" "X-mount.mkdir" ];
|
fsType = "zfs";
|
||||||
|
options = ["zfsutil" "X-mount.mkdir"];
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/boot" =
|
fileSystems."/boot" = {
|
||||||
{ device = "bpool/nixos/root";
|
device = "bpool/nixos/root";
|
||||||
fsType = "zfs"; options = [ "zfsutil" "X-mount.mkdir" ];
|
fsType = "zfs";
|
||||||
|
options = ["zfsutil" "X-mount.mkdir"];
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/boot/efis/scsi-0QEMU_QEMU_HARDDISK_9233346-part1" =
|
fileSystems."/boot/efis/scsi-0QEMU_QEMU_HARDDISK_9233346-part1" = {
|
||||||
{ device = "/dev/disk/by-uuid/B6D7-D52E";
|
device = "/dev/disk/by-uuid/B6D7-D52E";
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -47,7 +55,7 @@
|
|||||||
# options = [ "bind" ];
|
# options = [ "bind" ];
|
||||||
# };
|
# };
|
||||||
|
|
||||||
swapDevices = [ { device = "/dev/disk/by-uuid/03ebe703-aa24-4ee5-a7c3-f8614ee779b0"; } ];
|
swapDevices = [{device = "/dev/disk/by-uuid/03ebe703-aa24-4ee5-a7c3-f8614ee779b0";}];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
@ -15,11 +15,12 @@ let
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
in {
|
in {
|
||||||
hel1a = pkgs.krops.writeDeploy "deploy-hel1a" {
|
hel1a = pkgs.krops.writeDeploy "deploy-hel1a" {
|
||||||
source = source;
|
source = source;
|
||||||
target = lib.mkTarget "motiejus@hel1-a.jakstys.lt" // {
|
target =
|
||||||
|
lib.mkTarget "motiejus@hel1-a.jakstys.lt"
|
||||||
|
// {
|
||||||
sudo = true;
|
sudo = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -3,4 +3,4 @@ let
|
|||||||
spec = lock.nodes.nixpkgs.locked;
|
spec = lock.nodes.nixpkgs.locked;
|
||||||
nixpkgs = fetchTarball "https://github.com/${spec.owner}/${spec.repo}/archive/${spec.rev}.tar.gz";
|
nixpkgs = fetchTarball "https://github.com/${spec.owner}/${spec.repo}/archive/${spec.rev}.tar.gz";
|
||||||
in
|
in
|
||||||
import nixpkgs
|
import nixpkgs
|
||||||
|
61
zfs.nix
61
zfs.nix
@ -1,34 +1,37 @@
|
|||||||
{ config, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
{ boot.supportedFilesystems = [ "zfs" ];
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
boot.supportedFilesystems = ["zfs"];
|
||||||
networking.hostId = "cd1a441c";
|
networking.hostId = "cd1a441c";
|
||||||
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
|
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
|
||||||
boot.loader.efi.efiSysMountPoint = "/boot/efi";
|
boot.loader.efi.efiSysMountPoint = "/boot/efi";
|
||||||
boot.loader.efi.canTouchEfiVariables = false;
|
boot.loader.efi.canTouchEfiVariables = false;
|
||||||
boot.loader.generationsDir.copyKernels = true;
|
boot.loader.generationsDir.copyKernels = true;
|
||||||
boot.loader.grub.efiInstallAsRemovable = true;
|
boot.loader.grub.efiInstallAsRemovable = true;
|
||||||
boot.loader.grub.enable = true;
|
boot.loader.grub.enable = true;
|
||||||
boot.loader.grub.version = 2;
|
boot.loader.grub.version = 2;
|
||||||
boot.loader.grub.copyKernels = true;
|
boot.loader.grub.copyKernels = true;
|
||||||
boot.loader.grub.efiSupport = true;
|
boot.loader.grub.efiSupport = true;
|
||||||
boot.loader.grub.zfsSupport = true;
|
boot.loader.grub.zfsSupport = true;
|
||||||
#boot.loader.grub.extraPrepareConfig = ''
|
#boot.loader.grub.extraPrepareConfig = ''
|
||||||
# mkdir -p /boot/efis
|
# mkdir -p /boot/efis
|
||||||
# for i in /boot/efis/*; do mount $i ; done
|
# for i in /boot/efis/*; do mount $i ; done
|
||||||
#
|
#
|
||||||
# mkdir -p /boot/efi
|
# mkdir -p /boot/efi
|
||||||
# mount /boot/efi
|
# mount /boot/efi
|
||||||
#'';
|
#'';
|
||||||
#boot.loader.grub.extraInstallCommands = ''
|
#boot.loader.grub.extraInstallCommands = ''
|
||||||
#ESP_MIRROR=$(mktemp -d)
|
#ESP_MIRROR=$(mktemp -d)
|
||||||
#cp -r /boot/efi/EFI $ESP_MIRROR
|
#cp -r /boot/efi/EFI $ESP_MIRROR
|
||||||
#for i in /boot/efis/*; do
|
#for i in /boot/efis/*; do
|
||||||
# cp -r $ESP_MIRROR/EFI $i
|
# cp -r $ESP_MIRROR/EFI $i
|
||||||
#done
|
#done
|
||||||
#rm -rf $ESP_MIRROR
|
#rm -rf $ESP_MIRROR
|
||||||
#'';
|
#'';
|
||||||
boot.loader.grub.devices = [
|
boot.loader.grub.devices = [
|
||||||
"/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_9233346"
|
"/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_9233346"
|
||||||
];
|
];
|
||||||
users.users.root.initialHashedPassword = "$6$oXLEcliXQJloPkrW$Or3O2tLdpLMs4s4gyn2hJlvMjm0S7zLlFlQCOx.S3fdLKxyFjQFaLhPZXJPluZ7iYrB65JSdT0ESluFwgJwLi.";
|
users.users.root.initialHashedPassword = "$6$oXLEcliXQJloPkrW$Or3O2tLdpLMs4s4gyn2hJlvMjm0S7zLlFlQCOx.S3fdLKxyFjQFaLhPZXJPluZ7iYrB65JSdT0ESluFwgJwLi.";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user