chore: hax

This commit is contained in:
truxnell 2024-03-25 22:51:18 +11:00
parent 57d59e5f69
commit e6243b48ba
17 changed files with 104 additions and 60 deletions

3
docs/vm/faq.md Normal file
View file

@ -0,0 +1,3 @@
## Why not recurse the module folder
Imports are special in NIX and its important that they are definet at runtime for lazy evaluation - if you do optional/coded imports not everything is avaliable for evaluating.

View file

@ -9,7 +9,6 @@
imports = [
# Common imports
../common/optional/fish.nix
../common/optional/gnome.nix
../common/optional/editors/vscode
../common/optional/firefox.nix
@ -25,13 +24,13 @@
fileSystems."/" =
{
device = "/dev/disk/by-label/701fc943-ede7-41ed-8a53-3cc38fc68fe5";
device = "/dev/disk/by-uuid/701fc943-ede7-41ed-8a53-3cc38fc68fe5";
fsType = "ext4";
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/C634-F571";
device = "/dev/disk/by-uuid/1D5B-36D3";
fsType = "vfat";
};

View file

@ -1,32 +0,0 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
fileSystems."/" =
{
device = "/dev/disk/by-uuid/701fc943-ede7-41ed-8a53-3cc38fc68fe5";
fsType = "ext4";
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/C634-F571";
fsType = "vfat";
};
swapDevices = [ ];
# 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
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp12s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp13s0.useDHCP = lib.mkDefault true;
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -1,10 +0,0 @@
{
programs.fish = {
enable = true;
vendor = {
completions.enable = true;
config.enable = true;
functions.enable = true;
};
};
}

View file

@ -7,7 +7,6 @@
, ...
}: {
imports = [
../common/optional/fish.nix
../common/optional/monitoring.nix
../common/optional/reboot-required.nix

View file

@ -9,7 +9,6 @@
imports = [
# Common imports
../common/optional/fish.nix
../common/optional/gnome.nix
../common/optional/editors/vscode
../common/optional/firefox.nix

View file

@ -1,5 +1,7 @@
{
imports = [
./system
./programs
];
}

View file

@ -0,0 +1,5 @@
{
imports = [
./shell
];
}

View file

@ -0,0 +1,5 @@
{
imports = [
./fish.nix
];
}

View file

@ -0,0 +1,46 @@
{ lib
, config
, self
, pkgs
, ...
}:
with lib;
let
cfg = config.mySystem.shell.fish;
in
{
options.mySystem.shell.fish =
{
enable = mkEnableOption "Fish";
enablePlugins = mkOption
{
type = lib.types.bool;
description = "If we want to add fish plugins";
default = true;
};
}
# Install fish systemwide
config.programs.fish = mkIf cfg.enable {
enable = true;
vendor = {
completions.enable = true;
config.enable = true;
functions.enable = true;
};
};
# Install fish plugins systemwide
config.mySystem.system.packages = with pkgs; mkIf cfg.enable [
fishPlugins.done
fishPlugins.fzf-fish
fishPlugins.forgit
fishPlugins.hydro
fzf
fishPlugins.grc
grc
];
}

View file

@ -17,7 +17,7 @@ in
};
gc = {
enabled = mkEnableOption "automatic garbage collection" // {
enable = mkEnableOption "automatic garbage collection" // {
default = true;
};
persistent = mkOption
@ -35,9 +35,9 @@ in
optimise.automatic = cfg.autoOptimiseStore;
# automatically garbage collect nix store
gc = mkIf cfg.gc.enabled {
gc = mkIf cfg.gc.enable {
# garbage collection
automatic = cfg.gc.enabled;
automatic = cfg.gc.enable;
options = "--delete-older-than 30d";
persistent = cfg.gc.persistent;
};

View file

@ -13,11 +13,7 @@ with lib;
imports =
[
(modulesPath + "/installer/scan/not-detected.nix") # Generated by nixos-config-generate
./global/nix.nix
./global/users.nix
./global/sops.nix
./global/nixpkgs.nix
./global/system.nix
./global
];
mySystem = {
@ -26,8 +22,14 @@ with lib;
time.timeZone = "Australia/Melbourne";
security.increaseWheelLoginLimits = true;
system.packages = [ pkgs.bat ];
# Lets see if fish everywhere is OK on the pi's
# TODO decide if i drop to bash on pis?
shell.fish.enable = true;
# But wont enable plugins globally, leave them for workstations
};
i18n = {
defaultLocale = lib.mkDefault "en_AU.UTF-8";
};

View file

@ -0,0 +1,9 @@
{
imports = [
./nix.nix
./nixpkgs.nix
./sops.nix
./system.nix
./users.nix
];
}

View file

@ -26,6 +26,7 @@
# Substitutions
trusted-substituters = [
"https://cache.garnix.io"
"https://nix-community.cachix.org"
"https://numtide.cachix.org"
];
@ -33,6 +34,7 @@
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE="
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
];
# Fallback quickly if substituters are not available.

View file

@ -2,12 +2,20 @@
with lib;
{
mySystem.system.packages = with pkgs; [
ntfs3g
];
boot = {
initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
kernelModules = [ "kvm-amd" ];
extraModulePackages = [ ];
# for managing/mounting ntfs
supportedFilesystems = [ "ntfs" ];
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;

View file

@ -9,6 +9,9 @@ with lib;
kernelModules = [ "kvm-amd" ];
extraModulePackages = [ ];
# for managing/mounting ntfs
supportedFilesystems = [ "ntfs" ];
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
@ -21,6 +24,9 @@ with lib;
# set xserver videodrivers for amp gpu
services.xserver.videoDrivers = [ "amdgpu" ];
# As this is a laptop explicitly enable nmcli (likely enabled by GUI anyway)
networking.networkmanager.enable = true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View file

@ -5,13 +5,15 @@
with lib;
{
boot = {
config.mySystem.shell.fish.plugins = true;
config.boot = {
binfmt.emulatedSystems = [ "aarch64-linux" ]; # Enabled for raspi4 compilation
plymouth.enable = true;
plymouth.enable = true; # hide console with splash screen
};
nix.settings = {
config.nix.settings = {
# TODO factor out into mySystem
# Avoid disk full issues
max-free = lib.mkDefault (1000 * 1000 * 1000);
@ -19,12 +21,11 @@ with lib;
};
# set xserver videodrivers if used
services.xserver.enable = true;
config.services.xserver.enable = true;
# Laptop so ill likely use wireles
# very likely to be set by GUI packages but lets
# be declarative.
networking.networkmanager.enable = true;
}