Improve folder structure

This commit is contained in:
Dave Gallant
2021-01-16 23:31:14 -05:00
parent 3e13f04043
commit 73e8011316
11 changed files with 300 additions and 164 deletions

View File

@@ -14,14 +14,14 @@
defaultModules = [
home-manager.nixosModules.home-manager
./modules/g810-led.nix
# ./main/fonts.nix
./main/fonts.nix
./main/kernel.nix
./main/packages.nix
./main/printing.nix
# ./main/general.nix
# ./main/hardware.nix
# ./main/kernel.nix
# ./main/misc.nix
# ./main/networking.nix
# ./main/packages.nix
# ./main/printing.nix
# ./main/services.nix
# ./main/terminal.nix
@@ -38,7 +38,7 @@
nixpkgs-unstable.flake = nixpkgs-unstable;
};
nixpkgs.overlays = [ (import ./overlays) ];
# nixpkgs.overlays = [ (import ./overlays) ];
home-manager = {
useGlobalPkgs = true;

View File

@@ -1,12 +1,9 @@
{ pkgs, ... }:
{
nixpkgs.overlays = import ../overlays { inherit pkgs; };
nixpkgs.config.allowUnfree = true;
home = {
sessionVariables = { EDITOR = "vim"; };
packages = import ./packages.nix { inherit pkgs; };
};
services = {

View File

@@ -1,154 +0,0 @@
{ pkgs }:
with pkgs; [
# utils
bat
bind
binutils-unwrapped
colordiff
curl
direnv
exa
fd
fzf
git
gnumake
jq
ripgrep
tree
unzip
zip
# education
anki
# monitoring
htop
# password
gopass
# social media
rtv
# imaging
gifsicle
gimp
# editors
libreoffice
vscodium
# audio
audio-recorder
spotify
# video
youtube-dl
vlc
# network
bandwhich
deluge
nmap
openvpn
postman
# terraform
terraform-ls
terraform_0_14
tflint
tfsec
# gcp
google-cloud-sdk
# jvm
jdk8
gradle
groovy
maven
# encryption
cryptsetup
# browser
brave
firefox
# docker
docker
docker-compose
# k8s
kubectl
kubernetes-helm
# nix
nix-index
nixfmt
nixpkgs-fmt
nixpkgs-review
rnix-lsp
# games
steam
minecraft
yuzu
# communication
discord
element-desktop
signal-desktop
slack
zoom-us
## aws
awscli2
ssm-session-manager-plugin
# python
black
python38
python38Packages.ipython
python38Packages.pip
python38Packages.poetry
python38Packages.setuptools
python38Packages.virtualenv
# fonts
dejavu_fonts
fira-code
fira-code-symbols
fira-mono
font-awesome
google-fonts
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
noto-fonts-extra
# misc
asciinema
github-cli
glibcLocales
go-jira
hadolint
nodejs-12_x
imagemagick
pfetch
pinentry-curses
shellcheck
shfmt
starship
xclip
xdg_utils
zathura
# overlays
lpass
rfd
vpngate
]

12
nix/lib/default.nix Normal file
View File

@@ -0,0 +1,12 @@
{ config, lib, ... }:
with lib; rec {
pkgsImport = pkgs:
import pkgs {
config = config.nixpkgs.config;
overlays = config.nixpkgs.overlays;
system = config.nixpkgs.system;
};
}

View File

@@ -15,7 +15,6 @@
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.kernelPackages = pkgs.linuxPackages_latest;
networking.hostName = "hephaestus"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.

39
nix/main/fonts.nix Normal file
View File

@@ -0,0 +1,39 @@
{ pkgs, ... }:
{
# Set system-wide fonts.
fonts.fonts = with pkgs; [
dejavu_fonts
fira-code
fira-code-symbols
fira-mono
font-awesome
google-fonts
liberation_ttf # Free replacement for MS Fonts.
noto-fonts
noto-fonts
noto-fonts-cjk
noto-fonts-cjk
noto-fonts-emoji
noto-fonts-emoji
noto-fonts-extra
];
# Set default fonts.
fonts.fontconfig.defaultFonts = {
sansSerif = [
"Noto Sans"
];
serif = [
"Noto Serif"
];
monospace = [
"MesloLGS Nerd Font"
"Noto Sans Mono"
];
emoji = [
"Noto Color Emoji"
];
};
}

9
nix/main/kernel.nix Normal file
View File

@@ -0,0 +1,9 @@
{ pkgs, ... }:
{
# Use the latest stable kernel
boot.kernelPackages = pkgs.linuxPackages_latest;
# Enable support for additional filesystems
boot.supportedFilesystems = [ "ntfs" ];
}

168
nix/main/packages.nix Normal file
View File

@@ -0,0 +1,168 @@
{ config, lib, pkgs, unstable, ... }:
{
# System-wide packages to install.
environment.systemPackages = with unstable;
let
common = [
# utils
bat
bind
binutils-unwrapped
colordiff
curl
direnv
exa
fd
fzf
git
gnumake
jq
ripgrep
tree
unzip
zip
# education
anki
# monitoring
htop
# password
gopass
# social media
rtv
# imaging
gifsicle
gimp
# editors
libreoffice
vscodium
# audio
audio-recorder
spotify
# video
youtube-dl
vlc
# network
bandwhich
deluge
nmap
openvpn
postman
# terraform
terraform-ls
terraform_0_14
tflint
tfsec
# gcp
google-cloud-sdk
# jvm
jdk8
gradle
groovy
maven
# encryption
cryptsetup
# browser
brave
firefox
# docker
docker
docker-compose
# k8s
kubectl
kubernetes-helm
# nix
nix-index
nixfmt
nixpkgs-fmt
nixpkgs-review
rnix-lsp
# games
steam
minecraft
yuzu
# communication
discord
element-desktop
signal-desktop
slack
zoom-us
## aws
awscli2
ssm-session-manager-plugin
# python
black
python38
python38Packages.ipython
python38Packages.pip
python38Packages.poetry
python38Packages.setuptools
python38Packages.virtualenv
# fonts
dejavu_fonts
fira-code
fira-code-symbols
fira-mono
font-awesome
google-fonts
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
noto-fonts-extra
# misc
asciinema
github-cli
glibcLocales
go-jira
hadolint
nodejs-12_x
imagemagick
pfetch
pinentry-curses
shellcheck
shfmt
starship
xclip
xdg_utils
zathura
# overlays
# lpass
# rfd
# vpngate
];
in common;
# Don't install optional default packages.
environment.defaultPackages = [ ];
# Install ADB and fastboot.
programs.adb.enable = true;
# Install GnuPG agent.
programs.gnupg.agent.enable = true;
}

6
nix/main/printing.nix Normal file
View File

@@ -0,0 +1,6 @@
{ pkgs, ... }:
{
# Setup CUPS for printing documents.
services.printing.enable = true;
}

60
nix/modules/g810-led.nix Normal file
View File

@@ -0,0 +1,60 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.hardware.g810-led;
in
{
options.hardware.g810-led = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Whether to apply a g810-led profile when a compatible keyboard
is connected.
'';
};
profile = mkOption {
type = types.path;
description = ''
The profile file to be applied, samples can be found at:
https://github.com/MatMoul/g810-led/tree/master/sample_profiles
'';
};
enableFlashingWorkaround = mkOption {
type = types.bool;
default = false;
description = ''
Whether to turn off all LEDs on shutdown and reboot.
Enable this if your keyboard flashes 3 times on boot.
'';
};
};
config = mkIf cfg.enable {
services.udev.packages = [
(pkgs.g810-led.override { profile = cfg.profile; })
];
# Workaround mentioned here:
# https://github.com/MatMoul/g810-led/blob/14e331ad2ab7c5ffb546e0c14dd6164b517ff9ca/PROFILES.md
systemd.services.g810-led-workaround = mkIf cfg.enableFlashingWorkaround {
description = "Turn off all g810-led keys";
script = "${pkgs.g810-led}/bin/g810-led -a 000000";
serviceConfig.Type = "oneshot";
unitConfig.DefaultDependencies = false;
wantedBy = [ "shutdown.target" ];
before = [ "shutdown.target" "reboot.target" "halt.target" ];
};
};
meta.maintainers = [ maintainers.davegallant ];
}

View File

@@ -1,3 +1,3 @@
#!/usr/bin/env bash
cd "$(dirname "$0")"
exec nixos-rebuild -I nixos-config=machines/$(hostname)/configuration.nix "$@"
exec nixos-rebuild -I nixos-config=machines/$(hostname)/configuration.nix "$@" --flake '.#'