Skip to content

Commit

Permalink
nixos/modules/virtualisation/digital-ocean-init.nix: remove with lib;
Browse files Browse the repository at this point in the history
  • Loading branch information
Stunkymonkey committed Nov 24, 2024
1 parent 9d9266b commit 847e7c8
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions nixos/modules/virtualisation/digital-ocean-init.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.virtualisation.digitalOcean;
defaultConfigFile = pkgs.writeText "digitalocean-configuration.nix" ''
Expand All @@ -11,16 +10,16 @@ let
}
'';
in {
options.virtualisation.digitalOcean.rebuildFromUserData = mkOption {
type = types.bool;
options.virtualisation.digitalOcean.rebuildFromUserData = lib.mkOption {
type = lib.types.bool;
default = true;
example = true;
description = "Whether to reconfigure the system from Digital Ocean user data";
};
options.virtualisation.digitalOcean.defaultConfigFile = mkOption {
type = types.path;
options.virtualisation.digitalOcean.defaultConfigFile = lib.mkOption {
type = lib.types.path;
default = defaultConfigFile;
defaultText = literalMD ''
defaultText = lib.literalMD ''
The default configuration imports user-data if applicable and
`(modulesPath + "/virtualisation/digital-ocean-config.nix")`.
'';
Expand All @@ -32,7 +31,7 @@ in {
};

config = {
systemd.services.digitalocean-init = mkIf cfg.rebuildFromUserData {
systemd.services.digitalocean-init = lib.mkIf cfg.rebuildFromUserData {
description = "Reconfigure the system from Digital Ocean userdata on startup";
wantedBy = [ "network-online.target" ];
unitConfig = {
Expand All @@ -49,7 +48,7 @@ in {
path = [ pkgs.jq pkgs.gnused pkgs.gnugrep config.systemd.package config.nix.package config.system.build.nixos-rebuild ];
environment = {
HOME = "/root";
NIX_PATH = concatStringsSep ":" [
NIX_PATH = lib.concatStringsSep ":" [
"/nix/var/nix/profiles/per-user/root/channels/nixos"
"nixos-config=/etc/nixos/configuration.nix"
"/nix/var/nix/profiles/per-user/root/channels"
Expand Down Expand Up @@ -91,5 +90,5 @@ in {
'';
};
};
meta.maintainers = with maintainers; [ arianvp eamsden ];
meta.maintainers = with lib.maintainers; [ arianvp eamsden ];
}

0 comments on commit 847e7c8

Please sign in to comment.