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
nix-pre-commit-hooks = import (builtins.fetchTarball
"https://github.com/cachix/git-hooks.nix/tarball/master");
in {
nix-pre-commit-hooks = import (
builtins.fetchTarball "https://github.com/cachix/git-hooks.nix/tarball/master"
);
in
{
pre-commit-check = nix-pre-commit-hooks.run {
src = ./.;
hooks = {

View File

@@ -20,16 +20,30 @@
stylix.url = "github:danth/stylix/release-24.05";
};
outputs = { self, darwin, home-manager, nixpkgs, nixpkgs-unstable
, nixos-hardware, stylix, ... }@inputs: {
nixosConfigurations = let
outputs =
{
self,
darwin,
home-manager,
nixpkgs,
nixpkgs-unstable,
nixos-hardware,
stylix,
...
}@inputs:
{
nixosConfigurations =
let
unstable = import nixpkgs-unstable {
system = "x86_64-linux";
config.allowUnfree = true;
};
in {
in
{
hephaestus = nixpkgs.lib.nixosSystem {
specialArgs = { inherit unstable; };
specialArgs = {
inherit unstable;
};
modules = [
./fonts.nix
./machines/hephaestus/configuration.nix
@@ -39,19 +53,24 @@
home-manager.nixosModules.home-manager
stylix.nixosModules.stylix
({ config, lib, ... }: {
(
{ config, lib, ... }:
{
config = {
nix = {
settings = {
auto-optimise-store = true;
sandbox = false;
substituters = [ "https://davegallant.cachix.org" ];
trusted-users = [ "root" "dave" ];
trusted-public-keys = [
"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;
};
registry = { nixpkgs.flake = nixpkgs; };
gc = {
automatic = true;
dates = "daily";
@@ -68,24 +87,31 @@
./home/default.nix
inputs.nixvim.homeManagerModules.nixvim
];
extraSpecialArgs = { inherit unstable; };
extraSpecialArgs = {
inherit unstable;
};
};
})
};
}
)
];
};
};
darwinConfigurations = let
darwinConfigurations =
let
system = "aarch64-darwin";
unstable = import nixpkgs-unstable {
config.allowUnfree = true;
inherit system;
};
in {
in
{
zelus = darwin.lib.darwinSystem {
inherit system;
specialArgs = { inherit unstable; };
specialArgs = {
inherit unstable;
};
modules = [
home-manager.darwinModules.home-manager
@@ -94,7 +120,9 @@
./packages.nix
./upgrade-diff.nix
({ config, ... }: {
(
{ config, ... }:
{
config = {
nixpkgs.overlays = [ (import ./overlays) ];
home-manager = {
@@ -104,10 +132,13 @@
./home/default.nix
inputs.nixvim.homeManagerModules.nixvim
];
extraSpecialArgs = { inherit unstable; };
extraSpecialArgs = {
inherit unstable;
};
};
})
};
}
)
];
};
};

View File

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

View File

@@ -1,6 +1,13 @@
{ lib, pkgs, unstable, ... }:
let inherit (pkgs) stdenv;
in {
{
lib,
pkgs,
unstable,
...
}:
let
inherit (pkgs) stdenv;
in
{
home.stateVersion = "24.05";
home.packages = with pkgs; [ just ];
@@ -16,8 +23,7 @@ in {
opacity.terminal = 1.0;
fonts.sizes =
if stdenv.isLinux then { terminal = 20; } else { terminal = 16; };
fonts.sizes = if stdenv.isLinux then { terminal = 20; } else { terminal = 16; };
fonts.monospace = {
name = "FiraCode Nerd Font Mono";
@@ -67,20 +73,17 @@ in {
d = "diff";
dc = "diff --cached";
dcn = "diff --cached --name-only";
ds =
"! 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";
ds = "! 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";
ms = "merge --squash";
p = "push origin";
pf = "push -f";
pl = "! git pull origin $(git rev-parse --abbrev-ref HEAD)";
st = "status";
wip =
"for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads";
wip = "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 = {
enable = true;
@@ -98,8 +101,12 @@ in {
};
extraConfig = {
push = { default = "current"; };
pull = { rebase = true; };
push = {
default = "current";
};
pull = {
rebase = true;
};
};
};
@@ -110,8 +117,12 @@ in {
settings = {
add_newline = false;
scan_timeout = 10;
character = { error_symbol = "[](bold red)"; };
gcloud = { format = ""; };
character = {
error_symbol = "[](bold red)";
};
gcloud = {
format = "";
};
kubernetes = {
disabled = false;
context_aliases = {
@@ -205,7 +216,9 @@ in {
v = "nvim";
};
"oh-my-zsh" = { enable = true; };
"oh-my-zsh" = {
enable = true;
};
};
alacritty = {
@@ -219,12 +232,19 @@ in {
shell = {
program = "zsh";
args = [ "-l" "-c" "tmux" "u" ];
args = [
"-l"
"-c"
"tmux"
"u"
];
};
};
};
go = { enable = true; };
go = {
enable = true;
};
tmux = {
enable = true;
@@ -319,7 +339,9 @@ in {
'';
};
fzf = { enable = true; };
fzf = {
enable = true;
};
nixvim = {
enable = true;
@@ -330,7 +352,9 @@ in {
key = "<C-n>";
mode = [ "n" ];
action = "<cmd>tabnew<cr>";
options = { silent = true; };
options = {
silent = true;
};
}
{
key = "<leader>y";
@@ -413,7 +437,11 @@ in {
enable = true;
settings.defaults = {
layout_strategy = "vertical";
layout_config = { vertical = { width = 0.9; }; };
layout_config = {
vertical = {
width = 0.9;
};
};
};
package = pkgs.vimPlugins.telescope-fzy-native-nvim;
};
@@ -422,7 +450,10 @@ in {
autoindent = true;
backup = false;
belloff = "all";
completeopt = [ "menuone" "noselect" ];
completeopt = [
"menuone"
"noselect"
];
cursorline = true;
expandtab = true;
fillchars = {
@@ -499,7 +530,8 @@ in {
vscode = {
enable = true;
package = pkgs.vscode;
extensions = with pkgs.vscode-extensions;
extensions =
with pkgs.vscode-extensions;
[
bbenoist.nix
github.vscode-pull-request-github
@@ -508,7 +540,8 @@ in {
ms-dotnettools.csharp
ms-kubernetes-tools.vscode-kubernetes-tools
redhat.vscode-yaml
] ++ lib.optionals stdenv.isLinux [
]
++ lib.optionals stdenv.isLinux [
ms-vsliveshare.vsliveshare
ms-python.python
];
@@ -529,8 +562,7 @@ in {
"dom.push.enabled" = false;
"geo.enabled" = false;
"intl.regional_prefs.use_os_locales" = true;
"services.sync.prefs.sync.intl.regional._prefs.use_os_locates" =
false;
"services.sync.prefs.sync.intl.regional._prefs.use_os_locates" = false;
};
name = "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
gnomeExtensions = with pkgs.gnomeExtensions; [
appindicator
@@ -12,17 +19,16 @@ let
tailscale-status
tray-icons-reloaded
];
in {
in
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
stylix = {
enable = true;
base16Scheme =
"${unstable.base16-schemes}/share/themes/tokyo-night-dark.yaml";
base16Scheme = "${unstable.base16-schemes}/share/themes/tokyo-night-dark.yaml";
image = pkgs.fetchurl {
url =
"https://github.com/davegallant/nix-config/blob/main/nixos-wallpaper.png?raw=true";
url = "https://github.com/davegallant/nix-config/blob/main/nixos-wallpaper.png?raw=true";
sha256 = "Ztqn9+CHslr6wZdnOTeo/YNi/ICerpcFLyMArsZ/PIY=";
};
polarity = "dark";
@@ -48,15 +54,23 @@ in {
supportedFilesystems = [ "ntfs" ];
initrd = {
availableKernelModules =
[ "ahci" "nvme" "sd_mod" "usb_storage" "usbhid" "xhci_pci" ];
availableKernelModules = [
"ahci"
"nvme"
"sd_mod"
"usb_storage"
"usbhid"
"xhci_pci"
];
luks.devices."root" = {
allowDiscards = true;
device = "/dev/disk/by-uuid/21cd166c-1528-49a4-b31b-0d408d48aa80";
preLVM = true;
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";
};
environment.systemPackages = with pkgs;
environment.systemPackages =
with pkgs;
[
android-tools
bitwarden
@@ -111,7 +126,8 @@ in {
wine
wine64
wireshark-qt
] ++ gnomeExtensions;
]
++ gnomeExtensions;
fileSystems = {
"/" = {
@@ -136,8 +152,7 @@ in {
};
};
swapDevices =
[{ device = "/dev/disk/by-uuid/5d6d0388-2b15-4ff1-9f0f-391818a76090"; }];
swapDevices = [ { device = "/dev/disk/by-uuid/5d6d0388-2b15-4ff1-9f0f-391818a76090"; } ];
nixpkgs = {
hostPlatform = "x86_64-linux";
@@ -150,7 +165,9 @@ in {
networking = {
iproute2.enable = true;
hostName = "hephaestus";
interfaces.enp34s0 = { useDHCP = true; };
interfaces.enp34s0 = {
useDHCP = true;
};
firewall = {
allowPing = false;
enable = true;
@@ -159,18 +176,27 @@ in {
};
};
systemd.services = { NetworkManager-wait-online.enable = false; };
systemd.services = {
NetworkManager-wait-online.enable = false;
};
system = {
autoUpgrade.enable = true;
stateVersion = "24.05";
};
nix = { extraOptions = "experimental-features = nix-command flakes"; };
nix = {
extraOptions = "experimental-features = nix-command flakes";
};
users.users.dave = {
isNormalUser = true;
extraGroups = [ "docker" "wheel" "libvirtd" "corectrl" ];
extraGroups = [
"docker"
"wheel"
"libvirtd"
"corectrl"
];
shell = pkgs.zsh;
};
@@ -185,8 +211,7 @@ in {
hardware = {
opengl.enable = true;
cpu.amd.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
pulseaudio.enable = true;
# Vulkan
opengl.driSupport = true;

View File

@@ -1,6 +1,8 @@
{ pkgs, ... }:
let checkBrew = "command -v brew > /dev/null";
in {
let
checkBrew = "command -v brew > /dev/null";
in
{
nixpkgs = {
config = {
allowUnfree = true;
@@ -8,7 +10,9 @@ in {
};
};
networking = { hostName = "zelus"; };
networking = {
hostName = "zelus";
};
services.nix-daemon.enable = true;
@@ -28,7 +32,9 @@ in {
extraInit = ''
${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 = {
@@ -69,7 +75,9 @@ in {
enable = true;
onActivation.autoUpdate = false;
onActivation.upgrade = false;
global = { brewfile = true; };
global = {
brewfile = true;
};
brews = [
"azure-cli"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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