feat: jenkins + darwin (and linting)

This commit is contained in:
Swarsel 2024-10-22 18:10:34 +02:00
parent d2c8805e5b
commit 6338497d5f
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
42 changed files with 841 additions and 602 deletions

View file

@ -456,6 +456,12 @@ A short overview over each input and what it does:
url = "github:TamtamHero/fw-fanctrl/packaging/nix"; url = "github:TamtamHero/fw-fanctrl/packaging/nix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nix-darwin = {
url = "github:lnl7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
#+end_src #+end_src
*** let *** let
:PROPERTIES: :PROPERTIES:
@ -641,6 +647,24 @@ In contrast, this defines home-manager systems, which I only have one of, that s
#+end_src #+end_src
*** darwinConfigurations
:PROPERTIES:
:CUSTOM_ID: h:f881aa05-a670-48dd-a57b-2916abdcb692
:END:
In contrast, this defines home-manager systems, which I only have one of, that serves as a template mostly.
#+begin_src nix :tangle no :noweb-ref flakemacconf
"nbm-imba-166" = inputs.nix-darwin.lib.darwinSystem {
specialArgs = { inherit inputs outputs; };
modules = [
./profiles/nbm-imba-166
];
};
#+end_src
*** nixOnDroidConfigurations *** nixOnDroidConfigurations
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h:5f6ef553-59f9-4239-b6f3-63d33b57f335 :CUSTOM_ID: h:5f6ef553-59f9-4239-b6f3-63d33b57f335
@ -671,8 +695,6 @@ Nix on Android also demands an own flake output, which is provided here.
This section mainly exists house different `configuration.nix` files for system level configurations of NixOS systems as well as `home.nix` for user level configurations on all systems. This section mainly exists house different `configuration.nix` files for system level configurations of NixOS systems as well as `home.nix` for user level configurations on all systems.
Important: Think about if a settings really needs to go into this area - chances are that the settings can also go to the general settings, which is to be preferred in order to reduce code duplication.
*** Physical hosts *** Physical hosts
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h:58dc6384-0d19-4f71-9043-4014bd033ba2 :CUSTOM_ID: h:58dc6384-0d19-4f71-9043-4014bd033ba2
@ -1920,7 +1942,7 @@ My work machine. Built for more security, this is the gold standard of my config
#+begin_src nix :tangle profiles/server/winters/default.nix #+begin_src nix :tangle profiles/server/winters/default.nix
{ inputs, outputs, config, pkgs, lib, ... }: { inputs, outputs, config, ... }:
{ {
imports = [ imports = [
@ -1976,6 +1998,7 @@ My work machine. Built for more security, this is the gold standard of my config
transmission = true; transmission = true;
syncthing = true; syncthing = true;
monitoring = true; monitoring = true;
jenkins = false;
}; };
}; };
@ -1984,6 +2007,49 @@ My work machine. Built for more security, this is the gold standard of my config
#+end_src #+end_src
**** nbm-imba-166 (MacBook Pro)
#+begin_src nix :tangle profiles/nbm-imba-166/default.nix
{ inputs, outputs, config, pkgs, lib, ... }:
{
imports = [
inputs.home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users."leon.schwarzaeugl".imports = [
] ++ (builtins.attrValues outputs.homeManagerModules);
}
] ++ (builtins.attrValues outputs.nixosModules);
nix.settings.experimental-features = "nix-command flakes";
nixpkgs = {
hostPlatform = "x86_64-darwin";
inherit (outputs) overlays;
config = {
allowUnfree = true;
};
};
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
services.karabiner-elements.enable = true;
home-manager.users."leon.schwarzaeugl".home.stateVersion = "23.05";
home-manager.users."leon.schwarzaeugl".swarselsystems = {
isDarwin = true;
isLaptop = true;
isNixos = false;
isBtrfs = false;
};
system.stateVersion = 4;
}
#+end_src
**** Magicant (Phone) **** Magicant (Phone)
@ -3094,7 +3160,7 @@ This app checks for different apps that I keep around in the scratchpad for quic
#+end_src #+end_src
#+begin_src nix :tangle pkgs/swarselcheck/default.nix #+begin_src nix :tangle pkgs/swarselcheck/default.nix
{ writeShellApplication, kitty, element-desktop-wayland, vesktop, spotify-player, sway, jq }: { writeShellApplication, kitty, element-desktop-wayland, vesktop, spotify-player, jq }:
writeShellApplication { writeShellApplication {
name = "swarselcheck"; name = "swarselcheck";
@ -3206,7 +3272,7 @@ done
#+end_src #+end_src
#+begin_src nix :tangle pkgs/fs-diff/default.nix #+begin_src nix :tangle pkgs/fs-diff/default.nix
{ writeShellApplication, sway }: { writeShellApplication }:
writeShellApplication { writeShellApplication {
name = "fs-diff"; name = "fs-diff";
@ -3315,7 +3381,7 @@ This file now holds all of the "nixpkgs-changes" that I am using across the conf
#+begin_src nix :tangle overlays/default.nix #+begin_src nix :tangle overlays/default.nix
{ inputs, ... }: { { inputs, ... }: {
additions = final: _prev: import ../pkgs { pkgs = final; }; additions = final: _prev: import ../pkgs { pkgs = final; };
modifications = final: _prev: { modifications = _: _prev: {
vesktop = _prev.vesktop.override { vesktop = _prev.vesktop.override {
withSystemVencord = true; withSystemVencord = true;
}; };
@ -3356,7 +3422,7 @@ This file now holds all of the "nixpkgs-changes" that I am using across the conf
}; };
}; };
zjstatus = final: _prev: { zjstatus = _: _prev: {
zjstatus = inputs.zjstatus.packages.${_prev.system}.default; zjstatus = inputs.zjstatus.packages.${_prev.system}.default;
}; };
@ -3463,6 +3529,7 @@ I usually use =mutableUsers = false= in my NixOS configuration. However, on a ne
options.swarselsystems.server.syncthing = lib.mkEnableOption "enable syncthing on server"; options.swarselsystems.server.syncthing = lib.mkEnableOption "enable syncthing on server";
options.swarselsystems.server.restic = lib.mkEnableOption "enable restic backups on server"; options.swarselsystems.server.restic = lib.mkEnableOption "enable restic backups on server";
options.swarselsystems.server.monitoring = lib.mkEnableOption "enable monitoring on server"; options.swarselsystems.server.monitoring = lib.mkEnableOption "enable monitoring on server";
options.swarselsystems.server.jenkins = lib.mkEnableOption "enable jenkins on server";
} }
#+end_src #+end_src
@ -3470,7 +3537,7 @@ I usually use =mutableUsers = false= in my NixOS configuration. However, on a ne
#+begin_src nix :tangle modules/nixos/input.nix #+begin_src nix :tangle modules/nixos/input.nix
{ lib, config, ... }: { lib, ... }:
let let
inherit (lib) mkOption types; inherit (lib) mkOption types;
in in
@ -3527,6 +3594,7 @@ This holds modules that are to be used on most hosts. These are also the most im
monitors = import ./monitors.nix; monitors = import ./monitors.nix;
input = import ./input.nix; input = import ./input.nix;
nixos = import ./nixos.nix; nixos = import ./nixos.nix;
darwin = import ./darwin.nix;
waybar = import ./waybar.nix; waybar = import ./waybar.nix;
startup = import ./startup.nix; startup = import ./startup.nix;
wallpaper = import ./wallpaper.nix; wallpaper = import ./wallpaper.nix;
@ -3756,6 +3824,15 @@ These are some extra options that will be used if the machine also runs NixOS. F
} }
#+end_src #+end_src
***** darwin
#+begin_src nix :noweb yes :tangle modules/home/darwin.nix
{ lib, config, ... }:
{
options.swarselsystems.isDarwin = lib.mkEnableOption "darwin host";
}
#+end_src
***** System startup ***** System startup
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h:0809445e-9a24-4700-8675-03fb8f4beab8 :CUSTOM_ID: h:0809445e-9a24-4700-8675-03fb8f4beab8
@ -4675,7 +4752,7 @@ Some programs profit from being installed through dedicated NixOS settings on sy
Do not touch this. Do not touch this.
#+begin_src nix :tangle profiles/common/nixos/zsh.nix #+begin_src nix :tangle profiles/common/nixos/zsh.nix
{ lib, config, pkgs, ... }: { pkgs, ... }:
{ {
programs.zsh.enable = true; programs.zsh.enable = true;
users.defaultUserShell = pkgs.zsh; users.defaultUserShell = pkgs.zsh;
@ -4689,7 +4766,6 @@ Do not touch this.
:END: :END:
#+begin_src nix :tangle profiles/common/nixos/syncthing.nix #+begin_src nix :tangle profiles/common/nixos/syncthing.nix
_: _:
{ {
services.syncthing = { services.syncthing = {
@ -5327,7 +5403,7 @@ I am using distrobox to quickly circumvent isses that I cannot immediately solve
This turns off the display when the lid is closed. This turns off the display when the lid is closed.
#+begin_src nix :tangle profiles/common/nixos/lid.nix #+begin_src nix :tangle profiles/common/nixos/lid.nix
{ config, pkgs, ... }: _:
{ {
services.logind = { services.logind = {
lidSwitch = "suspend"; lidSwitch = "suspend";
@ -5393,6 +5469,7 @@ Also, the system state version is set here. No need to touch it.
./syncthing.nix ./syncthing.nix
./restic.nix ./restic.nix
./monitoring.nix ./monitoring.nix
./jenkins.nix
]; ];
nix = nix =
@ -5415,7 +5492,8 @@ Also, the system state version is set here. No need to touch it.
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs; nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
}; };
environment.shellAliases = lib.recursiveUpdate { environment.shellAliases = lib.recursiveUpdate
{
npswitch = "cd ${config.swarselsystems.flakePath}; git pull; sudo nixos-rebuild --flake .#$(hostname) switch --impure; cd -;"; npswitch = "cd ${config.swarselsystems.flakePath}; git pull; sudo nixos-rebuild --flake .#$(hostname) switch --impure; cd -;";
nswitch = "cd ${config.swarselsystems.flakePath}; sudo nixos-rebuild --flake .#$(hostname) switch --impure; cd -;"; nswitch = "cd ${config.swarselsystems.flakePath}; sudo nixos-rebuild --flake .#$(hostname) switch --impure; cd -;";
} }
@ -5448,7 +5526,7 @@ Also, the system state version is set here. No need to touch it.
**** sops **** sops
#+begin_src nix :tangle profiles/server/common/sops.nix #+begin_src nix :tangle profiles/server/common/sops.nix
{ pkgs, config, ... }: { config, ... }:
{ {
sops = { sops = {
age.sshKeyPaths = [ "/etc/ssh/sops" ]; age.sshKeyPaths = [ "/etc/ssh/sops" ];
@ -5462,7 +5540,7 @@ Also, the system state version is set here. No need to touch it.
**** nfs/samba (smb) **** nfs/samba (smb)
#+begin_src nix :tangle profiles/server/common/nfs.nix #+begin_src nix :tangle profiles/server/common/nfs.nix
{ pkgs, lib, config, ... }: { pkgs, ... }:
{ {
services = { services = {
# add a user with sudo smbpasswd -a <user> # add a user with sudo smbpasswd -a <user>
@ -5770,7 +5848,7 @@ Also, the system state version is set here. No need to touch it.
**** spotifyd **** spotifyd
#+begin_src nix :tangle profiles/server/common/spotifyd.nix #+begin_src nix :tangle profiles/server/common/spotifyd.nix
{ pkgs, lib, config, ... }: { lib, config, ... }:
{ {
config = lib.mkIf config.swarselsystems.server.spotifyd { config = lib.mkIf config.swarselsystems.server.spotifyd {
users.groups.spotifyd = { users.groups.spotifyd = {
@ -5865,7 +5943,7 @@ Also, the system state version is set here. No need to touch it.
**** matrix **** matrix
#+begin_src nix :tangle profiles/server/common/matrix.nix #+begin_src nix :tangle profiles/server/common/matrix.nix
{ config, lib, pkgs, modulesPath, sops, ... }: { config, lib, pkgs, sops, ... }:
let let
matrixDomain = "swatrix.swarsel.win"; matrixDomain = "swatrix.swarsel.win";
baseUrl = "https://${matrixDomain}"; baseUrl = "https://${matrixDomain}";
@ -6236,7 +6314,7 @@ Also, the system state version is set here. No need to touch it.
**** immich **** immich
#+begin_src nix :tangle profiles/server/common/immich.nix #+begin_src nix :tangle profiles/server/common/immich.nix
{ pkgs, lib, config, ... }: { lib, config, ... }:
{ {
config = lib.mkIf config.swarselsystems.server.immich { config = lib.mkIf config.swarselsystems.server.immich {
@ -6290,9 +6368,9 @@ Also, the system state version is set here. No need to touch it.
**** paperless **** paperless
#+begin_src nix :tangle profiles/server/common/paperless.nix #+begin_src nix :tangle profiles/server/common/paperless.nix
{ pkgs, lib, config, ... }: { lib, config, ... }:
{ {
config = lib.mkIf config.swarselsystems.server.immich { config = lib.mkIf config.swarselsystems.server.paperless {
users.users.paperless = { users.users.paperless = {
extraGroups = [ "users" ]; extraGroups = [ "users" ];
@ -6483,7 +6561,7 @@ Also, the system state version is set here. No need to touch it.
**** syncthing **** syncthing
#+begin_src nix :tangle profiles/server/common/syncthing.nix #+begin_src nix :tangle profiles/server/common/syncthing.nix
{ pkgs, lib, config, ... }: { lib, config, ... }:
{ {
config = lib.mkIf config.swarselsystems.server.syncthing { config = lib.mkIf config.swarselsystems.server.syncthing {
@ -6592,7 +6670,7 @@ Also, the system state version is set here. No need to touch it.
**** restic **** restic
#+begin_src nix :tangle profiles/server/common/restic.nix #+begin_src nix :tangle profiles/server/common/restic.nix
{ pkgs, lib, config, ... }: { lib, config, ... }:
{ {
config = lib.mkIf config.swarselsystems.server.restic { config = lib.mkIf config.swarselsystems.server.restic {
@ -6605,7 +6683,7 @@ Also, the system state version is set here. No need to touch it.
**** monitoring **** monitoring
#+begin_src nix :tangle profiles/server/common/monitoring.nix #+begin_src nix :tangle profiles/server/common/monitoring.nix
{ pkgs, lib, config, ... }: { lib, config, ... }:
{ {
config = lib.mkIf config.swarselsystems.server.monitoring { config = lib.mkIf config.swarselsystems.server.monitoring {
@ -6767,6 +6845,46 @@ Also, the system state version is set here. No need to touch it.
} }
#+end_src #+end_src
**** Jenkins
#+begin_src nix :tangle profiles/server/common/jenkins.nix
{ pkgs, lib, config, ... }:
{
config = lib.mkIf config.swarselsystems.server.jenkins {
services.jenkins = {
enable = true;
withCLI = true;
port = 8088;
packages = [ pkgs.stdenv pkgs.git pkgs.jdk17 config.programs.ssh.package pkgs.nix ];
listenAddress = "127.0.0.1";
home = "/Vault/apps/jenkins";
};
services.nginx = {
virtualHosts = {
"servant.swarsel.win" = {
enableACME = true;
forceSSL = true;
acmeRoot = null;
locations = {
"/" = {
proxyPass = "http://localhost:8088";
extraConfig = ''
client_max_body_size 0;
'';
};
};
};
};
};
};
}
#+end_src
*** Optional *** Optional
:PROPERTIES: :PROPERTIES:
@ -6934,10 +7052,12 @@ Options that I need specifically at work. There are more options at [[#h:f0b2ea9
zsh.shellInit = '' zsh.shellInit = ''
export CLAD="$(cat ${config.sops.secrets.clad.path})" export CLAD="$(cat ${config.sops.secrets.clad.path})"
export DCAD="$(cat ${config.sops.secrets.dcad.path})" export DCAD="$(cat ${config.sops.secrets.dcad.path})"
export GOVC_PASSWORD="$(cat ${config.sops.secrets.dcad.path})"
export WSAD="$(cat ${config.sops.secrets.wsad.path})" export WSAD="$(cat ${config.sops.secrets.wsad.path})"
export IMBAD="$(cat ${config.sops.secrets.imbad.path})" export IMBAD="$(cat ${config.sops.secrets.imbad.path})"
export DCUSER="dc_adm_schwarzaeugl@IMP.UNIVIE.AC.AT" export DCUSER="dc_adm_schwarzaeugl@IMP.UNIVIE.AC.AT"
export PACKER_SSH_EXTRA_ARGS='"--scp-extra-args"',"\"'-O'\"" export GOVC_USERNAME="dc_adm_schwarzaeugl@IMP.UNIVIE.AC.AT"
export PACKER_SSH_EXTRA_ARGS='"--scp-extra-args","'-O'"'
''; '';
browserpass.enable = true; browserpass.enable = true;
@ -6961,6 +7081,7 @@ Options that I need specifically at work. There are more options at [[#h:f0b2ea9
gnumake gnumake
libisoburn libisoburn
govc govc
terraform
]; ];
@ -7872,8 +7993,7 @@ The theme is handled by stylix.
{ {
programs.kitty = { programs.kitty = {
enable = true; enable = true;
keybindings = { keybindings = { };
};
settings = { settings = {
scrollback_lines = 10000; scrollback_lines = 10000;
enable_audio_bell = false; enable_audio_bell = false;
@ -8015,39 +8135,40 @@ Here we set some aliases (some of them should be shellApplications instead) as w
**** zellij **** zellij
#+begin_src nix :tangle profiles/common/home/zellij.nix #+begin_src nix :tangle profiles/common/home/zellij.nix
{ pkgs, config, ... }: _:
let # { pkgs, config, ... }:
inherit (config.lib.stylix) colors; # let
sesh = pkgs.writeScriptBin "sesh" '' # inherit (config.lib.stylix) colors;
#! /usr/bin/env sh # sesh = pkgs.writeScriptBin "sesh" ''
# #! /usr/bin/env sh
# Taken from https://github.com/zellij-org/zellij/issues/884#issuecomment-1851136980 # # Taken from https://github.com/zellij-org/zellij/issues/884#issuecomment-1851136980
# select a directory using zoxide # # select a directory using zoxide
ZOXIDE_RESULT=$(zoxide query --interactive) # ZOXIDE_RESULT=$(zoxide query --interactive)
# checks whether a directory has been selected # # checks whether a directory has been selected
if [[ -z "$ZOXIDE_RESULT" ]]; then # if [[ -z "$ZOXIDE_RESULT" ]]; then
# if there was no directory, select returns without executing # # if there was no directory, select returns without executing
exit 0 # exit 0
fi # fi
# extracts the directory name from the absolute path # # extracts the directory name from the absolute path
SESSION_TITLE=$(echo "$ZOXIDE_RESULT" | sed 's#.*/##') # SESSION_TITLE=$(echo "$ZOXIDE_RESULT" | sed 's#.*/##')
# get the list of sessions # # get the list of sessions
SESSION_LIST=$(zellij list-sessions -n | awk '{print $1}') # SESSION_LIST=$(zellij list-sessions -n | awk '{print $1}')
# checks if SESSION_TITLE is in the session list # # checks if SESSION_TITLE is in the session list
if echo "$SESSION_LIST" | grep -q "^$SESSION_TITLE$"; then # if echo "$SESSION_LIST" | grep -q "^$SESSION_TITLE$"; then
# if so, attach to existing session # # if so, attach to existing session
zellij attach "$SESSION_TITLE" # zellij attach "$SESSION_TITLE"
else # else
# if not, create a new session # # if not, create a new session
echo "Creating new session $SESSION_TITLE and CD $ZOXIDE_RESULT" # echo "Creating new session $SESSION_TITLE and CD $ZOXIDE_RESULT"
cd $ZOXIDE_RESULT # cd $ZOXIDE_RESULT
zellij attach -c "$SESSION_TITLE" # zellij attach -c "$SESSION_TITLE"
fi # fi
''; # '';
in # in
{ {
programs.zellij = { programs.zellij = {
enable = true; enable = true;
@ -8540,7 +8661,7 @@ The rest of the related configuration is found here:
- [[#h:f93f66f9-6b8b-478e-b139-b2f382c1f25e][waybarupdate]] - [[#h:f93f66f9-6b8b-478e-b139-b2f382c1f25e][waybarupdate]]
#+begin_src nix :tangle profiles/common/home/waybar.nix #+begin_src nix :tangle profiles/common/home/waybar.nix
{ config, lib, pkgs, ... }: { config, lib, ... }:
{ {
programs.waybar = { programs.waybar = {
@ -9046,7 +9167,7 @@ I am currently using SwayFX, which adds some nice effects to sway, like rounded
Currently, I am too lazy to explain every option here, but most of it is very self-explaining in any case. Currently, I am too lazy to explain every option here, but most of it is very self-explaining in any case.
#+begin_src nix :tangle profiles/common/home/sway.nix #+begin_src nix :tangle profiles/common/home/sway.nix
{ config, pkgs, lib, ... }: { config, lib, ... }:
let let
inherit (config.swarselsystems) monitors; inherit (config.swarselsystems) monitors;
eachMonitor = _name: monitor: { eachMonitor = _name: monitor: {
@ -9625,6 +9746,7 @@ This tangles the flake.nix file; This block only needs to be touched when updati
, nixpkgs , nixpkgs
, nixpkgs-stable , nixpkgs-stable
, home-manager , home-manager
, nix-darwin
, systems , systems
, ... , ...
}: }:
@ -9651,6 +9773,10 @@ This tangles the flake.nix file; This block only needs to be touched when updati
<<flakehomeconf>> <<flakehomeconf>>
}; };
darwinConfigurations = {
<<flakemacconf>>
};
nixOnDroidConfigurations = { nixOnDroidConfigurations = {
<<flakedroidconf>> <<flakedroidconf>>
}; };
@ -10131,17 +10257,19 @@ We set a hook that runs everytime we save the file. It would be a bit more effic
(shell-command "nixpkgs-fmt . > /dev/null"))) (shell-command "nixpkgs-fmt . > /dev/null")))
(defun swarsel/org-babel-tangle-config () (defun swarsel/org-babel-tangle-config ()
(interactive)
(when (string-equal (buffer-file-name) (when (string-equal (buffer-file-name)
swarsel-swarsel-org-filepath) swarsel-swarsel-org-filepath)
;; Dynamic scoping to the rescue ;; Dynamic scoping to the rescue
(let ((org-confirm-babel-evaluate nil)) (let ((org-confirm-babel-evaluate nil))
;; (org-html-export-to-html) ;; (org-html-export-to-html)
(org-babel-tangle) (org-babel-tangle)
(swarsel/run-formatting)))) ;; (swarsel/run-formatting)
)))
(setq org-html-htmlize-output-type nil) (setq org-html-htmlize-output-type nil)
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'swarsel/org-babel-tangle-config))) ;; (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'swarsel/org-babel-tangle-config)))
#+end_src #+end_src
@ -11507,6 +11635,7 @@ It also offers a very useful utility of exporting org-mode buffers to different
- This configures the languages that babel recognizes. - This configures the languages that babel recognizes.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq org-src-preserve-indentation nil)
(org-babel-do-load-languages (org-babel-do-load-languages
'org-babel-load-languages 'org-babel-load-languages
@ -12455,15 +12584,9 @@ The following block is mostly inspired from [[https://code.kulupu.party/thesuess
#+end_src #+end_src
*** eglot *** eglot
:PROPERTIES:
:CUSTOM_ID: h:316857e7-4df8-4ec5-b22e-6dac918fa937
:END:
After having tried out =lsp-mode= and =lsp-bridge= for a while each, I must say that =eglot= feels the most clean and fast to me. After having tried out =lsp-mode= and =lsp-bridge= for a while each, I must say that =eglot= feels the most clean and fast to me.
:PROPERTIES:
:CUSTOM_ID: h:424fbc62-84e2-42c7-a1ca-e43ea04c43e5
:END:
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -12498,6 +12621,21 @@ After having tried out =lsp-mode= and =lsp-bridge= for a while each, I must say
#+end_src #+end_src
*** sideline-flymake
This brings back warnings and errors on the sideline for eglot; a feature that I have been missing from lsp-mode for a while.
#+begin_src emacs-lisp
(use-package sideline-flymake
:hook (flymake-mode . sideline-mode)
:init
(setq sideline-flymake-display-mode 'point) ; 'point to show errors only on point
; 'line to show errors on the current line
(setq sideline-backends-right '(sideline-flymake)))
#+end_src
*** Breadcrumb *** Breadcrumb
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h:1de35f27-335d-4cbd-beb6-f85cf5496173 :CUSTOM_ID: h:1de35f27-335d-4cbd-beb6-f85cf5496173

21
flake.lock generated
View file

@ -534,6 +534,26 @@
"type": "github" "type": "github"
} }
}, },
"nix-darwin": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1729579044,
"narHash": "sha256-0kEUVl5s8LHbK4/xEePflsdYVwG+RRFSIofSvITYmIU=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "64d9d1ae25215c274c37e3e4016977a6779cf0d3",
"type": "github"
},
"original": {
"owner": "lnl7",
"repo": "nix-darwin",
"type": "github"
}
},
"nix-filter": { "nix-filter": {
"locked": { "locked": {
"lastModified": 1710156097, "lastModified": 1710156097,
@ -1069,6 +1089,7 @@
"impermanence": "impermanence", "impermanence": "impermanence",
"lanzaboote": "lanzaboote", "lanzaboote": "lanzaboote",
"nix-alien": "nix-alien", "nix-alien": "nix-alien",
"nix-darwin": "nix-darwin",
"nix-index-database": "nix-index-database_2", "nix-index-database": "nix-index-database_2",
"nix-on-droid": "nix-on-droid", "nix-on-droid": "nix-on-droid",
"nixgl": "nixgl", "nixgl": "nixgl",

View file

@ -98,6 +98,12 @@
url = "github:TamtamHero/fw-fanctrl/packaging/nix"; url = "github:TamtamHero/fw-fanctrl/packaging/nix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nix-darwin = {
url = "github:lnl7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = outputs =
@ -105,6 +111,7 @@
, nixpkgs , nixpkgs
, nixpkgs-stable , nixpkgs-stable
, home-manager , home-manager
, nix-darwin
, systems , systems
, ... , ...
}: }:
@ -261,6 +268,17 @@
}; };
darwinConfigurations = {
"nbm-imba-166" = inputs.nix-darwin.lib.darwinSystem {
specialArgs = { inherit inputs outputs; };
modules = [
./profiles/nbm-imba-166
];
};
};
nixOnDroidConfigurations = { nixOnDroidConfigurations = {
mysticant = inputs.nix-on-droid.lib.nixOnDroidConfiguration { mysticant = inputs.nix-on-droid.lib.nixOnDroidConfiguration {

4
modules/home/darwin.nix Normal file
View file

@ -0,0 +1,4 @@
{ lib, config, ... }:
{
options.swarselsystems.isDarwin = lib.mkEnableOption "darwin host";
}

View file

@ -4,6 +4,7 @@
monitors = import ./monitors.nix; monitors = import ./monitors.nix;
input = import ./input.nix; input = import ./input.nix;
nixos = import ./nixos.nix; nixos = import ./nixos.nix;
darwin = import ./darwin.nix;
waybar = import ./waybar.nix; waybar = import ./waybar.nix;
startup = import ./startup.nix; startup = import ./startup.nix;
wallpaper = import ./wallpaper.nix; wallpaper = import ./wallpaper.nix;

View file

@ -1,4 +1,4 @@
{ lib, config, ... }: { lib, ... }:
let let
inherit (lib) mkOption types; inherit (lib) mkOption types;
in in

View file

@ -23,4 +23,5 @@ in
options.swarselsystems.server.syncthing = lib.mkEnableOption "enable syncthing on server"; options.swarselsystems.server.syncthing = lib.mkEnableOption "enable syncthing on server";
options.swarselsystems.server.restic = lib.mkEnableOption "enable restic backups on server"; options.swarselsystems.server.restic = lib.mkEnableOption "enable restic backups on server";
options.swarselsystems.server.monitoring = lib.mkEnableOption "enable monitoring on server"; options.swarselsystems.server.monitoring = lib.mkEnableOption "enable monitoring on server";
options.swarselsystems.server.jenkins = lib.mkEnableOption "enable jenkins on server";
} }

View file

@ -1,6 +1,6 @@
{ inputs, ... }: { { inputs, ... }: {
additions = final: _prev: import ../pkgs { pkgs = final; }; additions = final: _prev: import ../pkgs { pkgs = final; };
modifications = final: _prev: { modifications = _: _prev: {
vesktop = _prev.vesktop.override { vesktop = _prev.vesktop.override {
withSystemVencord = true; withSystemVencord = true;
}; };
@ -41,7 +41,7 @@
}; };
}; };
zjstatus = final: _prev: { zjstatus = _: _prev: {
zjstatus = inputs.zjstatus.packages.${_prev.system}.default; zjstatus = inputs.zjstatus.packages.${_prev.system}.default;
}; };

View file

@ -1,7 +0,0 @@
{ writeShellApplication, kitty, element-desktop-wayland, discord, spotify-player, sway, jq }:
writeShellApplication {
name = "swarselcheck";
runtimeInputs = [ jq ];
text = builtins.readFile ../../scripts/check.sh;
}

View file

@ -1,4 +1,4 @@
{ writeShellApplication, sway }: { writeShellApplication }:
writeShellApplication { writeShellApplication {
name = "fs-diff"; name = "fs-diff";

View file

@ -1,7 +0,0 @@
{ writeShellApplication, libnotify, pass, fuzzel, wtype }:
writeShellApplication {
name = "pass-fuzzel-otp";
runtimeInputs = [ fuzzel (pass.withExtensions (exts: [ exts.pass-otp ])) ];
text = builtins.readFile ../../scripts/pass-fuzzel-otp.sh;
}

View file

@ -1,4 +1,4 @@
{ writeShellApplication, kitty, element-desktop-wayland, vesktop, spotify-player, sway, jq }: { writeShellApplication, kitty, element-desktop-wayland, vesktop, spotify-player, jq }:
writeShellApplication { writeShellApplication {
name = "swarselcheck"; name = "swarselcheck";

View file

@ -1,4 +1,4 @@
{ config, pkgs, lib, ... }: { config, lib, ... }:
let let
inherit (config.swarselsystems) monitors; inherit (config.swarselsystems) monitors;
eachMonitor = _name: monitor: { eachMonitor = _name: monitor: {

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, ... }:
{ {
programs.waybar = { programs.waybar = {

View file

@ -1,36 +1,37 @@
{ pkgs, config, ... }: _:
let # { pkgs, config, ... }:
inherit (config.lib.stylix) colors; # let
sesh = pkgs.writeScriptBin "sesh" '' # inherit (config.lib.stylix) colors;
#! /usr/bin/env sh # sesh = pkgs.writeScriptBin "sesh" ''
# #! /usr/bin/env sh
# Taken from https://github.com/zellij-org/zellij/issues/884#issuecomment-1851136980 # # Taken from https://github.com/zellij-org/zellij/issues/884#issuecomment-1851136980
# select a directory using zoxide # # select a directory using zoxide
ZOXIDE_RESULT=$(zoxide query --interactive) # ZOXIDE_RESULT=$(zoxide query --interactive)
# checks whether a directory has been selected # # checks whether a directory has been selected
if [[ -z "$ZOXIDE_RESULT" ]]; then # if [[ -z "$ZOXIDE_RESULT" ]]; then
# if there was no directory, select returns without executing # # if there was no directory, select returns without executing
exit 0 # exit 0
fi # fi
# extracts the directory name from the absolute path # # extracts the directory name from the absolute path
SESSION_TITLE=$(echo "$ZOXIDE_RESULT" | sed 's#.*/##') # SESSION_TITLE=$(echo "$ZOXIDE_RESULT" | sed 's#.*/##')
# get the list of sessions # # get the list of sessions
SESSION_LIST=$(zellij list-sessions -n | awk '{print $1}') # SESSION_LIST=$(zellij list-sessions -n | awk '{print $1}')
# checks if SESSION_TITLE is in the session list # # checks if SESSION_TITLE is in the session list
if echo "$SESSION_LIST" | grep -q "^$SESSION_TITLE$"; then # if echo "$SESSION_LIST" | grep -q "^$SESSION_TITLE$"; then
# if so, attach to existing session # # if so, attach to existing session
zellij attach "$SESSION_TITLE" # zellij attach "$SESSION_TITLE"
else # else
# if not, create a new session # # if not, create a new session
echo "Creating new session $SESSION_TITLE and CD $ZOXIDE_RESULT" # echo "Creating new session $SESSION_TITLE and CD $ZOXIDE_RESULT"
cd $ZOXIDE_RESULT # cd $ZOXIDE_RESULT
zellij attach -c "$SESSION_TITLE" # zellij attach -c "$SESSION_TITLE"
fi # fi
''; # '';
in # in
{ {
programs.zellij = { programs.zellij = {
enable = true; enable = true;

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }: _:
{ {
services.logind = { services.logind = {
lidSwitch = "suspend"; lidSwitch = "suspend";

View file

@ -1,4 +1,4 @@
{ lib, config, pkgs, ... }: { pkgs, ... }:
{ {
programs.zsh.enable = true; programs.zsh.enable = true;
users.defaultUserShell = pkgs.zsh; users.defaultUserShell = pkgs.zsh;

View file

@ -1,7 +1,7 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: { config, lib, modulesPath, ... }:
{ {
imports = imports =

View file

@ -0,0 +1,37 @@
{ inputs, outputs, config, pkgs, lib, ... }:
{
imports = [
inputs.home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users."leon.schwarzaeugl".imports = [
] ++ (builtins.attrValues outputs.homeManagerModules);
}
] ++ (builtins.attrValues outputs.nixosModules);
nix.settings.experimental-features = "nix-command flakes";
nixpkgs = {
hostPlatform = "x86_64-darwin";
inherit (outputs) overlays;
config = {
allowUnfree = true;
};
};
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
services.karabiner-elements.enable = true;
home-manager.users."leon.schwarzaeugl".home.stateVersion = "23.05";
home-manager.users."leon.schwarzaeugl".swarselsystems = {
isDarwin = true;
isLaptop = true;
isNixos = false;
isBtrfs = false;
};
system.stateVersion = 4;
}

View file

@ -26,10 +26,12 @@
zsh.shellInit = '' zsh.shellInit = ''
export CLAD="$(cat ${config.sops.secrets.clad.path})" export CLAD="$(cat ${config.sops.secrets.clad.path})"
export DCAD="$(cat ${config.sops.secrets.dcad.path})" export DCAD="$(cat ${config.sops.secrets.dcad.path})"
export GOVC_PASSWORD="$(cat ${config.sops.secrets.dcad.path})"
export WSAD="$(cat ${config.sops.secrets.wsad.path})" export WSAD="$(cat ${config.sops.secrets.wsad.path})"
export IMBAD="$(cat ${config.sops.secrets.imbad.path})" export IMBAD="$(cat ${config.sops.secrets.imbad.path})"
export DCUSER="dc_adm_schwarzaeugl@IMP.UNIVIE.AC.AT" export DCUSER="dc_adm_schwarzaeugl@IMP.UNIVIE.AC.AT"
export PACKER_SSH_EXTRA_ARGS='"--scp-extra-args"',"\"'-O'\"" export GOVC_USERNAME="dc_adm_schwarzaeugl@IMP.UNIVIE.AC.AT"
export PACKER_SSH_EXTRA_ARGS='"--scp-extra-args","'-O'"'
''; '';
browserpass.enable = true; browserpass.enable = true;
@ -53,6 +55,7 @@
gnumake gnumake
libisoburn libisoburn
govc govc
terraform
]; ];

View file

@ -26,6 +26,7 @@
./syncthing.nix ./syncthing.nix
./restic.nix ./restic.nix
./monitoring.nix ./monitoring.nix
./jenkins.nix
]; ];
nix = nix =

View file

@ -1,4 +1,4 @@
{ pkgs, lib, config, ... }: { lib, config, ... }:
{ {
config = lib.mkIf config.swarselsystems.server.immich { config = lib.mkIf config.swarselsystems.server.immich {

View file

@ -0,0 +1,35 @@
{ pkgs, lib, config, ... }:
{
config = lib.mkIf config.swarselsystems.server.jenkins {
services.jenkins = {
enable = true;
withCLI = true;
port = 8088;
packages = [ pkgs.stdenv pkgs.git pkgs.jdk17 config.programs.ssh.package pkgs.nix ];
listenAddress = "127.0.0.1";
home = "/Vault/apps/jenkins";
};
services.nginx = {
virtualHosts = {
"servant.swarsel.win" = {
enableACME = true;
forceSSL = true;
acmeRoot = null;
locations = {
"/" = {
proxyPass = "http://localhost:8088";
extraConfig = ''
client_max_body_size 0;
'';
};
};
};
};
};
};
}

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, modulesPath, sops, ... }: { config, lib, pkgs, sops, ... }:
let let
matrixDomain = "swatrix.swarsel.win"; matrixDomain = "swatrix.swarsel.win";
baseUrl = "https://${matrixDomain}"; baseUrl = "https://${matrixDomain}";

View file

@ -1,4 +1,4 @@
{ pkgs, lib, config, ... }: { lib, config, ... }:
{ {
config = lib.mkIf config.swarselsystems.server.monitoring { config = lib.mkIf config.swarselsystems.server.monitoring {

View file

@ -1,4 +1,4 @@
{ pkgs, lib, config, ... }: { pkgs, ... }:
{ {
services = { services = {
# add a user with sudo smbpasswd -a <user> # add a user with sudo smbpasswd -a <user>

View file

@ -1,6 +1,6 @@
{ pkgs, lib, config, ... }: { lib, config, ... }:
{ {
config = lib.mkIf config.swarselsystems.server.immich { config = lib.mkIf config.swarselsystems.server.paperless {
users.users.paperless = { users.users.paperless = {
extraGroups = [ "users" ]; extraGroups = [ "users" ];

View file

@ -1,4 +1,4 @@
{ pkgs, lib, config, ... }: { lib, config, ... }:
{ {
config = lib.mkIf config.swarselsystems.server.restic { config = lib.mkIf config.swarselsystems.server.restic {

View file

@ -1,53 +0,0 @@
{ pkgs, lib, config, ... }:
{
# Network shares
# add a user with sudo smbpasswd -a <user>
samba = {
package = pkgs.samba4Full;
extraConfig = ''
workgroup = WORKGROUP
server role = standalone server
dns proxy = no
pam password change = yes
map to guest = bad user
create mask = 0664
force create mode = 0664
directory mask = 0775
force directory mode = 0775
follow symlinks = yes
'';
# ^^ `samba4Full` is compiled with avahi, ldap, AD etc support compared to the default package, `samba`
# Required for samba to register mDNS records for auto discovery
# See https://github.com/NixOS/nixpkgs/blob/592047fc9e4f7b74a4dc85d1b9f5243dfe4899e3/pkgs/top-level/all-packages.nix#L27268
enable = true;
# openFirewall = true;
shares.Eternor = {
browseable = "yes";
"read only" = "no";
"guest ok" = "no";
path = "/Vault/Eternor";
writable = "true";
comment = "Eternor";
"valid users" = "@Swarsel";
};
};
avahi = {
publish.enable = true;
publish.userServices = true;
# ^^ Needed to allow samba to automatically register mDNS records without the need for an `extraServiceFile`
nssmdns4 = true;
# ^^ Not one hundred percent sure if this is needed- if it aint broke, don't fix it
enable = true;
};
samba-wsdd = {
# This enables autodiscovery on windows since SMB1 (and thus netbios) support was discontinued
enable = true;
};
};
}

View file

@ -1,4 +1,4 @@
{ pkgs, config, ... }: { config, ... }:
{ {
sops = { sops = {
age.sshKeyPaths = [ "/etc/ssh/sops" ]; age.sshKeyPaths = [ "/etc/ssh/sops" ];

View file

@ -1,4 +1,4 @@
{ pkgs, lib, config, ... }: { lib, config, ... }:
{ {
config = lib.mkIf config.swarselsystems.server.spotifyd { config = lib.mkIf config.swarselsystems.server.spotifyd {
users.groups.spotifyd = { users.groups.spotifyd = {

View file

@ -1,4 +1,4 @@
{ pkgs, lib, config, ... }: { lib, config, ... }:
{ {
config = lib.mkIf config.swarselsystems.server.syncthing { config = lib.mkIf config.swarselsystems.server.syncthing {

View file

@ -1,2 +0,0 @@
{ pkgs, lib, config, ... }:
{ }

View file

@ -0,0 +1,36 @@
{ inputs, outputs, config, pkgs, lib, ... }:
{
imports = [
inputs.home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users."leon.schwarzaeugl".imports = [
../../common/home/emacs.nix
] ++ (builtins.attrValues outputs.homeManagerModules);
}
] ++ (builtins.attrValues outputs.nixosModules);
nix.settings.experimental-features = "nix-command flakes";
nixpkgs = {
inherit (outputs) overlays;
config = {
allowUnfree = true;
};
};
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
services.karabiner-elements.enable = true;
home-manager.users."leon.schwarzaeugl".swarselsystems = {
isDarwin = true;
isLaptop = true;
isNixos = false;
isBtrfs = false;
};
system.stateVersion = 4;
}

View file

@ -1,4 +1,4 @@
{ inputs, outputs, config, pkgs, lib, ... }: { inputs, outputs, config, ... }:
{ {
imports = [ imports = [
@ -54,6 +54,7 @@
transmission = true; transmission = true;
syncthing = true; syncthing = true;
monitoring = true; monitoring = true;
jenkins = false;
}; };
}; };

View file

@ -1,7 +1,7 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: { config, lib, modulesPath, ... }:
{ {
imports = imports =

View file

@ -179,17 +179,19 @@ create a new one."
(shell-command "nixpkgs-fmt . > /dev/null"))) (shell-command "nixpkgs-fmt . > /dev/null")))
(defun swarsel/org-babel-tangle-config () (defun swarsel/org-babel-tangle-config ()
(interactive)
(when (string-equal (buffer-file-name) (when (string-equal (buffer-file-name)
swarsel-swarsel-org-filepath) swarsel-swarsel-org-filepath)
;; Dynamic scoping to the rescue ;; Dynamic scoping to the rescue
(let ((org-confirm-babel-evaluate nil)) (let ((org-confirm-babel-evaluate nil))
;; (org-html-export-to-html) ;; (org-html-export-to-html)
(org-babel-tangle) (org-babel-tangle)
(swarsel/run-formatting)))) ;; (swarsel/run-formatting)
)))
(setq org-html-htmlize-output-type nil) (setq org-html-htmlize-output-type nil)
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'swarsel/org-babel-tangle-config))) ;; (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'swarsel/org-babel-tangle-config)))
(defun org-fold-outer () (defun org-fold-outer ()
(interactive) (interactive)
@ -976,6 +978,8 @@ create a new one."
(setq org-fold-core-style 'overlays) (setq org-fold-core-style 'overlays)
(setq org-src-preserve-indentation nil)
(org-babel-do-load-languages (org-babel-do-load-languages
'org-babel-load-languages 'org-babel-load-languages
'((emacs-lisp . t) '((emacs-lisp . t)
@ -1526,6 +1530,13 @@ create a new one."
(defalias 'start-lsp-server #'eglot) (defalias 'start-lsp-server #'eglot)
(use-package sideline-flymake
:hook (flymake-mode . sideline-mode)
:init
(setq sideline-flymake-display-mode 'point) ; 'point to show errors only on point
; 'line to show errors on the current line
(setq sideline-backends-right '(sideline-flymake)))
(use-package breadcrumb (use-package breadcrumb
;; :config (breadcrumb-mode) ;; :config (breadcrumb-mode)
) )