feat: Add automatic formatting for .nix files

This commit is contained in:
Swarsel 2024-07-19 00:45:48 +02:00
parent 9dc9a1fe1b
commit 72d321f478
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
46 changed files with 3204 additions and 3164 deletions

View file

@ -14,7 +14,9 @@ jobs:
- name: Install Nix - name: Install Nix
uses: DeterminateSystems/nix-installer-action@v3 uses: DeterminateSystems/nix-installer-action@v3
- uses: DeterminateSystems/magic-nix-cache-action@main - uses: DeterminateSystems/magic-nix-cache-action@main
- name: Check for dead code - name: Check for dead code in .nix files
run: git ls-files '*.nix' | nix run nixpkgs#deadnix run: git ls-files '*.nix' | nix run nixpkgs#deadnix
- name: Check for lints - name: Check for lints in .nix files
run: nix run nixpkgs#statix -- check run: nix run nixpkgs#statix -- check
- name: Check formatting in .nix files
run: git ls-files '*.nix' | xargs nix run nixpkgs#alejandra -- --check

View file

@ -5131,6 +5131,11 @@ Programming languages and default lsp's are defined here: [[#h:0e7e8bea-ec58-499
nmap nmap
lsof lsof
# nix
alejandra
deadnix
statix
# local file sharing # local file sharing
wormhole-rs wormhole-rs
@ -7524,16 +7529,24 @@ Used in: [[#h:bbcfa895-4d46-4b1d-b84e-f634e982c46e][Centered org-mode Buffers]]
#+end_src #+end_src
**** org-mode: Auto-tangle and export Configuration Files **** org-mode: Upon-save actions (Auto-tangle, export to html, formatting)
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h:59d4306e-9b73-4b2c-b039-6a6518c357fc :CUSTOM_ID: h:59d4306e-9b73-4b2c-b039-6a6518c357fc
:END: :END:
This section automatically tangles all configuration blocks in this file to the defined Emacs org-file. It also exports the configuration file as html. This section handles everything that shoudld happen when I save =SwarselSystems.org=. It:
1) automatically tangles all configuration blocks in this file
2) exports the configuration file as html for an easier reading experience with working links and index
3) formats the generated =.nix= files in accordance to the =Alejandra=-style.
We set a hook that runs everytime we save the file. It would be a bit more efficient to only export and format when we enter a magit window for instance (since especially the html export takes times), however, since I cannot be sure to only ever commit from magit (I do indeed sometimes use git from the command line), I prefer this approach.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun run-alejandra ()
(interactive)
(let ((default-directory (expand-file-name "~/.dotfiles")))
(shell-command "alejandra . -q")))
(defun swarsel/org-babel-tangle-config () (defun swarsel/org-babel-tangle-config ()
(when (string-equal (buffer-file-name) (when (string-equal (buffer-file-name)
@ -7541,25 +7554,13 @@ This section automatically tangles all configuration blocks in this file to the
;; 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)
(when (string-equal (buffer-file-name) (run-alejandra))))
swarsel-emacs-org-filepath)
;; Dynamic scoping to the rescue
(let ((org-confirm-babel-evaluate nil))
(org-html-export-to-html)
(org-babel-tangle)))
(when (string-equal (buffer-file-name)
swarsel-nix-org-filepath)
;; Dynamic scoping to the rescue
(let ((org-confirm-babel-evaluate nil))
(org-babel-tangle))))
(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
**** org-mode: Fold current heading **** org-mode: Fold current heading

View file

@ -2,7 +2,6 @@
description = "SwarseFlake - Nix Flake for all SwarselSystems"; description = "SwarseFlake - Nix Flake for all SwarselSystems";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05"; nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
@ -67,11 +66,9 @@
nswitch-rcm-nix = { nswitch-rcm-nix = {
url = "github:Swarsel/nswitch-rcm-nix"; url = "github:Swarsel/nswitch-rcm-nix";
}; };
}; };
outputs = inputs @ { outputs = inputs @ {
nixpkgs, nixpkgs,
nixpkgs-stable, nixpkgs-stable,
home-manager, home-manager,
@ -85,13 +82,13 @@
nixos-hardware, nixos-hardware,
nix-alien, nix-alien,
nswitch-rcm-nix, nswitch-rcm-nix,
... ...
}: let }: let
system = "x86_64-linux"; # not very portable, but I do not use other architectures at the moment system = "x86_64-linux"; # not very portable, but I do not use other architectures at the moment
pkgs = import nixpkgs { inherit system; pkgs = import nixpkgs {
overlays = [ emacs-overlay.overlay inherit system;
overlays = [
emacs-overlay.overlay
nur.overlay nur.overlay
nixgl.overlay nixgl.overlay
(final: _prev: { (final: _prev: {
@ -104,12 +101,17 @@
}; };
# NixOS modules that can only be used on NixOS systems # NixOS modules that can only be used on NixOS systems
nixModules = [ stylix.nixosModules.stylix nixModules = [
stylix.nixosModules.stylix
sops-nix.nixosModules.sops sops-nix.nixosModules.sops
nswitch-rcm-nix.nixosModules.nswitch-rcm nswitch-rcm-nix.nixosModules.nswitch-rcm
./profiles/common/nixos.nix ./profiles/common/nixos.nix
# dynamic library loading # dynamic library loading
({ self, system, ... }: { ({
self,
system,
...
}: {
environment.systemPackages = with self.inputs.nix-alien.packages.${system}; [ environment.systemPackages = with self.inputs.nix-alien.packages.${system}; [
nix-alien nix-alien
]; ];
@ -119,15 +121,15 @@
]; ];
# Home-Manager modules wanted on non-NixOS systems # Home-Manager modules wanted on non-NixOS systems
homeModules = [ stylix.homeManagerModules.stylix homeModules = [
stylix.homeManagerModules.stylix
]; ];
# Home-Manager modules wanted on both NixOS and non-NixOS systems # Home-Manager modules wanted on both NixOS and non-NixOS systems
mixedModules = [ sops-nix.homeManagerModules.sops mixedModules = [
sops-nix.homeManagerModules.sops
./profiles/common/home.nix ./profiles/common/home.nix
]; ];
in { in {
# NixOS setups - run home-manager as a NixOS module for better compatibility # NixOS setups - run home-manager as a NixOS module for better compatibility
# another benefit - full rebuild on nixos-rebuild switch # another benefit - full rebuild on nixos-rebuild switch
# run rebuild using `nswitch` # run rebuild using `nswitch`
@ -136,14 +138,17 @@
# Make sure to move hardware-configuration to the appropriate location, by default it is found in /etc/nixos/. # Make sure to move hardware-configuration to the appropriate location, by default it is found in /etc/nixos/.
nixosConfigurations = { nixosConfigurations = {
onett = nixpkgs.lib.nixosSystem { onett = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs pkgs;}; specialArgs = {inherit inputs pkgs;};
modules = nixModules ++ [ modules =
nixModules
++ [
./profiles/onett/nixos.nix ./profiles/onett/nixos.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
home-manager.users.swarsel.imports = mixedModules ++ [ home-manager.users.swarsel.imports =
mixedModules
++ [
./profiles/onett/home.nix ./profiles/onett/home.nix
]; ];
} }
@ -160,11 +165,15 @@
twoson = nixpkgs.lib.nixosSystem { twoson = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs pkgs;}; specialArgs = {inherit inputs pkgs;};
modules = nixModules ++ [ modules =
nixModules
++ [
./profiles/twoson/nixos.nix ./profiles/twoson/nixos.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
home-manager.users.swarsel.imports = mixedModules ++ [ home-manager.users.swarsel.imports =
mixedModules
++ [
./profiles/twoson/home.nix ./profiles/twoson/home.nix
]; ];
} }
@ -173,12 +182,16 @@
threed = nixpkgs.lib.nixosSystem { threed = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs pkgs;}; specialArgs = {inherit inputs pkgs;};
modules = nixModules ++ [ modules =
nixModules
++ [
lanzaboote.nixosModules.lanzaboote lanzaboote.nixosModules.lanzaboote
./profiles/threed/nixos.nix ./profiles/threed/nixos.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
home-manager.users.swarsel.imports = mixedModules ++ [ home-manager.users.swarsel.imports =
mixedModules
++ [
./profiles/threed/home.nix ./profiles/threed/home.nix
]; ];
} }
@ -187,12 +200,16 @@
fourside = nixpkgs.lib.nixosSystem { fourside = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs pkgs;}; specialArgs = {inherit inputs pkgs;};
modules = nixModules ++ [ modules =
nixModules
++ [
nixos-hardware.nixosModules.lenovo-thinkpad-p14s-amd-gen2 nixos-hardware.nixosModules.lenovo-thinkpad-p14s-amd-gen2
./profiles/fourside/nixos.nix ./profiles/fourside/nixos.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
home-manager.users.swarsel.imports = mixedModules ++ [ home-manager.users.swarsel.imports =
mixedModules
++ [
./profiles/fourside/home.nix ./profiles/fourside/home.nix
]; ];
} }
@ -201,12 +218,16 @@
winters = nixpkgs.lib.nixosSystem { winters = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs pkgs;}; specialArgs = {inherit inputs pkgs;};
modules = nixModules ++ [ modules =
nixModules
++ [
nixos-hardware.nixosModules.framework-16-inch-7040-amd nixos-hardware.nixosModules.framework-16-inch-7040-amd
./profiles/winters/nixos.nix ./profiles/winters/nixos.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
home-manager.users.swarsel.imports = mixedModules ++ [ home-manager.users.swarsel.imports =
mixedModules
++ [
./profiles/winters/home.nix ./profiles/winters/home.nix
]; ];
} }
@ -215,11 +236,15 @@
stand = nixpkgs.lib.nixosSystem { stand = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs pkgs;}; specialArgs = {inherit inputs pkgs;};
modules = nixModules ++ [ modules =
nixModules
++ [
./profiles/stand/nixos.nix ./profiles/stand/nixos.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
home-manager.users.homelen.imports = mixedModules ++ [ home-manager.users.homelen.imports =
mixedModules
++ [
./profiles/stand/home.nix ./profiles/stand/home.nix
]; ];
} }
@ -315,29 +340,26 @@
# run rebuild using `hmswitch` # run rebuild using `hmswitch`
homeConfigurations = { homeConfigurations = {
"leons@PCisLee" = home-manager.lib.homeManagerConfiguration { "leons@PCisLee" = home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = homeModules ++ mixedModules ++ [ modules =
homeModules
++ mixedModules
++ [
./profiles/surface/home.nix ./profiles/surface/home.nix
]; ];
}; };
}; };
nixOnDroidConfigurations = { nixOnDroidConfigurations = {
default = nix-on-droid.lib.nixOnDroidConfiguration { default = nix-on-droid.lib.nixOnDroidConfiguration {
modules = [ modules = [
./profiles/mysticant/configuration.nix ./profiles/mysticant/configuration.nix
]; ];
}; };
}; };
packages.x86_64-linux = { packages.x86_64-linux = {
}; };
}; };
} }

View file

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head> <head>
<!-- 2024-07-19 Fr 00:29 --> <!-- 2024-07-19 Fr 00:52 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<title>SwarselSystems: NixOS + Emacs Configuration</title> <title>SwarselSystems: NixOS + Emacs Configuration</title>
@ -387,7 +387,7 @@
</div> </div>
</div> </div>
<p> <p>
<b>This file has 40971 words spanning 10908 lines and was last revised on 2024-07-19 00:29:02 +0200.</b> <b>This file has 41033 words spanning 10909 lines and was last revised on 2024-07-19 00:52:31 +0200.</b>
</p> </p>
<p> <p>
@ -437,7 +437,7 @@ This section defines my Emacs configuration. For a while, I considered to use ry
</p> </p>
<p> <p>
My emacs is built using the emacs-overlay nix flake, which builds a bleeding edge emacs on wayland (pgtk) with utilities like treesitter support. By executing the below source block, the current build setting can be updated at any time, and you can see my most up-to-date build options (last updated: 2024-07-19 00:29:02 +0200) My emacs is built using the emacs-overlay nix flake, which builds a bleeding edge emacs on wayland (pgtk) with utilities like treesitter support. By executing the below source block, the current build setting can be updated at any time, and you can see my most up-to-date build options (last updated: 2024-07-19 00:52:31 +0200)
</p></li> </p></li>
</ul> </ul>
@ -6335,6 +6335,11 @@ Programming languages and default lsp's are defined here: <a href="#h:0e7e8bea-e
nmap nmap
lsof lsof
# nix
alejandra
deadnix
statix
# local file sharing # local file sharing
wormhole-rs wormhole-rs
@ -9194,41 +9199,41 @@ Used in: <a href="#h:bbcfa895-4d46-4b1d-b84e-f634e982c46e">Centered org-mode Buf
</div> </div>
</div> </div>
</li> </li>
<li><a id="h:59d4306e-9b73-4b2c-b039-6a6518c357fc"></a>org-mode: Auto-tangle and export Configuration Files<br /> <li><a id="h:59d4306e-9b73-4b2c-b039-6a6518c357fc"></a>org-mode: Upon-save actions (Auto-tangle, export to html, formatting)<br />
<div class="outline-text-5" id="text-h:59d4306e-9b73-4b2c-b039-6a6518c357fc"> <div class="outline-text-5" id="text-h:59d4306e-9b73-4b2c-b039-6a6518c357fc">
<p> <p>
This section automatically tangles all configuration blocks in this file to the defined Emacs org-file. It also exports the configuration file as html. This section handles everything that shoudld happen when I save <code>SwarselSystems.org</code>. It:
</p> </p>
<ol class="org-ol">
<li>automatically tangles all configuration blocks in this file</li>
<li>exports the configuration file as html for an easier reading experience with working links and index</li>
<li>formats the generated <code>.nix</code> files in accordance to the <code>Alejandra</code>-style.</li>
</ol>
<p>
We set a hook that runs everytime we save the file. It would be a bit more efficient to only export and format when we enter a magit window for instance (since especially the html export takes times), however, since I cannot be sure to only ever commit from magit (I do indeed sometimes use git from the command line), I prefer this approach.
</p>
<div class="org-src-container"> <div class="org-src-container">
<pre class="src src-emacs-lisp"> <pre class="src src-emacs-lisp">(defun run-alejandra ()
(interactive)
(let ((default-directory (expand-file-name "~/.dotfiles")))
(shell-command "alejandra . -q")))
(defun swarsel/org-babel-tangle-config () (defun swarsel/org-babel-tangle-config ()
(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)
(when (string-equal (buffer-file-name) (run-alejandra))))
swarsel-emacs-org-filepath)
;; Dynamic scoping to the rescue
(let ((org-confirm-babel-evaluate nil))
(org-html-export-to-html)
(org-babel-tangle)))
(when (string-equal (buffer-file-name)
swarsel-nix-org-filepath)
;; Dynamic scoping to the rescue
(let ((org-confirm-babel-evaluate nil))
(org-babel-tangle))))
(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)))
</pre> </pre>
</div> </div>
</div> </div>
@ -9336,7 +9341,7 @@ The standard Emacs behaviour for the Python process shell is a bit annoying. Thi
</div> </div>
</div> </div>
</li> </li>
<li><a id="org03da7a6"></a>Nix common prefix bracketer<br /> <li><a id="orgbb564b1"></a>Nix common prefix bracketer<br />
<div class="outline-text-5" id="text-4-2-1-15"> <div class="outline-text-5" id="text-4-2-1-15">
<p> <p>
This function searches for common delimiters in region and removes them, summarizing all captured lines by it. This function searches for common delimiters in region and removes them, summarizing all captured lines by it.
@ -12907,7 +12912,7 @@ My laptop, sadly soon to be replaced by a new one, since most basic functions ar
</div> </div>
<div id="postamble" class="status"> <div id="postamble" class="status">
<p class="author">Author: Leon Schwarzäugl</p> <p class="author">Author: Leon Schwarzäugl</p>
<p class="date">Created: 2024-07-19 Fr 00:29</p> <p class="date">Created: 2024-07-19 Fr 00:52</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p> <p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div> </div>
</body> </body>

View file

@ -1,8 +1,8 @@
{ config, pkgs, ... }:
{ {
config,
pkgs,
...
}: {
services.gpg-agent = { services.gpg-agent = {
enable = true; enable = true;
enableSshSupport = true; enableSshSupport = true;
@ -67,7 +67,8 @@
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# if not always connected to power (laptop), use this (default): # if not always connected to power (laptop), use this (default):
programs.waybar.settings.mainBar.modules-right = ["custom/outer-left-arrow-dark" programs.waybar.settings.mainBar.modules-right = [
"custom/outer-left-arrow-dark"
"mpris" "mpris"
"custom/left-arrow-light" "custom/left-arrow-light"
"network" "network"
@ -94,7 +95,8 @@
xkb_layout = "us"; xkb_layout = "us";
xkb_variant = "altgr-intl"; xkb_variant = "altgr-intl";
}; };
"1:1:AT_Translated_Set_2_keyboard" = { # TEMPLATE "1:1:AT_Translated_Set_2_keyboard" = {
# TEMPLATE
xkb_layout = "us"; xkb_layout = "us";
xkb_options = "grp:win_space_toggle"; xkb_options = "grp:win_space_toggle";
# xkb_options = "ctrl:nocaps,grp:win_space_toggle"; # xkb_options = "ctrl:nocaps,grp:win_space_toggle";
@ -106,7 +108,6 @@
natural_scroll = "enabled"; natural_scroll = "enabled";
middle_emulation = "enabled"; middle_emulation = "enabled";
}; };
}; };
output = { output = {
@ -126,14 +127,12 @@
}; };
startup = [ startup = [
{command = "nextcloud --background";} {command = "nextcloud --background";}
{command = "discord --start-minimized";} {command = "discord --start-minimized";}
{command = "element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds";} {command = "element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds";}
{command = "ANKI_WAYLAND=1 anki";} {command = "ANKI_WAYLAND=1 anki";}
{command = "OBSIDIAN_USE_WAYLAND=1 obsidian";} {command = "OBSIDIAN_USE_WAYLAND=1 obsidian";}
{command = "nm-applet";} {command = "nm-applet";}
]; ];
}; };
}; };

View file

@ -1,14 +1,8 @@
{ pkgs, ... }: {pkgs, ...}: {
imports = [
{
imports =
[
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
services = { services = {
getty.autologinUser = "TEMPLATE"; getty.autologinUser = "TEMPLATE";
greetd.settings.initial_session.user = "TEMPLATE"; greetd.settings.initial_session.user = "TEMPLATE";
@ -84,9 +78,6 @@
}; };
}; };
# Configure keymap in X11 (only used for login) # Configure keymap in X11 (only used for login)
services.xserver = { services.xserver = {
layout = "us"; layout = "us";
@ -104,5 +95,4 @@
]; ];
system.stateVersion = "23.05"; # TEMPLATE - but probably no need to change system.stateVersion = "23.05"; # TEMPLATE - but probably no need to change
} }

View file

@ -1,8 +1,10 @@
{ config, pkgs, fetchFromGitHub , ... }:
{ {
config,
pkgs,
fetchFromGitHub,
...
}: {
home.packages = with pkgs; [ home.packages = with pkgs; [
# audio stuff # audio stuff
spek # spectrum analyzer spek # spectrum analyzer
losslessaudiochecker losslessaudiochecker
@ -25,6 +27,11 @@
nmap nmap
lsof lsof
# nix
alejandra
deadnix
statix
# local file sharing # local file sharing
wormhole-rs wormhole-rs
@ -142,9 +149,17 @@
# latex and related packages # latex and related packages
(pkgs.texlive.combine { (pkgs.texlive.combine {
inherit (pkgs.texlive) scheme-full inherit
dvisvgm dvipng # for preview and export as html (pkgs.texlive)
wrapfig amsmath ulem hyperref capt-of; scheme-full
dvisvgm
dvipng # for preview and export as html
wrapfig
amsmath
ulem
hyperref
capt-of
;
}) })
# font stuff # font stuff
@ -155,7 +170,8 @@
noto-fonts-cjk-sans noto-fonts-cjk-sans
# cura # cura
(let cura5 = appimageTools.wrapType2 rec { (let
cura5 = appimageTools.wrapType2 rec {
name = "cura5"; name = "cura5";
version = "5.4.0"; version = "5.4.0";
src = fetchurl { src = fetchurl {
@ -163,7 +179,9 @@
hash = "sha256-QVv7Wkfo082PH6n6rpsB79st2xK2+Np9ivBg/PYZd74="; hash = "sha256-QVv7Wkfo082PH6n6rpsB79st2xK2+Np9ivBg/PYZd74=";
}; };
extraPkgs = pkgs: with pkgs; []; extraPkgs = pkgs: with pkgs; [];
}; in writeScriptBin "cura" '' };
in
writeScriptBin "cura" ''
#! ${pkgs.bash}/bin/bash #! ${pkgs.bash}/bin/bash
# AppImage version of Cura loses current working directory and treats all paths relateive to $HOME. # AppImage version of Cura loses current working directory and treats all paths relateive to $HOME.
# So we convert each of the files passed as argument to an absolute path. # So we convert each of the files passed as argument to an absolute path.
@ -298,7 +316,6 @@
cp "$1"{,.bak} cp "$1"{,.bak}
''; '';
}) })
]; ];
sops = { sops = {
@ -447,7 +464,6 @@ programs.ssh= {
stylix.targets.emacs.enable = false; stylix.targets.emacs.enable = false;
xdg.desktopEntries = { xdg.desktopEntries = {
cura = { cura = {
name = "Ultimaker Cura"; name = "Ultimaker Cura";
genericName = "Cura"; genericName = "Cura";
@ -488,7 +504,6 @@ xdg.desktopEntries = {
terminal = false; terminal = false;
categories = ["Development" "TextEditor"]; categories = ["Development" "TextEditor"];
}; };
}; };
home.file = { home.file = {
@ -939,13 +954,11 @@ programs.emacs = {
}; };
packageRequires = []; packageRequires = [];
}) })
]; ];
}; };
}; };
programs.waybar = { programs.waybar = {
enable = true; enable = true;
# systemd.enable = true; # systemd.enable = true;
settings = { settings = {
@ -998,7 +1011,6 @@ programs.waybar = {
critical-threshold = 80; critical-threshold = 80;
format-critical = " {temperatureC}°C"; format-critical = " {temperatureC}°C";
format = " {temperatureC}°C"; format = " {temperatureC}°C";
}; };
mpris = { mpris = {
@ -1086,7 +1098,6 @@ programs.waybar = {
format-icons = ["" "" "" "" "" "" "" ""]; format-icons = ["" "" "" "" "" "" "" ""];
# on-click-right= "com.github.stsdc.monitor"; # on-click-right= "com.github.stsdc.monitor";
on-click-right = "kitty -o confirm_os_window_close=0 btm"; on-click-right = "kitty -o confirm_os_window_close=0 btm";
}; };
battery = { battery = {
states = { states = {
@ -1181,44 +1192,65 @@ programs.firefox = {
search.engines = { search.engines = {
"Nix Packages" = { "Nix Packages" = {
urls = [{ urls = [
{
template = "https://search.nixos.org/packages"; template = "https://search.nixos.org/packages";
params = [ params = [
{ name = "type"; value = "packages"; } {
{ name = "query"; value = "{searchTerms}"; } name = "type";
value = "packages";
}
{
name = "query";
value = "{searchTerms}";
}
];
}
]; ];
}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@np"]; definedAliases = ["@np"];
}; };
"NixOS Wiki" = { "NixOS Wiki" = {
urls = [{ urls = [
{
template = "https://nixos.wiki/index.php?search={searchTerms}"; template = "https://nixos.wiki/index.php?search={searchTerms}";
}]; }
];
iconUpdateURL = "https://nixos.wiki/favicon.png"; iconUpdateURL = "https://nixos.wiki/favicon.png";
updateInterval = 24 * 60 * 60 * 1000; # every day updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = ["@nw"]; definedAliases = ["@nw"];
}; };
"NixOS Options" = { "NixOS Options" = {
urls = [{ urls = [
{
template = "https://search.nixos.org/options"; template = "https://search.nixos.org/options";
params = [ params = [
{ name = "query"; value = "{searchTerms}"; } {
name = "query";
value = "{searchTerms}";
}
];
}
]; ];
}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@no"]; definedAliases = ["@no"];
}; };
"Home Manager Options" = { "Home Manager Options" = {
urls = [{ template = "https://home-manager-options.extranix.com/"; urls = [
{
template = "https://home-manager-options.extranix.com/";
params = [ params = [
{ name = "query"; value = "{searchTerms}"; } {
name = "query";
value = "{searchTerms}";
}
];
}
]; ];
}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@hm" "@ho" "@hmo"]; definedAliases = ["@hm" "@ho" "@hmo"];
@ -1465,7 +1497,6 @@ wayland.windowManager.sway = {
# }; # };
# } # }
{ {
command = "resize set width 60 ppt height 60 ppt, sticky enable, move container to scratchpad"; command = "resize set width 60 ppt height 60 ppt, sticky enable, move container to scratchpad";
criteria = { criteria = {
class = "Spotify"; class = "Spotify";
@ -1545,5 +1576,4 @@ wayland.windowManager.sway = {
"; ";
}; };
} }

View file

@ -1,6 +1,9 @@
{ config, lib, pkgs, ... }:
{ {
config,
lib,
pkgs,
...
}: {
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
@ -235,8 +238,7 @@ networking.networkmanager = {
proxy = {}; proxy = {};
vpn = { vpn = {
auth = "sha1"; auth = "sha1";
ca = ca = "${config.users.users.swarsel.home}/.dotfiles/secrets/certs/sweden-aes-128-cbc-udp-dns-ca.pem";
"${config.users.users.swarsel.home}/.dotfiles/secrets/certs/sweden-aes-128-cbc-udp-dns-ca.pem";
challenge-response-flags = "2"; challenge-response-flags = "2";
cipher = "aes-128-cbc"; cipher = "aes-128-cbc";
compress = "yes"; compress = "yes";
@ -277,7 +279,6 @@ networking.networkmanager = {
psk = "$HOTSPOT"; psk = "$HOTSPOT";
}; };
}; };
}; };
}; };
}; };
@ -302,7 +303,6 @@ i18n = {
}; };
sops = { sops = {
defaultSopsFile = "${config.users.users.swarsel.home}/.dotfiles/secrets/general/secrets.yaml"; defaultSopsFile = "${config.users.users.swarsel.home}/.dotfiles/secrets/general/secrets.yaml";
validateSopsFiles = false; validateSopsFiles = false;
@ -405,9 +405,7 @@ environment.systemPackages = with pkgs; [
tar xvf $src -C $out/ tar xvf $src -C $out/
mv $out/oama-0.13.1-Linux-x86_64-static/oama $out/bin/ mv $out/oama-0.13.1-Linux-x86_64-static/oama $out/bin/
''; '';
}) })
]; ];
programs = { programs = {
@ -507,5 +505,4 @@ services.greetd = {
environment.etc."greetd/environments".text = '' environment.etc."greetd/environments".text = ''
sway sway
''; '';
} }

View file

@ -1,11 +1,14 @@
# 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, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/installer/scan/not-detected.nix") lib,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"];
@ -13,18 +16,18 @@
boot.kernelModules = ["kvm-amd"]; boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/55eee3d2-4125-4aba-a326-10cde2abdf26"; device = "/dev/disk/by-uuid/55eee3d2-4125-4aba-a326-10cde2abdf26";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/BC7A-F7D9"; device = "/dev/disk/by-uuid/BC7A-F7D9";
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = swapDevices = [
[ { device = "/dev/disk/by-uuid/0a74b04a-99e0-48cd-afcf-6ca849f6f85a"; } {device = "/dev/disk/by-uuid/0a74b04a-99e0-48cd-afcf-6ca849f6f85a";}
]; ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking

View file

@ -1,8 +1,8 @@
{ config, pkgs, ... }:
{ {
config,
pkgs,
...
}: {
services.gpg-agent = { services.gpg-agent = {
enable = true; enable = true;
enableSshSupport = true; enableSshSupport = true;
@ -34,8 +34,8 @@
temperature.input-filename = "temp1_input"; temperature.input-filename = "temp1_input";
}; };
programs.waybar.settings.mainBar.modules-right = [
programs.waybar.settings.mainBar.modules-right = ["custom/outer-left-arrow-dark" "custom/outer-left-arrow-dark"
"mpris" "mpris"
"custom/left-arrow-light" "custom/left-arrow-light"
"network" "network"
@ -52,7 +52,6 @@
"clock#1" "clock#1"
]; ];
wayland.windowManager.sway = { wayland.windowManager.sway = {
config = rec { config = rec {
# update for actual inputs here, # update for actual inputs here,
@ -61,7 +60,8 @@
xkb_layout = "us"; xkb_layout = "us";
xkb_variant = "altgr-intl"; xkb_variant = "altgr-intl";
}; };
"1:1:AT_Translated_Set_2_keyboard" = { # TEMPLATE "1:1:AT_Translated_Set_2_keyboard" = {
# TEMPLATE
xkb_layout = "us"; xkb_layout = "us";
xkb_options = "grp:win_space_toggle"; xkb_options = "grp:win_space_toggle";
xkb_variant = "altgr-intl"; xkb_variant = "altgr-intl";
@ -72,7 +72,6 @@
natural_scroll = "enabled"; natural_scroll = "enabled";
middle_emulation = "enabled"; middle_emulation = "enabled";
}; };
}; };
output = { output = {
@ -91,11 +90,16 @@
}; };
workspaceOutputAssign = [ workspaceOutputAssign = [
{ output = "eDP-1"; workspace = "1:";} {
{ output = "DP-4"; workspace = "2:";} output = "eDP-1";
workspace = "1:";
}
{
output = "DP-4";
workspace = "2:";
}
]; ];
keybindings = let keybindings = let
inherit (config.wayland.windowManager.sway.config) modifier; inherit (config.wayland.windowManager.sway.config) modifier;
in { in {
@ -115,14 +119,12 @@
}; };
startup = [ startup = [
{command = "nextcloud --background";} {command = "nextcloud --background";}
{command = "discord --start-minimized";} {command = "discord --start-minimized";}
{command = "element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds";} {command = "element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds";}
{command = "ANKI_WAYLAND=1 anki";} {command = "ANKI_WAYLAND=1 anki";}
{command = "OBSIDIAN_USE_WAYLAND=1 obsidian";} {command = "OBSIDIAN_USE_WAYLAND=1 obsidian";}
{command = "nm-applet";} {command = "nm-applet";}
]; ];
}; };
}; };

View file

@ -1,15 +1,15 @@
{ config, pkgs, ... }:
{ {
config,
pkgs,
...
}: {
# #
# imports = # imports =
# [ # [
# ./hardware-configuration.nix # ./hardware-configuration.nix
# ]; # ];
# #
imports = imports = [
[
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
@ -36,12 +36,24 @@
allowedUDPPorts = [4380 27036 14242 34197 51820]; # 34197: factorio; 4380 27036 14242: barotrauma; 51820: wireguard allowedUDPPorts = [4380 27036 14242 34197 51820]; # 34197: factorio; 4380 27036 14242: barotrauma; 51820: wireguard
allowedTCPPorts = []; # 34197: factorio; 4380 27036 14242: barotrauma; 51820: wireguard allowedTCPPorts = []; # 34197: factorio; 4380 27036 14242: barotrauma; 51820: wireguard
allowedTCPPortRanges = [ allowedTCPPortRanges = [
{from = 27015; to = 27030;} # barotrauma {
{from = 27036; to = 27037;} # barotrauma from = 27015;
to = 27030;
} # barotrauma
{
from = 27036;
to = 27037;
} # barotrauma
]; ];
allowedUDPPortRanges = [ allowedUDPPortRanges = [
{from = 27000; to = 27031;} # barotrauma {
{from = 58962; to = 58964;} # barotrauma from = 27000;
to = 27031;
} # barotrauma
{
from = 58962;
to = 58964;
} # barotrauma
]; ];
}; };
}; };
@ -105,9 +117,6 @@
}; };
}; };
hardware = { hardware = {
graphics = { graphics = {
enable = true; enable = true;
@ -168,6 +177,4 @@
]; ];
system.stateVersion = "23.05"; system.stateVersion = "23.05";
} }

View file

@ -1,6 +1,4 @@
{ pkgs, ... }: {pkgs, ...}: {
{
environment.packages = with pkgs; [ environment.packages = with pkgs; [
vim vim
git git
@ -18,5 +16,4 @@
nix.extraOptions = '' nix.extraOptions = ''
experimental-features = nix-command flakes experimental-features = nix-command flakes
''; '';
} }

View file

@ -1,14 +1,18 @@
{ modulesPath, ... }: {modulesPath, ...}: {
{
imports = [(modulesPath + "/profiles/qemu-guest.nix")]; imports = [(modulesPath + "/profiles/qemu-guest.nix")];
boot.loader.grub = { boot.loader.grub = {
efiSupport = true; efiSupport = true;
efiInstallAsRemovable = true; efiInstallAsRemovable = true;
device = "nodev"; device = "nodev";
}; };
fileSystems."/boot" = { device = "/dev/disk/by-uuid/A1B2-7E6F"; fsType = "vfat"; }; fileSystems."/boot" = {
device = "/dev/disk/by-uuid/A1B2-7E6F";
fsType = "vfat";
};
boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi"]; boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi"];
boot.initrd.kernelModules = ["nvme"]; boot.initrd.kernelModules = ["nvme"];
fileSystems."/" = { device = "/dev/mapper/ocivolume-root"; fsType = "xfs"; }; fileSystems."/" = {
device = "/dev/mapper/ocivolume-root";
fsType = "xfs";
};
} }

View file

@ -1,7 +1,11 @@
{ config, pkgs, sops, ... }: let {
config,
pkgs,
sops,
...
}: let
matrixDomain = "swatrix.swarsel.win"; matrixDomain = "swatrix.swarsel.win";
in { in {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
@ -78,7 +82,6 @@ in {
recommendedOptimisation = true; recommendedOptimisation = true;
recommendedGzipSettings = true; recommendedGzipSettings = true;
virtualHosts = { virtualHosts = {
"swatrix.swarsel.win" = { "swatrix.swarsel.win" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
@ -164,7 +167,8 @@ in {
public_baseurl = "https://${matrixDomain}"; public_baseurl = "https://${matrixDomain}";
}; };
listeners = [ listeners = [
{ port = 8008; {
port = 8008;
bind_addresses = ["0.0.0.0"]; bind_addresses = ["0.0.0.0"];
type = "http"; type = "http";
tls = false; tls = false;
@ -287,7 +291,6 @@ in {
domain = matrixDomain; domain = matrixDomain;
}; };
appservice = { appservice = {
address = "http://localhost:29328"; address = "http://localhost:29328";
hostname = "0.0.0.0"; hostname = "0.0.0.0";
port = 29328; port = 29328;
@ -333,5 +336,4 @@ in {
User = "root"; User = "root";
}; };
}; };
} }

View file

@ -1,8 +1,11 @@
{ config, lib, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/profiles/qemu-guest.nix") lib,
modulesPath,
...
}: {
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
]; ];
boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod"]; boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod"];
@ -10,18 +13,18 @@
boot.kernelModules = ["kvm-amd"]; boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/4b47378a-02eb-4548-bab8-59cbf379252a"; device = "/dev/disk/by-uuid/4b47378a-02eb-4548-bab8-59cbf379252a";
fsType = "xfs"; fsType = "xfs";
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/2B75-2AD5"; device = "/dev/disk/by-uuid/2B75-2AD5";
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = swapDevices = [
[ { device = "/dev/disk/by-uuid/f0126a93-753e-4769-ada8-7499a1efb3a9"; } {device = "/dev/disk/by-uuid/f0126a93-753e-4769-ada8-7499a1efb3a9";}
]; ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking

View file

@ -1,6 +1,8 @@
{ config, pkgs, ... }:
{ {
config,
pkgs,
...
}: {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
@ -44,7 +46,6 @@
recommendedOptimisation = true; recommendedOptimisation = true;
recommendedGzipSettings = true; recommendedGzipSettings = true;
virtualHosts = { virtualHosts = {
"synki.swarsel.win" = { "synki.swarsel.win" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
@ -160,5 +161,4 @@
}; };
}; };
}; };
} }

View file

@ -1,11 +1,14 @@
# 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, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/installer/scan/not-detected.nix") lib,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = ["xhci_pci" "ehci_pci" "ata_piix" "usb_storage" "sd_mod" "sr_mod"]; boot.initrd.availableKernelModules = ["xhci_pci" "ehci_pci" "ata_piix" "usb_storage" "sd_mod" "sr_mod"];
@ -13,8 +16,8 @@
boot.kernelModules = ["kvm-intel"]; boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/147e3682-eb15-4e96-9cac-4f2fb5888a69"; device = "/dev/disk/by-uuid/147e3682-eb15-4e96-9cac-4f2fb5888a69";
fsType = "ext4"; fsType = "ext4";
}; };

View file

@ -1,7 +1,11 @@
{ config, pkgs, sops, ... }: let {
config,
pkgs,
sops,
...
}: let
matrixDomain = "swatrix.swarsel.win"; matrixDomain = "swatrix.swarsel.win";
in { in {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
@ -133,24 +137,24 @@ in {
zfs zfs
]; ];
etc = { etc = {
"openvpn/iptables.sh" = "openvpn/iptables.sh" = {
{ source = ../../scripts/server1/iptables.sh; source = ../../scripts/server1/iptables.sh;
mode = "0755"; mode = "0755";
}; };
"openvpn/update-resolv-conf" = "openvpn/update-resolv-conf" = {
{ source = ../../scripts/server1/update-resolv-conf; source = ../../scripts/server1/update-resolv-conf;
mode = "0755"; mode = "0755";
}; };
"openvpn/routing.sh" = "openvpn/routing.sh" = {
{ source = ../../scripts/server1/routing.sh; source = ../../scripts/server1/routing.sh;
mode = "0755"; mode = "0755";
}; };
"openvpn/ca.rsa.2048.crt" = "openvpn/ca.rsa.2048.crt" = {
{ source = ../../secrets/certs/ca.rsa.2048.crt; source = ../../secrets/certs/ca.rsa.2048.crt;
mode = "0644"; mode = "0644";
}; };
"openvpn/crl.rsa.2048.pem" = "openvpn/crl.rsa.2048.pem" = {
{ source = ../../secrets/certs/crl.rsa.2048.pem; source = ../../secrets/certs/crl.rsa.2048.pem;
mode = "0644"; mode = "0644";
}; };
}; };
@ -265,10 +269,12 @@ in {
openssh = { openssh = {
enable = true; enable = true;
settings.PermitRootLogin = "yes"; settings.PermitRootLogin = "yes";
listenAddresses = [{ listenAddresses = [
{
port = 22; port = 22;
addr = "0.0.0.0"; addr = "0.0.0.0";
}]; }
];
}; };
nginx = { nginx = {
@ -278,7 +284,6 @@ in {
recommendedOptimisation = true; recommendedOptimisation = true;
recommendedGzipSettings = true; recommendedGzipSettings = true;
virtualHosts = { virtualHosts = {
"stash.swarsel.win" = { "stash.swarsel.win" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
@ -313,7 +318,6 @@ in {
}; };
}; };
"sound.swarsel.win" = { "sound.swarsel.win" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
@ -508,9 +512,6 @@ in {
# MAUTRIX_TELEGRAM_TELEGRAM_API_HASH=${config.sops.placeholder.mautrixtelegram_api_hash} # MAUTRIX_TELEGRAM_TELEGRAM_API_HASH=${config.sops.placeholder.mautrixtelegram_api_hash}
# ''; # '';
# ---------------- # ----------------
# sops.secrets.mautrixwhatsapp_shared = {owner="matrix-synapse";}; # sops.secrets.mautrixwhatsapp_shared = {owner="matrix-synapse";};
# sops.templates.mautrixwhatsapp.owner = "matrix-synapse"; # sops.templates.mautrixwhatsapp.owner = "matrix-synapse";
@ -557,7 +558,8 @@ in {
config.sops.templates.matrixshared.path config.sops.templates.matrixshared.path
]; ];
settings.listeners = [ settings.listeners = [
{ port = 8008; {
port = 8008;
bind_addresses = ["0.0.0.0"]; bind_addresses = ["0.0.0.0"];
type = "http"; type = "http";
tls = false; tls = false;
@ -676,7 +678,6 @@ in {
domain = matrixDomain; domain = matrixDomain;
}; };
appservice = { appservice = {
address = "http://localhost:29328"; address = "http://localhost:29328";
hostname = "0.0.0.0"; hostname = "0.0.0.0";
port = 29328; port = 29328;
@ -740,7 +741,6 @@ in {
]; ];
}; };
spotifyd = { spotifyd = {
enable = true; enable = true;
settings = { settings = {
@ -789,7 +789,6 @@ in {
}; };
}; };
avahi = { avahi = {
publish.enable = true; publish.enable = true;
publish.userServices = true; publish.userServices = true;

View file

@ -1,6 +1,8 @@
{ pkgs, modulesPath, ... }:
{ {
pkgs,
modulesPath,
...
}: {
imports = [ imports = [
(modulesPath + "/virtualisation/proxmox-lxc.nix") (modulesPath + "/virtualisation/proxmox-lxc.nix")
]; ];

View file

@ -1,9 +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.
{ lib, ... }: {lib, ...}: {
{
imports = []; imports = [];
boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "vfio_pci" "usbhid"]; boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "vfio_pci" "usbhid"];
@ -11,8 +9,8 @@
boot.kernelModules = ["kvm-intel"]; boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/mapper/pve-vm--120--disk--0"; device = "/dev/mapper/pve-vm--120--disk--0";
fsType = "ext4"; fsType = "ext4";
}; };

View file

@ -1,6 +1,9 @@
{ config, pkgs, modulesPath, ... }:
{ {
config,
pkgs,
modulesPath,
...
}: {
imports = [ imports = [
(modulesPath + "/virtualisation/proxmox-lxc.nix") (modulesPath + "/virtualisation/proxmox-lxc.nix")
./hardware-configuration.nix ./hardware-configuration.nix
@ -65,6 +68,4 @@ firewall.enable = false;
port = 8080; port = 8080;
tokenKeyFile = config.sops.secrets.kavita.path; tokenKeyFile = config.sops.secrets.kavita.path;
}; };
} }

View file

@ -1,9 +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.
{ lib, ... }: {lib, ...}: {
{
imports = []; imports = [];
boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "vfio_pci" "usbhid"]; boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "vfio_pci" "usbhid"];
@ -11,13 +9,13 @@
boot.kernelModules = ["kvm-intel"]; boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/mapper/pve-vm--121--disk--0"; device = "/dev/mapper/pve-vm--121--disk--0";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/media/Videos" = fileSystems."/media/Videos" = {
{ device = "//192.168.1.3/Eternor"; device = "//192.168.1.3/Eternor";
fsType = "cifs"; fsType = "cifs";
}; };

View file

@ -1,6 +1,9 @@
{ config, pkgs, modulesPath, ... }:
{ {
config,
pkgs,
modulesPath,
...
}: {
imports = [ imports = [
(modulesPath + "/virtualisation/proxmox-lxc.nix") (modulesPath + "/virtualisation/proxmox-lxc.nix")
./hardware-configuration.nix ./hardware-configuration.nix
@ -73,5 +76,4 @@
user = "jellyfin"; user = "jellyfin";
# openFirewall = true; # this works only for the default ports # openFirewall = true; # this works only for the default ports
}; };
} }

View file

@ -1,9 +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.
{ lib, ... }: {lib, ...}: {
{
imports = []; imports = [];
boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "vfio_pci" "usbhid"]; boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "vfio_pci" "usbhid"];
@ -11,8 +9,8 @@
boot.kernelModules = ["kvm-intel"]; boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/mapper/pve-vm--102--disk--0"; device = "/dev/mapper/pve-vm--102--disk--0";
fsType = "ext4"; fsType = "ext4";
}; };

View file

@ -1,8 +1,12 @@
{ config, pkgs, modulesPath, sops, ... }: let {
config,
pkgs,
modulesPath,
sops,
...
}: let
matrixDomain = "matrix2.swarsel.win"; matrixDomain = "matrix2.swarsel.win";
in { in {
services = { services = {
xserver = { xserver = {
layout = "us"; layout = "us";
@ -11,10 +15,12 @@ in {
openssh = { openssh = {
enable = true; enable = true;
settings.PermitRootLogin = "yes"; settings.PermitRootLogin = "yes";
listenAddresses = [{ listenAddresses = [
{
port = 22; port = 22;
addr = "0.0.0.0"; addr = "0.0.0.0";
}]; }
];
}; };
}; };
@ -40,7 +46,6 @@ in {
nswitch = "cd /.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;"; nswitch = "cd /.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;";
}; };
imports = [ imports = [
(modulesPath + "/virtualisation/proxmox-lxc.nix") (modulesPath + "/virtualisation/proxmox-lxc.nix")
./hardware-configuration.nix ./hardware-configuration.nix
@ -132,7 +137,8 @@ in {
server_name = matrixDomain; server_name = matrixDomain;
public_baseurl = "https://${matrixDomain}"; public_baseurl = "https://${matrixDomain}";
listeners = [ listeners = [
{ port = 8008; {
port = 8008;
bind_addresses = ["0.0.0.0"]; bind_addresses = ["0.0.0.0"];
type = "http"; type = "http";
tls = false; tls = false;
@ -255,7 +261,6 @@ in {
domain = matrixDomain; domain = matrixDomain;
}; };
appservice = { appservice = {
address = "http://localhost:29328"; address = "http://localhost:29328";
hostname = "0.0.0.0"; hostname = "0.0.0.0";
port = 29328; port = 29328;
@ -301,5 +306,4 @@ in {
User = "root"; User = "root";
}; };
}; };
} }

View file

@ -1,9 +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.
{ lib, ... }: {lib, ...}: {
{
imports = []; imports = [];
boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "vfio_pci" "usbhid"]; boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "vfio_pci" "usbhid"];
@ -11,8 +9,8 @@
boot.kernelModules = ["kvm-intel"]; boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/mapper/pve-vm--119--disk--0"; device = "/dev/mapper/pve-vm--119--disk--0";
fsType = "ext4"; fsType = "ext4";
}; };

View file

@ -1,5 +1,9 @@
{ config, pkgs, modulesPath, ... }:
{ {
config,
pkgs,
modulesPath,
...
}: {
imports = [ imports = [
(modulesPath + "/virtualisation/proxmox-lxc.nix") (modulesPath + "/virtualisation/proxmox-lxc.nix")
./hardware-configuration.nix ./hardware-configuration.nix
@ -69,7 +73,6 @@
recommendedOptimisation = true; recommendedOptimisation = true;
recommendedGzipSettings = true; recommendedGzipSettings = true;
virtualHosts = { virtualHosts = {
"stash.swarsel.win" = { "stash.swarsel.win" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
@ -107,7 +110,6 @@
}; };
}; };
"sound.swarsel.win" = { "sound.swarsel.win" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
@ -197,8 +199,6 @@
}; };
}; };
}; };
}; };
}; };
} }

View file

@ -1,9 +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.
{ lib, ... }: {lib, ...}: {
{
imports = []; imports = [];
boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "vfio_pci" "usbhid"]; boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "vfio_pci" "usbhid"];
@ -11,8 +9,8 @@
boot.kernelModules = ["kvm-intel"]; boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/mapper/pve-vm--117--disk--0"; device = "/dev/mapper/pve-vm--117--disk--0";
fsType = "ext4"; fsType = "ext4";
}; };

View file

@ -1,14 +1,14 @@
{ config, pkgs, modulesPath, ... }:
{ {
config,
pkgs,
modulesPath,
...
}: {
imports = [ imports = [
(modulesPath + "/virtualisation/proxmox-lxc.nix") (modulesPath + "/virtualisation/proxmox-lxc.nix")
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
services = { services = {
xserver = { xserver = {
layout = "us"; layout = "us";
@ -17,10 +17,12 @@
openssh = { openssh = {
enable = true; enable = true;
settings.PermitRootLogin = "yes"; settings.PermitRootLogin = "yes";
listenAddresses = [{ listenAddresses = [
{
port = 22; port = 22;
addr = "0.0.0.0"; addr = "0.0.0.0";
}]; }
];
}; };
}; };
@ -46,8 +48,6 @@
nswitch = "cd /.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;"; nswitch = "cd /.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;";
}; };
users.groups.lxc_shares = { users.groups.lxc_shares = {
gid = 10000; gid = 10000;
members = [ members = [
@ -90,5 +90,4 @@
}; };
}; };
}; };
} }

View file

@ -1,9 +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.
{ lib, ... }: {lib, ...}: {
{
imports = []; imports = [];
boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "vfio_pci" "usbhid"]; boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "vfio_pci" "usbhid"];
@ -11,14 +9,14 @@
boot.kernelModules = ["kvm-intel"]; boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/mnt/data/images/118/vm-118-disk-0.raw"; device = "/mnt/data/images/118/vm-118-disk-0.raw";
fsType = "ext4"; fsType = "ext4";
options = ["loop"]; options = ["loop"];
}; };
fileSystems."/media" = fileSystems."/media" = {
{ device = "//192.168.1.3/Eternor"; device = "//192.168.1.3/Eternor";
fsType = "cifs"; fsType = "cifs";
}; };

View file

@ -1,14 +1,14 @@
{ config, pkgs, modulesPath, ... }:
{ {
config,
pkgs,
modulesPath,
...
}: {
imports = [ imports = [
(modulesPath + "/virtualisation/proxmox-lxc.nix") (modulesPath + "/virtualisation/proxmox-lxc.nix")
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
services = { services = {
xserver = { xserver = {
layout = "us"; layout = "us";
@ -17,10 +17,12 @@
openssh = { openssh = {
enable = true; enable = true;
settings.PermitRootLogin = "yes"; settings.PermitRootLogin = "yes";
listenAddresses = [{ listenAddresses = [
{
port = 22; port = 22;
addr = "0.0.0.0"; addr = "0.0.0.0";
}]; }
];
}; };
}; };
@ -46,8 +48,6 @@
nswitch = "cd /.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;"; nswitch = "cd /.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;";
}; };
proxmoxLXC.privileged = true; # manage hostname myself proxmoxLXC.privileged = true; # manage hostname myself
users = { users = {

View file

@ -1,9 +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.
{ lib, ... }: {lib, ...}: {
{
imports = []; imports = [];
boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "vfio_pci" "usbhid"]; boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "vfio_pci" "usbhid"];
@ -11,8 +9,8 @@
boot.kernelModules = ["kvm-intel"]; boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/mapper/pve-vm--123--disk--0"; device = "/dev/mapper/pve-vm--123--disk--0";
fsType = "ext4"; fsType = "ext4";
}; };

View file

@ -1,14 +1,13 @@
{ pkgs, modulesPath, ... }:
{ {
pkgs,
modulesPath,
...
}: {
imports = [ imports = [
(modulesPath + "/virtualisation/proxmox-lxc.nix") (modulesPath + "/virtualisation/proxmox-lxc.nix")
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
services = { services = {
xserver = { xserver = {
layout = "us"; layout = "us";
@ -17,10 +16,12 @@
openssh = { openssh = {
enable = true; enable = true;
settings.PermitRootLogin = "yes"; settings.PermitRootLogin = "yes";
listenAddresses = [{ listenAddresses = [
{
port = 22; port = 22;
addr = "0.0.0.0"; addr = "0.0.0.0";
}]; }
];
}; };
}; };
@ -46,8 +47,6 @@
nswitch = "cd /.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;"; nswitch = "cd /.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;";
}; };
proxmoxLXC.privileged = true; # manage hostname myself proxmoxLXC.privileged = true; # manage hostname myself
users.groups.spotifyd = { users.groups.spotifyd = {
@ -89,5 +88,4 @@
}; };
}; };
}; };
} }

View file

@ -1,9 +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.
{ lib, ... }: {lib, ...}: {
{
imports = []; imports = [];
boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "vfio_pci" "usbhid"]; boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "vfio_pci" "usbhid"];
@ -11,8 +9,8 @@
boot.kernelModules = ["kvm-intel"]; boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/mapper/pve-vm--122--disk--0"; device = "/dev/mapper/pve-vm--122--disk--0";
fsType = "ext4"; fsType = "ext4";
}; };

View file

@ -1,6 +1,9 @@
{ config, pkgs, modulesPath, ... }:
{ {
config,
pkgs,
modulesPath,
...
}: {
imports = [ imports = [
(modulesPath + "/virtualisation/proxmox-lxc.nix") (modulesPath + "/virtualisation/proxmox-lxc.nix")
./hardware-configuration.nix ./hardware-configuration.nix
@ -87,34 +90,36 @@
''; '';
}; };
environment.etc = { environment.etc = {
"openvpn/iptables.sh" = "openvpn/iptables.sh" = {
{ source = ../../../scripts/server1/iptables.sh; source = ../../../scripts/server1/iptables.sh;
mode = "0755"; mode = "0755";
}; };
"openvpn/update-resolv-conf" = "openvpn/update-resolv-conf" = {
{ source = ../../../scripts/server1/update-resolv-conf; source = ../../../scripts/server1/update-resolv-conf;
mode = "0755"; mode = "0755";
}; };
"openvpn/routing.sh" = "openvpn/routing.sh" = {
{ source = ../../../scripts/server1/routing.sh; source = ../../../scripts/server1/routing.sh;
mode = "0755"; mode = "0755";
}; };
"openvpn/ca.rsa.2048.crt" = "openvpn/ca.rsa.2048.crt" = {
{ source = ../../../secrets/certs/ca.rsa.2048.crt; source = ../../../secrets/certs/ca.rsa.2048.crt;
mode = "0644"; mode = "0644";
}; };
"openvpn/crl.rsa.2048.pem" = "openvpn/crl.rsa.2048.pem" = {
{ source = ../../../secrets/certs/crl.rsa.2048.pem; source = ../../../secrets/certs/crl.rsa.2048.pem;
mode = "0644"; mode = "0644";
}; };
}; };
services.openssh = { services.openssh = {
enable = true; enable = true;
settings.PermitRootLogin = "yes"; settings.PermitRootLogin = "yes";
listenAddresses = [{ listenAddresses = [
{
port = 22; port = 22;
addr = "0.0.0.0"; addr = "0.0.0.0";
}]; }
];
}; };
users.users.root.openssh.authorizedKeys.keyFiles = [ users.users.root.openssh.authorizedKeys.keyFiles = [
../../../secrets/keys/authorized_keys ../../../secrets/keys/authorized_keys
@ -194,7 +199,6 @@
user = "vpn"; user = "vpn";
group = "lxc_shares"; group = "lxc_shares";
settings = { settings = {
alt-speed-down = 8000; alt-speed-down = 8000;
alt-speed-enabled = false; alt-speed-enabled = false;
alt-speed-time-begin = 0; alt-speed-time-begin = 0;
@ -265,6 +269,4 @@
utp-enabled = false; utp-enabled = false;
}; };
}; };
} }

View file

@ -1,11 +1,14 @@
# 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, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/installer/scan/not-detected.nix") lib,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usb_storage" "sd_mod"]; boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usb_storage" "sd_mod"];
@ -13,18 +16,18 @@
boot.kernelModules = ["kvm-intel"]; boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/4a590cad-28d9-4153-bdb8-e424ec3bd5c8"; device = "/dev/disk/by-uuid/4a590cad-28d9-4153-bdb8-e424ec3bd5c8";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/C67D-61AD"; device = "/dev/disk/by-uuid/C67D-61AD";
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = swapDevices = [
[ { device = "/dev/disk/by-uuid/b07aac27-a443-489c-9fdb-01c1ef633699"; } {device = "/dev/disk/by-uuid/b07aac27-a443-489c-9fdb-01c1ef633699";}
]; ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking

View file

@ -1,8 +1,8 @@
{ config, pkgs, ... }:
{ {
config,
pkgs,
...
}: {
services.gpg-agent = { services.gpg-agent = {
enable = true; enable = true;
enableSshSupport = true; enableSshSupport = true;
@ -16,7 +16,6 @@
''; '';
}; };
home = { home = {
username = "swarsel"; username = "swarsel";
homeDirectory = "/home/swarsel"; homeDirectory = "/home/swarsel";
@ -33,7 +32,8 @@
temperature.hwmon-path = "/sys/devices/platform/coretemp.0/hwmon/hwmon1/temp3_input"; temperature.hwmon-path = "/sys/devices/platform/coretemp.0/hwmon/hwmon1/temp3_input";
}; };
programs.waybar.settings.mainBar.modules-right = ["custom/outer-left-arrow-dark" programs.waybar.settings.mainBar.modules-right = [
"custom/outer-left-arrow-dark"
"mpris" "mpris"
"custom/left-arrow-light" "custom/left-arrow-light"
"network" "network"
@ -50,7 +50,6 @@
"clock#1" "clock#1"
]; ];
wayland.windowManager.sway = { wayland.windowManager.sway = {
config = rec { config = rec {
input = { input = {
@ -89,14 +88,12 @@
}; };
startup = [ startup = [
{command = "nextcloud --background";} {command = "nextcloud --background";}
{command = "discord --start-minimized";} {command = "discord --start-minimized";}
{command = "element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds";} {command = "element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds";}
{command = "ANKI_WAYLAND=1 anki";} {command = "ANKI_WAYLAND=1 anki";}
{command = "OBSIDIAN_USE_WAYLAND=1 obsidian";} {command = "OBSIDIAN_USE_WAYLAND=1 obsidian";}
{command = "nm-applet";} {command = "nm-applet";}
]; ];
keycodebindings = { keycodebindings = {

View file

@ -1,13 +1,12 @@
{ lib, pkgs, ... }:
{ {
lib,
imports = pkgs,
[ ...
}: {
imports = [
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
services = { services = {
getty.autologinUser = "swarsel"; getty.autologinUser = "swarsel";
greetd.settings.initial_session.user = "swarsel"; greetd.settings.initial_session.user = "swarsel";
@ -82,9 +81,6 @@
}; };
}; };
users.users.swarsel = { users.users.swarsel = {
isNormalUser = true; isNormalUser = true;
description = "Leon S"; description = "Leon S";
@ -96,5 +92,4 @@
]; ];
system.stateVersion = "23.05"; system.stateVersion = "23.05";
} }

View file

@ -1,8 +1,8 @@
{ config, pkgs, ... }:
{ {
config,
pkgs,
...
}: {
services.gpg-agent = { services.gpg-agent = {
enable = true; enable = true;
enableSshSupport = true; enableSshSupport = true;
@ -34,8 +34,8 @@
temperature.input-filename = "temp1_input"; temperature.input-filename = "temp1_input";
}; };
programs.waybar.settings.mainBar.modules-right = [
programs.waybar.settings.mainBar.modules-right = ["custom/outer-left-arrow-dark" "custom/outer-left-arrow-dark"
"mpris" "mpris"
"custom/left-arrow-light" "custom/left-arrow-light"
"network" "network"
@ -52,7 +52,6 @@
"clock#1" "clock#1"
]; ];
wayland.windowManager.sway = { wayland.windowManager.sway = {
config = rec { config = rec {
# update for actual inputs here, # update for actual inputs here,
@ -61,7 +60,8 @@
xkb_layout = "us"; xkb_layout = "us";
xkb_variant = "altgr-intl"; xkb_variant = "altgr-intl";
}; };
"1:1:AT_Translated_Set_2_keyboard" = { # TEMPLATE "1:1:AT_Translated_Set_2_keyboard" = {
# TEMPLATE
xkb_layout = "us"; xkb_layout = "us";
xkb_options = "grp:win_space_toggle"; xkb_options = "grp:win_space_toggle";
xkb_variant = "altgr-intl"; xkb_variant = "altgr-intl";
@ -72,7 +72,6 @@
natural_scroll = "enabled"; natural_scroll = "enabled";
middle_emulation = "enabled"; middle_emulation = "enabled";
}; };
}; };
output = { output = {
@ -92,11 +91,16 @@
}; };
workspaceOutputAssign = [ workspaceOutputAssign = [
{ output = "eDP-1"; workspace = "1:";} {
{ output = "HDMI-A-1"; workspace = "2:";} output = "eDP-1";
workspace = "1:";
}
{
output = "HDMI-A-1";
workspace = "2:";
}
]; ];
# keybindings = let # keybindings = let
# inherit (config.wayland.windowManager.sway.config) modifier; # inherit (config.wayland.windowManager.sway.config) modifier;
# in { # in {
@ -104,14 +108,12 @@
# }; # };
startup = [ startup = [
{command = "nextcloud --background";} {command = "nextcloud --background";}
{command = "discord --start-minimized";} {command = "discord --start-minimized";}
{command = "element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds";} {command = "element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds";}
{command = "ANKI_WAYLAND=1 anki";} {command = "ANKI_WAYLAND=1 anki";}
{command = "OBSIDIAN_USE_WAYLAND=1 obsidian";} {command = "OBSIDIAN_USE_WAYLAND=1 obsidian";}
{command = "nm-applet";} {command = "nm-applet";}
]; ];
}; };
}; };

View file

@ -1,15 +1,11 @@
{ pkgs, ... }: {pkgs, ...}: {
{
# #
# imports = # imports =
# [ # [
# ./hardware-configuration.nix # ./hardware-configuration.nix
# ]; # ];
# #
imports = imports = [
[
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
@ -99,9 +95,6 @@
}; };
}; };
hardware = { hardware = {
graphics = { graphics = {
enable = true; enable = true;
@ -140,6 +133,4 @@
]; ];
system.stateVersion = "23.05"; system.stateVersion = "23.05";
} }

View file

@ -171,24 +171,19 @@ create a new one."
visual-fill-column-center-text t) visual-fill-column-center-text t)
(visual-fill-column-mode 1)) (visual-fill-column-mode 1))
(defun run-alejandra ()
(interactive)
(let ((default-directory (expand-file-name "~/.dotfiles")))
(shell-command "alejandra . -q")))
(defun swarsel/org-babel-tangle-config () (defun swarsel/org-babel-tangle-config ()
(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)
(when (string-equal (buffer-file-name) (run-alejandra))))
swarsel-emacs-org-filepath)
;; Dynamic scoping to the rescue
(let ((org-confirm-babel-evaluate nil))
(org-html-export-to-html)
(org-babel-tangle)))
(when (string-equal (buffer-file-name)
swarsel-nix-org-filepath)
;; Dynamic scoping to the rescue
(let ((org-confirm-babel-evaluate nil))
(org-babel-tangle))))
(setq org-html-htmlize-output-type nil) (setq org-html-htmlize-output-type nil)

View file

@ -11,7 +11,6 @@
llvm = pkgs.llvmPackages_latest; llvm = pkgs.llvmPackages_latest;
in { in {
devShells.${system}.default = pkgs.mkShell { devShells.${system}.default = pkgs.mkShell {
packages = with pkgs; [ packages = with pkgs; [
gcc gcc
#builder #builder
@ -32,7 +31,6 @@
PATH_add ~/.dotfiles/scripts/devShell PATH_add ~/.dotfiles/scripts/devShell
''; '';
# ... # ...
}; };
}; };
} }

View file

@ -7,10 +7,12 @@
outputs = {nixpkgs, ...}: let outputs = {nixpkgs, ...}: let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = import nixpkgs { system = "x86_64-linux"; config.allowUnfree = true; }; pkgs = import nixpkgs {
system = "x86_64-linux";
config.allowUnfree = true;
};
in { in {
devShells.${system}.default = pkgs.mkShell { devShells.${system}.default = pkgs.mkShell {
packages = with pkgs; [ packages = with pkgs; [
# gcc # gcc
#builder #builder
@ -39,7 +41,6 @@
]; ];
hardeningDisable = ["all"]; hardeningDisable = ["all"];
# ... # ...
}; };
}; };
} }

View file

@ -9,7 +9,6 @@
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
in { in {
devShells.${system}.default = pkgs.mkShell { devShells.${system}.default = pkgs.mkShell {
packages = with pkgs; [ packages = with pkgs; [
# fill here # fill here
]; ];

View file

@ -9,7 +9,6 @@
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
in { in {
devShells.${system}.default = pkgs.mkShell { devShells.${system}.default = pkgs.mkShell {
packages = [ packages = [
(pkgs.python3.withPackages (python-pkgs: [ (pkgs.python3.withPackages (python-pkgs: [
python-pkgs.numpy python-pkgs.numpy

View file

@ -5,7 +5,11 @@
rust-overlay.url = "github:oxalica/rust-overlay"; rust-overlay.url = "github:oxalica/rust-overlay";
}; };
outputs = { nixpkgs, rust-overlay, ...}: let outputs = {
nixpkgs,
rust-overlay,
...
}: let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
@ -14,7 +18,6 @@
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./toolchain.toml; toolchain = pkgs.rust-bin.fromRustupToolchainFile ./toolchain.toml;
in { in {
devShells.${system}.default = pkgs.mkShell { devShells.${system}.default = pkgs.mkShell {
packages = with pkgs; [ packages = with pkgs; [
cargo cargo
clippy clippy
@ -30,7 +33,6 @@
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library"; RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
# ... # ...
}; };
}; };
} }