global/general: replace ensure with systemd tmpfiles
This commit is contained in:
parent
6cfbf62470
commit
d09fc8a2b2
3 changed files with 5 additions and 25 deletions
|
@ -1,21 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
with lib.our;
|
||||
let
|
||||
cfg = config.services.ensure;
|
||||
in
|
||||
{
|
||||
options.services.ensure = with types; {
|
||||
enable = mkBoolOpt true;
|
||||
directories = mkOpt (listOf str) [ ];
|
||||
};
|
||||
|
||||
config.systemd.services = {
|
||||
"ensure-directories" = mkIf (cfg.enable && (length cfg.directories > 0)) {
|
||||
description = "Ensures certain directories exist (${concatStringsSep "," cfg.directories})";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = "mkdir -p ${concatStringsSep " " cfg.directories}";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -13,13 +13,15 @@
|
|||
# Enable Early Out of Memory service
|
||||
earlyoom.enable = true;
|
||||
|
||||
# Ensure certain necessary directories always exist
|
||||
ensure.directories = [ "/mnt" ];
|
||||
|
||||
# Accept EULA for all minecraft servers
|
||||
minecraft-servers.eula = true;
|
||||
};
|
||||
|
||||
# Ensure certain necessary directories always exist
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /mnt 0777 root root - -"
|
||||
];
|
||||
|
||||
system.activationScripts = {
|
||||
# FIX: command-not-found database doesn't exist normally
|
||||
# FIXME: activation script doesn't work properly, and frequently errors
|
||||
|
|
|
@ -43,7 +43,6 @@ The real meat of the configuration, defines a bunch of NixOS modules that all ge
|
|||
|
||||
Modules that create some sort of new functionality.
|
||||
|
||||
- `ensure.nix`: Takes a list of directories, and ensures they exist after boot.
|
||||
- `soft-serve.nix`: Runs the `soft-serve` git server.
|
||||
- `ssh-tunnel.nix`: Runs an SSH session for opening ports.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue