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 --- adho-configuration.nix | 32 +++++++++++++++++--------------- configuration.nix | 33 ++++++++++++++++++++------------- desktop.nix | 34 ++++++++++++++++++++-------------- dotfiles.nix | 8 ++++---- stallo-configuration.nix | 14 ++++++++------ 5 files changed, 69 insertions(+), 52 deletions(-) diff --git a/adho-configuration.nix b/adho-configuration.nix index a9328925ab6a..d3560a51660a 100644 --- a/adho-configuration.nix +++ b/adho-configuration.nix @@ -3,27 +3,29 @@ { boot.initrd.luks.devices.adho.device = "/dev/disk/by-uuid/722006b0-9654-4ea1-8703-e0cf9ac1905e"; - networking.hostName = "adho"; services.xserver.libinput.enable = true; services.xserver.videoDrivers = [ "intel" ]; programs.light.enable = true; - networking.wireless.enable = true; - networking.wireless.networks = { - # Welcome to roast club! - "How do I computer?" = { - psk = "washyourface"; - }; + networking = { + hostName = "adho"; + wireless.enable = true; + wireless.networks = { + # Welcome to roast club! + "How do I computer?" = { + psk = "washyourface"; + }; - # Did someone say wifi credentials are secret? - # http://bit.ly/2gI43QP - "Amesto-mobile" = { - psk = "ostemAt1"; - }; + # Did someone say wifi credentials are secret? + # http://bit.ly/2gI43QP + "Amesto-mobile" = { + psk = "ostemAt1"; + }; - # Public places in Oslo: - "Abelone" = { - psk = "speakeasy"; + # Public places in Oslo: + "Abelone" = { + psk = "speakeasy"; + }; }; }; diff --git a/configuration.nix b/configuration.nix index aae8c61db41f..4fd9c71d2635 100644 --- a/configuration.nix +++ b/configuration.nix @@ -20,22 +20,27 @@ hardware.pulseaudio.enable = true; time.timeZone = "Europe/Oslo"; - # Configure shell environment: - programs.fish.enable = true; - programs.ssh.startAgent = true; + # Configure emacs: + # (actually, that's a lie, this only installs emacs!) services.emacs.enable = true; services.emacs.defaultEditor = true; - # Configure VirtualBox (needed for local NixOps testing): - virtualisation.virtualbox.host.enable = true; + virtualisation = { + # Configure VirtualBox (needed for local NixOps testing): + virtualbox.host.enable = true; - # Configure Docker (with socket activation): - # Side note: ... virtualisation? ... - virtualisation.docker.enable = true; - virtualisation.docker.autoPrune.enable = true; + # Configure Docker (with socket activation): + # Side note: ... why is this in virtualisation? ... + docker.enable = true; + docker.autoPrune.enable = true; + }; - # Configure other random applications: - programs.java.enable = true; + # Configure various other applications: + programs = { + java.enable = true; + fish.enable = true; + ssh.startAgent = true; + }; # Configure user account users.defaultUserShell = pkgs.fish; @@ -46,8 +51,10 @@ shell = pkgs.fish; }; - security.sudo.enable = true; - security.sudo.extraConfig = "wheel ALL=(ALL:ALL) SETENV: ALL"; + security.sudo = { + enable = true; + extraConfig = "wheel ALL=(ALL:ALL) SETENV: ALL"; + }; # This value determines the NixOS release with which your system is to be # compatible, in order to avoid breaking some software such as database 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"; }; }; diff --git a/dotfiles.nix b/dotfiles.nix index e0f74b5c602a..4032c873a3b7 100644 --- a/dotfiles.nix +++ b/dotfiles.nix @@ -20,10 +20,10 @@ in { # /etc/ is a special place in NixOS! # Symlinks that need to be created there must be specified explicitly. environment.etc = { - "i3/config".source = "${dotfiles}/i3.conf"; - "tmux.conf".source = "${dotfiles}/tmux.conf"; + "alacritty.yml".source = "${dotfiles}/alacritty.yml"; "fish/config.fish".source = "${dotfiles}/config.fish"; - "rofi.conf".source = "${dotfiles}/rofi.conf"; - "alacritty.yml".source = "${dotfiles}/alacritty.yml"; + "i3/config".source = "${dotfiles}/i3.conf"; + "rofi.conf".source = "${dotfiles}/rofi.conf"; + "tmux.conf".source = "${dotfiles}/tmux.conf"; }; } diff --git a/stallo-configuration.nix b/stallo-configuration.nix index 2925152824e6..b58497f9e4b5 100644 --- a/stallo-configuration.nix +++ b/stallo-configuration.nix @@ -7,12 +7,14 @@ # Use proprietary nvidia driver services.xserver.videoDrivers = [ "nvidia" ]; - networking.hostName = "stallo"; - networking.wireless.enable = true; - networking.wireless.networks = { - "How do I computer?" = { - # Welcome to roast club! - psk = "washyourface"; + networking = { + hostName = "stallo"; + wireless.enable = true; + wireless.networks = { + "How do I computer?" = { + # Welcome to roast club! + psk = "washyourface"; + }; }; }; } -- cgit 1.4.1