From e2279e52c34ea0b8c839f5cfbf1d412bd1c1ba87 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 15 Oct 2017 16:27:35 +0200 Subject: [PATCH] feat: Add initial NixOS configuration Adds NixOS configuration to configure my base system with all sorts of things, including - but not limited to - i3, emacs, FF57, connman and so on. Not all of these things are fully configured yet (especially in the desktop environment) but I'm hoping to get more of that done in the future. --- configuration.nix | 119 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 configuration.nix diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 000000000..467e10b1c --- /dev/null +++ b/configuration.nix @@ -0,0 +1,119 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +let + unstable = import { config.allowUnfree = true; }; +in { + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ./local-configuration.nix + ]; + + # Ensure encrypted devices are decrypted + boot.initrd.luks.devices.adho.device = "/dev/disk/by-uuid/722006b0-9654-4ea1-8703-e0cf9ac1905e"; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Use connman for network configuration + networking.connman.enable = true; + hardware.pulseaudio.enable = true; + programs.light.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Oslo"; + + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment.systemPackages = with pkgs; [ + curl gnumake unzip openjdk gcc htop tree direnv tmux fish ripgrep + gnupg pass git + ]; + + # 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; + + # 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; + services.emacs.enable = true; + services.emacs.defaultEditor = true; + + # Configure other random applications: + programs.java.enable = true; + nixpkgs.config.allowUnfree = true; + + # Configure fonts + fonts = { + fonts = with pkgs; [ + input-fonts + ]; + }; + + # Configure user account + users.defaultUserShell = pkgs.fish; + users.extraUsers.vincent = { + extraGroups = [ "wheel" ]; + isNormalUser = true; + uid = 1000; + shell = pkgs.fish; + packages = with pkgs; [ + jetbrains.idea-community pavucontrol spotify xclip tdesktop + rofi rofi-pass alacritty i3lock unstable.firefox-beta-bin + ]; + }; + + # 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"; + ExecStart = "${pkgs.feh}/bin/feh --recursive --randomize --bg-fill %h/wallpapers"; + }; + }; + + systemd.user.timers.feh-wp = { + description = "Set a random wallpaper every hour"; + wantedBy = [ "timers.target" ]; + + timerConfig = { + OnActiveSec = "3second"; + OnUnitActiveSec = "1hour"; + }; + }; + + security.sudo.enable = true; + security.sudo.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 + # servers. You should change this only after NixOS release notes say you + # should. + system.stateVersion = "17.09"; # Did you read the comment? +}