Merge branch 'main' of github.com:jroeger23/.nixos

This commit is contained in:
Jonas Röger 2025-03-17 13:04:24 +01:00
commit 60254529e4
Signed by: jonas
GPG Key ID: 4000EB35E1AE0F07
19 changed files with 289 additions and 73 deletions

84
flake.lock generated
View File

@ -20,11 +20,11 @@
]
},
"locked": {
"lastModified": 1739103745,
"narHash": "sha256-c53dcRaw0F4Os9WD05HwIRs9kTDZw4Mxe1XK4edEALo=",
"lastModified": 1741934125,
"narHash": "sha256-qwI47l3aKXRpDvmCKDbLV70iVfAqhpuKqT7qYHA4KJk=",
"owner": "hyprwm",
"repo": "aquamarine",
"rev": "a3dda0d10ce9aa1d1dfb7a6c139ea8c2872c74bd",
"rev": "bea48d0bbe15fb3d758a8b6be865836c97056575",
"type": "github"
},
"original": {
@ -42,11 +42,11 @@
},
"locked": {
"dir": "pkgs/firefox-addons",
"lastModified": 1739383790,
"narHash": "sha256-OuQrFnZqp9coc4b7Hz1QkTxj+pIiAvS/fUnCXqxUUFw=",
"lastModified": 1742025179,
"narHash": "sha256-gxfMDCQeGZk3wZjqdl2boaGGm+yiAkaNFNp3x5vhuYg=",
"owner": "rycee",
"repo": "nur-expressions",
"rev": "2b28cc6940ded52f60883074a2d53a328db9907c",
"rev": "9b8d2f4a1e3a199878d1eb14d7e0f176052a8038",
"type": "gitlab"
},
"original": {
@ -116,11 +116,11 @@
]
},
"locked": {
"lastModified": 1736373539,
"narHash": "sha256-dinzAqCjenWDxuy+MqUQq0I4zUSfaCvN9rzuCmgMZJY=",
"lastModified": 1739757849,
"narHash": "sha256-Gs076ot1YuAAsYVcyidLKUMIc4ooOaRGO0PqTY7sBzA=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "bd65bc3cde04c16755955630b344bc9e35272c56",
"rev": "9d3d080aec2a35e05a15cedd281c2384767c2cfe",
"type": "github"
},
"original": {
@ -206,11 +206,11 @@
"xdph": "xdph"
},
"locked": {
"lastModified": 1739368482,
"narHash": "sha256-SHDq4bk3tJsh0wyXs20OztvsCGT2+6c6sj92+qBKjfI=",
"lastModified": 1742062509,
"narHash": "sha256-7XaXH+puaULpz2dbK9VuMgOwI9cD7MBd51N+wZsXiIY=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "68bb3e7f0a1d528a8b2da1f92d2005889587561d",
"rev": "4c471218c9fd8be87f0df968004e527b4f42d948",
"type": "github"
},
"original": {
@ -358,11 +358,11 @@
]
},
"locked": {
"lastModified": 1739048914,
"narHash": "sha256-vd5rJBTmp2w7SDgfv23Zcd84ktI5eDA7e5UBzx+pKrU=",
"lastModified": 1741191527,
"narHash": "sha256-kM+11Nch47Xwfgtw2EpRitJuORy4miwoMuRi5tyMBDY=",
"owner": "hyprwm",
"repo": "hyprlang",
"rev": "a7334904d591f38757c46fbe2ab68651877d9099",
"rev": "72df3861f1197e41b078faa3e38eedd60e00018d",
"type": "github"
},
"original": {
@ -383,11 +383,11 @@
]
},
"locked": {
"lastModified": 1739048933,
"narHash": "sha256-ck6MaoYvISBQKqZR+HcxXnx0wOhyCauxfVMaV5zhJxQ=",
"lastModified": 1741534688,
"narHash": "sha256-EV3945SnjOCuRVbGRghsWx/9D89FyshnSO1Q6/TuQ14=",
"owner": "hyprwm",
"repo": "hyprutils",
"rev": "e4e018a2ca6f5a9c33511973454199e1c7c85499",
"rev": "dd1f720cbc2dbb3c71167c9598045dd3261d27b3",
"type": "github"
},
"original": {
@ -408,11 +408,11 @@
]
},
"locked": {
"lastModified": 1739049028,
"narHash": "sha256-RleJp7LYbr6s+M1xgbmhtBs+fYa3ZdIiF7+QalJ4D1g=",
"lastModified": 1739870480,
"narHash": "sha256-SiDN5BGxa/1hAsqhgJsS03C3t2QrLgBT8u+ENJ0Qzwc=",
"owner": "hyprwm",
"repo": "hyprwayland-scanner",
"rev": "04146df74a8d5ec0b579657307be01f1e241125f",
"rev": "206367a08dc5ac4ba7ad31bdca391d098082e64b",
"type": "github"
},
"original": {
@ -423,11 +423,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1738816619,
"narHash": "sha256-5yRlg48XmpcX5b5HesdGMOte+YuCy9rzQkJz+imcu6I=",
"lastModified": 1741792691,
"narHash": "sha256-f0BVt1/cvA0DQ/q3rB+HY4g4tKksd03ZkzI4xehC2Ew=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "2eccff41bab80839b1d25b303b53d339fbb07087",
"rev": "e1f12151258b12c567f456d8248e4694e9390613",
"type": "github"
},
"original": {
@ -439,11 +439,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1739206421,
"narHash": "sha256-PwQASeL2cGVmrtQYlrBur0U20Xy07uSWVnFup2PHnDs=",
"lastModified": 1741862977,
"narHash": "sha256-prZ0M8vE/ghRGGZcflvxCu40ObKaB+ikn74/xQoNrGQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "44534bc021b85c8d78e465021e21f33b856e2540",
"rev": "cdd2ef009676ac92b715ff26630164bb88fec4e0",
"type": "github"
},
"original": {
@ -455,11 +455,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1739214665,
"narHash": "sha256-26L8VAu3/1YRxS8MHgBOyOM8xALdo6N0I04PgorE7UM=",
"lastModified": 1741851582,
"narHash": "sha256-cPfs8qMccim2RBgtKGF+x9IBCduRvd/N5F4nYpU0TVE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "64e75cd44acf21c7933d61d7721e812eac1b5a0a",
"rev": "6607cf789e541e7873d40d3a8f7815ea92204f32",
"type": "github"
},
"original": {
@ -479,11 +479,11 @@
]
},
"locked": {
"lastModified": 1736549395,
"narHash": "sha256-XzwkB62Tt5UYoL1jXiHzgk/qz2fUpGHExcSIbyGTtI0=",
"lastModified": 1740569341,
"narHash": "sha256-WV8nY2IOfWdzBF5syVgCcgOchg/qQtpYh6LECYS9XkY=",
"owner": "pjones",
"repo": "plasma-manager",
"rev": "a53af7f1514ef4cce8620a9d6a50f238cdedec8b",
"rev": "5eeb0172fb74392053b66a8149e61b5e191b2845",
"type": "github"
},
"original": {
@ -502,11 +502,11 @@
]
},
"locked": {
"lastModified": 1737465171,
"narHash": "sha256-R10v2hoJRLq8jcL4syVFag7nIGE7m13qO48wRIukWNg=",
"lastModified": 1741379162,
"narHash": "sha256-srpAbmJapkaqGRE3ytf3bj4XshspVR5964OX5LfjDWc=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "9364dc02281ce2d37a1f55b6e51f7c0f65a75f17",
"rev": "b5a62751225b2f62ff3147d0a334055ebadcd5cc",
"type": "github"
},
"original": {
@ -535,11 +535,11 @@
]
},
"locked": {
"lastModified": 1739262228,
"narHash": "sha256-7JAGezJ0Dn5qIyA2+T4Dt/xQgAbhCglh6lzCekTVMeU=",
"lastModified": 1741861888,
"narHash": "sha256-ynOgXAyToeE1UdLNfrUn/hL7MN0OpIS2BtNdLjpjPf0=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "07af005bb7d60c7f118d9d9f5530485da5d1e975",
"rev": "d016ce0365b87d848a57c12ffcfdc71da7a2b55f",
"type": "github"
},
"original": {
@ -591,11 +591,11 @@
]
},
"locked": {
"lastModified": 1737634991,
"narHash": "sha256-dBAnb7Kbnier30cA7AgxVSxxARmxKZ1vHZT33THSIr8=",
"lastModified": 1741934139,
"narHash": "sha256-ZhTcTH9FoeAtbPfWGrhkH7RjLJZ7GeF18nygLAMR+WE=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "e09dfe2726c8008f983e45a0aa1a3b7416aaeb8a",
"rev": "150b0b6f52bb422a1b232a53698606fe0320dde0",
"type": "github"
},
"original": {

View File

@ -98,5 +98,18 @@
# to pass through arguments to home.nix
extraSpecialArgs = {inherit inputs;};
};
templates = {
rust = {
path = ./templates/rust;
description = "A simple rust binary template";
welcomeText = ''
# Rust template
This is a simple rust binary template.
To build the project run `cargo build`.
To run the project run `cargo run`.
Before running nix build, make sure to run `cargo generate-lockfile` first.
'';
};
};
};
}

View File

@ -22,7 +22,7 @@
../../modules/programs.nix
];
desktop.dm.name = "sddm";
desktop.de.plasma.enable = true;
desktop.de.plasma.enable = false;
desktop.de.hyprland.enable = true;
nix.settings.experimental-features = ["nix-command" "flakes"];

View File

@ -11,7 +11,7 @@
${pkgs.alejandra}/bin/alejandra . &>/dev/null
${pkgs.git}/bin/git diff -U0
echo "NixOS Rebuilding..."
${pkgs.unstable.nh}/bin/nh home switch ~/.nixos
${pkgs.nh}/bin/nh home switch ~/.nixos
gen=$(home-manager generations | head -n1 | ${pkgs.gawk}/bin/awk '{print "Gen" $5 " @ " $1 "-" $2}')
${pkgs.git}/bin/git commit --no-gpg-sign -am "Home $gen"
popd
@ -24,7 +24,7 @@
${pkgs.alejandra}/bin/alejandra . &>/dev/null
${pkgs.git}/bin/git diff -U0
echo "NixOS Rebuilding..."
${pkgs.unstable.nh}/bin/nh os switch ~/.nixos
${pkgs.nh}/bin/nh os switch ~/.nixos
gen=$(sudo nix-env --list-generations --profile /nix/var/nix/profiles/system | ${pkgs.gnugrep}/bin/grep current | ${pkgs.gawk}/bin/awk '{print "Gen" $1 " @ " $2 "-" $3}')
${pkgs.git}/bin/git commit --no-gpg-sign -am "System $gen"
popd
@ -38,12 +38,23 @@
echo ".nixos is unclean!"
exit 1
fi
branch_staging="staging-update"
if ${pkgs.git}/bin/git rev-parse --verify "$branch_staging" >/dev/null 2>&1; then
echo "Using staging update branch."
else
echo "No staging update branch found."
exit 1
fi
${pkgs.git}/bin/git checkout "$branch_staging" flake.lock
echo "Updating nix-flake..."
nix flake update --flake .
echo "NixOS Rebuilding..."
${pkgs.unstable.nh}/bin/nh os switch ~/.nixos
${pkgs.nh}/bin/nh os switch ~/.nixos
gen=$(sudo nix-env --list-generations --profile /nix/var/nix/profiles/system | ${pkgs.gnugrep}/bin/grep current | ${pkgs.gawk}/bin/awk '{print "Gen" $1 " @ " $2 "-" $3}')
${pkgs.git}/bin/git commit --no-gpg-sign -am "Upgrade $gen"
${pkgs.git}/bin/git branch -D "$branch_staging"
popd
'';
update =
@ -55,15 +66,28 @@
echo ".nixos is unclean!"
exit 1
fi
echo "Updating nix-flake..."
nix flake update --flake .
echo "NixOS Building..."
${pkgs.unstable.nh}/bin/nh os build ~/.nixos
branch_staging="staging-update"
branch_current="$(${pkgs.git}/bin/git branch --show-current)"
if ${pkgs.git}/bin/git rev-parse --verify "$branch_staging" >/dev/null 2>&1; then
echo "There is already a staging update branch."
else
echo "Creating a new staging update branch."
${pkgs.git}/bin/git switch -c "$branch_staging"
nix flake update --verbose --flake .
${pkgs.git}/bin/git add flake.lock
${pkgs.git}/bin/git commit --no-gpg-sign -m "staging update"
${pkgs.git}/bin/git switch "$branch_current"
fi
nix store diff-closures \
'.?ref='"$branch_current"'#nixosConfigurations.'"$(${pkgs.hostname}/bin/hostname)"'.config.system.build.toplevel' \
'.?ref='"$branch_staging"'#nixosConfigurations.'"$(${pkgs.hostname}/bin/hostname)"'.config.system.build.toplevel'
popd
'';
in {
environment.systemPackages = [
pkgs.bash
home-rebuild
rebuild
upgrade

View File

@ -27,8 +27,11 @@ in {
environment.systemPackages = with pkgs; [
libsForQt5.kwallet
libsForQt5.kwalletmanager
spaceFM
];
services.udisks2.enable = true;
programs.hyprland = {
enable = true;
withUWSM = true;

View File

@ -101,13 +101,6 @@
("C-TAB" . 'copilot-accept-completion-by-word)
("C-<tab>" . 'copilot-accept-completion-by-word)))
(add-hook! 'prog-mode-hook #'undo-tree-mode)
(after! undo-tree
(setq undo-tree-auto-save-history t)
(setq undo-tree-enable-undo-in-region nil)
(setq undo-tree-history-directory-alist '(("." . "~/.cache/doom/undo"))))
(after! markdown-mode
(setq markdown-split-window-direction 'right)
(setq markdown-command "pandoc -t html5 -f markdown_mmd --embed-resources --standalone --mathjax --quiet --highlight-style=zenburn")
@ -122,7 +115,7 @@
:config
(setq graphviz-dot-indent-width 4))
(after! latex
(after! auctex
(add-hook! 'LaTeX-mode-hook 'lsp)
(map! :map LaTeX-mode-map
:localleader

View File

@ -70,9 +70,9 @@
:emacs
dired ; making dired pretty [functional]
electric ; smarter, keyword-based electric-indent
;;ibuffer ; interactive buffer management
(ibuffer +icons) ; interactive buffer management
undo ; persistent, smarter undo for your inevitable mistakes
(undo +tree) ; persistent, smarter undo for your inevitable mistakes
vc ; version-control and Emacs, sitting in a tree
:term
@ -112,7 +112,7 @@
:os
(:if (featurep :system 'macos) macos) ; improve compatibility with macOS
;;tty ; improve the terminal Emacs experience
(tty +osc) ; improve the terminal Emacs experience
:lang
;;agda ; types of types of types of types...

View File

@ -55,9 +55,11 @@
(package! copilot
:recipe (:host github :repo "copilot-emacs/copilot.el" :files ("*.el")))
;; TODO: Remove this when a fix for https://github.com/doomemacs/doomemacs/issues/8286 is included
(package! package-lint :pin "21edc6d0d0eadd2d0a537f422fb9b7b8a3ae6991")
(package! direnv)
(package! copilot)
(package! undo-tree)
(package! pdf-tools)
(package! eww)
(package! pandoc-mode)

View File

@ -3,7 +3,34 @@
pkgs,
lib,
...
}: {
}: let
screenshot = pkgs.writeShellScriptBin "screenshot" ''
region=0
clip=0
while [[ "$#" -gt 0 ]]; do
case $1 in
--region) region=1; ;;
--clip) clip=1; ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
done
if [[ $region -eq 1 ]]; then
if [[ $clip -eq 1 ]]; then
${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" - | ${pkgs.wl-clipboard}/bin/wl-copy
else
${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" ~/Pictures/Screenshots/$(${pkgs.coreutils}/bin/date +'%Y-%m-%d_%H-%M-%S').png
fi
else
if [[ $clip -eq 1 ]]; then
${pkgs.grim}/bin/grim - | ${pkgs.wl-clipboard}/bin/wl-copy
else
${pkgs.grim}/bin/grim ~/Pictures/Screenshots/$(${pkgs.coreutils}/bin/date +'%Y-%m-%d_%H-%M-%S').png
fi
fi
'';
in {
services.hypridle.settings = {
general = {
# lock_cmd = notify-send "lock!" # dbus/sysd lock command (loginctl lock-session)
@ -190,8 +217,10 @@
"$mod, 9, exec, ${pkgs.hyprlock}/bin/hyprlock"
"$mod, 0, exec, ${pkgs.wlogout}/bin/wlogout -b 5"
"$mod, n, exec, ${pkgs.swaynotificationcenter}/bin/swaync-client -t"
", Print, exec, ${pkgs.grim}/bin/grim -g \"\$(${pkgs.slurp}/slurp)\" ~/Pictures/Screenshots/$(date +'%Y-%m-%d_%H-%M-%S').png"
"CTRL, Print, exec, ${pkgs.grim}/bin/grim -g \"\$(${pkgs.slurp}/slurp)\" | wl-copy"
", Print, exec, ${screenshot}/bin/screenshot"
"CTRL, Print, exec, ${screenshot}/bin/screenshot --region"
"SHIFT, Print, exec, ${screenshot}/bin/screenshot --clip"
"CTRL SHIFT, Print, exec, ${screenshot}/bin/screenshot --region --clip"
]
++ (
# workspaces

View File

@ -1,4 +1,8 @@
{config, ...}: {
{
config,
lib,
...
}: {
programs.ranger = {
settings = {
preview_images = true;
@ -7,5 +11,50 @@
then "kitty"
else "ueberzug";
};
extraConfig = lib.strings.concatStringsSep "\n" [
"default_linemode devicons"
];
mappings = {
f = "console fzf_filter%space";
};
plugins =
[
{
name = "ranger_fzf_filter";
src = builtins.fetchGit {
url = "https://github.com/MuXiu1997/ranger-fzf-filter";
rev = "bf16de2e4ace415b685ff7c58306d0c5146f9f43";
};
}
{
name = "ranger_archives";
src = builtins.fetchGit {
url = "https://github.com/maximtrp/ranger-archives";
rev = "b4e136b24fdca7670e0c6105fb496e5df356ef25";
};
}
{
name = "ranger_devicons";
src = builtins.fetchGit {
url = "https://github.com/alexanderjeurissen/ranger_devicons";
rev = "f227f212e14996fbb366f945ec3ecaf5dc5f44b0";
};
}
]
++ (
if config.services.kdeconnect.enable
then
lib.lists.singleton
{
name = "ranger_kdeconnect.py";
src =
builtins.fetchGit {
url = "https://github.com/bwconrad/ranger-kdeconnect";
rev = "710c600bb894fed3e293f6518930c16a494dd154";
}
+ "/kdeconnect_send.py";
}
else []
);
};
}

View File

@ -7,16 +7,19 @@
killall
neofetch
nix-search-cli
nix-tree
nixpkgs-fmt
pass
poetry
python311Packages.radian
ranger
thefuck
unstable.mmtui
unzip
vim
w3m
wget
yt-dlp
zip
];
}

View File

@ -13,16 +13,18 @@ in {
nix-direnv.enable = true;
};
# fancy ls command
programs.lsd = {
enable = true;
enableAliases = true;
};
# Zsh
programs.zsh = {
enable = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
shellAliases = {
ll = "ls -l";
update = "sudo nixos-rebuild switch";
};
history.size = 10000;
history.path = "${config.xdg.dataHome}/zsh/history";
oh-my-zsh = {

View File

@ -32,18 +32,19 @@ in {
pkgs.docker
pkgs.docker-compose
pkgs.drawio
pkgs.feh
pkgs.ffmpeg
pkgs.firefox
pkgs.gimp
pkgs.git
pkgs.insomnia
pkgs.kicad
pkgs.krita
pkgs.libreoffice
pkgs.lutris
pkgs.mosquitto
pkgs.mpv
pkgs.mupdf
pkgs.nh
pkgs.nix-index
pkgs.nix-output-monitor
pkgs.obsidian
@ -53,7 +54,6 @@ in {
pkgs.ranger
pkgs.sops
pkgs.spotify
pkgs.unstable.nh
pkgs.vim
pkgs.vlc
pkgs.vscode

17
templates/rust/.envrc Normal file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
# ^ make editor happy
#
# Use https://direnv.net/ to automatically load the dev shell.
#
if ! has nix_direnv_version || ! nix_direnv_version 3.0.4; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.4/direnvrc" "sha256-DzlYZ33mWF/Gs8DDeyjr8mnVmQGx7ASYqA5WlxwvBG4="
fi
watch_file nix/**
watch_file -- **/*.nix
# Adding files to git includes them in a flake
# But it is also a bit much reloading.
# watch_file .git/index .git/HEAD
use flake . --show-trace

3
templates/rust/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.direnv/
target/
result/

11
templates/rust/Cargo.toml Normal file
View File

@ -0,0 +1,11 @@
[package]
name = "hello"
description = "A test rust binary"
publish = false
version = "0.1.0"
edition = "2021"
[[bin]]
name = "hello"
path = "src/main.rs"

61
templates/rust/flake.nix Normal file
View File

@ -0,0 +1,61 @@
{
description = "Rust-Hello";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
crate2nix = {
url = "github:nix-community/crate2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ {
crate2nix,
flake-utils,
nixpkgs,
rust-overlay,
...
}:
flake-utils.lib.eachDefaultSystem (
system: let
# Overlay pkgs with rust-bin
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {
inherit system overlays;
};
# Use rust-bin to generate the toolchain from rust-toolchain.toml
rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
buildRustCrateForPkgs = _:
pkgs.buildRustCrate.override {
rustc = rust-toolchain; # Use rustc from toolchain
cargo = rust-toolchain; # Use cargo from toolchain
};
# Cargo.nix for IFD
generatedCargoNix = crate2nix.tools.${system}.generatedCargoNix {
name = "rustnix";
src = ./.;
};
cargoNix = import generatedCargoNix {
inherit pkgs buildRustCrateForPkgs;
};
in {
packages = rec {
hello = cargoNix.rootCrate.build;
default = hello;
};
devShell = pkgs.mkShell {
buildInputs = [rust-toolchain];
};
}
);
}

View File

@ -0,0 +1,3 @@
[toolchain]
channel = "1.85.0"
components = [ "rustfmt", "rustc-dev", "rust-analyzer", "rust-src"]

View File

@ -0,0 +1,3 @@
fn main() {
println!("{}", "Hello, world!");
}