about summary refs log tree commit diff stats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--flake.nix2
-rw-r--r--hm/soispha/pkgs/default.nix1
-rw-r--r--hm/soispha/pkgs/scripts.nix6
-rwxr-xr-xhm/soispha/pkgs/scripts/wrappers/backsnap3
-rw-r--r--sys/nixpkgs/default.nix10
-rw-r--r--sys/nixpkgs/pkgs/default.nix5
-rw-r--r--sys/nixpkgs/pkgs/snap-sync-forked/default.nix24
-rwxr-xr-xsys/nixpkgs/pkgs/snap-sync-forked/snap-sync-forked (renamed from sys/svcs/backup/snap-sync-forked)0
-rw-r--r--sys/svcs/backup/default.nix23
9 files changed, 40 insertions, 34 deletions
diff --git a/flake.nix b/flake.nix
index 307d0a3b..dbc66476 100644
--- a/flake.nix
+++ b/flake.nix
@@ -316,7 +316,7 @@
     system = "x86_64-linux";
     pkgs = import nixpkgs (import ./sys/nixpkgs {
       inherit (nixpkgs) lib;
-      inherit system;
+      inherit system sysLib;
       overlays = [nixNeovim.overlays.default];
     });
     # FIXME: this `nixpkgs` misses the configs applied to the other one
diff --git a/hm/soispha/pkgs/default.nix b/hm/soispha/pkgs/default.nix
index e8b105ca..83744400 100644
--- a/hm/soispha/pkgs/default.nix
+++ b/hm/soispha/pkgs/default.nix
@@ -60,6 +60,7 @@ with pkgs; let
       xdg-utils # open urls and such things
       yokadi # Command line oriented, sqlite powered, todo list
       killall # kill a application by name
+      snap-sync-forked # A btrfs based backup solution
     ];
 
     WM = {
diff --git a/hm/soispha/pkgs/scripts.nix b/hm/soispha/pkgs/scripts.nix
index d06fc67f..1341370c 100644
--- a/hm/soispha/pkgs/scripts.nix
+++ b/hm/soispha/pkgs/scripts.nix
@@ -50,11 +50,6 @@
     dependencies = builtins.attrValues {inherit (pkgs) git git-crypt nixos-rebuild sudo openssh coreutils mktemp gnugrep gnused;};
   };
 
-  backsnap-scr = write_script {
-    name = "backsnap";
-    path = "wrappers";
-    dependencies = builtins.attrValues {}; # TODO: add snap-sync
-  };
   ll-scr = sysLib.writeShellScriptWithLibraryUnwrapped {
     name = "ll";
     src = ./scripts/wrappers/ll;
@@ -87,7 +82,6 @@
   };
 in [
   aumo-scr
-  backsnap-scr
   con2pdf-scr
   dldragon-scr
   gtk-themes-scr
diff --git a/hm/soispha/pkgs/scripts/wrappers/backsnap b/hm/soispha/pkgs/scripts/wrappers/backsnap
deleted file mode 100755
index cd08045d..00000000
--- a/hm/soispha/pkgs/scripts/wrappers/backsnap
+++ /dev/null
@@ -1,3 +0,0 @@
-#! /usr/bin/env dash
-snap-sync --noconfirm -u d1c6e0f6-1837-40fd-bb29-251d5ea0ddb0
-umount /run/dt/d1c6e0f6-1837-40fd-bb29-251d5ea0ddb0
diff --git a/sys/nixpkgs/default.nix b/sys/nixpkgs/default.nix
index c37d5582..da3a33e6 100644
--- a/sys/nixpkgs/default.nix
+++ b/sys/nixpkgs/default.nix
@@ -2,11 +2,17 @@
   lib,
   system,
   overlays ? [],
-}: {
+  sysLib,
+}: let
+  additionalPackages = (import ./pkgs) {inherit sysLib;};
+  complete_overlays = overlays ++ additionalPackages;
+in {
   # TODO: inheriting system here is discouraged, localSystem or hostSystem should be inspected
-  inherit system overlays;
+  inherit system;
+  overlays = complete_overlays;
   config = {
     # TODO: this fails because of the root tempsize, which should be increased
+
     #contentAddressedByDefault = true;
 
     allowUnfreePredicate = pkg:
diff --git a/sys/nixpkgs/pkgs/default.nix b/sys/nixpkgs/pkgs/default.nix
new file mode 100644
index 00000000..b057068c
--- /dev/null
+++ b/sys/nixpkgs/pkgs/default.nix
@@ -0,0 +1,5 @@
+{sysLib}: let
+  snap-sync-forked = (import ./snap-sync-forked) {inherit sysLib;};
+  overlays = [] ++ snap-sync-forked;
+in
+  overlays
diff --git a/sys/nixpkgs/pkgs/snap-sync-forked/default.nix b/sys/nixpkgs/pkgs/snap-sync-forked/default.nix
new file mode 100644
index 00000000..55e2bd27
--- /dev/null
+++ b/sys/nixpkgs/pkgs/snap-sync-forked/default.nix
@@ -0,0 +1,24 @@
+{sysLib}: [
+  (self: super: {
+    snap-sync-forked = sysLib.writeShellScriptWithLibrary {
+      name = "snap-sync-forked";
+      src = ./snap-sync-forked;
+      dependencies = with self; [
+        bash
+        btrfs-progs
+        coreutils
+        gawk
+        gnugrep
+        snapper
+        util-linux
+
+        # optional:
+        libnotify
+        openssh
+        pv
+        rsync
+        sudo
+      ];
+    };
+  })
+]
diff --git a/sys/svcs/backup/snap-sync-forked b/sys/nixpkgs/pkgs/snap-sync-forked/snap-sync-forked
index a66f31ae..a66f31ae 100755
--- a/sys/svcs/backup/snap-sync-forked
+++ b/sys/nixpkgs/pkgs/snap-sync-forked/snap-sync-forked
diff --git a/sys/svcs/backup/default.nix b/sys/svcs/backup/default.nix
index 171f1043..91433bf9 100644
--- a/sys/svcs/backup/default.nix
+++ b/sys/svcs/backup/default.nix
@@ -1,33 +1,12 @@
 {
   lib,
-  sysLib,
   pkgs,
   config,
   ...
 }: let
-  snap-sync-forked = sysLib.writeShellScriptWithLibrary {
-    name = "snap-sync-forked";
-    src = ./snap-sync-forked;
-    dependencies = with pkgs; [
-      bash
-      btrfs-progs
-      coreutils
-      gawk
-      gnugrep
-      snapper
-      util-linux
-
-      # optional:
-      libnotify
-      openssh
-      pv
-      rsync
-      sudo
-    ];
-  };
   backup-script = pkgs.writeShellScriptBin "backsnap" ''
     ${pkgs.util-linux}/bin/mount --mkdir "/dev/disk/by-uuid/${cfg.backupDiskUuid}" "/run/media/${cfg.backupDiskUuid}";
-    ${snap-sync-forked}/bin/snap-sync-forked --UUID "${cfg.backupDiskUuid}" --noconfirm;
+    ${pkgs.snap-sync-forked}/bin/snap-sync-forked --UUID "${cfg.backupDiskUuid}" --noconfirm;
     ${pkgs.util-linux}/bin/umount "/run/media/${cfg.backupDiskUuid}";
   '';
   cfg = config.soispha.fs.backup;