chore: centralise folders
1
files/config/.aspell.conf
Normal file
|
|
@ -0,0 +1 @@
|
|||
dict-dir /run/current-system/sw/lib/aspell
|
||||
62
files/emacs/early-init.el
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
(defvar swarsel-file-name-handler-alist file-name-handler-alist)
|
||||
(defvar swarsel-vc-handled-backends vc-handled-backends)
|
||||
|
||||
(setq gc-cons-threshold most-positive-fixnum
|
||||
gc-cons-percentage 0.6
|
||||
file-name-handler-alist nil
|
||||
vc-handled-backends nil)
|
||||
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
(progn
|
||||
(setq gc-cons-threshold (* 32 1024 1024)
|
||||
gc-cons-percentage 0.1
|
||||
jit-lock-defer-time 0.05
|
||||
read-process-output-max (* 1024 1024)
|
||||
file-name-handler-alist swarsel-file-name-handler-alist
|
||||
vc-handled-backends swarsel-vc-handled-backends)
|
||||
(fset 'epg-wait-for-status 'ignore)
|
||||
)))
|
||||
|
||||
(tool-bar-mode 0)
|
||||
(menu-bar-mode 0)
|
||||
(scroll-bar-mode 0)
|
||||
|
||||
(setq frame-inhibit-implied-resize t
|
||||
ring-bell-function 'ignore
|
||||
use-dialog-box nil
|
||||
use-file-dialog nil
|
||||
use-short-answers t
|
||||
inhibit-startup-message t
|
||||
inhibit-splash-screen t
|
||||
inhibit-startup-screen t
|
||||
inhibit-x-resources t
|
||||
inhibit-startup-buffer-menu t
|
||||
inhibit-startup-echo-area-message user-login-name ; this needs to be set to the username or it will not have an effect
|
||||
comp-deferred-compilation nil ; compile all Elisp to native code immediately
|
||||
)
|
||||
|
||||
(setq-default left-margin-width 1
|
||||
right-margin-width 1)
|
||||
|
||||
(setq-default default-frame-alist
|
||||
(append
|
||||
(list
|
||||
'(undecorated . t) ; no title bar, borders etc.
|
||||
'(background-color . "#1D252C") ; load doom-citylight colors to avoid white flash
|
||||
'(foreground-color . "#A0B3C5") ; load doom-citylight colors to avoid white flash
|
||||
'(vertical-scroll-bars . nil)
|
||||
'(horizontal-scroll-bars . nil)
|
||||
'(internal-border-width . 5)
|
||||
'(tool-bar-lines . 0)
|
||||
'(menu-bar-lines . 0))))
|
||||
|
||||
(add-hook
|
||||
'after-make-frame-functions
|
||||
(lambda (frame)
|
||||
(with-selected-frame frame
|
||||
(when (display-graphic-p)
|
||||
(define-key input-decode-map (kbd "C-i") [DUMMY-i])
|
||||
(define-key input-decode-map (kbd "C-[") [DUMMY-lsb])
|
||||
(define-key input-decode-map (kbd "C-m") [DUMMY-m])
|
||||
))))
|
||||
1697
files/emacs/init.el
Normal file
80
files/emacs/server.el
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
(require 'package)
|
||||
|
||||
(package-initialize nil)
|
||||
(setq package-enable-at-startup nil)
|
||||
|
||||
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
|
||||
|
||||
(add-to-list 'package-archives
|
||||
'("melpa" . "https://melpa.org/packages/") t)
|
||||
|
||||
|
||||
(package-initialize)
|
||||
|
||||
(let ((default-directory "~/.emacs.d/elpa/"))
|
||||
(normal-top-level-add-subdirs-to-load-path))
|
||||
|
||||
(unless (package-installed-p 'use-package)
|
||||
(package-refresh-contents)
|
||||
(package-install 'use-package))
|
||||
|
||||
(require 'use-package)
|
||||
|
||||
(use-package elfeed
|
||||
:ensure t
|
||||
:bind (:map elfeed-search-mode-map
|
||||
("q" . bjm/elfeed-save-db-and-bury)))
|
||||
|
||||
(require 'elfeed)
|
||||
|
||||
(use-package elfeed-org
|
||||
:ensure t
|
||||
:config
|
||||
(elfeed-org)
|
||||
(setq rmh-elfeed-org-files (list "/var/lib/syncthing/.elfeed/elfeed.org")))
|
||||
|
||||
(use-package elfeed-goodies
|
||||
:ensure t)
|
||||
|
||||
(elfeed-goodies/setup)
|
||||
|
||||
(use-package elfeed-web
|
||||
:ensure t)
|
||||
|
||||
(global-set-key (kbd "C-x w") 'bjm/elfeed-load-db-and-open)
|
||||
|
||||
(define-key elfeed-show-mode-map (kbd "j") 'elfeed-goodies/split-show-next)
|
||||
(define-key elfeed-show-mode-map (kbd "k") 'elfeed-goodies/split-show-prev)
|
||||
(define-key elfeed-search-mode-map (kbd "j") 'next-line)
|
||||
(define-key elfeed-search-mode-map (kbd "k") 'previous-line)
|
||||
(define-key elfeed-show-mode-map (kbd "S-SPC") 'scroll-down-command)
|
||||
|
||||
|
||||
(defun bjm/elfeed-save-db-and-bury ()
|
||||
"Wrapper to save the elfeed db to disk before burying buffer"
|
||||
(interactive)
|
||||
(elfeed-db-save)
|
||||
(quit-window))
|
||||
|
||||
(defun bjm/elfeed-load-db-and-open ()
|
||||
"Wrapper to load the elfeed db from disk before opening"
|
||||
(interactive)
|
||||
(elfeed-db-load)
|
||||
(elfeed)
|
||||
(elfeed-search-update--force)
|
||||
(elfeed-update))
|
||||
|
||||
(defun bjm/elfeed-updater ()
|
||||
"Wrapper to load the elfeed db from disk before opening"
|
||||
(interactive)
|
||||
(elfeed-db-load))
|
||||
|
||||
(run-with-timer 0 (* 1 60) 'bjm/elfeed-updater)
|
||||
|
||||
(setq httpd-port 9812)
|
||||
(setq httpd-host "0.0.0.0")
|
||||
(setq httpd-root "/root/.emacs.d/elpa/elfeed-web-20240729.1741/")
|
||||
(setq elfeed-db-directory "/var/lib/syncthing/.elfeed/db/")
|
||||
|
||||
(httpd-start)
|
||||
(elfeed-web-start)
|
||||
220
files/firefox/chrome/userChrome.css
Normal file
|
|
@ -0,0 +1,220 @@
|
|||
/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/autohide_toolbox.css made available under Mozilla Public License v. 2.0
|
||||
See the above repository for updates as well as full license text. */
|
||||
|
||||
/* Hide the whole toolbar area unless urlbar is focused or cursor is over the toolbar
|
||||
* Dimensions on non-Win10 OS probably needs to be adjusted.
|
||||
*/
|
||||
|
||||
:root{
|
||||
--uc-autohide-toolbox-delay: 0ms; /* Wait 0.1s before hiding toolbars */
|
||||
--uc-toolbox-rotation: 107deg; /* This may need to be lower on mac - like 75 or so */
|
||||
|
||||
--base00: #1D252C;
|
||||
--base01: #171D23;
|
||||
--base02: #5EC4FF;
|
||||
--base03: #566C7D;
|
||||
--base04: #5EC4FF;
|
||||
--base05: #A0B3C5;
|
||||
--base06: #C06ECE;
|
||||
--base07: #A0B3C5;
|
||||
--base08: #D95468;
|
||||
--base09: #FFA880;
|
||||
--base0A: #5EC4FF;
|
||||
--base0B: #8BD49C;
|
||||
--base0C: #008B94;
|
||||
--base0D: #5EC4FF;
|
||||
--base0E: #C06ECE;
|
||||
--base0F: #5EC4FF;
|
||||
|
||||
}
|
||||
|
||||
:root[sizemode="maximized"]{
|
||||
--uc-toolbox-rotation: 88.5deg;
|
||||
}
|
||||
|
||||
@media (-moz-platform: windows){
|
||||
:root:not([lwtheme]) #navigator-toolbox{ background-color: -moz-dialog !important; }
|
||||
}
|
||||
|
||||
:root[sizemode="fullscreen"],
|
||||
:root[sizemode="fullscreen"] #navigator-toolbox{ margin-top: 0 !important; }
|
||||
|
||||
#navigator-toolbox{
|
||||
--browser-area-z-index-toolbox: 3;
|
||||
position: fixed !important;
|
||||
background-color: var(--lwt-accent-color,black) !important;
|
||||
transition: transform 0ms linear, opacity 0ms linear !important;
|
||||
transition-delay: var(--uc-autohide-toolbox-delay) !important;
|
||||
transform-origin: top;
|
||||
transform: rotateX(var(--uc-toolbox-rotation));
|
||||
opacity: 0;
|
||||
line-height: 0;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
:root[sessionrestored] #urlbar[popover]{
|
||||
pointer-events: none;
|
||||
opacity: 0;
|
||||
transition: transform 0ms linear var(--uc-autohide-toolbox-delay), opacity 0ms calc(var(--uc-autohide-toolbox-delay) + 0ms);
|
||||
transform-origin: 0px calc(0px - var(--tab-min-height) - var(--tab-block-margin) * 2);
|
||||
transform: rotateX(89.9deg);
|
||||
}
|
||||
#mainPopupSet:has(> [panelopen]:not(#ask-chat-shortcuts)) ~ toolbox #urlbar[popover],
|
||||
#navigator-toolbox:is(:hover,:focus-within) #urlbar[popover],
|
||||
#urlbar-container > #urlbar[popover]:is([focused],[open]){
|
||||
pointer-events: auto;
|
||||
opacity: 1;
|
||||
transition-delay: 0ms;
|
||||
transform: rotateX(0deg);
|
||||
}
|
||||
#mainPopupSet:has(> [panelopen]:not(#ask-chat-shortcuts)) ~ toolbox,
|
||||
#navigator-toolbox:has(#urlbar:is([open],[focus-within])),
|
||||
#navigator-toolbox:hover,
|
||||
#navigator-toolbox:focus-within{
|
||||
transition-delay: 0ms !important;
|
||||
transform: rotateX(0);
|
||||
opacity: 1;
|
||||
}
|
||||
/* This makes things like OS menubar/taskbar show the toolbox when hovered in maximized windows.
|
||||
* Unfortunately it also means that other OS native surfaces (such as context menu on macos)
|
||||
* and other always-on-top applications will trigger toolbox to show up. */
|
||||
@media (-moz-bool-pref: "userchrome.autohide-toolbox.unhide-by-native-ui.enabled"){
|
||||
:root[sizemode="maximized"]:not(:hover){
|
||||
#navigator-toolbox:not(:-moz-window-inactive),
|
||||
#urlbar[popover]:not(:-moz-window-inactive){
|
||||
transition-delay: 0ms !important;
|
||||
transform: rotateX(0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#navigator-toolbox > *{ line-height: normal; pointer-events: auto }
|
||||
|
||||
#navigator-toolbox,
|
||||
#navigator-toolbox > *{
|
||||
width: 100vw;
|
||||
-moz-appearance: none !important;
|
||||
}
|
||||
|
||||
/* These two exist for oneliner compatibility */
|
||||
#nav-bar{ width: var(--uc-navigationbar-width,100vw) }
|
||||
#TabsToolbar
|
||||
{
|
||||
visibility: collapse;
|
||||
}
|
||||
/* Don't apply transform before window has been fully created */
|
||||
:root:not([sessionrestored]) #navigator-toolbox{ transform:none !important }
|
||||
|
||||
:root[customizing] #navigator-toolbox{
|
||||
position: relative !important;
|
||||
transform: none !important;
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
#navigator-toolbox[inFullscreen] > #PersonalToolbar,
|
||||
#PersonalToolbar[collapsed="true"]{ display: none }
|
||||
|
||||
/* Uncomment this if tabs toolbar is hidden with hide_tabs_toolbar.css */
|
||||
/*#titlebar{ margin-bottom: -9px }*/
|
||||
|
||||
/* Uncomment the following for compatibility with tabs_on_bottom.css - this isn't well tested though */
|
||||
/*
|
||||
#navigator-toolbox{ flex-direction: column; display: flex; }
|
||||
#titlebar{ order: 2 }
|
||||
*/
|
||||
#sidebar-header {
|
||||
display: none;
|
||||
}
|
||||
#sidebar-header {
|
||||
/* display: none; */
|
||||
visibility: collapse !important;
|
||||
}
|
||||
/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/autohide_sidebar.css made available under Mozilla Public License v. 2.0
|
||||
See the above repository for updates as well as full license text. */
|
||||
|
||||
/* Show sidebar only when the cursor is over it */
|
||||
/* The border controlling sidebar width will be removed so you'll need to modify these values to change width */
|
||||
|
||||
#sidebar-box{
|
||||
--uc-sidebar-width: 30px;
|
||||
--uc-sidebar-hover-width: 210px;
|
||||
--uc-autohide-sidebar-delay: 0ms; /* Wait 0.6s before hiding sidebar */
|
||||
--uc-autohide-transition-duration: 0ms;
|
||||
--uc-autohide-transition-type: linear;
|
||||
--browser-area-z-index-sidebar: 3;
|
||||
position: relative;
|
||||
min-width: var(--uc-sidebar-width) !important;
|
||||
width: var(--uc-sidebar-width) !important;
|
||||
max-width: var(--uc-sidebar-width) !important;
|
||||
z-index: var(--browser-area-z-index-sidebar,3);
|
||||
}
|
||||
#sidebar-box[positionend]{ direction: rtl }
|
||||
#sidebar-box[positionend] > *{ direction: ltr }
|
||||
|
||||
#sidebar-box[positionend]:-moz-locale-dir(rtl){ direction: ltr }
|
||||
#sidebar-box[positionend]:-moz-locale-dir(rtl) > *{ direction: rtl }
|
||||
|
||||
#main-window[sizemode="fullscreen"] #sidebar-box{ --uc-sidebar-width: 1px; }
|
||||
|
||||
#sidebar-splitter{ display: none }
|
||||
|
||||
#sidebar-header{
|
||||
overflow: hidden;
|
||||
color: var(--chrome-color, inherit) !important;
|
||||
padding-inline: 0 !important;
|
||||
}
|
||||
|
||||
#sidebar-header::before,
|
||||
#sidebar-header::after{
|
||||
content: "";
|
||||
display: flex;
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
||||
#sidebar-header,
|
||||
#sidebar{
|
||||
transition: min-width var(--uc-autohide-transition-duration) var(--uc-autohide-transition-type) var(--uc-autohide-sidebar-delay) !important;
|
||||
min-width: var(--uc-sidebar-width) !important;
|
||||
will-change: min-width;
|
||||
}
|
||||
#sidebar-box:hover > #sidebar-header,
|
||||
#sidebar-box:hover > #sidebar{
|
||||
min-width: var(--uc-sidebar-hover-width) !important;
|
||||
transition-delay: 0ms !important;
|
||||
}
|
||||
|
||||
.sidebar-panel{
|
||||
background-color: transparent !important;
|
||||
color: var(--newtab-text-primary-color) !important;
|
||||
}
|
||||
|
||||
.sidebar-panel #search-box{
|
||||
-moz-appearance: none !important;
|
||||
background-color: rgba(249,249,250,0.1) !important;
|
||||
color: inherit !important;
|
||||
}
|
||||
|
||||
/* Add sidebar divider and give it background */
|
||||
|
||||
#sidebar,
|
||||
#sidebar-header{
|
||||
background-color: inherit !important;
|
||||
border-inline: 1px solid rgb(80,80,80);
|
||||
border-inline-width: 0px 1px;
|
||||
}
|
||||
|
||||
#sidebar-box:not([positionend]) > :-moz-locale-dir(rtl),
|
||||
#sidebar-box[positionend] > *{
|
||||
border-inline-width: 1px 0px;
|
||||
}
|
||||
|
||||
/* Move statuspanel to the other side when sidebar is hovered so it doesn't get covered by sidebar */
|
||||
|
||||
#sidebar-box:not([positionend]):hover ~ #appcontent #statuspanel{
|
||||
inset-inline: auto 0px !important;
|
||||
}
|
||||
#sidebar-box:not([positionend]):hover ~ #appcontent #statuspanel-label{
|
||||
margin-inline: 0px !important;
|
||||
border-left-style: solid !important;
|
||||
}
|
||||
160
files/firefox/tridactyl/themes/swarsel.css
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
:root {
|
||||
|
||||
--base00: #1D252C;
|
||||
--base01: #171D23;
|
||||
--base02: #5EC4FF;
|
||||
--base03: #566C7D;
|
||||
--base04: #5EC4FF;
|
||||
--base05: #A0B3C5;
|
||||
--base06: #C06ECE;
|
||||
--base07: #A0B3C5;
|
||||
--base08: #D95468;
|
||||
--base09: #FFA880;
|
||||
--base0A: #5EC4FF;
|
||||
--base0B: #8BD49C;
|
||||
--base0C: #008B94;
|
||||
--base0D: #5EC4FF;
|
||||
--base0E: #C06ECE;
|
||||
--base0F: #5EC4FF;
|
||||
|
||||
--tridactyl-def-fg: var(--base02);
|
||||
--tridactyl-cmdl-bg: var(--base00);
|
||||
--tridactyl-cmdl-fg: var(--base0C);
|
||||
|
||||
--tridactyl-font-family: "San Francisco", sans-serif;
|
||||
|
||||
--tridactyl-cmdl-font-size: 1.5rem;
|
||||
--tridactyl-cmdl-line-height: 1.5;
|
||||
|
||||
--tridactyl-cmplt-option-height: 1.4em;
|
||||
--tridactyl-cmplt-font-size: var(--tridactyl-small-font-size);
|
||||
--tridactyl-cmplt-border-top: unset;
|
||||
|
||||
--tridactyl-status-font-size: 9px;
|
||||
--tridactyl-status-font-family: "Fira Code", monospace;
|
||||
--tridactyl-status-border: 1px var(--tridactyl-fg) solid;
|
||||
|
||||
--tridactyl-header-font-size: var(--tridactyl-small-font-size);
|
||||
--tridactyl-header-font-weight: 200;
|
||||
--tridactyl-header-border-bottom: unset;
|
||||
|
||||
--tridactyl-hintspan-font-size: var(--tridactyl-font-size);
|
||||
--tridactyl-hint-active-fg: none;
|
||||
|
||||
}
|
||||
|
||||
:root #command-line-holder {
|
||||
order: 1;
|
||||
border: 2px solid var(--tridactyl-cmdl-fg);
|
||||
color: var(--tridactyl-cmdl-bg);
|
||||
}
|
||||
|
||||
:root #tridactyl-input {
|
||||
width: 90%;
|
||||
padding: 1rem;
|
||||
color: var(--tridactyl-def-fg);
|
||||
}
|
||||
|
||||
:root #completions table {
|
||||
font-size: 0.8rem;
|
||||
font-weight: 200;
|
||||
border-spacing: 0;
|
||||
table-layout: fixed;
|
||||
padding: 1rem;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
:root #completions > div {
|
||||
max-height: calc(20 * var(--tridactyl-cmplt-option-height));
|
||||
min-height: calc(10 * var(--tridactyl-cmplt-option-height));
|
||||
}
|
||||
|
||||
/* COMPLETIONS */
|
||||
|
||||
:root #completions {
|
||||
font-weight: 200;
|
||||
order: 2;
|
||||
color: var(--tridactyl-def-fg);
|
||||
background: var(--tridactyl-cmdl-bg);
|
||||
|
||||
}
|
||||
|
||||
/* Olie doesn't know how CSS inheritance works */
|
||||
:root #completions .HistoryCompletionSource {
|
||||
max-height: unset;
|
||||
min-height: unset;
|
||||
}
|
||||
|
||||
:root #completions .HistoryCompletionSource table {
|
||||
width: 100%;
|
||||
font-size: 9pt;
|
||||
border-spacing: 0;
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
/* redundancy 2: redundancy 2: more redundancy */
|
||||
:root #completions .BmarkCompletionSource {
|
||||
max-height: unset;
|
||||
min-height: unset;
|
||||
}
|
||||
|
||||
:root #completions table tr { white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
:root #completions .url {
|
||||
background: var(--tridactyl-cmdl-bg);
|
||||
}
|
||||
|
||||
:root #completions .focused {
|
||||
background: #44391F;
|
||||
}
|
||||
:root #completions .focused .url {
|
||||
background: #44391F;
|
||||
}
|
||||
|
||||
:root #completions .BufferCompletionSource table {
|
||||
width: unset;
|
||||
font-size: unset;
|
||||
border-spacing: unset;
|
||||
table-layout: unset;
|
||||
}
|
||||
|
||||
:root #completions table tr {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
:root #completions .sectionHeader {
|
||||
background: unset;
|
||||
padding: 1rem !important;
|
||||
padding-left: unset;
|
||||
padding-bottom: 0.2rem;
|
||||
}
|
||||
|
||||
:root #cmdline_iframe {
|
||||
position: fixed !important;
|
||||
bottom: unset;
|
||||
top: 25% !important;
|
||||
left: 10% !important;
|
||||
z-index: 2147483647 !important;
|
||||
width: 80% !important;
|
||||
box-shadow: rgba(0, 0, 0, 0.5) 0px 0px 15px !important;
|
||||
}
|
||||
|
||||
:root .TridactylStatusIndicator {
|
||||
position: fixed !important;
|
||||
bottom: 0 !important;
|
||||
font-weight: 200 !important;
|
||||
padding: 0.8ex !important;
|
||||
}
|
||||
|
||||
/* #Shydactyl-normal { */
|
||||
/* border-color: green !important; */
|
||||
/* } */
|
||||
|
||||
/* #Shydactyl-insert { */
|
||||
/* border-color: yellow !important; */
|
||||
/* } */
|
||||
127
files/firefox/tridactyl/tridactylrc
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
sanitise tridactyllocal tridactylsync
|
||||
|
||||
colourscheme swarsel
|
||||
|
||||
" General Settings
|
||||
set update.lastchecktime 1720629386560
|
||||
set update.lastnaggedversion 1.24.1
|
||||
set update.nag true
|
||||
set update.nagwait 7
|
||||
set update.checkintervalsecs 86400
|
||||
set configversion 2.0
|
||||
set searchurls.no https://search.nixos.org/options?query=
|
||||
set searchurls.np https://search.nixos.org/packages?query=
|
||||
set searchurls.hm https://home-manager-options.extranix.com/?query=
|
||||
set searchurls.@c https://vbc.atlassian.net/wiki/search?text=
|
||||
set searchurls.@j https://vbc.atlassian.net/issues/?jql=textfields%20~%20%22%s*%22&wildcardFlag=true
|
||||
set completions.Tab.statusstylepretty true
|
||||
set hintfiltermode vimperator-reflow
|
||||
set hintnames numeric
|
||||
unbind --mode=hint <Space>
|
||||
|
||||
" Binds
|
||||
bind <C-m> buffer #
|
||||
bind gd tabdetach
|
||||
bind gD composite tabduplicate; tabdetach
|
||||
bind d composite tabprev; tabclose #
|
||||
bind D tabclose
|
||||
bind c hint
|
||||
bindurl ^http(s)?://www\.google\.com c hint -Jc [class="LC20lb MBeuO DKV0Md"],[class="YmvwI"],[class="YyVfkd"],[class="fl"]
|
||||
bindurl ^http(s)?://news\.ycombinator\.com c hint -Jc [class="titleline"],[class="age"]
|
||||
bindurl ^http(s)?://lobste\.rs c hint -Jc [class="u-url"],[class="comments_label"]
|
||||
bindurl ^http(s)?://www\.google\.com gi composite focusinput -l ; text.end_of_line
|
||||
|
||||
" Work
|
||||
command tab_or_tabopen jsb -p (async () => {let tabs = await browser.tabs.query({}); let tab = tabs.find(t => t.url.includes(JS_ARG)); if (tab) {browser.tabs.update(tab.id, { active: true });} else {tri.excmds.tabopen(JS_ARG);}})()
|
||||
|
||||
command tab_or_tabopen_local jsb -p (async () => {const currentWindow = await browser.windows.getCurrent(); const tabs = await browser.tabs.query({ windowId: currentWindow.id }); const tab = tabs.find(t => t.url.includes(JS_ARG)); if (tab) {browser.tabs.update(tab.id, { active: true });} else {tri.excmds.tabopen(JS_ARG);}})()
|
||||
|
||||
bind gwa tab_or_tabopen_local apic-impimba-1.m.imp.ac.at
|
||||
bind gwA tab_or_tabopen_local artifactory.imp.ac.at
|
||||
bind gwb tab_or_tabopen_local bitbucket.vbc.ac.at
|
||||
bind gwc tab_or_tabopen_local vbc.atlassian.net/wiki
|
||||
bind gwd tab_or_tabopen_local datadomain-impimba-2.imp.ac.at
|
||||
bind gwe tab_or_tabopen_local exivity.vbc.ac.at
|
||||
bind gwg tab_or_tabopen_local github.com
|
||||
bind gwG tab_or_tabopen_local goc.egi.eu
|
||||
bind gwh tab_or_tabopen_local jupyterhub.vbc.ac.at
|
||||
bind gwH tab_or_tabopen_local test-jupyterhub.vbc.ac.at
|
||||
bind gwj tab_or_tabopen_local jenkins.vbc.ac.at
|
||||
bind gwJ tab_or_tabopen_local test-jenkins.vbc.ac.at
|
||||
bind gwl tab_or_tabopen_local lucid.app
|
||||
bind gwm tab_or_tabopen_local monitoring.vbc.ac.at/grafana
|
||||
bind gwM tab_or_tabopen_local monitoring.vbc.ac.at/prometheus
|
||||
bind gwn tab_or_tabopen_local netbox.vbc.ac.at
|
||||
bind gwN tab_or_tabopen_local nap.imp.ac.at
|
||||
bind gwo tab_or_tabopen_local outlook.office.com
|
||||
bind gws tab_or_tabopen_local satellite.vbc.ac.at
|
||||
bind gwt tab_or_tabopen_local tower.vbc.ac.at
|
||||
bind gwv tab_or_tabopen_local vc-impimba-1.m.imp.ac.at/ui
|
||||
bind gwx tab_or_tabopen_local xclarity.vbc.ac.at
|
||||
|
||||
" Search in page
|
||||
set findcase smart
|
||||
bind / fillcmdline find
|
||||
bind ? fillcmdline find -?
|
||||
bind n findnext 1
|
||||
bind N findnext -1
|
||||
|
||||
bind j scrollline 4
|
||||
bind k scrollline -4
|
||||
|
||||
|
||||
" WARNING: This file defines and runs a command called fixamo_quiet. If you
|
||||
" also have a malicious addon that operates on `<all_urls>` installed this
|
||||
" will allow it to steal your firefox account credentials!
|
||||
"
|
||||
" With those credentials, an attacker can read anything in your sync account,
|
||||
" publish addons to the AMO, etc, etc.
|
||||
"
|
||||
" Without this command a malicious addon can steal credentials from any site
|
||||
" that you visit that is not in the restrictedDomains list.
|
||||
"
|
||||
" You should comment out the fixamo lines unless you are entirely sure that
|
||||
" they are what you want.
|
||||
command fixamo_quiet jsb tri.excmds.setpref("privacy.resistFingerprinting.block_mozAddonManager", "true").then(tri.excmds.setpref("extensions.webextensions.restrictedDomains", '""'))
|
||||
command fixamo js tri.excmds.setpref("privacy.resistFingerprinting.block_mozAddonManager", "true").then(tri.excmds.setpref("extensions.webextensions.restrictedDomains", '""').then(tri.excmds.fillcmdline_tmp(3000, "Permissions added to user.js. Please restart Firefox to make them take affect.")))
|
||||
|
||||
fixamo_quiet
|
||||
set allowautofocus false
|
||||
|
||||
" The following modification allows Tridactyl to function on more pages, e.g. raw GitHub pages.
|
||||
" You may not wish to run this. Mozilla strongly feels that you shouldn't.
|
||||
" Read https://wiki.mozilla.org/Security/CSP#Goals for more information.
|
||||
"
|
||||
" Equivalent to `set csp clobber` before it was removed.
|
||||
" This weakens your defences against cross-site-scripting attacks
|
||||
" and other types of code-injection by reducing the strictness
|
||||
" of Content Security Policy on all sites in a couple of ways.
|
||||
"
|
||||
" We remove the sandbox directive
|
||||
" https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/sandbox
|
||||
" which allows our iframe (and anyone else's) to run on any website.
|
||||
"
|
||||
" We weaken the style-src directive
|
||||
" https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src
|
||||
" to allow us to theme our elements.
|
||||
" This exposes you to 'cross site styling' attacks
|
||||
jsb browser.webRequest.onHeadersReceived.addListener(tri.request.clobberCSP,{urls:["<all_urls>"],types:["main_frame"]},["blocking","responseHeaders"])
|
||||
|
||||
" default is 300ms
|
||||
set hintdelay 100
|
||||
|
||||
" Some pages like github break on the tridactyl quick search. have this as a fallback
|
||||
unbind <C-f>
|
||||
|
||||
" Subconfig Settings
|
||||
seturl www.google.com followpagepatterns.next Next
|
||||
seturl www.google.com followpagepatterns.prev Previous
|
||||
|
||||
" Autocmds
|
||||
autocmd DocStart undefined mode ignore
|
||||
autocmd DocStart pokerogue.net mode ignore
|
||||
autocmd DocStart typelit.io mode ignore
|
||||
autocmd DocStart vc-impimba-1.m.imp.ac.at/ui/webconsole mode ignore
|
||||
|
||||
" For syntax highlighting see https://github.com/tridactyl/vim-tridactyl
|
||||
" vim: set filetype=tridactyl
|
||||
11
files/git/.gitmessage
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
|
||||
# max. 50 chars is here: #
|
||||
# <type>[optional scope]: <description>
|
||||
# types: feat, fix, build, chore, ci, docs, style, refactor, perf, test
|
||||
# ! indicates a breaking change.
|
||||
|
||||
|
||||
# Body: wrap at 72 chars is here: #
|
||||
# Include at least one empty line before co-authored. Format:
|
||||
# Co-authored-by: name <user@users.noreply.github.com>
|
||||
33
files/scripts/command-not-found.sh
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Adapted from https://github.com/bennofs/nix-index/blob/master/command-not-found.sh
|
||||
command_not_found_handle() {
|
||||
if [ -n "${MC_SID-}" ] || ! [ -t 1 ]; then
|
||||
>&2 echo "$1: command not found"
|
||||
return 127
|
||||
fi
|
||||
|
||||
echo -n "searching nix-index..."
|
||||
ATTRS=$(@nix-locate@ --minimal --no-group --type x --type s --top-level --whole-name --at-root "/bin/$1")
|
||||
|
||||
case $(echo -n "$ATTRS" | grep -c "^") in
|
||||
0)
|
||||
>&2 echo -ne "$(@tput@ el1)\r"
|
||||
>&2 echo "$1: command not found"
|
||||
;;
|
||||
*)
|
||||
>&2 echo -ne "$(@tput@ el1)\r"
|
||||
>&2 echo "The program ‘$(@tput@ setaf 4)$1$(@tput@ sgr0)’ is currently not installed."
|
||||
>&2 echo "It is provided by the following derivation(s):"
|
||||
while read -r ATTR; do
|
||||
ATTR=${ATTR%.out}
|
||||
>&2 echo " $(@tput@ setaf 12)nixpkgs#$(@tput@ setaf 4)$ATTR$(@tput@ sgr0)"
|
||||
done <<< "$ATTRS"
|
||||
;;
|
||||
esac
|
||||
|
||||
return 127
|
||||
}
|
||||
|
||||
command_not_found_handler() {
|
||||
command_not_found_handle "$@"
|
||||
return $?
|
||||
}
|
||||
5
files/scripts/devShell/benchmark
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
rm -rf build
|
||||
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release
|
||||
cmake --build build --target benchmark
|
||||
./build/benchmark/benchmark
|
||||
5
files/scripts/devShell/compile
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
rm -rf build
|
||||
cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug
|
||||
cmake --build build --target all
|
||||
ctest --test-dir build
|
||||
23
files/scripts/e.sh
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
wait=0
|
||||
while :; do
|
||||
case ${1:-} in
|
||||
-w | --wait)
|
||||
wait=1
|
||||
;;
|
||||
*) break ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
STR=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]) | select(.name == "__i3_scratch")' | grep kittyterm || true)
|
||||
if [ "$STR" == "" ]; then
|
||||
swaymsg '[title="kittyterm"]' scratchpad show
|
||||
emacsclient -c -a "" "$@"
|
||||
swaymsg '[title="kittyterm"]' scratchpad show
|
||||
else
|
||||
if [[ $wait -eq 0 ]]; then
|
||||
emacsclient -n -c -a "" "$@"
|
||||
else
|
||||
emacsclient -c -a "" "$@"
|
||||
fi
|
||||
fi
|
||||
20
files/scripts/fs-diff.sh
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
set -euo pipefail
|
||||
|
||||
OLD_TRANSID=$(sudo btrfs subvolume find-new /mnt/root-blank 9999999)
|
||||
OLD_TRANSID=${OLD_TRANSID#transid marker was }
|
||||
|
||||
sudo btrfs subvolume find-new "/mnt/root" "$OLD_TRANSID" |
|
||||
sed '$d' |
|
||||
cut -f17- -d' ' |
|
||||
sort |
|
||||
uniq |
|
||||
while read -r path; do
|
||||
path="/$path"
|
||||
if [ -L "$path" ]; then
|
||||
: # The path is a symbolic link, so is probably handled by NixOS already
|
||||
elif [ -d "$path" ]; then
|
||||
: # The path is a directory, ignore
|
||||
else
|
||||
echo "$path"
|
||||
fi
|
||||
done
|
||||
5
files/scripts/opacitytoggle.sh
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
if swaymsg opacity plus 0.01 -q; then
|
||||
swaymsg opacity 1
|
||||
else
|
||||
swaymsg opacity 0.95
|
||||
fi
|
||||
51
files/scripts/pass-fuzzel.sh
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# Adapted from https://code.kulupu.party/thesuess/home-manager/src/branch/main/modules/river.nix
|
||||
shopt -s nullglob globstar
|
||||
|
||||
otp=0
|
||||
typeit=0
|
||||
while :; do
|
||||
case ${1:-} in
|
||||
-t | --type)
|
||||
typeit=1
|
||||
;;
|
||||
-o | --otp)
|
||||
otp=1
|
||||
;;
|
||||
*) break ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
export PASSWORD_STORE_DIR=~/.local/share/password-store
|
||||
prefix=${PASSWORD_STORE_DIR-~/.local/share/password-store}
|
||||
if [[ $otp -eq 0 ]]; then
|
||||
password_files=("$prefix"/**/*.gpg)
|
||||
else
|
||||
password_files=("$prefix"/otp/**/*.gpg)
|
||||
fi
|
||||
password_files=("${password_files[@]#"$prefix"/}")
|
||||
password_files=("${password_files[@]%.gpg}")
|
||||
|
||||
password=$(printf '%s\n' "${password_files[@]}" | fuzzel --dmenu "$@")
|
||||
|
||||
[[ -n $password ]] || exit
|
||||
if [[ $otp -eq 0 ]]; then
|
||||
if [[ $typeit -eq 0 ]]; then
|
||||
pass show -c "$password" &> /tmp/pass-fuzzel
|
||||
else
|
||||
pass show "$password" | {
|
||||
IFS= read -r pass
|
||||
printf %s "$pass"
|
||||
} | wtype -
|
||||
fi
|
||||
else
|
||||
if [[ $typeit -eq 0 ]]; then
|
||||
pass otp -c "$password" &> /tmp/pass-fuzzel
|
||||
else
|
||||
pass otp "$password" | {
|
||||
IFS= read -r pass
|
||||
printf %s "$pass"
|
||||
} | wtype -
|
||||
fi
|
||||
fi
|
||||
notify-send -u critical -a pass -t 1000 "Copied/Typed Password"
|
||||
7
files/scripts/project.sh
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
set -euo pipefail
|
||||
|
||||
if [ ! -d "$(pwd)/.git" ]; then
|
||||
git init
|
||||
fi
|
||||
nix flake init --template "$FLAKE"#"$1"
|
||||
direnv allow
|
||||
23
files/scripts/screenshare.sh
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
headless="false"
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-h)
|
||||
headless="true"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option detected."
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
SHARESCREEN="$(nix eval --raw ~/.dotfiles#nixosConfigurations."$(hostname)".config.home-manager.users."$(whoami)".swarselsystems.sharescreen)"
|
||||
|
||||
if [[ $headless == "true" ]]; then
|
||||
wl-mirror "$SHARESCREEN"
|
||||
else
|
||||
wl-mirror "$SHARESCREEN" &
|
||||
sleep 0.1
|
||||
swaymsg '[app_id=at.yrlf.wl_mirror] move to workspace 14:T'
|
||||
swaymsg '[app_id=at.yrlf.wl_mirror] fullscreen'
|
||||
fi
|
||||
11
files/scripts/sshrm.sh
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
HISTFILE="$HOME"/.histfile
|
||||
|
||||
last_ssh_cmd=$(grep -E "ssh " "$HISTFILE" | sed -E 's/^: [0-9]+:[0-9]+;//' | grep "^ssh " | tail -1)
|
||||
host=$(echo "$last_ssh_cmd" | sed -E 's/.*ssh ([^@ ]+@)?([^ ]+).*/\2/')
|
||||
|
||||
if [[ -n $host ]]; then
|
||||
echo "Removing SSH host key for: $host"
|
||||
ssh-keygen -R "$host"
|
||||
else
|
||||
echo "No valid SSH command found in history."
|
||||
fi
|
||||
339
files/scripts/swarsel-bootstrap.sh
Normal file
|
|
@ -0,0 +1,339 @@
|
|||
# highly inspired by https://github.com/EmergentMind/nix-config/blob/dev/files/scripts/bootstrap-nixos.sh
|
||||
set -eo pipefail
|
||||
|
||||
target_hostname=""
|
||||
target_destination=""
|
||||
target_user="swarsel"
|
||||
ssh_port="22"
|
||||
persist_dir=""
|
||||
disk_encryption=0
|
||||
temp=$(mktemp -d)
|
||||
|
||||
function help_and_exit() {
|
||||
echo
|
||||
echo "Remotely installs SwarselSystem on a target machine including secret deployment."
|
||||
echo
|
||||
echo "USAGE: $0 -n <target_hostname> -d <target_destination> [OPTIONS]"
|
||||
echo
|
||||
echo "ARGS:"
|
||||
echo " -n <target_hostname> specify target_hostname of the target host to deploy the nixos config on."
|
||||
echo " -d <target_destination> specify ip or url to the target host."
|
||||
echo " target during install process."
|
||||
echo
|
||||
echo "OPTIONS:"
|
||||
echo " -u <target_user> specify target_user with sudo access. nix-config will be cloned to their home."
|
||||
echo " Default='${target_user}'."
|
||||
echo " --port <ssh_port> specify the ssh port to use for remote access. Default=${ssh_port}."
|
||||
echo " --debug Enable debug mode."
|
||||
echo " -h | --help Print this help."
|
||||
exit 0
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
rm -rf "$temp"
|
||||
}
|
||||
trap cleanup exit
|
||||
|
||||
function red() {
|
||||
echo -e "\x1B[31m[!] $1 \x1B[0m"
|
||||
if [ -n "${2-}" ]; then
|
||||
echo -e "\x1B[31m[!] $($2) \x1B[0m"
|
||||
fi
|
||||
}
|
||||
function green() {
|
||||
echo -e "\x1B[32m[+] $1 \x1B[0m"
|
||||
if [ -n "${2-}" ]; then
|
||||
echo -e "\x1B[32m[+] $($2) \x1B[0m"
|
||||
fi
|
||||
}
|
||||
function yellow() {
|
||||
echo -e "\x1B[33m[*] $1 \x1B[0m"
|
||||
if [ -n "${2-}" ]; then
|
||||
echo -e "\x1B[33m[*] $($2) \x1B[0m"
|
||||
fi
|
||||
}
|
||||
|
||||
function yes_or_no() {
|
||||
echo -en "\x1B[32m[+] $* [y/n] (default: y): \x1B[0m"
|
||||
while true; do
|
||||
read -rp "" yn
|
||||
yn=${yn:-y}
|
||||
case $yn in
|
||||
[Yy]*) return 0 ;;
|
||||
[Nn]*) return 1 ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function update_sops_file() {
|
||||
key_name=$1
|
||||
key_type=$2
|
||||
key=$3
|
||||
|
||||
if [ ! "$key_type" == "hosts" ] && [ ! "$key_type" == "users" ]; then
|
||||
red "Invalid key type passed to update_sops_file. Must be either 'hosts' or 'users'."
|
||||
exit 1
|
||||
fi
|
||||
cd "${git_root}"
|
||||
|
||||
SOPS_FILE=".sops.yaml"
|
||||
sed -i "{
|
||||
# Remove any * and & entries for this host
|
||||
/[*&]$key_name/ d;
|
||||
# Inject a new age: entry
|
||||
# n matches the first line following age: and p prints it, then we transform it while reusing the spacing
|
||||
/age:/{n; p; s/\(.*- \*\).*/\1$key_name/};
|
||||
# Inject a new hosts or user: entry
|
||||
/&$key_type/{n; p; s/\(.*- &\).*/\1$key_name $key/}
|
||||
}" $SOPS_FILE
|
||||
green "Updating .sops.yaml"
|
||||
cd -
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-n)
|
||||
shift
|
||||
target_hostname=$1
|
||||
;;
|
||||
-d)
|
||||
shift
|
||||
target_destination=$1
|
||||
;;
|
||||
-u)
|
||||
shift
|
||||
target_user=$1
|
||||
;;
|
||||
--port)
|
||||
shift
|
||||
ssh_port=$1
|
||||
;;
|
||||
--debug)
|
||||
set -x
|
||||
;;
|
||||
-h | --help) help_and_exit ;;
|
||||
*)
|
||||
echo "Invalid option detected."
|
||||
help_and_exit
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
green "~SwarselSystems~ remote installer"
|
||||
green "Reading system information for $target_hostname ..."
|
||||
|
||||
DISK="$(nix eval --raw ~/.dotfiles#nixosConfigurations."$target_hostname".config.swarselsystems.rootDisk)"
|
||||
green "Root Disk: $DISK"
|
||||
|
||||
CRYPTED="$(nix eval ~/.dotfiles#nixosConfigurations."$target_hostname".config.swarselsystems.isCrypted)"
|
||||
if [[ $CRYPTED == "true" ]]; then
|
||||
green "Encryption: ✓"
|
||||
disk_encryption=1
|
||||
else
|
||||
red "Encryption: X"
|
||||
disk_encryption=0
|
||||
fi
|
||||
|
||||
IMPERMANENCE="$(nix eval ~/.dotfiles#nixosConfigurations."$target_hostname".config.swarselsystems.isImpermanence)"
|
||||
if [[ $IMPERMANENCE == "true" ]]; then
|
||||
green "Impermanence: ✓"
|
||||
persist_dir="/persist"
|
||||
else
|
||||
red "Impermanence: X"
|
||||
persist_dir=""
|
||||
fi
|
||||
|
||||
SWAP="$(nix eval ~/.dotfiles#nixosConfigurations."$target_hostname".config.swarselsystems.isSwap)"
|
||||
if [[ $SWAP == "true" ]]; then
|
||||
green "Swap: ✓"
|
||||
else
|
||||
red "Swap: X"
|
||||
fi
|
||||
|
||||
SECUREBOOT="$(nix eval ~/.dotfiles#nixosConfigurations."$target_hostname".config.swarselsystems.isSecureBoot)"
|
||||
if [[ $SECUREBOOT == "true" ]]; then
|
||||
green "Secure Boot: ✓"
|
||||
else
|
||||
red "Secure Boot: X"
|
||||
fi
|
||||
|
||||
ssh_cmd="ssh -oport=${ssh_port} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -t $target_user@$target_destination"
|
||||
# ssh_root_cmd=$(echo "$ssh_cmd" | sed "s|${target_user}@|root@|") # uses @ in the sed switch to avoid it triggering on the $ssh_key value
|
||||
ssh_root_cmd=${ssh_cmd/${target_user}@/root@}
|
||||
scp_cmd="scp -oport=${ssh_port} -o StrictHostKeyChecking=no"
|
||||
|
||||
if [[ -z ${FLAKE} ]]; then
|
||||
FLAKE=/home/"$target_user"/.dotfiles
|
||||
fi
|
||||
if [ ! -d "$FLAKE" ]; then
|
||||
cd /home/"$target_user"
|
||||
yellow "Flake directory not found - cloning repository from GitHub"
|
||||
git clone git@github.com:Swarsel/.dotfiles.git || (yellow "Could not clone repository via SSH - defaulting to HTTPS" && git clone https://github.com/Swarsel/.dotfiles.git)
|
||||
FLAKE=/home/"$target_user"/.dotfiles
|
||||
fi
|
||||
|
||||
cd "$FLAKE"
|
||||
git_root=$(git rev-parse --show-toplevel)
|
||||
# ------------------------
|
||||
green "Wiping known_hosts of $target_destination"
|
||||
sed -i "/$target_hostname/d; /$target_destination/d" ~/.ssh/known_hosts
|
||||
# ------------------------
|
||||
green "Preparing a new ssh_host_ed25519_key pair for $target_hostname."
|
||||
# Create the directory where sshd expects to find the host keys
|
||||
install -d -m755 "$temp/$persist_dir/etc/ssh"
|
||||
# Generate host ssh key pair without a passphrase
|
||||
ssh-keygen -t ed25519 -f "$temp/$persist_dir/etc/ssh/ssh_host_ed25519_key" -C root@"$target_hostname" -N ""
|
||||
# Set the correct permissions so sshd will accept the key
|
||||
chmod 600 "$temp/$persist_dir/etc/ssh/ssh_host_ed25519_key"
|
||||
echo "Adding ssh host fingerprint at $target_destination to ~/.ssh/known_hosts"
|
||||
# This will fail if we already know the host, but that's fine
|
||||
ssh-keyscan -p "$ssh_port" "$target_destination" >> ~/.ssh/known_hosts || true
|
||||
# ------------------------
|
||||
# when using luks, disko expects a passphrase on /tmp/disko-password, so we set it for now and will update the passphrase later
|
||||
# via the config
|
||||
if [ "$disk_encryption" -eq 1 ]; then
|
||||
while true; do
|
||||
green "Set disk encryption passphrase:"
|
||||
read -rs luks_passphrase
|
||||
green "Please confirm passphrase:"
|
||||
read -rs luks_passphrase_confirm
|
||||
if [[ $luks_passphrase == "$luks_passphrase_confirm" ]]; then
|
||||
$ssh_root_cmd "/bin/sh -c 'echo $luks_passphrase > /tmp/disko-password'"
|
||||
break
|
||||
else
|
||||
red "Passwords do not match"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
# ------------------------
|
||||
green "Generating hardware-config.nix for $target_hostname and adding it to the nix-config."
|
||||
$ssh_root_cmd "nixos-generate-config --force --no-filesystems --root /mnt"
|
||||
|
||||
green "Injecting initialSetup"
|
||||
$ssh_root_cmd "sed -i '/ boot.extraModulePackages /a \ swarselsystems.initialSetup = true;' /mnt/etc/nixos/hardware-configuration.nix"
|
||||
|
||||
mkdir -p "$FLAKE"/hosts/nixos/"$target_hostname"
|
||||
$scp_cmd root@"$target_destination":/mnt/etc/nixos/hardware-configuration.nix "${git_root}"/hosts/nixos/"$target_hostname"/hardware-configuration.nix
|
||||
# ------------------------
|
||||
|
||||
green "Deploying minimal NixOS installation on $target_destination"
|
||||
SHELL=/bin/sh nix run github:nix-community/nixos-anywhere -- --ssh-port "$ssh_port" --extra-files "$temp" --flake .#"$target_hostname" root@"$target_destination"
|
||||
|
||||
echo "Updating ssh host fingerprint at $target_destination to ~/.ssh/known_hosts"
|
||||
ssh-keyscan -p "$ssh_port" "$target_destination" >> ~/.ssh/known_hosts || true
|
||||
# ------------------------
|
||||
|
||||
while true; do
|
||||
read -rp "Press Enter to continue once the remote host has finished booting."
|
||||
if nc -z "$target_destination" "${ssh_port}" 2> /dev/null; then
|
||||
green "$target_destination is booted. Continuing..."
|
||||
break
|
||||
else
|
||||
yellow "$target_destination is not yet ready."
|
||||
fi
|
||||
done
|
||||
|
||||
# ------------------------
|
||||
|
||||
if [[ $SECUREBOOT == "true" ]]; then
|
||||
green "Setting up secure boot keys"
|
||||
$ssh_root_cmd "mkdir -p /var/lib/sbctl"
|
||||
read -ra scp_call <<< "${scp_cmd}"
|
||||
sudo "${scp_call[@]}" -r /var/lib/sbctl root@"$target_destination":/var/lib/
|
||||
$ssh_root_cmd "sbctl enroll-keys --ignore-immutable --microsoft || true"
|
||||
fi
|
||||
# ------------------------
|
||||
green "Disabling initialSetup"
|
||||
sed -i '/swarselsystems\.initialSetup = true;/d' "$git_root"/hosts/nixos/"$target_hostname"/hardware-configuration.nix
|
||||
|
||||
if [ -n "$persist_dir" ]; then
|
||||
$ssh_root_cmd "cp /etc/machine-id $persist_dir/etc/machine-id || true"
|
||||
$ssh_root_cmd "cp -R /etc/ssh/ $persist_dir/etc/ssh/ || true"
|
||||
fi
|
||||
# ------------------------
|
||||
green "Generating an age key based on the new ssh_host_ed25519_key."
|
||||
target_key=$(
|
||||
ssh-keyscan -p "$ssh_port" -t ssh-ed25519 "$target_destination" 2>&1 |
|
||||
grep ssh-ed25519 |
|
||||
cut -f2- -d" " ||
|
||||
(
|
||||
red "Failed to get ssh key. Host down?"
|
||||
exit 1
|
||||
)
|
||||
)
|
||||
host_age_key=$(nix shell nixpkgs#ssh-to-age.out -c sh -c "echo $target_key | ssh-to-age")
|
||||
|
||||
if grep -qv '^age1' <<< "$host_age_key"; then
|
||||
red "The result from generated age key does not match the expected format."
|
||||
yellow "Result: $host_age_key"
|
||||
yellow "Expected format: age1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
exit 1
|
||||
else
|
||||
echo "$host_age_key"
|
||||
fi
|
||||
|
||||
green "Updating nix-secrets/.sops.yaml"
|
||||
update_sops_file "$target_hostname" "hosts" "$host_age_key"
|
||||
yellow ".sops.yaml has been updated. There may be superfluous entries, you might need to edit manually."
|
||||
if yes_or_no "Do you want to manually edit .sops.yaml now?"; then
|
||||
vim "${git_root}"/.sops.yaml
|
||||
fi
|
||||
green "Updating all secrets files to reflect updates .sops.yaml"
|
||||
sops updatekeys --yes --enable-local-keyservice "${git_root}"/secrets/*/secrets.yaml
|
||||
# --------------------------
|
||||
green "Making ssh_host_ed25519_key available to home-manager for user $target_user"
|
||||
sed -i "/$target_hostname/d; /$target_destination/d" ~/.ssh/known_hosts
|
||||
$scp_cmd root@"$target_destination":/etc/ssh/ssh_host_ed25519_key root@"$target_destination":/home/"$target_user"/.ssh/ssh_host_ed25519_key
|
||||
$ssh_root_cmd "mkdir -p /home/$target_user/.ssh; chown $target_user:users /home/$target_user/.ssh/ssh_host_ed25519_key"
|
||||
# __________________________
|
||||
|
||||
if yes_or_no "Add ssh host fingerprints for git upstream repositories? (This is needed for building the full config)"; then
|
||||
green "Adding ssh host fingerprints for git{lab,hub}"
|
||||
$ssh_cmd "mkdir -p /home/$target_user/.ssh/; ssh-keyscan -t ssh-ed25519 gitlab.com github.com swagit.swarsel.win >> /home/$target_user/.ssh/known_hosts"
|
||||
$ssh_root_cmd "mkdir -p /root/.ssh/; ssh-keyscan -t ssh-ed25519 gitlab.com github.com swagit.swarsel.win >> /root/.ssh/known_hosts"
|
||||
fi
|
||||
# --------------------------
|
||||
|
||||
if yes_or_no "Do you want to copy your full nix-config and nix-secrets to $target_hostname?"; then
|
||||
green "Adding ssh host fingerprint at $target_destination to ~/.ssh/known_hosts"
|
||||
ssh-keyscan -p "$ssh_port" "$target_destination" >> ~/.ssh/known_hosts || true
|
||||
green "Copying full nix-config to $target_hostname"
|
||||
cd "${git_root}"
|
||||
just sync "$target_user" "$target_destination"
|
||||
|
||||
if [ -n "$persist_dir" ]; then
|
||||
$ssh_root_cmd "cp -r /home/$target_user/.dotfiles $persist_dir/.dotfiles || true"
|
||||
$ssh_root_cmd "cp -r /home/$target_user/.ssh $persist_dir/.ssh || true"
|
||||
fi
|
||||
|
||||
if yes_or_no "Do you want to rebuild immediately?"; then
|
||||
green "Rebuilding nix-config on $target_hostname"
|
||||
yellow "Reminder: The password is 'setup'"
|
||||
$ssh_root_cmd "mkdir -p /root/.local/share/nix/; printf '{\"extra-substituters\":{\"https://nix-community.cachix.org\":true,\"https://nix-community.cachix.org https://cache.ngi0.nixos.org/\":true},\"extra-trusted-public-keys\":{\"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=\":true,\"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= cache.ngi0.nixos.org-1:KqH5CBLNSyX184S9BKZJo1LxrxJ9ltnY2uAs5c/f1MA=\":true}}' > /root/.local/share/nix/trusted-settings.json"
|
||||
$ssh_cmd -oForwardAgent=yes "cd .dotfiles && sudo nixos-rebuild --show-trace --flake .#$target_hostname switch"
|
||||
fi
|
||||
else
|
||||
echo
|
||||
green "NixOS was successfully installed!"
|
||||
echo "Post-install config build instructions:"
|
||||
echo "To copy nix-config from this machine to the $target_hostname, run the following command from ~/nix-config"
|
||||
echo "just sync $target_user $target_destination"
|
||||
echo "To rebuild, sign into $target_hostname and run the following command from ~/nix-config"
|
||||
echo "cd nix-config"
|
||||
# see above FIXME:(bootstrap)
|
||||
echo "sudo nixos-rebuild --show-trace --flake .#$target_hostname switch"
|
||||
# echo "just rebuild"
|
||||
echo
|
||||
fi
|
||||
|
||||
if yes_or_no "You can now commit and push the nix-config, which includes the hardware-configuration.nix for $target_hostname?"; then
|
||||
cd "${git_root}"
|
||||
deadnix hosts/nixos/"$target_hostname"/hardware-configuration.nix -qe
|
||||
nixpkgs-fmt hosts/nixos/"$target_hostname"/hardware-configuration.nix
|
||||
(pre-commit run --all-files 2> /dev/null || true) &&
|
||||
git add "$git_root/hosts/nixos/$target_hostname/hardware-configuration.nix" &&
|
||||
git add "$git_root/.sops.yaml" &&
|
||||
git add "$git_root/secrets" &&
|
||||
(git commit -m "feat: deployed $target_hostname" || true) && git push
|
||||
fi
|
||||
2
files/scripts/swarsel-displaypower.sh
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
swaymsg "output * power on" > /dev/null 2>&1 || true
|
||||
swaymsg "output * dpms on" > /dev/null 2>&1 || true
|
||||
201
files/scripts/swarsel-install.sh
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
set -eo pipefail
|
||||
|
||||
target_config="chaostheatre"
|
||||
target_hostname="chaostheatre"
|
||||
target_user="swarsel"
|
||||
persist_dir=""
|
||||
target_disk="/dev/vda"
|
||||
disk_encryption=0
|
||||
|
||||
function help_and_exit() {
|
||||
echo
|
||||
echo "Locally installs SwarselSystem on this machine."
|
||||
echo
|
||||
echo "USAGE: $0 -n <target_config> -d <target_disk> [OPTIONS]"
|
||||
echo
|
||||
echo "ARGS:"
|
||||
echo " -n <target_config> specify the nixos config to deploy."
|
||||
echo " Default: chaostheatre"
|
||||
echo " -d <target_disk> specify disk to install on."
|
||||
echo " Default: /dev/vda"
|
||||
echo " -u <target_user> specify user to deploy for."
|
||||
echo " Default: swarsel"
|
||||
echo " -h | --help Print this help."
|
||||
exit 0
|
||||
}
|
||||
|
||||
function red() {
|
||||
echo -e "\x1B[31m[!] $1 \x1B[0m"
|
||||
if [ -n "${2-}" ]; then
|
||||
echo -e "\x1B[31m[!] $($2) \x1B[0m"
|
||||
fi
|
||||
}
|
||||
function green() {
|
||||
echo -e "\x1B[32m[+] $1 \x1B[0m"
|
||||
if [ -n "${2-}" ]; then
|
||||
echo -e "\x1B[32m[+] $($2) \x1B[0m"
|
||||
fi
|
||||
}
|
||||
function yellow() {
|
||||
echo -e "\x1B[33m[*] $1 \x1B[0m"
|
||||
if [ -n "${2-}" ]; then
|
||||
echo -e "\x1B[33m[*] $($2) \x1B[0m"
|
||||
fi
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-n)
|
||||
shift
|
||||
target_config=$1
|
||||
target_hostname=$1
|
||||
;;
|
||||
-u)
|
||||
shift
|
||||
target_user=$1
|
||||
;;
|
||||
-d)
|
||||
shift
|
||||
target_disk=$1
|
||||
;;
|
||||
-h | --help) help_and_exit ;;
|
||||
*)
|
||||
echo "Invalid option detected."
|
||||
help_and_exit
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
function cleanup() {
|
||||
sudo rm -rf .cache/nix
|
||||
sudo rm -rf /root/.cache/nix
|
||||
}
|
||||
trap cleanup exit
|
||||
|
||||
green "~SwarselSystems~ local installer"
|
||||
|
||||
cd /home/"$target_user"
|
||||
|
||||
sudo rm -rf /root/.cache/nix
|
||||
sudo rm -rf .cache/nix
|
||||
sudo rm -rf .dotfiles
|
||||
|
||||
green "Cloning repository from GitHub"
|
||||
git clone https://github.com/Swarsel/.dotfiles.git
|
||||
|
||||
local_keys=$(ssh-add -L || true)
|
||||
pub_key=$(cat /home/"$target_user"/.dotfiles/secrets/keys/ssh/yubikey.pub)
|
||||
read -ra pub_arr <<< "$pub_key"
|
||||
|
||||
cd .dotfiles
|
||||
if [[ $local_keys != *"${pub_arr[1]}"* ]]; then
|
||||
yellow "The ssh key for this configuration is not available."
|
||||
green "Adjusting flake.nix so that the configuration is buildable ..."
|
||||
sed -i '/nix-secrets = {/,/^[[:space:]]*};/d' flake.nix
|
||||
sed -i '/vbc-nix = {/,/^[[:space:]]*};/d' flake.nix
|
||||
sed -i '/[[:space:]]*\/\/ (inputs.vbc-nix.overlays.default final prev)/d' overlays/default.nix
|
||||
rm modules/home/common/env.nix
|
||||
rm modules/home/common/gammastep.nix
|
||||
rm modules/home/common/git.nix
|
||||
rm modules/home/common/mail.nix
|
||||
rm modules/home/common/yubikey.nix
|
||||
rm modules/nixos/server/restic.nix
|
||||
rm hosts/nixos/sync/default.nix
|
||||
rm -rf modules/nixos/server
|
||||
rm -rf modules/home/server
|
||||
cat > hosts/nixos/chaostheatre/options-home.nix << EOF
|
||||
{ self, lib, ... }:
|
||||
{
|
||||
options = {
|
||||
swarselsystems = {
|
||||
modules = {
|
||||
yubikey = lib.mkEnableOption "dummy option for chaostheatre";
|
||||
env = lib.mkEnableOption "dummy option for chaostheatre";
|
||||
git = lib.mkEnableOption "dummy option for chaostheatre";
|
||||
mail = lib.mkEnableOption "dummy option for chaostheatre";
|
||||
gammastep = lib.mkEnableOption "dummy option for chaostheatre";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
EOF
|
||||
nix flake update vbc-nix
|
||||
git add .
|
||||
else
|
||||
green "Valid SSH key found! Continuing with installation"
|
||||
fi
|
||||
|
||||
green "Reading system information for $target_config ..."
|
||||
DISK="$(nix eval --raw ~/.dotfiles#nixosConfigurations."$target_hostname".config.swarselsystems.rootDisk)"
|
||||
green "Root Disk in config: $DISK - Root Disk passed in cli: $target_disk"
|
||||
|
||||
CRYPTED="$(nix eval ~/.dotfiles#nixosConfigurations."$target_hostname".config.swarselsystems.isCrypted)"
|
||||
if [[ $CRYPTED == "true" ]]; then
|
||||
green "Encryption: ✓"
|
||||
disk_encryption=1
|
||||
else
|
||||
red "Encryption: X"
|
||||
disk_encryption=0
|
||||
fi
|
||||
|
||||
IMPERMANENCE="$(nix eval ~/.dotfiles#nixosConfigurations."$target_hostname".config.swarselsystems.isImpermanence)"
|
||||
if [[ $IMPERMANENCE == "true" ]]; then
|
||||
green "Impermanence: ✓"
|
||||
persist_dir="/persist"
|
||||
else
|
||||
red "Impermanence: X"
|
||||
persist_dir=""
|
||||
fi
|
||||
|
||||
SWAP="$(nix eval ~/.dotfiles#nixosConfigurations."$target_hostname".config.swarselsystems.isSwap)"
|
||||
if [[ $SWAP == "true" ]]; then
|
||||
green "Swap: ✓"
|
||||
else
|
||||
red "Swap: X"
|
||||
fi
|
||||
|
||||
SECUREBOOT="$(nix eval ~/.dotfiles#nixosConfigurations."$target_hostname".config.swarselsystems.isSecureBoot)"
|
||||
if [[ $SECUREBOOT == "true" ]]; then
|
||||
green "Secure Boot: ✓"
|
||||
else
|
||||
red "Secure Boot: X"
|
||||
fi
|
||||
|
||||
if [ "$disk_encryption" -eq 1 ]; then
|
||||
while true; do
|
||||
green "Set disk encryption passphrase:"
|
||||
read -rs luks_passphrase
|
||||
green "Please confirm passphrase:"
|
||||
read -rs luks_passphrase_confirm
|
||||
if [[ $luks_passphrase == "$luks_passphrase_confirm" ]]; then
|
||||
echo "$luks_passphrase" > /tmp/disko-password
|
||||
break
|
||||
else
|
||||
red "Passwords do not match"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
green "Setting up disk ..."
|
||||
if [[ $target_config == "chaostheatre" ]]; then
|
||||
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/v1.10.0 -- --mode destroy,format,mount --flake .#"$target_config" --yes-wipe-all-disks --arg diskDevice "$target_disk"
|
||||
else
|
||||
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode destroy,format,mount --flake .#"$target_config" --yes-wipe-all-disks
|
||||
fi
|
||||
sudo mkdir -p /mnt/"$persist_dir"/home/"$target_user"/
|
||||
sudo cp -r /home/"$target_user"/.dotfiles /mnt/"$persist_dir"/home/"$target_user"/
|
||||
sudo chown -R 1000:100 /mnt/"$persist_dir"/home/"$target_user"
|
||||
|
||||
green "Generating hardware configuration ..."
|
||||
sudo nixos-generate-config --root /mnt --no-filesystems --dir /home/"$target_user"/.dotfiles/hosts/nixos/"$target_config"/
|
||||
|
||||
green "Injecting initialSetup ..."
|
||||
sudo sed -i '/ boot.extraModulePackages /a \ swarselsystems.initialSetup = true;' /home/"$target_user"/.dotfiles/hosts/nixos/"$target_config"/hardware-configuration.nix
|
||||
|
||||
git add /home/"$target_user"/.dotfiles/hosts/nixos/"$target_config"/hardware-configuration.nix
|
||||
sudo mkdir -p /root/.local/share/nix/
|
||||
printf '{\"extra-substituters\":{\"https://nix-community.cachix.org\":true,\"https://nix-community.cachix.org https://cache.ngi0.nixos.org/\":true},\"extra-trusted-public-keys\":{\"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=\":true,\"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= cache.ngi0.nixos.org-1:KqH5CBLNSyX184S9BKZJo1LxrxJ9ltnY2uAs5c/f1MA=\":true}}' | sudo tee /root/.local/share/nix/trusted-settings.json > /dev/null
|
||||
green "Installing flake $target_config"
|
||||
sudo nixos-install --flake .#"$target_config"
|
||||
green "Installation finished! Reboot to see changes"
|
||||
74
files/scripts/swarsel-postinstall.sh
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
set -eo pipefail
|
||||
|
||||
target_config="chaostheatre"
|
||||
target_user="swarsel"
|
||||
|
||||
function help_and_exit() {
|
||||
echo
|
||||
echo "Locally installs SwarselSystem on this machine."
|
||||
echo
|
||||
echo "USAGE: $0 -d <disk> [OPTIONS]"
|
||||
echo
|
||||
echo "ARGS:"
|
||||
echo " -d <disk> specify disk to install on."
|
||||
echo " -n <target_config> specify the nixos config to deploy."
|
||||
echo " Default: chaostheatre"
|
||||
echo " Default: chaostheatre"
|
||||
echo " -u <target_user> specify user to deploy for."
|
||||
echo " Default: swarsel"
|
||||
echo " -h | --help Print this help."
|
||||
exit 0
|
||||
}
|
||||
|
||||
function green() {
|
||||
echo -e "\x1B[32m[+] $1 \x1B[0m"
|
||||
if [ -n "${2-}" ]; then
|
||||
echo -e "\x1B[32m[+] $($2) \x1B[0m"
|
||||
fi
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-n)
|
||||
shift
|
||||
target_config=$1
|
||||
;;
|
||||
-u)
|
||||
shift
|
||||
target_user=$1
|
||||
;;
|
||||
-h | --help) help_and_exit ;;
|
||||
*)
|
||||
echo "Invalid option detected."
|
||||
help_and_exit
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
function cleanup() {
|
||||
sudo rm -rf .cache/nix
|
||||
sudo rm -rf /root/.cache/nix
|
||||
}
|
||||
trap cleanup exit
|
||||
|
||||
sudo rm -rf .cache/nix
|
||||
sudo rm -rf /root/.cache/nix
|
||||
|
||||
green "~SwarselSystems~ remote post-installer"
|
||||
|
||||
cd /home/"$target_user"/.dotfiles
|
||||
|
||||
SECUREBOOT="$(nix eval ~/.dotfiles#nixosConfigurations."$target_config".config.swarselsystems.isSecureBoot)"
|
||||
|
||||
if [[ $SECUREBOOT == "true" ]]; then
|
||||
green "Setting up secure boot keys"
|
||||
sudo mkdir -p /var/lib/sbctl
|
||||
sbctl create-keys || true
|
||||
sbctl enroll-keys --ignore-immutable --microsoft || true
|
||||
fi
|
||||
|
||||
green "Disabling initialSetup"
|
||||
sed -i '/swarselsystems\.initialSetup = true;/d' /home/"$target_user"/.dotfiles/hosts/nixos/"$target_config"/hardware-configuration.nix
|
||||
sudo nixos-rebuild --flake .#"$target_config" switch
|
||||
green "Post-install finished!"
|
||||
99
files/scripts/swarsel-rebuild.sh
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
set -eo pipefail
|
||||
|
||||
target_config="chaostheatre"
|
||||
target_user="swarsel"
|
||||
|
||||
function help_and_exit() {
|
||||
echo
|
||||
echo "Builds SwarselSystem configuration."
|
||||
echo
|
||||
echo "USAGE: $0 [OPTIONS]"
|
||||
echo
|
||||
echo "ARGS:"
|
||||
echo " -n <target_config> specify nixos config to build."
|
||||
echo " Default: chaostheatre"
|
||||
echo " -u <target_user> specify user to deploy for."
|
||||
echo " Default: swarsel"
|
||||
echo " -h | --help Print this help."
|
||||
exit 0
|
||||
}
|
||||
|
||||
function red() {
|
||||
echo -e "\x1B[31m[!] $1 \x1B[0m"
|
||||
if [ -n "${2-}" ]; then
|
||||
echo -e "\x1B[31m[!] $($2) \x1B[0m"
|
||||
fi
|
||||
}
|
||||
function green() {
|
||||
echo -e "\x1B[32m[+] $1 \x1B[0m"
|
||||
if [ -n "${2-}" ]; then
|
||||
echo -e "\x1B[32m[+] $($2) \x1B[0m"
|
||||
fi
|
||||
}
|
||||
function yellow() {
|
||||
echo -e "\x1B[33m[*] $1 \x1B[0m"
|
||||
if [ -n "${2-}" ]; then
|
||||
echo -e "\x1B[33m[*] $($2) \x1B[0m"
|
||||
fi
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-n)
|
||||
shift
|
||||
target_config=$1
|
||||
;;
|
||||
-u)
|
||||
shift
|
||||
target_user=$1
|
||||
;;
|
||||
-h | --help) help_and_exit ;;
|
||||
*)
|
||||
echo "Invalid option detected."
|
||||
help_and_exit
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
cd /home/"$target_user"
|
||||
|
||||
if [ ! -d /home/"$target_user"/.dotfiles ]; then
|
||||
green "Cloning repository from GitHub"
|
||||
git clone https://github.com/Swarsel/.dotfiles.git
|
||||
else
|
||||
red "A .dotfiles repository is in the way. Please (re-)move the repository and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local_keys=$(ssh-add -L || true)
|
||||
pub_key=$(cat /home/"$target_user"/.dotfiles/secrets/keys/ssh/yubikey.pub)
|
||||
read -ra pub_arr <<< "$pub_key"
|
||||
|
||||
cd .dotfiles
|
||||
if [[ $local_keys != *"${pub_arr[1]}"* ]]; then
|
||||
yellow "The ssh key for this configuration is not available."
|
||||
green "Adjusting flake.nix so that the configuration is buildable"
|
||||
sed -i '/nix-secrets = {/,/^[[:space:]]*};/d' flake.nix
|
||||
sed -i '/vbc-nix = {/,/^[[:space:]]*};/d' flake.nix
|
||||
sed -i '/[[:space:]]*\/\/ (inputs.vbc-nix.overlays.default final prev)/d' overlays/default.nix
|
||||
rm modules/home/common/env.nix
|
||||
rm modules/home/common/gammastep.nix
|
||||
rm modules/home/common/git.nix
|
||||
rm modules/home/common/mail.nix
|
||||
rm modules/home/common/yubikey.nix
|
||||
rm modules/nixos/server/restic.nix
|
||||
rm hosts/nixos/sync/default.nix
|
||||
rm -rf modules/nixos/server
|
||||
rm -rf modules/home/server
|
||||
nix flake update vbc-nix
|
||||
git add .
|
||||
else
|
||||
green "Valid SSH key found! Continuing with installation"
|
||||
fi
|
||||
sudo nixos-generate-config --dir /home/"$target_user"/.dotfiles/hosts/nixos/"$target_config"/
|
||||
git add /home/"$target_user"/.dotfiles/hosts/nixos/"$target_config"/hardware-configuration.nix
|
||||
|
||||
green "Installing flake $target_config"
|
||||
sudo nixos-rebuild --show-trace --flake .#"$target_config" boot
|
||||
yellow "Please keep in mind that this is only a demo of the configuration. Things might break unexpectedly."
|
||||
62
files/scripts/swarselcheck.sh
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
kitty=0
|
||||
element=0
|
||||
vesktop=0
|
||||
spotifyplayer=0
|
||||
while :; do
|
||||
case ${1:-} in
|
||||
-k | --kitty)
|
||||
kitty=1
|
||||
;;
|
||||
-e | --element)
|
||||
element=1
|
||||
;;
|
||||
-d | --vesktop)
|
||||
vesktop=1
|
||||
;;
|
||||
-s | --spotifyplayer)
|
||||
spotifyplayer=1
|
||||
;;
|
||||
*) break ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [[ $kitty -eq 1 ]]; then
|
||||
STR=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]) | select(.name == "__i3_scratch")' | grep kittyterm || true)
|
||||
CHECK=$(swaymsg -t get_tree | grep kittyterm || true)
|
||||
if [ "$CHECK" == "" ]; then
|
||||
exec kitty -T kittyterm -o confirm_os_window_close=0 zellij attach --create kittyterm &
|
||||
sleep 1
|
||||
fi
|
||||
if [ "$STR" == "" ]; then
|
||||
exec swaymsg '[title="kittyterm"]' scratchpad show
|
||||
else
|
||||
exec swaymsg '[title="kittyterm"]' scratchpad show
|
||||
fi
|
||||
elif [[ $element -eq 1 ]]; then
|
||||
STR=$(swaymsg -t get_tree | grep Element || true)
|
||||
if [ "$STR" == "" ]; then
|
||||
exec element-desktop
|
||||
else
|
||||
exec swaymsg '[app_id=Element]' kill
|
||||
fi
|
||||
elif [[ $vesktop -eq 1 ]]; then
|
||||
STR=$(swaymsg -t get_tree | grep vesktop || true)
|
||||
if [ "$STR" == "" ]; then
|
||||
exec vesktop
|
||||
else
|
||||
exec swaymsg '[app_id=vesktop]' kill
|
||||
fi
|
||||
elif [[ $spotifyplayer -eq 1 ]]; then
|
||||
STR=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]) | select(.name == "__i3_scratch")' | grep spotifytui || true)
|
||||
CHECK=$(swaymsg -t get_tree | grep spotifytui || true)
|
||||
if [ "$CHECK" == "" ]; then
|
||||
exec kitty -T spotifytui -o confirm_os_window_close=0 spotify_player &
|
||||
sleep 1
|
||||
fi
|
||||
if [ "$STR" == "" ]; then
|
||||
exec swaymsg '[title="spotifytui"]' scratchpad show
|
||||
else
|
||||
exec swaymsg '[title="spotifytui"]' scratchpad show
|
||||
fi
|
||||
fi
|
||||
7
files/scripts/swarselzellij.sh
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
KITTIES=$(($(pgrep -P 1 kitty | wc -l) - 1))
|
||||
|
||||
if ((KITTIES < 1)); then
|
||||
exec kitty -o confirm_os_window_close=0 zellij attach --create main
|
||||
else
|
||||
exec kitty -o confirm_os_window_close=0 zellij attach --create "temp $KITTIES"
|
||||
fi
|
||||
24
files/scripts/waybarupdate.sh
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
CFG=$(git --git-dir="$HOME"/.dotfiles/.git --work-tree="$HOME"/.dotfiles/ status -s | wc -l)
|
||||
CSE=$(git --git-dir="$DOCUMENT_DIR_PRIV"/CSE_TUWIEN/.git --work-tree="$DOCUMENT_DIR_PRIV"/CSE_TUWIEN/ status -s | wc -l)
|
||||
PASS=$(($(git --git-dir="$HOME"/.local/share/password-store/.git --work-tree="$HOME"/.local/share/password-store/ status -s | wc -l) + $(git --git-dir="$HOME"/.local/share/password-store/.git --work-tree="$HOME"/.local/share/password-store/ diff origin/main..HEAD | wc -l)))
|
||||
|
||||
if [[ $CFG != 0 ]]; then
|
||||
CFG_STR='CONFIG'
|
||||
else
|
||||
CFG_STR=''
|
||||
fi
|
||||
|
||||
if [[ $CSE != 0 ]]; then
|
||||
CSE_STR=' CSE'
|
||||
else
|
||||
CSE_STR=''
|
||||
fi
|
||||
|
||||
if [[ $PASS != 0 ]]; then
|
||||
PASS_STR=' PASS'
|
||||
else
|
||||
PASS_STR=''
|
||||
fi
|
||||
|
||||
OUT="$CFG_STR""$CSE_STR""$PASS_STR"
|
||||
echo "$OUT"
|
||||
35
files/stylix/swarsel.yaml
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# scheme: "better-contrast"
|
||||
author: "Swarsel"
|
||||
base00: "1D252C" # #1d252c passt
|
||||
base01: "171D23" # #171d23
|
||||
base02: "5EC4FF" # #5EC4FF
|
||||
base03: "566C7D" # #566C7D passt
|
||||
base04: "5EC4FF" # #5EC4FF passt
|
||||
base05: "A0B3C5" # #A0B3C5 passt
|
||||
base06: "C06ECE" # #C06ECE passt
|
||||
base07: "A0B3C5" # #A0B3C5 passt
|
||||
base08: "D95468" # #D95468 passt
|
||||
base09: "FFA880" # #ffA880 passt
|
||||
base0A: "5EC4FF" # #5EC4FF
|
||||
base0B: "8BD49C" # #8BD49C
|
||||
base0C: "008B94" # #008B94 passt
|
||||
base0D: "5EC4FF" # #5EC4FF passt
|
||||
base0E: "C06ECE" # #C06ECE passt
|
||||
base0F: "5EC4FF" # #5EC4FF passt
|
||||
|
||||
# base00 - Default Background
|
||||
# base01 - Lighter Background (Used for status bars)
|
||||
# base02 - Selection Background
|
||||
# base03 - Comments, Invisibles, Line Highlighting
|
||||
# base04 - Dark Foreground (Used for status bars)
|
||||
# base05 - Default Foreground, Caret, Delimiters, Operators
|
||||
# base06 - Light Foreground (Not often used)
|
||||
# base07 - Light Background (Not often used)
|
||||
# base08 - Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted
|
||||
# base09 - Integers, Boolean, Constants, XML Attributes, Markup Link Url
|
||||
# base0A - Classes, Markup Bold, Search Text Background
|
||||
# base0B - Strings, Inherited Class, Markup Code, Diff Inserted
|
||||
# base0C - Support, Regular Expressions, Escape Characters, Markup Quotes
|
||||
# base0D - Functions, Methods, Attribute IDs, Headings
|
||||
# base0E - Keywords, Storage, Selector, Markup Italic, Diff Changed
|
||||
# base0F - Deprecated, Opening/Closing Embedded Language Tags, e.g. <?php ?>
|
||||
3
files/swayidle/config
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
timeout 300 'swaylock -f --screenshots --clock --effect-blur 7x5 --effect-vignette 0.5:0.5 --fade-in 0.2'
|
||||
timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"'
|
||||
before-sleep 'swaylock -f --screenshots --clock --effect-blur 7x5 --effect-vignette 0.5:0.5 --fade-in 0.2'
|
||||
1
files/templates/cpp/.envrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
use flake
|
||||
12
files/templates/cpp/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
CMakeLists.txt.user
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
Testing
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
_deps
|
||||
CMakeUserPresets.json
|
||||
9
files/templates/cpp/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
project(name)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
install(TARGETS name DESTINATION bin)
|
||||
62
files/templates/cpp/flake.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
# heavily inspired by https://github.com/nulladmin1/nix-flake-templates/blob/main/cpp-cmake/flake.nix
|
||||
{
|
||||
description = "C++ Flake";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
systems.url = "github:nix-systems/default";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self
|
||||
, nixpkgs
|
||||
, systems
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
forEachSystem = nixpkgs.lib.genAttrs (import systems);
|
||||
pkgsFor = forEachSystem (system: import nixpkgs { inherit system; });
|
||||
|
||||
pname = "name";
|
||||
in
|
||||
{
|
||||
formatter = forEachSystem (system: pkgsFor.${system}.nixpgks-fmt);
|
||||
|
||||
devShells = forEachSystem (system: {
|
||||
default = pkgsFor.${system}.mkShell {
|
||||
packages = with pkgsFor.${system}; [
|
||||
libllvm
|
||||
cmake
|
||||
gtest
|
||||
cppcheck
|
||||
valgrind
|
||||
doxygen
|
||||
clang-tools
|
||||
# cudatoolkit
|
||||
];
|
||||
};
|
||||
});
|
||||
|
||||
packages = forEachSystem (system: {
|
||||
default = pkgsFor.${system}.stdenv.mkDerivation {
|
||||
inherit pname;
|
||||
version = "0.1.0";
|
||||
src = ./.;
|
||||
|
||||
nativeBuildInputs = with pkgsFor.${system}; [
|
||||
cmake
|
||||
];
|
||||
buildInputs = with pkgsFor.${system}; [
|
||||
gtest
|
||||
];
|
||||
};
|
||||
});
|
||||
|
||||
apps = forEachSystem (system: {
|
||||
default = {
|
||||
type = "app";
|
||||
program = "${self.packages.${system}.default}/bin/${pname}";
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
1
files/templates/cpp/src/CMakeLists.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
add_executable(name name.cpp name.cpp)
|
||||
7
files/templates/cpp/src/name.cpp
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
cout << "Hello, world!" << endl;
|
||||
return 0;
|
||||
}
|
||||
1
files/templates/default/.envrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
use flake
|
||||
30
files/templates/default/flake.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
description = "General purpose Flake";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
systems.url = "github:nix-systems/default";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ nixpkgs
|
||||
, systems
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
forEachSystem = nixpkgs.lib.genAttrs (import systems);
|
||||
pkgsFor = forEachSystem (system: import nixpkgs { inherit system; });
|
||||
in
|
||||
{
|
||||
formatter = forEachSystem (system: pkgsFor.${system}.nixpkgs-fmt);
|
||||
|
||||
devShells = forEachSystem (system: {
|
||||
default = pkgsFor.${system}.mkShell {
|
||||
packages = with pkgsFor.${system}; [
|
||||
|
||||
];
|
||||
};
|
||||
});
|
||||
|
||||
};
|
||||
}
|
||||
1
files/templates/go/.envrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
use flake
|
||||
52
files/templates/go/flake.nix
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
# heavily inspired by https://github.com/nulladmin1/nix-flake-templates/blob/main/go-nix/flake.nix
|
||||
{
|
||||
description = "Go Flake";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
systems.url = "github:nix-systems/default";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self
|
||||
, nixpkgs
|
||||
, systems
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
forEachSystem = nixpkgs.lib.genAttrs (import systems);
|
||||
pkgsFor = forEachSystem (system: import nixpkgs { inherit system; });
|
||||
|
||||
pname = "name";
|
||||
in
|
||||
{
|
||||
formatter = forEachSystem (system: pkgsFor.${system}.nixpkgs-fmt);
|
||||
|
||||
devShells = forEachSystem (system: {
|
||||
default = pkgsFor.${system}.mkShell {
|
||||
packages = with pkgsFor.${system}; [
|
||||
go
|
||||
gopls
|
||||
go-tools
|
||||
gotools
|
||||
];
|
||||
};
|
||||
});
|
||||
|
||||
packages = forEachSystem (system: {
|
||||
default = pkgsFor.${system}.buildGoModule {
|
||||
inherit pname;
|
||||
version = "0.1.0";
|
||||
src = ./.;
|
||||
vendorHash = null;
|
||||
};
|
||||
});
|
||||
|
||||
apps = forEachSystem (system: {
|
||||
default = {
|
||||
type = "app";
|
||||
program = "${self.packages.${system}.default}/bin/${pname}";
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
3
files/templates/go/go.mod
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
module name
|
||||
|
||||
go 1.22.7
|
||||
9
files/templates/go/name/name.go
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello, World!")
|
||||
}
|
||||
61
files/templates/hosts/nixos/default.nix
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{ self, inputs, pkgs, lib, globals, ... }:
|
||||
let
|
||||
modulesPath = "${self}/modules";
|
||||
sharedOptions = {
|
||||
isBtrfs = true;
|
||||
};
|
||||
primaryUser = globals.user.name;
|
||||
in
|
||||
{
|
||||
|
||||
imports = [
|
||||
# ---- nixos-hardware here ----
|
||||
|
||||
./hardware-configuration.nix
|
||||
./disk-config.nix
|
||||
|
||||
"${modulesPath}/nixos/optional/virtualbox.nix"
|
||||
# "${modulesPath}/nixos/optional/vmware.nix"
|
||||
"${modulesPath}/nixos/optional/autologin.nix"
|
||||
"${modulesPath}/nixos/optional/nswitch-rcm.nix"
|
||||
"${modulesPath}/nixos/optional/gaming.nix"
|
||||
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.users."${primaryUser}".imports = [
|
||||
"${modulesPath}/home/optional/gaming.nix"
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
boot = {
|
||||
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||
};
|
||||
|
||||
networking = {
|
||||
hostName = "TEMPLATE";
|
||||
firewall.enable = true;
|
||||
};
|
||||
|
||||
swarselsystems = lib.recursiveUpdate
|
||||
{
|
||||
wallpaper = self + /files/wallpaper/lenovowp.png;
|
||||
hasBluetooth = true;
|
||||
hasFingerprint = true;
|
||||
isImpermanence = true;
|
||||
isSecureBoot = true;
|
||||
isCrypted = true;
|
||||
isSwap = true;
|
||||
swapSize = "32G";
|
||||
rootDisk = "TEMPLATE";
|
||||
}
|
||||
sharedOptions;
|
||||
|
||||
home-manager.users."${primaryUser}".swarselsystems = lib.recursiveUpdate
|
||||
{
|
||||
isLaptop = true;
|
||||
isNixos = true;
|
||||
cpuCount = 16;
|
||||
}
|
||||
sharedOptions;
|
||||
}
|
||||
122
files/templates/hosts/nixos/disk-config.nix
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
{ lib, pkgs, config, rootDisk, ... }:
|
||||
let
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-L" "nixos" "-f" ]; # force overwrite
|
||||
subvolumes = {
|
||||
"/root" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = [
|
||||
"subvol=root"
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
"/home" = lib.mkIf config.swarselsystems.isImpermanence {
|
||||
mountpoint = "/home";
|
||||
mountOptions = [
|
||||
"subvol=home"
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
"/persist" = lib.mkIf config.swarselsystems.isImpermanence {
|
||||
mountpoint = "/persist";
|
||||
mountOptions = [
|
||||
"subvol=persist"
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
"/log" = lib.mkIf config.swarselsystems.isImpermanence {
|
||||
mountpoint = "/var/log";
|
||||
mountOptions = [
|
||||
"subvol=log"
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
"/nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = [
|
||||
"subvol=nix"
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
"/swap" = lib.mkIf config.swarselsystems.isSwap {
|
||||
mountpoint = "/.swapvol";
|
||||
swap.swapfile.size = config.swarselsystems.swapSize;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
disk0 = {
|
||||
type = "disk";
|
||||
device = config.swarselsystems.rootDisk;
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
priority = 1;
|
||||
name = "ESP";
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "defaults" ];
|
||||
};
|
||||
};
|
||||
root = lib.mkIf (!config.swarselsystems.isCrypted) {
|
||||
size = "100%";
|
||||
content = {
|
||||
inherit type subvolumes extraArgs;
|
||||
postCreateHook = lib.mkIf config.swarselsystems.isImpermanence ''
|
||||
MNTPOINT=$(mktemp -d)
|
||||
mount "/dev/disk/by-label/nixos" "$MNTPOINT" -o subvolid=5
|
||||
trap 'umount $MNTPOINT; rm -rf $MNTPOINT' EXIT
|
||||
btrfs subvolume snapshot -r $MNTPOINT/root $MNTPOINT/root-blank
|
||||
'';
|
||||
};
|
||||
};
|
||||
luks = lib.mkIf config.swarselsystems.isCrypted {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "luks";
|
||||
name = "cryptroot";
|
||||
passwordFile = "/tmp/disko-password"; # this is populated by bootstrap.sh
|
||||
settings = {
|
||||
allowDiscards = true;
|
||||
# https://github.com/hmajid2301/dotfiles/blob/a0b511c79b11d9b4afe2a5e2b7eedb2af23e288f/systems/x86_64-linux/framework/disks.nix#L36
|
||||
crypttabExtraOpts = [
|
||||
"fido2-device=auto"
|
||||
"token-timeout=10"
|
||||
];
|
||||
};
|
||||
content = {
|
||||
inherit type subvolumes extraArgs;
|
||||
postCreateHook = lib.mkIf config.swarselsystems.isImpermanence ''
|
||||
MNTPOINT=$(mktemp -d)
|
||||
mount "/dev/mapper/cryptroot" "$MNTPOINT" -o subvolid=5
|
||||
trap 'umount $MNTPOINT; rm -rf $MNTPOINT' EXIT
|
||||
btrfs subvolume snapshot -r $MNTPOINT/root $MNTPOINT/root-blank
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fileSystems."/persist".neededForBoot = lib.mkIf config.swarselsystems.isImpermanence true;
|
||||
fileSystems."/home".neededForBoot = lib.mkIf config.swarselsystems.isImpermanence true;
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.yubikey-manager
|
||||
];
|
||||
}
|
||||
1
files/templates/latex/.envrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
use flake
|
||||
292
files/templates/latex/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,292 @@
|
|||
# nix build output
|
||||
result
|
||||
|
||||
## PDF output (but not in figures/)
|
||||
*.pdf
|
||||
!figures/*.pdf
|
||||
!figures/**/*.pdf
|
||||
|
||||
## Core latex/pdflatex auxiliary files:
|
||||
*.aux
|
||||
*.lof
|
||||
*.log
|
||||
*.lot
|
||||
*.fls
|
||||
*.out
|
||||
*.toc
|
||||
*.fmt
|
||||
*.fot
|
||||
*.cb
|
||||
*.cb2
|
||||
.*.lb
|
||||
|
||||
## Intermediate documents:
|
||||
*.dvi
|
||||
*.xdv
|
||||
*-converted-to.*
|
||||
# these rules might exclude image files for figures etc.
|
||||
# *.ps
|
||||
# *.eps
|
||||
# *.pdf
|
||||
|
||||
## Generated if empty string is given at "Please type another file name for output:"
|
||||
.pdf
|
||||
|
||||
## Bibliography auxiliary files (bibtex/biblatex/biber):
|
||||
*.bbl
|
||||
*.bcf
|
||||
*.blg
|
||||
*-blx.aux
|
||||
*-blx.bib
|
||||
*.run.xml
|
||||
|
||||
## Build tool auxiliary files:
|
||||
*.fdb_latexmk
|
||||
*.synctex
|
||||
*.synctex(busy)
|
||||
*.synctex.gz
|
||||
*.synctex.gz(busy)
|
||||
*.pdfsync
|
||||
|
||||
## Build tool directories for auxiliary files
|
||||
# latexrun
|
||||
latex.out/
|
||||
|
||||
## Auxiliary and intermediate files from other packages:
|
||||
# algorithms
|
||||
*.alg
|
||||
*.loa
|
||||
|
||||
# achemso
|
||||
acs-*.bib
|
||||
|
||||
# amsthm
|
||||
*.thm
|
||||
|
||||
# beamer
|
||||
*.nav
|
||||
*.pre
|
||||
*.snm
|
||||
*.vrb
|
||||
|
||||
# changes
|
||||
*.soc
|
||||
|
||||
# comment
|
||||
*.cut
|
||||
|
||||
# cprotect
|
||||
*.cpt
|
||||
|
||||
# elsarticle (documentclass of Elsevier journals)
|
||||
*.spl
|
||||
|
||||
# endnotes
|
||||
*.ent
|
||||
|
||||
# fixme
|
||||
*.lox
|
||||
|
||||
# feynmf/feynmp
|
||||
*.mf
|
||||
*.mp
|
||||
*.t[1-9]
|
||||
*.t[1-9][0-9]
|
||||
*.tfm
|
||||
|
||||
#(r)(e)ledmac/(r)(e)ledpar
|
||||
*.end
|
||||
*.?end
|
||||
*.[1-9]
|
||||
*.[1-9][0-9]
|
||||
*.[1-9][0-9][0-9]
|
||||
*.[1-9]R
|
||||
*.[1-9][0-9]R
|
||||
*.[1-9][0-9][0-9]R
|
||||
*.eledsec[1-9]
|
||||
*.eledsec[1-9]R
|
||||
*.eledsec[1-9][0-9]
|
||||
*.eledsec[1-9][0-9]R
|
||||
*.eledsec[1-9][0-9][0-9]
|
||||
*.eledsec[1-9][0-9][0-9]R
|
||||
|
||||
# glossaries
|
||||
*.acn
|
||||
*.acr
|
||||
*.glg
|
||||
*.glo
|
||||
*.gls
|
||||
*.glsdefs
|
||||
*.lzo
|
||||
*.lzs
|
||||
|
||||
# uncomment this for glossaries-extra (will ignore makeindex's style files!)
|
||||
# *.ist
|
||||
|
||||
# gnuplottex
|
||||
*-gnuplottex-*
|
||||
|
||||
# gregoriotex
|
||||
*.gaux
|
||||
*.gtex
|
||||
|
||||
# htlatex
|
||||
*.4ct
|
||||
*.4tc
|
||||
*.idv
|
||||
*.lg
|
||||
*.trc
|
||||
*.xref
|
||||
|
||||
# hyperref
|
||||
*.brf
|
||||
|
||||
# knitr
|
||||
*-concordance.tex
|
||||
# TODO Uncomment the next line if you use knitr and want to ignore its generated tikz files
|
||||
# *.tikz
|
||||
*-tikzDictionary
|
||||
|
||||
# listings
|
||||
*.lol
|
||||
|
||||
# luatexja-ruby
|
||||
*.ltjruby
|
||||
|
||||
# makeidx
|
||||
*.idx
|
||||
*.ilg
|
||||
*.ind
|
||||
|
||||
# minitoc
|
||||
*.maf
|
||||
*.mlf
|
||||
*.mlt
|
||||
*.mtc[0-9]*
|
||||
*.slf[0-9]*
|
||||
*.slt[0-9]*
|
||||
*.stc[0-9]*
|
||||
|
||||
# minted
|
||||
_minted*
|
||||
*.pyg
|
||||
|
||||
# morewrites
|
||||
*.mw
|
||||
|
||||
# nomencl
|
||||
*.nlg
|
||||
*.nlo
|
||||
*.nls
|
||||
|
||||
# pax
|
||||
*.pax
|
||||
|
||||
# pdfpcnotes
|
||||
*.pdfpc
|
||||
|
||||
# sagetex
|
||||
*.sagetex.sage
|
||||
*.sagetex.py
|
||||
*.sagetex.scmd
|
||||
|
||||
# scrwfile
|
||||
*.wrt
|
||||
|
||||
# sympy
|
||||
*.sout
|
||||
*.sympy
|
||||
sympy-plots-for-*.tex/
|
||||
|
||||
# pdfcomment
|
||||
*.upa
|
||||
*.upb
|
||||
|
||||
# pythontex
|
||||
*.pytxcode
|
||||
pythontex-files-*/
|
||||
|
||||
# tcolorbox
|
||||
*.listing
|
||||
|
||||
# thmtools
|
||||
*.loe
|
||||
|
||||
# TikZ & PGF
|
||||
*.dpth
|
||||
*.md5
|
||||
*.auxlock
|
||||
|
||||
# todonotes
|
||||
*.tdo
|
||||
|
||||
# vhistory
|
||||
*.hst
|
||||
*.ver
|
||||
|
||||
# easy-todo
|
||||
*.lod
|
||||
|
||||
# xcolor
|
||||
*.xcp
|
||||
|
||||
# xmpincl
|
||||
*.xmpi
|
||||
|
||||
# xindy
|
||||
*.xdy
|
||||
|
||||
# xypic precompiled matrices and outlines
|
||||
*.xyc
|
||||
*.xyd
|
||||
|
||||
# endfloat
|
||||
*.ttt
|
||||
*.fff
|
||||
|
||||
# Latexian
|
||||
TSWLatexianTemp*
|
||||
|
||||
## Editors:
|
||||
# WinEdt
|
||||
*.bak
|
||||
*.sav
|
||||
|
||||
# Texpad
|
||||
.texpadtmp
|
||||
|
||||
# LyX
|
||||
*.lyx~
|
||||
|
||||
# Kile
|
||||
*.backup
|
||||
|
||||
# gummi
|
||||
.*.swp
|
||||
|
||||
# KBibTeX
|
||||
*~[0-9]*
|
||||
|
||||
# TeXnicCenter
|
||||
*.tps
|
||||
|
||||
# auto folder when using emacs and auctex
|
||||
./auto/*
|
||||
*.el
|
||||
|
||||
# expex forward references with \gathertags
|
||||
*-tags.tex
|
||||
|
||||
# standalone packages
|
||||
*.sta
|
||||
|
||||
# Makeindex log files
|
||||
*.lpz
|
||||
|
||||
# xwatermark package
|
||||
*.xwm
|
||||
|
||||
# REVTeX puts footnotes in the bibliography by default, unless the nofootinbib
|
||||
# option is specified. Footnotes are the stored in a file with suffix Notes.bib.
|
||||
# Uncomment the next line to have this generated file ignored.
|
||||
#*Notes.bib
|
||||
3
files/templates/latex/.latexmkrc
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
$pdf_mode = 4;
|
||||
@default_files = ('000-main.tex');
|
||||
$lualatex = "lualatex %O -shell-escape %S";
|
||||
75
files/templates/latex/000-main.tex
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
%! TEX root = **/000-main.tex
|
||||
% vim: spell spelllang=en:
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% PREAMBLE
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\input{001-preamble}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% EXTRA PACKAGES / CONFIG
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% METADATA
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
% remove when using \maketitle:
|
||||
\renewcommand\and{\\[\baselineskip]}
|
||||
|
||||
\title{My title \\ \Large \normalfont My Subtitle}
|
||||
\author{First Author \and Second Author}
|
||||
\date{\today}
|
||||
|
||||
\begin{document}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% TITLE
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
% Default title or use titlepage.tex
|
||||
|
||||
%\maketitle
|
||||
\include{005-titlepage}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% TOC & lists
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\pagenumbering{Roman}
|
||||
|
||||
%\setcounter{tocdepth}{2}
|
||||
\tableofcontents \pagebreak
|
||||
|
||||
\listoffigures \pagebreak
|
||||
\listoftables \clearpage
|
||||
|
||||
\pagenumbering{arabic}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% SECTIONS
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
% Paragraph spacing (placed after ToC)
|
||||
\setlength{\parskip}{1em plus 0.5em minus 0.2em}
|
||||
%\setlength{\parindent}{0pt}
|
||||
|
||||
\include{010-introduction}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% BIBLIO
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\printbibliography[heading=bibintoc]
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% APPENDIX
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
% uncomment to add appendix section prefix to numbering
|
||||
%\appendixpagenumbering
|
||||
|
||||
\appendix
|
||||
|
||||
\include{990-appendix}
|
||||
|
||||
\end{document}
|
||||
204
files/templates/latex/001-preamble.tex
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
%! TEX root = **/000-main.tex
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% LaTeX preamble, load in main.tex with: \input{preamble}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\documentclass[12pt, oneside]{article}
|
||||
\usepackage[a4paper, left=2.5cm, right=2.5cm, top=2.5cm, bottom=2.5cm]{geometry}
|
||||
|
||||
% for debugging overfulls
|
||||
%\documentclass[draft, 12pt, oneside]{article}
|
||||
%\usepackage[showframe, a4paper, left=2.5cm, right=2.5cm, top=2.5cm, bottom=2.5cm]{geometry}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% FONTS
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{fontspec}
|
||||
\usepackage{microtype}
|
||||
|
||||
\setmonofont[Scale=MatchLowercase]{DejaVu Sans Mono}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% LANGUAGE
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\usepackage{polyglossia}
|
||||
\setdefaultlanguage{english}
|
||||
\setotherlanguages{spanish,catalan}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% BIBLIOGRAPHY
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\usepackage[
|
||||
backend=biber,
|
||||
style=numeric,
|
||||
]{biblatex}
|
||||
\DeclareNameAlias{default}{family-given}
|
||||
|
||||
\addbibresource{biblio.bib}
|
||||
|
||||
\usepackage{fvextra} % Req by minted (must load before csquotes)
|
||||
\usepackage{csquotes} % For bibliography quotations
|
||||
\DeclareQuoteAlias{spanish}{catalan}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% COMMON
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\usepackage{color, xcolor} % more colors
|
||||
|
||||
\usepackage{graphicx} % graphics
|
||||
\graphicspath{{./figures/}}
|
||||
|
||||
\usepackage{comment}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% MATHS
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\usepackage{mathtools} % amsmath + more
|
||||
\usepackage{amsthm} % Theorem enviroment
|
||||
\usepackage{amssymb} % More symbols
|
||||
\usepackage{amstext} % Text inside mathenv
|
||||
|
||||
%\usepackage{relsize} % Bigger math with mathlarger{___}
|
||||
%\usepackage{nicefrac} % nice fractions in one line
|
||||
|
||||
%\usepackage{IEEEtrantools} % Complex equation arrays
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% REFERENCES (load order is important)
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\usepackage{varioref} % reference far away (1)
|
||||
\usepackage[colorlinks = true]{hyperref} % links in references (2)
|
||||
\usepackage{cleveref} % smart references (3)
|
||||
%hyperref configuration so that it doesn't contrast so much colorlinks,
|
||||
\hypersetup{
|
||||
linkcolor={black},
|
||||
citecolor={black},
|
||||
%linkcolor={red!50!black},
|
||||
%citecolor={blue!50!black},
|
||||
urlcolor={blue!80!black}
|
||||
}
|
||||
|
||||
\usepackage[bottom]{footmisc} % Footnotes at bottom of page
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% FIGURES
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
%\usepackage[export]{adjustbox} % Adjust table size
|
||||
\usepackage{float} % Force tables and images position (H and H!)
|
||||
%\usepackage{wrapfig} % Wrap images like in HTML
|
||||
|
||||
\usepackage[justification=centering]{caption}
|
||||
%\usepackage{subcaption} % Subfigures
|
||||
%\usepackage[framemethod=tikz]{mdframed} % Custom frames
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% TABLES
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
%\usepackage{colortbl, booktabs} % Better tables
|
||||
%\usepackage{tabularx}
|
||||
%\usepackage{longtable} % Multiple page table (does not work with tabularx)
|
||||
\usepackage{xltabular, colortbl, booktabs} % longtable + tabularx (has bug with booktabs: fix below)
|
||||
|
||||
% Split cell in lines and more formating options inside table
|
||||
\usepackage{array, multirow, multicol, makecell}
|
||||
|
||||
%%%
|
||||
% bug fix for booktabs + xltabular incompatibility
|
||||
\makeatletter
|
||||
\def\@BTrule[#1]{%
|
||||
\ifx\longtable\undefined
|
||||
\let\@BTswitch\@BTnormal
|
||||
\else\ifx\hline\LT@hline
|
||||
\nobreak
|
||||
\let\@BTswitch\@BLTrule
|
||||
\else
|
||||
\let\@BTswitch\@BTnormal
|
||||
\fi\fi
|
||||
\global\@thisrulewidth=#1\relax
|
||||
\ifnum\@thisruleclass=\tw@\vskip\@aboverulesep\else
|
||||
\ifnum\@lastruleclass=\z@\vskip\@aboverulesep\else
|
||||
\ifnum\@lastruleclass=\@ne\vskip\doublerulesep\fi\fi\fi
|
||||
\@BTswitch}
|
||||
\makeatother
|
||||
%%%
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% SIUNITX
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
%\usepackage[alsoload=hep]{siunitx} % SI units and uncertainties
|
||||
%\sisetup{locale = FR} % Commas and so on for spanish
|
||||
%\sisetup{separate-uncertainty=true}
|
||||
%\sisetup{
|
||||
%per-mode=fraction,
|
||||
%fraction-function=\nicefrac
|
||||
%}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% TIKZ
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
%\usepackage{tikz}
|
||||
%\usetikzlibrary{arrows}
|
||||
%\usetikzlibrary{scopes}
|
||||
%\usetikzlibrary{babel}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% MINTED
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\usepackage{minted}
|
||||
\definecolor{codeBg}{HTML}{FFFDE7}
|
||||
\setminted{
|
||||
%style=pastie,
|
||||
frame=lines,
|
||||
framesep=3mm,
|
||||
linenos,
|
||||
breaklines=true,
|
||||
encoding=utf8,
|
||||
fontsize=\footnotesize,
|
||||
bgcolor=codeBg
|
||||
}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% CUSTOM COMMANDS
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
% empty whitepage without numbering
|
||||
\newcommand{\whitepage}{
|
||||
\clearpage\thispagestyle{empty}\addtocounter{page}{-1} \newpage \clearpage
|
||||
}
|
||||
|
||||
% Add command before appendix section for page numbering: A-1
|
||||
\newcommand{\appendixpagenumbering}{
|
||||
\break
|
||||
\pagenumbering{arabic}
|
||||
\renewcommand{\thepage}{\thesection-\arabic{page}}
|
||||
}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% CUSTOM MATH OPERATORS (functions not in italic in math mode)
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
%\DeclareMathOperator{\arcsec}{arcsec}
|
||||
%\DeclareMathOperator{\arccot}{arccot}
|
||||
%\DeclareMathOperator{\arccsc}{arccsc}
|
||||
%\DeclareMathOperator{\cis}{cis}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% MISC
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
%\usepackage{datetime} % Customize date
|
||||
%% \monthyeardate\today gives the date without the day
|
||||
%\newdateformat{monthyeardate}{%
|
||||
%\monthname[\THEMONTH], \THEYEAR}
|
||||
28
files/templates/latex/005-titlepage.tex
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
%! TEX root = **/000-main.tex
|
||||
% vim: spell spelllang=en:
|
||||
|
||||
\thispagestyle{empty}
|
||||
\clearpage
|
||||
\setcounter{page}{-1}
|
||||
|
||||
\makeatletter
|
||||
\begin{titlepage}
|
||||
{
|
||||
\centering
|
||||
\includegraphics[width=0.9\textwidth]{institution-logo}
|
||||
\null%
|
||||
\vspace{3em}
|
||||
{\Huge \bfseries \@title \par}
|
||||
\vspace{2em}
|
||||
{\large \scshape \@date \par}
|
||||
\vfill
|
||||
\begin{center}
|
||||
% Supplementary image
|
||||
\end{center}
|
||||
\vspace{5em}
|
||||
|
||||
\vfill
|
||||
{\raggedleft \large \@author \par}
|
||||
}
|
||||
\end{titlepage}
|
||||
\makeatother
|
||||
39
files/templates/latex/010-introduction.tex
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
%! TEX root = **/000-main.tex
|
||||
% vim: spell spelllang=en:
|
||||
|
||||
\section{Introduction}%
|
||||
\label{sec:introduction}
|
||||
|
||||
\(E = mc^2\) \cite{einstein}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.3\linewidth]{Professortocat_v2}
|
||||
\caption{Professor OctoCat}%
|
||||
\label{fig:profocto}
|
||||
\end{figure}
|
||||
|
||||
As we can see in \cref{fig:profocto}, the professor is holding an apple.
|
||||
|
||||
\begin{table}[H]
|
||||
\begin{center}
|
||||
\caption{Table captions go on top of the tables}%
|
||||
\label{tab:example}
|
||||
\begin{tabular}{ccc}
|
||||
\toprule
|
||||
a & b & c \\
|
||||
\midrule
|
||||
0 & 2 & 4 \\
|
||||
\bottomrule
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
\end{table}
|
||||
|
||||
\subsection{Lorem ipsum}%
|
||||
\label{sub:lorem_ipsum}
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ultricies est sit amet interdum ornare. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut nulla lectus, bibendum ultrices dui quis, sodales suscipit quam. Donec eu finibus lectus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Etiam eu metus mattis, bibendum massa quis, eleifend libero. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nunc lacinia ipsum at dolor tristique convallis. Sed dignissim malesuada nunc, nec malesuada risus sagittis eu. Nulla et erat et mi elementum scelerisque vitae at neque. Suspendisse scelerisque laoreet tellus, sit amet accumsan mauris placerat nec. Vestibulum mollis augue a odio posuere, ut gravida est lacinia. Etiam turpis ligula, molestie nec porta in, malesuada id magna. Donec elementum nulla ac tincidunt fringilla. Suspendisse porta laoreet nisl, non aliquam orci dictum egestas.
|
||||
|
||||
Proin euismod consequat felis ut pharetra. Maecenas auctor, nunc ac gravida pretium, metus mi fringilla lectus, auctor scelerisque nunc velit id magna. Etiam sit amet mi sit amet nunc congue ornare non hendrerit diam. Nullam consectetur lectus quis urna vehicula, nec lacinia tortor rhoncus. Vestibulum at enim aliquam, ultricies urna sit amet, porta tellus. Curabitur posuere elit orci, et rutrum nibh cursus eget. Donec ac venenatis purus. Fusce vehicula nisi erat, at tempor turpis congue vitae. Nunc auctor pellentesque malesuada. Nunc sodales, dolor ac sagittis mollis, enim ipsum mollis sem, non porttitor arcu nulla at velit. Ut non velit nec lacus sollicitudin maximus id id tortor. Sed ac aliquam lorem.
|
||||
|
||||
Nunc non ante ex. Curabitur lacinia euismod velit, non posuere leo bibendum non. Mauris ac orci non risus feugiat rutrum eu ac velit. Phasellus facilisis lacinia condimentum. Pellentesque vulputate nibh urna, vel varius mauris cursus quis. Aliquam vitae sem ac orci fermentum semper. Praesent est tellus, luctus sed venenatis at, bibendum id purus. Cras at mi sed lorem aliquet congue at sit amet turpis. Aliquam vestibulum tempor mauris, id aliquam ipsum scelerisque ut. In arcu turpis, dapibus ut nisi vel, luctus pellentesque felis. Aenean nisi erat, porttitor eu felis ut, imperdiet aliquam velit. Mauris vitae vehicula leo. Curabitur ut ante et ante pulvinar gravida. Donec tincidunt fringilla erat. Vivamus cursus augue et odio pharetra hendrerit.
|
||||
8
files/templates/latex/990-appendix.tex
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
%! TEX root = **/000-main.tex
|
||||
% vim: spell spelllang=en:
|
||||
|
||||
\section{Appendix}
|
||||
|
||||
Appendix contents
|
||||
|
||||
\inputminted{cpp}{./code/P15601_en_Harrichu_y_and_the_maze.cc}
|
||||
41
files/templates/latex/biblio.bib
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
% vim: spell spelllang=en:
|
||||
|
||||
@article{einstein,
|
||||
author = "Albert Einstein",
|
||||
title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
|
||||
[{On} the electrodynamics of moving bodies]",
|
||||
journal = "Annalen der Physik",
|
||||
volume = "322",
|
||||
number = "10",
|
||||
pages = "891--921",
|
||||
year = "1905",
|
||||
DOI = "http://dx.doi.org/10.1002/andp.19053221004",
|
||||
keywords = "physics"
|
||||
}
|
||||
|
||||
@book{dirac,
|
||||
title = {The Principles of Quantum Mechanics},
|
||||
author = {Paul Adrien Maurice Dirac},
|
||||
isbn = {9780198520115},
|
||||
series = {International series of monographs on physics},
|
||||
year = {1981},
|
||||
publisher = {Clarendon Press},
|
||||
keywords = {physics}
|
||||
}
|
||||
|
||||
@online{knuthwebsite,
|
||||
author = "Donald Knuth",
|
||||
title = "Knuth: Computers and Typesetting",
|
||||
url = "http://www-cs-faculty.stanford.edu/~uno/abcde.html",
|
||||
addendum = "(accessed: 01.09.2016)",
|
||||
keywords = "latex,knuth"
|
||||
}
|
||||
|
||||
@inbook{knuth-fa,
|
||||
author = "Donald E. Knuth",
|
||||
title = "Fundamental Algorithms",
|
||||
publisher = "Addison-Wesley",
|
||||
year = "1973",
|
||||
chapter = "1.2",
|
||||
keywords = "knuth,programming"
|
||||
}
|
||||
87
files/templates/latex/build-document.nix
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
# Build a reproducible latex document with latexmk, based on:
|
||||
# https://flyx.org/nix-flakes-latex/
|
||||
|
||||
{ pkgs
|
||||
# Document source
|
||||
, src ? ./.
|
||||
|
||||
# Name of the final pdf file
|
||||
, name ? "document.pdf"
|
||||
|
||||
# Use -shell-escape
|
||||
, shellEscape ? false
|
||||
|
||||
# Use minted (requires shellEscape)
|
||||
, minted ? false
|
||||
|
||||
# Additional flags for latexmk
|
||||
, extraFlags ? [ ]
|
||||
|
||||
# Do not use the default latexmk flags. Usefull if you have a .latexmkrc or you
|
||||
# don't want to use lualatex
|
||||
, dontUseDefaultFlags ? false
|
||||
|
||||
# texlive packages needed to build the document
|
||||
# you can also include other packages as a list.
|
||||
, texlive ? pkgs.texlive.combined.scheme-full
|
||||
|
||||
# Pygments package to use (needed for minted)
|
||||
, pygments ? pkgs.python39Packages.pygments
|
||||
|
||||
# Add system fonts
|
||||
# you can specify one font directly with: pkgs.fira-code
|
||||
# of join multiple fonts using symlinJoin:
|
||||
# pkgs.symlinkJoin { name = "fonts"; paths = with pkgs; [ fira-code souce-code-pro ]; }
|
||||
, fonts ? null
|
||||
|
||||
# Date for the document in unix time. You can change it
|
||||
# to "$(date -r . +%s)" , "$(date -d "2022/02/22" +%s)", toString
|
||||
# self.lastModified
|
||||
, SOURCE_DATE_EPOCH ? "$(git log -1 --pretty=%ct)"
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (pkgs) lib;
|
||||
defaultFlags = [
|
||||
"-interaction=nonstopmode"
|
||||
"-pdf"
|
||||
"-lualatex"
|
||||
"-pretex='\\pdfvariable suppressoptionalinfo 512\\relax'"
|
||||
"-usepretex"
|
||||
];
|
||||
flags = lib.concatLists [
|
||||
(lib.optional (!dontUseDefaultFlags) defaultFlags)
|
||||
extraFlags
|
||||
(lib.optional shellEscape [ "-shell-escape" ])
|
||||
];
|
||||
in
|
||||
|
||||
assert minted -> shellEscape;
|
||||
|
||||
pkgs.stdenvNoCC.mkDerivation rec {
|
||||
inherit src name;
|
||||
|
||||
buildInputs = [ texlive pkgs.git ] ++
|
||||
lib.optional minted [ pkgs.which pygments ];
|
||||
|
||||
TEXMFHOME = "./cache";
|
||||
TEXMFVAR = "./cache/var";
|
||||
|
||||
OSFONTDIR = lib.optionalString (fonts != null) "${fonts}/share/fonts";
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH}" latexmk ${toString flags}
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -m644 -D *.pdf $out/${name}
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
#include <iostream>
|
||||
#include <queue>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
struct coord {
|
||||
int x,y;
|
||||
coord (int xx=0, int yy=0) : x(xx), y(yy) {}
|
||||
bool operator== (const coord& p) {return x==p.x and y==p.y;}
|
||||
} beg, goal;
|
||||
|
||||
int main () {
|
||||
int n;
|
||||
cin >> n;
|
||||
while (n--) {
|
||||
int r,c;
|
||||
cin >> r >> c;
|
||||
vector <vector <bool> > v (r, vector <bool> (c, 0));
|
||||
for (int i = 0; i < r; ++i)
|
||||
for (int j = 0; j < c; ++j) {
|
||||
char cc;
|
||||
cin >> cc;
|
||||
if (cc=='.') v[i][j]=true;
|
||||
else if (cc=='b') beg = coord(i,j);
|
||||
else if (cc=='g') goal = coord(i,j);
|
||||
}
|
||||
|
||||
v[goal.x][goal.y] = v[beg.x][beg.y]=true;
|
||||
vector <vector <bool> > f (v.size(),vector <bool> (v[0].size(),0));
|
||||
|
||||
queue <coord> q;
|
||||
q.push(beg);
|
||||
|
||||
while (!q.empty()) {
|
||||
coord p = q.front(); q.pop();
|
||||
if (p.x>=v.size() or p.x<0 or p.y >= v[0].size() or p.y<0) continue;
|
||||
if (!v[p.x][p.y]) continue;
|
||||
if (f[p.x][p.y]) continue;
|
||||
|
||||
f[p.x][p.y] = true;
|
||||
if (p==goal) break;
|
||||
|
||||
q.push(coord(p.x+1,p.y));
|
||||
q.push(coord(p.x-1,p.y));
|
||||
q.push(coord(p.x,p.y+1));
|
||||
q.push(coord(p.x,p.y-1));
|
||||
}
|
||||
|
||||
cout << (f[goal.x][goal.y]? "Good" : "Bad") << endl;
|
||||
}
|
||||
}
|
||||
BIN
files/templates/latex/figures/Professortocat_v2.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
files/templates/latex/figures/institution-logo.pdf
Normal file
78
files/templates/latex/flake.nix
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
# This template is based on https://github.com/Leixb/latex-template/tree/master
|
||||
{
|
||||
description = "LaTeX Flake";
|
||||
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
{
|
||||
|
||||
lib.latexmk = import ./build-document.nix;
|
||||
|
||||
} // flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pname = "document";
|
||||
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
latex-packages = with pkgs; [
|
||||
(texlive.combine {
|
||||
inherit (texlive)
|
||||
scheme-medium
|
||||
framed
|
||||
titlesec
|
||||
cleveref
|
||||
multirow
|
||||
wrapfig
|
||||
tabu
|
||||
threeparttable
|
||||
threeparttablex
|
||||
makecell
|
||||
environ
|
||||
biblatex
|
||||
biber
|
||||
fvextra
|
||||
upquote
|
||||
catchfile
|
||||
xstring
|
||||
csquotes
|
||||
minted
|
||||
dejavu
|
||||
comment
|
||||
footmisc
|
||||
xltabular
|
||||
ltablex
|
||||
;
|
||||
})
|
||||
which
|
||||
python39Packages.pygments
|
||||
];
|
||||
|
||||
dev-packages = with pkgs; [
|
||||
texlab
|
||||
zathura
|
||||
wmctrl
|
||||
];
|
||||
in
|
||||
rec {
|
||||
devShell = pkgs.mkShell {
|
||||
buildInputs = [ latex-packages dev-packages ];
|
||||
};
|
||||
|
||||
formatter = pkgs.nixpkgs-fmt;
|
||||
|
||||
packages = flake-utils.lib.flattenTree {
|
||||
default = import ./build-document.nix {
|
||||
inherit pkgs;
|
||||
name = pname;
|
||||
texlive = latex-packages;
|
||||
shellEscape = true;
|
||||
minted = true;
|
||||
SOURCE_DATE_EPOCH = toString self.lastModified;
|
||||
};
|
||||
};
|
||||
|
||||
apps.default = flake-utils.lib.mkApp { drv = "${pkgs.texlivePackages.latexmk}"; exePath = "/bin/latexmk"; };
|
||||
}
|
||||
);
|
||||
}
|
||||
1
files/templates/python/.envrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
use flake
|
||||
1
files/templates/python/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
__pycache__
|
||||
26
files/templates/python/README.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Python template using uv2nix
|
||||
|
||||
This template flake provides a python environment that is being managed by `uv` while still keeping the store managed by `nix`.
|
||||
|
||||
## Setup
|
||||
|
||||
1) Enter project directory
|
||||
2) `project python`
|
||||
3) Edit Python version in `flake.nix` and Python version + dependencies in `pyproject.toml`
|
||||
4) `uv lock`
|
||||
5) `direnv reload`
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
|
||||
### Testing
|
||||
|
||||
- run `nix flake check`
|
||||
|
||||
###### Note for Emacs users
|
||||
|
||||
It can happen that Emacs will not immediately pick up on the new environment after you have made your changes. In that case, perform the following steps in Emacs (this is for a setup using `envrc.el` and `eglot`):
|
||||
|
||||
1) `(envrc-reload)`
|
||||
2) `(eglot)`
|
||||
199
files/templates/python/flake.nix
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
# based on https://github.com/pyproject-nix/uv2nix/tree/master/templates/hello-world
|
||||
{
|
||||
description = "Python flake using uv2nix";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
pyproject-nix = {
|
||||
url = "github:pyproject-nix/pyproject.nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
uv2nix = {
|
||||
url = "github:pyproject-nix/uv2nix";
|
||||
inputs = {
|
||||
pyproject-nix.follows = "pyproject-nix";
|
||||
nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
pyproject-build-systems = {
|
||||
url = "github:pyproject-nix/build-system-pkgs";
|
||||
inputs = {
|
||||
pyproject-nix.follows = "pyproject-nix";
|
||||
uv2nix.follows = "uv2nix";
|
||||
nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ nixpkgs
|
||||
, uv2nix
|
||||
, pyproject-nix
|
||||
, pyproject-build-systems
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
pname = "name";
|
||||
forAllSystems = lib.genAttrs lib.systems.flakeExposed;
|
||||
|
||||
# Load a uv workspace from a workspace root.
|
||||
# Uv2nix treats all uv projects as workspace projects.
|
||||
workspace = uv2nix.lib.workspace.loadWorkspace { workspaceRoot = ./.; };
|
||||
|
||||
overlay = workspace.mkPyprojectOverlay {
|
||||
# Prefer prebuilt binary wheels as a package source.
|
||||
# Sdists are less likely to "just work" because of the metadata missing from uv.lock.
|
||||
# Binary wheels are more likely to, but may still require overrides for library dependencies.
|
||||
sourcePreference = "wheel"; # or sourcePreference = "sdist";
|
||||
# Optionally customise PEP 508 environment
|
||||
# environ = {
|
||||
# platform_release = "5.10.65";
|
||||
# };
|
||||
};
|
||||
|
||||
|
||||
pythonSets = forAllSystems
|
||||
(system:
|
||||
let
|
||||
inherit (pkgs) stdenv;
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
pyprojectOverrides = final: prev: {
|
||||
# Implement build fixups here.
|
||||
${pname} = prev.${pname}.overrideAttrs (old: {
|
||||
|
||||
passthru = old.passthru // {
|
||||
# Put all tests in the passthru.tests attribute set.
|
||||
# Nixpkgs also uses the passthru.tests mechanism for ofborg test discovery.
|
||||
#
|
||||
# For usage with Flakes we will refer to the passthru.tests attributes to construct the flake checks attribute set.
|
||||
tests =
|
||||
let
|
||||
|
||||
virtualenv = final.mkVirtualEnv "${pname}-pytest-env" {
|
||||
${pname} = [ "test" ];
|
||||
};
|
||||
|
||||
in
|
||||
(old.tests or { })
|
||||
// {
|
||||
pytest = stdenv.mkDerivation {
|
||||
name = "${final.${pname}.name}-pytest";
|
||||
inherit (final.${pname}) src;
|
||||
nativeBuildInputs = [
|
||||
virtualenv
|
||||
];
|
||||
dontConfigure = true;
|
||||
|
||||
# Because this package is running tests, and not actually building the main package
|
||||
# the build phase is running the tests.
|
||||
#
|
||||
# We also output a HTML coverage report, which is used as the build output.
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
pytest --cov tests --cov-report html
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
# Install the HTML coverage report into the build output.
|
||||
#
|
||||
# If you wanted to install multiple test output formats such as TAP outputs
|
||||
# you could make this derivation a multiple-output derivation.
|
||||
#
|
||||
# See https://nixos.org/manual/nixpkgs/stable/#chap-multiple-output for more information on multiple outputs.
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mv htmlcov $out
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
baseSet = pkgs.callPackage pyproject-nix.build.packages {
|
||||
python = pkgs.python312;
|
||||
};
|
||||
in
|
||||
baseSet.overrideScope
|
||||
(
|
||||
lib.composeManyExtensions [
|
||||
pyproject-build-systems.overlays.default
|
||||
overlay
|
||||
pyprojectOverrides
|
||||
]
|
||||
));
|
||||
|
||||
in
|
||||
{
|
||||
packages = forAllSystems (system:
|
||||
let
|
||||
pythonSet = pythonSets.${system};
|
||||
in
|
||||
{ default = pythonSet.mkVirtualEnv "${pname}-env" workspace.deps.default; });
|
||||
|
||||
devShells = forAllSystems
|
||||
(system:
|
||||
let
|
||||
pythonSet = pythonSets.${system};
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
default =
|
||||
let
|
||||
# Create an overlay enabling editable mode for all local dependencies.
|
||||
editableOverlay = workspace.mkEditablePyprojectOverlay {
|
||||
# Use environment variable
|
||||
root = "$REPO_ROOT";
|
||||
# Optional: Only enable editable for these packages
|
||||
# members = [ "hello-world" ];
|
||||
};
|
||||
|
||||
# Override previous set with our overrideable overlay.
|
||||
editablePythonSet = pythonSet.overrideScope editableOverlay;
|
||||
|
||||
virtualenv = editablePythonSet.mkVirtualEnv "${pname}-dev-env" {
|
||||
${pname} = [ "dev" ];
|
||||
};
|
||||
|
||||
in
|
||||
pkgs.mkShell {
|
||||
packages = [
|
||||
virtualenv
|
||||
pkgs.uv
|
||||
];
|
||||
shellHook = ''
|
||||
# Undo dependency propagation by nixpkgs.
|
||||
unset PYTHONPATH
|
||||
|
||||
# Don't create venv using uv
|
||||
export UV_NO_SYNC=1
|
||||
|
||||
# Prevent uv from downloading managed Python's
|
||||
export UV_PYTHON_DOWNLOADS=never
|
||||
|
||||
# Get repository root using git. This is expanded at runtime by the editable `.pth` machinery.
|
||||
export REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
'';
|
||||
};
|
||||
});
|
||||
|
||||
checks = forAllSystems (
|
||||
system:
|
||||
let
|
||||
pythonSet = pythonSets.${system};
|
||||
in
|
||||
{
|
||||
inherit (pythonSet.${pname}.passthru.tests) pytest;
|
||||
}
|
||||
);
|
||||
|
||||
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt);
|
||||
|
||||
};
|
||||
}
|
||||
32
files/templates/python/pyproject.toml
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
[project]
|
||||
name = "name"
|
||||
version = "0.1.0"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
hello = "name:hello"
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
{include-group = "test"},
|
||||
{include-group = "lint"},
|
||||
{include-group = "lsp"},
|
||||
]
|
||||
lsp = [
|
||||
"python-lsp-server",
|
||||
]
|
||||
lint = [
|
||||
"ruff>=0.6.7",
|
||||
]
|
||||
test = [
|
||||
"pytest-cov>=6.0.0",
|
||||
"pytest>=8.3.3",
|
||||
]
|
||||
2
files/templates/python/src/name/__init__.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def hello() -> None:
|
||||
print("Hello from testing!")
|
||||
8
files/templates/python/tests/test_hello.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import name
|
||||
|
||||
|
||||
def test_hello(capsys):
|
||||
name.hello()
|
||||
captured = capsys.readouterr()
|
||||
assert captured.out == "Hello from testing!\n"
|
||||
assert captured.err == ""
|
||||
254
files/templates/python/uv.lock
generated
Normal file
|
|
@ -0,0 +1,254 @@
|
|||
version = 1
|
||||
requires-python = ">=3.12"
|
||||
|
||||
[[package]]
|
||||
name = "colorama"
|
||||
version = "0.4.6"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "coverage"
|
||||
version = "7.6.10"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/84/ba/ac14d281f80aab516275012e8875991bb06203957aa1e19950139238d658/coverage-7.6.10.tar.gz", hash = "sha256:7fb105327c8f8f0682e29843e2ff96af9dcbe5bab8eeb4b398c6a33a16d80a23", size = 803868 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/86/77/19d09ea06f92fdf0487499283b1b7af06bc422ea94534c8fe3a4cd023641/coverage-7.6.10-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:27c6e64726b307782fa5cbe531e7647aee385a29b2107cd87ba7c0105a5d3853", size = 208281 },
|
||||
{ url = "https://files.pythonhosted.org/packages/b6/67/5479b9f2f99fcfb49c0d5cf61912a5255ef80b6e80a3cddba39c38146cf4/coverage-7.6.10-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:c56e097019e72c373bae32d946ecf9858fda841e48d82df7e81c63ac25554078", size = 208514 },
|
||||
{ url = "https://files.pythonhosted.org/packages/15/d1/febf59030ce1c83b7331c3546d7317e5120c5966471727aa7ac157729c4b/coverage-7.6.10-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c7827a5bc7bdb197b9e066cdf650b2887597ad124dd99777332776f7b7c7d0d0", size = 241537 },
|
||||
{ url = "https://files.pythonhosted.org/packages/4b/7e/5ac4c90192130e7cf8b63153fe620c8bfd9068f89a6d9b5f26f1550f7a26/coverage-7.6.10-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:204a8238afe787323a8b47d8be4df89772d5c1e4651b9ffa808552bdf20e1d50", size = 238572 },
|
||||
{ url = "https://files.pythonhosted.org/packages/dc/03/0334a79b26ecf59958f2fe9dd1f5ab3e2f88db876f5071933de39af09647/coverage-7.6.10-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e67926f51821b8e9deb6426ff3164870976fe414d033ad90ea75e7ed0c2e5022", size = 240639 },
|
||||
{ url = "https://files.pythonhosted.org/packages/d7/45/8a707f23c202208d7b286d78ad6233f50dcf929319b664b6cc18a03c1aae/coverage-7.6.10-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e78b270eadb5702938c3dbe9367f878249b5ef9a2fcc5360ac7bff694310d17b", size = 240072 },
|
||||
{ url = "https://files.pythonhosted.org/packages/66/02/603ce0ac2d02bc7b393279ef618940b4a0535b0868ee791140bda9ecfa40/coverage-7.6.10-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:714f942b9c15c3a7a5fe6876ce30af831c2ad4ce902410b7466b662358c852c0", size = 238386 },
|
||||
{ url = "https://files.pythonhosted.org/packages/04/62/4e6887e9be060f5d18f1dd58c2838b2d9646faf353232dec4e2d4b1c8644/coverage-7.6.10-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:abb02e2f5a3187b2ac4cd46b8ced85a0858230b577ccb2c62c81482ca7d18852", size = 240054 },
|
||||
{ url = "https://files.pythonhosted.org/packages/5c/74/83ae4151c170d8bd071924f212add22a0e62a7fe2b149edf016aeecad17c/coverage-7.6.10-cp312-cp312-win32.whl", hash = "sha256:55b201b97286cf61f5e76063f9e2a1d8d2972fc2fcfd2c1272530172fd28c359", size = 210904 },
|
||||
{ url = "https://files.pythonhosted.org/packages/c3/54/de0893186a221478f5880283119fc40483bc460b27c4c71d1b8bba3474b9/coverage-7.6.10-cp312-cp312-win_amd64.whl", hash = "sha256:e4ae5ac5e0d1e4edfc9b4b57b4cbecd5bc266a6915c500f358817a8496739247", size = 211692 },
|
||||
{ url = "https://files.pythonhosted.org/packages/25/6d/31883d78865529257bf847df5789e2ae80e99de8a460c3453dbfbe0db069/coverage-7.6.10-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:05fca8ba6a87aabdd2d30d0b6c838b50510b56cdcfc604d40760dae7153b73d9", size = 208308 },
|
||||
{ url = "https://files.pythonhosted.org/packages/70/22/3f2b129cc08de00c83b0ad6252e034320946abfc3e4235c009e57cfeee05/coverage-7.6.10-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:9e80eba8801c386f72e0712a0453431259c45c3249f0009aff537a517b52942b", size = 208565 },
|
||||
{ url = "https://files.pythonhosted.org/packages/97/0a/d89bc2d1cc61d3a8dfe9e9d75217b2be85f6c73ebf1b9e3c2f4e797f4531/coverage-7.6.10-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a372c89c939d57abe09e08c0578c1d212e7a678135d53aa16eec4430adc5e690", size = 241083 },
|
||||
{ url = "https://files.pythonhosted.org/packages/4c/81/6d64b88a00c7a7aaed3a657b8eaa0931f37a6395fcef61e53ff742b49c97/coverage-7.6.10-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ec22b5e7fe7a0fa8509181c4aac1db48f3dd4d3a566131b313d1efc102892c18", size = 238235 },
|
||||
{ url = "https://files.pythonhosted.org/packages/9a/0b/7797d4193f5adb4b837207ed87fecf5fc38f7cc612b369a8e8e12d9fa114/coverage-7.6.10-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:26bcf5c4df41cad1b19c84af71c22cbc9ea9a547fc973f1f2cc9a290002c8b3c", size = 240220 },
|
||||
{ url = "https://files.pythonhosted.org/packages/65/4d/6f83ca1bddcf8e51bf8ff71572f39a1c73c34cf50e752a952c34f24d0a60/coverage-7.6.10-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:4e4630c26b6084c9b3cb53b15bd488f30ceb50b73c35c5ad7871b869cb7365fd", size = 239847 },
|
||||
{ url = "https://files.pythonhosted.org/packages/30/9d/2470df6aa146aff4c65fee0f87f58d2164a67533c771c9cc12ffcdb865d5/coverage-7.6.10-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:2396e8116db77789f819d2bc8a7e200232b7a282c66e0ae2d2cd84581a89757e", size = 237922 },
|
||||
{ url = "https://files.pythonhosted.org/packages/08/dd/723fef5d901e6a89f2507094db66c091449c8ba03272861eaefa773ad95c/coverage-7.6.10-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:79109c70cc0882e4d2d002fe69a24aa504dec0cc17169b3c7f41a1d341a73694", size = 239783 },
|
||||
{ url = "https://files.pythonhosted.org/packages/3d/f7/64d3298b2baf261cb35466000628706ce20a82d42faf9b771af447cd2b76/coverage-7.6.10-cp313-cp313-win32.whl", hash = "sha256:9e1747bab246d6ff2c4f28b4d186b205adced9f7bd9dc362051cc37c4a0c7bd6", size = 210965 },
|
||||
{ url = "https://files.pythonhosted.org/packages/d5/58/ec43499a7fc681212fe7742fe90b2bc361cdb72e3181ace1604247a5b24d/coverage-7.6.10-cp313-cp313-win_amd64.whl", hash = "sha256:254f1a3b1eef5f7ed23ef265eaa89c65c8c5b6b257327c149db1ca9d4a35f25e", size = 211719 },
|
||||
{ url = "https://files.pythonhosted.org/packages/ab/c9/f2857a135bcff4330c1e90e7d03446b036b2363d4ad37eb5e3a47bbac8a6/coverage-7.6.10-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:2ccf240eb719789cedbb9fd1338055de2761088202a9a0b73032857e53f612fe", size = 209050 },
|
||||
{ url = "https://files.pythonhosted.org/packages/aa/b3/f840e5bd777d8433caa9e4a1eb20503495709f697341ac1a8ee6a3c906ad/coverage-7.6.10-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:0c807ca74d5a5e64427c8805de15b9ca140bba13572d6d74e262f46f50b13273", size = 209321 },
|
||||
{ url = "https://files.pythonhosted.org/packages/85/7d/125a5362180fcc1c03d91850fc020f3831d5cda09319522bcfa6b2b70be7/coverage-7.6.10-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2bcfa46d7709b5a7ffe089075799b902020b62e7ee56ebaed2f4bdac04c508d8", size = 252039 },
|
||||
{ url = "https://files.pythonhosted.org/packages/a9/9c/4358bf3c74baf1f9bddd2baf3756b54c07f2cfd2535f0a47f1e7757e54b3/coverage-7.6.10-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4e0de1e902669dccbf80b0415fb6b43d27edca2fbd48c74da378923b05316098", size = 247758 },
|
||||
{ url = "https://files.pythonhosted.org/packages/cf/c7/de3eb6fc5263b26fab5cda3de7a0f80e317597a4bad4781859f72885f300/coverage-7.6.10-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3f7b444c42bbc533aaae6b5a2166fd1a797cdb5eb58ee51a92bee1eb94a1e1cb", size = 250119 },
|
||||
{ url = "https://files.pythonhosted.org/packages/3e/e6/43de91f8ba2ec9140c6a4af1102141712949903dc732cf739167cfa7a3bc/coverage-7.6.10-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:b330368cb99ef72fcd2dc3ed260adf67b31499584dc8a20225e85bfe6f6cfed0", size = 249597 },
|
||||
{ url = "https://files.pythonhosted.org/packages/08/40/61158b5499aa2adf9e37bc6d0117e8f6788625b283d51e7e0c53cf340530/coverage-7.6.10-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:9a7cfb50515f87f7ed30bc882f68812fd98bc2852957df69f3003d22a2aa0abf", size = 247473 },
|
||||
{ url = "https://files.pythonhosted.org/packages/50/69/b3f2416725621e9f112e74e8470793d5b5995f146f596f133678a633b77e/coverage-7.6.10-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:6f93531882a5f68c28090f901b1d135de61b56331bba82028489bc51bdd818d2", size = 248737 },
|
||||
{ url = "https://files.pythonhosted.org/packages/3c/6e/fe899fb937657db6df31cc3e61c6968cb56d36d7326361847440a430152e/coverage-7.6.10-cp313-cp313t-win32.whl", hash = "sha256:89d76815a26197c858f53c7f6a656686ec392b25991f9e409bcef020cd532312", size = 211611 },
|
||||
{ url = "https://files.pythonhosted.org/packages/1c/55/52f5e66142a9d7bc93a15192eba7a78513d2abf6b3558d77b4ca32f5f424/coverage-7.6.10-cp313-cp313t-win_amd64.whl", hash = "sha256:54a5f0f43950a36312155dae55c505a76cd7f2b12d26abeebbe7a0b36dbc868d", size = 212781 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "docstring-to-markdown"
|
||||
version = "0.15"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/7a/ad/6a66abd14676619bd56f6b924c96321a2e2d7d86558841d94a30023eec53/docstring-to-markdown-0.15.tar.gz", hash = "sha256:e146114d9c50c181b1d25505054a8d0f7a476837f0da2c19f07e06eaed52b73d", size = 29246 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/c1/cf/4eee59f6c4111b3e80cc32cf6bac483a90646f5c8693e84496c9855e8e38/docstring_to_markdown-0.15-py3-none-any.whl", hash = "sha256:27afb3faedba81e34c33521c32bbd258d7fbb79eedf7d29bc4e81080e854aec0", size = 21640 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iniconfig"
|
||||
version = "2.0.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d7/4b/cbd8e699e64a6f16ca3a8220661b5f83792b3017d0f79807cb8708d33913/iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3", size = 4646 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374", size = 5892 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jedi"
|
||||
version = "0.19.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "parso" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/72/3a/79a912fbd4d8dd6fbb02bf69afd3bb72cf0c729bb3063c6f4498603db17a/jedi-0.19.2.tar.gz", hash = "sha256:4770dc3de41bde3966b02eb84fbcf557fb33cce26ad23da12c742fb50ecb11f0", size = 1231287 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/c0/5a/9cac0c82afec3d09ccd97c8b6502d48f165f9124db81b4bcb90b4af974ee/jedi-0.19.2-py2.py3-none-any.whl", hash = "sha256:a8ef22bde8490f57fe5c7681a3c83cb58874daf72b4784de3cce5b6ef6edb5b9", size = 1572278 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "name"
|
||||
version = "0.1.0"
|
||||
source = { editable = "." }
|
||||
|
||||
[package.dev-dependencies]
|
||||
dev = [
|
||||
{ name = "pytest" },
|
||||
{ name = "pytest-cov" },
|
||||
{ name = "python-lsp-server" },
|
||||
{ name = "ruff" },
|
||||
]
|
||||
lint = [
|
||||
{ name = "ruff" },
|
||||
]
|
||||
lsp = [
|
||||
{ name = "python-lsp-server" },
|
||||
]
|
||||
test = [
|
||||
{ name = "pytest" },
|
||||
{ name = "pytest-cov" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
|
||||
[package.metadata.requires-dev]
|
||||
dev = [
|
||||
{ name = "pytest", specifier = ">=8.3.3" },
|
||||
{ name = "pytest-cov", specifier = ">=6.0.0" },
|
||||
{ name = "python-lsp-server" },
|
||||
{ name = "ruff", specifier = ">=0.6.7" },
|
||||
]
|
||||
lint = [{ name = "ruff", specifier = ">=0.6.7" }]
|
||||
lsp = [{ name = "python-lsp-server" }]
|
||||
test = [
|
||||
{ name = "pytest", specifier = ">=8.3.3" },
|
||||
{ name = "pytest-cov", specifier = ">=6.0.0" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "packaging"
|
||||
version = "24.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d0/63/68dbb6eb2de9cb10ee4c9c14a0148804425e13c4fb20d61cce69f53106da/packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f", size = 163950 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759", size = 65451 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parso"
|
||||
version = "0.8.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/66/94/68e2e17afaa9169cf6412ab0f28623903be73d1b32e208d9e8e541bb086d/parso-0.8.4.tar.gz", hash = "sha256:eb3a7b58240fb99099a345571deecc0f9540ea5f4dd2fe14c2a99d6b281ab92d", size = 400609 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/c6/ac/dac4a63f978e4dcb3c6d3a78c4d8e0192a113d288502a1216950c41b1027/parso-0.8.4-py2.py3-none-any.whl", hash = "sha256:a418670a20291dacd2dddc80c377c5c3791378ee1e8d12bffc35420643d43f18", size = 103650 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pluggy"
|
||||
version = "1.5.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/96/2d/02d4312c973c6050a18b314a5ad0b3210edb65a906f868e31c111dede4a6/pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1", size = 67955 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/88/5f/e351af9a41f866ac3f1fac4ca0613908d9a41741cfcf2228f4ad853b697d/pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669", size = 20556 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pytest"
|
||||
version = "8.3.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
||||
{ name = "iniconfig" },
|
||||
{ name = "packaging" },
|
||||
{ name = "pluggy" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/05/35/30e0d83068951d90a01852cb1cef56e5d8a09d20c7f511634cc2f7e0372a/pytest-8.3.4.tar.gz", hash = "sha256:965370d062bce11e73868e0335abac31b4d3de0e82f4007408d242b4f8610761", size = 1445919 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/11/92/76a1c94d3afee238333bc0a42b82935dd8f9cf8ce9e336ff87ee14d9e1cf/pytest-8.3.4-py3-none-any.whl", hash = "sha256:50e16d954148559c9a74109af1eaf0c945ba2d8f30f0a3d3335edde19788b6f6", size = 343083 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pytest-cov"
|
||||
version = "6.0.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "coverage" },
|
||||
{ name = "pytest" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/be/45/9b538de8cef30e17c7b45ef42f538a94889ed6a16f2387a6c89e73220651/pytest-cov-6.0.0.tar.gz", hash = "sha256:fde0b595ca248bb8e2d76f020b465f3b107c9632e6a1d1705f17834c89dcadc0", size = 66945 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/36/3b/48e79f2cd6a61dbbd4807b4ed46cb564b4fd50a76166b1c4ea5c1d9e2371/pytest_cov-6.0.0-py3-none-any.whl", hash = "sha256:eee6f1b9e61008bd34975a4d5bab25801eb31898b032dd55addc93e96fcaaa35", size = 22949 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "python-lsp-jsonrpc"
|
||||
version = "1.1.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "ujson" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/48/b6/fd92e2ea4635d88966bb42c20198df1a981340f07843b5e3c6694ba3557b/python-lsp-jsonrpc-1.1.2.tar.gz", hash = "sha256:4688e453eef55cd952bff762c705cedefa12055c0aec17a06f595bcc002cc912", size = 15298 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/cb/d9/656659d5b5d5f402b2b174cd0ba9bc827e07ce3c0bf88da65424baf64af8/python_lsp_jsonrpc-1.1.2-py3-none-any.whl", hash = "sha256:7339c2e9630ae98903fdaea1ace8c47fba0484983794d6aafd0bd8989be2b03c", size = 8805 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "python-lsp-server"
|
||||
version = "1.12.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "docstring-to-markdown" },
|
||||
{ name = "jedi" },
|
||||
{ name = "pluggy" },
|
||||
{ name = "python-lsp-jsonrpc" },
|
||||
{ name = "ujson" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/2b/15/b7e1577b9ca358e008b06910bf23cfa0a8be130ee9f319a262a3c610ee8d/python_lsp_server-1.12.0.tar.gz", hash = "sha256:b6a336f128da03bd9bac1e61c3acca6e84242b8b31055a1ccf49d83df9dc053b", size = 114328 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/1d/49/37c9659f76dbf1018d88892c14184db36ce9df09ea7d760162584aee8a58/python_lsp_server-1.12.0-py3-none-any.whl", hash = "sha256:2e912c661881d85f67f2076e4e66268b695b62bf127e07e81f58b187d4bb6eda", size = 74782 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ruff"
|
||||
version = "0.8.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/34/37/9c02181ef38d55b77d97c68b78e705fd14c0de0e5d085202bb2b52ce5be9/ruff-0.8.4.tar.gz", hash = "sha256:0d5f89f254836799af1615798caa5f80b7f935d7a670fad66c5007928e57ace8", size = 3402103 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/05/67/f480bf2f2723b2e49af38ed2be75ccdb2798fca7d56279b585c8f553aaab/ruff-0.8.4-py3-none-linux_armv6l.whl", hash = "sha256:58072f0c06080276804c6a4e21a9045a706584a958e644353603d36ca1eb8a60", size = 10546415 },
|
||||
{ url = "https://files.pythonhosted.org/packages/eb/7a/5aba20312c73f1ce61814e520d1920edf68ca3b9c507bd84d8546a8ecaa8/ruff-0.8.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:ffb60904651c00a1e0b8df594591770018a0f04587f7deeb3838344fe3adabac", size = 10346113 },
|
||||
{ url = "https://files.pythonhosted.org/packages/76/f4/c41de22b3728486f0aa95383a44c42657b2db4062f3234ca36fc8cf52d8b/ruff-0.8.4-py3-none-macosx_11_0_arm64.whl", hash = "sha256:6ddf5d654ac0d44389f6bf05cee4caeefc3132a64b58ea46738111d687352296", size = 9943564 },
|
||||
{ url = "https://files.pythonhosted.org/packages/0e/f0/afa0d2191af495ac82d4cbbfd7a94e3df6f62a04ca412033e073b871fc6d/ruff-0.8.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e248b1f0fa2749edd3350a2a342b67b43a2627434c059a063418e3d375cfe643", size = 10805522 },
|
||||
{ url = "https://files.pythonhosted.org/packages/12/57/5d1e9a0fd0c228e663894e8e3a8e7063e5ee90f8e8e60cf2085f362bfa1a/ruff-0.8.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bf197b98ed86e417412ee3b6c893f44c8864f816451441483253d5ff22c0e81e", size = 10306763 },
|
||||
{ url = "https://files.pythonhosted.org/packages/04/df/f069fdb02e408be8aac6853583572a2873f87f866fe8515de65873caf6b8/ruff-0.8.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c41319b85faa3aadd4d30cb1cffdd9ac6b89704ff79f7664b853785b48eccdf3", size = 11359574 },
|
||||
{ url = "https://files.pythonhosted.org/packages/d3/04/37c27494cd02e4a8315680debfc6dfabcb97e597c07cce0044db1f9dfbe2/ruff-0.8.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:9f8402b7c4f96463f135e936d9ab77b65711fcd5d72e5d67597b543bbb43cf3f", size = 12094851 },
|
||||
{ url = "https://files.pythonhosted.org/packages/81/b1/c5d7fb68506cab9832d208d03ea4668da9a9887a4a392f4f328b1bf734ad/ruff-0.8.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e4e56b3baa9c23d324ead112a4fdf20db9a3f8f29eeabff1355114dd96014604", size = 11655539 },
|
||||
{ url = "https://files.pythonhosted.org/packages/ef/38/8f8f2c8898dc8a7a49bc340cf6f00226917f0f5cb489e37075bcb2ce3671/ruff-0.8.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:736272574e97157f7edbbb43b1d046125fce9e7d8d583d5d65d0c9bf2c15addf", size = 12912805 },
|
||||
{ url = "https://files.pythonhosted.org/packages/06/dd/fa6660c279f4eb320788876d0cff4ea18d9af7d9ed7216d7bd66877468d0/ruff-0.8.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e5fe710ab6061592521f902fca7ebcb9fabd27bc7c57c764298b1c1f15fff720", size = 11205976 },
|
||||
{ url = "https://files.pythonhosted.org/packages/a8/d7/de94cc89833b5de455750686c17c9e10f4e1ab7ccdc5521b8fe911d1477e/ruff-0.8.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:13e9ec6d6b55f6da412d59953d65d66e760d583dd3c1c72bf1f26435b5bfdbae", size = 10792039 },
|
||||
{ url = "https://files.pythonhosted.org/packages/6d/15/3e4906559248bdbb74854af684314608297a05b996062c9d72e0ef7c7097/ruff-0.8.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:97d9aefef725348ad77d6db98b726cfdb075a40b936c7984088804dfd38268a7", size = 10400088 },
|
||||
{ url = "https://files.pythonhosted.org/packages/a2/21/9ed4c0e8133cb4a87a18d470f534ad1a8a66d7bec493bcb8bda2d1a5d5be/ruff-0.8.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:ab78e33325a6f5374e04c2ab924a3367d69a0da36f8c9cb6b894a62017506111", size = 10900814 },
|
||||
{ url = "https://files.pythonhosted.org/packages/0d/5d/122a65a18955bd9da2616b69bc839351f8baf23b2805b543aa2f0aed72b5/ruff-0.8.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:8ef06f66f4a05c3ddbc9121a8b0cecccd92c5bf3dd43b5472ffe40b8ca10f0f8", size = 11268828 },
|
||||
{ url = "https://files.pythonhosted.org/packages/43/a9/1676ee9106995381e3d34bccac5bb28df70194167337ed4854c20f27c7ba/ruff-0.8.4-py3-none-win32.whl", hash = "sha256:552fb6d861320958ca5e15f28b20a3d071aa83b93caee33a87b471f99a6c0835", size = 8805621 },
|
||||
{ url = "https://files.pythonhosted.org/packages/10/98/ed6b56a30ee76771c193ff7ceeaf1d2acc98d33a1a27b8479cbdb5c17a23/ruff-0.8.4-py3-none-win_amd64.whl", hash = "sha256:f21a1143776f8656d7f364bd264a9d60f01b7f52243fbe90e7670c0dfe0cf65d", size = 9660086 },
|
||||
{ url = "https://files.pythonhosted.org/packages/13/9f/026e18ca7d7766783d779dae5e9c656746c6ede36ef73c6d934aaf4a6dec/ruff-0.8.4-py3-none-win_arm64.whl", hash = "sha256:9183dd615d8df50defa8b1d9a074053891ba39025cf5ae88e8bcb52edcc4bf08", size = 9074500 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ujson"
|
||||
version = "5.10.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f0/00/3110fd566786bfa542adb7932d62035e0c0ef662a8ff6544b6643b3d6fd7/ujson-5.10.0.tar.gz", hash = "sha256:b3cd8f3c5d8c7738257f1018880444f7b7d9b66232c64649f562d7ba86ad4bc1", size = 7154885 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e8/a6/fd3f8bbd80842267e2d06c3583279555e8354c5986c952385199d57a5b6c/ujson-5.10.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:98ba15d8cbc481ce55695beee9f063189dce91a4b08bc1d03e7f0152cd4bbdd5", size = 55642 },
|
||||
{ url = "https://files.pythonhosted.org/packages/a8/47/dd03fd2b5ae727e16d5d18919b383959c6d269c7b948a380fdd879518640/ujson-5.10.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a9d2edbf1556e4f56e50fab7d8ff993dbad7f54bac68eacdd27a8f55f433578e", size = 51807 },
|
||||
{ url = "https://files.pythonhosted.org/packages/25/23/079a4cc6fd7e2655a473ed9e776ddbb7144e27f04e8fc484a0fb45fe6f71/ujson-5.10.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6627029ae4f52d0e1a2451768c2c37c0c814ffc04f796eb36244cf16b8e57043", size = 51972 },
|
||||
{ url = "https://files.pythonhosted.org/packages/04/81/668707e5f2177791869b624be4c06fb2473bf97ee33296b18d1cf3092af7/ujson-5.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f8ccb77b3e40b151e20519c6ae6d89bfe3f4c14e8e210d910287f778368bb3d1", size = 53686 },
|
||||
{ url = "https://files.pythonhosted.org/packages/bd/50/056d518a386d80aaf4505ccf3cee1c40d312a46901ed494d5711dd939bc3/ujson-5.10.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f3caf9cd64abfeb11a3b661329085c5e167abbe15256b3b68cb5d914ba7396f3", size = 58591 },
|
||||
{ url = "https://files.pythonhosted.org/packages/fc/d6/aeaf3e2d6fb1f4cfb6bf25f454d60490ed8146ddc0600fae44bfe7eb5a72/ujson-5.10.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6e32abdce572e3a8c3d02c886c704a38a1b015a1fb858004e03d20ca7cecbb21", size = 997853 },
|
||||
{ url = "https://files.pythonhosted.org/packages/f8/d5/1f2a5d2699f447f7d990334ca96e90065ea7f99b142ce96e85f26d7e78e2/ujson-5.10.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:a65b6af4d903103ee7b6f4f5b85f1bfd0c90ba4eeac6421aae436c9988aa64a2", size = 1140689 },
|
||||
{ url = "https://files.pythonhosted.org/packages/f2/2c/6990f4ccb41ed93744aaaa3786394bca0875503f97690622f3cafc0adfde/ujson-5.10.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:604a046d966457b6cdcacc5aa2ec5314f0e8c42bae52842c1e6fa02ea4bda42e", size = 1043576 },
|
||||
{ url = "https://files.pythonhosted.org/packages/14/f5/a2368463dbb09fbdbf6a696062d0c0f62e4ae6fa65f38f829611da2e8fdd/ujson-5.10.0-cp312-cp312-win32.whl", hash = "sha256:6dea1c8b4fc921bf78a8ff00bbd2bfe166345f5536c510671bccececb187c80e", size = 38764 },
|
||||
{ url = "https://files.pythonhosted.org/packages/59/2d/691f741ffd72b6c84438a93749ac57bf1a3f217ac4b0ea4fd0e96119e118/ujson-5.10.0-cp312-cp312-win_amd64.whl", hash = "sha256:38665e7d8290188b1e0d57d584eb8110951a9591363316dd41cf8686ab1d0abc", size = 42211 },
|
||||
{ url = "https://files.pythonhosted.org/packages/0d/69/b3e3f924bb0e8820bb46671979770c5be6a7d51c77a66324cdb09f1acddb/ujson-5.10.0-cp313-cp313-macosx_10_9_x86_64.whl", hash = "sha256:618efd84dc1acbd6bff8eaa736bb6c074bfa8b8a98f55b61c38d4ca2c1f7f287", size = 55646 },
|
||||
{ url = "https://files.pythonhosted.org/packages/32/8a/9b748eb543c6cabc54ebeaa1f28035b1bd09c0800235b08e85990734c41e/ujson-5.10.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:38d5d36b4aedfe81dfe251f76c0467399d575d1395a1755de391e58985ab1c2e", size = 51806 },
|
||||
{ url = "https://files.pythonhosted.org/packages/39/50/4b53ea234413b710a18b305f465b328e306ba9592e13a791a6a6b378869b/ujson-5.10.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:67079b1f9fb29ed9a2914acf4ef6c02844b3153913eb735d4bf287ee1db6e557", size = 51975 },
|
||||
{ url = "https://files.pythonhosted.org/packages/b4/9d/8061934f960cdb6dd55f0b3ceeff207fcc48c64f58b43403777ad5623d9e/ujson-5.10.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d7d0e0ceeb8fe2468c70ec0c37b439dd554e2aa539a8a56365fd761edb418988", size = 53693 },
|
||||
{ url = "https://files.pythonhosted.org/packages/f5/be/7bfa84b28519ddbb67efc8410765ca7da55e6b93aba84d97764cd5794dbc/ujson-5.10.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:59e02cd37bc7c44d587a0ba45347cc815fb7a5fe48de16bf05caa5f7d0d2e816", size = 58594 },
|
||||
{ url = "https://files.pythonhosted.org/packages/48/eb/85d465abafb2c69d9699cfa5520e6e96561db787d36c677370e066c7e2e7/ujson-5.10.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:2a890b706b64e0065f02577bf6d8ca3b66c11a5e81fb75d757233a38c07a1f20", size = 997853 },
|
||||
{ url = "https://files.pythonhosted.org/packages/9f/76/2a63409fc05d34dd7d929357b7a45e3a2c96f22b4225cd74becd2ba6c4cb/ujson-5.10.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:621e34b4632c740ecb491efc7f1fcb4f74b48ddb55e65221995e74e2d00bbff0", size = 1140694 },
|
||||
{ url = "https://files.pythonhosted.org/packages/45/ed/582c4daba0f3e1688d923b5cb914ada1f9defa702df38a1916c899f7c4d1/ujson-5.10.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:b9500e61fce0cfc86168b248104e954fead61f9be213087153d272e817ec7b4f", size = 1043580 },
|
||||
{ url = "https://files.pythonhosted.org/packages/d7/0c/9837fece153051e19c7bade9f88f9b409e026b9525927824cdf16293b43b/ujson-5.10.0-cp313-cp313-win32.whl", hash = "sha256:4c4fc16f11ac1612f05b6f5781b384716719547e142cfd67b65d035bd85af165", size = 38766 },
|
||||
{ url = "https://files.pythonhosted.org/packages/d7/72/6cb6728e2738c05bbe9bd522d6fc79f86b9a28402f38663e85a28fddd4a0/ujson-5.10.0-cp313-cp313-win_amd64.whl", hash = "sha256:4573fd1695932d4f619928fd09d5d03d917274381649ade4328091ceca175539", size = 42212 },
|
||||
]
|
||||
1
files/templates/rust/.envrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
use flake
|
||||
7
files/templates/rust/Cargo.lock
generated
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "rust"
|
||||
version = "0.1.0"
|
||||
6
files/templates/rust/Cargo.toml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[package]
|
||||
name = "rust"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
70
files/templates/rust/flake.nix
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
# heavily inspired by https://github.com/nulladmin1/nix-flake-templates/blob/main/rust-fenix-naersk/flake.nix
|
||||
{
|
||||
description = "Rust Flake using Fenix and Naersk";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
systems.url = "github:nix-systems/default";
|
||||
naersk.url = "github:nix-community/naersk";
|
||||
fenix = {
|
||||
url = "github:nix-community/fenix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self
|
||||
, nixpkgs
|
||||
, naersk
|
||||
, fenix
|
||||
, systems
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
forEachSystem = nixpkgs.lib.genAttrs (import systems);
|
||||
pkgsFor = forEachSystem (system:
|
||||
|
||||
import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
fenix.overlays.default
|
||||
];
|
||||
});
|
||||
rust-toolchain = forEachSystem (system: pkgsFor.${system}.fenix.stable);
|
||||
in
|
||||
{
|
||||
formatter = forEachSystem (system: pkgsFor.${system}.nixpkgs-fmt);
|
||||
|
||||
devShells = forEachSystem (system: {
|
||||
default = pkgsFor.${system}.mkShell {
|
||||
packages = with rust-toolchain.${system}; [
|
||||
cargo
|
||||
rustc
|
||||
clippy
|
||||
rustfmt
|
||||
rust-analyzer
|
||||
];
|
||||
env = {
|
||||
RUST_BACKTRACE = "full";
|
||||
};
|
||||
RUST_SRC_PATH = "${rust-toolchain.${system}.rust-src}/lib/rustlib/src/rust/library";
|
||||
};
|
||||
});
|
||||
|
||||
packages = forEachSystem (system: {
|
||||
default =
|
||||
(pkgsFor.${system}.callPackage naersk {
|
||||
inherit (rust-toolchain.${system}) cargo rustc;
|
||||
}).buildPackage {
|
||||
src = ./.;
|
||||
};
|
||||
});
|
||||
|
||||
apps = forEachSystem (system: {
|
||||
default = {
|
||||
type = "app";
|
||||
program = "${self.packages.${system}.default}/bin/rust";
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
3
files/templates/rust/src/main.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
BIN
files/topology-images/DELL-C2665dnf.png
Normal file
|
After Width: | Height: | Size: 122 KiB |
BIN
files/topology-images/TL-SG1005D.png
Normal file
|
After Width: | Height: | Size: 393 KiB |
BIN
files/topology-images/TL-SG108.png
Normal file
|
After Width: | Height: | Size: 139 KiB |
BIN
files/topology-images/ankisync.png
Normal file
|
After Width: | Height: | Size: 91 KiB |
BIN
files/topology-images/croc.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
files/topology-images/firefly-iii.png
Normal file
|
After Width: | Height: | Size: 90 KiB |
BIN
files/topology-images/freshrss.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
files/topology-images/huawei.png
Normal file
|
After Width: | Height: | Size: 157 KiB |
BIN
files/topology-images/hunsn.png
Normal file
|
After Width: | Height: | Size: 205 KiB |
BIN
files/topology-images/kavita.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
files/topology-images/koillection.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
files/topology-images/microbin.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
files/topology-images/mpd.png
Normal file
|
After Width: | Height: | Size: 9.7 KiB |
BIN
files/topology-images/nintendo-switch.png
Normal file
|
After Width: | Height: | Size: 84 KiB |
BIN
files/topology-images/pc.png
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
files/topology-images/readarr.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
files/topology-images/shlink.png
Normal file
|
After Width: | Height: | Size: 250 KiB |
196
files/vieb/viebrc
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
" Options
|
||||
set adblocker=update
|
||||
set adblockernotifications=all
|
||||
set cache=clearonquit
|
||||
set noclearcookiesonquit
|
||||
set nocleardownloadsoncompleted
|
||||
set nocleardownloadsonquit
|
||||
set clearhistoryinterval=none
|
||||
set noclearlocalstorageonquit
|
||||
set noclosablepinnedtabs
|
||||
set commandhist=persistuseronly
|
||||
set containerkeeponreopen
|
||||
set containernewtab=s:usecurrent
|
||||
set containershowname=automatic
|
||||
set containersplitpage=s:usecurrent
|
||||
set containerstartuppage=main
|
||||
set countlimit=100
|
||||
" set nodarkreader
|
||||
set darkreaderbg=#181a1b
|
||||
set darkreaderbrightness=100
|
||||
set darkreadercontrast=100
|
||||
set darkreaderfg=#e8e6e3
|
||||
set darkreadergrayscale=0
|
||||
set darkreadermode=dark
|
||||
set darkreadersepia=0
|
||||
set darkreadertextstroke=0
|
||||
set devtoolsposition=split
|
||||
set dialogalert=notifyblock
|
||||
set dialogconfirm=notifyallow
|
||||
set dialogprompt=notifyblock
|
||||
set downloadmethod=automatic
|
||||
set downloadpath=
|
||||
set encodeurlcopy=nospaces
|
||||
set encodeurlext=nospaces
|
||||
set explorehist=persist
|
||||
set externalcommand=
|
||||
set favicons=session
|
||||
set followchars=numbers
|
||||
set followfallbackaction=filter
|
||||
set followlabelposition=outsiderighttop
|
||||
set follownewtabswitch
|
||||
set guifontsize=14
|
||||
set guifullscreennavbar=oninput
|
||||
set guifullscreentabbar=onupdate
|
||||
set guihidetimeout=5000
|
||||
set guinavbar=oninput
|
||||
set guiscrollbar=onscroll
|
||||
set guitabbar=onupdate
|
||||
set historyperpage=100
|
||||
set ignorecase
|
||||
set incsearch
|
||||
set inputfocusalignment=rememberend
|
||||
set keeprecentlyclosed
|
||||
set lang=en
|
||||
set loadingindicator=line
|
||||
set mapsuggest=9000000000000000
|
||||
set mapsuggestposition=topright
|
||||
set markposition=newtab
|
||||
set markpositionshifted=default
|
||||
set maxmapdepth=10
|
||||
set menupage=elementasneeded
|
||||
set menusuggest=both
|
||||
set menuvieb=both
|
||||
set mintabwidth=28
|
||||
set mouse=all
|
||||
set mousedisabledbehavior=nothing
|
||||
set nomousefocus
|
||||
set mousenewtabswitch
|
||||
set mousevisualmode=onswitch
|
||||
set nativenotification=never
|
||||
set nativetheme=dark
|
||||
set newtaburl=
|
||||
set notificationduration=6000
|
||||
set notificationforpermissions=silent
|
||||
set notificationforsystemcommands=errors
|
||||
set notificationlimitsmall=3
|
||||
set notificationposition=bottomright
|
||||
set pdfbehavior=download
|
||||
set permissioncamera=ask
|
||||
set permissioncertificateerror=allow
|
||||
set permissionclipboardread=allow
|
||||
set permissionclipboardwrite=allow
|
||||
set permissionclosepage=allow
|
||||
set permissiondisplaycapture=ask
|
||||
set permissionfullscreen=allow
|
||||
set permissiongeolocation=block
|
||||
set permissionhid=block
|
||||
set permissionidledetection=block
|
||||
set permissionmediadevices=allowfull
|
||||
set permissionmicrophone=ask
|
||||
set permissionmidi=ask
|
||||
set permissionmidisysex=ask
|
||||
set permissionnotifications=ask
|
||||
set permissionopenexternal=ask
|
||||
set permissionpersistentstorage=ask
|
||||
set permissionpointerlock=block
|
||||
set permissionscreenwakelock=block
|
||||
set permissionsensors=block
|
||||
set permissionserial=block
|
||||
set permissionunknown=ask
|
||||
set permissionusb=allow
|
||||
set permissionwindowmanagement=ask
|
||||
set pointerposlocalid=domain
|
||||
set pointerpostype=casing
|
||||
set noquitonlasttabclose
|
||||
set redirecttohttp
|
||||
set noreloadtaboncrash
|
||||
set replacespecial=special
|
||||
set replacestartup=never
|
||||
set requesttimeout=20000
|
||||
set restoretabs=all
|
||||
set scrollposlocalid=domain
|
||||
set scrollpostype=casing
|
||||
set searchemptyscope=global
|
||||
set searchpointeralignment=left
|
||||
set searchscope=global
|
||||
set shell=
|
||||
set showcmd
|
||||
set smartcase
|
||||
set spell
|
||||
set nosplitbelow
|
||||
set nosplitright
|
||||
set nosponsorblock
|
||||
set suggestbouncedelay=100
|
||||
set suggestcommands=9000000000000000
|
||||
set suggesttopsites=10
|
||||
set suspendbackgroundtab
|
||||
set suspendonrestore=regular
|
||||
set suspendtimeout=0
|
||||
set tabclosefocus=left
|
||||
set tabcycle
|
||||
set tabnewposition=right
|
||||
set tabopenmuted=never
|
||||
set taboverflow=scroll
|
||||
set tabreopenmuted=remember
|
||||
set tabreopenposition=right
|
||||
set timeout
|
||||
set timeoutlen=2000
|
||||
set translateapi=auto
|
||||
set translatekey=
|
||||
set translatelang=en-us
|
||||
set translateurl=https://api-free.deepl.com/v2/
|
||||
" set nouserscript
|
||||
" set nouserstyle
|
||||
set useragent=%firefox
|
||||
set vimcommand=gvim
|
||||
set windowfullscreen=restore
|
||||
set windowmaximize=restore
|
||||
set windowposition=restore
|
||||
set windowsize=restore
|
||||
set windowtitle="%app - %title"
|
||||
|
||||
" Commands
|
||||
colorscheme default
|
||||
|
||||
|
||||
" Mappings
|
||||
nmap o <toExploreMode>
|
||||
nmap t <:tabnew><toExploreMode>
|
||||
nmap b <toCommandMode>buffer<Space>
|
||||
nmap g0 <:buffer 0>
|
||||
nmap g^ <:buffer 0>
|
||||
nmap g$ <:buffer -1>
|
||||
nmap <C-m> <:buffer #>
|
||||
nmap J <previousTab>
|
||||
nmap K <nextTab>
|
||||
nmap >> <moveTabForward>
|
||||
nmap <lt><lt> <moveTabBackward>
|
||||
nmap O <toExploreMode><End>
|
||||
nmap gx0 <:lclose>
|
||||
nmap gx$ <:rclose>
|
||||
nmap x <stopLoadingPage>
|
||||
nunmap [
|
||||
nunmap ]
|
||||
nmap [[ <previousPage>
|
||||
nmap ]] <nextPage>
|
||||
nmap [c <decreasePageNumber>
|
||||
nmap ]c <increasePageNumber>
|
||||
nmap zz <zoomReset>
|
||||
nmap zi <zoomIn>
|
||||
nmap zo <zoomOut>
|
||||
nmap zm 5<zoomIn>
|
||||
nmap zr 5<zoomOut>
|
||||
nmap zM 5<zoomIn>
|
||||
nmap zR 5<zoomOut>
|
||||
nmap zI 7<zoomIn>
|
||||
nmap zO 7<zoomOut>
|
||||
|
||||
" Search
|
||||
set searchengine=https://kagi.com/search?q=%s
|
||||
set searchwords+=no~https://search.nixos.org/options?query=%s
|
||||
set searchwords+=np~https://search.nixos.org/packages?query=%s
|
||||
set searchwords+=hm~https://home-manager-options.extranix.com/?query=%s
|
||||
|
||||
" Viebrc generated by Vieb
|
||||
" vim: ft=vim
|
||||
BIN
files/wallpaper/botanicswp.png
Normal file
|
After Width: | Height: | Size: 4.5 MiB |
BIN
files/wallpaper/lenovowp.png
Normal file
|
After Width: | Height: | Size: 7.9 MiB |
BIN
files/wallpaper/navidrome.png
Normal file
|
After Width: | Height: | Size: 78 KiB |
BIN
files/wallpaper/op6wp.png
Normal file
|
After Width: | Height: | Size: 2.5 MiB |
BIN
files/wallpaper/serverwp.png
Normal file
|
After Width: | Height: | Size: 557 KiB |
BIN
files/wallpaper/standwp.png
Normal file
|
After Width: | Height: | Size: 2.9 MiB |
BIN
files/wallpaper/surfacewp.png
Normal file
|
After Width: | Height: | Size: 3 MiB |
BIN
files/wallpaper/swarsel.png
Normal file
|
After Width: | Height: | Size: 86 KiB |
BIN
files/wallpaper/user.png
Normal file
|
After Width: | Height: | Size: 6.9 MiB |
265
files/waybar/style.css
Normal file
|
|
@ -0,0 +1,265 @@
|
|||
@define-color foreground #fdf6e3;
|
||||
@define-color background #1a1a1a;
|
||||
@define-color background-alt #292b2e;
|
||||
@define-color foreground-warning #268bd2;
|
||||
@define-color background-warning @background;
|
||||
@define-color foreground-error red;
|
||||
@define-color background-error @background;
|
||||
@define-color foreground-critical gold;
|
||||
@define-color background-critical blue;
|
||||
|
||||
|
||||
* {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
font-family: "FiraCode Nerd Font Propo", "Font Awesome 5 Free";
|
||||
font-size: 14px;
|
||||
min-height: 0;
|
||||
margin: -1px 0px;
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
background: transparent;
|
||||
color: @foreground;
|
||||
transition-duration: .5s;
|
||||
}
|
||||
|
||||
window#waybar.hidden {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
|
||||
#mpris {
|
||||
padding: 0 10px;
|
||||
background-color: transparent;
|
||||
color: #1DB954;
|
||||
font-family: Monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
#custom-right-arrow-dark,
|
||||
#custom-left-arrow-dark {
|
||||
color: @background;
|
||||
background: @background-alt;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
#window {
|
||||
font-size: 12px;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
#mode {
|
||||
background: @background-critical;
|
||||
color: @foreground-critical;
|
||||
padding: 0 3px;
|
||||
}
|
||||
|
||||
#privacy,
|
||||
#custom-configwarn {
|
||||
color: black;
|
||||
padding: 0 3px;
|
||||
animation-name: configblink;
|
||||
animation-duration: 0.5s;
|
||||
animation-timing-function: linear;
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: alternate;
|
||||
}
|
||||
|
||||
#custom-nix-updates {
|
||||
color: white;
|
||||
padding: 0 3px;
|
||||
}
|
||||
|
||||
#custom-outer-right-arrow-dark,
|
||||
#custom-outer-left-arrow-dark {
|
||||
color: @background;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
#custom-outer-left-arrow-dark,
|
||||
#custom-left-arrow-dark,
|
||||
#custom-left-arrow-light {
|
||||
margin: 0 -1px;
|
||||
}
|
||||
|
||||
#custom-right-arrow-light,
|
||||
#custom-left-arrow-light {
|
||||
color: @background-alt;
|
||||
background: @background;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
#workspaces,
|
||||
#clock.1,
|
||||
#clock.2,
|
||||
#clock.3,
|
||||
#pulseaudio,
|
||||
#memory,
|
||||
#cpu,
|
||||
#temperature,
|
||||
#custom-scratchpad-indicator,
|
||||
#power-profiles-daemon,
|
||||
#idle_inhibitor,
|
||||
#backlight-slider,
|
||||
#mpris,
|
||||
#tray {
|
||||
background: @background;
|
||||
}
|
||||
|
||||
#network,
|
||||
#custom-vpn,
|
||||
#clock.2,
|
||||
#battery,
|
||||
#cpu,
|
||||
#custom-pseudobat,
|
||||
#disk {
|
||||
background: @background-alt;
|
||||
}
|
||||
|
||||
|
||||
#workspaces button {
|
||||
padding: 0 2px;
|
||||
color: #fdf6e3;
|
||||
}
|
||||
#workspaces button.focused {
|
||||
color: @foreground-warning;
|
||||
}
|
||||
|
||||
#workspaces button:hover {
|
||||
background: @foreground;
|
||||
color: @background;
|
||||
border: @foreground;
|
||||
padding: 0 2px;
|
||||
box-shadow: inherit;
|
||||
text-shadow: inherit;
|
||||
}
|
||||
|
||||
#workspaces button.urgent {
|
||||
color: @background-critical;
|
||||
background: @foreground-critical;
|
||||
}
|
||||
|
||||
#custom-vpn,
|
||||
#network {
|
||||
color: #cc99c9;
|
||||
}
|
||||
|
||||
#temperature,
|
||||
#power-profiles-daemon {
|
||||
color: #9ec1cf;
|
||||
}
|
||||
|
||||
#disk {
|
||||
/*color: #b58900;*/
|
||||
color: #9ee09e;
|
||||
}
|
||||
|
||||
#custom-scratchpad-indicator {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#disk.warning {
|
||||
color: @foreground-error;
|
||||
background-color: @background-error;
|
||||
}
|
||||
#disk.critical,
|
||||
#temperature.critical {
|
||||
color: @foreground-critical;
|
||||
background-color: @background-critical;
|
||||
animation-name: blink;
|
||||
animation-duration: 0.5s;
|
||||
animation-timing-function: linear;
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: alternate;
|
||||
}
|
||||
#pulseaudio.muted {
|
||||
color: @foreground-error;
|
||||
}
|
||||
#memory {
|
||||
/*color: #2aa198;*/
|
||||
color: #fdfd97;
|
||||
}
|
||||
#cpu {
|
||||
/*color: #6c71c4;*/
|
||||
color: #feb144;
|
||||
}
|
||||
|
||||
#pulseaudio {
|
||||
/*color: #268bd2;*/
|
||||
color: #ff6663;
|
||||
}
|
||||
|
||||
#battery,
|
||||
#custom-pseudobat {
|
||||
color: cyan;
|
||||
}
|
||||
#battery.discharging {
|
||||
color: #859900;
|
||||
}
|
||||
|
||||
@keyframes blink {
|
||||
to {
|
||||
color: @foreground-error;
|
||||
background-color: @background-error;
|
||||
}
|
||||
}
|
||||
@keyframes configblink {
|
||||
to {
|
||||
color: @foreground-error;
|
||||
background-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
#battery.critical:not(.charging) {
|
||||
color: @foreground-critical;
|
||||
background-color: @background-critical;
|
||||
animation-name: blink;
|
||||
animation-duration: 0.5s;
|
||||
animation-timing-function: linear;
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: alternate;
|
||||
}
|
||||
|
||||
#backlight-slider slider {
|
||||
min-height: 0px;
|
||||
min-width: 0px;
|
||||
opacity: 0;
|
||||
background-image: none;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
#backlight-slider trough {
|
||||
min-height: 5px;
|
||||
min-width: 80px;
|
||||
border-radius: 5px;
|
||||
background-color: black;
|
||||
}
|
||||
#backlight-slider highlight {
|
||||
min-width: 0px;
|
||||
border-radius: 5px;
|
||||
background-color: grey;
|
||||
}
|
||||
|
||||
#clock.1,
|
||||
#clock.2,
|
||||
#clock.3 {
|
||||
font-family: Monospace;
|
||||
}
|
||||
|
||||
#clock,
|
||||
#pulseaudio,
|
||||
#memory,
|
||||
#cpu,
|
||||
#tray,
|
||||
#temperature,
|
||||
#power-profiles-daemon,
|
||||
#network,
|
||||
#custom-vpn,
|
||||
#mpris,
|
||||
#battery,
|
||||
#custom-scratchpad-indicator,
|
||||
#custom-pseudobat,
|
||||
#disk {
|
||||
padding: 0 3px;
|
||||
}
|
||||
340
files/zellij/config.kdl.nix
Normal file
|
|
@ -0,0 +1,340 @@
|
|||
{ config }:
|
||||
''
|
||||
pane_frames false
|
||||
simplified_ui false
|
||||
default_shell "zsh"
|
||||
copy_on_select true
|
||||
on_force_close "detach"
|
||||
|
||||
default_layout "default"
|
||||
layout_dir "${config.home.homeDirectory}/.config/zellij/layouts"
|
||||
theme_dir "${config.home.homeDirectory}/.config/zellij/themes"
|
||||
|
||||
keybinds clear-defaults=true {
|
||||
locked {
|
||||
bind "Ctrl g" { SwitchToMode "normal"; }
|
||||
}
|
||||
pane {
|
||||
bind "left" { MoveFocus "left"; }
|
||||
bind "down" { MoveFocus "down"; }
|
||||
bind "up" { MoveFocus "up"; }
|
||||
bind "right" { MoveFocus "right"; }
|
||||
bind "c" { SwitchToMode "renamepane"; PaneNameInput 0; }
|
||||
bind "d" { NewPane "down"; SwitchToMode "normal"; }
|
||||
bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "normal"; }
|
||||
bind "f" { ToggleFocusFullscreen; SwitchToMode "normal"; }
|
||||
bind "h" { MoveFocus "left"; }
|
||||
bind "j" { MoveFocus "down"; }
|
||||
bind "k" { MoveFocus "up"; }
|
||||
bind "l" { MoveFocus "right"; }
|
||||
bind "n" { NewPane; SwitchToMode "normal"; }
|
||||
bind "p" { SwitchFocus; }
|
||||
bind "Ctrl p" { SwitchToMode "normal"; }
|
||||
bind "r" { NewPane "right"; SwitchToMode "normal"; }
|
||||
bind "w" { ToggleFloatingPanes; SwitchToMode "normal"; }
|
||||
bind "z" { TogglePaneFrames; SwitchToMode "normal"; }
|
||||
}
|
||||
tab {
|
||||
bind "left" { GoToPreviousTab; }
|
||||
bind "down" { GoToNextTab; }
|
||||
bind "up" { GoToPreviousTab; }
|
||||
bind "right" { GoToNextTab; }
|
||||
bind "1" { GoToTab 1; SwitchToMode "normal"; }
|
||||
bind "2" { GoToTab 2; SwitchToMode "normal"; }
|
||||
bind "3" { GoToTab 3; SwitchToMode "normal"; }
|
||||
bind "4" { GoToTab 4; SwitchToMode "normal"; }
|
||||
bind "5" { GoToTab 5; SwitchToMode "normal"; }
|
||||
bind "6" { GoToTab 6; SwitchToMode "normal"; }
|
||||
bind "7" { GoToTab 7; SwitchToMode "normal"; }
|
||||
bind "8" { GoToTab 8; SwitchToMode "normal"; }
|
||||
bind "9" { GoToTab 9; SwitchToMode "normal"; }
|
||||
bind "[" { BreakPaneLeft; SwitchToMode "normal"; }
|
||||
bind "]" { BreakPaneRight; SwitchToMode "normal"; }
|
||||
bind "b" { BreakPane; SwitchToMode "normal"; }
|
||||
bind "h" { GoToPreviousTab; }
|
||||
bind "j" { GoToNextTab; }
|
||||
bind "k" { GoToPreviousTab; }
|
||||
bind "l" { GoToNextTab; }
|
||||
bind "n" { NewTab; SwitchToMode "normal"; }
|
||||
bind "r" { SwitchToMode "renametab"; TabNameInput 0; }
|
||||
bind "s" { ToggleActiveSyncTab; SwitchToMode "normal"; }
|
||||
bind "Ctrl t" { SwitchToMode "normal"; }
|
||||
bind "x" { CloseTab; SwitchToMode "normal"; }
|
||||
bind "tab" { ToggleTab; }
|
||||
}
|
||||
resize {
|
||||
bind "left" { Resize "Increase left"; }
|
||||
bind "down" { Resize "Increase down"; }
|
||||
bind "up" { Resize "Increase up"; }
|
||||
bind "right" { Resize "Increase right"; }
|
||||
bind "+" { Resize "Increase"; }
|
||||
bind "-" { Resize "Decrease"; }
|
||||
bind "=" { Resize "Increase"; }
|
||||
bind "H" { Resize "Decrease left"; }
|
||||
bind "J" { Resize "Decrease down"; }
|
||||
bind "K" { Resize "Decrease up"; }
|
||||
bind "L" { Resize "Decrease right"; }
|
||||
bind "h" { Resize "Increase left"; }
|
||||
bind "j" { Resize "Increase down"; }
|
||||
bind "k" { Resize "Increase up"; }
|
||||
bind "l" { Resize "Increase right"; }
|
||||
bind "Ctrl n" { SwitchToMode "normal"; }
|
||||
}
|
||||
move {
|
||||
bind "left" { MovePane "left"; }
|
||||
bind "down" { MovePane "down"; }
|
||||
bind "up" { MovePane "up"; }
|
||||
bind "right" { MovePane "right"; }
|
||||
bind "h" { MovePane "left"; }
|
||||
bind "Ctrl h" { SwitchToMode "normal"; }
|
||||
bind "j" { MovePane "down"; }
|
||||
bind "k" { MovePane "up"; }
|
||||
bind "l" { MovePane "right"; }
|
||||
bind "n" { MovePane; }
|
||||
bind "p" { MovePaneBackwards; }
|
||||
bind "tab" { MovePane; }
|
||||
}
|
||||
scroll {
|
||||
bind "e" { EditScrollback; SwitchToMode "normal"; }
|
||||
bind "s" { SwitchToMode "entersearch"; SearchInput 0; }
|
||||
}
|
||||
search {
|
||||
bind "c" { SearchToggleOption "CaseSensitivity"; }
|
||||
bind "n" { Search "down"; }
|
||||
bind "o" { SearchToggleOption "WholeWord"; }
|
||||
bind "p" { Search "up"; }
|
||||
bind "w" { SearchToggleOption "Wrap"; }
|
||||
}
|
||||
session {
|
||||
bind "c" {
|
||||
LaunchOrFocusPlugin "configuration" {
|
||||
floating true
|
||||
move_to_focused_tab true
|
||||
}
|
||||
SwitchToMode "normal"
|
||||
}
|
||||
bind "Ctrl o" { SwitchToMode "normal"; }
|
||||
bind "p" {
|
||||
LaunchOrFocusPlugin "plugin-manager" {
|
||||
floating true
|
||||
move_to_focused_tab true
|
||||
}
|
||||
SwitchToMode "normal"
|
||||
}
|
||||
bind "w" {
|
||||
LaunchOrFocusPlugin "session-manager" {
|
||||
floating true
|
||||
move_to_focused_tab true
|
||||
}
|
||||
SwitchToMode "normal"
|
||||
}
|
||||
}
|
||||
shared_except "locked" {
|
||||
bind "Alt left" { MoveFocusOrTab "left"; }
|
||||
bind "Alt down" { MoveFocus "down"; }
|
||||
bind "Alt up" { MoveFocus "up"; }
|
||||
bind "Alt right" { MoveFocusOrTab "right"; }
|
||||
bind "Alt +" { Resize "Increase"; }
|
||||
bind "Alt -" { Resize "Decrease"; }
|
||||
bind "Alt =" { Resize "Increase"; }
|
||||
bind "Alt [" { PreviousSwapLayout; }
|
||||
bind "Alt ]" { NextSwapLayout; }
|
||||
bind "Alt f" { ToggleFloatingPanes; }
|
||||
bind "Ctrl g" { SwitchToMode "locked"; }
|
||||
bind "Alt h" { MoveFocusOrTab "left"; }
|
||||
bind "Alt i" { MoveTab "left"; }
|
||||
bind "Alt j" { MoveFocus "down"; }
|
||||
bind "Alt k" { MoveFocus "up"; }
|
||||
bind "Alt l" { MoveFocusOrTab "right"; }
|
||||
bind "Alt n" { NewPane; }
|
||||
bind "Alt o" { MoveTab "right"; }
|
||||
bind "Ctrl q" { Quit; }
|
||||
}
|
||||
shared_except "locked" "move" {
|
||||
bind "Ctrl h" { SwitchToMode "move"; }
|
||||
}
|
||||
shared_except "locked" "session" {
|
||||
bind "Ctrl o" { SwitchToMode "session"; }
|
||||
}
|
||||
shared_except "locked" "scroll" "search" "tmux" {
|
||||
bind "Ctrl b" { SwitchToMode "tmux"; }
|
||||
}
|
||||
shared_except "locked" "scroll" "search" {
|
||||
bind "Ctrl s" { SwitchToMode "scroll"; }
|
||||
}
|
||||
shared_except "locked" "tab" {
|
||||
bind "Ctrl t" { SwitchToMode "tab"; }
|
||||
}
|
||||
shared_except "locked" "pane" {
|
||||
bind "Ctrl p" { SwitchToMode "pane"; }
|
||||
}
|
||||
shared_except "locked" "resize" {
|
||||
bind "Ctrl n" { SwitchToMode "resize"; }
|
||||
}
|
||||
shared_except "normal" "locked" "entersearch" {
|
||||
bind "enter" { SwitchToMode "normal"; }
|
||||
}
|
||||
shared_except "normal" "locked" "entersearch" "renametab" "renamepane" {
|
||||
bind "esc" { SwitchToMode "normal"; }
|
||||
}
|
||||
shared_among "pane" "tmux" {
|
||||
bind "x" { CloseFocus; SwitchToMode "normal"; }
|
||||
}
|
||||
shared_among "scroll" "search" {
|
||||
bind "PageDown" { PageScrollDown; }
|
||||
bind "PageUp" { PageScrollUp; }
|
||||
bind "left" { PageScrollUp; }
|
||||
bind "down" { ScrollDown; }
|
||||
bind "up" { ScrollUp; }
|
||||
bind "right" { PageScrollDown; }
|
||||
bind "Ctrl b" { PageScrollUp; }
|
||||
bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; }
|
||||
bind "d" { HalfPageScrollDown; }
|
||||
bind "Ctrl f" { PageScrollDown; }
|
||||
bind "h" { PageScrollUp; }
|
||||
bind "j" { ScrollDown; }
|
||||
bind "k" { ScrollUp; }
|
||||
bind "l" { PageScrollDown; }
|
||||
bind "Ctrl s" { SwitchToMode "normal"; }
|
||||
bind "u" { HalfPageScrollUp; }
|
||||
}
|
||||
entersearch {
|
||||
bind "Ctrl c" { SwitchToMode "scroll"; }
|
||||
bind "esc" { SwitchToMode "scroll"; }
|
||||
bind "enter" { SwitchToMode "search"; }
|
||||
}
|
||||
renametab {
|
||||
bind "esc" { UndoRenameTab; SwitchToMode "tab"; }
|
||||
}
|
||||
shared_among "renametab" "renamepane" {
|
||||
bind "Ctrl c" { SwitchToMode "normal"; }
|
||||
}
|
||||
renamepane {
|
||||
bind "esc" { UndoRenamePane; SwitchToMode "pane"; }
|
||||
}
|
||||
shared_among "session" "tmux" {
|
||||
bind "d" { Detach; }
|
||||
}
|
||||
tmux {
|
||||
bind "left" { MoveFocus "left"; SwitchToMode "normal"; }
|
||||
bind "down" { MoveFocus "down"; SwitchToMode "normal"; }
|
||||
bind "up" { MoveFocus "up"; SwitchToMode "normal"; }
|
||||
bind "right" { MoveFocus "right"; SwitchToMode "normal"; }
|
||||
bind "space" { NextSwapLayout; }
|
||||
bind "\"" { NewPane "down"; SwitchToMode "normal"; }
|
||||
bind "%" { NewPane "right"; SwitchToMode "normal"; }
|
||||
bind "," { SwitchToMode "renametab"; }
|
||||
bind "[" { SwitchToMode "scroll"; }
|
||||
bind "Ctrl b" { Write 2; SwitchToMode "normal"; }
|
||||
bind "c" { NewTab; SwitchToMode "normal"; }
|
||||
bind "h" { MoveFocus "left"; SwitchToMode "normal"; }
|
||||
bind "j" { MoveFocus "down"; SwitchToMode "normal"; }
|
||||
bind "k" { MoveFocus "up"; SwitchToMode "normal"; }
|
||||
bind "l" { MoveFocus "right"; SwitchToMode "normal"; }
|
||||
bind "n" { GoToNextTab; SwitchToMode "normal"; }
|
||||
bind "o" { FocusNextPane; }
|
||||
bind "p" { GoToPreviousTab; SwitchToMode "normal"; }
|
||||
bind "z" { ToggleFocusFullscreen; SwitchToMode "normal"; }
|
||||
}
|
||||
}
|
||||
|
||||
// Plugin aliases - can be used to change the implementation of Zellij
|
||||
// changing these requires a restart to take effect
|
||||
plugins {
|
||||
compact-bar location="zellij:compact-bar"
|
||||
configuration location="zellij:configuration"
|
||||
filepicker location="zellij:strider" {
|
||||
cwd "/"
|
||||
}
|
||||
plugin-manager location="zellij:plugin-manager"
|
||||
session-manager location="zellij:session-manager"
|
||||
status-bar location="zellij:status-bar"
|
||||
strider location="zellij:strider"
|
||||
tab-bar location="zellij:tab-bar"
|
||||
welcome-screen location="zellij:session-manager" {
|
||||
welcome_screen true
|
||||
}
|
||||
}
|
||||
|
||||
// Plugins to load in the background when a new session starts
|
||||
// eg. "file:/path/to/my-plugin.wasm"
|
||||
// eg. "https://example.com/my-plugin.wasm"
|
||||
load_plugins {
|
||||
}
|
||||
|
||||
// Provide a command to execute when copying text. The text will be piped to
|
||||
// the stdin of the program to perform the copy. This can be used with
|
||||
// terminal emulators which do not support the OSC 52 ANSI control sequence
|
||||
// that will be used by default if this option is not set.
|
||||
// Examples:
|
||||
//
|
||||
// copy_command "xclip -selection clipboard" // x11
|
||||
// copy_command "wl-copy" // wayland
|
||||
// copy_command "pbcopy" // osx
|
||||
//
|
||||
// copy_command "pbcopy"
|
||||
|
||||
// Choose the destination for copied text
|
||||
// Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard.
|
||||
// Does not apply when using copy_command.
|
||||
// Options:
|
||||
// - system (default)
|
||||
// - primary
|
||||
//
|
||||
// copy_clipboard "primary"
|
||||
|
||||
// Path to the default editor to use to edit pane scrollbuffer
|
||||
// Default: $EDITOR or $VISUAL
|
||||
// scrollback_editor "/usr/bin/vim"
|
||||
|
||||
// Toggle between having Zellij lay out panes according to a predefined set of layouts whenever possible
|
||||
// Options:
|
||||
// - true (default)
|
||||
// - false
|
||||
//
|
||||
// auto_layout false
|
||||
|
||||
// Whether sessions should be serialized to the cache folder (including their tabs/panes, cwds and running commands) so that they can later be resurrected
|
||||
// Options:
|
||||
// - true (default)
|
||||
// - false
|
||||
//
|
||||
// session_serialization false
|
||||
|
||||
// Whether pane viewports are serialized along with the session, default is false
|
||||
// Options:
|
||||
// - true
|
||||
// - false (default)
|
||||
//
|
||||
// serialize_pane_viewport false
|
||||
|
||||
// Scrollback lines to serialize along with the pane viewport when serializing sessions, 0
|
||||
// defaults to the scrollback size. If this number is higher than the scrollback size, it will
|
||||
// also default to the scrollback size. This does nothing if `serialize_pane_viewport` is not true.
|
||||
//
|
||||
// scrollback_lines_to_serialize 10000
|
||||
|
||||
// Enable or disable the rendering of styled and colored underlines (undercurl).
|
||||
// May need to be disabled for certain unsupported terminals
|
||||
// (Requires restart)
|
||||
// Default: true
|
||||
//
|
||||
// styled_underlines false
|
||||
|
||||
// How often in seconds sessions are serialized
|
||||
//
|
||||
// serialization_interval 10000
|
||||
|
||||
// Enable or disable writing of session metadata to disk (if disabled, other sessions might not know
|
||||
// metadata info on this session)
|
||||
// (Requires restart)
|
||||
// Default: false
|
||||
//
|
||||
// disable_session_metadata false
|
||||
|
||||
// Enable or disable support for the enhanced Kitty Keyboard Protocol (the host terminal must also support it)
|
||||
// (Requires restart)
|
||||
// Default: true (if the host terminal supports it)
|
||||
//
|
||||
// support_kitty_keyboard_protocol false
|
||||
''
|
||||
159
files/zellij/layouts/default.kdl.nix
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
{ config, pkgs }:
|
||||
let
|
||||
inherit (config.lib.stylix) colors;
|
||||
in
|
||||
''
|
||||
layout {
|
||||
swap_tiled_layout name="vertical" {
|
||||
tab max_panes=5 {
|
||||
pane split_direction="vertical" {
|
||||
pane
|
||||
pane { children; }
|
||||
}
|
||||
}
|
||||
tab max_panes=8 {
|
||||
pane split_direction="vertical" {
|
||||
pane { children; }
|
||||
pane { pane; pane; pane; pane; }
|
||||
}
|
||||
}
|
||||
tab max_panes=12 {
|
||||
pane split_direction="vertical" {
|
||||
pane { children; }
|
||||
pane { pane; pane; pane; pane; }
|
||||
pane { pane; pane; pane; pane; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
swap_tiled_layout name="horizontal" {
|
||||
tab max_panes=5 {
|
||||
pane
|
||||
pane
|
||||
}
|
||||
tab max_panes=8 {
|
||||
pane {
|
||||
pane split_direction="vertical" { children; }
|
||||
pane split_direction="vertical" { pane; pane; pane; pane; }
|
||||
}
|
||||
}
|
||||
tab max_panes=12 {
|
||||
pane {
|
||||
pane split_direction="vertical" { children; }
|
||||
pane split_direction="vertical" { pane; pane; pane; pane; }
|
||||
pane split_direction="vertical" { pane; pane; pane; pane; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
swap_tiled_layout name="stacked" {
|
||||
tab min_panes=5 {
|
||||
pane split_direction="vertical" {
|
||||
pane
|
||||
pane stacked=true { children; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
swap_floating_layout name="staggered" {
|
||||
floating_panes
|
||||
}
|
||||
|
||||
swap_floating_layout name="enlarged" {
|
||||
floating_panes max_panes=10 {
|
||||
pane { x "5%"; y 1; width "90%"; height "90%"; }
|
||||
pane { x "5%"; y 2; width "90%"; height "90%"; }
|
||||
pane { x "5%"; y 3; width "90%"; height "90%"; }
|
||||
pane { x "5%"; y 4; width "90%"; height "90%"; }
|
||||
pane { x "5%"; y 5; width "90%"; height "90%"; }
|
||||
pane { x "5%"; y 6; width "90%"; height "90%"; }
|
||||
pane { x "5%"; y 7; width "90%"; height "90%"; }
|
||||
pane { x "5%"; y 8; width "90%"; height "90%"; }
|
||||
pane { x "5%"; y 9; width "90%"; height "90%"; }
|
||||
pane focus=true { x 10; y 10; width "90%"; height "90%"; }
|
||||
}
|
||||
}
|
||||
|
||||
swap_floating_layout name="spread" {
|
||||
floating_panes max_panes=1 {
|
||||
pane {y "50%"; x "50%"; }
|
||||
}
|
||||
floating_panes max_panes=2 {
|
||||
pane { x "1%"; y "25%"; width "45%"; }
|
||||
pane { x "50%"; y "25%"; width "45%"; }
|
||||
}
|
||||
floating_panes max_panes=3 {
|
||||
pane focus=true { y "55%"; width "45%"; height "45%"; }
|
||||
pane { x "1%"; y "1%"; width "45%"; }
|
||||
pane { x "50%"; y "1%"; width "45%"; }
|
||||
}
|
||||
floating_panes max_panes=4 {
|
||||
pane { x "1%"; y "55%"; width "45%"; height "45%"; }
|
||||
pane focus=true { x "50%"; y "55%"; width "45%"; height "45%"; }
|
||||
pane { x "1%"; y "1%"; width "45%"; height "45%"; }
|
||||
pane { x "50%"; y "1%"; width "45%"; height "45%"; }
|
||||
}
|
||||
}
|
||||
|
||||
default_tab_template {
|
||||
children
|
||||
pane size=1 borderless=true {
|
||||
plugin location="file://${pkgs.zjstatus}/bin/zjstatus.wasm" {
|
||||
format_left "{mode}#[bg=#${colors.base00}] {tabs}"
|
||||
format_center ""
|
||||
format_right "#[bg=#${colors.base00},fg=#${colors.base02}]#[bg=#${colors.base02},fg=#${colors.base01},bold] #[bg=#${colors.base02},fg=#${colors.base01},bold] {session} #[bg=#${colors.base02},fg=#${colors.base01},bold]"
|
||||
format_space ""
|
||||
format_hide_on_overlength "false"
|
||||
format_precedence "lcr"
|
||||
|
||||
border_enabled "false"
|
||||
border_char "─"
|
||||
border_format "#[fg=#6C7086]{char}"
|
||||
border_position "top"
|
||||
|
||||
mode_normal "#[bg=#${colors.base0B},fg=#${colors.base01},bold] NORMAL#[bg=#${colors.base01},fg=#${colors.base0B}]█"
|
||||
mode_locked "#[bg=#${colors.base04},fg=#${colors.base01},bold] LOCKED #[bg=#${colors.base01},fg=#${colors.base04}]█"
|
||||
mode_resize "#[bg=#${colors.base08},fg=#${colors.base01},bold] RESIZE#[bg=#${colors.base01},fg=#${colors.base08}]█"
|
||||
mode_pane "#[bg=#${colors.base0D},fg=#${colors.base01},bold] PANE#[bg=#${colors.base01},fg=#${colors.base0D}]█"
|
||||
mode_tab "#[bg=#${colors.base07},fg=#${colors.base01},bold] TAB#[bg=#${colors.base01},fg=#${colors.base07}]█"
|
||||
mode_scroll "#[bg=#${colors.base0A},fg=#${colors.base01},bold] SCROLL#[bg=#${colors.base01},fg=#${colors.base0A}]█"
|
||||
mode_enter_search "#[bg=#${colors.base0D},fg=#${colors.base01},bold] ENT-SEARCH#[bg=#${colors.base01},fg=#${colors.base0D}]█"
|
||||
mode_search "#[bg=#${colors.base0D},fg=#${colors.base01},bold] SEARCHARCH#[bg=#${colors.base01},fg=#${colors.base0D}]█"
|
||||
mode_rename_tab "#[bg=#${colors.base07},fg=#${colors.base01},bold] RENAME-TAB#[bg=#${colors.base01},fg=#${colors.base07}]█"
|
||||
mode_rename_pane "#[bg=#${colors.base0D},fg=#${colors.base01},bold] RENAME-PANE#[bg=#${colors.base01},fg=#${colors.base0D}]█"
|
||||
mode_session "#[bg=#${colors.base0E},fg=#${colors.base01},bold] SESSION#[bg=#${colors.base01},fg=#${colors.base0E}]█"
|
||||
mode_move "#[bg=#${colors.base0F},fg=#${colors.base01},bold] MOVE#[bg=#${colors.base01},fg=#${colors.base0F}]█"
|
||||
mode_prompt "#[bg=#${colors.base0D},fg=#${colors.base01},bold] PROMPT#[bg=#${colors.base01},fg=#${colors.base0D}]█"
|
||||
mode_tmux "#[bg=#${colors.base09},fg=#${colors.base01},bold] TMUX#[bg=#${colors.base01},fg=#${colors.base09}]█"
|
||||
|
||||
// formatting for inactive tabs
|
||||
tab_normal "#[bg=#${colors.base01},fg=#${colors.base0C}]█#[bg=#${colors.base0C},fg=#${colors.base01},bold]{index} #[bg=#${colors.base01},fg=#${colors.base0C},bold] {name}{floating_indicator}#[bg=#${colors.base01},fg=#${colors.base01},bold]█"
|
||||
tab_normal_fullscreen "#[bg=#${colors.base01},fg=#${colors.base0C}]█#[bg=#${colors.base0C},fg=#${colors.base01},bold]{index} #[bg=#${colors.base01},fg=#${colors.base0C},bold] {name}{fullscreen_indicator}#[bg=#${colors.base01},fg=#${colors.base01},bold]█"
|
||||
tab_normal_sync "#[bg=#${colors.base01},fg=#${colors.base0C}]█#[bg=#${colors.base0C},fg=#${colors.base01},bold]{index} #[bg=#${colors.base01},fg=#${colors.base0C},bold] {name}{sync_indicator}#[bg=#${colors.base01},fg=#${colors.base01},bold]█"
|
||||
|
||||
// formatting for the current active tab
|
||||
tab_active "#[bg=#${colors.base01},fg=#${colors.base09}]█#[bg=#${colors.base09},fg=#${colors.base01},bold]{index} #[bg=#${colors.base01},fg=#${colors.base09},bold] {name}{floating_indicator}#[bg=#${colors.base01},fg=#${colors.base01},bold]█"
|
||||
tab_active_fullscreen "#[bg=#${colors.base01},fg=#${colors.base09}]█#[bg=#${colors.base09},fg=#${colors.base01},bold]{index} #[bg=#${colors.base01},fg=#${colors.base09},bold] {name}{fullscreen_indicator}#[bg=#${colors.base01},fg=#${colors.base01},bold]█"
|
||||
tab_active_sync "#[bg=#${colors.base01},fg=#${colors.base09}]█#[bg=#${colors.base09},fg=#${colors.base01},bold]{index} #[bg=#${colors.base01},fg=#${colors.base09},bold] {name}{sync_indicator}#[bg=#${colors.base01},fg=#${colors.base01},bold]█"
|
||||
|
||||
// separator between the tabs
|
||||
tab_separator "#[bg=#${colors.base00}] "
|
||||
|
||||
// indicators
|
||||
tab_sync_indicator " "
|
||||
tab_fullscreen_indicator " "
|
||||
tab_floating_indicator " "
|
||||
|
||||
command_git_branch_command "git rev-parse --abbrev-ref HEAD"
|
||||
command_git_branch_format "#[fg=blue] {stdout} "
|
||||
command_git_branch_interval "10"
|
||||
command_git_branch_rendermode "static"
|
||||
|
||||
datetime "#[fg=#6C7086,bold] {format} "
|
||||
datetime_format "%A, %d %b %Y %H:%M"
|
||||
datetime_timezone "Europe/Vienna"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
''
|
||||