Merge branch 'master' of git.2li.ch:Nebucatnetzer/nixos

This commit is contained in:
Andreas Zweili 2023-08-02 08:48:46 +02:00
commit 7ad9b27fad
17 changed files with 70 additions and 76 deletions

View File

@ -4,19 +4,6 @@ This repository contains my configuration for my Nixos systems.
I don't provide any garantuees that it will work on other systems.
In addition some of the scripts required for installation will destroy your data when used.
## VM installation
This allows you to setup a VM with minimal effort.
However this requires some prerequisites.
- A VM running the minimal NixOS ISO reachable with SSH under nixos@nixos.2li.local.
- The VM runs UEFI.
- You've set a password for the nixos user.
1. `./scripts/install_new_vm.sh`
2. Provide the required information and wait until the script is finished.
3. Reboot and profit!
## Raspberry Pi installation
1. Add the new system to `flake.nix`.
@ -34,14 +21,13 @@ However this requires some prerequisites.
1. `curl https://git.2li.ch/Nebucatnetzer/nixos/archive/master.tar.gz | tar xz`
2. `cd nixos && nix-shell`
3. `sudo python3 scripts/format-disk.py`
3. `sudo ./scripts/format-disk.py`
4. `sudo nixos-install --no-root-passwd --root /mnt --impure --flake .#SYSTEMNAME`
## Update remote systems
Simply run the script `scripts/update_all_systems.xsh` and it will iterate over
all defined systems.
The script requires Xonsh but can be easily adapted to BASH or similar.
Simply run the script `scripts/remote_switch.sh` and it will iterate over
all defined systems. With the option `-r` the systems will reboot as well.
## Non-Nixos System

View File

@ -9,11 +9,11 @@
]
},
"locked": {
"lastModified": 1689334118,
"narHash": "sha256-djk5AZv1yU84xlKFaVHqFWvH73U7kIRstXwUAnDJPsk=",
"lastModified": 1690228878,
"narHash": "sha256-9Xe7JV0krp4RJC9W9W9WutZVlw6BlHTFMiUP/k48LQY=",
"owner": "ryantm",
"repo": "agenix",
"rev": "0d8c5325fc81daf00532e3e26c6752f7bcde1143",
"rev": "d8c973fd228949736dedf61b7f8cc1ece3236792",
"type": "github"
},
"original": {
@ -88,11 +88,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1689320556,
"narHash": "sha256-vODUkZLWFVCvo1KPK3dC2CbXjxa9antEn5ozwlcTr48=",
"lastModified": 1690704397,
"narHash": "sha256-sgIWjcz0e+x87xlKg324VtHgH55J5rIuFF0ZWRDvQoE=",
"owner": "nixos",
"repo": "nixos-hardware",
"rev": "d4ea64f2063820120c05f6ba93ee02e6d4671d6b",
"rev": "96e5a0a0e8568c998135ea05575a9ed2c87f5492",
"type": "github"
},
"original": {
@ -103,11 +103,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1689431009,
"narHash": "sha256-hPgQCRWP5q/Xc4qOIP3c2krR9nQua78+t9EDiuey5nc=",
"lastModified": 1690726002,
"narHash": "sha256-cACz6jCJZtsZHGCJAN4vMobxzH5s6FCOTZHMrh/Hu0M=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "af8279f65fe71ce5a448408034a8c06e2b4b2c66",
"rev": "391e8db1f06c3f74c2d313a73135515023af3993",
"type": "github"
},
"original": {
@ -119,11 +119,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1689534811,
"narHash": "sha256-jnSUdzD/414d94plCyNlvTJJtiTogTep6t7ZgIKIHiE=",
"lastModified": 1690789960,
"narHash": "sha256-3K+2HuyGTiJUSZNJxXXvc0qj4xFx1FHC/ItYtEa7/Xs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6cee3b5893090b0f5f0a06b4cf42ca4e60e5d222",
"rev": "fb942492b7accdee4e6d17f5447091c65897dde4",
"type": "github"
},
"original": {

View File

@ -106,7 +106,6 @@ in
epkgs.xclip
epkgs.yaml-mode
epkgs.yasnippet-snippets
epkgs.zetteldeft
languagetool
mu # needed for mailing
rufo # formatter for Ruby

View File

@ -31,10 +31,3 @@
(interactive)
(persp-switch "notes")
(deft)))
(use-package zetteldeft
:after deft
:config (zetteldeft-set-classic-keybindings)
(setq zetteldeft-link-indicator "[["
zetteldeft-link-suffix "]]")
(setq zetteldeft-title-prefix "# "))

View File

@ -1,8 +1,23 @@
(use-package denote
:bind
(("C-c C-n r" . denote-rename-file)
("C-c C-n n" . denote-create-file))
(("C-c n r" . denote-rename-file)
("C-c n p" . az-denote-create-new-note-from-region)
("C-c n n" . denote))
:config
(setq denote-file-type "markdown-yaml"
(defun az-denote-create-new-note-from-region (beg end)
"Create note whose contents include the text between BEG and END. Prompt
for title and keywords of the new note."
(interactive "r")
(if-let (((region-active-p))
(text
(buffer-substring-no-properties beg end)))
(progn (denote
(denote-title-prompt) (denote-keywords-prompt)) (insert text))
(user-error
"No region is available")))
(add-hook 'find-file-hook #'denote-link-buttonize-buffer)
(setq denote-rename-buffer-mode 1
denote-excluded-directories-regexp "99_archive"
denote-file-type "markdown-yaml"
denote-directory "~/nextcloud/10_documents/"
denote-excluded-directories-regexp "99_archive/*"))
denote-yaml-front-matter "---\ntitle: %s\ndate: %s\ntags: %s\nidentifier: %S\n---\n\n"))

View File

@ -56,3 +56,16 @@
;; switch focus to man page
(setq man-notify-method t)
;; use ripgrep or rg if possible
(setq xref-search-program (cond ((or (executable-find "ripgrep")
(executable-find "rg")) 'ripgrep)
((executable-find "ugrep") 'ugrep) (t
'grep)))
;; required for autoloading packages on nixos
(dolist (path load-path)
(when (string-match-p "/nix/store/[a-z0-9]\\{32\\}-emacs-packages-deps.*" path)
(dolist (autoload-file (directory-files path t "-autoloads.el"))
(with-demoted-errors "init.el error: %s"
(load autoload-file nil t)))))

View File

@ -17,6 +17,7 @@
;; note taking and writing
(load-file (modules-path "az_deft_raw.el"))
(load-file (modules-path "az_deft.el"))
(load-file (modules-path "az_denote.el"))
(load-file (modules-path "az_hyperbole.el"))
(load-file (modules-path "az_langtool.el"))
(load-file (modules-path "az_markdown.el"))

View File

@ -1,4 +1,14 @@
{ inputs, pkgs, ... }:
let
az-media = pkgs.writeShellScriptBin "az-media" ''
videos="videos"
directory="''${1:-videos}"
for i in $(seq 1 4);
do
nvidia-offload mpv --shuffle --mute=yes "/run/media/andreas/e7c05e7e-79ec-45af-b1c8-840020fcf708/$directory/" &
done
'';
in
{
imports = [
"${inputs.self}/home-manager/modules"
@ -13,6 +23,7 @@
shotwell
sound-juicer
unstable.tagger
az-media
];
};

View File

@ -24,7 +24,7 @@ in
containers."gitea" = {
# https://blog.gitea.io/
# https://hub.docker.com/r/gitea/gitea/tags
image = "gitea/gitea:1.19.4";
image = "gitea/gitea:1.20.2";
autoStart = true;
environment = {
PUID = "1000";

View File

@ -31,7 +31,7 @@ in
containers."plex" = {
autoStart = true;
# https://fleet.linuxserver.io/image?name=linuxserver/plex
image = "lscr.io/linuxserver/plex:1.32.4";
image = "lscr.io/linuxserver/plex:1.32.5";
environment = {
TZ = " Europe/Zurich ";
PUID = "1000";

View File

@ -15,7 +15,7 @@ in
backend = "docker";
containers."rss-bridge" = {
# https://hub.docker.com/r/rssbridge/rss-bridge/tags
image = "rssbridge/rss-bridge@sha256:a3620a5f39673ea6fc6e2d0ea99164174b542823cd593bd26564e92ef92d0676";
image = "rssbridge/rss-bridge@sha256:31d2e27f40b10291f0f2091cb3942fbb0754313dc57fe7c836bccbcab9c893ea";
autoStart = true;
ports = [
"8082:80"

View File

@ -11,7 +11,7 @@ let
TTRSS_PLUGINS = "af_comics, af_readability, auth_internal, hotkeys_swap_jk, nginx_xaccel";
};
# https://github.com/Nebucatnetzer/tt-rss-aarch64/pkgs/container/tt-rss-aarch64%2Fttrss-fpm-pgsql-static/versions
ttrssImage = "ghcr.io/nebucatnetzer/tt-rss-aarch64/ttrss-fpm-pgsql-static@sha256:be93020a762f906e02e67fd6baf595d1811812cf6a9581ac1969b02f1803d972";
ttrssImage = "ghcr.io/nebucatnetzer/tt-rss-aarch64/ttrss-fpm-pgsql-static@sha256:a7cb5c6291f7c2ecb2fe28a61c263a1a563ed8f759a7c6c4c33d2fcbe8410ff0";
ttrssService = "${config.virtualisation.oci-containers.backend}-ttrss";
in
{

View File

@ -1,7 +0,0 @@
pep8
rope
pylint
autopep8
yapf
black
flake8

4
scripts/format-disk.py Normal file → Executable file
View File

@ -1,4 +1,6 @@
#!/usr/bin/env python3
#! /usr/bin/env nix-shell
#! nix-shell -i python3 -p python3
import getpass
import os
import subprocess

View File

@ -1,25 +1,11 @@
{ pkgs ? import <nixpkgs> { } }:
let
nix-refactor = pkgs.writeShellScriptBin "nix-refactor" ''
origin=$(${pkgs.coreutils-full}/bin/readlink /run/current-system)
result=$(${pkgs.lib.getExe pkgs.nixos-rebuild} build && ${pkgs.coreutils-full}/bin/readlink result)
${pkgs.diffutils}/bin/diff -q <(echo "$origin" ) <(echo "$result")
rm ./result
'';
in
pkgs.mkShell {
name = "nixosbuildshell";
nativeBuildInputs = with pkgs; [
git
nixFlakes
nix-refactor
python3
python310Packages.autopep8
python310Packages.black
python310Packages.flake8
python310Packages.jedi
python310Packages.pip
python310Packages.yapf
python310Packages.pylint
vim
];

View File

@ -26,6 +26,9 @@
# Required to build aarch64 packages
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
boot = {
supportedFilesystems = [ "apfs" "ext4" "nfs" "nfs4" "ntfs" "cifs" ];
};
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";

View File

@ -1,13 +1,5 @@
{ hostname }: { inputs, ... }:
{
fileSystems = {
"/mnt/external" = {
device = "/dev/disk/by-uuid/F73C-AA4F";
fsType = "exfat";
options = [ "x-systemd.automount" "noauto" "noatime" "uid=1000" "gid=100" ];
};
};
hardware = {
az-raspi4-ethernet = {
enable = true;