From e754de605120cf1d3d28852d54d427fd7848dfc3 Mon Sep 17 00:00:00 2001 From: Malte Brandy Date: Wed, 14 Feb 2018 10:22:45 +0100 Subject: [PATCH] home/fb4: Modularize --- home/hosts/fb4.nix | 11 ----------- home/hosts/fb4/home.nix | 17 +++++++++++++++++ home/hosts/fb4/nix-gc.nix | 21 +++++++++++++++++++++ home/hosts/fb4/nix-update-channel.nix | 21 +++++++++++++++++++++ home/hosts/fb4/syncthing.nix | 19 +++++++++++++++++++ 5 files changed, 78 insertions(+), 11 deletions(-) delete mode 100644 home/hosts/fb4.nix create mode 100644 home/hosts/fb4/home.nix create mode 100644 home/hosts/fb4/nix-gc.nix create mode 100644 home/hosts/fb4/nix-update-channel.nix create mode 100644 home/hosts/fb4/syncthing.nix diff --git a/home/hosts/fb4.nix b/home/hosts/fb4.nix deleted file mode 100644 index ec133b8a..00000000 --- a/home/hosts/fb4.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, ... }: -{ -imports = [ - ../snippets/everywhere.nix - ../snippets/graphical.nix - ]; - home.packages = with pkgs; [ - xautolock - syncthing - ]; -} diff --git a/home/hosts/fb4/home.nix b/home/hosts/fb4/home.nix new file mode 100644 index 00000000..65bc140f --- /dev/null +++ b/home/hosts/fb4/home.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: +{ + imports = [ + ../../snippets/everywhere.nix + ../../snippets/graphical.nix + # ./syncthing.nix + # ./nix-gc.nix + # ./nix-update-channel.nix + ]; + + home.packages = with pkgs; [ + xautolock + syncthing + ]; + + systemd.user.systemctlPath = "/usr/bin/systemctl"; +} diff --git a/home/hosts/fb4/nix-gc.nix b/home/hosts/fb4/nix-gc.nix new file mode 100644 index 00000000..aa711b11 --- /dev/null +++ b/home/hosts/fb4/nix-gc.nix @@ -0,0 +1,21 @@ +{ pkgs, ... }: +{ + systemd.user = { + services.nix-gc = { + Unit = { + Description = "Collect garbage"; + }; + + Service = { + Type = "oneshot"; + ExecStart="${pkgs.nix}/bin/nix-collect-garbage --delete-older-than 5d"; + }; + }; + timers.nix-gc = { + Timer = { + OnCalendar = "22:00"; + Persistent = "true"; + }; + }; + }; +} diff --git a/home/hosts/fb4/nix-update-channel.nix b/home/hosts/fb4/nix-update-channel.nix new file mode 100644 index 00000000..e78a8b80 --- /dev/null +++ b/home/hosts/fb4/nix-update-channel.nix @@ -0,0 +1,21 @@ +{ pkgs, ... }: +{ + systemd.user = { + services.nix-update = { + Unit = { + Description = "Update nix-channel"; + }; + + Service = { + Type = "oneshot"; + ExecStart="${pkgs.nix}/bin/nix-channel --update"; + }; + }; + timers.nix-update = { + Timer = { + OnCalendar = "22:00"; + Persistent = "true"; + }; + }; + }; +} diff --git a/home/hosts/fb4/syncthing.nix b/home/hosts/fb4/syncthing.nix new file mode 100644 index 00000000..418e5c8d --- /dev/null +++ b/home/hosts/fb4/syncthing.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: +{ + systemd.user = { + services.syncthing = { + Unit = { + Description = "Syncthing"; + ConditionHost = "fb04217"; + Wants= "syncthing-inotify.service"; + }; + + Service = { + ExecStart="${pkgs.syncthing}/bin/syncthing -no-browser -no-restart -logflags=0"; + Restart="on-failure"; + SuccessExitStatus="3 4"; + RestartForceExitStatus="3 4"; + }; + }; + }; +}