mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-10 14:50:40 +02:00
feat: begin writing user config
This commit is contained in:
parent
abe369ba0a
commit
4b4268b537
14 changed files with 209 additions and 94 deletions
|
@ -20,18 +20,14 @@ in {
|
|||
|
||||
environment = {
|
||||
etc."nixos/configuration.nix".source = dummyConfig;
|
||||
pathsToLink = [
|
||||
"/share/zsh"
|
||||
];
|
||||
systemPackages = with pkgs; [
|
||||
neovim
|
||||
];
|
||||
variables.EDITOR = "nvim";
|
||||
};
|
||||
|
||||
# Disable unnecessary stuff from the nixos defaults.
|
||||
services.udisks2.enable = false;
|
||||
networking.dhcpcd.enable = false;
|
||||
networking.firewall.enable = false;
|
||||
security.sudo.enable = false;
|
||||
|
||||
home-manager = {
|
||||
|
@ -44,12 +40,11 @@ in {
|
|||
i18n.defaultLocale = "C.UTF-8";
|
||||
|
||||
networking = {
|
||||
# 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`.
|
||||
useDHCP = lib.mkForce false;
|
||||
useNetworkd = true;
|
||||
wireguard.enable = true;
|
||||
dhcpcd.enable = false;
|
||||
firewall.enable = false;
|
||||
};
|
||||
|
||||
nix.nixPath = [
|
||||
|
@ -61,10 +56,17 @@ in {
|
|||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
programs = {
|
||||
zsh = {
|
||||
git = {
|
||||
enable = true;
|
||||
enableGlobalCompInit = false;
|
||||
config = {
|
||||
init.defaultBranch = "main";
|
||||
pull.rebase = true;
|
||||
};
|
||||
};
|
||||
neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
};
|
||||
};
|
||||
|
||||
system = {
|
||||
|
@ -81,5 +83,9 @@ in {
|
|||
network.wait-online.anyInterface = true;
|
||||
};
|
||||
|
||||
users.users.root = {
|
||||
initialHashedPassword = "$6$EBo/CaxB.dQoq2W8$lo2b5vKgJlLPdGGhEqa08q3Irf1Zd1PcFBCwJOrG8lqjwbABkn1DEhrMh1P3ezwnww2HusUBuZGDSMa4nvSQg1";
|
||||
openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA5Uq+CDy5Pmt3If5M6d8K/Q7HArU6sZ7sgoj3T521Wm"];
|
||||
};
|
||||
users.mutableUsers = false;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
{
|
||||
imports = [./documentation.nix];
|
||||
|
||||
environment = {
|
||||
enableDebugInfo = true;
|
||||
};
|
||||
environment.enableDebugInfo = true;
|
||||
}
|
||||
|
|
18
dev/virt-manager.nix
Normal file
18
dev/virt-manager.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [virt-manager spice-gtk swtpm];
|
||||
security.polkit.enable = true;
|
||||
virtualisation = {
|
||||
libvirtd = {
|
||||
enable = true;
|
||||
qemu = {
|
||||
package = pkgs.qemu_kvm;
|
||||
ovmf = {
|
||||
enable = true;
|
||||
packages = with pkgs; [OVMFFull.fd];
|
||||
};
|
||||
swtpm.enable = true;
|
||||
};
|
||||
};
|
||||
spiceUSBRedirection.enable = true;
|
||||
};
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{lib, ...}: {
|
||||
boot.loader = {
|
||||
efi.canTouchEfiVariables = true;
|
||||
systemd-boot = {
|
||||
enable = true;
|
||||
configurationLimit = 15;
|
||||
};
|
||||
timeout = lib.mkDefault 2;
|
||||
};
|
||||
console.earlySetup = true;
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
services.udev.packages = with pkgs; [yubikey-personalization libu2f-host];
|
||||
services.pcscd.enable = true;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
boot.supportedFilesystems = ["zfs"];
|
||||
|
||||
environment.systemPackages = with pkgs; [zfs];
|
||||
|
||||
services.zfs = {
|
||||
autoScrub = {
|
||||
enable = true;
|
||||
interval = "weekly";
|
||||
};
|
||||
trim = {
|
||||
enable = true;
|
||||
interval = "weekly";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -10,18 +10,21 @@
|
|||
nixos-hardware.common-pc-laptop
|
||||
nixos-hardware.common-pc-laptop-ssd
|
||||
../../core
|
||||
../../dev
|
||||
|
||||
../../hardware/efi.nix
|
||||
../../modules/efi.nix
|
||||
../../modules/laptop.nix
|
||||
../../modules/yubikey.nix
|
||||
../../modules/zfs.nix
|
||||
../../users/oddlama
|
||||
|
||||
#./state.nix
|
||||
./fs.nix
|
||||
./net.nix
|
||||
];
|
||||
|
||||
boot = {
|
||||
initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"];
|
||||
kernelModules = [];
|
||||
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
|
||||
supportedFilesystems = ["zfs"];
|
||||
tmpOnTmpfs = true;
|
||||
};
|
||||
|
||||
|
@ -31,22 +34,7 @@
|
|||
packages = with pkgs; [terminus_font];
|
||||
};
|
||||
|
||||
fileSystems = {
|
||||
"/" = {
|
||||
device = "rpool/root/nixos";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil" "X-mount.mkdir"];
|
||||
};
|
||||
|
||||
"/boot" = {
|
||||
device = "/dev/disk/by-uuid/91ED-0E13";
|
||||
fsType = "vfat";
|
||||
};
|
||||
};
|
||||
|
||||
swapDevices = [
|
||||
{device = "/dev/disk/by-uuid/1122527a-71d3-4ec7-8d41-65d0c8494b04";}
|
||||
];
|
||||
environment.systemPackages = with pkgs; [wireguard-tools powertop];
|
||||
|
||||
hardware = {
|
||||
enableRedistributableFirmware = true;
|
||||
|
@ -55,37 +43,10 @@
|
|||
opengl.enable = true;
|
||||
};
|
||||
|
||||
networking = {
|
||||
hostId = "4313abca";
|
||||
hostName = "nom";
|
||||
wireless.iwd.enable = true;
|
||||
};
|
||||
|
||||
powerManagement.cpuFreqGovernor = "powersave";
|
||||
|
||||
services = {
|
||||
fwupd.enable = true;
|
||||
smartd.enable = true;
|
||||
};
|
||||
|
||||
systemd.network.networks = {
|
||||
wired = {
|
||||
DHCP = "yes";
|
||||
matchConfig.MACAddress = "00:00:00:00:00:00";
|
||||
dhcpV4Config.RouteMetric = 10;
|
||||
dhcpV6Config.RouteMetric = 10;
|
||||
};
|
||||
wireless = {
|
||||
DHCP = "yes";
|
||||
matchConfig.MACAddress = "00:00:00:00:00:00";
|
||||
dhcpV4Config.RouteMetric = 40;
|
||||
dhcpV6Config.RouteMetric = 40;
|
||||
};
|
||||
};
|
||||
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
users.users.root = {
|
||||
initialHashedPassword = "$6$EBo/CaxB.dQoq2W8$lo2b5vKgJlLPdGGhEqa08q3Irf1Zd1PcFBCwJOrG8lqjwbABkn1DEhrMh1P3ezwnww2HusUBuZGDSMa4nvSQg1";
|
||||
openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA5Uq+CDy5Pmt3If5M6d8K/Q7HArU6sZ7sgoj3T521Wm"];
|
||||
};
|
||||
}
|
||||
|
|
18
hosts/nom/fs.nix
Normal file
18
hosts/nom/fs.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{config, ...}: {
|
||||
fileSystems = {
|
||||
"/" = {
|
||||
device = "rpool/root/nixos";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil" "X-mount.mkdir"];
|
||||
};
|
||||
|
||||
"/boot" = {
|
||||
device = "/dev/disk/by-uuid/91ED-0E13";
|
||||
fsType = "vfat";
|
||||
};
|
||||
};
|
||||
|
||||
swapDevices = [
|
||||
{device = "/dev/disk/by-uuid/1122527a-71d3-4ec7-8d41-65d0c8494b04";}
|
||||
];
|
||||
}
|
22
hosts/nom/net.nix
Normal file
22
hosts/nom/net.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
networking = {
|
||||
hostId = "4313abca";
|
||||
hostName = "nom";
|
||||
wireless.iwd.enable = true;
|
||||
};
|
||||
|
||||
systemd.network.networks = {
|
||||
wired = {
|
||||
DHCP = "yes";
|
||||
matchConfig.MACAddress = "00:00:00:00:00:00";
|
||||
dhcpV4Config.RouteMetric = 10;
|
||||
dhcpV6Config.RouteMetric = 10;
|
||||
};
|
||||
wireless = {
|
||||
DHCP = "yes";
|
||||
matchConfig.MACAddress = "00:00:00:00:00:00";
|
||||
dhcpV4Config.RouteMetric = 40;
|
||||
dhcpV6Config.RouteMetric = 40;
|
||||
};
|
||||
};
|
||||
}
|
27
nix/overlays/scripts/screenocr.nix
Normal file
27
nix/overlays/scripts/screenocr.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
final: _: {
|
||||
screenocr =
|
||||
final.callPackage
|
||||
(
|
||||
{
|
||||
writeShellApplication,
|
||||
coreutils,
|
||||
grim,
|
||||
slurp,
|
||||
tesseract4,
|
||||
wl-clipboard,
|
||||
}:
|
||||
writeShellApplication {
|
||||
name = "screenocr";
|
||||
|
||||
runtimeInputs = [coreutils grim slurp tesseract4 wl-clipboard];
|
||||
|
||||
text = ''
|
||||
grim -t png -g "$(slurp)" - \
|
||||
| tesseract stdin stdout -l "eng+equ" \
|
||||
| tr -d '\f' \
|
||||
| wl-copy
|
||||
'';
|
||||
}
|
||||
)
|
||||
{};
|
||||
}
|
67
users/myuser/core/default.nix
Normal file
67
users/myuser/core/default.nix
Normal file
|
@ -0,0 +1,67 @@
|
|||
{ pkgs, ... }: {
|
||||
imports = [
|
||||
./atuin.nix
|
||||
./bash.nix
|
||||
./btop.nix
|
||||
./fish.nix
|
||||
./git.nix
|
||||
./htop.nix
|
||||
./neovim
|
||||
./ssh.nix
|
||||
./starship.nix
|
||||
./tmux.nix
|
||||
./xdg.nix
|
||||
./zsh.nix
|
||||
];
|
||||
|
||||
home = {
|
||||
username = "myuser";
|
||||
stateVersion = "22.11";
|
||||
packages = with pkgs; [
|
||||
bandwhich
|
||||
btop
|
||||
colorcheck
|
||||
fd
|
||||
kalker
|
||||
neofetch
|
||||
rclone
|
||||
ripgrep
|
||||
rsync
|
||||
];
|
||||
shellAliases = {
|
||||
l = "ls -lahF --group-directories-first --show-control-chars --quoting-style=escape --color=auto";
|
||||
t="tree -F --dirsfirst -L 2"
|
||||
tt="tree -F --dirsfirst -L 3 --filelimit 16"
|
||||
ttt="tree -F --dirsfirst -L 6 --filelimit 16"
|
||||
cpr="rsync -axHAWXS --numeric-ids --info=progress2"
|
||||
|
||||
md="mkdir"
|
||||
rmd="rm --one-file-system -d"
|
||||
cp="cp -vi"
|
||||
mv="mv -vi"
|
||||
rm="rm --one-file-system -I"
|
||||
chmod="chmod -c --preserve-root"
|
||||
chown="chown -c --preserve-root"
|
||||
|
||||
vim="nvim"
|
||||
ip="ip --color"
|
||||
tmux="tmux -2"
|
||||
rg="rg -S"
|
||||
|
||||
p="cd ~/projects"
|
||||
};
|
||||
};
|
||||
|
||||
programs = {
|
||||
atuin = {
|
||||
enable = true;
|
||||
settings.auto_sync = false;
|
||||
};
|
||||
bat.enable = true;
|
||||
fzf.enable = true;
|
||||
gpg.enable = true;
|
||||
zoxide.enable = true;
|
||||
};
|
||||
|
||||
xdg.configFile."nixpkgs/config.nix".text = "{ allowUnfree = true; }";
|
||||
}
|
32
users/myuser/default.nix
Normal file
32
users/myuser/default.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
{
|
||||
users.groups.myuser.gid = config.users.users.myuser.uid;
|
||||
users.users.myuser = {
|
||||
uid = 1000;
|
||||
createHome = true;
|
||||
group = "myuser";
|
||||
extraGroups = [ "wheel" "input" "video" ]
|
||||
++ optionals config.sound.enable [ "audio" ];
|
||||
isNormalUser = true;
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
home-manager.users.myuser = {
|
||||
imports = [
|
||||
#impermanence.home-manager.impermanence
|
||||
./core
|
||||
./dev
|
||||
#]
|
||||
#++ optionals config.programs.sway.enable [
|
||||
# ./graphical
|
||||
# ./graphical/sway
|
||||
#] ++ optionals config.services.xserver.windowManager.i3.enable [
|
||||
# ./graphical
|
||||
# ./graphical/i3
|
||||
];
|
||||
|
||||
home.username = config.users.users.myuser.name;
|
||||
home.uid = config.users.users.myuser.uid;
|
||||
};
|
||||
}
|
0
users/myuser/dev/default.nix
Normal file
0
users/myuser/dev/default.nix
Normal file
|
@ -1,3 +0,0 @@
|
|||
{lib, ...}:
|
||||
with lib; {
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue