Run nix fmt

Format using `nixfmt-rfc-style`.
This commit is contained in:
Oliver Davies 2024-06-10 09:31:28 +01:00
parent 14a1f177a0
commit 7f2df5f726
24 changed files with 317 additions and 162 deletions

View file

@ -15,7 +15,8 @@
# build-configs.url = "github:OliverDaviesLtd/build-configs";
};
outputs = { nixpkgs, self, ... }@inputs:
outputs =
{ nixpkgs, self, ... }@inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
@ -26,11 +27,11 @@
mkWsl = import ./lib/wsl2 { inherit inputs self username; };
inherit (pkgs) mkShell;
in {
packages.${system}.default =
mkShell { buildInputs = with pkgs; [ just ]; };
in
{
packages.${system}.default = mkShell { buildInputs = with pkgs; [ just ]; };
formatter.${system} = pkgs.nixfmt-classic;
formatter.${system} = pkgs.nixfmt-rfc-style;
nixosConfigurations = {
apollo = mkNixos {
@ -44,6 +45,8 @@
};
};
homeConfigurations = { wsl2 = mkWsl { system = "x86_64-linux"; }; };
homeConfigurations = {
wsl2 = mkWsl { system = "x86_64-linux"; };
};
};
}

View file

@ -4,6 +4,9 @@ _default:
check:
nix flake check
fmt:
nix fmt flake.nix lib
nixos-build *args:
sudo nixos-rebuild build --flake . {{ args }}

View file

@ -1,24 +1,32 @@
{ inputs, desktop ? false, hostname, self }:
{
inputs,
desktop ? false,
hostname,
self,
}:
{ pkgs, ... }:
let
configure-gtk = pkgs.writeTextFile {
name = "configure-gtk";
destination = "/bin/configure-gtk";
executable = true;
text = let
schema = pkgs.gsettings-desktop-schemas;
datadir = "${schema}/share/gsettings-schemas/${schema.name}";
in ''
export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS
gnome_schema=org.gnome.desktop.interface
gsettings set $gnome_schema gtk-theme 'Breeze Dark'
'';
text =
let
schema = pkgs.gsettings-desktop-schemas;
datadir = "${schema}/share/gsettings-schemas/${schema.name}";
in
''
export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS
gnome_schema=org.gnome.desktop.interface
gsettings set $gnome_schema gtk-theme 'Breeze Dark'
'';
};
theme = import "${self}/lib/theme" { inherit pkgs; };
username = "opdavies";
in {
in
{
nixpkgs.config.allowUnfree = true;
# Bootloader.
@ -126,7 +134,11 @@ in {
users.users.${username} = {
isNormalUser = true;
description = "Oliver Davies";
extraGroups = [ "docker" "networkmanager" "wheel" ];
extraGroups = [
"docker"
"networkmanager"
"wheel"
];
packages = with pkgs; [ ];
};
@ -216,10 +228,13 @@ in {
fonts = {
fontconfig = {
enable = true;
defaultFonts = { monospace = [ theme.fonts.monospace.name ]; };
defaultFonts = {
monospace = [ theme.fonts.monospace.name ];
};
};
packages = with pkgs;
packages =
with pkgs;
[
(nerdfonts.override {
fonts = [
@ -231,7 +246,8 @@ in {
"JetBrainsMono"
];
})
] ++ [ theme.fonts.monospace.package ];
]
++ [ theme.fonts.monospace.package ];
};
zramSwap.enable = true;
@ -247,31 +263,35 @@ in {
settings = {
auto-optimise-store = true;
experimental-features = [ "nix-command" "flakes" ];
experimental-features = [
"nix-command"
"flakes"
];
warn-dirty = false;
};
};
# Make Caps lock work as an Escape key on press and Ctrl on hold.
services.interception-tools = let
dfkConfig = pkgs.writeText "dual-function-keys.yaml" ''
MAPPINGS:
- KEY: KEY_CAPSLOCK
TAP: KEY_ESC
HOLD: KEY_LEFTCTRL
'';
in {
enable = true;
plugins =
pkgs.lib.mkForce [ pkgs.interception-tools-plugins.dual-function-keys ];
udevmonConfig = ''
- JOB: "${pkgs.interception-tools}/bin/intercept -g $DEVNODE | ${pkgs.interception-tools-plugins.dual-function-keys}/bin/dual-function-keys -c ${dfkConfig} | ${pkgs.interception-tools}/bin/uinput -d $DEVNODE"
DEVICE:
NAME: "AT Translated Set 2 keyboard"
EVENTS:
EV_KEY: [[KEY_CAPSLOCK, KEY_ESC, KEY_LEFTCTRL]]
'';
};
services.interception-tools =
let
dfkConfig = pkgs.writeText "dual-function-keys.yaml" ''
MAPPINGS:
- KEY: KEY_CAPSLOCK
TAP: KEY_ESC
HOLD: KEY_LEFTCTRL
'';
in
{
enable = true;
plugins = pkgs.lib.mkForce [ pkgs.interception-tools-plugins.dual-function-keys ];
udevmonConfig = ''
- JOB: "${pkgs.interception-tools}/bin/intercept -g $DEVNODE | ${pkgs.interception-tools-plugins.dual-function-keys}/bin/dual-function-keys -c ${dfkConfig} | ${pkgs.interception-tools}/bin/uinput -d $DEVNODE"
DEVICE:
NAME: "AT Translated Set 2 keyboard"
EVENTS:
EV_KEY: [[KEY_CAPSLOCK, KEY_ESC, KEY_LEFTCTRL]]
'';
};
system.autoUpgrade = {
enable = true;
@ -308,8 +328,7 @@ in {
services.cron = {
enable = true;
systemCronJobs =
[ "* * * * * opdavies /home/opdavies/.config/bin/notify-battery.sh" ];
systemCronJobs = [ "* * * * * opdavies /home/opdavies/.config/bin/notify-battery.sh" ];
};
services.auto-cpufreq.enable = true;

View file

@ -1,15 +1,36 @@
{ inputs, self, username }:
{ desktop ? false, hostname }:
{
inputs,
self,
username,
}:
{
desktop ? false,
hostname,
}:
let
configuration =
import ./configuration.nix { inherit desktop hostname inputs self; };
configuration = import ./configuration.nix {
inherit
desktop
hostname
inputs
self
;
};
hardwareConfiguration = import ./hardware-configuration.nix;
in inputs.nixpkgs.lib.nixosSystem {
in
inputs.nixpkgs.lib.nixosSystem {
modules = [
inputs.home-manager.nixosModules.home-manager
{
home-manager = {
extraSpecialArgs = { inherit inputs desktop self username; };
extraSpecialArgs = {
inherit
inputs
desktop
self
username
;
};
useGlobalPkgs = true;
useUserPackages = true;
users."${username}" = import ./home-manager;

View file

@ -1,8 +1,20 @@
{ config, lib, pkgs, modulesPath, ... }: {
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules =
[ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.availableKernelModules = [
"xhci_pci"
"thunderbolt"
"nvme"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.kernelParams = [
@ -28,7 +40,7 @@
fsType = "vfat";
};
swapDevices = [{ device = "/dev/disk/by-label/swap"; }];
swapDevices = [ { device = "/dev/disk/by-label/swap"; } ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
@ -41,6 +53,5 @@
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.bluetooth.enable = true;
hardware.cpu.intel.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -1,34 +1,60 @@
{ config, desktop, inputs, pkgs, self, username, ... }:
{
config,
desktop,
inputs,
pkgs,
self,
username,
...
}:
let
desktop-config =
import ./desktop.nix { inherit config inputs pkgs username; };
desktop-config = import ./desktop.nix {
inherit
config
inputs
pkgs
username
;
};
shared-config = import "${self}/lib/shared/home-manager.nix" {
inherit inputs pkgs self username;
inherit
inputs
pkgs
self
username
;
};
shared-packages = import "${self}/lib/shared/home-manager-packages.nix" {
inherit inputs pkgs;
};
in {
shared-packages = import "${self}/lib/shared/home-manager-packages.nix" { inherit inputs pkgs; };
in
{
imports =
if desktop then [ desktop-config shared-config ] else [ shared-config ];
if desktop then
[
desktop-config
shared-config
]
else
[ shared-config ];
home.packages = shared-packages ++ pkgs.lib.optionals desktop [
pkgs.discord
pkgs.gimp
pkgs.gscan2pdf
pkgs.kdenlive
pkgs.meslo-lg
pkgs.obs-studio
pkgs.okular
pkgs.pamixer
pkgs.pass
pkgs.pavucontrol
pkgs.pinentry
pkgs.via
pkgs.xsel
pkgs.xcape
pkgs.zoom-us
];
home.packages =
shared-packages
++ pkgs.lib.optionals desktop [
pkgs.discord
pkgs.gimp
pkgs.gscan2pdf
pkgs.kdenlive
pkgs.meslo-lg
pkgs.obs-studio
pkgs.okular
pkgs.pamixer
pkgs.pass
pkgs.pavucontrol
pkgs.pinentry
pkgs.via
pkgs.xsel
pkgs.xcape
pkgs.zoom-us
];
home.sessionVariables = {
EDITOR = "nvim";

View file

@ -1,4 +1,10 @@
{ config, inputs, pkgs, username, }: {
{
config,
inputs,
pkgs,
username,
}:
{
imports = [
./modules/copyq.nix
./modules/dunst.nix

View file

@ -2,6 +2,10 @@
services.dunst = {
enable = true;
settings = { global = { follow = "keyboard"; }; };
settings = {
global = {
follow = "keyboard";
};
};
};
}

View file

@ -1,9 +1,15 @@
let baseUrl = "https://www.oliverdavies.uk";
in {
let
baseUrl = "https://www.oliverdavies.uk";
in
{
services.espanso = {
enable = true;
configs = { default = { show_notifications = false; }; };
configs = {
default = {
show_notifications = false;
};
};
matches = {
base = {

View file

@ -1,4 +1,5 @@
{ username, ... }: {
{ username, ... }:
{
services.flameshot = {
enable = true;

View file

@ -1,4 +1,9 @@
{ config, inputs, pkgs, ... }:
{
config,
inputs,
pkgs,
...
}:
{
programs.i3status-rust = {
@ -64,18 +69,19 @@
xwayland = true;
config = {
bars = [{
colors.background = "#111111";
bars = [
{
colors.background = "#111111";
fonts = {
names = [ "JetBrainsMono Nerd Font Mono" ];
size = 12.0;
};
fonts = {
names = [ "JetBrainsMono Nerd Font Mono" ];
size = 12.0;
};
statusCommand =
"i3status-rs ~/.config/i3status-rust/config-default.toml";
trayPadding = 5;
}];
statusCommand = "i3status-rs ~/.config/i3status-rust/config-default.toml";
trayPadding = 5;
}
];
defaultWorkspace = "workspace number 1";
@ -85,7 +91,9 @@
};
input = {
"*" = { xkb_layout = "gb"; };
"*" = {
xkb_layout = "gb";
};
"type:touchpad" = {
dwt = "enabled";
@ -94,8 +102,10 @@
};
keybindings =
let modifier = config.wayland.windowManager.sway.config.modifier;
in inputs.nixpkgs.lib.mkOptionDefault {
let
modifier = config.wayland.windowManager.sway.config.modifier;
in
inputs.nixpkgs.lib.mkOptionDefault {
"${modifier}+Escape" = "exec swaylock --daemonize";
"${modifier}+Shift+b" = "exec ${pkgs.firefox}/bin/firefox";
"${modifier}+Shift+f" = "exec ${pkgs.xfce.thunar}/bin/thunar";
@ -112,7 +122,9 @@
# bg = "~/.config/wallpaper/wallpaper.jpg fill";
# };
eDP-1 = { scale = "1.0"; };
eDP-1 = {
scale = "1.0";
};
};
terminal = "wezterm";

View file

@ -1,5 +1,6 @@
{ inputs, username, ... }:
{ pkgs, ... }: {
{ pkgs, ... }:
{
services.displayManager.defaultSession = "sway";
programs.sway.enable = true;
@ -9,16 +10,24 @@
extraPortals = with pkgs; [ xdg-desktop-portal-wlr ];
};
home-manager.users.${username} = { pkgs, ... }: {
home.sessionVariables = {
MOZ_ENABLE_WAYLAND = "1";
MOZ_USE_XINPUT2 = "1";
QT_QPA_PLATFORM = "wayland";
SDL_VIDEODRIVER = "wayland";
XDG_CURRENT_DESKTOP = "sway";
XDG_SESSION_TYPE = "wayland";
};
home-manager.users.${username} =
{ pkgs, ... }:
{
home.sessionVariables = {
MOZ_ENABLE_WAYLAND = "1";
MOZ_USE_XINPUT2 = "1";
QT_QPA_PLATFORM = "wayland";
SDL_VIDEODRIVER = "wayland";
XDG_CURRENT_DESKTOP = "sway";
XDG_SESSION_TYPE = "wayland";
};
home.packages = with pkgs; [ i3status swaybg wdisplays wl-clipboard wofi ];
};
home.packages = with pkgs; [
i3status
swaybg
wdisplays
wl-clipboard
wofi
];
};
}

View file

@ -2,7 +2,9 @@
let
php = pkgs.php82;
phpPackages = pkgs.php82Packages;
in with pkgs; [
in
with pkgs;
[
inputs.build-configs.packages.${pkgs.system}.default
awscli2

View file

@ -1,4 +1,10 @@
{ inputs, pkgs, username, self, }: {
{
inputs,
pkgs,
username,
self,
}:
{
home.username = "${username}";
home.homeDirectory = "/home/${username}";

View file

@ -1,4 +1,5 @@
{ self, ... }: {
{ self, ... }:
{
home.sessionPath = [ "$HOME/.local/bin" ];
home.file.".local/bin" = {

View file

@ -34,10 +34,12 @@
userName = "Oliver Davies";
userEmail = "oliver@oliverdavies.dev";
includes = [{
condition = "gitdir:~/Code/bitbucket.org/transportforwales/";
contents.user.email = "oliver.davies@tfw.wales";
}];
includes = [
{
condition = "gitdir:~/Code/bitbucket.org/transportforwales/";
contents.user.email = "oliver.davies@tfw.wales";
}
];
aliases = {
aa = "add --all";
@ -54,12 +56,10 @@
current-branch = "rev-parse --abbrev-ref HEAD";
dc = "diff --color --word-diff --cached";
df = "diff --color --word-diff";
dup =
"!git checkout develop && git fetch origin && echo && git sl develop..origin/develop && echo && git pull --quiet && git checkout -";
dup = "!git checkout develop && git fetch origin && echo && git sl develop..origin/develop && echo && git pull --quiet && git checkout -";
fixup = "commit --fixup";
issues = "!gh issue list --web";
mup =
"!git master-to-main-wrapper checkout %BRANCH% && git fetch origin && echo && git sl %BRANCH%..origin/%BRANCH% && echo && git pull --quiet && git checkout -";
mup = "!git master-to-main-wrapper checkout %BRANCH% && git fetch origin && echo && git sl %BRANCH%..origin/%BRANCH% && echo && git pull --quiet && git checkout -";
no-ff = "merge --no-ff";
pl = "pull";
prune = "remote prune origin";
@ -71,12 +71,10 @@
repush = "!git pull --rebase && git push";
ri = "rebase --interactive";
rid = "!git rebase -i $(git merge-base develop HEAD)";
rim =
"!git rebase -i $(git master-to-main-wrapper merge-base %BRANCH% HEAD)";
rim = "!git rebase -i $(git master-to-main-wrapper merge-base %BRANCH% HEAD)";
rip = "!git rebase -i $(git merge-base production HEAD)";
ris = "!git rebase -i $(git merge-base staging HEAD)";
riu =
"!git rebase -i $(git rev-parse --abbrev-ref --symbolic-full-name @{u})";
riu = "!git rebase -i $(git rev-parse --abbrev-ref --symbolic-full-name @{u})";
rmup = "!git mup && git master-to-main-wrapper rebase %BRANCH%";
sl = "log --oneline --decorate -20";
sla = "log --oneline --decorate --graph --all -20";
@ -87,8 +85,7 @@
unassume = "update-index --no-assume-unchanged";
uncommit = "reset --soft HEAD^";
unstage = "reset";
update =
"!git fetch --all --jobs=4 --prune --progress && git rebase --autostash --stat";
update = "!git fetch --all --jobs=4 --prune --progress && git rebase --autostash --stat";
upstream = "rev-parse --abbrev-ref --symbolic-full-name @{u}";
ureset = "!git reset --hard $(git upstream)";
worktrees = "worktree list";
@ -103,7 +100,9 @@
checkout.defaultRemote = "origin";
color.ui = true;
column.ui = "auto";
commit = { template = "~/.gitmessage"; };
commit = {
template = "~/.gitmessage";
};
core = {
editor = "nvim";
excludesFile = "~/.config/git/ignore";

View file

@ -1,7 +1,9 @@
{ inputs }:
{ pkgs, ... }:
let system = pkgs.system;
in {
let
system = pkgs.system;
in
{
programs.neovim = inputs.opdavies-nvim.lib.mkHomeManager { inherit system; };
home.file.".markdownlint.yaml".text = ''

View file

@ -1,4 +1,5 @@
{ self, ... }: {
{ self, ... }:
{
xdg.configFile.phpactor = {
source = "${self}/config/phpactor";
recursive = true;

View file

@ -1,4 +1,5 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
home.packages = with pkgs; [ ripgrep ];
xdg.configFile."ripgrep/config".text = ''

View file

@ -1,6 +1,8 @@
{ pkgs, ... }:
let inherit (pkgs) tmuxPlugins;
in {
let
inherit (pkgs) tmuxPlugins;
in
{
programs.tmux = {
enable = true;
@ -106,7 +108,10 @@ in {
if-shell "[ -f ~/.tmux.conf.local ]" 'source ~/.tmux.conf.local'
'';
plugins =
[ tmuxPlugins.resurrect tmuxPlugins.vim-tmux-navigator tmuxPlugins.yank ];
plugins = [
tmuxPlugins.resurrect
tmuxPlugins.vim-tmux-navigator
tmuxPlugins.yank
];
};
}

View file

@ -1,7 +1,8 @@
{ pkgs, self, ... }:
let
theme = import "${self}/lib/theme" { inherit pkgs; };
in {
in
{
programs.wezterm = {
enable = true;
enableZshIntegration = true;

View file

@ -15,7 +15,7 @@
ls = "lsd";
run = "./run";
s = "secrets";
secrets = "doppler --project \"$(whoami)\" run";
secrets = ''doppler --project "$(whoami)" run'';
switch = "run nixos nixedo switch";
sz = "source ~/.config/zsh/.zshrc";
tag = "tag-release";
@ -62,7 +62,7 @@
};
shellGlobalAliases = {
A1 = "| awk '{print \$1}'";
A1 = "| awk '{print $1}'";
Fj = "| jq .";
Fy = "| yq .";
G = "| grep";
@ -175,7 +175,10 @@
plugins = [
{
name = "themes/robbyrussell";
tags = [ "from:oh-my-zsh" "as:theme" ];
tags = [
"from:oh-my-zsh"
"as:theme"
];
}
{
name = "plugin/git";

View file

@ -1,4 +1,5 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
fonts = {
monospace = {
name = "MesloLGSDZ Nerd Font Mono";

View file

@ -1,31 +1,43 @@
{ inputs, self, username }:
{
inputs,
self,
username,
}:
{ system }:
let
pkgs = inputs.nixpkgs.legacyPackages.${system};
shared-config = import "${self}/lib/shared/home-manager.nix" {
inherit inputs pkgs self username;
inherit
inputs
pkgs
self
username
;
};
shared-packages = import "${self}/lib/shared/home-manager-packages.nix" {
inherit inputs pkgs;
};
in inputs.home-manager.lib.homeManagerConfiguration {
shared-packages = import "${self}/lib/shared/home-manager-packages.nix" { inherit inputs pkgs; };
in
inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit self; };
extraSpecialArgs = {
inherit self;
};
modules = [{
imports = [ shared-config ];
modules = [
{
imports = [ shared-config ];
home.packages = shared-packages;
home.packages = shared-packages;
home.sessionVariables = {
EDITOR = "nvim";
PATH = "$PATH:./vendor/bin:./node_modules/.bin";
PULUMI_SKIP_UPDATE_CHECK = "true";
REPOS = "$HOME/Code";
RIPGREP_CONFIG_PATH = "$HOME/.config/ripgrep/config";
};
}];
home.sessionVariables = {
EDITOR = "nvim";
PATH = "$PATH:./vendor/bin:./node_modules/.bin";
PULUMI_SKIP_UPDATE_CHECK = "true";
REPOS = "$HOME/Code";
RIPGREP_CONFIG_PATH = "$HOME/.config/ripgrep/config";
};
}
];
}