mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-04-18 18:19:12 +00:00
Format the files through nixfmt
This commit is contained in:
parent
d0a87597c5
commit
7db21c9fc5
@ -79,7 +79,10 @@
|
|||||||
|
|
||||||
# Set several binary caches.
|
# Set several binary caches.
|
||||||
nix = {
|
nix = {
|
||||||
binaryCaches = [ "https://nix-community.cachix.org" "https://foo-dogsquared.cachix.org" ];
|
binaryCaches = [
|
||||||
|
"https://nix-community.cachix.org"
|
||||||
|
"https://foo-dogsquared.cachix.org"
|
||||||
|
];
|
||||||
binaryCachePublicKeys = [
|
binaryCachePublicKeys = [
|
||||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||||
"foo-dogsquared.cachix.org-1:/2fmqn/gLGvCs5EDeQmqwtus02TUmGy0ZlAEXqRE70E="
|
"foo-dogsquared.cachix.org-1:/2fmqn/gLGvCs5EDeQmqwtus02TUmGy0ZlAEXqRE70E="
|
||||||
@ -158,7 +161,9 @@
|
|||||||
|
|
||||||
# The development environment for this flake.
|
# The development environment for this flake.
|
||||||
devShell = forAllSystems (system:
|
devShell = forAllSystems (system:
|
||||||
import ./shell.nix { pkgs = import nixpkgs { inherit system overlays; }; });
|
import ./shell.nix {
|
||||||
|
pkgs = import nixpkgs { inherit system overlays; };
|
||||||
|
});
|
||||||
|
|
||||||
# My several development shells for usual type of projects. This is much
|
# My several development shells for usual type of projects. This is much
|
||||||
# more preferable than installing all of the packages at the system
|
# more preferable than installing all of the packages at the system
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
{ config, options, lib, pkgs, ... }:
|
{ config, options, lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let cfg = config.services.archivebox;
|
||||||
cfg = config.services.archivebox;
|
|
||||||
in {
|
in {
|
||||||
options.services.archivebox = {
|
options.services.archivebox = {
|
||||||
enable = lib.mkEnableOption "Archivebox service";
|
enable = lib.mkEnableOption "Archivebox service";
|
||||||
@ -31,7 +30,9 @@ in {
|
|||||||
Install.WantedBy = [ "graphical-session.target" ];
|
Install.WantedBy = [ "graphical-session.target" ];
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
ExecStart = "${pkgs.archivebox}/bin/archivebox server localhost:${toString cfg.port}";
|
ExecStart = "${pkgs.archivebox}/bin/archivebox server localhost:${
|
||||||
|
toString cfg.port
|
||||||
|
}";
|
||||||
WorkingDirectory = cfg.archivePath;
|
WorkingDirectory = cfg.archivePath;
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
};
|
};
|
||||||
|
@ -35,8 +35,7 @@ in {
|
|||||||
"google_toolbar.search_history"
|
"google_toolbar.search_history"
|
||||||
"thumbnails.cache"
|
"thumbnails.cache"
|
||||||
"zoom.logs"
|
"zoom.logs"
|
||||||
]
|
] ++ lib.optionals cfg.withBrowserCleanup [
|
||||||
++ lib.optionals cfg.withBrowserCleanup [
|
|
||||||
"brave.cache"
|
"brave.cache"
|
||||||
"brave.form_history"
|
"brave.form_history"
|
||||||
"brave.history"
|
"brave.history"
|
||||||
@ -68,7 +67,8 @@ in {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
withBrowserCleanup = lib.mkEnableOption "browser-related cleaners to be included in the list";
|
withBrowserCleanup =
|
||||||
|
lib.mkEnableOption "browser-related cleaners to be included in the list";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
@ -26,9 +26,10 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extensionPackages = lib.mkOption {
|
extensionPackages = lib.mkOption {
|
||||||
default = [];
|
default = [ ];
|
||||||
type = with lib.types; listOf package;
|
type = with lib.types; listOf package;
|
||||||
example = lib.literalExpression "with pkgs; [ mopidy-spotify mopidy-mpd mopidy-mpris ]";
|
example = lib.literalExpression
|
||||||
|
"with pkgs; [ mopidy-spotify mopidy-mpd mopidy-mpris ]";
|
||||||
description = ''
|
description = ''
|
||||||
Mopidy extensions that should be loaded by the service.
|
Mopidy extensions that should be loaded by the service.
|
||||||
'';
|
'';
|
||||||
@ -42,7 +43,7 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extraConfigFiles = lib.mkOption {
|
extraConfigFiles = lib.mkOption {
|
||||||
default = [];
|
default = [ ];
|
||||||
type = with lib.types; listOf str;
|
type = with lib.types; listOf str;
|
||||||
description = ''
|
description = ''
|
||||||
Extra config files to be read to the service.
|
Extra config files to be read to the service.
|
||||||
@ -53,7 +54,8 @@ in {
|
|||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
assertions = [
|
assertions = [
|
||||||
(lib.hm.assertions.assertPlatform "services.mopidy" pkgs lib.platforms.linux)
|
(lib.hm.assertions.assertPlatform "services.mopidy" pkgs
|
||||||
|
lib.platforms.linux)
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.user.services.mopidy = {
|
systemd.user.services.mopidy = {
|
||||||
@ -64,7 +66,9 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
ExecStart = "${mopidyEnv}/bin/mopidy --config ${lib.concatStringsSep ":" ([mopidyConf] ++ cfg.extraConfigFiles)}";
|
ExecStart = "${mopidyEnv}/bin/mopidy --config ${
|
||||||
|
lib.concatStringsSep ":" ([ mopidyConf ] ++ cfg.extraConfigFiles)
|
||||||
|
}";
|
||||||
};
|
};
|
||||||
|
|
||||||
Install.WantedBy = [ "default.target" ];
|
Install.WantedBy = [ "default.target" ];
|
||||||
@ -78,7 +82,9 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
ExecStart = "${mopidyEnv}/bin/mopidy --config ${lib.concatStringsSep ":" ([mopidyConf] ++ cfg.extraConfigFiles)} local scan";
|
ExecStart = "${mopidyEnv}/bin/mopidy --config ${
|
||||||
|
lib.concatStringsSep ":" ([ mopidyConf ] ++ cfg.extraConfigFiles)
|
||||||
|
} local scan";
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -135,12 +135,11 @@ in {
|
|||||||
|
|
||||||
# I try to avoid using Wine on NixOS because most of them uses FHS or something and I just want it to work but here goes.
|
# I try to avoid using Wine on NixOS because most of them uses FHS or something and I just want it to work but here goes.
|
||||||
(lib.mkIf cfg.wine.enable {
|
(lib.mkIf cfg.wine.enable {
|
||||||
environment.systemPackages = with pkgs;
|
environment.systemPackages = with pkgs; [
|
||||||
[
|
cfg.wine.package # The star of the show.
|
||||||
cfg.wine.package # The star of the show.
|
winetricks # We do a little trickery with missing Windows runtimes.
|
||||||
winetricks # We do a little trickery with missing Windows runtimes.
|
bottles # PlayOnLinux but better. :)
|
||||||
bottles # PlayOnLinux but better. :)
|
];
|
||||||
];
|
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,9 @@ in {
|
|||||||
options.services.borgmatic = {
|
options.services.borgmatic = {
|
||||||
jobs = lib.mkOption {
|
jobs = lib.mkOption {
|
||||||
type = with lib.types; attrsOf (submodule jobOption);
|
type = with lib.types; attrsOf (submodule jobOption);
|
||||||
description = "borgmatic jobs with each bearing a configuration file to be used.";
|
description =
|
||||||
default = {};
|
"borgmatic jobs with each bearing a configuration file to be used.";
|
||||||
|
default = { };
|
||||||
example = {
|
example = {
|
||||||
external-hard-drive = {
|
external-hard-drive = {
|
||||||
startAt = "daily";
|
startAt = "daily";
|
||||||
@ -42,59 +43,56 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
systemd.services = (lib.mapAttrs'
|
systemd.services = (lib.mapAttrs' (name: settings:
|
||||||
(name: settings:
|
lib.nameValuePair ("borgmatic-backup-" + name) ({
|
||||||
lib.nameValuePair
|
unitConfig = {
|
||||||
("borgmatic-backup-" + name)
|
Description = "Backup with Borgmatic job '${name}'";
|
||||||
({
|
Wants = [ "network-online.target" ];
|
||||||
unitConfig = {
|
After = [ "network-online.target" ];
|
||||||
Description = "Backup with Borgmatic job '${name}'";
|
};
|
||||||
Wants = [ "network-online.target" ];
|
|
||||||
After = [ "network-online.target" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
startAt = settings.startAt;
|
startAt = settings.startAt;
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
# Delay start to prevent backups running during boot. Note that systemd-inhibit requires dbus and
|
# Delay start to prevent backups running during boot. Note that systemd-inhibit requires dbus and
|
||||||
# dbus-user-session to be installed.
|
# dbus-user-session to be installed.
|
||||||
ExecStartPre = "${pkgs.coreutils}/bin/sleep 1m";
|
ExecStartPre = "${pkgs.coreutils}/bin/sleep 1m";
|
||||||
ExecStart = ''
|
ExecStart = ''
|
||||||
${pkgs.systemd}/bin/systemd-inhibit --who="borgmatic" --why="Prevent interrupting scheduled backup" ${pkgs.borgmatic}/bin/borgmatic --verbosity -1 --syslog-verbosity 1 --config ${settings.configPath}
|
${pkgs.systemd}/bin/systemd-inhibit --who="borgmatic" --why="Prevent interrupting scheduled backup" ${pkgs.borgmatic}/bin/borgmatic --verbosity -1 --syslog-verbosity 1 --config ${settings.configPath}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Set security-related stuff.
|
# Set security-related stuff.
|
||||||
LockPersonality = "true";
|
LockPersonality = "true";
|
||||||
ProtectSystem = "full";
|
ProtectSystem = "full";
|
||||||
MemoryDenyWriteExecute = "no";
|
MemoryDenyWriteExecute = "no";
|
||||||
NoNewPrivileges = "yes";
|
NoNewPrivileges = "yes";
|
||||||
PrivateDevices = "yes";
|
PrivateDevices = "yes";
|
||||||
PrivateTmp = "yes";
|
PrivateTmp = "yes";
|
||||||
ProtectClock = "yes";
|
ProtectClock = "yes";
|
||||||
ProtectControlGroups = "yes";
|
ProtectControlGroups = "yes";
|
||||||
ProtectHostname = "yes";
|
ProtectHostname = "yes";
|
||||||
ProtectKernelLogs = "yes";
|
ProtectKernelLogs = "yes";
|
||||||
ProtectKernelModules = "yes";
|
ProtectKernelModules = "yes";
|
||||||
ProtectKernelTunables = "yes";
|
ProtectKernelTunables = "yes";
|
||||||
RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6 AF_NETLINK";
|
RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6 AF_NETLINK";
|
||||||
RestrictNamespaces = "yes";
|
RestrictNamespaces = "yes";
|
||||||
RestrictRealtime = "yes";
|
RestrictRealtime = "yes";
|
||||||
RestrictSUIDSGID = "yes";
|
RestrictSUIDSGID = "yes";
|
||||||
SystemCallArchitectures = "native";
|
SystemCallArchitectures = "native";
|
||||||
SystemCallFilter = "@system-service";
|
SystemCallFilter = "@system-service";
|
||||||
SystemCallErrorNumber = "EPERM";
|
SystemCallErrorNumber = "EPERM";
|
||||||
CapabilityBoundingSet = "CAP_DAC_READ_SEARCH CAP_NET_RAW";
|
CapabilityBoundingSet = "CAP_DAC_READ_SEARCH CAP_NET_RAW";
|
||||||
|
|
||||||
# Lower CPU and I/O priority.
|
# Lower CPU and I/O priority.
|
||||||
Nice = 19;
|
Nice = 19;
|
||||||
CPUSchedulingPolicy = "batch";
|
CPUSchedulingPolicy = "batch";
|
||||||
IOSchedulingClass = "best-effort";
|
IOSchedulingClass = "best-effort";
|
||||||
IOSchedulingPriority = 7;
|
IOSchedulingPriority = 7;
|
||||||
IOWeight = 100;
|
IOWeight = 100;
|
||||||
|
|
||||||
# Prevent rate limiting of borgmatic log events. If you are using an older version of systemd that
|
# Prevent rate limiting of borgmatic log events. If you are using an older version of systemd that
|
||||||
# doesn't support this (pre-240 or so), you may have to remove this option.
|
# doesn't support this (pre-240 or so), you may have to remove this option.
|
||||||
LogRateLimitIntervalSec = "0";
|
LogRateLimitIntervalSec = "0";
|
||||||
};
|
};
|
||||||
})) cfg.jobs);
|
})) cfg.jobs);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user