Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • jens/dotfiles
1 result
Show changes
Showing
with 160 additions and 120 deletions
youtube.com 600 IN CNAME .
*.youtube.com 600 IN CNAME .
twitch.tv 600 IN CNAME .
*.twitch.tv 600 IN CNAME .
reddit.com 600 IN CNAME .
*.reddit.com 600 IN CNAME .
news.ycombinator.com 600 IN CNAME .
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.queezle.distractionBlocker;
in {
options.queezle.distractionBlocker = {
enable = mkEnableOption "distraction blocker";
};
config = mkIf cfg.enable {
services.kresd = {
enable = true;
package = pkgs.knot-resolver.override { extraFeatures = true; };
listenPlain = [ "127.0.0.42:53" ];
extraConfig = ''
cache.size = 100*MB
-- Log DNSSEC validation failures
modules.load('bogus_log')
-- Refresh records that are about to expire and enable prediction prototype
modules.load('predict')
policy.add(policy.rpz(policy.REFUSE, '/run/blocklist.rpz', true))
policy.add(policy.all(policy.TLS_FORWARD({
{ '2606:4700:4700::1111', hostname='cloudflare-dns.com' },
{ '1.1.1.1', hostname='cloudflare-dns.com' },
})))
trust_anchors.set_insecure({
'gnome.org'
})
'';
};
systemd.services.distraction-blocker = {
wantedBy = [ "multi-user.target" ];
unitConfig = {
Description = "Install distraction blocklist";
};
serviceConfig = {
ExecStart = "${pkgs.coreutils}/bin/ln -f -s ${./blocklist.rpz} /run/blocklist.rpz";
ExecStop = "${pkgs.coreutils}/bin/ln -f -s ${pkgs.emptyFile} /run/blocklist.rpz";
RemainAfterExit = true;
};
};
};
}
{ config, lib, pkgs, ... }:
with lib;
let
etcDirName = "dotfiles/per-user";
in {
options.users.users = mkOption {
options = [{
dotfiles = {
base = mkOption {
type = types.path;
default = ../home-profiles;
description = ''
The `base` for the selected `profiles`.
If this `isStorePath`, the dotfiles will be linked
immutably, via `/etc/${etcDirName}/$USER` proxy to the Nix
store; so that removed dotfiles become broken symlinks in
the new system. Without this proxy, they would only become
broken after performing GC.
If not a store path (probably your `~/.dotfiles`), they
will be linked mutably and you can freely change them.
Since you’re modifying that mutable location, deleted
dotfiles will correctly become broken symlinks, as well.
All symlinking in the actual user’s home directory happens
in `/etc/profile` (when setting up the environment, on
each login, session etc.).
It is performed using `cp -srf $src $HOME` (more or
less). But prior to that, regular files, that would be
overwritten, are backed up.
'';
};
profiles = mkOption {
type = types.listOf types.str;
default = [];
description = ''
List of directory roots under `base`, files of which will
be indirectly (immutable `base`) or directly (mutable
`base`) symlinked to user’s home directory.
'';
};
};
}];
};
config = let
usersWithMutableDotfiles = filterAttrs (n: u:
length u.dotfiles.profiles != 0
&& !isStorePath "${u.dotfiles.base}"
) config.users.users;
usersWithImmutableDotfiles = filterAttrs (n: u:
length u.dotfiles.profiles != 0
&& isStorePath "${u.dotfiles.base}"
) config.users.users;
symlinkCmd = srcs: target: ''
# Let’s backup non-symlink files.
(
cd "${target}/"
find \
$( ${concatMapStringsSep " " (src: ''cd "${src}" ; find -not -type d ; '') srcs} ) \
-type f -exec mv -v {} {}.$(date -Ins) \;
) 2>/dev/null || true
# Display errors, but always return 0, since non-0 in `/profile` is rather problematic… in various ways.
cp --no-preserve=mode --remove-destination --symbolic-link --recursive \
${concatMapStringsSep " " (src: ''"${src}/."'') srcs} \
"${target}/" || true
'';
srcs = u: map (profile: "${u.dotfiles.base}/${profile}") u.dotfiles.profiles;
in {
environment.etc = mapAttrs' (n: u: {
name = "${etcDirName}/${n}";
value.source =
# Both `pkgs.buildEnv` and `pkgs.symlinkJoin` do slightly
# wrong things here. The user, within `srcs`, wants to be able
# to symlink to files potentially non-symlinked in
# `etcDirName`. Therefore we can’t resolve their symlinks
# prior to our linking, as both of these commands do. Let’s
# just blindly link to what the user supplies in `srcs`.
pkgs.runCommand "dotfiles-${n}" {} ''
mkdir -p $out
${symlinkCmd (srcs u) "$out"}
'';
}) usersWithImmutableDotfiles;
environment.extraInit = ''
(
umask 0077
if [ -e "/etc/${etcDirName}/$USER" ] ; then
${symlinkCmd ["/etc/${etcDirName}/$USER"] "$HOME"}
else
: # no-op in case of no mutable dotfiles
${concatMapStringsSep "\n" (u: ''
if [ "$USER" = "${u.name}" ] ; then
${symlinkCmd (srcs u) "$HOME"}
fi
'') (attrValues usersWithMutableDotfiles)}
fi
)
'';
};
}
......@@ -93,6 +93,7 @@ let
#epkgs.tree-sitter-langs
lsp-haskell
rustic
nix-mode
#zoom-frm # ; increase/decrease font size for all buffers %lt;C-x C-+>
]) ++ (with epkgs.elpaPackages; [
......@@ -267,6 +268,8 @@ let
(setq lsp-haskell-plugin-import-lens-code-lens-on nil)
(add-hook 'haskell-mode-hook #'lsp)
(keymap-global-set "<leader> h" #'lsp-ui-doc-show)
;; Known issue - enables code execution but is required for the `derive`-feature (e.g. used by matrix-sdk)
(setq lsp-rust-analyzer-proc-macro-enable t)
;;; helm
......
{ lib, pkgs, config, ... }:
with lib;
pkgs.writeText "git-config" ''
[user]
email = git@queezle.net
name = Jens Nolte
......@@ -14,6 +17,7 @@
g = !git graph
changes = "!f() { \
{ git --no-pager log --max-count=1 --shortstat --color=always ${1:-HEAD};\
echo; git --no-pager diff --color=always "${1:-HEAD}^" "${1:-HEAD}"; } \
{ git --no-pager log --max-count=1 --shortstat --color=always ''${1:-HEAD};\
echo; git --no-pager diff --color=always "''${1:-HEAD}^" "''${1:-HEAD}"; } \
| $PAGER -r; }; f"
''
inputs@{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.queezle.git;
in
{
options = {
queezle.git = {
enable = mkOption {
type = types.bool;
default = false;
};
user = mkOption {
type = types.str;
default = "jens";
};
};
};
config = mkIf cfg.enable {
home-manager.users."${cfg.user}".xdg.configFile."git/config".source =
import ./config.nix inputs;
};
}
......@@ -3,7 +3,7 @@ with lib;
let
cfg = config.queezle.sway;
temperature-bin = pkgs.writeScript "temperature.zsh" ''
#!/usr/bin/env zsh
#!${pkgs.zsh}/bin/zsh
echo -n $'🔥\uFE0E '
......@@ -16,6 +16,12 @@ let
exit 42
'';
toggle-microphone-mute = pkgs.writeScript "toggle-microphone-mute.zsh" ''
#!${pkgs.zsh}/bin/zsh
pamixer --default-source --toggle-mute
readonly ismuted=$(pamixer --default-source --get-mute || true)
busctl --user set-property net.sourceforge.mumble.mumble / net.sourceforge.mumble.Mumble mute b $ismuted
'';
in
pkgs.writeText "sway-config" ''
# sway config file
......@@ -199,7 +205,8 @@ bindsym --locked $mod+Ctrl+F12 exec $brightnessFull
# Toggle mumble mute
# TODO: merge with mumble config (requires sway config merging)
bindsym --locked Pause exec ~/.local/bin/mumble-toggle-mute
bindsym --locked Pause exec ${toggle-microphone-mute}
bindsym --locked XF86AudioMicMute exec ${toggle-microphone-mute}
# The middle button over a titlebar kills the window
bindsym button2 kill
......@@ -250,9 +257,7 @@ bindsym $mod+p exec project-launcher
#bindsym $mod+Shift+p exec terminal stack ghci --verbosity warning
# start a browser
bindsym $mod+b exec "chromium --enable-features=WebRTCPipeWireCapturer --force-dark-mode"
# Ozone might work only when $DISPLAY is not set
#bindsym $mod+b exec "chromium --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer --ozone-platform=wayland --force-dark-mode"
bindsym $mod+b exec "chromium --force-dark-mode --ozone-platform-hint=auto --enable-features=WebRTCPipeWireCapturer"
#bindsym $mod+Shift+b exec qutebrowser
# start htop
......@@ -382,6 +387,12 @@ bindsym $mod+Shift+r restart
bindsym $mod+Shift+e exec "swaymsg exit"
# resize window (you can also use the mouse for that)
bindsym $mod+Alt+ resize shrink width 10 px or 10 ppt
bindsym $mod+Alt+j resize shrink height 10 px or 10 ppt
bindsym $mod+Alt+k resize grow height 10 px or 10 ppt
bindsym $mod+Alt+l resize grow width 10 px or 10 ppt
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
......
{ lib, buildGoModule, fetchFromGitea, pkg-config, xorg, libglvnd }:
buildGoModule rec {
pname = "itd";
version = "unstable";
src = fetchFromGitea {
domain = "gitea.arsenm.dev";
owner = "Arsen6331";
repo = pname;
rev = "365414f951fab2ca378855beeef6a624a4158186";
sha256 = "sha256-Hosg8ftyxs7HFNrPRBVM8NTJBXMc65mXnrxNN8qyU7g=";
};
buildInputs = [ xorg.libX11 xorg.libXcursor xorg.libXrandr xorg.libXinerama xorg.libXi xorg.libXext xorg.libXxf86vm libglvnd ];
nativeBuildInputs = [ pkg-config ];
vendorSha256 = "sha256-wi8GIXPeAD3RRcNNJgULoeUt9fURsRBVbaizl++ux7Q=";
meta = with lib; {
homepage = "https://gitea.arsenm.dev/Arsen6331/itd";
description = "itd is a daemon that uses my infinitime library to interact with the PineTime snartwatch running InfiniTime.";
license = with licenses; [ gpl3 ];
};
}
{ lib, buildGoModule, fetchFromGitHub, alsa-lib }:
buildGoModule rec {
pname = "jellycli";
version = "0.9.1";
src = fetchFromGitHub {
owner = "tryffel";
repo = pname;
rev = "v${version}";
sha256 = "sha256-2su+4qR5R9Xb4yBnH5Sr52gte8d1fZhJOqqc4Gxnn6s=";
};
buildInputs = [ alsa-lib ];
vendorSha256 = "sha256-3tmNZd1FH1D/1w4gRmaul2epKb70phSUAjUBCbPV3Ak=";
# Test is missing config path? Disabled to get it to build but should be fixed before moving the packet to nixpkgs.
doCheck = false;
meta = with lib; {
homepage = "https://github.com/tryffel/jellycli";
description = "Jellyfin terminal client";
license = with licenses; [ gpl3 ];
};
}