about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--configuration.nix24
-rw-r--r--desktop.nix51
-rw-r--r--wallpapers.nix34
3 files changed, 52 insertions, 57 deletions
diff --git a/configuration.nix b/configuration.nix
index 421b02549797..c03dc06ebbe1 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -10,7 +10,7 @@
     ./hardware-configuration.nix
     ./local-configuration.nix
     ./packages.nix
-    ./wallpapers.nix
+    ./desktop.nix
     ];
 
   # Use the systemd-boot EFI boot loader.
@@ -22,21 +22,6 @@
   # Set your time zone.
   time.timeZone = "Europe/Oslo";
 
-  # Enable the X11 windowing system.
-  services.xserver.enable = true;
-  services.xserver.layout = "us,no";
-  services.xserver.xkbOptions = "caps:super, grp:shifts_toggle";
-
-  # Configure i3 & compositor
-  services.xserver.windowManager.i3.enable = true;
-  services.compton.enable = true;
-  services.compton.backend = "xrender";
-
-  # Configure Redshift for Oslo
-  services.redshift.enable = true;
-  services.redshift.latitude = "59.911491";
-  services.redshift.longitude = "10.757933";
-
   # Configure shell environment
   programs.fish.enable = true;
   programs.ssh.startAgent = true;
@@ -46,13 +31,6 @@
   # Configure other random applications:
   programs.java.enable = true;
 
-  # Configure fonts
-  fonts = {
-    fonts = with pkgs; [
-      input-fonts
-    ];
-  };
-
   # Configure user account
   users.defaultUserShell = pkgs.fish;
   users.extraUsers.vincent = {
diff --git a/desktop.nix b/desktop.nix
new file mode 100644
index 000000000000..335e15d87d88
--- /dev/null
+++ b/desktop.nix
@@ -0,0 +1,51 @@
+# Configuration for the desktop environment
+
+{ config, pkgs, ... }:
+
+let wallpapers = import ./pkgs/wallpapers.nix;
+in {
+  # Configure basic X-server stuff:
+  services.xserver.enable = true;
+  services.xserver.layout = "us,no";
+  services.xserver.xkbOptions = "caps:super, grp:shifts_toggle";
+
+  # configure desktop environment:
+  services.xserver.windowManager.i3.enable = true;
+  services.compton.enable = true;
+  services.compton.backend = "xrender"; # this should be the default!
+
+  # Configure Redshift for Oslo
+  services.redshift.enable = true;
+  services.redshift.latitude = "59.911491";
+  services.redshift.longitude = "10.757933";
+
+  # Configure fonts
+  fonts = {
+    fonts = with pkgs; [
+      input-fonts
+    ];
+  };
+
+  # Ensure wallpapers are "installed"
+  environment.systemPackages = [ wallpapers ];
+
+  # Configure random setting of wallpapers
+  systemd.user.services.feh-wp = {
+    description = "Randomly set wallpaper via feh";
+    serviceConfig = {
+      Type = "oneshot";
+      WorkingDirectory = "${wallpapers}/share/wallpapers";
+      ExecStart = "${pkgs.bash}/bin/bash -c '${pkgs.fd}/bin/fd -atf | shuf | head -n1 | ${pkgs.findutils}/bin/xargs ${pkgs.feh}/bin/feh --bg-fill'";
+    };
+  };
+
+  systemd.user.timers.feh-wp = {
+    description = "Set a random wallpaper every hour";
+    wantedBy = [ "timers.target" ];
+
+    timerConfig = {
+      OnActiveSec = "3second";
+      OnUnitActiveSec = "1hour";
+    };
+  };
+}
diff --git a/wallpapers.nix b/wallpapers.nix
deleted file mode 100644
index 4faf7ef52c51..000000000000
--- a/wallpapers.nix
+++ /dev/null
@@ -1,34 +0,0 @@
-# Configuration for randomly setting wallpapers.
-{ config, pkgs, ... }:
-
-{
-  # Configure random setting of wallpapers
-  systemd.user.services.clone-wallpapers = {
-    description = "Clone wallpaper repository";
-    enable = true;
-    before = [ "feh-wp.service" "feh-wp.timer" ];
-    serviceConfig = {
-      Type = "oneshot";
-      ExecStart = "${pkgs.fish}/bin/fish -c '${pkgs.coreutils}/bin/stat %h/wallpapers; or ${pkgs.git}/bin/git clone https://git.tazj.in/tazjin/wallpapers.git %h/wallpapers'";
-    };
-  };
-
-  systemd.user.services.feh-wp = {
-    description = "Randomly set wallpaper via feh";
-    serviceConfig = {
-      Type = "oneshot";
-      WorkingDirectory = "%h/wallpapers";
-      ExecStart = "${pkgs.bash}/bin/bash -c '${pkgs.fd}/bin/fd -atf | shuf | head -n1 | ${pkgs.findutils}/bin/xargs ${pkgs.feh}/bin/feh --bg-fill'";
-    };
-  };
-
-  systemd.user.timers.feh-wp = {
-    description = "Set a random wallpaper every hour";
-    wantedBy = [ "timers.target" ];
-
-    timerConfig = {
-      OnActiveSec = "3second";
-      OnUnitActiveSec = "1hour";
-    };
-  };
-}