Merge remote-tracking branch 'origin/main' into darwin

This commit is contained in:
greg-compass
2022-09-06 17:01:56 -05:00
58 changed files with 1366 additions and 208 deletions
+1
View File
@@ -1,3 +1,4 @@
#pattern filter=crypt diff=crypt #pattern filter=crypt diff=crypt
**/*.crypt filter=crypt diff=crypt **/*.crypt filter=crypt diff=crypt
home/ssh/id_rsa* filter=crypt diff=crypt home/ssh/id_rsa* filter=crypt diff=crypt
modules/ssh/id_* filter=crypt diff=crypt
+1
View File
@@ -1 +1,2 @@
host host
result
+120
View File
@@ -0,0 +1,120 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./modules/automatic/nix.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot/efi";
networking.hostName = "lappy"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "America/Chicago";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.utf8";
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the GNOME Desktop Environment.
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
# Configure keymap in X11
services.xserver = {
layout = "us";
xkbVariant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.greg = {
isNormalUser = true;
description = "Greg Hellings";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
firefox
# thunderbird
];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
git
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.05"; # Did you read the comment?
}
Generated
+45 -12
View File
@@ -5,11 +5,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1648942457, "lastModified": 1652712410,
"narHash": "sha256-i29Z1t3sVfCNfpp+KAfeExvpqHQSbLO1KWylTtfradU=", "narHash": "sha256-hMJ2TqLt0DleEnQFGUHK9sV2aAzJPU8pZeiZoqRozbE=",
"owner": "ryantm", "owner": "ryantm",
"repo": "agenix", "repo": "agenix",
"rev": "0d5e59ed645e4c7b60174bc6f6aac6a203dc0b01", "rev": "7e5e58b98c3dcbf497543ff6f22591552ebfe65b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -46,16 +46,16 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1649887911, "lastModified": 1656169755,
"narHash": "sha256-Af0Ppb1RZ7HWuxUvF0/O7h3cy8tqU2eKFyVwyA1ZD+w=", "narHash": "sha256-Nlnm4jeQWEGjYrE6hxi/7HYHjBSZ/E0RtjCYifnNsWk=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "7244c6715cb8f741f3b3e1220a9279e97b2ed8f5", "rev": "4a3d01fb53f52ac83194081272795aa4612c2381",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "release-21.11", "ref": "release-22.05",
"repo": "home-manager", "repo": "home-manager",
"type": "github" "type": "github"
} }
@@ -78,26 +78,59 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1650244918, "lastModified": 1659342832,
"narHash": "sha256-DsS5nxjTpnoUC4pNXJI1rit7TnDTij8vQDa5PtcDCD0=", "narHash": "sha256-ePnxG4hacRd6oZMk+YeCSYMNUnHCe+qPLI0/+VaTu48=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "7b38b03d76ab71bdc8dc325e3f6338d984cc35ca", "rev": "e43cf1748462c81202a32b26294e9f8eefcc3462",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "nixos",
"ref": "nixos-21.11", "ref": "nixos-22.05",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixunstable": {
"locked": {
"lastModified": 1659219666,
"narHash": "sha256-pzYr5fokQPHv7CmUXioOhhzDy/XyWOIXP4LZvv/T7Mk=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "7b9be38c7250b22d829ab6effdee90d5e40c6e5c",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nurpkgs": {
"locked": {
"lastModified": 1659423577,
"narHash": "sha256-i2wSHqFqu4xpBJU/o9SRpQblAHknnEtyeN6Kuq/c1JA=",
"owner": "nix-community",
"repo": "NUR",
"rev": "0bdb7691364dc93c8f04016c0ed395b675bdc50c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "NUR",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"agenix": "agenix", "agenix": "agenix",
"darwin": "darwin", "darwin": "darwin",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_2",
"nixunstable": "nixunstable",
"nurpkgs": "nurpkgs"
} }
} }
}, },
+42 -11
View File
@@ -5,34 +5,40 @@
description = "Greg's machines!"; description = "Greg's machines!";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11"; nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
nixunstable.url = "github:nixos/nixpkgs/nixos-unstable";
agenix.url = "github:ryantm/agenix"; agenix.url = "github:ryantm/agenix";
home-manager = { home-manager = {
url = "github:nix-community/home-manager/release-21.11"; url = "github:nix-community/home-manager/release-22.05";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
darwin = { darwin = {
url = "github:lnl7/nix-darwin/master"; url = "github:lnl7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nurpkgs.url = "github:nix-community/NUR";
}; };
outputs = inputs: outputs = {nixpkgs, nixunstable, agenix, home-manager, nurpkgs, self}@inputs:
let let
local_overlay = import ./overlays;
mods = hostname: [ mods = hostname: [
inputs.agenix.nixosModule { nixpkgs.overlays = [ nurpkgs.overlay local_overlay ]; }
agenix.nixosModule
./modules ./modules
./profiles/linux
./hosts/${hostname} ./hosts/${hostname}
inputs.home-manager.nixosModules.home-manager { home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.users.greg = import ./home/home.nix "greg"; home-manager.useUserPackages = true;
home-manager.users.root = import ./home/home.nix "root"; home-manager.extraSpecialArgs = {
inherit nixunstable;
};
} }
]; ];
machine = system: name: inputs.nixpkgs.lib.nixosSystem { machine = system: name: nixpkgs.lib.nixosSystem {
system = system; inherit system;
specialArgs = inputs; specialArgs = inputs;
modules = mods name; modules = mods name;
}; };
@@ -43,12 +49,28 @@
./hosts/${hostname} ./hosts/${hostname}
]; ];
unstableMachine = system: name: inputs.nixunstable.lib.nixosSystem {
system = system;
modules = mods name;
specialArgs = {
nixpkgs = inputs.nixunstable;
nixunstable = inputs.nixunstable;
agenix = inputs.agenix;
home-manager = inputs.home-manager;
nur = inputs.nur;
};
};
in { in {
nixosConfigurations = { nixosConfigurations = {
"2maccabees" = machine "aarch64-linux" "2maccabees"; "2maccabees" = unstableMachine "aarch64-linux" "2maccabees";
"linode" = machine "x86_64-linux" "linode"; "linode" = machine "x86_64-linux" "linode";
"jude" = machine "x86_64-linux" "jude";
"lappy" = machine "x86_64-linux" "lappy";
"iso" = machine "x86_64-linux" "iso"; "iso" = machine "x86_64-linux" "iso";
}; };
@@ -62,5 +84,14 @@
defaultPackage."x86_64-linux" = inputs.self.nixosConfigurations.iso.config.system.build.isoImage; defaultPackage."x86_64-linux" = inputs.self.nixosConfigurations.iso.config.system.build.isoImage;
defaultPackage."x86_64-darwin" = inputs.self.darwinConfigurations.C02G48H8MD6R.system; defaultPackage."x86_64-darwin" = inputs.self.darwinConfigurations.C02G48H8MD6R.system;
homeConfigurations = (
import ./home {
inherit nixpkgs nixunstable agenix home-manager nurpkgs;
}
);
overlay = local_overlay;
modules = import ./modules;
}; };
} }
+39
View File
@@ -0,0 +1,39 @@
# 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 = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sr_mod" "rtsx_usb_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/63bcc80e-0501-4aef-bb58-30bb83881055";
fsType = "ext4";
};
fileSystems."/boot/efi" =
{ device = "/dev/disk/by-uuid/C617-B2B1";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/bc4f24a3-5969-4bcb-95f4-f80109e36ebb"; }
];
# 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.enp7s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp6s0.useDHCP = lib.mkDefault true;
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
+28
View File
@@ -0,0 +1,28 @@
{ ... }:
{
home.file.".ansible.cfg".text = ''
[defaults]
forks=10
host_key_checking=False
# Also available: profile_roles
callback_enabled=timer,profile_tasks
stdout_callback=yaml
nocows=1
cow_selection=tux
collections_path=~/src
[ssh_connection]
pipelining=True
ssh_args = -o ControlMaster=auto -o ControlPersist=600s -o IdentitiesOnly=yes -o GSSAPIAuthentication=no -o StrictHostKeyChecking=no
control_path=%(directory)s/%%h-%%r
control_path_dir=/tmp
[callback_profile_tasks]
sort_order=descending
[galaxy]
role_skeleton_ignore = ^.git$,^.*/.git_keep$,\..*.swp
role_skeleton = ~/src/ansible_collections/meta_ansible_templates/role
'';
}
+35
View File
@@ -0,0 +1,35 @@
{ nixpkgs, nurpkgs, home-manager, username ? builtins.getEnv "USER", ... }:
let
homeDirectory = if username == "root" then "/root" else "/home/${username}";
configDir = "${homeDirectory}/.config";
pkgs = import nixpkgs {
config.allowUnfree = true;
config.xdg.configHome = configDir;
overlays = [
nurpkgs.overlay
(import ../overlays)
];
};
nur = import nurpkgs {
inherit pkgs;
nur = pkgs;
};
mkhome = system: gui:
home-manager.lib.homeManagerConfiguration rec {
inherit pkgs system username homeDirectory;
stateVersion = "22.05";
configuration = import ./home.nix username {
inherit nur pkgs gui;
inherit (pkgs) config lib stdenv;
};
};
in {
"aarch64-gui" = mkhome "aarch64-linux" true;
"aarch64-nogui" = mkhome "aarch64-linux" false;
"x86_64-gui" = mkhome "x86_64-linux" true;
"x86_64-nogui" = mkhome "x86_64-linux" false;
}
+12
View File
@@ -0,0 +1,12 @@
{ pkgs, ... }:
{
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
home.packages = [
pkgs.xonsh-direnv
];
}
+8
View File
@@ -0,0 +1,8 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
element-desktop
nheko
];
}
+18
View File
@@ -0,0 +1,18 @@
{ pkgs, ... }:
{
imports = [
./chat.nix
./firefox.nix
./terminal.nix
];
home.packages = with pkgs; [
bitwarden
gnucash
handbrake
onlyoffice-bin
synology-drive-client
vlc
];
}
+41
View File
@@ -0,0 +1,41 @@
{ lib, pkgs, ... }:
let
ffPkgs = wayland: if wayland
then [ pkgs.firefox-wayland ]
else [ pkgs.firefox ];
vars = {
MOZ_ENABLE_WAYLAND = "1";
XDG_CURRENT_DESKTOP = "sway";
};
in with lib;
{
programs.firefox = {
enable = true;
package = pkgs.firefox-wayland.override {
cfg = {
enableGnomeExtensions = true;
};
};
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
bitwarden
octotree
refined-github
tree-style-tab
ublock-origin
];
profiles = {
default.settings = {
"browser.startup.page" = 3;
"browser.startup.homepage" = "https://thehellings.com";
"doh-rollout.doorhanger-decision" = "UIDisabled";
"doh-rollout.doneFirstRun" = true;
};
};
};
programs.bash.sessionVariables = vars;
programs.xonsh.sessionVariables = vars;
}
+13
View File
@@ -0,0 +1,13 @@
{ ... }:
{
programs.gnome-terminal = {
enable = true;
showMenubar = true;
themeVariant = "dark";
profile.default = {
default = true;
visibleName = "greg";
};
};
}
+21 -6
View File
@@ -1,13 +1,28 @@
name: { pkgs, lib, ...}: name: { pkgs, lib, gui, ...}:
{ let
guiImports = if gui then
[ ./gui ] else [];
in {
imports = [ imports = [
./modules
./ansible.nix
./bash.nix ./bash.nix
./direnv.nix
./git.nix ./git.nix
./vim.nix
./ssh.nix ./ssh.nix
]; ./vim.nix
./xonsh.nix
] ++ guiImports;
home.username = name;
home.homeDirectory = if name == "root" then "/root" else "/home/${name}"; home.stateVersion = "22.05";
home.packages = with pkgs; [
cdrtools
ffmpeg
hms
libtheora
x265
];
} }
+7
View File
@@ -0,0 +1,7 @@
{ ... }:
{
imports = [
./xonsh.nix
];
}
+96
View File
@@ -0,0 +1,96 @@
{ config, pkgs, lib, ... }:
let
cfg = config.programs.xonsh;
in with lib; {
options = {
programs.xonsh = {
enable = mkEnableOption "Enable the xonsh program";
sessionVariables = mkOption {
type = types.attrs;
default = {};
example = { XONSH_TRACE_SUBPROC = true; };
description = ''
Environment variables that will be set for the Xonsh session.
'';
};
aliases = mkOption {
type = types.attrsOf types.str;
default = {};
example = literalExpression ''
{
ll = "ls -l";
la = "ls -a";
}
'';
description = ''
An attribute set that maps aliases (the top level attribute names in
this option) to command strings or directly to build outputs.
'';
};
configHeader = mkOption {
type = types.lines;
default = "";
example = literalExpression ''
import os
import sys
'';
description = "An arbitrary string to put at the top of the config file";
};
configFooter = mkOption {
type = types.lines;
default = "";
example = literalExpression ''
def _some_method(args):
do_command()
some_other_thing()
aliases['some_method'] = _some_method
'';
description = "An arbitrary string to put at the end of the config file";
};
};
};
config =
let
shortAliases = concatStringsSep "\n" (
mapAttrsToList (k: v: "aliases['${k}']='${v}'") cfg.aliases
);
listToPythonList = let
listInternals = args:
concatStringsSep "\n" (map (v: "'${v}'") args);
in list: "[${listInternals list}]";
sessionVars = concatStringsSep "\n" (
mapAttrsToList (k: v:
if builtins.typeOf v == "string" then
"\$${k} = '${v}'"
else if builtins.typeOf v == "list" then
"\$${k} = ${listToPythonList}"
else if builtins.typeOf v == "int" then
"\$${k} = ${toString v}"
else ""
) cfg.sessionVariables
);
in mkIf cfg.enable {
home.packages = [ pkgs.xonsh ];
home.file.".xonshrc".text = ''
${cfg.configHeader}
${sessionVars}
${shortAliases}
${cfg.configFooter}
'';
};
}
+5
View File
@@ -35,6 +35,11 @@
"src.fedoraproject.org pkgs.fedoraproject.org" = { "src.fedoraproject.org pkgs.fedoraproject.org" = {
user = "greghellings"; user = "greghellings";
}; };
"127.*".extraOptions = {
PubkeyAcceptedAlgorithms = "+ssh-rsa";
HostkeyAlgorithms = "+ssh-rsa";
};
}; };
}; };
+11 -7
View File
@@ -15,14 +15,16 @@ in
programs.vim = { programs.vim = {
enable = true; enable = true;
plugins = with pkgs.vimPlugins; [ plugins = with pkgs.vimPlugins; [
ansible-vim
bufexplorer bufexplorer
ctrlp ctrlp
direnv-vim
nerdtree nerdtree
vim-gitgutter vim-gitgutter
vim-flake8 vim-flake8
vim-fugitive vim-fugitive
vim-indent-guides vim-indent-guides
#vim-stabs vim-packer
gruvbox gruvbox
syntastic syntastic
]; ];
@@ -72,12 +74,13 @@ set wildignore+=*.swp,*.pyc,*.class,.tox
let g:ctrlp_working_path_mode = 'arc' let g:ctrlp_working_path_mode = 'arc'
let g:ctrlp_switch_buffer = 0 let g:ctrlp_switch_buffer = 0
let g:ctrlp_cmd = 'CtrlPMixed' let g:ctrlp_cmd = 'CtrlPMixed'
let g:ctrlp_user_command = { let g:ctrlp_show_hidden = 1
\'types': { "let g:ctrlp_user_command = {
\1: ['.git', 'git ls-files --cached --exclude-standard --others' ], " \'types': {
\}, " \1: ['.git', '${pkgs.git}/bin/git ls-files --cached --exclude-standard --others' ],
\'fallback': 'find . -type f | grep -v -e "\.tox/" -e "\.git/"' " \},
\} " \'fallback': '${pkgs.findutils}/bin/find . -type f | ${pkgs.gnugrep}/bin/grep -v -e "\.tox/" -e "\.git/"'
"\}
" let g:ctrpl_match_func = { 'match': 'pymatcher#PyMatch' } " let g:ctrpl_match_func = { 'match': 'pymatcher#PyMatch' }
" Settings for NerdTree " Settings for NerdTree
@@ -88,6 +91,7 @@ autocmd! BufWritePost .vimrc source $MYVIMRC
" Tell syntastic to use yamllint " Tell syntastic to use yamllint
let g:syntastic_yaml_checkers = ['yamllint'] let g:syntastic_yaml_checkers = ['yamllint']
let g:syntastic_yaml_yamllint_args = [] let g:syntastic_yaml_yamllint_args = []
let g:syntastic_shell = "${pkgs.bash}/bin/bash"
" Shortcuts for resolving git diff conflicts " Shortcuts for resolving git diff conflicts
let g:diffget_local_map = 'gl' let g:diffget_local_map = 'gl'
let g:diffget_upstream_map = 'gu' let g:diffget_upstream_map = 'gu'
+123
View File
@@ -0,0 +1,123 @@
{ pkgs, config, lib, ... }:
{
programs.xonsh = {
enable = true;
sessionVariables = {
TIMEFORMAT = "%3Uu %3Ss %3lR %P%%";
CLICOLOR = 1;
LSCOLORS = "ExGxBxDxCxEgEdxbxgxcxd";
EDITOR = "${pkgs.vim}/bin/vim";
# Tells vox where to find virtualenvs
VIRTUALENV_HOME = "${config.home.homeDirectory}/venv/";
# vte_new_tab_cwd causes new Terminal tabs to open in the
# same CWD as the current tab
PROMPT = "{vte_new_tab_cwd}{env_name}{BOLD_GREEN}{user}@{hostname}{BOLD_BLUE} {short_cwd}{branch_color}{curr_branch: {}}{RESET} {BOLD_BLUE}{prompt_end}{RESET} ";
SWORD_PATH = "${config.home.homeDirectory}/.sword/";
OS_CLOUD = "default";
MAVEN_OPTS = " -Dmaven.wagon.http.ssl.insecure=true";
LESS_TERMCAP_mb = "\\033[01;31m"; # begin blinking
LESS_TERMCAP_md = "\\033[01;31m"; # begin bold
LESS_TERMCAP_me = "\\033[0m"; # end mode
LESS_TERMCAP_so = "\\033[01;44;36m"; # begin standout-mode (bottom of screen)
LESS_TERMCAP_se = "\\033[0m"; # end standout-mode
LESS_TERMCAP_us = "\\033[00;36m"; # begin underline
LESS_TERMCAP_ue = "\\033[0m"; # end underline
};
aliases = {
ll = "ls -l";
vup = "vagrant up --provision --provider libvirt";
vos = "vagrant up --provision --provider openstack";
vssh = "vagrant ssh";
vhalt = "vagrant halt";
vprov = "vagrant provision";
vdown = "vagrant destroy";
ac = "vox activate";
d = "vox deactivate";
devroles = "cd ~/src/ansible_collections/devroles";
molcol = "molecule -c ../../tests/molecule.yml";
pa = "cd ~/src/packaging";
dirflake = "nix flake new -t github:nix-community/nix-direnv";
tsup = "sudo tailscale up";
tspub = "sudo tailscale up --exit-node=linode";
tshome = "sudo tailscale up --exit-node=2maccabees";
tsclear = "sudo tailscale up --exit-node=''";
rebuild = "sudo nixos-rebuild switch";
};
configHeader = ''
# set -e == $RAISE_SUBPROC_ERROR = True
# set -x == trace on; $XONSH_TRACE_SUBPROC = True
# $? == _.rtn
import os
xontrib load direnv
'';
#$PKG_CONFIG_PATH = '/usr/local/lib/pkgconfig'
#$GOPATH = $HOME + '/.go'
#$JAVA_HOME = '/etc/alternatives/java_sdk'
configFooter = ''
def _yaml2json(args, stdin=None, stdout=None):
import sys, yaml, json
from yaml import CLoader
json.dump(yaml.load(stdin, Loader=CLoader), stdout, indent=4)
def _py2env(args):
vox new @(args[0]) -p /usr/bin/python2
def _py3env(args):
vox new @(args[0])
def _rundock(args):
if os.path.exists('/usr/bin/podman'):
e = 'podman'
else:
e = 'docker'
@(e) exec -ti @(args[0]) /bin/bash
def _pip_extras(args):
import importlib_metadata
print(importlib_metadata.metadata(args[0]).get_all('Provides-Extra'))
# Container stuff
def _newdock(args):
if os.path.exists('/usr/bin/podman'):
e = 'podman'
else:
e = 'docker'
@(e) run -P --privileged=true -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v @(os.getcwd()):/dmnt -v /etc/pki:/etc/pki:ro -d --name @(args[1]) @(args[0]) /sbin/init
rundock @(args[1])
def _unknown_host(args):
sed -i -e @(args[0])d ~/.ssh/known_hosts
aliases['yaml2json'] = _yaml2json
aliases['py2env'] = _py2env
aliases['py3env'] = _py3env
aliases['rundock'] = _rundock
aliases['newdock'] = _newdock
aliases['unknown_host'] = _unknown_host
aliases['pip_extras'] = _pip_extras
###
#
# Other random nice-to-have things
#
###
# Does virtualenv support
xontrib load vox
# Faster coreutils
xontrib load coreutils
# Allows identifying JSON as if it was Python by adding some new builtins to the language
import builtins
builtins.true = True
builtins.false = False
builtins.null = None
'';
};
}
+11 -3
View File
@@ -2,14 +2,22 @@
let let
extraHosts = builtins.concatStringsSep "\n" [ extraHosts = builtins.concatStringsSep "\n" [
# Local hosts
"10.42.0.1 switch" "10.42.0.1 switch"
"10.42.1.1 router" "10.42.1.1 router"
"10.42.1.2 dns smart" "10.42.1.2 2maccabees 2maccabees.thehellings.lan dns dns.thehellings.lan smart smart.thehellings.lan"
"100.99.244.92 dns.me.ts"
"10.42.1.3 printer" "10.42.1.3 printer"
"10.42.1.4 chronicles nas" "10.42.1.4 chronicles nas"
"100.119.228.115 nas.me.ts"
"10.42.1.12 tv" "10.42.1.12 tv"
# Tailscale hosts
"100.90.74.19 jude.me.ts"
"100.99.244.92 dns.me.ts 2maccabees.me.ts smart.me.ts"
"100.119.228.115 chronicles.me.ts nas.me.ts"
"100.115.57.8 linode.me.ts"
# Dev hosts
"10.42.101.1 icdm.lan wiki.icdm.lan *.icdm.lan"
]; ];
extraConfig = builtins.concatStringsSep "\n" [ extraConfig = builtins.concatStringsSep "\n" [
+34 -78
View File
@@ -7,19 +7,44 @@ in
{ {
virtualisation.podman.enable = true; virtualisation.podman.enable = true;
services.home-assistant = {
enable = true;
configDir = "/var/lib/hass";
package = (pkgs.home-assistant.override {
extraComponents = [
"accuweather"
"cast"
"eufy"
"lovelace"
"tplink"
"wiz"
"zwave_js"
];
}).overrideAttrs (oldAttrs: {
doInstallCheck = false;
});
config = {
default_config = {};
esphome = {}; # Get these things loaded, even if not configured
met = {};
tts = [ { platform = "google_translate"; } ];
http = {
use_x_forwarded_for = true;
trusted_proxies = [ "127.0.0.1" "::1" ];
server_host = "127.0.0.1";
};
"automation ui" = "!include automations.yaml";
"script ui" = "!include scripts.yaml";
"scene ui" = "!include scenes.yaml";
};
};
# Although NixOS has a package for Home Assistant, it is not kept as up to date as the container and the upstream # Although NixOS has a package for Home Assistant, it is not kept as up to date as the container and the upstream
# is very vocal about only supporting their own container or the HAOS deployments. So we deploy the container here # is very vocal about only supporting their own container or the HAOS deployments. So we deploy the container here
# and avoid any potential messes from that # and avoid any potential messes from that
virtualisation.oci-containers = { virtualisation.oci-containers = {
backend = "podman"; backend = "podman";
containers."home-assistant" = {
image = "ghcr.io/home-assistant/home-assistant:stable";
ports = [ "127.0.0.1:8123:8123" ];
volumes = [ "/var/lib/hass:/config" ];
extraOptions = [
"--device" "/dev/ttyAMA0"
];
};
# I have ZWave devices. The easiest way to connect to them is the zwavejs2mqtt service running, so we spin up # I have ZWave devices. The easiest way to connect to them is the zwavejs2mqtt service running, so we spin up
# its container and map the ZWave device into it # its container and map the ZWave device into it
@@ -36,13 +61,6 @@ in
# Both of the above container need storage for their configuration and devices, but it is not created correctly by # Both of the above container need storage for their configuration and devices, but it is not created correctly by
# the container. So we add the creation of /var/lib/{zwave,hass} to the systemd Unit files # the container. So we add the creation of /var/lib/{zwave,hass} to the systemd Unit files
systemd.services = { systemd.services = {
"podman-home-assistant" = {
serviceConfig = {
StateDirectory = "hass";
StateDirectoryMode = pkgs.lib.mkForce "0777";
};
};
"podman-zwave".serviceConfig = { "podman-zwave".serviceConfig = {
StateDirectory = "zwave"; StateDirectory = "zwave";
StateDirectoryMode = pkgs.lib.mkForce "0777"; StateDirectoryMode = pkgs.lib.mkForce "0777";
@@ -50,74 +68,12 @@ in
}; };
# Podman 3.4, which is in NixOS 21.11 does not support creating multiple network interfaces during launch. Starting in Podman
# 4.0 (NixOS 22.05) that will be possible. For now, adding this sidecar service that executes after every time the Home Assistant
# container is started will do the necessary Podman commands to attach the container to the interface for VLAN 66. Once we
# upgrade to NixOS 22.05 this service can go away and we can explicitly add two "--network" options to the Home Assistant container
systemd.services."home-assistant-network-attach" = {
requires = service_list;
path = [ pkgs.podman pkgs.coreutils ];
script = "sleep 10 && podman network connect podman66 home-assistant";
wantedBy = service_list;
serviceConfig = {
Type = "oneshot";
};
};
# This ensures that Podman has a separate network configured to attach to my IOT VLAN so that Home Assistant is able to communicate
# with my devices as well as with the rest of the LAN.
systemd.services.podman66 = {
wantedBy = service_list;
before = service_list;
path = [ pkgs.podman ];
script = "podman network create -d macvlan -o parent=vlan66 --subnet 192.168.66.0/24 --ip-range 192.168.66.192/26 --gateway 192.168.66.1 podman66 || true";
serviceConfig = {
Type = "oneshot";
};
};
# I do not want to have to remember the port number for Home Assistant's UI, so we use Nginx to proxy communication from
# smart.thehellings.lan to the Home Assistant UI
# After the first activation of this container, before you can access the Home Assistant UI, you need to ensure that the
# Home Assistant's configuration at /var/lib/hass/configuration.yaml includes the following option. Update the IP address
# if you have changed the value of your default podman network.
# ```yaml
# http:
# use_x_forwarded_for: true
# trusted_proxies:
# - "10.88.0.1"
# ```
# Home assistant will not accept connections from the proxy if these values are not set. If you are adding those values
# manually after initial creation of the containers, then you will need to issue `systemctl restart podman-home-assistant.service`
# for Home Assistant to pick up the new values. After that, proxy connections should work well. If you are sitting behind
# multiple layers of proxies, then add more of them in the list. The list also accepts subnet notation in case you have
# multiple potentially incoming connections. So you could do "10.88.0.1/24", according to the docs. However, that has not
# worked in my testing, as Home Assistant throws an error on start up saying that value is invalid
greg.proxies."smart.thehellings.lan".target = "http://127.0.0.1:8123"; greg.proxies."smart.thehellings.lan".target = "http://127.0.0.1:8123";
# Ensure that both ports are up and running. We keep 8123 directly open because we are on the LAN and sometimes want to connect # Ensure that both ports are up and running. We keep 8123 directly open because we are on the LAN and sometimes want to connect
# directly for troubleshooting Nginx configuration # directly for troubleshooting Nginx configuration
networking.firewall = { networking.firewall = {
enable = true; enable = true;
allowedTCPPorts = [ 80 8123 ]; allowedTCPPorts = [ 80 8091 8123 ];
};
# No data is secure unless it is backed up! So we back up the data on this node to our NAS using Syncthing, from there we will
# handle things like off site
services.syncthing = {
enable = true;
folders = {
"asdf-fdsa" = {
enable = true;
path = "/var/lib/hass";
devices = [ "nas" ];
};
"zwave-live" = {
enable = true;
path = "/var/lib/zwave";
devices = [ "nas" ];
};
};
}; };
} }
-9
View File
@@ -20,11 +20,6 @@
address = "192.168.66.2"; address = "192.168.66.2";
prefixLength = 24; prefixLength = 24;
} ]; } ];
vlan67.ipv4.addresses = [ {
address = "192.168.67.2";
prefixLength = 24;
} ];
}; };
vlans = { vlans = {
@@ -32,10 +27,6 @@
id = 66; id = 66;
interface = "eth0"; interface = "eth0";
}; };
vlan67 = {
id = 67;
interface = "eth0";
};
}; };
}; };
+1 -1
View File
@@ -2,7 +2,7 @@
{ {
imports = [ imports = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-base.nix" "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares-gnome.nix"
]; ];
networking.networkmanager.enable = lib.mkForce false; networking.networkmanager.enable = lib.mkForce false;
+15
View File
@@ -0,0 +1,15 @@
{ ... }:
{
# Use the systemd-boot EFI boot loader.
#boot.loader.systemd-boot.enable = true;
boot.loader.grub.device = "/dev/nvme0n1";
boot.loader.grub.useOSProber = true;
boot.loader.grub.extraEntries = ''
menuentry "Windows" {
chainloader (hd0,2)+1
}
'';
boot.loader.efi.canTouchEfiVariables = true;
networking.interfaces.enp4s0.useDHCP = true;
}
+15
View File
@@ -0,0 +1,15 @@
{ ... }:
{
imports = [
./boot.nix
./hardware-configuration.nix
./podman.nix
./printing.nix
./virt.nix
];
programs.steam.enable = true;
networking.hostName = "jude";
greg.tailscale.enable = true;
greg.gnome.enable= true;
}
+24
View File
@@ -0,0 +1,24 @@
# 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" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/27ae91ed-32e9-411e-8227-0d99e360fbbf";
fsType = "btrfs";
};
swapDevices = [ ];
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
+8
View File
@@ -0,0 +1,8 @@
{ ... }:
{
virtualisation.podman = {
enable = true;
dockerCompat = true;
};
}
+12
View File
@@ -0,0 +1,12 @@
{ pkgs, ... }:
{
# ipp://printer.thehellings.lan:631/ - generic postscript printer
services.printing = {
enable = true;
drivers = with pkgs; [
gutenprint
gutenprintBin
];
};
}
+31
View File
@@ -0,0 +1,31 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
ansible
libguestfs
packer
virt-manager
vagrant
];
# Give my user access to the libvirtd process
users.users.greg.extraGroups = [ "libvirtd" ];
virtualisation = {
libvirtd = {
enable = true;
onBoot = "ignore"; # Do not auto-restart VMs on boot, unless they are marked autostart
};
waydroid = {
enable = true;
};
virtualbox.host.enable = true;
};
users.extraGroups.vboxusers.members = [ "greg" ];
boot.extraModprobeConfig = "options kvm_amd nested=1";
}
+15
View File
@@ -0,0 +1,15 @@
{ ... }:
{
imports = [
./hardware-configuration.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot/efi";
# Graphics, please
greg.gnome.enable = true;
# Set host name
networking.hostName = "lappy";
}
+39
View File
@@ -0,0 +1,39 @@
# 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 = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sr_mod" "rtsx_usb_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/63bcc80e-0501-4aef-bb58-30bb83881055";
fsType = "ext4";
};
fileSystems."/boot/efi" =
{ device = "/dev/disk/by-uuid/C617-B2B1";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/bc4f24a3-5969-4bcb-95f4-f80109e36ebb"; }
];
# 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.enp7s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp6s0.useDHCP = lib.mkDefault true;
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
+1
View File
@@ -10,6 +10,7 @@
]; ];
greg.home = false; greg.home = false;
greg.linode.enable = true; greg.linode.enable = true;
greg.tailscale.enable = true;
networking.hostName = "linode"; networking.hostName = "linode";
networking.domain = "thehellings.com"; networking.domain = "thehellings.com";
} }
+4 -8
View File
@@ -25,13 +25,9 @@
enableACME = true; enableACME = true;
}; };
services.syncthing.folders."nextcloud-backup" = { greg.backup.jobs.nextcloud = {
path = "${config.services.nextcloud.datadir}"; src = "/var/lib/nextcloud";
enable = true; dest = "nextcloud-backup";
devices = [ "nas" ]; user = "nextcloud";
}; };
services.cron.systemCronJobs = [
"59 2 * * * root chmod -R a+r ${config.services.syncthing.folders.nextcloud-backup.path} && find ${config.services.syncthing.folders.nextcloud-backup.path} -type d -exec chmod a+x '{}' \\;"
];
} }
+2 -1
View File
@@ -5,7 +5,7 @@ in
{ {
security.acme = { security.acme = {
acceptTerms = true; acceptTerms = true;
email = "greg.hellings@gmail.com"; defaults.email = "greg.hellings@gmail.com";
}; };
services.nginx = { services.nginx = {
@@ -30,5 +30,6 @@ in
greg.proxies."thehellings.com" = { greg.proxies."thehellings.com" = {
target = "http://${homepage}/"; target = "http://${homepage}/";
ssl = true; ssl = true;
genAliases = false;
}; };
} }
+18 -12
View File
@@ -27,25 +27,31 @@ root root postgres
''; '';
}; };
services.postgresqlBackup.enable = true; services.postgresqlBackup = {
enable = true;
databases = [
"nextcloud"
"synapse"
];
};
services.logrotate = { services.logrotate = {
enable = true; enable = true;
paths = { settings = {
postgres = { postgresBackup = {
enable = true; enable = true;
path = "${config.services.postgresqlBackup.location}/*.gz"; files = "${config.services.postgresqlBackup.location}/*.gz";
};
postgresLog = {
enable = true;
files = "/var/lib/postgresql/*/log/*.log";
}; };
}; };
}; };
services.syncthing.folders."postgres-backups" = { greg.backup.jobs.postgresql = {
path = "${config.services.postgresqlBackup.location}"; src = "/var/backup/postgresql";
enable = true; dest = "linode-postgres";
devices = [ "nas" ]; user = "postgres";
}; };
services.cron.systemCronJobs = [
"59 2 * * * root chmod -R a+r ${config.services.postgresqlBackup.location} && find ${config.services.postgresqlBackup.location} -type d -exec chmod a+x '{}' \\;"
];
} }
+22 -18
View File
@@ -74,26 +74,30 @@ return 200 '${builtins.toJSON client}';
services.matrix-synapse = { services.matrix-synapse = {
enable = true; enable = true;
database_name = "synapse";
database_user = "matrix-synapse";
# Identify ourselves as the root of our own domain # Identify ourselves as the root of our own domain
server_name = "thehellings.com"; settings = {
#registration_shared_secret = "B9EoPr2WV9hzwc7uL2Sx1JmvCeKDEOGCpB0uginQcQtEH4wzRtkSIdo7lltrjSQa"; database.args = {
# Bind a single listener to localhost only, disable SSL/TLS, and put user = "matrix-synapse";
# it behind an nginx proxy database = "synapse";
listeners = [ { };
port = 8448; server_name = "thehellings.com";
bind_address = "127.0.0.1"; #registration_shared_secret = "B9EoPr2WV9hzwc7uL2Sx1JmvCeKDEOGCpB0uginQcQtEH4wzRtkSIdo7lltrjSQa";
type = "http"; # Offload SSL/TLS to Nginx # Bind a single listener to localhost only, disable SSL/TLS, and put
tls = false; # it behind an nginx proxy
resources = [ { listeners = [ {
names = [ "client" "federation" ]; port = 8448;
compress = false; # Offload compressiong to Nginx bind_addresses = ["127.0.0.1"];
type = "http"; # Offload SSL/TLS to Nginx
tls = false;
resources = [ {
names = [ "client" "federation" ];
compress = false; # Offload compressiong to Nginx
} ];
} ]; } ];
} ]; app_service_config_files = [
app_service_config_files = [ "/etc/${fbRegistrationFile}"
"/etc/${fbRegistrationFile}" ];
]; };
}; };
# Open networking ports for the server # Open networking ports for the server
+12
View File
@@ -0,0 +1,12 @@
{ ... }:
{
imports = [
./automatic/nix.nix
./automatic/programs.nix
./automatic/syncthing.nix
./automatic/users.nix
];
# I am a fan of network manager, myself
networking.networkmanager.enable = true;
}
+21
View File
@@ -0,0 +1,21 @@
{ pkgs, ... }:
{
# Enable flakes
nix = {
package = pkgs.nixFlakes;
# Keep freespace available, at a minimum, and enable Flakes
extraOptions = ''
experimental-features = nix-command flakes
min-free = ${toString (1024 * 1024 * 1024) }
max-free = ${toString (5 * 1024 * 1024 * 1024) }
# Used by direnv
keep-outputs = true
keep-derivations = true
'';
};
nixpkgs.config.allowUnfree = true;
system.stateVersion = "22.05";
}
+30
View File
@@ -0,0 +1,30 @@
{ pkgs, agenix, ... }:
let
myPackages = pypackages: with pypackages; [
pkgs.xonsh-direnv
];
myPython = pkgs.python3.withPackages myPackages;
in {
# Base packages that need to be in all my hosts
environment.systemPackages = with pkgs; [
agenix.defaultPackage."${system}"
bitwarden-cli
diffutils
git
gnupatch
findutils
hms # My own home manager switcher
home-manager
htop
myPython
pwgen
tmux
transcrypt
unzip
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget
yamllint # Used in vim
];
}
+46
View File
@@ -0,0 +1,46 @@
{ ... }:
let
syncs = [
"nas"
"dns"
"linode"
];
in
{
services.syncthing = {
enable = true;
user = "greg";
group = "users";
dataDir = "/home/greg/sync";
devices = {
nas = {
addresses = [
"tcp://nas.thehellings.lan:22000"
"tcp://chronicles.greg-hellings.gmail.com.beta.tailscale.net:22000"
];
id = "74JUTZG-77EPGO3-FEYCL2P-CHDWP5G-6EXWZVB-XTAH6O5-TUXCVY2-QNRHSQ4";
};
dns = {
addresses = [
"tcp://dns.thehellings.lan:22000"
"tcp://2maccabees.greg-hellings.gmail.com.beta.tailscale.net:22000"
];
id = "C4XJCH7-3ZNW6XZ-R5DB2EU-OEGVVT2-WPHQAG7-UDWER36-6NO5KZR-4MN5VAK";
};
linode = {
addresses = [
"tcp://linode.thehellings.com:22000"
];
id = "ROZPUG5-G4IAXYA-JNRQXRD-5PFU2BQ-WVJTOGZ-DFMGJ5E-Q4IGXCJ-JHSNDQ6";
};
};
folders = {
"mkrvy-tc6x9" = {
path = "/home/greg/drive";
enable = true;
devices = syncs;
};
};
};
}
+43
View File
@@ -0,0 +1,43 @@
{ config, pkgs, agenix, ... }:
{
<<<<<<<< HEAD:profiles/linux/default.nix
imports = [
../shared
./programs.nix
./syncthing.nix
./xonsh.nix
];
# Use hardlinking instead of copying when possible
nix.autoOptimiseStore = true;
# I am a fan of network manager, myself
networking.networkmanager.enable = true;
========
>>>>>>>> origin/main:modules/automatic/users.nix
# Enable the OpenSSH daemon for remote control
services.openssh.enable = true;
#services.openssh.permitRootLogin = "yes";
# Define a user account. Don't forget to set a password with passwd.
users.users.greg = {
isNormalUser = true;
createHome = true;
extraGroups = [ "wheel" "networkmanager" ]; # Enable sudo for the user.
shell = pkgs.xonsh;
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAEAQDLQRq55JKqLifX+31kEXyuoB8gfM+5thAlgR7XLPvvdu6g2a5cCWyozQ1I2oGbPRfJtzcJ5ifM7Ii2PuqAj3MdYFLHBEDOhIpBBWme9Ts2YB9HJ4NorBvB4zEfJd0Q7k2MmylyeBOwdwGz3bVqPRDcJbxWFMDHqr33FEs6SXdfyAQ5SvhWGARI84qz8zUUdOp6M4e3aIGO3cx1gA+YzYQ4FbUtL8+m1NFO8VoNFMZBMf5q0iF/SgEu5bmGWUCePia6DvfeBFQ2/y4Y7WmOj980WE+JmFTkIvmGruMYeGI8FuDQ2JIIIcehddy9bQbPF4VlGnTFsHqJYVRUUWc+vH1cPNMn01oB8s27ogf9e1lyhIN+cZOgp/jDt4eXcO4Wr04uwj7CI6m+d8iMQOa5Jv0hmNgqqiwOMVBlKeo0FCxlovzwvn/Lia9WZ74JqM6JwLCD8SZ0oFgiSIHOTHrQhr7iaCmj7X/0ey7VR8FnCrpeAJpG+ELTfWGshF1d9QR2zW7u4EsXTDLiuOmdJ+/KxwMvjMcWdlg2+Qch6SwulTQRxWaED2IWJo+YiAql8eaiVXu/eZJGLoiskGFZnONoLrzIT4pSjakPlrSpn/M/GkP1pDpaMkr24OhJsGpJNEU3F1ZcOMqy2iJzIxlPmU8Xg0I/OrnbJplpaXeRCqnmouJUJhWkaPzawaVyW7dtvprLWcpQtUgTRet18WLyOrLKlq1jwvNRMTPKUJ2IFJMpk2pNEP6bdiUxyMa4vrRIEU2p1zsYSUJpCRLtccZ/i/+yAqwnTA2L5TdAORi9nD2uCdM/Ljz52V3A14QapS6oqcoWx2soWKgnsbVXoG8DxmUTpll77Ze9t7Y5216SMInWuOu0vstP8ZcgFmWsiBgIYIuLA58abWHMxgD251phYidua6R3Gtkf8J/kYqTR1P6eJF1bt5efEg7FD2aL1QQZsYJo3CRNz7yVe1XqMdPbfe2mFXQVF9TDX5x6r9Ir3d0KiEmTlBdByz8nSyPJ8IQxC58NT4LNVQs3p2XH2Zcf6B4JOBSmV4NNBnLseFobsxniWjkWwZigED/D2iu3OXuuhmskCbw0hKy2rBcKffaSNMioVqYIiYNfKlMlSvAacQKqc/1HCpqgX8PwAcSgNSLy4K7/gIrTHmjY+g+CH7onzatWzkLo+0vsZRa/D/qwhhK2CU2FeU07mhnWxWuzqpJuqVaAwDTaEforK7nQUtAOFAZZP6qGhIoqsynYt4THb+QORb3QYfaP0PVgQwXfVU5Q8eUQFZ8A+siPtOASFjDumsIbseB5VzkF+UhvdseJwkX2+4pVFu8eHFDyvArYsHeGK6fBcQGJFQc2jSs6doIP9HD9IO2R ghelling@unknown38BAF87CD102"
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDv26EhyBZS9E5bcuZDHHkh/oeyINHXlsD3OEL1UjZekIsiHoMv2QHYq99cYO/CsTVGcZj4ZTOKxrQQ069Cm1II76nXJP9mb3+jip5QAE/zYSWfxi3SgQum95qmkQsx9mxeKFi4NfUU9qN9vpmJkn0hrvYWg8vU98bcYmkx4RtGW6EgZJed3347EtHshTqq3UfAbj3ErSQdCbEqgNOjokzGWmcx16HyyO5HoQj2FP7PGQmArzMz0V76BRsnpg97CoPKkoWoGk+P13BCWWXR9GCa2PbJ9uprzPa6Ib4+i9RJPdeSkUiLlFi6rBTHaZUT9WUIEaqNSq3bbu1bIqMXkifPeDw7m+TMfOBT8MUBciJaPlPTgXuz3T4kCHBI041hIt+/VqryGtxnT45IavyUaN3JWYntDbpG3eEW4N9IB2oGWuC/XuTJrsUaNpLPpApUKuozxhsFELBRepU+j+Wn4kgJJl8hy0n+WL63ZUee+/F23C7UNXoOc/wU3KbpxO6ipsTSkTzhZpQF2LOuA3JUs5t9ZaiCJ2P9r8axHiphCRcIYSbcCo3pZupf1eTDSXm+x9/UB2sfzErNEH4SdakoSdAi8jG8WhPVOs3BrIXjVBjvyBLeOH86EzBGR/Ba8X6MWoEW9Oau1C3P/z65VH8RHpvPvp6axlMynyVI1ygt5uheuQ== gregory.hellings@C02G48H8MD6R"
];
};
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "us";
};
}
+107
View File
@@ -0,0 +1,107 @@
{ lib, config, pkgs, ... }:
let
cfg = config.greg.backup;
backup_key = "backup_keys/id_ed25519";
makeJob = name: job: {
paths = job.src;
encryption.mode = "none";
environment.BORG_RSH = "ssh -i /etc/${backup_key} -o 'StrictHostKeyChecking=no' -o 'UserKnownHostsFile=/dev/null'";
repo = "ssh://backup@nas.me.ts//volume1/NetBackup/${job.dest}";
compression = "auto,zstd";
startAt = "daily";
user = job.user;
group = job.group;
preHook = job.pre;
postHook = job.post;
};
cronJob = name: job:
let
binName = "backup-${name}";
script = pkgs.writeShellScriptBin binName ''
exec 1> >(systemd-cat -t $(basename $0)) 2>&1
set -ex
${job.pre}
${pkgs.rsync}/bin/rsync -avz --delete -e "${pkgs.openssh}/bin/ssh -i /etc/${backup_key} -o 'StrictHostKeyChecking=no' -o 'UserKnownHostsFile=/dev/null'" ${job.src}/* backup@nas.me.ts:/volume1/NetBackup/${job.dest}/
${job.post}
'';
in {
inherit script;
cron = "0 1 * * * ${job.user} ${script}/bin/${binName}";
};
in with lib; {
options = {
greg.backup = {
key = mkOption {
type = types.path;
description = "SSH key to use";
default = ./ssh/id_ed25519;
};
jobs = mkOption {
default = {};
type = with types; attrsOf (submodule (
{ name, config, options, ... }:
{
options = {
src = mkOption {
type = types.str;
description = "Local path (string form) to backup from";
};
dest = mkOption {
type = types.str;
};
user = mkOption {
type = types.str;
default = "root";
description = "User to run backup as";
};
pre = mkOption {
type = types.str;
default = "";
description = "Commands to run before backup";
};
post = mkOption {
type = types.str;
default = "";
description = "Commands to run after backup";
};
};
}
));
};
};
};
config = let
jobs = attrValues ( mapAttrs cronJob cfg.jobs );
in mkIf ( ( attrValues cfg.jobs ) != [] )
{
#services.borgbackup = {
# jobs = mapAttrs makeJob cfg.jobs;
#};
services.cron = {
enable = true;
systemCronJobs = map (e: e.cron) jobs;
};
environment.etc = mkIf ( cfg.key != null ) {
"${backup_key}" = {
user = "nobody";
mode = "0777";
source = cfg.key;
};
};
environment.systemPackages = map (e: e.script) jobs;
};
}
+5
View File
@@ -2,9 +2,14 @@
{ {
imports = [ imports = [
./automatic.nix
./backup.nix
./home.nix ./home.nix
./gnome.nix
./linode.nix ./linode.nix
./proxy.nix ./proxy.nix
./rpi4.nix ./rpi4.nix
./tailscale.nix
./xprograms.nix
]; ];
} }
+57
View File
@@ -0,0 +1,57 @@
{ config, pkgs, lib, ... }:
let
cfg = config.greg.gnome;
in with lib; {
options = {
greg.gnome.enable = mkEnableOption "Enable my default Gnome3 setup";
};
config = mkIf cfg.enable {
greg.xprograms.enable = true;
# Sets up a basic Gnome installation
services = {
xserver = {
enable = true;
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
layout = "us";
# Trackpad support
libinput.enable = true;
};
udev.packages = with pkgs; [
gnome3.gnome-settings-daemon
];
pipewire.enable = true;
# Enablement for Firefox
gnome = {
chrome-gnome-shell.enable = true;
sushi.enable = true;
gnome-online-accounts.enable = true;
};
};
programs.dconf.enable = true;
programs.sway.enable = true; # Gives us Wayland
xdg.portal = {
enable = true;
gtkUsePortal = true;
wlr.enable = true; # Enables screen sharing in Wayland
};
# Enable some Gnome plugins that I like
environment.systemPackages = with pkgs; [
gnome3.adwaita-icon-theme
gnome3.gnome-tweaks
gnome3.dconf-editor
gnomeExtensions.appindicator
gnomeExtensions.clipboard-indicator
gnomeExtensions.dash-to-dock
];
};
}
+9
View File
@@ -3,6 +3,8 @@
let let
cfg = config.greg.proxies; cfg = config.greg.proxies;
alias = name: with builtins; head (split "\\." name);
makeHost = name: dest: { makeHost = name: dest: {
forceSSL = dest.ssl; forceSSL = dest.ssl;
enableACME = dest.ssl; enableACME = dest.ssl;
@@ -14,6 +16,7 @@ proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade; proxy_set_header Connection $connection_upgrade;
''; '';
}; };
serverAliases = lib.mkIf dest.genAliases [ "${alias name}" ];
}; };
in with lib; { in with lib; {
@@ -37,6 +40,12 @@ in with lib; {
{ name, config, options, ... }: { name, config, options, ... }:
{ {
options = { options = {
genAliases = mkOption {
type = types.bool;
description = "Whether to auto-generate short alias name";
default = true;
};
target = mkOption { target = mkOption {
type = types.str; type = types.str;
description = ''The destination that is being proxied.''; description = ''The destination that is being proxied.'';
+9
View File
@@ -0,0 +1,9 @@
U2FsdGVkX1+8TBMzBYN9YHgBu1txsCXL0bCxLaGsDMoAaMdkBEdFI1owuEIpM5/E
wJICFzAcEmdFMpX0ZZn4c/jIA7K3Q+p1uxaj+7zcdmzRs08ZxU64yG7LTM47cffJ
W2L1OOFvJPICOs5WmwC/R+4FG6LBIa09W58Xn3OkUEFTe2L2iK73J0ecXuWYjEhN
2y9UvtXr1dHJdXSVY0i7DoPb22JUGuWRRWnT1ThW83xDMs6d83PLD26/BIS/HJiJ
24d0HXuO3nXkkdPX6ocRJmAM0PeMtW+uPG4/HjS6xWaJThBljfvC0I1NRWK7SYR8
+Ret+OXlYhQmSN0M8cGixQKxlrn4iUpawpRnTsug3aSe0Nx30eTw/aRt6WkyeWLS
g/aEnOiaIFSyg780nq5AENQW9/XgvWAb/i9k4AKwKBdyeaAveA/37xoM/6rWToXu
Cql9d4sAF9mEZjSIjXulMQakZHep59MiNclK1WJQQHjQh1DabXS6CEjVD+jJOG9R
cpTkdJ1/Q711jJR7hZK7SNNoo8EH3Vpl5czpJjp+zJE=
+3
View File
@@ -0,0 +1,3 @@
U2FsdGVkX199UgWOiZI4QFCTOsVVEQatJHJFBVDmavrKzuGL+2RX1Fsi1uEafGpz
Fa6UGCWVrUvaT69yxpt3PBtSjkFiZtR9g1A0LzWT3XaUB41/0DJIzAsbK62Ya9UT
A+xICWdf2WVk6n0xeNIvPQ==
+14
View File
@@ -0,0 +1,14 @@
{ lib, config, ... }:
let
cfg = config.greg.tailscale;
in {
options = {
greg.tailscale.enable = lib.mkEnableOption "Enable Tailscale";
};
config = lib.mkIf cfg.enable {
services.tailscale.enable = true;
networking.firewall.checkReversePath = "loose";
};
}
+16
View File
@@ -0,0 +1,16 @@
{ config, lib, pkgs, ... }:
let
cfg = config.greg.xprograms;
in with lib; {
options = {
greg.xprograms.enable = mkEnableOption "Install my favorite XPrograms";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
keepassxc
];
};
}
+15
View File
@@ -0,0 +1,15 @@
self: super:
{
xonsh-direnv = super.callPackage ./xonsh-direnv.nix {
buildPythonPackage = self.python3.pkgs.buildPythonPackage;
fetchPypi = self.python.pkgs.fetchPypi;
};
xonsh = super.xonsh.overridePythonAttrs (old: rec{
propagatedBuildInputs = old.propagatedBuildInputs ++ [ self.xonsh-direnv ];
});
hms = super.callPackage ./hms.nix {
pkgs = self.pkgs;
};
}
-6
View File
@@ -1,6 +0,0 @@
self: super:
{
git = super.git.override {
meta.priority = 4;
};
}
+20
View File
@@ -0,0 +1,20 @@
{ pkgs, ... }:
pkgs.writeShellScriptBin "hms" ''
set -eo pipefail
# Build different targets with GUI or not
if [ -z "$DISPLAY" ]; then
target="nogui"
else
target="gui"
fi
# Build and switch
echo "Building $(uname -m)-$target"
dest=$(mktemp -d)
pushd "$dest" > /dev/null
nix build --impure /etc/nixos#homeConfigurations.$(uname -m)-$target.activationPackage
./result/activate
popd > /dev/null
rm -r "$dest"
''
+20
View File
@@ -0,0 +1,20 @@
{ lib, buildPythonPackage, fetchPypi, pkgs}:
buildPythonPackage rec {
pname = "xonsh-direnv";
version = "1.6.1";
src = fetchPypi {
inherit pname version;
sha256 = "Nt8Da1EtMVWZ9mbBDjys7HDutLYifwoQ1HVmI5CN2Ww=";
};
meta = with lib; {
description = "Direnv support for Xonsh";
homepage = "https://github.com/74th/xonsh-direnv/";
license = licenses.mit;
maintainers = [];
};
doCheck = false;
}
-27
View File
@@ -1,27 +0,0 @@
{ config, pkgs, ... }:
{
# Sets up a basic Gnome installation
services.xserver = {
enable = true;
displayManager = {
gdm.enable = true;
gnome.enable = true;
};
layout = "us";
# Trackpad support
libinput.enable = true;
};
programs.dconf.enable = true;
# Enable some Gnome plugins that I like
environment.systemPackages = with pkgs; [
gnome3.adwaita-icon-theme
gnomeExtensions.appindicator
];
services.udev.packages = with pkgs; [
gnome3.gnome-settings-daemon
];
}
Executable → Regular
+3 -4
View File
@@ -1,6 +1,7 @@
{ config, pkgs, agenix, ... }: { config, pkgs, agenix, ... }:
{ {
<<<<<<<< HEAD:profiles/linux/default.nix
imports = [ imports = [
../shared ../shared
./programs.nix ./programs.nix
@@ -15,6 +16,8 @@
# I am a fan of network manager, myself # I am a fan of network manager, myself
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
========
>>>>>>>> origin/main:modules/automatic/users.nix
# Enable the OpenSSH daemon for remote control # Enable the OpenSSH daemon for remote control
services.openssh.enable = true; services.openssh.enable = true;
#services.openssh.permitRootLogin = "yes"; #services.openssh.permitRootLogin = "yes";
@@ -37,8 +40,4 @@
font = "Lat2-Terminus16"; font = "Lat2-Terminus16";
keyMap = "us"; keyMap = "us";
}; };
# The set of default values, which allow syou to keep system defaults set
# to a predictable value as you upgrade the system
system.stateVersion = "21.11";
} }
+11 -3
View File
@@ -1,22 +1,30 @@
{ pkgs, agenix, ... }: { pkgs, agenix, ... }:
{ let
myPackages = pypackages: with pypackages; [
pkgs.xonsh-direnv
];
myPython = pkgs.python3.withPackages myPackages;
in {
# Base packages that need to be in all my hosts # Base packages that need to be in all my hosts
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
agenix.defaultPackage."${system}" agenix.defaultPackage."${system}"
bitwarden-cli
diffutils diffutils
git git
gnupatch gnupatch
findutils findutils
hms # My own home manager switcher
home-manager home-manager
htop htop
python3 myPython
pwgen pwgen
tmux tmux
transcrypt transcrypt
unzip
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget wget
xonsh
yamllint # Used in vim yamllint # Used in vim
]; ];
} }
+2 -2
View File
@@ -32,13 +32,13 @@ in
addresses = [ addresses = [
"tcp://linode.thehellings.com:22000" "tcp://linode.thehellings.com:22000"
]; ];
id = "3PHWAI5-ILAWGGD-S5FC5QM-M2WQ2FX-PZ3IXQF-QVRKANG-WXAACJC-2MZN3Q5"; id = "ROZPUG5-G4IAXYA-JNRQXRD-5PFU2BQ-WVJTOGZ-DFMGJ5E-Q4IGXCJ-JHSNDQ6";
}; };
}; };
folders = { folders = {
"mkrvy-tc6x9" = { "mkrvy-tc6x9" = {
enable = true;
path = "/home/greg/drive"; path = "/home/greg/drive";
enable = true;
devices = syncs; devices = syncs;
}; };
}; };
+5
View File
@@ -10,7 +10,12 @@
experimental-features = nix-command flakes experimental-features = nix-command flakes
min-free = ${toString (1024 * 1024 * 1024) } min-free = ${toString (1024 * 1024 * 1024) }
max-free = ${toString (5 * 1024 * 1024 * 1024) } max-free = ${toString (5 * 1024 * 1024 * 1024) }
# Used by direnv
keep-outputs = true
keep-derivations = true
''; '';
}; };
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
system.stateVersion = "22.05";
} }