From 9b7810ae428418907d62765a7724a8362f2952a7 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 21 Oct 2017 00:33:39 +0200 Subject: style(all): Consistently use block/attr format & clean up --- desktop.nix | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'desktop.nix') diff --git a/desktop.nix b/desktop.nix index 85e9f4b9a8c6..7554de7f93a7 100644 --- a/desktop.nix +++ b/desktop.nix @@ -5,9 +5,11 @@ 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"; + services.xserver = { + enable = true; + layout = "us,no"; + xkbOptions = "caps:super, grp:shifts_toggle"; + }; # configure desktop environment: services.xserver.windowManager.i3 = { @@ -16,12 +18,16 @@ in { }; services.compton.enable = true; - services.compton.backend = "xrender"; # this should be the default! + # this should be the default! in fact, it will soon be: + # https://github.com/NixOS/nixpkgs/pull/30486 + services.compton.backend = "xrender"; # Configure Redshift for Oslo - services.redshift.enable = true; - services.redshift.latitude = "59.911491"; - services.redshift.longitude = "10.757933"; + services.redshift = { + enable = true; + latitude = "59.911491"; + longitude = "10.757933"; + }; # Configure fonts fonts = { @@ -30,26 +36,26 @@ in { ]; }; - # 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"; + Type = "oneshot"; WorkingDirectory = "${wallpapers}/share/wallpapers"; + + # Manually shuffle because feh's --randomize option can't be restricted to + # just certain file types. 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 = [ "graphical-session.target" ]; - partOf = [ "graphical-session.target" ]; + wantedBy = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; timerConfig = { - OnActiveSec = "1second"; + OnActiveSec = "1second"; OnUnitActiveSec = "1hour"; }; }; -- cgit 1.4.1