Add cloudflare ddns
This commit is contained in:
@@ -17,6 +17,10 @@
|
||||
|
||||
programs.fish.enable = true;
|
||||
programs.tmux.enable = true;
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
};
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "Europe/London";
|
||||
@@ -34,7 +38,8 @@
|
||||
shell = pkgs.fish;
|
||||
extraGroups = [ "wheel" ];
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJFUwk54CNtSLUyXSTLsIs5KXgEsjOgE4HGlA4FacKjV syed@tardis"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJFUwk54CNtSLUyXSTLsIs5KXgEsjOgE4HGlA4FacKjV syed@tardis # msi laptop"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILMeU7L0yQ4+O1GME4D4UM4f6nqua+pWt/zdsMvyHV94 u0_a309@localhost # mobile"
|
||||
];
|
||||
packages = with pkgs; [];
|
||||
};
|
||||
@@ -42,11 +47,12 @@
|
||||
# List packages installed in system profile.
|
||||
# You can use https://search.nixos.org/ to find more packages (and options).
|
||||
environment.systemPackages = with pkgs; [
|
||||
sops
|
||||
age
|
||||
eza
|
||||
yazi
|
||||
gitui
|
||||
bind
|
||||
neovim
|
||||
wget
|
||||
curl
|
||||
stow
|
||||
|
||||
Generated
+36
-1
@@ -16,9 +16,44 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1775888245,
|
||||
"narHash": "sha256-nwASzrRDD1JBEu/o8ekKYEXm/oJW6EMCzCRdrwcLe90=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "13043924aaa7375ce482ebe2494338e058282925",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
"nixpkgs": "nixpkgs",
|
||||
"sops-nix": "sops-nix"
|
||||
}
|
||||
},
|
||||
"sops-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1782165805,
|
||||
"narHash": "sha256-478kKQBvK6SYTOdN2h9jhKJv94nbXRbFMfuL1WshErg=",
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"rev": "56b24064fdcaedca53553b1a6d607fd23b613a24",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
+13
-3
@@ -1,11 +1,21 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
|
||||
sops-nix.url = "github:Mic92/sops-nix";
|
||||
};
|
||||
outputs = inputs@{ self, nixpkgs, ... }: {
|
||||
|
||||
outputs = inputs@{ self, nixpkgs, sops-nix, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
in {
|
||||
nixosConfigurations.syedm = nixpkgs.lib.nixosSystem {
|
||||
modules = [ ./configuration.nix ];
|
||||
inherit system;
|
||||
|
||||
modules = [
|
||||
./configuration.nix
|
||||
sops-nix.nixosModules.sops
|
||||
./flakes/cloudflare-ddns.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
script = pkgs.substituteAll {
|
||||
src = ../../scripts/cloudflare-ddns.sh;
|
||||
|
||||
bash = pkgs.bash;
|
||||
curl = pkgs.curl;
|
||||
jq = pkgs.jq;
|
||||
};
|
||||
|
||||
cloudflare-ddns = pkgs.writeShellScriptBin "cloudflare-ddns" (builtins.readFile script);
|
||||
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [ cloudflare-ddns ];
|
||||
|
||||
systemd.services.cloudflare-ddns = {
|
||||
description = "Cloudflare DDNS updater";
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "root";
|
||||
};
|
||||
|
||||
script = "${cloudflare-ddns}/bin/cloudflare-ddns";
|
||||
};
|
||||
|
||||
systemd.timers.cloudflare-ddns = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
|
||||
timerConfig = {
|
||||
OnBootSec = "2min";
|
||||
OnUnitActiveSec = "5min";
|
||||
Persistent = true;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /var/lib/cloudflare-ddns 0750 root root -"
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user