This commit is contained in:
Dave Gallant
2024-09-17 23:49:08 -04:00
parent b2c4f78049
commit 040581e146
12 changed files with 269 additions and 150 deletions

View File

@@ -1,7 +1,9 @@
let let
nix-pre-commit-hooks = import (builtins.fetchTarball nix-pre-commit-hooks = import (
"https://github.com/cachix/git-hooks.nix/tarball/master"); builtins.fetchTarball "https://github.com/cachix/git-hooks.nix/tarball/master"
in { );
in
{
pre-commit-check = nix-pre-commit-hooks.run { pre-commit-check = nix-pre-commit-hooks.run {
src = ./.; src = ./.;
hooks = { hooks = {

205
flake.nix
View File

@@ -20,96 +20,127 @@
stylix.url = "github:danth/stylix/release-24.05"; stylix.url = "github:danth/stylix/release-24.05";
}; };
outputs = { self, darwin, home-manager, nixpkgs, nixpkgs-unstable outputs =
, nixos-hardware, stylix, ... }@inputs: { {
nixosConfigurations = let self,
unstable = import nixpkgs-unstable { darwin,
system = "x86_64-linux"; home-manager,
config.allowUnfree = true; nixpkgs,
}; nixpkgs-unstable,
in { nixos-hardware,
hephaestus = nixpkgs.lib.nixosSystem { stylix,
specialArgs = { inherit unstable; }; ...
modules = [ }@inputs:
./fonts.nix {
./machines/hephaestus/configuration.nix nixosConfigurations =
./packages.nix let
./services/netdata/default.nix unstable = import nixpkgs-unstable {
./upgrade-diff.nix system = "x86_64-linux";
home-manager.nixosModules.home-manager config.allowUnfree = true;
stylix.nixosModules.stylix };
in
{
hephaestus = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit unstable;
};
modules = [
./fonts.nix
./machines/hephaestus/configuration.nix
./packages.nix
./services/netdata/default.nix
./upgrade-diff.nix
home-manager.nixosModules.home-manager
stylix.nixosModules.stylix
({ config, lib, ... }: { (
config = { { config, lib, ... }:
nix = { {
settings = { config = {
auto-optimise-store = true; nix = {
sandbox = false; settings = {
substituters = [ "https://davegallant.cachix.org" ]; auto-optimise-store = true;
trusted-users = [ "root" "dave" ]; sandbox = false;
trusted-public-keys = [ substituters = [ "https://davegallant.cachix.org" ];
"davegallant.cachix.org-1:SsUMqL4+tF2R3/G6X903E9laLlY1rES2QKFfePegF08=" trusted-users = [
]; "root"
"dave"
];
trusted-public-keys = [ "davegallant.cachix.org-1:SsUMqL4+tF2R3/G6X903E9laLlY1rES2QKFfePegF08=" ];
};
registry = {
nixpkgs.flake = nixpkgs;
};
gc = {
automatic = true;
dates = "daily";
options = "--delete-older-than 14d";
};
};
nixpkgs.overlays = [ (import ./overlays) ];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.dave.imports = [
./home/default.nix
inputs.nixvim.homeManagerModules.nixvim
];
extraSpecialArgs = {
inherit unstable;
};
};
}; };
registry = { nixpkgs.flake = nixpkgs; }; }
gc = { )
automatic = true; ];
dates = "daily"; };
options = "--delete-older-than 14d"; };
darwinConfigurations =
let
system = "aarch64-darwin";
unstable = import nixpkgs-unstable {
config.allowUnfree = true;
inherit system;
};
in
{
zelus = darwin.lib.darwinSystem {
inherit system;
specialArgs = {
inherit unstable;
};
modules = [
home-manager.darwinModules.home-manager
stylix.darwinModules.stylix
./machines/zelus/configuration.nix
./packages.nix
./upgrade-diff.nix
(
{ config, ... }:
{
config = {
nixpkgs.overlays = [ (import ./overlays) ];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users."dave.gallant".imports = [
./home/default.nix
inputs.nixvim.homeManagerModules.nixvim
];
extraSpecialArgs = {
inherit unstable;
};
};
}; };
}; }
)
nixpkgs.overlays = [ (import ./overlays) ]; ];
};
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.dave.imports = [
./home/default.nix
inputs.nixvim.homeManagerModules.nixvim
];
extraSpecialArgs = { inherit unstable; };
};
};
})
];
}; };
};
darwinConfigurations = let
system = "aarch64-darwin";
unstable = import nixpkgs-unstable {
config.allowUnfree = true;
inherit system;
};
in {
zelus = darwin.lib.darwinSystem {
inherit system;
specialArgs = { inherit unstable; };
modules = [
home-manager.darwinModules.home-manager
stylix.darwinModules.stylix
./machines/zelus/configuration.nix
./packages.nix
./upgrade-diff.nix
({ config, ... }: {
config = {
nixpkgs.overlays = [ (import ./overlays) ];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users."dave.gallant".imports = [
./home/default.nix
inputs.nixvim.homeManagerModules.nixvim
];
extraSpecialArgs = { inherit unstable; };
};
};
})
];
};
};
}; };
} }

View File

@@ -1,4 +1,5 @@
{ pkgs, ... }: { { pkgs, ... }:
{
fonts.packages = with pkgs; [ fonts.packages = with pkgs; [
dejavu_fonts dejavu_fonts
fira-code fira-code

View File

@@ -1,6 +1,13 @@
{ lib, pkgs, unstable, ... }: {
let inherit (pkgs) stdenv; lib,
in { pkgs,
unstable,
...
}:
let
inherit (pkgs) stdenv;
in
{
home.stateVersion = "24.05"; home.stateVersion = "24.05";
home.packages = with pkgs; [ just ]; home.packages = with pkgs; [ just ];
@@ -16,8 +23,7 @@ in {
opacity.terminal = 1.0; opacity.terminal = 1.0;
fonts.sizes = fonts.sizes = if stdenv.isLinux then { terminal = 20; } else { terminal = 16; };
if stdenv.isLinux then { terminal = 20; } else { terminal = 16; };
fonts.monospace = { fonts.monospace = {
name = "FiraCode Nerd Font Mono"; name = "FiraCode Nerd Font Mono";
@@ -67,20 +73,17 @@ in {
d = "diff"; d = "diff";
dc = "diff --cached"; dc = "diff --cached";
dcn = "diff --cached --name-only"; dcn = "diff --cached --name-only";
ds = ds = "! git diff origin | sed -r 's/value: (.*)/value: \"************\"/'";
"! git diff origin | sed -r 's/value: (.*)/value: \"************\"/'"; l = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
l =
"log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
ms = "merge --squash"; ms = "merge --squash";
p = "push origin"; p = "push origin";
pf = "push -f"; pf = "push -f";
pl = "! git pull origin $(git rev-parse --abbrev-ref HEAD)"; pl = "! git pull origin $(git rev-parse --abbrev-ref HEAD)";
st = "status"; st = "status";
wip = wip = "for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads";
"for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads";
}; };
includes = [{ path = "~/.gitconfig-work"; }]; includes = [ { path = "~/.gitconfig-work"; } ];
delta = { delta = {
enable = true; enable = true;
@@ -98,8 +101,12 @@ in {
}; };
extraConfig = { extraConfig = {
push = { default = "current"; }; push = {
pull = { rebase = true; }; default = "current";
};
pull = {
rebase = true;
};
}; };
}; };
@@ -110,8 +117,12 @@ in {
settings = { settings = {
add_newline = false; add_newline = false;
scan_timeout = 10; scan_timeout = 10;
character = { error_symbol = "[](bold red)"; }; character = {
gcloud = { format = ""; }; error_symbol = "[](bold red)";
};
gcloud = {
format = "";
};
kubernetes = { kubernetes = {
disabled = false; disabled = false;
context_aliases = { context_aliases = {
@@ -205,7 +216,9 @@ in {
v = "nvim"; v = "nvim";
}; };
"oh-my-zsh" = { enable = true; }; "oh-my-zsh" = {
enable = true;
};
}; };
alacritty = { alacritty = {
@@ -219,12 +232,19 @@ in {
shell = { shell = {
program = "zsh"; program = "zsh";
args = [ "-l" "-c" "tmux" "u" ]; args = [
"-l"
"-c"
"tmux"
"u"
];
}; };
}; };
}; };
go = { enable = true; }; go = {
enable = true;
};
tmux = { tmux = {
enable = true; enable = true;
@@ -319,7 +339,9 @@ in {
''; '';
}; };
fzf = { enable = true; }; fzf = {
enable = true;
};
nixvim = { nixvim = {
enable = true; enable = true;
@@ -330,7 +352,9 @@ in {
key = "<C-n>"; key = "<C-n>";
mode = [ "n" ]; mode = [ "n" ];
action = "<cmd>tabnew<cr>"; action = "<cmd>tabnew<cr>";
options = { silent = true; }; options = {
silent = true;
};
} }
{ {
key = "<leader>y"; key = "<leader>y";
@@ -413,7 +437,11 @@ in {
enable = true; enable = true;
settings.defaults = { settings.defaults = {
layout_strategy = "vertical"; layout_strategy = "vertical";
layout_config = { vertical = { width = 0.9; }; }; layout_config = {
vertical = {
width = 0.9;
};
};
}; };
package = pkgs.vimPlugins.telescope-fzy-native-nvim; package = pkgs.vimPlugins.telescope-fzy-native-nvim;
}; };
@@ -422,7 +450,10 @@ in {
autoindent = true; autoindent = true;
backup = false; backup = false;
belloff = "all"; belloff = "all";
completeopt = [ "menuone" "noselect" ]; completeopt = [
"menuone"
"noselect"
];
cursorline = true; cursorline = true;
expandtab = true; expandtab = true;
fillchars = { fillchars = {
@@ -499,7 +530,8 @@ in {
vscode = { vscode = {
enable = true; enable = true;
package = pkgs.vscode; package = pkgs.vscode;
extensions = with pkgs.vscode-extensions; extensions =
with pkgs.vscode-extensions;
[ [
bbenoist.nix bbenoist.nix
github.vscode-pull-request-github github.vscode-pull-request-github
@@ -508,7 +540,8 @@ in {
ms-dotnettools.csharp ms-dotnettools.csharp
ms-kubernetes-tools.vscode-kubernetes-tools ms-kubernetes-tools.vscode-kubernetes-tools
redhat.vscode-yaml redhat.vscode-yaml
] ++ lib.optionals stdenv.isLinux [ ]
++ lib.optionals stdenv.isLinux [
ms-vsliveshare.vsliveshare ms-vsliveshare.vsliveshare
ms-python.python ms-python.python
]; ];
@@ -529,8 +562,7 @@ in {
"dom.push.enabled" = false; "dom.push.enabled" = false;
"geo.enabled" = false; "geo.enabled" = false;
"intl.regional_prefs.use_os_locales" = true; "intl.regional_prefs.use_os_locales" = true;
"services.sync.prefs.sync.intl.regional._prefs.use_os_locates" = "services.sync.prefs.sync.intl.regional._prefs.use_os_locates" = false;
false;
}; };
name = "dev-edition-default"; name = "dev-edition-default";
path = "6b7pm104.dev-edition-default"; path = "6b7pm104.dev-edition-default";

View File

@@ -1,4 +1,11 @@
{ config, lib, modulesPath, pkgs, unstable, ... }: {
config,
lib,
modulesPath,
pkgs,
unstable,
...
}:
let let
gnomeExtensions = with pkgs.gnomeExtensions; [ gnomeExtensions = with pkgs.gnomeExtensions; [
appindicator appindicator
@@ -12,17 +19,16 @@ let
tailscale-status tailscale-status
tray-icons-reloaded tray-icons-reloaded
]; ];
in { in
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
stylix = { stylix = {
enable = true; enable = true;
base16Scheme = base16Scheme = "${unstable.base16-schemes}/share/themes/tokyo-night-dark.yaml";
"${unstable.base16-schemes}/share/themes/tokyo-night-dark.yaml";
image = pkgs.fetchurl { image = pkgs.fetchurl {
url = url = "https://github.com/davegallant/nix-config/blob/main/nixos-wallpaper.png?raw=true";
"https://github.com/davegallant/nix-config/blob/main/nixos-wallpaper.png?raw=true";
sha256 = "Ztqn9+CHslr6wZdnOTeo/YNi/ICerpcFLyMArsZ/PIY="; sha256 = "Ztqn9+CHslr6wZdnOTeo/YNi/ICerpcFLyMArsZ/PIY=";
}; };
polarity = "dark"; polarity = "dark";
@@ -48,15 +54,23 @@ in {
supportedFilesystems = [ "ntfs" ]; supportedFilesystems = [ "ntfs" ];
initrd = { initrd = {
availableKernelModules = availableKernelModules = [
[ "ahci" "nvme" "sd_mod" "usb_storage" "usbhid" "xhci_pci" ]; "ahci"
"nvme"
"sd_mod"
"usb_storage"
"usbhid"
"xhci_pci"
];
luks.devices."root" = { luks.devices."root" = {
allowDiscards = true; allowDiscards = true;
device = "/dev/disk/by-uuid/21cd166c-1528-49a4-b31b-0d408d48aa80"; device = "/dev/disk/by-uuid/21cd166c-1528-49a4-b31b-0d408d48aa80";
preLVM = true; preLVM = true;
keyFile = "./keyfile0.bin"; keyFile = "./keyfile0.bin";
}; };
secrets = { "keyfile0.bin" = "/etc/secrets/initrd/keyfile0.bin"; }; secrets = {
"keyfile0.bin" = "/etc/secrets/initrd/keyfile0.bin";
};
}; };
}; };
@@ -65,7 +79,8 @@ in {
keyMap = "us"; keyMap = "us";
}; };
environment.systemPackages = with pkgs; environment.systemPackages =
with pkgs;
[ [
android-tools android-tools
bitwarden bitwarden
@@ -111,7 +126,8 @@ in {
wine wine
wine64 wine64
wireshark-qt wireshark-qt
] ++ gnomeExtensions; ]
++ gnomeExtensions;
fileSystems = { fileSystems = {
"/" = { "/" = {
@@ -136,8 +152,7 @@ in {
}; };
}; };
swapDevices = swapDevices = [ { device = "/dev/disk/by-uuid/5d6d0388-2b15-4ff1-9f0f-391818a76090"; } ];
[{ device = "/dev/disk/by-uuid/5d6d0388-2b15-4ff1-9f0f-391818a76090"; }];
nixpkgs = { nixpkgs = {
hostPlatform = "x86_64-linux"; hostPlatform = "x86_64-linux";
@@ -150,7 +165,9 @@ in {
networking = { networking = {
iproute2.enable = true; iproute2.enable = true;
hostName = "hephaestus"; hostName = "hephaestus";
interfaces.enp34s0 = { useDHCP = true; }; interfaces.enp34s0 = {
useDHCP = true;
};
firewall = { firewall = {
allowPing = false; allowPing = false;
enable = true; enable = true;
@@ -159,18 +176,27 @@ in {
}; };
}; };
systemd.services = { NetworkManager-wait-online.enable = false; }; systemd.services = {
NetworkManager-wait-online.enable = false;
};
system = { system = {
autoUpgrade.enable = true; autoUpgrade.enable = true;
stateVersion = "24.05"; stateVersion = "24.05";
}; };
nix = { extraOptions = "experimental-features = nix-command flakes"; }; nix = {
extraOptions = "experimental-features = nix-command flakes";
};
users.users.dave = { users.users.dave = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ "docker" "wheel" "libvirtd" "corectrl" ]; extraGroups = [
"docker"
"wheel"
"libvirtd"
"corectrl"
];
shell = pkgs.zsh; shell = pkgs.zsh;
}; };
@@ -185,8 +211,7 @@ in {
hardware = { hardware = {
opengl.enable = true; opengl.enable = true;
cpu.amd.updateMicrocode = cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
lib.mkDefault config.hardware.enableRedistributableFirmware;
pulseaudio.enable = true; pulseaudio.enable = true;
# Vulkan # Vulkan
opengl.driSupport = true; opengl.driSupport = true;

View File

@@ -1,6 +1,8 @@
{ pkgs, ... }: { pkgs, ... }:
let checkBrew = "command -v brew > /dev/null"; let
in { checkBrew = "command -v brew > /dev/null";
in
{
nixpkgs = { nixpkgs = {
config = { config = {
allowUnfree = true; allowUnfree = true;
@@ -8,7 +10,9 @@ in {
}; };
}; };
networking = { hostName = "zelus"; }; networking = {
hostName = "zelus";
};
services.nix-daemon.enable = true; services.nix-daemon.enable = true;
@@ -28,7 +32,9 @@ in {
extraInit = '' extraInit = ''
${checkBrew} || >&2 echo "brew is not installed (install it via https://brew.sh)" ${checkBrew} || >&2 echo "brew is not installed (install it via https://brew.sh)"
''; '';
variables = { LANG = "en_US.UTF-8"; }; variables = {
LANG = "en_US.UTF-8";
};
}; };
system.defaults = { system.defaults = {
@@ -69,7 +75,9 @@ in {
enable = true; enable = true;
onActivation.autoUpdate = false; onActivation.autoUpdate = false;
onActivation.upgrade = false; onActivation.upgrade = false;
global = { brewfile = true; }; global = {
brewfile = true;
};
brews = [ brews = [
"azure-cli" "azure-cli"

View File

@@ -1,4 +1,9 @@
{ lib, fetchFromGitHub, pkgs, stdenv, }: {
lib,
fetchFromGitHub,
pkgs,
stdenv,
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "sbx-h6-rgb"; pname = "sbx-h6-rgb";
version = "95b4ef9788ef94e557a4d1e815079d5ea8a70943"; version = "95b4ef9788ef94e557a4d1e815079d5ea8a70943";

View File

@@ -1,4 +1,8 @@
{ lib, fetchFromGitHub, buildGoModule, }: {
lib,
fetchFromGitHub,
buildGoModule,
}:
buildGoModule rec { buildGoModule rec {
pname = "vpngate"; pname = "vpngate";
version = "v0.3.0"; version = "v0.3.0";

View File

@@ -1,6 +1,14 @@
{ config, lib, pkgs, unstable, ... }: {
let inherit (pkgs) stdenv; config,
in { lib,
pkgs,
unstable,
...
}:
let
inherit (pkgs) stdenv;
in
{
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# essentials # essentials
curl curl

View File

@@ -3,7 +3,8 @@ let
netdata = pkgs.netdata; netdata = pkgs.netdata;
netdataConf = ./netdata.conf; netdataConf = ./netdata.conf;
netdataDir = "/var/lib/netdata"; netdataDir = "/var/lib/netdata";
in { in
{
users.extraGroups.netdata.gid = 220008; users.extraGroups.netdata.gid = 220008;
users.users.netdata.group = "netdata"; users.users.netdata.group = "netdata";
users.extraUsers.netdata = { users.extraUsers.netdata = {

View File

@@ -5,7 +5,8 @@ let
overlays = [ ]; overlays = [ ];
}; };
in pkgs.mkShell { in
pkgs.mkShell {
shellHook = '' shellHook = ''
${(import ./default.nix).pre-commit-check.shellHook} ${(import ./default.nix).pre-commit-check.shellHook}
''; '';

View File

@@ -1,4 +1,5 @@
{ pkgs, ... }: { { pkgs, ... }:
{
system.activationScripts.diff = { system.activationScripts.diff = {
supportsDryActivation = true; supportsDryActivation = true;
text = '' text = ''