Compare commits
11 Commits
install_fi
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ca1a569013 | ||
![]() |
6578d64b50 | ||
![]() |
22cf52d490 | ||
![]() |
5b276081d1 | ||
![]() |
ff1217c65d | ||
![]() |
9319fc4bc5 | ||
![]() |
b1bea7224f | ||
![]() |
28b61ff95a | ||
![]() |
abf5f81d21 | ||
![]() |
d9150880d3 | ||
![]() |
515e910487 |
@ -53,7 +53,7 @@
|
||||
- javascript
|
||||
- launch_keyboard
|
||||
- lvfs
|
||||
- restaurant_health_rating
|
||||
# - restaurant_health_rating
|
||||
- wasm
|
||||
- noise_suppression
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
name = Tom Alexander
|
||||
signingkey = D3A179C9A53C0EDE
|
||||
[push]
|
||||
default = simple
|
||||
default = simple # (default since 2.0)
|
||||
[alias]
|
||||
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
|
||||
bh = log --oneline --branches=* --remotes=* --graph --decorate
|
||||
@ -12,24 +12,42 @@
|
||||
excludesfile = ~/.gitignore_global
|
||||
[commit]
|
||||
gpgsign = true
|
||||
verbose = true
|
||||
[pull]
|
||||
rebase = true
|
||||
[log]
|
||||
date = local
|
||||
[init]
|
||||
defaultBranch = main
|
||||
|
||||
# Use meld for `git difftool` and `git mergetool`
|
||||
[diff]
|
||||
tool = meld
|
||||
tool = meld # Use meld for `git difftool` and `git mergetool`
|
||||
algorithm = histogram
|
||||
colorMoved = plain
|
||||
mnemonicPrefix = true
|
||||
renames = true
|
||||
[difftool]
|
||||
prompt = false
|
||||
[difftool "meld"]
|
||||
cmd = meld "$LOCAL" "$REMOTE"
|
||||
[merge]
|
||||
tool = meld
|
||||
conflictStyle = zdiff3
|
||||
[mergetool "meld"]
|
||||
# Make the middle pane start with partially-merged contents:
|
||||
cmd = meld "$LOCAL" "$MERGED" "$REMOTE" --output "$MERGED"
|
||||
# Make the middle pane start without any merge progress:
|
||||
# cmd = meld "$LOCAL" "$BASE" "$REMOTE" --output "$MERGED"
|
||||
[column]
|
||||
ui = auto
|
||||
[branch]
|
||||
sort = -committerdate
|
||||
[tag]
|
||||
sort = version:refname
|
||||
[fetch]
|
||||
prune = true
|
||||
pruneTags = true
|
||||
all = true
|
||||
[rebase]
|
||||
autoSquash = true
|
||||
autoStash = true
|
||||
updateRefs = true
|
||||
|
@ -3,7 +3,7 @@
|
||||
name = Tom Alexander
|
||||
signingkey = D3A179C9A53C0EDE
|
||||
[push]
|
||||
default = simple
|
||||
default = simple # (default since 2.0)
|
||||
[alias]
|
||||
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
|
||||
bh = log --oneline --branches=* --remotes=* --graph --decorate
|
||||
@ -12,22 +12,26 @@
|
||||
excludesfile = ~/.gitignore_global
|
||||
[commit]
|
||||
gpgsign = true
|
||||
verbose = true
|
||||
[pull]
|
||||
rebase = true
|
||||
[log]
|
||||
date = local
|
||||
[init]
|
||||
defaultBranch = main
|
||||
|
||||
# Use meld for `git difftool` and `git mergetool`
|
||||
[diff]
|
||||
tool = meld
|
||||
tool = meld # Use meld for `git difftool` and `git mergetool`
|
||||
algorithm = histogram
|
||||
colorMoved = plain
|
||||
mnemonicPrefix = true
|
||||
renames = true
|
||||
[difftool]
|
||||
prompt = false
|
||||
[difftool "meld"]
|
||||
cmd = meld "$LOCAL" "$REMOTE"
|
||||
[merge]
|
||||
tool = meld
|
||||
conflictStyle = zdiff3
|
||||
[mergetool "meld"]
|
||||
# Make the middle pane start with partially-merged contents:
|
||||
cmd = meld "$LOCAL" "$MERGED" "$REMOTE" --output "$MERGED"
|
||||
@ -35,3 +39,17 @@
|
||||
# cmd = meld "$LOCAL" "$BASE" "$REMOTE" --output "$MERGED"
|
||||
[includeIf "gitdir:/bridge/"]
|
||||
path = /bridge/git/machine_setup/ansible/roles/base/files/gitconfig_home
|
||||
[column]
|
||||
ui = auto
|
||||
[branch]
|
||||
sort = -committerdate
|
||||
[tag]
|
||||
sort = version:refname
|
||||
[fetch]
|
||||
prune = true
|
||||
pruneTags = true
|
||||
all = true
|
||||
[rebase]
|
||||
autoSquash = true
|
||||
autoStash = true
|
||||
updateRefs = true
|
||||
|
@ -153,6 +153,7 @@ function start_vm {
|
||||
-D \
|
||||
-c $CPU_CORES \
|
||||
-m $MEMORY \
|
||||
-S \
|
||||
-H \
|
||||
-P \
|
||||
-o 'rtc.use_localtime=false' \
|
||||
|
@ -51,17 +51,27 @@
|
||||
;; Persist history over Emacs restarts. Vertico sorts by history position.
|
||||
(use-package savehist
|
||||
;; This is an emacs built-in but we're pulling the latest version
|
||||
:pin gnu
|
||||
:config
|
||||
(savehist-mode))
|
||||
|
||||
(use-package which-key
|
||||
:pin gnu
|
||||
:diminish
|
||||
:config
|
||||
(which-key-mode))
|
||||
|
||||
(use-package windmove
|
||||
:config
|
||||
(windmove-default-keybindings))
|
||||
;; This is an emacs built-in but we're pulling the latest version
|
||||
:pin gnu
|
||||
:bind
|
||||
(
|
||||
("S-<up>" . windmove-up)
|
||||
("S-<right>" . windmove-right)
|
||||
("S-<down>" . windmove-down)
|
||||
("S-<left>" . windmove-left)
|
||||
)
|
||||
)
|
||||
|
||||
(setq tramp-default-method "ssh")
|
||||
|
||||
|
@ -63,6 +63,9 @@
|
||||
show-trailing-whitespace t
|
||||
;; Remove the line when killing it with ctrl-k
|
||||
kill-whole-line t
|
||||
|
||||
;; Show the current project in the mode line
|
||||
project-mode-line t
|
||||
)
|
||||
|
||||
;; (setq-default fringes-outside-margins t)
|
||||
|
@ -7,14 +7,14 @@
|
||||
:commands nix-mode
|
||||
:hook (
|
||||
(nix-mode . (lambda ()
|
||||
;; (eglot-ensure)
|
||||
;; (defclass my/eglot-nix (eglot-lsp-server) ()
|
||||
;; :documentation
|
||||
;; "Own eglot server class.")
|
||||
(eglot-ensure)
|
||||
(defclass my/eglot-nix (eglot-lsp-server) ()
|
||||
:documentation
|
||||
"Own eglot server class.")
|
||||
|
||||
;; (add-to-list 'eglot-server-programs
|
||||
;; '(nix-mode . (my/eglot-nix "nixd")))
|
||||
;; (add-hook 'before-save-hook 'eglot-format-buffer nil 'local)
|
||||
(add-to-list 'eglot-server-programs
|
||||
'(nix-mode . (my/eglot-nix "nixd")))
|
||||
(add-hook 'before-save-hook 'eglot-format-buffer nil 'local)
|
||||
))
|
||||
)
|
||||
)
|
||||
|
@ -1,16 +1,23 @@
|
||||
(use-package org
|
||||
:ensure nil
|
||||
:commands org-mode
|
||||
:bind (
|
||||
:bind (:map org-mode-map
|
||||
("C-c l" . org-store-link)
|
||||
("C-c a" . org-agenda)
|
||||
("C--" . org-timestamp-down)
|
||||
("C-=" . org-timestamp-up)
|
||||
("S-<up>" . org-shiftup)
|
||||
("S-<right>" . org-shiftright)
|
||||
("S-<down>" . org-shiftdown)
|
||||
("S-<left>" . org-shiftleft)
|
||||
)
|
||||
:hook (
|
||||
(org-mode . (lambda ()
|
||||
(org-indent-mode +1)
|
||||
))
|
||||
;; Make windmove work in Org mode:
|
||||
(org-shiftup-final . windmove-up)
|
||||
(org-shiftleft-final . windmove-left)
|
||||
(org-shiftdown-final . windmove-down)
|
||||
(org-shiftright-final . windmove-right)
|
||||
)
|
||||
:config
|
||||
(require 'org-tempo)
|
||||
@ -38,6 +45,8 @@
|
||||
|
||||
;; TODO: There is an option to set the compiler, could be better than manually doing this here https://orgmode.org/manual/LaTeX_002fPDF-export-commands.html
|
||||
;; (setq org-latex-compiler "lualatex")
|
||||
;; TODO: nixos latex page recommends this line, figure out what it does / why its needed:
|
||||
;; (setq org-preview-latex-default-process 'dvisvgm)
|
||||
(setq org-latex-pdf-process
|
||||
'("lualatex -shell-escape -interaction nonstopmode -output-directory %o %f"
|
||||
"lualatex -shell-escape -interaction nonstopmode -output-directory %o %f"
|
||||
|
@ -4,6 +4,8 @@
|
||||
:commands (treesit-install-language-grammar treesit-ready-p)
|
||||
:init
|
||||
(setq treesit-language-source-alist '())
|
||||
:custom
|
||||
(treesit-max-buffer-size 209715200) ;; 200MiB
|
||||
:config
|
||||
;; Default to the max level of detail in treesitter highlighting. This
|
||||
;; can be overridden in each language's use-package call with:
|
||||
|
@ -38,4 +38,6 @@
|
||||
|
||||
(require 'lang-nix)
|
||||
|
||||
(require 'lang-cmake)
|
||||
|
||||
(load-directory autoload-directory)
|
||||
|
@ -47,6 +47,9 @@ rdr pass proto {tcp, udp} from $jail_nat_v4 to ($ext_if) port 65099 tag REDIRINT
|
||||
rdr pass proto {tcp, udp} from $not_jail_nat_v4 to ($ext_if) port 53 -> 10.215.1.211 port 53
|
||||
rdr pass proto {tcp, udp} from $jail_nat_v4 to ($ext_if) port 53 tag REDIRINTERNAL -> 10.215.1.211 port 53
|
||||
|
||||
rdr pass proto {tcp, udp} from $not_jail_nat_v4 to ($ext_if) port 65122 -> 10.215.1.219 port 22
|
||||
rdr pass proto {tcp, udp} from $jail_nat_v4 to ($ext_if) port 65122 tag REDIRINTERNAL -> 10.215.1.219 port 22
|
||||
|
||||
nat pass tagged REDIRINTERNAL -> (jail_nat)
|
||||
nat pass tagged REDIREXTERNAL -> ($ext_if)
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
- name: Configure kernel command line
|
||||
zfs:
|
||||
name: "zroot/linux"
|
||||
name: "zroot/linux/archwork/be"
|
||||
state: present
|
||||
extra_zfs_properties:
|
||||
# amdgpu.abmlevel=3 :: Automatically reduce screen brightness but tweak colors to compensate for power reduction.
|
||||
|
@ -26,7 +26,7 @@ function by_src {
|
||||
}
|
||||
|
||||
function by_bin {
|
||||
DESTRELEASE=13.2-RELEASE
|
||||
DESTRELEASE=14.1-RELEASE
|
||||
DESTARCH=`uname -m`
|
||||
SOURCEURL=http://ftp.freebsd.org/pub/FreeBSD/releases/$DESTARCH/$DESTRELEASE/
|
||||
for component in base ports; do fetch $SOURCEURL/$component.txz -o - | tar -xf - -C "$DESTDIR" ; done
|
||||
|
@ -94,7 +94,18 @@
|
||||
// momlaptop - hard-coded in rc.conf, reproduced here to reserve ip
|
||||
"hw-address": "06:85:69:c5:6a:d6",
|
||||
"ip-address": "10.215.1.218"
|
||||
},
|
||||
{
|
||||
// hydra
|
||||
"hw-address": "06:84:36:68:03:77",
|
||||
"ip-address": "10.215.1.219"
|
||||
},
|
||||
{
|
||||
// certificate - hard-coded in rc.conf, reproduced here to reserve ip
|
||||
"hw-address": "06:7b:e0:08:16:5d",
|
||||
"ip-address": "10.215.1.220"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -1,3 +1,7 @@
|
||||
profile office {
|
||||
output eDP-1 disable
|
||||
output "Dell Inc. DELL C2722DE 6PH6T83" enable
|
||||
}
|
||||
profile docked {
|
||||
output eDP-1 disable
|
||||
output "Dell Inc. DELL U3014 P1V6N35M329L" enable
|
||||
|
@ -81,12 +81,6 @@ Include = /etc/pacman.d/mirrorlist
|
||||
[extra]
|
||||
Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
#[community-testing]
|
||||
#Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
[community]
|
||||
Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
# If you want to run 32 bit applications on your x86_64 system,
|
||||
# enable the multilib repositories as required here.
|
||||
|
||||
|
@ -23,6 +23,9 @@ $ORIGIN fizz.buzz.
|
||||
; Allows receivers to know you send your mail via Fastmail, and other servers
|
||||
IN TXT v=spf1 include:spf.messagingengine.com ?all
|
||||
|
||||
; Tell receivers what to do with fake email
|
||||
_dmarc IN TXT "v=DMARC1; p=none; rua=mailto:postmaster@fizz.buzz;"
|
||||
|
||||
ns1 IN A 74.80.180.138
|
||||
ns2 IN A 74.80.180.138
|
||||
|
||||
|
@ -64,23 +64,6 @@
|
||||
# force: true
|
||||
# diff: false
|
||||
|
||||
- name: Create directories
|
||||
file:
|
||||
name: "{{ item }}"
|
||||
state: directory
|
||||
mode: 0700
|
||||
owner: nochainstounlock
|
||||
group: nochainstounlock
|
||||
loop:
|
||||
- /home/nochainstounlock/.ssh
|
||||
|
||||
- name: Set authorized keys
|
||||
authorized_key:
|
||||
user: nochainstounlock
|
||||
key: |
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMrjXsXjtxEm47XnRZfo67kJULoc0NBLrB0lPYFiS2Ar kodi@neelix
|
||||
exclusive: true
|
||||
|
||||
- import_tasks: tasks/freebsd.yaml
|
||||
when: 'os_flavor == "freebsd"'
|
||||
|
||||
|
@ -23,6 +23,7 @@ set $menu wofi --show drun --gtk-dark
|
||||
|
||||
# Do not show a title bar on windows
|
||||
default_border pixel 2
|
||||
hide_edge_borders smart_no_gaps
|
||||
|
||||
bindsym $mod+grave exec $term
|
||||
|
||||
|
@ -5,6 +5,6 @@ set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
makoctl set-mode do-not-disturb
|
||||
makoctl mode -s do-not-disturb
|
||||
|
||||
swaymsg output "'Dell Inc. DELL U3014 P1V6N35M329L'" scale 2
|
||||
|
@ -5,6 +5,6 @@ set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
makoctl set-mode default
|
||||
makoctl mode -s default
|
||||
|
||||
swaymsg output "'Dell Inc. DELL U3014 P1V6N35M329L'" scale 1
|
||||
|
@ -18,6 +18,7 @@
|
||||
"workbench.editor.showTabs": "none",
|
||||
"workbench.activityBar.location": "hidden",
|
||||
"window.menuBarVisibility": "toggle",
|
||||
"window.commandCenter": false,
|
||||
"explorer.autoReveal": false,
|
||||
"[python]": {
|
||||
"editor.defaultFormatter": "ms-python.black-formatter",
|
||||
@ -31,6 +32,10 @@
|
||||
"editor.defaultFormatter": "hashicorp.terraform",
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"black-formatter.importStrategy": "fromEnvironment",
|
||||
"workbench.statusBar.visible": false,
|
||||
"git.openRepositoryInParentFolders": "never",
|
||||
|
@ -1,8 +1,8 @@
|
||||
- name: Install packages
|
||||
package:
|
||||
name:
|
||||
# - linux-lts-headers
|
||||
- linux-headers
|
||||
- linux-lts-headers
|
||||
# - linux-headers
|
||||
state: present
|
||||
|
||||
- name: Check trusted gpg keys
|
||||
@ -27,7 +27,8 @@
|
||||
args:
|
||||
creates: "/var/cache/pacman/custom/{{ item }}-*.pkg.tar.*"
|
||||
loop:
|
||||
- zfs-dkms-git
|
||||
# - zfs-dkms-git
|
||||
- zfs-dkms
|
||||
- zfs-utils
|
||||
|
||||
- name: Update cache
|
||||
@ -40,7 +41,8 @@
|
||||
- name: Install packages
|
||||
package:
|
||||
name:
|
||||
- zfs-dkms-git
|
||||
# - zfs-dkms-git
|
||||
- zfs-dkms
|
||||
- zfs-utils
|
||||
state: present
|
||||
|
||||
|
1
nix/configuration/.gitignore
vendored
1
nix/configuration/.gitignore
vendored
@ -1 +0,0 @@
|
||||
result
|
@ -1,291 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
home-manager,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./roles/2ship2harkinian
|
||||
./roles/alacritty
|
||||
./roles/ansible
|
||||
./roles/ares
|
||||
./roles/bluetooth
|
||||
./roles/boot
|
||||
./roles/chromecast
|
||||
./roles/chromium
|
||||
./roles/distributed_build
|
||||
./roles/docker
|
||||
./roles/ecc
|
||||
./roles/emacs
|
||||
./roles/firefox
|
||||
./roles/firewall
|
||||
./roles/flux
|
||||
./roles/fonts
|
||||
./roles/gcloud
|
||||
./roles/git
|
||||
./roles/global_options
|
||||
./roles/gnuplot
|
||||
./roles/gpg
|
||||
./roles/graphics
|
||||
./roles/hydra
|
||||
./roles/iso
|
||||
./roles/iso_mount
|
||||
./roles/kanshi
|
||||
./roles/kodi
|
||||
./roles/kubernetes
|
||||
./roles/latex
|
||||
./roles/launch_keyboard
|
||||
./roles/lvfs
|
||||
./roles/media
|
||||
./roles/memtest86
|
||||
./roles/network
|
||||
./roles/nix_index
|
||||
./roles/nix_worker
|
||||
./roles/nvme
|
||||
./roles/optimized_build
|
||||
./roles/pcsx2
|
||||
./roles/python
|
||||
./roles/qemu
|
||||
./roles/reset
|
||||
./roles/rpcs3
|
||||
./roles/rust
|
||||
./roles/shikane
|
||||
./roles/shipwright
|
||||
./roles/sm64ex
|
||||
./roles/sops
|
||||
./roles/sound
|
||||
./roles/ssh
|
||||
./roles/steam
|
||||
./roles/steam_run_free
|
||||
./roles/sway
|
||||
./roles/tekton
|
||||
./roles/terraform
|
||||
./roles/thunderbolt
|
||||
./roles/vnc_client
|
||||
./roles/vscode
|
||||
./roles/wasm
|
||||
./roles/waybar
|
||||
./roles/wireguard
|
||||
./roles/zfs
|
||||
./roles/zrepl
|
||||
./roles/zsh
|
||||
./util/install_files
|
||||
./util/unfree_polyfill
|
||||
];
|
||||
|
||||
me.install.user.talexander.file."/home/talexander/flake.nix" = {
|
||||
source = ./flake.nix;
|
||||
};
|
||||
|
||||
nix.settings.experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
nix.settings.trusted-users = [ "@wheel" ];
|
||||
|
||||
# boot.kernelPackages = pkgs.linuxPackages_6_11;
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
|
||||
# Use nixos-rebuild-ng
|
||||
# system.rebuild.enableNg = true;
|
||||
|
||||
# Keep outputs so we can build offline.
|
||||
nix.extraOptions = ''
|
||||
keep-outputs = true
|
||||
keep-derivations = true
|
||||
'';
|
||||
|
||||
# Technically only needed when building the ISO because nix detects ZFS in the filesystem list normally. I basically always want this so I'm just setting it to always be on.
|
||||
boot.supportedFilesystems.zfs = true;
|
||||
# TODO: Is this different from boot.supportedFilesystems = [ "zfs" ]; ?
|
||||
|
||||
services.getty = {
|
||||
autologinUser = "talexander"; # I use full disk encryption so the user password is irrelevant.
|
||||
autologinOnce = true;
|
||||
};
|
||||
users.mutableUsers = false;
|
||||
users.users.talexander = {
|
||||
isNormalUser = true;
|
||||
createHome = true; # https://github.com/NixOS/nixpkgs/issues/6481
|
||||
group = "talexander";
|
||||
extraGroups = [ "wheel" ];
|
||||
uid = 11235;
|
||||
packages = with pkgs; [
|
||||
tree
|
||||
];
|
||||
# Generate with `mkpasswd -m scrypt`
|
||||
hashedPassword = "$7$CU..../....VXvNQ8za3wSGpdzGXNT50/$HcFtn/yvwPMCw4888BelpiAPLAxe/zU87fD.d/N6U48";
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGu+k5lrirokdW5zVdRVBOqEOAvAPlIkG/MdJNc9g5ky"
|
||||
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIEI6mu6I5Jp+Ib0vJxapGHbEShZjyvzV8jz5DnzDrI39AAAABHNzaDo="
|
||||
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIAFNcSXwvy+brYTOGo56G93Ptuq2MmZsjvRWAfMqbmMLAAAABHNzaDo="
|
||||
];
|
||||
};
|
||||
users.groups.talexander.gid = 11235;
|
||||
home-manager.users.talexander =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
# The state version is required and should stay at the version you
|
||||
# originally installed.
|
||||
home.stateVersion = "24.11";
|
||||
};
|
||||
|
||||
home-manager.users.root =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
# The state version is required and should stay at the version you
|
||||
# originally installed.
|
||||
home.stateVersion = "24.11";
|
||||
};
|
||||
|
||||
# Automatic garbage collection
|
||||
nix.gc = lib.mkIf (!config.me.buildingIso) {
|
||||
# Runs nix-collect-garbage --delete-older-than 5d
|
||||
automatic = true;
|
||||
randomizedDelaySec = "14m";
|
||||
options = "--delete-older-than 30d";
|
||||
};
|
||||
nix.settings.auto-optimise-store = !config.me.buildingIso;
|
||||
|
||||
# Use doas instead of sudo
|
||||
security.doas.enable = true;
|
||||
security.doas.wheelNeedsPassword = false;
|
||||
security.sudo.enable = false;
|
||||
security.doas.extraRules = [
|
||||
{
|
||||
# Retain environment (for example NIX_PATH)
|
||||
keepEnv = true;
|
||||
persist = true; # Only ask for a password the first time.
|
||||
}
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
wget
|
||||
mg
|
||||
rsync
|
||||
libinput
|
||||
htop
|
||||
tmux
|
||||
file
|
||||
usbutils # for lsusb
|
||||
pciutils # for lspci
|
||||
ripgrep
|
||||
strace
|
||||
ltrace
|
||||
trace-cmd # ftrace
|
||||
tcpdump
|
||||
git-crypt
|
||||
gnumake
|
||||
ncdu
|
||||
nix-tree
|
||||
libarchive # bsdtar
|
||||
lsof
|
||||
doas-sudo-shim # To support --use-remote-sudo for remote builds
|
||||
dmidecode # Read SMBIOS information.
|
||||
ipcalc
|
||||
gptfdisk # for cgdisk
|
||||
nix-output-monitor # For better view into nixos-rebuild
|
||||
nix-serve-ng # Serve nix store over http
|
||||
];
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
PasswordAuthentication = false;
|
||||
KbdInteractiveAuthentication = false;
|
||||
};
|
||||
hostKeys = [
|
||||
{
|
||||
path = "/persist/ssh/ssh_host_ed25519_key";
|
||||
type = "ed25519";
|
||||
}
|
||||
{
|
||||
path = "/persist/ssh/ssh_host_rsa_key";
|
||||
type = "rsa";
|
||||
bits = 4096;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||
hideMounts = true;
|
||||
directories = [
|
||||
"/var/lib/iwd" # Wifi settings
|
||||
"/var/lib/nixos" # Contains user information (uids/gids)
|
||||
"/var/lib/systemd" # Systemd state directory for random seed, persistent timers, core dumps, persist hardware state like backlight and rfkill
|
||||
"/var/log/journal" # Logs, alternatively set `services.journald.storage = "volatile";` to write to /run/log/journal
|
||||
];
|
||||
files = [
|
||||
"/etc/machine-id" # Systemd unique machine id "otherwise, the system journal may fail to list earlier boots, etc"
|
||||
"/etc/ssh/ssh_host_rsa_key"
|
||||
"/etc/ssh/ssh_host_rsa_key.pub"
|
||||
"/etc/ssh/ssh_host_ed25519_key"
|
||||
"/etc/ssh/ssh_host_ed25519_key.pub"
|
||||
];
|
||||
users.talexander = {
|
||||
directories = [
|
||||
{
|
||||
directory = "persist";
|
||||
user = "talexander";
|
||||
group = "talexander";
|
||||
mode = "0700";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Write a list of the currently installed packages to /etc/current-system-packages
|
||||
environment.etc."current-system-packages".text =
|
||||
let
|
||||
packages = builtins.map (p: "${p.name}") config.environment.systemPackages;
|
||||
sortedUnique = builtins.sort builtins.lessThan (lib.unique packages);
|
||||
formatted = builtins.concatStringsSep "\n" sortedUnique;
|
||||
in
|
||||
formatted;
|
||||
|
||||
# environment.etc."system-packages-with-source".text = builtins.concatStringsSep "\n\n" (
|
||||
# builtins.map (
|
||||
# x: x.file + "\n" + builtins.concatStringsSep "\n" (builtins.map (s: " " + s) x.value)
|
||||
# ) config.environment.systemPackages.definitionsWithLocations
|
||||
# );
|
||||
|
||||
# nixpkgs.overlays = [
|
||||
# (final: prev: {
|
||||
# nix = pkgs-unstable.nix;
|
||||
# })
|
||||
# ];
|
||||
|
||||
# nixpkgs.overlays = [
|
||||
# (final: prev: {
|
||||
# foot = throw "foo";
|
||||
# })
|
||||
# ];
|
||||
|
||||
# Copy the NixOS configuration file and link it from the resulting system
|
||||
# (/run/current-system/configuration.nix). This is useful in case you
|
||||
# accidentally delete configuration.nix.
|
||||
# system.copySystemConfiguration = true;
|
||||
|
||||
# This option defines the first version of NixOS you have installed on this particular machine,
|
||||
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
|
||||
#
|
||||
# Most users should NEVER change this value after the initial install, for any reason,
|
||||
# even if you've upgraded your system to a new NixOS release.
|
||||
#
|
||||
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
|
||||
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
|
||||
# to actually do that.
|
||||
#
|
||||
# This value being lower than the current NixOS release does NOT mean your system is
|
||||
# out of date, out of support, or vulnerable.
|
||||
#
|
||||
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
|
||||
# and migrated your data accordingly.
|
||||
#
|
||||
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
|
||||
system.stateVersion = "24.11"; # Did you read the comment?
|
||||
|
||||
}
|
386
nix/configuration/flake.lock
generated
386
nix/configuration/flake.lock
generated
@ -1,386 +0,0 @@
|
||||
{
|
||||
"nodes": {
|
||||
"ansible-sshjail": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"path": "flakes/ansible-sshjail",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"path": "flakes/ansible-sshjail",
|
||||
"type": "path"
|
||||
},
|
||||
"parent": []
|
||||
},
|
||||
"crane": {
|
||||
"locked": {
|
||||
"lastModified": 1731098351,
|
||||
"narHash": "sha256-HQkYvKvaLQqNa10KEFGgWHfMAbWBfFp+4cAgkut+NNE=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "ef80ead953c1b28316cc3f8613904edc2eb90c28",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"disko": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1746729224,
|
||||
"narHash": "sha256-9R4sOLAK1w3Bq54H3XOJogdc7a6C2bLLmatOQ+5pf5w=",
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"rev": "85555d27ded84604ad6657ecca255a03fd878607",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
"lanzaboote",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1730504689,
|
||||
"narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "506278e768c2a08bec68eb62932193e341f55c90",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"lanzaboote",
|
||||
"pre-commit-hooks-nix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709087332,
|
||||
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1746981801,
|
||||
"narHash": "sha256-+Bfr0KqZV6gZdA7e2kupeoawozaLIHLuiPtC54uxbFc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "ff915842e4a2e63c4c8c5c08c6870b9d5b3c3ee9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"impermanence": {
|
||||
"locked": {
|
||||
"lastModified": 1737831083,
|
||||
"narHash": "sha256-LJggUHbpyeDvNagTUrdhe/pRVp4pnS6wVKALS782gRI=",
|
||||
"owner": "nix-community",
|
||||
"repo": "impermanence",
|
||||
"rev": "4b3e914cdf97a5b536a889e939fb2fd2b043a170",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "impermanence",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"lanzaboote": {
|
||||
"inputs": {
|
||||
"crane": "crane",
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"pre-commit-hooks-nix": "pre-commit-hooks-nix",
|
||||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1737639419,
|
||||
"narHash": "sha256-AEEDktApTEZ5PZXNDkry2YV2k6t0dTgLPEmAZbnigXU=",
|
||||
"owner": "nix-community",
|
||||
"repo": "lanzaboote",
|
||||
"rev": "a65905a09e2c43ff63be8c0e86a93712361f871e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "v0.4.2",
|
||||
"repo": "lanzaboote",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1746663147,
|
||||
"narHash": "sha256-Ua0drDHawlzNqJnclTJGf87dBmaO/tn7iZ+TCkTRpRc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "dda3dcd3fe03e991015e9a74b22d35950f264a54",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-b93b4e9b5": {
|
||||
"locked": {
|
||||
"lastModified": 1713721570,
|
||||
"narHash": "sha256-R0s+O5UjTePQRb72XPgtkTmEiOOW8n+1q9Gxt/OJnKU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b93b4e9b527904aadf52dba6ca35efde2067cbd4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b93b4e9b527904aadf52dba6ca35efde2067cbd4",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1730741070,
|
||||
"narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d063c1dd113c91ab27959ba540c0d9753409edf3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-24.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unoptimized": {
|
||||
"locked": {
|
||||
"lastModified": 1746663147,
|
||||
"narHash": "sha256-Ua0drDHawlzNqJnclTJGf87dBmaO/tn7iZ+TCkTRpRc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "dda3dcd3fe03e991015e9a74b22d35950f264a54",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks-nix": {
|
||||
"inputs": {
|
||||
"flake-compat": [
|
||||
"lanzaboote",
|
||||
"flake-compat"
|
||||
],
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"lanzaboote",
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731363552,
|
||||
"narHash": "sha256-vFta1uHnD29VUY4HJOO/D6p6rxyObnf+InnSMT4jlMU=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "cd1af27aa85026ac759d5d3fccf650abe7e1bbf0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"ansible-sshjail": "ansible-sshjail",
|
||||
"disko": "disko",
|
||||
"home-manager": "home-manager",
|
||||
"impermanence": "impermanence",
|
||||
"lanzaboote": "lanzaboote",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-b93b4e9b5": "nixpkgs-b93b4e9b5",
|
||||
"nixpkgs-unoptimized": "nixpkgs-unoptimized",
|
||||
"zsh-histdb": "zsh-histdb"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"lanzaboote",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731897198,
|
||||
"narHash": "sha256-Ou7vLETSKwmE/HRQz4cImXXJBr/k9gp4J4z/PF8LzTE=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "0be641045af6d8666c11c2c40e45ffc9667839b5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"zsh-histdb": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"path": "flakes/zsh-histdb",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"path": "flakes/zsh-histdb",
|
||||
"type": "path"
|
||||
},
|
||||
"parent": []
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
@ -1,272 +0,0 @@
|
||||
# Build ISO image
|
||||
# nix build --extra-experimental-features nix-command --extra-experimental-features flakes .#iso.odo
|
||||
# output: result/iso/nixos.iso
|
||||
|
||||
# Run the ISO image
|
||||
# doas "$(nix-build '<nixpkgs>' --no-out-link -A 'qemu')/bin/qemu-system-x86_64" \
|
||||
# -accel kvm \
|
||||
# -cpu host \
|
||||
# -smp cores=8 \
|
||||
# -m 32768 \
|
||||
# -drive "file=$(nix-build '<nixpkgs>' --no-out-link -A 'OVMF.fd')/FV/OVMF.fd,if=pflash,format=raw,readonly=on" \
|
||||
# -drive if=pflash,format=raw,file="/tmp/OVMF_VARS.fd" \
|
||||
# -nic user,hostfwd=tcp::60022-:22 \
|
||||
# -boot order=d \
|
||||
# -cdrom "$(readlink -f ./result/iso/nixos*.iso)" \
|
||||
# -display vnc=127.0.0.1:0
|
||||
#
|
||||
# doas cp "$(nix-build '<nixpkgs>' --no-out-link -A 'OVMF.fd')/FV/OVMF_VARS.fd" /tmp/OVMF_VARS.fd
|
||||
# doas "$(nix-build '<nixpkgs>' --no-out-link -A 'qemu')/bin/qemu-system-x86_64" -accel kvm -cpu host -smp cores=8 -m 32768 -drive "file=$(nix-build '<nixpkgs>' --no-out-link -A 'OVMF.fd')/FV/OVMF.fd,if=pflash,format=raw,readonly=on" -drive if=pflash,format=raw,file="/tmp/OVMF_VARS.fd" -nic user,hostfwd=tcp::60022-:22 -boot order=d -cdrom /persist/machine_setup/nix/configuration/result/iso/nixos*.iso -display vnc=127.0.0.1:0
|
||||
|
||||
# Get a repl for this flake
|
||||
# nix repl --expr "builtins.getFlake \"$PWD\""
|
||||
|
||||
# TODO maybe use `nix eval --raw .#iso.odo.outPath`
|
||||
# iso.odo.isoName == "nixos.iso"
|
||||
# full path = <outPath> / iso / <isoName>
|
||||
|
||||
#
|
||||
# Install on a new machine:
|
||||
#
|
||||
#
|
||||
# doas nix --substituters "http://10.0.2.2:8080?trusted=1 https://cache.nixos.org/" --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode destroy,format,mount hosts/odo/disk-config.nix
|
||||
|
||||
# nix flake update zsh-histdb --flake .
|
||||
# nix flake update ansible-sshjail --flake .
|
||||
# for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
# nixos-install --substituters "http://10.0.2.2:8080?trusted=1 https://cache.nixos.org/" --flake ".#vm_ionlybootzfs"
|
||||
#
|
||||
|
||||
{
|
||||
description = "My system configuration";
|
||||
|
||||
inputs = {
|
||||
impermanence.url = "github:nix-community/impermanence";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs-b93b4e9b5.url = "github:NixOS/nixpkgs/b93b4e9b527904aadf52dba6ca35efde2067cbd4";
|
||||
nixpkgs-unoptimized.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
lanzaboote = {
|
||||
url = "github:nix-community/lanzaboote/v0.4.2";
|
||||
|
||||
# Optional but recommended to limit the size of your system closure.
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
zsh-histdb = {
|
||||
url = "path:flakes/zsh-histdb";
|
||||
|
||||
# Optional but recommended to limit the size of your system closure.
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
ansible-sshjail = {
|
||||
url = "path:flakes/ansible-sshjail";
|
||||
|
||||
# Optional but recommended to limit the size of your system closure.
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
disko = {
|
||||
url = "github:nix-community/disko";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
nixpkgs-unoptimized,
|
||||
nixpkgs-b93b4e9b5,
|
||||
impermanence,
|
||||
home-manager,
|
||||
lanzaboote,
|
||||
zsh-histdb,
|
||||
ansible-sshjail,
|
||||
...
|
||||
}@inputs:
|
||||
let
|
||||
base_x86_64_linux = rec {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = {
|
||||
pkgs-b93b4e9b5 = import nixpkgs-b93b4e9b5 {
|
||||
inherit system;
|
||||
};
|
||||
pkgs-unoptimized = import nixpkgs-unoptimized {
|
||||
inherit system;
|
||||
hostPlatform.gcc.arch = "default";
|
||||
hostPlatform.gcc.tune = "default";
|
||||
};
|
||||
};
|
||||
modules = [
|
||||
impermanence.nixosModules.impermanence
|
||||
home-manager.nixosModules.home-manager
|
||||
lanzaboote.nixosModules.lanzaboote
|
||||
inputs.disko.nixosModules.disko
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
}
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
zsh-histdb.overlays.default
|
||||
ansible-sshjail.overlays.default
|
||||
];
|
||||
}
|
||||
./configuration.nix
|
||||
];
|
||||
};
|
||||
systems =
|
||||
let
|
||||
additional_iso_modules = [
|
||||
(nixpkgs + "/nixos/modules/installer/cd-dvd/iso-image.nix")
|
||||
# TODO: Figure out how to do image based appliances
|
||||
# (nixpkgs + "/nixos/modules/profiles/image-based-appliance.nix")
|
||||
{
|
||||
isoImage.makeEfiBootable = true;
|
||||
isoImage.makeUsbBootable = true;
|
||||
me.buildingIso = true;
|
||||
me.optimizations.enable = nixpkgs.lib.mkForce false;
|
||||
}
|
||||
{
|
||||
# These are big space hogs. The chance that I need them on an ISO is slim.
|
||||
me.steam.enable = nixpkgs.lib.mkForce false;
|
||||
me.pcsx2.enable = nixpkgs.lib.mkForce false;
|
||||
}
|
||||
];
|
||||
additional_vm_modules = [
|
||||
(nixpkgs + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
{
|
||||
networking.dhcpcd.enable = true;
|
||||
networking.useDHCP = true;
|
||||
me.optimizations.enable = nixpkgs.lib.mkForce false;
|
||||
}
|
||||
{
|
||||
# I don't need games on a virtual machine.
|
||||
me.steam.enable = nixpkgs.lib.mkForce false;
|
||||
me.pcsx2.enable = nixpkgs.lib.mkForce false;
|
||||
me.sm64ex.enable = nixpkgs.lib.mkForce false;
|
||||
me.shipwright.enable = nixpkgs.lib.mkForce false;
|
||||
me.ship2harkinian.enable = nixpkgs.lib.mkForce false;
|
||||
}
|
||||
];
|
||||
in
|
||||
{
|
||||
odo = rec {
|
||||
main = base_x86_64_linux // {
|
||||
modules = base_x86_64_linux.modules ++ [
|
||||
./hosts/odo
|
||||
];
|
||||
};
|
||||
iso = main // {
|
||||
modules = main.modules ++ additional_iso_modules;
|
||||
};
|
||||
vm = main // {
|
||||
modules = main.modules ++ additional_vm_modules;
|
||||
};
|
||||
vm_iso = main // {
|
||||
modules = main.modules ++ additional_vm_modules ++ additional_iso_modules;
|
||||
};
|
||||
};
|
||||
quark = rec {
|
||||
main = base_x86_64_linux // {
|
||||
modules = base_x86_64_linux.modules ++ [
|
||||
./hosts/quark
|
||||
];
|
||||
};
|
||||
iso = main // {
|
||||
modules = main.modules ++ additional_iso_modules;
|
||||
};
|
||||
vm = main // {
|
||||
modules = main.modules ++ additional_vm_modules;
|
||||
};
|
||||
vm_iso = main // {
|
||||
modules = main.modules ++ additional_vm_modules ++ additional_iso_modules;
|
||||
};
|
||||
};
|
||||
neelix = rec {
|
||||
main = base_x86_64_linux // {
|
||||
modules = base_x86_64_linux.modules ++ [
|
||||
./hosts/neelix
|
||||
];
|
||||
};
|
||||
iso = main // {
|
||||
modules = main.modules ++ additional_iso_modules;
|
||||
};
|
||||
vm = main // {
|
||||
modules = main.modules ++ additional_vm_modules;
|
||||
};
|
||||
vm_iso = main // {
|
||||
modules = main.modules ++ additional_vm_modules ++ additional_iso_modules;
|
||||
};
|
||||
};
|
||||
hydra =
|
||||
let
|
||||
additional_iso_modules = additional_iso_modules ++ [
|
||||
{
|
||||
me.optimizations.enable = true;
|
||||
}
|
||||
];
|
||||
in
|
||||
rec {
|
||||
main = base_x86_64_linux // {
|
||||
modules = base_x86_64_linux.modules ++ [
|
||||
./hosts/hydra
|
||||
];
|
||||
};
|
||||
iso = main // {
|
||||
modules = main.modules ++ additional_iso_modules;
|
||||
};
|
||||
vm = main // {
|
||||
modules = main.modules ++ additional_vm_modules;
|
||||
};
|
||||
vm_iso = main // {
|
||||
modules = main.modules ++ additional_vm_modules ++ additional_iso_modules;
|
||||
};
|
||||
};
|
||||
ionlybootzfs = rec {
|
||||
main = base_x86_64_linux // {
|
||||
modules = base_x86_64_linux.modules ++ [
|
||||
./hosts/ionlybootzfs
|
||||
];
|
||||
};
|
||||
iso = main // {
|
||||
modules = main.modules ++ additional_iso_modules;
|
||||
};
|
||||
vm = main // {
|
||||
modules = main.modules ++ additional_vm_modules;
|
||||
};
|
||||
vm_iso = main // {
|
||||
modules = main.modules ++ additional_vm_modules ++ additional_iso_modules;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
in
|
||||
{
|
||||
nixosConfigurations.odo = nixpkgs.lib.nixosSystem systems.odo.main;
|
||||
iso.odo = (nixpkgs.lib.nixosSystem systems.odo.iso).config.system.build.isoImage;
|
||||
nixosConfigurations.vm_odo = nixpkgs.lib.nixosSystem systems.odo.vm;
|
||||
vm_iso.odo = (nixpkgs.lib.nixosSystem systems.odo.vm_iso).config.system.build.isoImage;
|
||||
|
||||
nixosConfigurations.quark = nixpkgs.lib.nixosSystem systems.quark.main;
|
||||
iso.quark = (nixpkgs.lib.nixosSystem systems.quark.iso).config.system.build.isoImage;
|
||||
nixosConfigurations.vm_quark = nixpkgs.lib.nixosSystem systems.quark.vm;
|
||||
vm_iso.quark = (nixpkgs.lib.nixosSystem systems.quark.vm_iso).config.system.build.isoImage;
|
||||
|
||||
nixosConfigurations.neelix = nixpkgs.lib.nixosSystem systems.neelix.main;
|
||||
iso.neelix = (nixpkgs.lib.nixosSystem systems.neelix.iso).config.system.build.isoImage;
|
||||
nixosConfigurations.vm_neelix = nixpkgs.lib.nixosSystem systems.neelix.vm;
|
||||
vm_iso.neelix = (nixpkgs.lib.nixosSystem systems.neelix.vm_iso).config.system.build.isoImage;
|
||||
|
||||
nixosConfigurations.hydra = nixpkgs.lib.nixosSystem systems.hydra.main;
|
||||
iso.hydra = (nixpkgs.lib.nixosSystem systems.hydra.iso).config.system.build.isoImage;
|
||||
nixosConfigurations.vm_hydra = nixpkgs.lib.nixosSystem systems.hydra.vm;
|
||||
vm_iso.hydra = (nixpkgs.lib.nixosSystem systems.hydra.vm_iso).config.system.build.isoImage;
|
||||
|
||||
nixosConfigurations.ionlybootzfs = nixpkgs.lib.nixosSystem systems.ionlybootzfs.main;
|
||||
iso.ionlybootzfs = (nixpkgs.lib.nixosSystem systems.ionlybootzfs.iso).config.system.build.isoImage;
|
||||
nixosConfigurations.vm_ionlybootzfs = nixpkgs.lib.nixosSystem systems.ionlybootzfs.vm;
|
||||
vm_iso.ionlybootzfs =
|
||||
(nixpkgs.lib.nixosSystem systems.ionlybootzfs.vm_iso).config.system.build.isoImage;
|
||||
};
|
||||
}
|
61
nix/configuration/flakes/ansible-sshjail/flake.lock
generated
61
nix/configuration/flakes/ansible-sshjail/flake.lock
generated
@ -1,61 +0,0 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1735141468,
|
||||
"narHash": "sha256-VIAjBr1qGcEbmhLwQJD6TABppPMggzOvqFsqkDoMsAY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4005c3ff7505313cbc21081776ad0ce5dfd7a3ce",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-24.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
{
|
||||
description = "A slightly better history for zsh";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
...
|
||||
}:
|
||||
let
|
||||
out =
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
# Maybe pkgs = import nixpkgs { inherit system; }; ?
|
||||
appliedOverlay = self.overlays.default pkgs pkgs;
|
||||
in
|
||||
{
|
||||
packages = rec {
|
||||
default = ansible-sshjail;
|
||||
ansible-sshjail = appliedOverlay.ansible-sshjail;
|
||||
};
|
||||
};
|
||||
in
|
||||
flake-utils.lib.eachDefaultSystem out
|
||||
// {
|
||||
overlays.default = final: prev: {
|
||||
ansible-sshjail = final.callPackage ./package.nix { };
|
||||
};
|
||||
};
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
# unpackPhase
|
||||
# patchPhase
|
||||
# configurePhase
|
||||
# buildPhase
|
||||
# checkPhase
|
||||
# installPhase
|
||||
# fixupPhase
|
||||
# installCheckPhase
|
||||
# distPhase
|
||||
{
|
||||
stdenv,
|
||||
fetchgit,
|
||||
...
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
name = "ansible-sshjail";
|
||||
src = fetchgit {
|
||||
url = "https://github.com/austinhyde/ansible-sshjail.git";
|
||||
rev = "a7b0076fdb680b915d35efafd1382919100532b6";
|
||||
sha256 = "sha256-4QX/017fDRzb363NexgvHZ/VFKXOjRgGPDKKygyUylM=";
|
||||
};
|
||||
phases = [
|
||||
"installPhase"
|
||||
];
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/share/ansible/plugins/connection_plugins
|
||||
cp $src/sshjail.py $out/share/ansible/plugins/connection_plugins/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
61
nix/configuration/flakes/zsh-histdb/flake.lock
generated
61
nix/configuration/flakes/zsh-histdb/flake.lock
generated
@ -1,61 +0,0 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1735141468,
|
||||
"narHash": "sha256-VIAjBr1qGcEbmhLwQJD6TABppPMggzOvqFsqkDoMsAY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4005c3ff7505313cbc21081776ad0ce5dfd7a3ce",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-24.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
{
|
||||
description = "A slightly better history for zsh";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
...
|
||||
}:
|
||||
let
|
||||
out =
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
# Maybe pkgs = import nixpkgs { inherit system; }; ?
|
||||
appliedOverlay = self.overlays.default pkgs pkgs;
|
||||
in
|
||||
{
|
||||
packages = rec {
|
||||
default = zsh-histdb;
|
||||
zsh-histdb = appliedOverlay.zsh-histdb;
|
||||
};
|
||||
};
|
||||
in
|
||||
flake-utils.lib.eachDefaultSystem out
|
||||
// {
|
||||
overlays.default = final: prev: {
|
||||
zsh-histdb = final.callPackage ./package.nix { };
|
||||
};
|
||||
};
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
# unpackPhase
|
||||
# patchPhase
|
||||
# configurePhase
|
||||
# buildPhase
|
||||
# checkPhase
|
||||
# installPhase
|
||||
# fixupPhase
|
||||
# installCheckPhase
|
||||
# distPhase
|
||||
{
|
||||
stdenv,
|
||||
pkgs,
|
||||
sqlite,
|
||||
...
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
name = "zsh-histdb";
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://github.com/larkery/zsh-histdb.git";
|
||||
rev = "90a6c104d0fcc0410d665e148fa7da28c49684eb";
|
||||
sha256 = "sha256-vtG1poaRVbfb/wKPChk1WpPgDq+7udLqLfYfLqap4Vg=";
|
||||
};
|
||||
buildInputs = [ sqlite ];
|
||||
phases = [
|
||||
"installPhase"
|
||||
];
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/share/zsh/plugins/zsh-histdb
|
||||
cp -r $src/histdb-* $src/*.zsh $src/db_migrations $out/share/zsh/plugins/zsh-histdb/
|
||||
runHook postInstall
|
||||
'';
|
||||
postInstall = ''
|
||||
substituteInPlace $out/share/zsh/plugins/zsh-histdb/sqlite-history.zsh $out/share/zsh/plugins/zsh-histdb/histdb-merge $out/share/zsh/plugins/zsh-histdb/histdb-migrate --replace-fail "sqlite3" "${sqlite}/bin/sqlite3"
|
||||
'';
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
#TARGET=10.216.1.14
|
||||
# TARGET=192.168.211.250
|
||||
TARGET=hydra
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
|
||||
nixos-rebuild boot --flake "$DIR/../../#hydra" --target-host "$TARGET" --build-host "$TARGET" --fast --use-remote-sudo --max-jobs "$JOBS" "${@}" |& nom
|
||||
|
||||
# rsync -av --progress --delete --exclude=.git "$DIR/../../../configuration" "talexander@${TARGET}:/persist/manual/" && ssh talexander@${TARGET} 'cd /persist/manual/configuration && nix flake update zsh-histdb && nix flake update ansible-sshjail && doas nice -n 19 nixos-rebuild boot --flake /persist/manual/configuration#hydra'
|
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
#TARGET=10.216.1.14
|
||||
# TARGET=192.168.211.250
|
||||
TARGET=hydra
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
|
||||
nixos-rebuild switch --flake "$DIR/../../#hydra" --target-host "$TARGET" --build-host "$TARGET" --fast --use-remote-sudo --max-jobs "$JOBS" "${@}" |& nom
|
||||
|
||||
# rsync -av --progress --delete --exclude=.git "$DIR/../../../configuration" "talexander@${TARGET}:/persist/manual/" && ssh talexander@${TARGET} 'cd /persist/manual/configuration && nix flake update zsh-histdb && nix flake update ansible-sshjail && doas nice -n 19 nixos-rebuild switch --flake /persist/manual/configuration#hydra'
|
@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
nix build --extra-experimental-features nix-command --extra-experimental-features flakes "$DIR/../..#iso.hydra" --max-jobs "$JOBS" "${@}" |& nom
|
@ -1,68 +0,0 @@
|
||||
#
|
||||
# Testing:
|
||||
# doas "$(nix-build '<nixpkgs>' --no-out-link -A 'qemu')/bin/qemu-system-x86_64" \
|
||||
# -accel kvm \
|
||||
# -cpu host \
|
||||
# -smp cores=8 \
|
||||
# -m 32768 \
|
||||
# -drive "file=$(nix-build '<nixpkgs>' --no-out-link -A 'OVMF.fd')/FV/OVMF.fd,if=pflash,format=raw,readonly=on" \
|
||||
# -drive file=/tmp/localdisk.img,if=none,id=nvm,format=raw \
|
||||
# -device nvme,serial=deadbeef,drive=nvm \
|
||||
# -nic user,hostfwd=tcp::60022-:22 \
|
||||
# -boot order=d \
|
||||
# -cdrom "$(readlink -f /persist/machine_setup/nix/configuration/result/iso/nixos*.iso)" \
|
||||
# -display vnc=127.0.0.1:0
|
||||
#
|
||||
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
./disk-config.nix
|
||||
./hardware-configuration.nix
|
||||
./optimized_build.nix
|
||||
./vm_disk.nix
|
||||
];
|
||||
|
||||
# Generate with `head -c4 /dev/urandom | od -A none -t x4`
|
||||
networking.hostId = "fbd233d8";
|
||||
|
||||
networking.hostName = "hydra"; # Define your hostname.
|
||||
|
||||
time.timeZone = "America/New_York";
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
me.secureBoot.enable = false;
|
||||
|
||||
me.optimizations = {
|
||||
enable = true;
|
||||
arch = "znver4";
|
||||
system_features = [
|
||||
"gccarch-znver4"
|
||||
"gccarch-skylake"
|
||||
# "gccarch-alderlake" missing WAITPKG
|
||||
"gccarch-x86-64-v3"
|
||||
"gccarch-x86-64-v4"
|
||||
"benchmark"
|
||||
"big-parallel"
|
||||
"kvm"
|
||||
"nixos-test"
|
||||
];
|
||||
};
|
||||
|
||||
# Mount tmpfs at /tmp
|
||||
boot.tmp.useTmpfs = true;
|
||||
|
||||
me.emacs_flavor = "plainmacs";
|
||||
me.graphical = false;
|
||||
me.hydra.enable = false;
|
||||
me.nix_worker.enable = true;
|
||||
me.vm_disk.enable = true;
|
||||
me.wireguard.activated = [ ];
|
||||
me.wireguard.deactivated = [ ];
|
||||
me.zsh.enable = true;
|
||||
}
|
@ -1,140 +0,0 @@
|
||||
# Manual Step:
|
||||
# Check if drive supports 4kn: nvme id-ns -H /dev/nvme0n1
|
||||
# Format the drive to 4kn: nvme format --lbaf=1 /dev/nvme0n1
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.mkIf (!config.me.buildingIso) {
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/nvme0n1";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
size = "1G";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [
|
||||
"umask=0077"
|
||||
"noatime"
|
||||
"discard"
|
||||
];
|
||||
};
|
||||
};
|
||||
zfs = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "zfs";
|
||||
pool = "zroot";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
zpool = {
|
||||
zroot = {
|
||||
type = "zpool";
|
||||
# mode = "mirror";
|
||||
# Workaround: cannot import 'zroot': I/O error in disko tests
|
||||
options.cachefile = "none";
|
||||
options = {
|
||||
ashift = "12";
|
||||
compatibility = "openzfs-2.2-freebsd";
|
||||
autotrim = "on";
|
||||
};
|
||||
rootFsOptions = {
|
||||
acltype = "posixacl";
|
||||
atime = "off";
|
||||
relatime = "off";
|
||||
xattr = "sa";
|
||||
mountpoint = "none";
|
||||
compression = "lz4";
|
||||
canmount = "off";
|
||||
utf8only = "on";
|
||||
dnodesize = "auto";
|
||||
normalization = "formD";
|
||||
};
|
||||
|
||||
datasets = {
|
||||
"linux/nix" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "none";
|
||||
};
|
||||
"linux/nix/root" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/root@blank$' || zfs snapshot zroot/linux/nix/root@blank";
|
||||
};
|
||||
"linux/nix/nix" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/nix";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/nix@blank$' || zfs snapshot zroot/linux/nix/nix@blank";
|
||||
options = {
|
||||
recordsize = "1MiB";
|
||||
compression = "lz4";
|
||||
};
|
||||
};
|
||||
"linux/nix/home" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/home";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/home@blank$' || zfs snapshot zroot/linux/nix/home@blank";
|
||||
};
|
||||
"linux/nix/persist" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/persist";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/persist@blank$' || zfs snapshot zroot/linux/nix/persist@blank";
|
||||
};
|
||||
"linux/nix/state" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/state";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/state@blank$' || zfs snapshot zroot/linux/nix/state@blank";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Make sure all persistent volumes are marked as neededForBoot
|
||||
#
|
||||
# Also mounts /home so it is mounted before the user home directories are created.
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
fileSystems."/state".neededForBoot = true;
|
||||
fileSystems."/home".neededForBoot = true;
|
||||
|
||||
fileSystems."/".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/nix".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/persist".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/state".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/home".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
}
|
@ -1,39 +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,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"nvme"
|
||||
"usbhid"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
"sdhci_pci"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
# 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.dhcpcd.enable = lib.mkForce true;
|
||||
networking.useDHCP = lib.mkForce true;
|
||||
networking.interfaces.enp0s2.useDHCP = lib.mkForce true;
|
||||
# systemd.network.enable = true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
options.me = {
|
||||
vm_disk.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether we want to mount the local disk for persistent storage.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.me.vm_disk.enable (
|
||||
lib.mkMerge [
|
||||
{
|
||||
# Mount the local disk
|
||||
fileSystems = {
|
||||
"/.disk" = lib.mkForce {
|
||||
device = "/dev/nvme0n1p1";
|
||||
fsType = "ext4";
|
||||
options = [
|
||||
"noatime"
|
||||
"discard"
|
||||
];
|
||||
neededForBoot = true;
|
||||
};
|
||||
|
||||
"/persist" = {
|
||||
fsType = "none";
|
||||
device = "/.disk/persist";
|
||||
options = [
|
||||
"bind"
|
||||
"rw"
|
||||
];
|
||||
depends = [
|
||||
"/.disk/persist"
|
||||
];
|
||||
};
|
||||
|
||||
"/state" = {
|
||||
fsType = "none";
|
||||
device = "/.disk/state";
|
||||
options = [
|
||||
"bind"
|
||||
"rw"
|
||||
];
|
||||
depends = [
|
||||
"/.disk/state"
|
||||
];
|
||||
};
|
||||
|
||||
"/nix/store" = lib.mkForce {
|
||||
fsType = "overlay";
|
||||
device = "overlay";
|
||||
options = [
|
||||
"lowerdir=/nix/.ro-store"
|
||||
"upperdir=/.disk/persist/store"
|
||||
"workdir=/.disk/state/work"
|
||||
];
|
||||
depends = [
|
||||
"/nix/.ro-store"
|
||||
"/.disk/persist/store"
|
||||
"/.disk/state/work"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
]
|
||||
);
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
#TARGET=10.216.1.14
|
||||
# TARGET=192.168.211.250
|
||||
TARGET="ionlybootzfs"
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
|
||||
nixos-rebuild boot --flake "$DIR/../../#ionlybootzfs" --target-host "$TARGET" --build-host "$TARGET" --fast --use-remote-sudo --max-jobs "$JOBS" "${@}" |& nom
|
||||
|
||||
# rsync -av --progress --delete --exclude=.git "$DIR/../../../configuration" "talexander@${TARGET}:/persist/manual/" && ssh talexander@${TARGET} 'cd /persist/manual/configuration && nix flake update zsh-histdb && nix flake update ansible-sshjail && doas nice -n 19 nixos-rebuild boot --flake /persist/manual/configuration#ionlybootzfs'
|
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
#TARGET=10.216.1.14
|
||||
# TARGET=192.168.211.250
|
||||
TARGET=ionlybootzfs
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
|
||||
nixos-rebuild switch --flake "$DIR/../../#ionlybootzfs" --target-host "$TARGET" --build-host "$TARGET" --fast --use-remote-sudo --max-jobs "$JOBS" "${@}" |& nom
|
||||
|
||||
# rsync -av --progress --delete --exclude=.git "$DIR/../../../configuration" "talexander@${TARGET}:/persist/manual/" && ssh talexander@${TARGET} 'cd /persist/manual/configuration && nix flake update zsh-histdb && nix flake update ansible-sshjail && doas nice -n 19 nixos-rebuild switch --flake /persist/manual/configuration#ionlybootzfs'
|
@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
nix build --extra-experimental-features nix-command --extra-experimental-features flakes "$DIR/../..#iso.ionlybootzfs" --max-jobs "$JOBS" "${@}" |& nom
|
@ -1,63 +0,0 @@
|
||||
#
|
||||
# Testing:
|
||||
# doas "$(nix-build '<nixpkgs>' --no-out-link -A 'qemu')/bin/qemu-system-x86_64" \
|
||||
# -accel kvm \
|
||||
# -cpu host \
|
||||
# -smp cores=8 \
|
||||
# -m 32768 \
|
||||
# -drive "file=$(nix-build '<nixpkgs>' --no-out-link -A 'OVMF.fd')/FV/OVMF.fd,if=pflash,format=raw,readonly=on" \
|
||||
# -drive file=/tmp/localdisk.img,if=none,id=nvm,format=raw \
|
||||
# -device nvme,serial=deadbeef,drive=nvm \
|
||||
# -nic user,hostfwd=tcp::60022-:22 \
|
||||
# -boot order=d \
|
||||
# -cdrom "$(readlink -f /persist/machine_setup/nix/configuration/result/iso/nixos*.iso)" \
|
||||
# -display vnc=127.0.0.1:0
|
||||
#
|
||||
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
./wrapped-disk-config.nix
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
# Generate with `head -c4 /dev/urandom | od -A none -t x4`
|
||||
networking.hostId = "fbd233d8";
|
||||
|
||||
networking.hostName = "ionlybootzfs"; # Define your hostname.
|
||||
|
||||
time.timeZone = "America/New_York";
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
me.secureBoot.enable = true;
|
||||
|
||||
me.optimizations = {
|
||||
enable = false;
|
||||
arch = "znver4";
|
||||
system_features = [
|
||||
"gccarch-znver4"
|
||||
"gccarch-skylake"
|
||||
# "gccarch-alderlake" missing WAITPKG
|
||||
"gccarch-x86-64-v3"
|
||||
"gccarch-x86-64-v4"
|
||||
"benchmark"
|
||||
"big-parallel"
|
||||
"kvm"
|
||||
"nixos-test"
|
||||
];
|
||||
};
|
||||
|
||||
# Mount tmpfs at /tmp
|
||||
boot.tmp.useTmpfs = true;
|
||||
|
||||
me.emacs_flavor = "plainmacs";
|
||||
me.graphical = false;
|
||||
me.wireguard.activated = [ ];
|
||||
me.wireguard.deactivated = [ ];
|
||||
me.zsh.enable = true;
|
||||
}
|
@ -1,142 +0,0 @@
|
||||
# Manual Step:
|
||||
# Check if drive supports 4kn: nvme id-ns -H /dev/nvme0n1
|
||||
# Format the drive to 4kn: nvme format --lbaf=1 /dev/nvme0n1
|
||||
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/nvme0n1";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
size = "1G";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [
|
||||
"umask=0077"
|
||||
"noatime"
|
||||
"discard"
|
||||
];
|
||||
};
|
||||
};
|
||||
zfs = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "zfs";
|
||||
pool = "zroot";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
zpool = {
|
||||
zroot = {
|
||||
type = "zpool";
|
||||
# mode = "mirror";
|
||||
# Workaround: cannot import 'zroot': I/O error in disko tests
|
||||
options.cachefile = "none";
|
||||
options = {
|
||||
ashift = "12";
|
||||
compatibility = "openzfs-2.2-freebsd";
|
||||
autotrim = "on";
|
||||
};
|
||||
rootFsOptions = {
|
||||
acltype = "posixacl";
|
||||
atime = "off";
|
||||
relatime = "off";
|
||||
xattr = "sa";
|
||||
mountpoint = "none";
|
||||
compression = "lz4";
|
||||
canmount = "off";
|
||||
utf8only = "on";
|
||||
dnodesize = "auto";
|
||||
normalization = "formD";
|
||||
};
|
||||
|
||||
datasets = {
|
||||
"linux/nix" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "none";
|
||||
options = {
|
||||
encryption = "aes-256-gcm";
|
||||
keyformat = "passphrase";
|
||||
# keylocation = "file:///tmp/secret.key";
|
||||
};
|
||||
};
|
||||
"linux/nix/root" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/root@blank$' || zfs snapshot zroot/linux/nix/root@blank";
|
||||
};
|
||||
"linux/nix/nix" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/nix";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/nix@blank$' || zfs snapshot zroot/linux/nix/nix@blank";
|
||||
options = {
|
||||
recordsize = "16MiB";
|
||||
compression = "zstd-19";
|
||||
};
|
||||
};
|
||||
"linux/nix/home" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/home";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/home@blank$' || zfs snapshot zroot/linux/nix/home@blank";
|
||||
};
|
||||
"linux/nix/persist" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/persist";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/persist@blank$' || zfs snapshot zroot/linux/nix/persist@blank";
|
||||
};
|
||||
"linux/nix/state" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/state";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/state@blank$' || zfs snapshot zroot/linux/nix/state@blank";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Make sure all persistent volumes are marked as neededForBoot
|
||||
#
|
||||
# Also mounts /home so it is mounted before the user home directories are created.
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
fileSystems."/state".neededForBoot = true;
|
||||
fileSystems."/home".neededForBoot = true;
|
||||
|
||||
fileSystems."/".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/nix".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/persist".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/state".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/home".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
|
||||
# Only attempt to decrypt the main pool. Otherwise it attempts to decrypt pools that aren't even used.
|
||||
boot.zfs.requestEncryptionCredentials = [ "zroot/linux/nix" ];
|
||||
}
|
@ -1,38 +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,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"nvme"
|
||||
"usbhid"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
"sdhci_pci"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
# 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.dhcpcd.enable = lib.mkForce true;
|
||||
networking.useDHCP = lib.mkForce true;
|
||||
# systemd.network.enable = true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
@ -1,131 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
pkgs-unoptimized,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
config = lib.mkMerge [
|
||||
{ }
|
||||
(lib.mkIf (!config.me.optimizations.enable) {
|
||||
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_6_14;
|
||||
})
|
||||
(lib.mkIf (config.me.optimizations.enable) {
|
||||
nixpkgs.hostPlatform = {
|
||||
gcc.arch = "znver4";
|
||||
gcc.tune = "znver4";
|
||||
system = "x86_64-linux";
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(
|
||||
final: prev:
|
||||
let
|
||||
addConfig =
|
||||
additionalConfig: pkg:
|
||||
pkg.override (oldconfig: {
|
||||
structuredExtraConfig = pkg.structuredExtraConfig // additionalConfig;
|
||||
});
|
||||
in
|
||||
{
|
||||
linux_me = addConfig {
|
||||
# Full preemption
|
||||
PREEMPT = lib.mkOverride 60 lib.kernel.yes;
|
||||
PREEMPT_VOLUNTARY = lib.mkOverride 60 lib.kernel.no;
|
||||
|
||||
# Google's BBRv3 TCP congestion Control
|
||||
TCP_CONG_BBR = lib.kernel.yes;
|
||||
DEFAULT_BBR = lib.kernel.yes;
|
||||
|
||||
# Preemptive Full Tickless Kernel at 300Hz
|
||||
HZ = lib.kernel.freeform "300";
|
||||
HZ_300 = lib.kernel.yes;
|
||||
HZ_1000 = lib.kernel.no;
|
||||
} prev.linux_6_14;
|
||||
# gsl = prev.gsl.overrideAttrs (old: {
|
||||
# # gsl tests fails when optimizations are enabled.
|
||||
# # > FAIL: cholesky_invert unscaled hilbert ( 4, 4)[0,2]: 2.55795384873636067e-13 0
|
||||
# # > (2.55795384873636067e-13 observed vs 0 expected) [28259614]
|
||||
# doCheck = false;
|
||||
# });
|
||||
}
|
||||
)
|
||||
(final: prev: {
|
||||
haskellPackages = prev.haskellPackages.extend (
|
||||
final': prev': {
|
||||
inherit (pkgs-unoptimized.haskellPackages)
|
||||
crypton
|
||||
crypton-connection
|
||||
crypton-x509
|
||||
crypton-x509-store
|
||||
crypton-x509-system
|
||||
crypton-x509-validation
|
||||
hspec-wai
|
||||
http-client-tls
|
||||
http2
|
||||
pandoc
|
||||
pandoc-cli
|
||||
pandoc-lua-engine
|
||||
pandoc-server
|
||||
servant-server
|
||||
tls
|
||||
wai-app-static
|
||||
wai-extra
|
||||
warp
|
||||
;
|
||||
}
|
||||
);
|
||||
})
|
||||
(final: prev: {
|
||||
inherit (pkgs-unoptimized)
|
||||
gsl
|
||||
redis
|
||||
valkey
|
||||
;
|
||||
})
|
||||
];
|
||||
|
||||
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_me;
|
||||
})
|
||||
(lib.mkIf (!config.me.buildingIso) {
|
||||
nix.settings.system-features = lib.mkForce [
|
||||
"gccarch-znver4"
|
||||
"gccarch-skylake"
|
||||
# "gccarch-alderlake" missing WAITPKG
|
||||
"gccarch-x86-64-v3"
|
||||
"gccarch-x86-64-v4"
|
||||
"benchmark"
|
||||
"big-parallel"
|
||||
"kvm"
|
||||
"nixos-test"
|
||||
];
|
||||
|
||||
# Keep ALL dependencies so we can rebuild offline. This DRASTICALLY increase disk usage, but disk space is cheap.
|
||||
# system.includeBuildDependencies = true;
|
||||
|
||||
# This also should enable building offline? TODO: test.
|
||||
nix.extraOptions = ''
|
||||
keep-outputs = true
|
||||
keep-derivations = true
|
||||
'';
|
||||
|
||||
# # building ON
|
||||
# nixpkgs.localSystem = { system = "aarch64-linux"; };
|
||||
# # building FOR
|
||||
# nixpkgs.crossSystem = { system = "aarch64-linux"; };
|
||||
|
||||
# nixpkgs.config = {
|
||||
# replaceStdenv = ({ pkgs }: pkgs.clangStdenv);
|
||||
# };
|
||||
# or maybe an overlay
|
||||
# stdenv = prev.clangStdenv;
|
||||
|
||||
})
|
||||
(lib.mkIf (config.me.buildingIso) {
|
||||
boot.supportedFilesystems.zfs = true;
|
||||
})
|
||||
];
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.mkIf (!config.me.buildingIso) (import ./disk-config.nix)
|
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
#TARGET=10.216.1.14
|
||||
# TARGET=192.168.211.250
|
||||
TARGET=neelix
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
|
||||
nixos-rebuild boot --flake "$DIR/../../#neelix" --target-host "$TARGET" --build-host "$TARGET" --fast --use-remote-sudo --max-jobs "$JOBS" "${@}" |& nom
|
||||
|
||||
# rsync -av --progress --delete --exclude=.git "$DIR/../../../configuration" "talexander@${TARGET}:/persist/manual/" && ssh talexander@${TARGET} 'cd /persist/manual/configuration && nix flake update zsh-histdb && nix flake update ansible-sshjail && doas nice -n 19 nixos-rebuild boot --flake /persist/manual/configuration#neelix'
|
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
#TARGET=10.216.1.14
|
||||
# TARGET=192.168.211.250
|
||||
TARGET=neelix
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
|
||||
nixos-rebuild switch --flake "$DIR/../../#neelix" --target-host "$TARGET" --build-host "$TARGET" --fast --use-remote-sudo --max-jobs "$JOBS" "${@}" |& nom
|
||||
|
||||
# rsync -av --progress --delete --exclude=.git "$DIR/../../../configuration" "talexander@${TARGET}:/persist/manual/" && ssh talexander@${TARGET} 'cd /persist/manual/configuration && nix flake update zsh-histdb && nix flake update ansible-sshjail && doas nice -n 19 nixos-rebuild switch --flake /persist/manual/configuration#neelix'
|
@ -1,51 +0,0 @@
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
./disk-config.nix
|
||||
./power_management.nix
|
||||
];
|
||||
|
||||
# Generate with `head -c4 /dev/urandom | od -A none -t x4`
|
||||
networking.hostId = "bca9d0a5";
|
||||
|
||||
networking.hostName = "neelix"; # Define your hostname.
|
||||
|
||||
time.timeZone = "America/New_York";
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
me.secureBoot.enable = false;
|
||||
|
||||
me.optimizations = {
|
||||
enable = false;
|
||||
arch = "alderlake";
|
||||
system_features = [
|
||||
"gccarch-alderlake"
|
||||
"gccarch-x86-64-v3"
|
||||
"gccarch-x86-64-v4"
|
||||
"benchmark"
|
||||
"big-parallel"
|
||||
"kvm"
|
||||
"nixos-test"
|
||||
];
|
||||
};
|
||||
|
||||
# Early KMS
|
||||
boot.initrd.kernelModules = [ "i915" ];
|
||||
|
||||
# Mount tmpfs at /tmp
|
||||
# boot.tmp.useTmpfs = true;
|
||||
|
||||
me.bluetooth.enable = true;
|
||||
me.emacs_flavor = "plainmacs";
|
||||
me.graphical = true;
|
||||
me.graphics_card_type = "intel";
|
||||
me.kodi.enable = true;
|
||||
me.lvfs.enable = true;
|
||||
me.sound.enable = true;
|
||||
me.wireguard.activated = [ "wgh" ];
|
||||
me.wireguard.deactivated = [ "wgf" ];
|
||||
me.zrepl.enable = true;
|
||||
me.zsh.enable = true;
|
||||
|
||||
}
|
@ -1,140 +0,0 @@
|
||||
# Manual Step:
|
||||
# Check if drive supports 4kn: nvme id-ns -H /dev/nvme0n1
|
||||
# Format the drive to 4kn: nvme format --lbaf=1 /dev/nvme0n1
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.mkIf (!config.me.buildingIso) {
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/nvme0n1";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
size = "1G";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [
|
||||
"umask=0077"
|
||||
"noatime"
|
||||
"discard"
|
||||
];
|
||||
};
|
||||
};
|
||||
zfs = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "zfs";
|
||||
pool = "zroot";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
zpool = {
|
||||
zroot = {
|
||||
type = "zpool";
|
||||
# mode = "mirror";
|
||||
# Workaround: cannot import 'zroot': I/O error in disko tests
|
||||
options.cachefile = "none";
|
||||
options = {
|
||||
ashift = "12";
|
||||
compatibility = "openzfs-2.2-freebsd";
|
||||
autotrim = "on";
|
||||
};
|
||||
rootFsOptions = {
|
||||
acltype = "posixacl";
|
||||
atime = "off";
|
||||
relatime = "off";
|
||||
xattr = "sa";
|
||||
mountpoint = "none";
|
||||
compression = "lz4";
|
||||
canmount = "off";
|
||||
utf8only = "on";
|
||||
dnodesize = "auto";
|
||||
normalization = "formD";
|
||||
};
|
||||
|
||||
datasets = {
|
||||
"linux/nix" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "none";
|
||||
};
|
||||
"linux/nix/root" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/root@blank$' || zfs snapshot zroot/linux/nix/root@blank";
|
||||
};
|
||||
"linux/nix/nix" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/nix";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/nix@blank$' || zfs snapshot zroot/linux/nix/nix@blank";
|
||||
options = {
|
||||
recordsize = "1MiB";
|
||||
compression = "lz4";
|
||||
};
|
||||
};
|
||||
"linux/nix/home" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/home";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/home@blank$' || zfs snapshot zroot/linux/nix/home@blank";
|
||||
};
|
||||
"linux/nix/persist" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/persist";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/persist@blank$' || zfs snapshot zroot/linux/nix/persist@blank";
|
||||
};
|
||||
"linux/nix/state" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/state";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/state@blank$' || zfs snapshot zroot/linux/nix/state@blank";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Make sure all persistent volumes are marked as neededForBoot
|
||||
#
|
||||
# Also mounts /home so it is mounted before the user home directories are created.
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
fileSystems."/state".neededForBoot = true;
|
||||
fileSystems."/home".neededForBoot = true;
|
||||
|
||||
fileSystems."/".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/nix".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/persist".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/state".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/home".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
}
|
@ -1,39 +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,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"nvme"
|
||||
"usbhid"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
"sdhci_pci"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
# 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.eno1.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.wlp58s0.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
powertop
|
||||
];
|
||||
|
||||
# pcie_aspm=force pcie_aspm.policy=powersupersave :: Enable PCIe active state power management for power reduction.
|
||||
# nowatchdog :: Disable watchdog for power savings (related to disable_sp5100_watchdog above).
|
||||
boot.kernelParams = [
|
||||
"pcie_aspm=force"
|
||||
# "pcie_aspm.policy=powersupersave"
|
||||
"nowatchdog"
|
||||
];
|
||||
|
||||
# default performance balance_performance balance_power power
|
||||
# defaults to balance_performance
|
||||
# systemd.tmpfiles.rules = [
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy0/energy_performance_preference - - - - power"
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy1/energy_performance_preference - - - - power"
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy2/energy_performance_preference - - - - power"
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy3/energy_performance_preference - - - - power"
|
||||
# ];
|
||||
|
||||
boot.extraModprobeConfig = ''
|
||||
options snd_hda_intel power_save=1
|
||||
'';
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
# TARGET=10.216.1.15
|
||||
# TARGET=192.168.211.250
|
||||
TARGET=odo
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
|
||||
nixos-rebuild boot --flake "$DIR/../../#odo" --target-host "$TARGET" --build-host "$TARGET" --fast --use-remote-sudo --max-jobs "$JOBS" "${@}" |& nom
|
||||
|
||||
# rsync -av --progress --delete --exclude=.git "$DIR/../../../configuration" "talexander@${TARGET}:/persist/manual/" && ssh talexander@${TARGET} 'cd /persist/manual/configuration && nix flake update zsh-histdb && nix flake update ansible-sshjail && doas nice -n 19 nixos-rebuild boot --flake /persist/manual/configuration#odo'
|
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
#TARGET=10.216.1.14
|
||||
# TARGET=192.168.211.250
|
||||
TARGET=odo
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
|
||||
nixos-rebuild switch --flake "$DIR/../../#odo" --target-host "$TARGET" --build-host "$TARGET" --fast --use-remote-sudo --max-jobs "$JOBS" "${@}" |& nom
|
||||
|
||||
# rsync -av --progress --delete --exclude=.git "$DIR/../../../configuration" "talexander@${TARGET}:/persist/manual/" && ssh talexander@${TARGET} 'cd /persist/manual/configuration && nix flake update zsh-histdb && nix flake update ansible-sshjail && doas nice -n 19 nixos-rebuild switch --flake /persist/manual/configuration#odo'
|
@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
nix build --extra-experimental-features nix-command --extra-experimental-features flakes "$DIR/../..#iso.odo" --max-jobs "$JOBS" "${@}" |& nom
|
@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
nixos-rebuild boot --show-trace --use-remote-sudo --max-jobs "$JOBS" --flake "$DIR/../../#odo" "${@}" |& nom
|
@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
nixos-rebuild build --show-trace --use-remote-sudo --max-jobs "$JOBS" --flake "$DIR/../../#odo" "${@}" |& nom
|
@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
nixos-rebuild switch --show-trace --use-remote-sudo --max-jobs "$JOBS" --flake "$DIR/../../#odo" "${@}" |& nom
|
@ -1,116 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
./wrapped-disk-config.nix
|
||||
./distributed_build.nix
|
||||
./power_management.nix
|
||||
./screen_brightness.nix
|
||||
./wifi.nix
|
||||
./framework_module.nix
|
||||
];
|
||||
|
||||
# Generate with `head -c4 /dev/urandom | od -A none -t x4`
|
||||
networking.hostId = "908cbf04";
|
||||
|
||||
networking.hostName = "odo"; # Define your hostname.
|
||||
|
||||
time.timeZone = "America/New_York";
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
me.secureBoot.enable = true;
|
||||
|
||||
me.optimizations = {
|
||||
enable = true;
|
||||
arch = "znver4";
|
||||
system_features = [
|
||||
"gccarch-znver4"
|
||||
"gccarch-skylake"
|
||||
# "gccarch-alderlake" missing WAITPKG
|
||||
"gccarch-x86-64-v3"
|
||||
"gccarch-x86-64-v4"
|
||||
"benchmark"
|
||||
"big-parallel"
|
||||
"kvm"
|
||||
"nixos-test"
|
||||
];
|
||||
};
|
||||
|
||||
# Early KMS
|
||||
boot.initrd.kernelModules = [ "amdgpu" ];
|
||||
|
||||
# Mount tmpfs at /tmp
|
||||
boot.tmp.useTmpfs = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
fw-ectool
|
||||
framework-tool
|
||||
];
|
||||
|
||||
# Enable light sensor
|
||||
# hardware.sensor.iio.enable = lib.mkDefault true;
|
||||
|
||||
# Enable TRIM
|
||||
# services.fstrim.enable = lib.mkDefault true;
|
||||
|
||||
me.alacritty.enable = true;
|
||||
me.ansible.enable = true;
|
||||
me.ares.enable = true;
|
||||
me.bluetooth.enable = true;
|
||||
me.chromecast.enable = true;
|
||||
me.chromium.enable = true;
|
||||
me.docker.enable = true;
|
||||
me.ecc.enable = true;
|
||||
me.emacs_flavor = "full";
|
||||
me.firefox.enable = true;
|
||||
me.flux.enable = true;
|
||||
me.gcloud.enable = true;
|
||||
me.git.config = ../../roles/git/files/gitconfig_home;
|
||||
me.gnuplot.enable = true;
|
||||
me.gpg.enable = true;
|
||||
me.graphical = true;
|
||||
me.graphics_card_type = "amd";
|
||||
me.iso_mount.enable = true;
|
||||
me.kanshi.enable = false;
|
||||
me.kubernetes.enable = true;
|
||||
me.latex.enable = true;
|
||||
me.launch_keyboard.enable = true;
|
||||
me.lvfs.enable = true;
|
||||
me.media.enable = true;
|
||||
me.nix_index.enable = true;
|
||||
me.pcsx2.enable = true;
|
||||
me.python.enable = true;
|
||||
me.qemu.enable = true;
|
||||
me.rpcs3.enable = true;
|
||||
me.rust.enable = true;
|
||||
me.shikane.enable = true;
|
||||
me.sops.enable = true;
|
||||
me.sound.enable = true;
|
||||
me.steam.enable = true;
|
||||
me.steam_run_free.enable = true;
|
||||
me.sway.enable = true;
|
||||
me.tekton.enable = true;
|
||||
me.terraform.enable = true;
|
||||
me.thunderbolt.enable = true;
|
||||
me.vnc_client.enable = true;
|
||||
me.vscode.enable = true;
|
||||
me.wasm.enable = true;
|
||||
me.waybar.enable = true;
|
||||
me.wireguard.activated = [
|
||||
"drmario"
|
||||
"wgh"
|
||||
"colo"
|
||||
];
|
||||
me.wireguard.deactivated = [ "wgf" ];
|
||||
me.zrepl.enable = true;
|
||||
me.zsh.enable = true;
|
||||
|
||||
me.sm64ex.enable = true;
|
||||
me.shipwright.enable = true;
|
||||
me.ship2harkinian.enable = true;
|
||||
}
|
@ -1,142 +0,0 @@
|
||||
# Manual Step:
|
||||
# Check if drive supports 4kn: nvme id-ns -H /dev/nvme0n1
|
||||
# Format the drive to 4kn: nvme format --lbaf=1 /dev/nvme0n1
|
||||
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/nvme0n1";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
size = "1G";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [
|
||||
"umask=0077"
|
||||
"noatime"
|
||||
"discard"
|
||||
];
|
||||
};
|
||||
};
|
||||
zfs = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "zfs";
|
||||
pool = "zroot";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
zpool = {
|
||||
zroot = {
|
||||
type = "zpool";
|
||||
# mode = "mirror";
|
||||
# Workaround: cannot import 'zroot': I/O error in disko tests
|
||||
options.cachefile = "none";
|
||||
options = {
|
||||
ashift = "12";
|
||||
compatibility = "openzfs-2.2-freebsd";
|
||||
autotrim = "on";
|
||||
};
|
||||
rootFsOptions = {
|
||||
acltype = "posixacl";
|
||||
atime = "off";
|
||||
relatime = "off";
|
||||
xattr = "sa";
|
||||
mountpoint = "none";
|
||||
compression = "lz4";
|
||||
canmount = "off";
|
||||
utf8only = "on";
|
||||
dnodesize = "auto";
|
||||
normalization = "formD";
|
||||
};
|
||||
|
||||
datasets = {
|
||||
"linux/nix" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "none";
|
||||
options = {
|
||||
encryption = "aes-256-gcm";
|
||||
keyformat = "passphrase";
|
||||
# keylocation = "file:///tmp/secret.key";
|
||||
};
|
||||
};
|
||||
"linux/nix/root" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/root@blank$' || zfs snapshot zroot/linux/nix/root@blank";
|
||||
};
|
||||
"linux/nix/nix" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/nix";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/nix@blank$' || zfs snapshot zroot/linux/nix/nix@blank";
|
||||
options = {
|
||||
recordsize = "16MiB";
|
||||
compression = "zstd-19";
|
||||
};
|
||||
};
|
||||
"linux/nix/home" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/home";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/home@blank$' || zfs snapshot zroot/linux/nix/home@blank";
|
||||
};
|
||||
"linux/nix/persist" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/persist";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/persist@blank$' || zfs snapshot zroot/linux/nix/persist@blank";
|
||||
};
|
||||
"linux/nix/state" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/state";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/state@blank$' || zfs snapshot zroot/linux/nix/state@blank";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Make sure all persistent volumes are marked as neededForBoot
|
||||
#
|
||||
# Also mounts /home so it is mounted before the user home directories are created.
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
fileSystems."/state".neededForBoot = true;
|
||||
fileSystems."/home".neededForBoot = true;
|
||||
|
||||
fileSystems."/".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/nix".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/persist".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/state".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/home".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
|
||||
# Only attempt to decrypt the main pool. Otherwise it attempts to decrypt pools that aren't even used.
|
||||
boot.zfs.requestEncryptionCredentials = [ "zroot/linux/nix" ];
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
me.distributed_build.enable = true;
|
||||
me.distributed_build.machines.hydra = {
|
||||
enable = true;
|
||||
additional_config = {
|
||||
speedFactor = 2;
|
||||
};
|
||||
};
|
||||
me.distributed_build.machines.quark = {
|
||||
enable = true;
|
||||
additional_config = {
|
||||
speedFactor = 2;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
boot.extraModulePackages = with config.boot.kernelPackages; [
|
||||
framework-laptop-kmod
|
||||
];
|
||||
# https://github.com/DHowett/framework-laptop-kmod?tab=readme-ov-file#usage
|
||||
boot.kernelModules = [
|
||||
"cros_ec"
|
||||
"cros_ec_lpcs"
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
@ -1,36 +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,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"nvme"
|
||||
"xhci_pci"
|
||||
"thunderbolt"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
# 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.eno1.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.wlp58s0.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
powertop
|
||||
];
|
||||
|
||||
# amdgpu.abmlevel=3 :: Automatically reduce screen brightness but tweak colors to compensate for power reduction.
|
||||
# pcie_aspm=force pcie_aspm.policy=powersupersave :: Enable PCIe active state power management for power reduction.
|
||||
# nowatchdog :: Disable watchdog for power savings (related to disable_sp5100_watchdog above).
|
||||
# amd_pstate=passive :: Fully automated hardware pstate control.
|
||||
# amd_pstate=active :: Same as passive except we can set the energy performance preference (EPP) to suggest how much we prefer performance or energy efficiency.
|
||||
# amd_pstate=guided :: Same as passive except we can set upper and lower frequency bounds.
|
||||
# amdgpu.dcdebugmask=0x10 :: Allegedly disables Panel Replay from https://community.frame.work/t/tracking-freezing-arch-linux-amd/39495/32
|
||||
boot.kernelParams = [
|
||||
"amdgpu.abmlevel=3"
|
||||
"pcie_aspm=force"
|
||||
# "pcie_aspm.policy=powersupersave"
|
||||
"nowatchdog"
|
||||
# I don't see a measurable benefit from these two:
|
||||
# "cpufreq.default_governor=powersave"
|
||||
# "initcall_blacklist=cpufreq_gov_userspace_init"
|
||||
];
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"w- /sys/firmware/acpi/platform_profile - - - - low-power"
|
||||
"w- /sys/devices/system/cpu/cpufreq/policy0/energy_performance_preference - - - - power"
|
||||
"w- /sys/devices/system/cpu/cpufreq/policy1/energy_performance_preference - - - - power"
|
||||
"w- /sys/devices/system/cpu/cpufreq/policy2/energy_performance_preference - - - - power"
|
||||
"w- /sys/devices/system/cpu/cpufreq/policy3/energy_performance_preference - - - - power"
|
||||
"w- /sys/devices/system/cpu/cpufreq/policy4/energy_performance_preference - - - - power"
|
||||
"w- /sys/devices/system/cpu/cpufreq/policy5/energy_performance_preference - - - - power"
|
||||
"w- /sys/devices/system/cpu/cpufreq/policy6/energy_performance_preference - - - - power"
|
||||
"w- /sys/devices/system/cpu/cpufreq/policy7/energy_performance_preference - - - - power"
|
||||
"w- /sys/devices/system/cpu/cpufreq/policy8/energy_performance_preference - - - - power"
|
||||
"w- /sys/devices/system/cpu/cpufreq/policy9/energy_performance_preference - - - - power"
|
||||
"w- /sys/devices/system/cpu/cpufreq/policy10/energy_performance_preference - - - - power"
|
||||
"w- /sys/devices/system/cpu/cpufreq/policy11/energy_performance_preference - - - - power"
|
||||
"w- /sys/devices/system/cpu/cpufreq/policy12/energy_performance_preference - - - - power"
|
||||
"w- /sys/devices/system/cpu/cpufreq/policy13/energy_performance_preference - - - - power"
|
||||
"w- /sys/devices/system/cpu/cpufreq/policy14/energy_performance_preference - - - - power"
|
||||
"w- /sys/devices/system/cpu/cpufreq/policy15/energy_performance_preference - - - - power"
|
||||
];
|
||||
|
||||
boot.extraModprobeConfig = ''
|
||||
# Disable the hardware watchdog inside AMD 700 chipset series for power savings.
|
||||
blacklist sp5100_tco
|
||||
|
||||
# Sound power-saving was causing chat notifications to be inaudible.
|
||||
# options snd_hda_intel power_save=1
|
||||
'';
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"w- /sys/class/backlight/amdgpu_bl1/brightness - - - - 85"
|
||||
];
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
config = {
|
||||
# Doesn't seem necessary starting with 6.13
|
||||
# environment.loginShellInit = lib.mkIf (!config.me.buildingIso) ''
|
||||
# doas iw dev wlan0 set power_save off
|
||||
# '';
|
||||
|
||||
# Enable debug logging for ath12k wifi card.
|
||||
boot.kernelParams = [
|
||||
"ath12k.debug_mask=0xffffffff"
|
||||
];
|
||||
};
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.mkIf (!config.me.buildingIso) (import ./disk-config.nix)
|
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
#TARGET=10.216.1.15
|
||||
# TARGET=192.168.211.250
|
||||
TARGET=quark
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
|
||||
nixos-rebuild boot --flake "$DIR/../../#quark" --target-host "$TARGET" --build-host "$TARGET" --fast --use-remote-sudo --max-jobs "$JOBS" "${@}" |& nom
|
||||
|
||||
# rsync -av --progress --delete --exclude=.git "$DIR/../../../configuration" "talexander@${TARGET}:/persist/manual/" && ssh talexander@${TARGET} 'cd /persist/manual/configuration && nix flake update zsh-histdb && nix flake update ansible-sshjail && doas nice -n 19 nixos-rebuild boot --flake /persist/manual/configuration#quark'
|
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
#TARGET=10.216.1.14
|
||||
# TARGET=192.168.211.250
|
||||
TARGET=quark
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
|
||||
nixos-rebuild switch --flake "$DIR/../../#quark" --target-host "$TARGET" --build-host "$TARGET" --fast --use-remote-sudo --max-jobs "$JOBS" "${@}" |& nom
|
||||
|
||||
# rsync -av --progress --delete --exclude=.git "$DIR/../../../configuration" "talexander@${TARGET}:/persist/manual/" && ssh talexander@${TARGET} 'cd /persist/manual/configuration && nix flake update zsh-histdb && nix flake update ansible-sshjail && doas nice -n 19 nixos-rebuild switch --flake /persist/manual/configuration#quark'
|
@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
nix build --extra-experimental-features nix-command --extra-experimental-features flakes "$DIR/../..#iso.quark" --max-jobs "$JOBS" "${@}" |& nom
|
@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
nixos-rebuild boot --show-trace --use-remote-sudo --max-jobs "$JOBS" --flake "$DIR/../../#quark" "${@}" |& nom
|
@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
nixos-rebuild build --show-trace --use-remote-sudo --max-jobs "$JOBS" --flake "$DIR/../../#quark" "${@}" |& nom
|
@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
nixos-rebuild switch --show-trace --use-remote-sudo --max-jobs "$JOBS" --flake "$DIR/../../#quark" "${@}" |& nom
|
@ -1,113 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
./disk-config.nix
|
||||
./distributed_build.nix
|
||||
./hardware-configuration.nix
|
||||
./power_management.nix
|
||||
./wifi.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
# Generate with `head -c4 /dev/urandom | od -A none -t x4`
|
||||
networking.hostId = "47ee7d7c";
|
||||
|
||||
networking.hostName = "quark"; # Define your hostname.
|
||||
|
||||
time.timeZone = "America/New_York";
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
me.secureBoot.enable = true;
|
||||
|
||||
me.optimizations = {
|
||||
enable = true;
|
||||
arch = "znver5";
|
||||
system_features = [
|
||||
"gccarch-znver4"
|
||||
"gccarch-znver5"
|
||||
"gccarch-skylake"
|
||||
# "gccarch-alderlake" missing WAITPKG
|
||||
"gccarch-x86-64-v3"
|
||||
"gccarch-x86-64-v4"
|
||||
"benchmark"
|
||||
"big-parallel"
|
||||
"kvm"
|
||||
"nixos-test"
|
||||
];
|
||||
};
|
||||
|
||||
# Early KMS
|
||||
boot.initrd.kernelModules = [ "amdgpu" ];
|
||||
|
||||
# Mount tmpfs at /tmp
|
||||
boot.tmp.useTmpfs = true;
|
||||
|
||||
# Enable TRIM
|
||||
# services.fstrim.enable = lib.mkDefault true;
|
||||
|
||||
# RPCS3 has difficulty with znver5
|
||||
me.rpcs3.config.Core."Use LLVM CPU" = "znver4";
|
||||
|
||||
me.alacritty.enable = true;
|
||||
me.ansible.enable = true;
|
||||
me.ares.enable = true;
|
||||
me.bluetooth.enable = true;
|
||||
me.chromecast.enable = true;
|
||||
me.chromium.enable = true;
|
||||
me.docker.enable = true;
|
||||
me.ecc.enable = true;
|
||||
me.emacs_flavor = "full";
|
||||
me.firefox.enable = true;
|
||||
me.flux.enable = true;
|
||||
me.gcloud.enable = true;
|
||||
me.git.config = ../../roles/git/files/gitconfig_home;
|
||||
me.gnuplot.enable = true;
|
||||
me.gpg.enable = true;
|
||||
me.graphical = true;
|
||||
me.graphics_card_type = "amd";
|
||||
me.iso_mount.enable = true;
|
||||
me.kanshi.enable = false;
|
||||
me.kubernetes.enable = true;
|
||||
me.latex.enable = true;
|
||||
me.launch_keyboard.enable = true;
|
||||
me.lvfs.enable = true;
|
||||
me.media.enable = true;
|
||||
me.nix_index.enable = true;
|
||||
me.nix_worker.enable = true;
|
||||
me.pcsx2.enable = true;
|
||||
me.python.enable = true;
|
||||
me.qemu.enable = true;
|
||||
me.rpcs3.enable = true;
|
||||
me.rust.enable = true;
|
||||
me.shikane.enable = true;
|
||||
me.sops.enable = true;
|
||||
me.sound.enable = true;
|
||||
me.steam.enable = true;
|
||||
me.steam_run_free.enable = true;
|
||||
me.sway.enable = true;
|
||||
me.tekton.enable = true;
|
||||
me.terraform.enable = true;
|
||||
me.thunderbolt.enable = true;
|
||||
me.vnc_client.enable = true;
|
||||
me.vscode.enable = true;
|
||||
me.wasm.enable = true;
|
||||
me.waybar.enable = true;
|
||||
me.wireguard.activated = [
|
||||
"drmario"
|
||||
"wgh"
|
||||
"colo"
|
||||
];
|
||||
me.wireguard.deactivated = [ "wgf" ];
|
||||
me.zrepl.enable = true;
|
||||
me.zsh.enable = true;
|
||||
|
||||
me.sm64ex.enable = true;
|
||||
me.shipwright.enable = true;
|
||||
me.ship2harkinian.enable = true;
|
||||
};
|
||||
}
|
@ -1,148 +0,0 @@
|
||||
# Manual Step:
|
||||
# Check if drive supports 4kn: nvme id-ns -H /dev/nvme0n1
|
||||
# Format the drive to 4kn: nvme format --lbaf=1 /dev/nvme0n1
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.mkIf (!config.me.buildingIso) {
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/nvme0n1";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
size = "1G";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [
|
||||
"umask=0077"
|
||||
"noatime"
|
||||
"discard"
|
||||
];
|
||||
};
|
||||
};
|
||||
zfs = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "zfs";
|
||||
pool = "zroot";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
zpool = {
|
||||
zroot = {
|
||||
type = "zpool";
|
||||
# mode = "mirror";
|
||||
# Workaround: cannot import 'zroot': I/O error in disko tests
|
||||
options.cachefile = "none";
|
||||
options = {
|
||||
ashift = "12";
|
||||
compatibility = "openzfs-2.2-freebsd";
|
||||
autotrim = "on";
|
||||
};
|
||||
rootFsOptions = {
|
||||
acltype = "posixacl";
|
||||
atime = "off";
|
||||
relatime = "off";
|
||||
xattr = "sa";
|
||||
mountpoint = "none";
|
||||
compression = "lz4";
|
||||
canmount = "off";
|
||||
utf8only = "on";
|
||||
dnodesize = "auto";
|
||||
normalization = "formD";
|
||||
};
|
||||
|
||||
datasets = {
|
||||
"linux/nix" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "none";
|
||||
options = {
|
||||
encryption = "aes-256-gcm";
|
||||
keyformat = "passphrase";
|
||||
# keylocation = "file:///tmp/secret.key";
|
||||
};
|
||||
};
|
||||
"linux/nix/root" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/root@blank$' || zfs snapshot zroot/linux/nix/root@blank";
|
||||
};
|
||||
"linux/nix/nix" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/nix";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/nix@blank$' || zfs snapshot zroot/linux/nix/nix@blank";
|
||||
options = {
|
||||
recordsize = "16MiB";
|
||||
compression = "zstd-19";
|
||||
};
|
||||
};
|
||||
"linux/nix/home" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/home";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/home@blank$' || zfs snapshot zroot/linux/nix/home@blank";
|
||||
};
|
||||
"linux/nix/persist" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/persist";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/persist@blank$' || zfs snapshot zroot/linux/nix/persist@blank";
|
||||
};
|
||||
"linux/nix/state" = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "legacy";
|
||||
mountpoint = "/state";
|
||||
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/state@blank$' || zfs snapshot zroot/linux/nix/state@blank";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Make sure all persistent volumes are marked as neededForBoot
|
||||
#
|
||||
# Also mounts /home so it is mounted before the user home directories are created.
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
fileSystems."/state".neededForBoot = true;
|
||||
fileSystems."/home".neededForBoot = true;
|
||||
|
||||
fileSystems."/".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/nix".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/persist".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/state".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
fileSystems."/home".options = [
|
||||
"noatime"
|
||||
"norelatime"
|
||||
];
|
||||
|
||||
# Only attempt to decrypt the main pool. Otherwise it attempts to decrypt pools that aren't even used.
|
||||
boot.zfs.requestEncryptionCredentials = [ "zroot/linux/nix" ];
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
me.distributed_build.enable = true;
|
||||
me.distributed_build.machines.hydra = {
|
||||
enable = true;
|
||||
additional_config = {
|
||||
speedFactor = 2;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
@ -1,35 +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,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"nvme"
|
||||
"xhci_pci"
|
||||
"thunderbolt"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
# 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.eno1.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.wlp58s0.useDHCP = lib.mkDefault true;
|
||||
|
||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
powertop
|
||||
];
|
||||
|
||||
boot.kernelParams = [
|
||||
# Enable undervolting GPU.
|
||||
# "amdgpu.ppfeaturemask=0xfff7ffff"
|
||||
];
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy0/energy_performance_preference - - - - power"
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy1/energy_performance_preference - - - - power"
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy2/energy_performance_preference - - - - power"
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy3/energy_performance_preference - - - - power"
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy4/energy_performance_preference - - - - power"
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy5/energy_performance_preference - - - - power"
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy6/energy_performance_preference - - - - power"
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy7/energy_performance_preference - - - - power"
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy8/energy_performance_preference - - - - power"
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy9/energy_performance_preference - - - - power"
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy10/energy_performance_preference - - - - power"
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy11/energy_performance_preference - - - - power"
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy12/energy_performance_preference - - - - power"
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy13/energy_performance_preference - - - - power"
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy14/energy_performance_preference - - - - power"
|
||||
# "w- /sys/devices/system/cpu/cpufreq/policy15/energy_performance_preference - - - - power"
|
||||
];
|
||||
|
||||
# services.udev.packages = [
|
||||
# (pkgs.writeTextFile {
|
||||
# name = "amdgpu-low-power";
|
||||
# text = ''
|
||||
# ACTION=="add", SUBSYSTEM=="drm", DRIVERS=="amdgpu", ATTR{device/power_dpm_force_performance_level}="low"
|
||||
# '';
|
||||
# destination = "/etc/udev/rules.d/30-amdgpu-low-power.rules";
|
||||
# })
|
||||
# ];
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
config = {
|
||||
environment.loginShellInit = lib.mkIf (!config.me.buildingIso) ''
|
||||
doas iw dev wlan0 set power_save off
|
||||
'';
|
||||
};
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
options.me = {
|
||||
ship2harkinian.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether we want to install 2ship2harkinian.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.me.ship2harkinian.enable (
|
||||
lib.mkMerge [
|
||||
{
|
||||
allowedUnfree = [ "2ship2harkinian" ];
|
||||
}
|
||||
(lib.mkIf config.me.graphical {
|
||||
environment.systemPackages = with pkgs; [
|
||||
_2ship2harkinian
|
||||
];
|
||||
|
||||
# TODO perhaps install ~/.local/share/2ship/2ship2harkinian.json
|
||||
|
||||
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||
hideMounts = true;
|
||||
users.talexander = {
|
||||
directories = [
|
||||
{
|
||||
directory = ".local/share/2ship";
|
||||
user = "talexander";
|
||||
group = "talexander";
|
||||
mode = "0755";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
options.me = {
|
||||
alacritty.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether we want to install alacritty.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.me.alacritty.enable (
|
||||
lib.mkMerge [
|
||||
(lib.mkIf config.me.graphical {
|
||||
environment.systemPackages = with pkgs; [
|
||||
alacritty
|
||||
xdg-utils # for xdg-open
|
||||
];
|
||||
|
||||
home-manager.users.talexander =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.file.".config/alacritty/alacritty.toml" = {
|
||||
source = ./files/alacritty.toml;
|
||||
};
|
||||
};
|
||||
})
|
||||
]
|
||||
);
|
||||
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
[colors]
|
||||
draw_bold_text_with_bright_colors = true
|
||||
indexed_colors = []
|
||||
|
||||
[colors.bright]
|
||||
black = "0x666666"
|
||||
blue = "0x7aa6da"
|
||||
cyan = "0x54ced6"
|
||||
green = "0x9ec400"
|
||||
magenta = "0xb77ee0"
|
||||
red = "0xff3334"
|
||||
white = "0xffffff"
|
||||
yellow = "0xe7c547"
|
||||
|
||||
[colors.normal]
|
||||
black = "0x000000"
|
||||
blue = "0x7aa6da"
|
||||
cyan = "0x70c0ba"
|
||||
green = "0xb9ca4a"
|
||||
magenta = "0xc397d8"
|
||||
red = "0xd54e53"
|
||||
white = "0xeaeaea"
|
||||
yellow = "0xe6c547"
|
||||
|
||||
[colors.primary]
|
||||
background = "0x000000"
|
||||
foreground = "0xeaeaea"
|
||||
|
||||
[font]
|
||||
size = 11.0
|
||||
|
||||
[[hints.enabled]]
|
||||
command = "xdg-open"
|
||||
post_processing = true
|
||||
regex = "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\u0000-\u001F\u007F-<>\"\\s{-}\\^⟨⟩`]+"
|
||||
|
||||
[hints.enabled.mouse]
|
||||
enabled = false
|
||||
mods = "None"
|
||||
|
||||
[scrolling]
|
||||
history = 10000
|
||||
# Lines moved per scroll.
|
||||
multiplier = 3
|
@ -1,86 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
options.me = {
|
||||
ansible.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether we want to install ansible.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.me.ansible.enable (
|
||||
lib.mkMerge [
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
ansible
|
||||
];
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
ansible = pkgs.symlinkJoin {
|
||||
name = "ansible";
|
||||
paths = [
|
||||
(prev.ansible.overridePythonAttrs {
|
||||
propagatedBuildInputs = prev.ansible.propagatedBuildInputs ++ [ prev.python3Packages.jmespath ];
|
||||
})
|
||||
pkgs.ansible-sshjail
|
||||
];
|
||||
buildInputs = [ pkgs.makeWrapper ];
|
||||
|
||||
postBuild = ''
|
||||
${lib.concatMapStringsSep "\n"
|
||||
(
|
||||
prog:
|
||||
(
|
||||
"wrapProgram $out/bin/${prog} ${
|
||||
lib.concatMapStringsSep " "
|
||||
(
|
||||
plugin_type:
|
||||
"--set ANSIBLE_${lib.toUpper plugin_type}_PLUGINS $out/share/ansible/plugins/${lib.toLower plugin_type}_plugins"
|
||||
)
|
||||
[
|
||||
"action"
|
||||
"cache"
|
||||
"callback"
|
||||
"connection"
|
||||
"filter"
|
||||
"inventory"
|
||||
"lookup"
|
||||
"shell"
|
||||
"strategy"
|
||||
"test"
|
||||
"vars"
|
||||
]
|
||||
} --prefix PATH : ${lib.makeBinPath [ ]}"
|
||||
)
|
||||
)
|
||||
[
|
||||
"ansible"
|
||||
"ansible-config"
|
||||
"ansible-console"
|
||||
"ansible-doc"
|
||||
"ansible-galaxy"
|
||||
"ansible-inventory"
|
||||
"ansible-playbook"
|
||||
"ansible-pull"
|
||||
"ansible-test"
|
||||
"ansible-vault"
|
||||
]
|
||||
}
|
||||
'';
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
]
|
||||
);
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
options.me = {
|
||||
ares.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether we want to install ares.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.me.ares.enable (
|
||||
lib.mkMerge [
|
||||
{ }
|
||||
(lib.mkIf config.me.graphical {
|
||||
environment.systemPackages = with pkgs; [
|
||||
ares
|
||||
];
|
||||
|
||||
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||
hideMounts = true;
|
||||
users.talexander = {
|
||||
directories = [
|
||||
{
|
||||
directory = ".local/share/ares";
|
||||
user = "talexander";
|
||||
group = "talexander";
|
||||
mode = "0755";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
options.me = {
|
||||
blank.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether we want to install blank.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.me.blank.enable (
|
||||
lib.mkMerge [
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
];
|
||||
}
|
||||
(lib.mkIf config.me.graphical {
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
options.me = {
|
||||
bluetooth.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether we want to install bluetooth.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.me.bluetooth.enable (
|
||||
lib.mkMerge [
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
];
|
||||
|
||||
hardware.bluetooth = {
|
||||
enable = true;
|
||||
powerOnBoot = true;
|
||||
settings = {
|
||||
General = {
|
||||
# Enable support for showing battery charge level.
|
||||
Experimental = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||
hideMounts = true;
|
||||
directories = [
|
||||
"/var/lib/bluetooth" # Bluetooth pairing information.
|
||||
];
|
||||
};
|
||||
}
|
||||
]
|
||||
);
|
||||
}
|
@ -1,104 +0,0 @@
|
||||
# ISO does not work with systemd initrd yet https://github.com/NixOS/nixpkgs/pull/291750
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
options = {
|
||||
me.secureBoot = {
|
||||
enable = lib.mkOption {
|
||||
default = false;
|
||||
type = lib.types.bool;
|
||||
description = ''
|
||||
Enable to use secure boot.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
tpm2-tools # For tpm2_eventlog to check for OptionRoms
|
||||
# cp /sys/kernel/security/tpm0/binary_bios_measurements eventlog
|
||||
# tpm2_eventlog eventlog | grep "BOOT_SERVICES_DRIVER"
|
||||
sbctl # For debugging and troubleshooting Secure Boot.
|
||||
];
|
||||
}
|
||||
(lib.mkIf (!config.me.buildingIso) {
|
||||
|
||||
boot.loader.grub.enable = false;
|
||||
# Use the systemd-boot EFI boot loader.
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
# TODO: make not write bootx64.efi
|
||||
boot.loader.efi.canTouchEfiVariables = false;
|
||||
|
||||
# Automatically delete old generations
|
||||
boot.loader.systemd-boot.configurationLimit = 3;
|
||||
|
||||
boot.loader.systemd-boot.memtest86.enable = true;
|
||||
|
||||
# Check what will be lost with `zfs diff zroot/linux/root@blank`
|
||||
boot.initrd.systemd.enable = lib.mkDefault true;
|
||||
boot.initrd.systemd.services.zfs-rollback = {
|
||||
description = "Rollback ZFS root dataset to blank snapshot";
|
||||
wantedBy = [
|
||||
"initrd.target"
|
||||
];
|
||||
after = [
|
||||
"zfs-import-zroot.service"
|
||||
];
|
||||
before = [
|
||||
"sysroot.mount"
|
||||
];
|
||||
path = with pkgs; [
|
||||
zfs
|
||||
];
|
||||
unitConfig.DefaultDependencies = "no";
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = ''
|
||||
zfs rollback -r zroot/linux/nix/root@blank
|
||||
zfs rollback -r zroot/linux/nix/home@blank
|
||||
echo "rollback complete"
|
||||
'';
|
||||
};
|
||||
|
||||
# boot.loader.systemd-boot.extraEntries = {
|
||||
# "windows.conf" = ''
|
||||
# title Windows
|
||||
# efi /EFI/Microsoft/Boot/bootmgfw.efi
|
||||
# options root=PARTUUID=17e325bf-a378-4d1d-be6a-f6df5476f0fa
|
||||
# '';
|
||||
# };
|
||||
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||
hideMounts = true;
|
||||
directories = [
|
||||
"/var/lib/sbctl" # Secure Boot Keys
|
||||
];
|
||||
};
|
||||
})
|
||||
(lib.mkIf (config.me.secureBoot.enable) {
|
||||
environment.systemPackages = with pkgs; [
|
||||
sbctl
|
||||
];
|
||||
boot.loader.systemd-boot.enable = lib.mkForce false;
|
||||
boot.lanzaboote = {
|
||||
enable = true;
|
||||
pkiBundle = "/var/lib/sbctl";
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
# efibootmgr -c -d /dev/sda -p 1 -L NixOS-boot -l '\EFI\NixOS-boot\grubx64.efi'
|
||||
|
||||
# Text-only:
|
||||
# sudo cp "$(nix-build '<nixpkgs>' --no-out-link -A 'refind')/share/refind/refind_x64.efi" /boot/EFI/boot/bootx64.efi
|
||||
|
||||
# Full graphics:
|
||||
# $ sudo nix-shell -p refind efibootmgr
|
||||
# $ refind-install
|
@ -1,31 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
options.me = {
|
||||
chromecast.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether we want to install chromecast.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.me.chromecast.enable (
|
||||
lib.mkMerge [
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
catt
|
||||
];
|
||||
}
|
||||
(lib.mkIf config.me.graphical {
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
options.me = {
|
||||
chromium.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether we want to install chromium.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.me.chromium.enable (
|
||||
lib.mkMerge [
|
||||
{ }
|
||||
(lib.mkIf config.me.graphical {
|
||||
environment.systemPackages = with pkgs; [
|
||||
(chromium.override { enableWideVine = true; })
|
||||
];
|
||||
allowedUnfree = [
|
||||
"chromium"
|
||||
"chromium-unwrapped"
|
||||
"widevine-cdm"
|
||||
];
|
||||
|
||||
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||
hideMounts = true;
|
||||
users.talexander = {
|
||||
directories = [
|
||||
{
|
||||
directory = ".config/chromium";
|
||||
user = "talexander";
|
||||
group = "talexander";
|
||||
mode = "0700";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
|
||||
hideMounts = true;
|
||||
users.talexander = {
|
||||
directories = [
|
||||
{
|
||||
directory = ".cache/chromium";
|
||||
user = "talexander";
|
||||
group = "talexander";
|
||||
mode = "0700";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Enabling vulkan causes video to render as white
|
||||
# nixpkgs.config.chromium.commandLineArgs = "--enable-features=Vulkan";
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
make_machine_config = name: {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether we want to use the ${name} machine during distributed builds.";
|
||||
};
|
||||
|
||||
additional_config = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
default = { };
|
||||
example = lib.literalExpression {
|
||||
speedFactor = 2;
|
||||
};
|
||||
description = "Additional config values for the buildMachines entry. For example, speedFactor.";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
options.me = {
|
||||
distributed_build.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether we want to use multiple machines to perform a nixos-rebuild.";
|
||||
};
|
||||
|
||||
distributed_build.machines.hydra = make_machine_config "hydra";
|
||||
distributed_build.machines.quark = make_machine_config "quark";
|
||||
};
|
||||
|
||||
config = lib.mkIf config.me.distributed_build.enable (
|
||||
lib.mkMerge [
|
||||
{
|
||||
nix.distributedBuilds = true;
|
||||
}
|
||||
(lib.mkIf config.me.distributed_build.machines.hydra.enable {
|
||||
nix.buildMachines = [
|
||||
(
|
||||
{
|
||||
hostName = "hydra";
|
||||
sshUser = "nixworker";
|
||||
# sshKey = "";
|
||||
# publicHostKey = "";
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
# "aarch64-linux"
|
||||
];
|
||||
maxJobs = 1;
|
||||
supportedFeatures = [
|
||||
# "nixos-test"
|
||||
"benchmark"
|
||||
"big-parallel"
|
||||
# "kvm"
|
||||
"gccarch-x86-64-v3"
|
||||
"gccarch-x86-64-v4"
|
||||
"gccarch-znver4"
|
||||
];
|
||||
}
|
||||
// config.me.distributed_build.machines.hydra.additional_config
|
||||
)
|
||||
];
|
||||
})
|
||||
(lib.mkIf config.me.distributed_build.machines.quark.enable {
|
||||
nix.buildMachines = [
|
||||
(
|
||||
{
|
||||
hostName = "quark";
|
||||
sshUser = "nixworker";
|
||||
sshKey = "/persist/manual/ssh/root/keys/id_ed25519";
|
||||
# From: base64 -w0 /persist/ssh/ssh_host_ed25519_key.pub
|
||||
publicHostKey = "c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUx0alplYlVYTkRkU3Y1enVGbjM3eFNMZUN3S2hPKzFMdWovM2FYNFJRTEEgcm9vdEBxdWFyawo=";
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
# "aarch64-linux"
|
||||
];
|
||||
maxJobs = 1;
|
||||
supportedFeatures = [
|
||||
# "nixos-test"
|
||||
"benchmark"
|
||||
"big-parallel"
|
||||
# "kvm"
|
||||
"gccarch-x86-64-v3"
|
||||
"gccarch-x86-64-v4"
|
||||
"gccarch-znver4"
|
||||
"gccarch-znver5"
|
||||
];
|
||||
}
|
||||
// config.me.distributed_build.machines.quark.additional_config
|
||||
)
|
||||
];
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
options.me = {
|
||||
docker.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether we want to install docker.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.me.docker.enable (
|
||||
lib.mkMerge [
|
||||
{
|
||||
virtualisation.docker.enable = true;
|
||||
# Use docker activation
|
||||
virtualisation.docker.enableOnBoot = false;
|
||||
# Rootless docker breaks access to ssh for buildkit.
|
||||
# virtualisation.docker.rootless = {
|
||||
# enable = true;
|
||||
# setSocketVariable = true;
|
||||
# };
|
||||
# Give docker access to ssh for fetching repos with buildkit.
|
||||
virtualisation.docker.extraPackages = [ pkgs.openssh ];
|
||||
environment.systemPackages = with pkgs; [
|
||||
docker-buildx
|
||||
];
|
||||
|
||||
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
|
||||
hideMounts = true;
|
||||
directories = [
|
||||
{
|
||||
directory = "/var/lib/docker";
|
||||
user = "root";
|
||||
group = "root";
|
||||
mode = "0740";
|
||||
}
|
||||
];
|
||||
# users.talexander = {
|
||||
# directories = [
|
||||
# {
|
||||
# directory = ".local/share/docker";
|
||||
# user = "talexander";
|
||||
# group = "talexander";
|
||||
# mode = "0740";
|
||||
# }
|
||||
# ];
|
||||
# };
|
||||
};
|
||||
|
||||
systemd.services.link-docker-creds = {
|
||||
# Contains credentials so it cannot be added to the nix store
|
||||
enable = true;
|
||||
description = "link-docker-creds";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "multi-user.target" ];
|
||||
after = [ "multi-user.target" ];
|
||||
# path = with pkgs; [
|
||||
# zfs
|
||||
# ];
|
||||
unitConfig.DefaultDependencies = "no";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = "yes";
|
||||
};
|
||||
script = ''
|
||||
if [ -e /persist/manual/docker/config.json ]; then
|
||||
install --directory --owner talexander --group talexander --mode 0700 /home/talexander/.docker
|
||||
ln -s /persist/manual/docker/config.json /home/talexander/.docker/config.json
|
||||
fi
|
||||
'';
|
||||
preStop = ''
|
||||
rm -f /home/talexander/.docker/config.json
|
||||
'';
|
||||
};
|
||||
|
||||
# Needed for non-rootless docker
|
||||
users.users.talexander.extraGroups = [ "docker" ];
|
||||
}
|
||||
]
|
||||
);
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
# Check memory errors with: ras-mc-ctl --error-count
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
options.me = {
|
||||
ecc.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether we want to install ecc.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.me.ecc.enable (
|
||||
lib.mkMerge [
|
||||
{
|
||||
hardware.rasdaemon.enable = true;
|
||||
}
|
||||
]
|
||||
);
|
||||
}
|
@ -1,171 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
plainmacs =
|
||||
emacs_package:
|
||||
pkgs.writeShellScriptBin "plainmacs" ''
|
||||
INIT_SCRIPT=$(cat <<EOF
|
||||
(progn
|
||||
(setq make-backup-files nil auto-save-default nil create-lockfiles nil)
|
||||
(load-theme 'tango-dark t)
|
||||
(set-face-attribute 'default nil :background "black")
|
||||
;; Bright yellow highlighting for selected region
|
||||
(set-face-attribute 'region nil :background "#ffff50" :foreground "black")
|
||||
;; Bright green cursor to distinguish from yellow region
|
||||
(set-cursor-color "#ccff66")
|
||||
;; Hightlight the current line
|
||||
(set-face-attribute 'line-number-current-line nil :foreground "white")
|
||||
;; Set default font
|
||||
(set-face-attribute 'default nil :height 100 :width 'regular :weight 'regular :family "Cascadia Mono")
|
||||
;; Set fallback font for unicode glyphs
|
||||
(when (display-graphic-p)
|
||||
(set-fontset-font "fontset-default" nil (font-spec :name "Noto Color Emoji")))
|
||||
(menu-bar-mode -1)
|
||||
(when (fboundp 'tool-bar-mode)
|
||||
(tool-bar-mode -1))
|
||||
(when ( fboundp 'scroll-bar-mode)
|
||||
(scroll-bar-mode -1))
|
||||
(pixel-scroll-precision-mode)
|
||||
(setq frame-resize-pixelwise t)
|
||||
)
|
||||
EOF
|
||||
)
|
||||
|
||||
exec ${emacs_package}/bin/emacs -q --eval "$INIT_SCRIPT" "''${@}"
|
||||
'';
|
||||
e_shorthand =
|
||||
emacs_package:
|
||||
pkgs.writeShellScriptBin "e" ''
|
||||
exec ${emacs_package}/bin/emacs "''${@}"
|
||||
'';
|
||||
in
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
options.me.emacs_flavor = lib.mkOption {
|
||||
type = lib.types.nullOr (
|
||||
lib.types.enum [
|
||||
"full"
|
||||
"plainmacs"
|
||||
]
|
||||
);
|
||||
default = null;
|
||||
example = "full";
|
||||
description = "What flavor of emacs to set up.";
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.me.emacs_flavor != null) (
|
||||
lib.mkMerge [
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
my_emacs
|
||||
(plainmacs my_emacs)
|
||||
(e_shorthand my_emacs)
|
||||
];
|
||||
|
||||
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
|
||||
hideMounts = true;
|
||||
users.talexander = {
|
||||
directories = [
|
||||
".config/emacs/eln-cache" # Installed packages
|
||||
".config/emacs/elpa" # Installed packages
|
||||
".config/emacs/private" # For recentf
|
||||
".config/emacs/tree-sitter" # Compiled tree-sitter grammars
|
||||
];
|
||||
files = [
|
||||
".config/emacs/history" # For savehist
|
||||
".config/emacs/.last-package-update-day" # For use-package
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
environment.variables.EDITOR = "plainmacs";
|
||||
}
|
||||
(lib.mkIf (config.me.graphical) {
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
my_emacs = final.emacs-pgtk;
|
||||
})
|
||||
];
|
||||
})
|
||||
(lib.mkIf (!config.me.graphical) {
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
my_emacs = final.emacs-nox;
|
||||
})
|
||||
];
|
||||
})
|
||||
(lib.mkIf (config.me.emacs_flavor == "full") {
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
my_emacs = pkgs.buildEnv {
|
||||
name = prev.my_emacs.name;
|
||||
paths = with prev; [
|
||||
my_emacs
|
||||
];
|
||||
extraOutputsToInstall = [
|
||||
"man"
|
||||
"doc"
|
||||
"info"
|
||||
];
|
||||
nativeBuildInputs = [ final.makeWrapper ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/emacs --prefix PATH : ${
|
||||
lib.makeBinPath [
|
||||
(final.aspellWithDicts (
|
||||
dicts: with dicts; [
|
||||
en
|
||||
en-computers
|
||||
# en-science # TODO: Why is en-science non-free?
|
||||
]
|
||||
))
|
||||
final.nixd # nix language server
|
||||
final.nixfmt-rfc-style # auto-formatting nix files through nixd
|
||||
final.clang # To compile tree-sitter grammars
|
||||
final.shellcheck
|
||||
final.cmake-language-server
|
||||
final.cmake # Used by cmake-language-server
|
||||
final.rust-analyzer
|
||||
final.nodePackages_latest.prettier # Format yaml, json, and JS
|
||||
final.terraform-ls
|
||||
]
|
||||
}
|
||||
'';
|
||||
};
|
||||
})
|
||||
];
|
||||
|
||||
home-manager.users.talexander =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.file.".config/emacs" = {
|
||||
source = ./files/emacs;
|
||||
recursive = true;
|
||||
};
|
||||
};
|
||||
})
|
||||
(lib.mkIf (config.me.emacs_flavor == "plainmacs") {
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
my_emacs = pkgs.buildEnv {
|
||||
name = prev.my_emacs.name;
|
||||
paths = with prev; [
|
||||
my_emacs
|
||||
];
|
||||
extraOutputsToInstall = [
|
||||
"man"
|
||||
"doc"
|
||||
"info"
|
||||
];
|
||||
};
|
||||
})
|
||||
];
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
(setq gc-cons-threshold (* 128 1024 1024)) ;; 128MiB Increase garbage collection threshold for performance (default 800000)
|
||||
;; Increase amount of data read from processes, default 4k
|
||||
(when (version<= "27.0" emacs-version)
|
||||
(setq read-process-output-max (* 10 1024 1024)) ;; 10MiB
|
||||
)
|
||||
|
||||
;; Suppress warnings
|
||||
(setq byte-compile-warnings '(not obsolete))
|
||||
(setq warning-suppress-log-types '((comp) (bytecomp)))
|
||||
(setq native-comp-async-report-warnings-errors 'silent)
|
||||
|
||||
;; Set up default visual settings
|
||||
(setq frame-resize-pixelwise t)
|
||||
;; Disable toolbar & menubar
|
||||
(menu-bar-mode -1)
|
||||
(when (fboundp 'tool-bar-mode)
|
||||
(tool-bar-mode -1))
|
||||
(when (display-graphic-p)
|
||||
(context-menu-mode +1))
|
||||
|
||||
(setq default-frame-alist '((fullscreen . maximized)
|
||||
(vertical-scroll-bars . nil)
|
||||
(horizontal-scroll-bars . nil)
|
||||
;; Set dark colors in early-init to prevent flashes of white.
|
||||
(background-color . "#000000")))
|
@ -1,85 +0,0 @@
|
||||
(use-package diminish)
|
||||
|
||||
;; Eglot recommends pulling the latest of the standard libraries it
|
||||
;; uses from ELPA if you're not tracking the current.config/emacsevelopment
|
||||
;; branch.
|
||||
(use-package xref
|
||||
:pin gnu
|
||||
)
|
||||
|
||||
(use-package eldoc
|
||||
:pin gnu
|
||||
:diminish
|
||||
)
|
||||
|
||||
;; Other packages
|
||||
|
||||
(use-package dashboard
|
||||
:config
|
||||
(dashboard-setup-startup-hook))
|
||||
|
||||
(when (version<= "26.0.50" emacs-version )
|
||||
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
|
||||
(add-hook 'prog-mode-hook 'column-number-mode)
|
||||
)
|
||||
|
||||
;; Display a horizontal line instead of ^L for page break characters
|
||||
(use-package page-break-lines
|
||||
:diminish
|
||||
:config
|
||||
(global-page-break-lines-mode +1)
|
||||
)
|
||||
|
||||
(use-package recentf
|
||||
;; This is an emacs built-in but we're pulling the latest version
|
||||
:config
|
||||
(setq recentf-max-saved-items 100)
|
||||
(setq recentf-save-file (recentf-expand-file-name "~/.config/emacs/private/cache/recentf"))
|
||||
(recentf-mode 1))
|
||||
|
||||
;; Persist history over Emacs restarts. Vertico sorts by history position.
|
||||
(use-package savehist
|
||||
;; This is an emacs built-in but we're pulling the latest version
|
||||
:pin gnu
|
||||
:config
|
||||
(savehist-mode))
|
||||
|
||||
(use-package which-key
|
||||
:pin gnu
|
||||
:diminish
|
||||
:config
|
||||
(which-key-mode))
|
||||
|
||||
(use-package windmove
|
||||
;; This is an emacs built-in but we're pulling the latest version
|
||||
:pin gnu
|
||||
:bind
|
||||
(
|
||||
("S-<up>" . windmove-up)
|
||||
("S-<right>" . windmove-right)
|
||||
("S-<down>" . windmove-down)
|
||||
("S-<left>" . windmove-left)
|
||||
)
|
||||
)
|
||||
|
||||
(setq tramp-default-method "ssh")
|
||||
|
||||
(use-package nginx-mode
|
||||
:mode (
|
||||
("headers\\.include\\'" . nginx-mode)
|
||||
)
|
||||
:config
|
||||
(setq nginx-indent-level 4))
|
||||
|
||||
(use-package systemd
|
||||
:mode
|
||||
(("\\.service\\'" . systemd-mode)
|
||||
("\\.timer\\'" . systemd-mode))
|
||||
)
|
||||
|
||||
(use-package pkgbuild-mode
|
||||
:mode
|
||||
(("PKGBUILD\\'" . pkgbuild-mode))
|
||||
)
|
||||
|
||||
(provide 'base-extensions)
|
@ -1,127 +0,0 @@
|
||||
;; ========== Function to reload current file =================
|
||||
|
||||
(defun reload-file ()
|
||||
"Revert buffer without confirmation."
|
||||
(interactive)
|
||||
(revert-buffer :ignore-auto :noconfirm))
|
||||
|
||||
;; ===========================================================
|
||||
;; ============= Run commands ================================
|
||||
(defun run-command-on-buffer (cmd &rest args)
|
||||
"Run a command using the current buffer as stdin and replacing its contents if the command succeeds with the stdout from the command. This is useful for code formatters."
|
||||
(let (
|
||||
(stdout-buffer (generate-new-buffer "tmp-stdout" t))
|
||||
(full-cmd (append '(call-process-region nil nil cmd nil stdout-buffer nil) args))
|
||||
)
|
||||
(unwind-protect
|
||||
(let ((exit-status (eval full-cmd)))
|
||||
(if (eq exit-status 0)
|
||||
(save-excursion
|
||||
(replace-buffer-contents stdout-buffer)
|
||||
)
|
||||
(message "FAILED running command on buffer %s" (append (list cmd) args))
|
||||
)
|
||||
)
|
||||
(kill-buffer stdout-buffer)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun run-command-in-directory (dir cmd &rest args)
|
||||
"Run a command in the specified directory. If the directory is nil, the directory of the file is used. The stdout result is trimmed of whitespace and returned."
|
||||
(let (
|
||||
(default-directory (or dir default-directory))
|
||||
(stdout-buffer (generate-new-buffer "tmp-stdout" t))
|
||||
(full-cmd (append '(call-process cmd nil (list stdout-buffer nil) nil) args))
|
||||
)
|
||||
(unwind-protect
|
||||
(let ((exit-status (condition-case nil (eval full-cmd) (file-missing nil))))
|
||||
(if (eq exit-status 0)
|
||||
(progn
|
||||
(with-current-buffer stdout-buffer
|
||||
(string-trim (buffer-string))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(kill-buffer stdout-buffer)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun load-directory (dir)
|
||||
(let ((load-it (lambda (f)
|
||||
(load-file (concat (file-name-as-directory dir) f)))
|
||||
))
|
||||
(mapc load-it (directory-files dir nil "\\.el$"))))
|
||||
|
||||
(defun generate-vc-link ()
|
||||
(interactive)
|
||||
(or
|
||||
(generate-github-link)
|
||||
(generate-source-hut-link)
|
||||
)
|
||||
)
|
||||
|
||||
(defun generate-github-link ()
|
||||
"Generate a permalink to the current line."
|
||||
(interactive)
|
||||
(let (
|
||||
(current-rev (vc-working-revision buffer-file-name))
|
||||
(line-number (line-number-at-pos))
|
||||
(repository-url (vc-git-repository-url buffer-file-name))
|
||||
(relative-path (file-relative-name buffer-file-name (vc-root-dir)))
|
||||
)
|
||||
(save-match-data
|
||||
(and (string-match "\\(git@github\.com:\\|https://github\.com/\\)\\([^/]+\\)/\\([^.]+\\).git" repository-url)
|
||||
(let* (
|
||||
(gh-org (match-string 2 repository-url))
|
||||
(gh-repo (match-string 3 repository-url))
|
||||
(full-url (format "https://github.com/%s/%s/blob/%s/%s?plain=1#L%s" gh-org gh-repo current-rev relative-path line-number))
|
||||
)
|
||||
(message "%s" full-url)
|
||||
(kill-new full-url)
|
||||
t
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun generate-source-hut-link ()
|
||||
"Generate a permalink to the current line."
|
||||
(interactive)
|
||||
(let (
|
||||
(current-rev (vc-working-revision buffer-file-name))
|
||||
(line-number (line-number-at-pos))
|
||||
(repository-url (vc-git-repository-url buffer-file-name))
|
||||
(relative-path (file-relative-name buffer-file-name (vc-root-dir)))
|
||||
)
|
||||
(message "Using repo url %s" repository-url)
|
||||
(save-match-data
|
||||
(and (string-match "https://git.sr.ht/\\([^/]+\\)/\\([^/]+\\)" repository-url)
|
||||
(let* (
|
||||
(sh-org (match-string 1 repository-url))
|
||||
(sh-repo (match-string 2 repository-url))
|
||||
(full-url (format "https://git.sr.ht/%s/%s/tree/%s/%s#L%s" sh-org sh-repo current-rev relative-path line-number))
|
||||
)
|
||||
(message "%s" full-url)
|
||||
(kill-new full-url)
|
||||
t
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro when-linux (&rest body)
|
||||
"Execute only when on Linux."
|
||||
(declare (indent defun))
|
||||
`(when (eq system-type 'gnu/linux) ,@body))
|
||||
|
||||
(defmacro when-freebsd (&rest body)
|
||||
"Execute only when on FreeBSD."
|
||||
(declare (indent defun))
|
||||
`(when (eq system-type 'berkeley-unix) ,@body))
|
||||
|
||||
(provide 'base-functions)
|
@ -1,12 +0,0 @@
|
||||
;; Add your keys here, as such
|
||||
|
||||
;; Disable the suspend frame hotkeys
|
||||
(global-unset-key (kbd "C-z"))
|
||||
(global-unset-key (kbd "C-x C-z"))
|
||||
|
||||
;; dabbrev-expand. Seems to be some sort of dumb-expand. Accidentally hitting it when trying to use M-?
|
||||
(global-unset-key (kbd "M-/"))
|
||||
|
||||
(global-set-key (kbd "C-x g l") 'generate-vc-link)
|
||||
|
||||
(provide 'base-global-keys)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user