chore: code cleanup

This commit is contained in:
Swarsel 2024-07-20 00:10:56 +02:00
parent e66e4978ff
commit 23cfb96adb
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
8 changed files with 3701 additions and 3681 deletions

File diff suppressed because it is too large Load diff

112
flake.lock generated
View file

@ -237,24 +237,6 @@
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_3": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib_2"
},
"locked": {
"lastModified": 1719994518,
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
"type": "github"
},
"original": {
"id": "flake-parts",
"type": "indirect"
@ -535,25 +517,6 @@
"type": "github"
}
},
"nix-gaming": {
"inputs": {
"flake-parts": "flake-parts_2",
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1720920199,
"narHash": "sha256-0dNwRhtUVQha5S+NFeoeMXEt/6v0x56DCdyUk+vEFeY=",
"owner": "fufexan",
"repo": "nix-gaming",
"rev": "fce565402d5b1ed4e92c4a9dfcd094d0172d8f0b",
"type": "github"
},
"original": {
"owner": "fufexan",
"repo": "nix-gaming",
"type": "github"
}
},
"nix-index-database": {
"inputs": {
"nixpkgs": "nixpkgs_2"
@ -620,7 +583,7 @@
"nixgl": {
"inputs": {
"flake-utils": "flake-utils_4",
"nixpkgs": "nixpkgs_4"
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1713543440,
@ -732,18 +695,6 @@
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
}
},
"nixpkgs-lib_2": {
"locked": {
"lastModified": 1719876945,
"narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1720954236,
@ -825,22 +776,6 @@
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1720781449,
"narHash": "sha256-po3TZO9kcZwzvkyMJKb0WCzzDtiHWD34XeRaX1lWXp0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8b5a3d5a1d951344d683b442c0739010b80039db",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1660551188,
"narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=",
@ -855,6 +790,22 @@
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1720957393,
"narHash": "sha256-oedh2RwpjEa+TNxhg5Je9Ch6d3W1NKi7DbRO1ziHemA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "693bc46d169f5af9c992095736e82c3488bf7dbb",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_5": {
"locked": {
"lastModified": 1720957393,
@ -872,22 +823,6 @@
}
},
"nixpkgs_6": {
"locked": {
"lastModified": 1720957393,
"narHash": "sha256-oedh2RwpjEa+TNxhg5Je9Ch6d3W1NKi7DbRO1ziHemA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "693bc46d169f5af9c992095736e82c3488bf7dbb",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_7": {
"locked": {
"lastModified": 1720781449,
"narHash": "sha256-po3TZO9kcZwzvkyMJKb0WCzzDtiHWD34XeRaX1lWXp0=",
@ -903,7 +838,7 @@
"type": "github"
}
},
"nixpkgs_8": {
"nixpkgs_7": {
"locked": {
"lastModified": 1714912032,
"narHash": "sha256-clkcOIkg8G4xuJh+1onLG4HPMpbtzdLv4rHxFzgsH9c=",
@ -969,8 +904,8 @@
},
"nswitch-rcm-nix": {
"inputs": {
"flake-parts": "flake-parts_3",
"nixpkgs": "nixpkgs_6"
"flake-parts": "flake-parts_2",
"nixpkgs": "nixpkgs_5"
},
"locked": {
"lastModified": 1721302286,
@ -1034,13 +969,12 @@
"home-manager": "home-manager",
"lanzaboote": "lanzaboote",
"nix-alien": "nix-alien",
"nix-gaming": "nix-gaming",
"nix-index-database": "nix-index-database_2",
"nix-on-droid": "nix-on-droid",
"nixgl": "nixgl",
"nixos-generators": "nixos-generators",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_5",
"nixpkgs": "nixpkgs_4",
"nixpkgs-stable": "nixpkgs-stable_3",
"nswitch-rcm-nix": "nswitch-rcm-nix",
"nur": "nur",
@ -1075,7 +1009,7 @@
},
"sops-nix": {
"inputs": {
"nixpkgs": "nixpkgs_7",
"nixpkgs": "nixpkgs_6",
"nixpkgs-stable": "nixpkgs-stable_4"
},
"locked": {
@ -1104,7 +1038,7 @@
"flake-compat": "flake-compat_3",
"gnome-shell": "gnome-shell",
"home-manager": "home-manager_3",
"nixpkgs": "nixpkgs_8"
"nixpkgs": "nixpkgs_7"
},
"locked": {
"lastModified": 1720818679,

View file

@ -47,11 +47,6 @@
inputs.nixpkgs.follows = "nixpkgs";
};
# patches for gaming on nix
nix-gaming = {
url = "github:fufexan/nix-gaming";
};
# hardware quirks on nix
nixos-hardware = {
url = "github:NixOS/nixos-hardware/master";
@ -87,6 +82,7 @@
lanzaboote,
nixos-hardware,
nix-alien,
nixos-generators,
nswitch-rcm-nix,
nix-index-database,
...
@ -151,7 +147,7 @@
modules =
nixModules
++ [
./profiles/onett/nixos.nix
./profles/onett/nixos.nix
home-manager.nixosModules.home-manager
{
home-manager.users.swarsel.imports =
@ -368,6 +364,13 @@
};
packages.x86_64-linux = {
proxmox-lxc = nixos-generators.nixosGenerate {
inherit system;
modules = [
./profiles/server1/TEMPLATE/nixos.nix
];
format = "proxmox-lxc";
};
};
};
}

3041
index.html

File diff suppressed because it is too large Load diff

View file

@ -41,26 +41,27 @@
# -----------------------------------------------------------------
# is this machine always connected to power? If yes, use this block:
#
# programs.waybar.settings.mainBar."custom/pseudobat"= {
# format= "";
# on-click-right= "wlogout -p layer-shell";
# programs.waybar.settings.mainBar."custom/pseudobat" = {
# format = "";
# on-click-right = "wlogout -p layer-shell";
# };
# programs.waybar.settings.mainBar.modules-right = ["custom/outer-left-arrow-dark"
# "mpris"
# "custom/left-arrow-light"
# "network"
# "custom/left-arrow-dark"
# "pulseaudio"
# "custom/left-arrow-light"
# "custom/pseudobat"
# "battery"
# "custom/left-arrow-dark"
# "group/hardware"
# "custom/left-arrow-light"
# "clock#2"
# "custom/left-arrow-dark"
# "clock#1"
# ];
# programs.waybar.settings.mainBar.modules-right = [
# "custom/outer-left-arrow-dark"
# "mpris"
# "custom/left-arrow-light"
# "network"
# "custom/left-arrow-dark"
# "pulseaudio"
# "custom/left-arrow-light"
# "custom/pseudobat"
# "battery"
# "custom/left-arrow-dark"
# "group/hardware"
# "custom/left-arrow-light"
# "clock#2"
# "custom/left-arrow-dark"
# "clock#1"
# ];
#
# -----------------------------------------------------------------

View file

@ -29,6 +29,7 @@
# nix
alejandra
nixpkgs-fmt
deadnix
statix
@ -170,31 +171,33 @@
noto-fonts-cjk-sans
# cura
(let
cura5 = appimageTools.wrapType2 rec {
name = "cura5";
version = "5.4.0";
src = fetchurl {
url = "https://github.com/Ultimaker/Cura/releases/download/${version}/UltiMaker-Cura-${version}-linux-modern.AppImage";
hash = "sha256-QVv7Wkfo082PH6n6rpsB79st2xK2+Np9ivBg/PYZd74=";
(
let
cura5 = appimageTools.wrapType2 rec {
name = "cura5";
version = "5.4.0";
src = fetchurl {
url = "https://github.com/Ultimaker/Cura/releases/download/${version}/UltiMaker-Cura-${version}-linux-modern.AppImage";
hash = "sha256-QVv7Wkfo082PH6n6rpsB79st2xK2+Np9ivBg/PYZd74=";
};
extraPkgs = pkgs: with pkgs; [];
};
extraPkgs = pkgs: with pkgs; [];
};
in
writeScriptBin "cura" ''
#! ${pkgs.bash}/bin/bash
# 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.
# This fixes use cases like `cd /path/to/my/files; cura mymodel.stl anothermodel.stl`.
args=()
for a in "$@"; do
if [ -e "$a" ]; then
a="$(realpath "$a")"
fi
args+=("$a")
done
exec "${cura5}/bin/cura5" "''${args[@]}"
'')
in
writeScriptBin "cura" ''
#! ${pkgs.bash}/bin/bash
# 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.
# This fixes use cases like `cd /path/to/my/files; cura mymodel.stl anothermodel.stl`.
args=()
for a in "$@"; do
if [ -e "$a" ]; then
a="$(realpath "$a")"
fi
args+=("$a")
done
exec "${cura5}/bin/cura5" "''${args[@]}"
''
)
#E: hides scratchpad depending on state, calls emacsclient for edit and then restores the scratchpad state
(pkgs.writeShellScriptBin "e" ''
@ -332,7 +335,10 @@
programs.ssh = {
enable = true;
extraConfig = "SetEnv TERM=xterm-256color";
forwardAgent = true;
extraConfig = ''
SetEnv TERM=xterm-256color
'';
matchBlocks = {
"nginx" = {
hostname = "192.168.1.14";
@ -406,57 +412,18 @@
hostname = "193.122.53.173";
user = "root"; #this is a oracle vm server but needs root due to nixos-infect
};
"songdiver" = {
hostname = "89.168.100.65";
user = "ubuntu";
};
"pkv" = {
hostname = "46.232.248.161";
user = "root";
};
"nebula" = {
hostname = "128.131.171.15";
user = "amp23s56";
compression = true;
identityFile = "~/.ssh/id_ed25519";
proxyCommand = "ssh -p 1022 -i ~/.ssh/id_ed25519 -q -W %h:%p %r@venus.par.tuwien.ac.at";
extraOptions = {
"TCPKeepAlive" = "yes";
};
};
"efficient" = {
hostname = "g0.complang.tuwien.ac.at";
forwardAgent = true;
user = "ep01427399";
# leaving the below lines in for future reference
# remoteForwards = [
# {
# bind.address = "/run/user/21217/gnupg/S.gpg-agent";
# host.address = "/run/user/1000/gnupg/S.gpg-agent.extra";
# }
# {
# bind.address = "/run/user/21217/gnupg/S.gpg-agent.ssh";
# host.address = "/run/user/1000/gnupg/S.gpg-agent.ssh";
# }
# ];
# extraOptions = {
# "RemoteForward" = "/run/user/21217/gnupg/S.gpg-agent /run/user/1000/gnupg/S.gpg-agent.extra";
# "StreamLocalBindUnlink" = "yes";
# "RemoteForward" = "/run/user/21217/gnupg/S.gpg-agent.ssh /run/user/1000/gnupg/S.gpg-agent.ssh";
# };
# setEnv = {
# "TERM" = "xterm";
# };
};
"hydra" = {
hostname = "128.131.171.215";
user = "hpc23w33";
compression = true;
forwardAgent = true;
# identityFile = "~/.ssh/id_tuwien_hpc";
# proxyCommand = "ssh -p 1022 -i ~/.ssh/id_tuwien_hpc -q -W %h:%p %r@venus.par.tuwien.ac.at";
proxyCommand = "ssh -p 1022 -q -W %h:%p %r@venus.par.tuwien.ac.at";
extraOptions = {
"TCPKeepAlive" = "yes";
};
};
};
};
@ -550,21 +517,21 @@
pandoc.enable = true;
fzf.enable = true;
zoxide.enable = true;
};
nix-index = let
command-not-found = pkgs.runCommandLocal "command-not-found.sh" {} ''
mkdir -p $out/etc/profile.d
substitute ${../../scripts/command-not-found.sh} \
$out/etc/profile.d/command-not-found.sh \
--replace @nix-locate@ ${pkgs.nix-index}/bin/nix-locate \
--replace @tput@ ${pkgs.ncurses}/bin/tput
'';
in {
enable = true;
package = pkgs.symlinkJoin {
name = "nix-index";
paths = [command-not-found];
};
programs.nix-index = let
command-not-found = pkgs.runCommandLocal "command-not-found.sh" {} ''
mkdir -p $out/etc/profile.d
substitute ${../../scripts/command-not-found.sh} \
$out/etc/profile.d/command-not-found.sh \
--replace @nix-locate@ ${pkgs.nix-index}/bin/nix-locate \
--replace @tput@ ${pkgs.ncurses}/bin/tput
'';
in {
enable = true;
package = pkgs.symlinkJoin {
name = "nix-index";
paths = [command-not-found];
};
};

View file

@ -102,8 +102,8 @@
};
extraConfig = "
exec swaymsg input 7062:6917:NTRG0001:01_1B96:1B05 map_to_output eDP-1
exec swaymsg input 7062:6917:NTRG0001:01_1B96:1B05_Stylus map_to_output eDP-1
";
exec swaymsg input 7062:6917:NTRG0001:01_1B96:1B05 map_to_output eDP-1
exec swaymsg input 7062:6917:NTRG0001:01_1B96:1B05_Stylus map_to_output eDP-1
";
};
}

View file

@ -263,6 +263,31 @@ create a new one."
(while (re-search-forward (concat "^" (regexp-quote common-prefix) "\\.") end t)
(replace-match ""))))))
(defun swarsel/org-nixpkgs-fmt-block-lite ()
(interactive)
(org-babel-mark-block)
(call-interactively 'nixpkgs-fmt-region))
(defun swarsel/org-nixpkgs-fmt-block ()
(interactive)
(save-excursion
(let* ((element (org-element-at-point))
(begin (org-element-property :begin element))
(end (org-element-property :end element))
(lang (org-element-property :language element)))
(when lang
(goto-char begin)
(forward-line)
(insert "{")
(goto-char end)
(forward-line -1)
(beginning-of-line)
(forward-char -1)
(insert "}")
(org-babel-mark-block)
(call-interactively 'nixpkgs-fmt-region)))))
;; Make ESC quit prompts
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
@ -1074,6 +1099,8 @@ create a new one."
(use-package nix-mode
:mode "\\.nix\\'")
(use-package nixpkgs-fmt)
(setq markdown-command "pandoc")
(use-package markdown-mode