diff options
-rw-r--r-- | flake.nix | 15 | ||||
-rw-r--r-- | home/don/common/core/bash.nix | 10 | ||||
-rw-r--r-- | home/don/common/core/default.nix | 33 | ||||
-rw-r--r-- | home/don/common/core/vim/default.nix | 6 | ||||
-rw-r--r-- | home/don/common/core/vim/vimrc | 47 | ||||
-rw-r--r-- | home/don/common/core/zsh/default.nix | 55 | ||||
-rw-r--r-- | home/don/common/core/zsh/zshrc | 125 | ||||
-rw-r--r-- | home/don/fangorn.nix | 6 | ||||
-rw-r--r-- | home/nipsy/fangorn.nix | 6 | ||||
-rw-r--r-- | home/root/fangorn.nix | 6 | ||||
-rw-r--r-- | hosts/common/optional/services/nsd/bitgnome.net.zone | 8 | ||||
-rw-r--r-- | hosts/common/optional/services/xorg.nix | 6 | ||||
-rw-r--r-- | hosts/common/optional/sound.nix | 6 | ||||
-rw-r--r-- | hosts/common/users/don/default.nix | 32 | ||||
-rw-r--r-- | hosts/common/users/nipsy/default.nix | 4 | ||||
-rw-r--r-- | hosts/fangorn/default.nix | 103 | ||||
-rw-r--r-- | hosts/fangorn/disks.nix | 102 | ||||
-rw-r--r-- | hosts/fangorn/hardware-configuration.nix | 33 |
18 files changed, 591 insertions, 12 deletions
@@ -114,6 +114,21 @@ ]; }; + fangorn = nixpkgs.lib.nixosSystem rec { + specialArgs = { inherit inputs outputs; }; + modules = [ + disko.nixosModules.disko + ./hosts/fangorn + home-manager.nixosModules.home-manager { + home-manager.sharedModules = [ sops-nix.homeManagerModules.sops ]; + home-manager.users.root = import ./home/root/fangorn.nix; + home-manager.users.don = import ./home/don/fangorn.nix; + home-manager.users.nipsy = import ./home/nipsy/fangorn.nix; + } + sops-nix.nixosModules.sops + ]; + }; + ginaz = nixpkgs.lib.nixosSystem rec { specialArgs = { inherit inputs outputs; }; modules = [ diff --git a/home/don/common/core/bash.nix b/home/don/common/core/bash.nix new file mode 100644 index 0000000..77f0cf4 --- /dev/null +++ b/home/don/common/core/bash.nix @@ -0,0 +1,10 @@ +{ + programs.bash = { + enable = true; + enableCompletion = true; + shellAliases = { + ll = "ls -alF --color=auto"; + la = "ls -aF --color=auto"; + }; + }; +} diff --git a/home/don/common/core/default.nix b/home/don/common/core/default.nix new file mode 100644 index 0000000..5983f42 --- /dev/null +++ b/home/don/common/core/default.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, outputs, ... }: +{ + imports = [ + ./bash.nix + #./git.nix + #./ssh.nix + #./tmux + ./vim + ./zsh + ]; + + home = { + username = lib.mkDefault "don"; + homeDirectory = lib.mkDefault "/home/${config.home.username}"; + stateVersion = lib.mkDefault "23.11"; + }; + + #home.packages = builtins.attrValues { + # inherit (pkgs) + # wget + # zip; + #}; + + nix = { + package = lib.mkDefault pkgs.nix; + settings = { + experimental-features = [ "nix-command" "flakes" ]; + warn-dirty = false; + }; + }; + + programs.home-manager.enable = true; +} diff --git a/home/don/common/core/vim/default.nix b/home/don/common/core/vim/default.nix new file mode 100644 index 0000000..ea4ed5e --- /dev/null +++ b/home/don/common/core/vim/default.nix @@ -0,0 +1,6 @@ +{ + programs.vim = { + enable = true; + extraConfig = (builtins.readFile ./vimrc); + }; +} diff --git a/home/don/common/core/vim/vimrc b/home/don/common/core/vim/vimrc new file mode 100644 index 0000000..87de2a0 --- /dev/null +++ b/home/don/common/core/vim/vimrc @@ -0,0 +1,47 @@ +" Handling of big files - William Natter, Tony Mechelynck and others +" fairly certain that BufSizeThreshold is in bytes +let g:SaveUndoLevels = &undolevels +let g:BufSizeThreshold = 5242880 +if has("autocmd") + au VimEnter * let g:SaveUndoLevels = &undolevels + au BufReadPre * if getfsize(expand("%")) >= g:BufSizeThreshold | setlocal noswapfile | endif + au BufEnter * if getfsize(expand("%")) < g:BufSizeThreshold | let &undolevels=g:SaveUndoLevels | else | setlocal undolevels=-1 | endif + au BufEnter * if getfsize(expand("%")) < g:BufSizeThreshold | syntax on | else | syntax off | endif +endif + +set mouse& +set noautoindent " always set autoindenting off + +" enable better 24-bit color support +"let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" +"let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" +set termguicolors + +" If using a dark background within the editing area and syntax highlighting +" turn on this option as well +set background=dark + +if has("autocmd") + " Enabled file type detection + " Use the default filetype settings. If you also want to load indent files + " to automatically do language-dependent indenting add 'indent' as well. + filetype plugin on + "filetype indent on +endif " has ("autocmd") + +" The following are commented out as they cause vim to behave a lot +" different from regular vi. They are highly recommended though. +set showcmd " Show (partial) command in status line. +set showmatch " Show matching brackets. +set ignorecase " Do case insensitive matching +set incsearch " Incremental search +"set expandtab " replace tabs with spaces +set smarttab " use shiftwidth instead of tabstop at start of line +set spell spelllang=en_us " turn on the spell check +set hlsearch " highlight all search matches + +set laststatus=2 +set statusline=%<%f%h%m%r%=%{&ff}\ %Y\ %b\ 0x%B\ \ %l,%c%V\ %P + +"map <F5> :w<CR><bar>:!clear;go run %<CR> +"map <F6> :w<CR><bar>:%! gofmt<CR> diff --git a/home/don/common/core/zsh/default.nix b/home/don/common/core/zsh/default.nix new file mode 100644 index 0000000..c78884f --- /dev/null +++ b/home/don/common/core/zsh/default.nix @@ -0,0 +1,55 @@ +{ lib, ... }: +{ + programs.zsh = { + enable = true; + + history = { + save = 100000; + size = 100000; + }; + + initExtra = (builtins.readFile ./zshrc); + + sessionVariables = let makePluginPath = format: + (lib.strings.makeSearchPath format [ + "$HOME/.nix-profile/lib" + "/run/current-system/sw/lib" + "/etc/profiles/per-user/$USER/lib" + ]) + ":$HOME/.${format}"; + in { + _JAVA_AWT_WM_NONREPARENTING = 1; # fix stupid broken Java shit + BROWSER = "firefox"; + CLAP_PATH = makePluginPath "clap"; + COLORFGBG = ";0"; + #COLORFGBG = "green;blue"; + #COLORTERM = "truecolor"; + DSSI_PATH = makePluginPath "dssi"; + EDITOR = "vim"; + LADSPA_PATH = makePluginPath "ladspa"; + LC_COLLATE = "C"; + LV2_PATH = makePluginPath "lv2"; + LXVST_PATH = makePluginPath "lxvst"; + #NNTPSERVER = "news.giganews.com"; + PAGER = "less"; + #PASSWORD_STORE_ENABLE_EXTENSIONS = "true"; + PATH = "$HOME/bin:$PATH"; + #PS1 = "%B%n%b@%U%m%u/%l:%~> "; + QUOTING_STYLE = "literal"; + VST_PATH = makePluginPath "vst"; + VST3_PATH = makePluginPath "vst3"; + }; + + shellAliases = { + #fixkeyboard = "setxkbmap -layout us -option caps:super -option compose:ralt"; + grep = "grep --color=auto"; + ip = "ip -c=auto"; + la = "ls -aF --color=auto"; + ll = "ls -alFhs --color=auto"; + lock = "xscreensaver-command -lock"; + nix-list-derivations = "nix-store --query --requisites /run/current-system | cut -d- -f2- | sort | uniq"; + nix-list-generations = "nixos-rebuild list-generations"; + steam-no-beta = "steam -clearbeta"; + zgrep = "zgrep --color=auto"; + }; + }; +} diff --git a/home/don/common/core/zsh/zshrc b/home/don/common/core/zsh/zshrc new file mode 100644 index 0000000..f724569 --- /dev/null +++ b/home/don/common/core/zsh/zshrc @@ -0,0 +1,125 @@ +umask 022 + +eval $(dircolors) + +# set SWAYSOCK correctly +#if pgrep -U don -x sway >/dev/null; then +# export SWAYSOCK=/run/user/$(id -u)/sway-ipc.$(id -u).$(pgrep -x sway).sock +#fi + +# start sway by default if logging into tty1 +#if [[ -z "${DISPLAY}" ]] && [[ $(tty) == "/dev/tty1" ]]; then +# +# export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) +# +# # set some Wayland specific variables +# export MOZ_ENABLE_WAYLAND=1 +# export GDK_BACKEND=wayland +# export QT_QPA_PLATFORM=wayland +# export SDL_VIDEODRIVER=wayland +# export XDG_SESSION_TYPE=wayland +# +# exec sway > ~/.sway.log +# +#fi + +# if already in Wayland, update the GPG TTY so ssh-askpass will work correctly +#if [[ -n "${WAYLAND_DISPLAY}" ]]; then +# gpg-connect-agent updatestartuptty /bye >/dev/null +#fi + +# completion options +setopt LIST_PACKED MENU_COMPLETE +# expansion and globbing options +setopt NO_NOMATCH +# history options +setopt SHARE_HISTORY EXTENDED_HISTORY HIST_FCNTL_LOCK HIST_IGNORE_ALL_DUPS HIST_REDUCE_BLANKS HIST_SAVE_NO_DUPS +# input/output options +setopt PRINT_EXIT_VALUE RM_STAR_SILENT +# job control options +setopt LONG_LIST_JOBS NO_HUP +# zle options +setopt NO_BEEP + +# menu completion +zstyle ':completion:*' menu select=5 + +# vi keybindings and settings +bindkey -v +export KEYTIMEOUT=1 +autoload -U edit-command-line +zle -N edit-command-line +bindkey -M vicmd v edit-command-line + +# always open tmux if interactive +[[ $- != *i* ]] && return +#[[ -z "$TMUX" ]] && (tmux -2 new-session -t default \; new-window || tmux -2 new-session -s default) +[[ -z "$TMUX" ]] && (tmux -2 attach -t default || tmux -2 new-session -s default) + +# useful helper functions +function nix-file-list { find $(nix build ${1} --print-out-paths --no-link) } + +function ntrace { + + if [[ -z ${argv} ]]; then + echo 'you must specify a command to strace!' >&2 + return 1 + fi + + eval strace -f -e trace=network -s 10000 ${=argv[@]} + +} + +# prompt/theme shit +function precmd { + + local RC=${?} + #local RC=${(%)RC-%?} + + print -nP '\n' + + # current user + if [[ ${EUID} -eq 0 ]]; then + print -nP '%{%S%F{red}%}%n%{%f%s%}' + else + print -nP '%{%F{magenta}%}%n%{%f%}' + fi + + print -nP '@' + + # current host + if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then + print -nP '%{%F{yellow}%}%m%{%f%}' + else + print -nP '%{%F{green}%}%m%{%f%}' + fi + + # connected terminal + print -nP '/%{%U%}%l%{%u%} ' + + # cwd + print -nP '%{%F{cyan}%}%~%{%f%} ' + + # job count + JOBCOUNT='%j' + if [[ ${(%)JOBCOUNT} -gt 0 ]]; then + print -nP 'j=%{%F{yellow}%}%j%{%f%} ' + fi + + # previous return code + if [[ ${RC} -ne 0 ]]; then + print -nP 'rc=%{%F{red}%}' + echo -n "${RC}" + print -nP '%{%f%} ' + else + print -nP 'rc=%{%F{green}%}' + echo -n "${RC}" + print -nP '%{%f%} ' + fi + + # time stamp + print -P '%{%F{cyan}%}%D{%FT%T%z}%{%f%}' + +} + +PS1='%# ' diff --git a/home/don/fangorn.nix b/home/don/fangorn.nix new file mode 100644 index 0000000..83c92cd --- /dev/null +++ b/home/don/fangorn.nix @@ -0,0 +1,6 @@ +{ inputs, lib, pkgs, config, outputs, ... }: +{ + imports = [ + common/core + ]; +} diff --git a/home/nipsy/fangorn.nix b/home/nipsy/fangorn.nix new file mode 100644 index 0000000..83c92cd --- /dev/null +++ b/home/nipsy/fangorn.nix @@ -0,0 +1,6 @@ +{ inputs, lib, pkgs, config, outputs, ... }: +{ + imports = [ + common/core + ]; +} diff --git a/home/root/fangorn.nix b/home/root/fangorn.nix new file mode 100644 index 0000000..83c92cd --- /dev/null +++ b/home/root/fangorn.nix @@ -0,0 +1,6 @@ +{ inputs, lib, pkgs, config, outputs, ... }: +{ + imports = [ + common/core + ]; +} diff --git a/hosts/common/optional/services/nsd/bitgnome.net.zone b/hosts/common/optional/services/nsd/bitgnome.net.zone index 038a860..f5ff137 100644 --- a/hosts/common/optional/services/nsd/bitgnome.net.zone +++ b/hosts/common/optional/services/nsd/bitgnome.net.zone @@ -3,7 +3,7 @@ $ORIGIN bitgnome.net. $TTL 1h @ in soa ns.bitgnome.net. nipsy.bitgnome.net. ( - 2025033101 ; serial + 2025040901 ; serial 1d ; refresh 2h ; retry 4w ; expire @@ -29,7 +29,7 @@ $TTL 1h ; name servers ns in a 5.161.149.85 ns in aaaa 2a01:4ff:f0:e164::1 -ns2 in a 67.5.119.0 +ns2 in a 67.5.118.253 ; srv records _xmpp-client._tcp 5m in srv 0 0 5222 bitgnome.net. @@ -67,10 +67,10 @@ mta-sts 5m in cname @ ;royder in cname @ ; external machines -arrakis 1m in a 67.5.119.0 +arrakis 1m in a 67.5.118.253 ;darkstar 1m in a 66.69.213.114 ;nb 1m in a 67.10.209.108 ;terraria 1m in a 128.83.27.4 ;caladan 1m in a 104.130.129.241 ;caladan 1m in aaaa 2001:4800:7818:101:be76:4eff:fe03:db44 -darkstar 1m in a 67.5.119.0 +darkstar 1m in a 67.5.118.253 diff --git a/hosts/common/optional/services/xorg.nix b/hosts/common/optional/services/xorg.nix index 7dccdd3..712886f 100644 --- a/hosts/common/optional/services/xorg.nix +++ b/hosts/common/optional/services/xorg.nix @@ -1,7 +1,5 @@ { pkgs, ... }: { - #environment.systemPackages = builtins.attrValues { - # inherit (pkgs) environment.systemPackages = with pkgs; [ chafa evince @@ -14,6 +12,7 @@ google-chrome gv inkscape + kdePackages.okular libreoffice libva-utils mesa-demos @@ -38,9 +37,8 @@ xorg.xev xscreensaver xsnow - xterm#; + xterm ]; - #}; programs.firefox = { enable = true; diff --git a/hosts/common/optional/sound.nix b/hosts/common/optional/sound.nix index b07de35..d409196 100644 --- a/hosts/common/optional/sound.nix +++ b/hosts/common/optional/sound.nix @@ -41,11 +41,11 @@ wavpack winetricks wineWowPackages.stagingFull - #master.yabridge - #master.yabridgectl + master.yabridge + master.yabridgectl yoshimi zam-plugins - #zynaddsubfx + master.zynaddsubfx ]; }; } diff --git a/hosts/common/users/don/default.nix b/hosts/common/users/don/default.nix new file mode 100644 index 0000000..9b958c6 --- /dev/null +++ b/hosts/common/users/don/default.nix @@ -0,0 +1,32 @@ +{ pkgs, inputs, config, ... }: +let + ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; + uid = 1001; +in +{ + users.groups.don.gid = uid; + users.users.don = { + description = "Don Arnold"; + extraGroups = [ + "audio" + "video" + "wheel" + ] ++ ifTheyExist [ + "adbusers" + "networkmanager" + "vboxsf" + "vboxusers" + ]; + group = "don"; + home = "/home/don"; + isNormalUser = true; + #openssh.authorizedKeys.keys = [ + # (builtins.readFile ./keys/id_arrakis.pub) + # #(builtins.readFile ./keys/id_other.pub) + #]; + + packages = [ pkgs.home-manager ]; + shell = pkgs.zsh; + uid = uid; + }; +} diff --git a/hosts/common/users/nipsy/default.nix b/hosts/common/users/nipsy/default.nix index 5eacd6f..9d5bfe6 100644 --- a/hosts/common/users/nipsy/default.nix +++ b/hosts/common/users/nipsy/default.nix @@ -1,9 +1,10 @@ { pkgs, inputs, config, ... }: let ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; + uid = 1000; in { - users.groups.nipsy.gid = 1000; + users.groups.nipsy.gid = uid; users.users.nipsy = { description = "Mark Nipper"; extraGroups = [ @@ -26,5 +27,6 @@ in packages = [ pkgs.home-manager ]; shell = pkgs.zsh; + uid = uid; }; } diff --git a/hosts/fangorn/default.nix b/hosts/fangorn/default.nix new file mode 100644 index 0000000..9194dae --- /dev/null +++ b/hosts/fangorn/default.nix @@ -0,0 +1,103 @@ +{ config, inputs, outputs, pkgs, ... }: { + boot = { + kernelPackages = pkgs.linuxPackages_6_12; + loader = { + efi.canTouchEfiVariables = true; + systemd-boot.enable = true; + timeout = 3; + }; + supportedFilesystems = [ "zfs" ]; + zfs = { + devNodes = "/dev/disk/by-label"; + package = pkgs.master.zfs; + }; + }; + + environment.systemPackages = with pkgs; [ + signal-desktop + #master.wsmancli + wpa_supplicant + ]; + + imports = [ + ./disks.nix + ./hardware-configuration.nix + ../common/core + #../common/optional/db.nix + #../common/optional/dev.nix + #../common/optional/ebooks.nix + #../common/optional/games.nix + #../common/optional/misc.nix + #../common/optional/multimedia.nix + ../common/optional/pipewire.nix + ../common/optional/services/openssh.nix + #../common/optional/services/tlp.nix + #../common/optional/services/xorg.nix + #../common/optional/sound.nix + ../common/optional/wdt.nix + ../common/optional/zfs.nix + ../common/users/don + ../common/users/nipsy + ../common/users/root + ]; + + networking = { + hostId = "6f1faddc"; + hostName = "fangorn"; + networkmanager.enable = true; + nftables.enable = true; + }; + + nixpkgs = { + config.allowUnfree = true; + hostPlatform = "x86_64-linux"; + overlays = [ + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.master-packages + outputs.overlays.stable-packages + ]; + }; + + services.openssh.settings.X11Forwarding = true; + services.xserver.videoDrivers = [ "amdgpu" ]; + + #sops = { + # age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; + # defaultSopsFile = ../secrets/fangorn.yaml; + + # secrets = { + # "nftables/ssh" = {}; + # "nix-access-token-github" = {}; + # "ssh_config".path = "/root/.ssh/config"; + # }; + #}; + + system.stateVersion = "23.11"; + + #systemd.services."nftables-extra" = let rules_script = '' + # ${pkgs.nftables}/bin/nft -f ${config.sops.secrets."nftables/ssh".path} + # ''; in { + # description = "nftables extra firewall rules"; + # reload = rules_script; + # script = rules_script; + # serviceConfig = { + # RemainAfterExit = true; + # Type = "oneshot"; + # }; + # unitConfig = { + # ConditionPathExists = config.sops.secrets."nftables/ssh".path; + # ReloadPropagatedFrom = "nftables.service"; + # }; + # wantedBy = [ "multi-user.target" ]; + # after = [ "nftables.service" ]; + # partOf = [ "nftables.service" ]; + #}; + + #systemd.paths."nftables-extra" = { + # pathConfig = { + # PathExists = config.sops.secrets."nftables/ssh".path; + # }; + # wantedBy = [ "multi-user.target" ]; + #}; +} diff --git a/hosts/fangorn/disks.nix b/hosts/fangorn/disks.nix new file mode 100644 index 0000000..fdef7cf --- /dev/null +++ b/hosts/fangorn/disks.nix @@ -0,0 +1,102 @@ +{ lib, ... }: +{ + disko.devices = { + disk = { + nvme0n1 = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "1G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + extraArgs = [ "-nboot" ]; + }; + }; + swap = { + size = "32G"; + type = "8200"; + content = { + type = "swap"; + extraArgs = [ "-L swap" ]; + }; + }; + rpool = { + size = "100%"; + content = { + type = "zfs"; + pool = "rpool"; + }; + }; + }; + }; + }; + }; + zpool = { + rpool = { + type = "zpool"; + rootFsOptions = { + acltype = "posixacl"; + canmount = "off"; + compression = "on"; + dnodesize = "auto"; + relatime = "on"; + xattr = "sa"; + }; + options = { + ashift = "12"; + autotrim = "on"; + }; + datasets = { + "local" = { + type = "zfs_fs"; + options.mountpoint = "none"; + }; + "local/root" = { + type = "zfs_fs"; + options.mountpoint = "legacy"; + mountpoint = "/"; + }; + "local/nix" = { + type = "zfs_fs"; + options = { + atime = "off"; + mountpoint = "legacy"; + }; + mountpoint = "/nix"; + }; + "user" = { + type = "zfs_fs"; + options.mountpoint = "none"; + }; + "user/home" = { + type = "zfs_fs"; + options.mountpoint = "legacy"; + mountpoint = "/home"; + }; + "user/home/root" = { + type = "zfs_fs"; + options.mountpoint = "legacy"; + mountpoint = "/root"; + }; + "user/home/don" = { + type = "zfs_fs"; + options.mountpoint = "legacy"; + mountpoint = "/home/don"; + }; + "user/home/nipsy" = { + type = "zfs_fs"; + options.mountpoint = "legacy"; + mountpoint = "/home/nipsy"; + }; + }; + }; + }; + }; +} diff --git a/hosts/fangorn/hardware-configuration.nix b/hosts/fangorn/hardware-configuration.nix new file mode 100644 index 0000000..17a6bc6 --- /dev/null +++ b/hosts/fangorn/hardware-configuration.nix @@ -0,0 +1,33 @@ +# 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, ... }: + +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot = { + initrd = { + availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ]; + kernelModules = [ ]; + }; + kernelModules = [ "kvm-amd" ]; + extraModulePackages = [ ]; + }; + + fileSystems."/boot" = { + device = lib.mkForce "/dev/disk/by-label/boot"; + }; + + # 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.enp1s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; + + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} |