Initial commit
It begins...
This commit is contained in:
commit
28ccec9704
24 changed files with 2721 additions and 0 deletions
11
system/configuration.nix
Normal file
11
system/configuration.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let machine = throw "Pick a machine from ./machines"; in
|
||||
{
|
||||
imports =
|
||||
[
|
||||
/etc/nixos/hardware-configuration.nix
|
||||
./modules/common.nix
|
||||
machine
|
||||
];
|
||||
}
|
||||
21
system/machines/bumblebee.nix
Normal file
21
system/machines/bumblebee.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
../modules/reusable/battery.nix
|
||||
];
|
||||
|
||||
networking.hostName = "bumblebee";
|
||||
|
||||
powerManagement = {
|
||||
enable = true;
|
||||
cpuFreqGovernor = "powersave";
|
||||
powertop.enable = true;
|
||||
};
|
||||
|
||||
# Hibernate on low battery
|
||||
laptop.onLowBattery = {
|
||||
enable = true;
|
||||
action = "hibernate";
|
||||
thresholdPercentage = 5;
|
||||
};
|
||||
}
|
||||
106
system/modules/common.nix
Normal file
106
system/modules/common.nix
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[
|
||||
./xserver.nix
|
||||
./emacs.nix
|
||||
./sound.nix
|
||||
];
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
networking.hostName = "bumblebee";
|
||||
networking.useDHCP = false;
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
# Select internationalisation properties.
|
||||
# i18n = {
|
||||
# consoleFont = "Lat2-Terminus16";
|
||||
# consoleKeyMap = "us";
|
||||
# defaultLocale = "en_US.UTF-8";
|
||||
# };
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "America/New_York";
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
wget
|
||||
vim
|
||||
zsh
|
||||
git
|
||||
w3m
|
||||
libnotify
|
||||
file
|
||||
];
|
||||
|
||||
# Some programs need SUID wrappers, can be configured further or are
|
||||
# started in user sessions.
|
||||
# programs.mtr.enable = true;
|
||||
# programs.gnupg.agent = {
|
||||
# enable = true;
|
||||
# enableSSHSupport = true;
|
||||
# pinentryFlavor = "gnome3";
|
||||
# };
|
||||
|
||||
programs.nm-applet.enable = true;
|
||||
|
||||
|
||||
services.openssh.enable = true;
|
||||
|
||||
# Open ports in the firewall.
|
||||
# networking.firewall.allowedTCPPorts = [ ... ];
|
||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||
# Or disable the firewall altogether.
|
||||
networking.firewall.enable = false;
|
||||
|
||||
# Enable CUPS to print documents.
|
||||
# services.printing.enable = true;
|
||||
|
||||
users.mutableUsers = true;
|
||||
programs.zsh.enable = true;
|
||||
environment.pathsToLink = [ "/share/zsh" ];
|
||||
users.users.grfn = {
|
||||
isNormalUser = true;
|
||||
initialPassword = "password";
|
||||
extraGroups = [
|
||||
"wheel" # Enable ‘sudo’ for the user.
|
||||
"networkmanager"
|
||||
"audio"
|
||||
];
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
# This value determines the NixOS release from which the default
|
||||
# settings for stateful data, like file locations and database versions
|
||||
# on your system were taken. It‘s perfectly fine and recommended to leave
|
||||
# this value at the release version of the first install of this system.
|
||||
# Before changing this value read the documentation for this option
|
||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||
system.stateVersion = "20.03"; # Did you read the comment?
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
fonts.fonts = with pkgs; [
|
||||
nerdfonts
|
||||
];
|
||||
|
||||
services.geoclue2.enable = true;
|
||||
|
||||
powerManagement = {
|
||||
enable = true;
|
||||
cpuFreqGovernor = "powersave";
|
||||
powertop.enable = true;
|
||||
};
|
||||
# Hibernate on low battery
|
||||
laptop.onLowBattery = {
|
||||
enable = true;
|
||||
action = "hibernate";
|
||||
thresholdPercentage = 5;
|
||||
};
|
||||
|
||||
nix = {
|
||||
autoOptimiseStore = true;
|
||||
};
|
||||
}
|
||||
23
system/modules/emacs.nix
Normal file
23
system/modules/emacs.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
options.programs.emacs.useGit = mkOption {
|
||||
description = "Use emacs from git";
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
config = {
|
||||
nixpkgs.overlays = if config.programs.emacs.useGit then [] else [
|
||||
(import (builtins.fetchTarball https://github.com/nix-community/emacs-overlay/archive/master.tar.gz))
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
(if config.programs.emacs.useGit then emacsGit else emacs)
|
||||
ripgrep
|
||||
coreutils
|
||||
fd
|
||||
clang
|
||||
];
|
||||
};
|
||||
}
|
||||
2
system/modules/reusable/README.org
Normal file
2
system/modules/reusable/README.org
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
This directory contains things I'm eventually planning on contributing upstream
|
||||
to nixpkgs
|
||||
32
system/modules/reusable/battery.nix
Normal file
32
system/modules/reusable/battery.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
{
|
||||
options = {
|
||||
laptop.onLowBattery = {
|
||||
enable = mkEnableOption "Perform action on low battery";
|
||||
|
||||
thresholdPercentage = mkOption {
|
||||
description = "Threshold battery percentage on which to perform the action";
|
||||
default = 5;
|
||||
type = types.int;
|
||||
};
|
||||
|
||||
action = mkOption {
|
||||
description = "Action to perform on low battery";
|
||||
default = "hibernate";
|
||||
type = types.enum [ "hibernate" "suspend" "suspend-then-hibernate" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let cfg = config.laptop.onLowBattery;
|
||||
in mkIf cfg.enable {
|
||||
services.udev.extraRules = concatStrings [
|
||||
''SUBSYSTEM=="power_supply", ''
|
||||
''ATTR{status}=="Discharging", ''
|
||||
''ATTR{capacity}=="[0-${toString cfg.thresholdPercentage}]", ''
|
||||
''RUN+="/${pkgs.systemd}/bin/systemctl ${cfg.action}"''
|
||||
];
|
||||
};
|
||||
}
|
||||
14
system/modules/sound.nix
Normal file
14
system/modules/sound.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
# Enable sound.
|
||||
sound.enable = true;
|
||||
hardware.pulseaudio.enable = true;
|
||||
nixpkgs.config.pulseaudio = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
pulseaudio-ctl
|
||||
paprefs
|
||||
pasystray
|
||||
pavucontrol
|
||||
];
|
||||
}
|
||||
19
system/modules/xserver.nix
Normal file
19
system/modules/xserver.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
# Enable the X11 windowing system.
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
layout = "us";
|
||||
xkbOptions = "caps:swapescape";
|
||||
|
||||
libinput.enable = true;
|
||||
|
||||
windowManager.i3 = {
|
||||
enable = true;
|
||||
extraPackages = with pkgs; [
|
||||
i3status
|
||||
i3lock
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue