1 Commits

Author SHA1 Message Date
68b8da0c8f WIP: xps16/btrfs: enable btrbk 2025-05-04 21:40:55 +02:00
182 changed files with 2750 additions and 4177 deletions

View File

@@ -1,6 +1,6 @@
keys:
- &gpg_h7x4 F7D37890228A907440E1FD4846B9228E814A2AAC
- &host_tsuki age1ue7uv559wf6tfjsutn9dsh07vpk53sgrfkdzqy4ltg6dnxcxeg7srx800u
- &host_tsuki age1c92j4w0gqh32hwssl5m2mfrggssxax9pge8qxwytv9lmrnfttcvqdrgsst
- &host_kasei age1eu2a6m3adakfzelfa9pqpl74a5dz0wkyr0v7gegm5ajnx7aqmqcqsp2ftc
- &host_dosei age1s6s4w7cdfgajm30z9gy8va8pvs2lrzk5gnsg0hmn5z2sl8z36seqej406r
- &host_xps16 age1np3fg9ue2tp4l47x7waapvjxh5zcaye2j54laapy7uklamve2c4qv3gytm

View File

@@ -1,6 +1,5 @@
[![built with nix](https://builtwithnix.org/badge.svg)](https://builtwithnix.org)
![works on my machine](https://img.shields.io/badge/status-works_on_my_machine-blue)
# Nix Dotfiles
@@ -16,7 +15,7 @@ Here are some of the interesting files and dirs:
| `/modules` | Custom nixos modules that I use in my own configuration. If you see options that does not appear in [NixOS Search][nixos-search], they might be defined here. |
| `/package-overrides` | Updated or pinned versions of packages that have not been upstreamed to nixpkgs (yet). |
| `/secrets` | Encrypted [sops-nix][sops-nix] secrets. |
| `flake.nix` | The root of everything. Defines the inputs and outputs of the project. Also applies misc overlays and adds config-wide modules. See [Nix Flakes][nix-flakes] for more information. |
| `flake.nix` | The root of everyting. Defines the inputs and outputs of the project. Also applies misc overlays and adds config-wide modules. See [Nix Flakes][nix-flakes] for more information. |
## Hosts
@@ -25,6 +24,7 @@ Here are some of the interesting files and dirs:
|------|--------------|---------|
| `Tsuki` | Dell Poweredge r710 server | Data storage / Build server / Selfhosted services. This server hosts a wide variety of services, including websites, matrix server, git repos, CI/CD and more. **This is probably the most interesting machine to pick config from** |
| `Kasei` | AMD Zen 2 CPU / AMD GPU - desktop computer | Semi-daily driver. This is my main computer at home. |
| `Dosei` | Dell Optiplex | Work computer, mostly used for development and testing. |
## home-manager configuration

162
flake.lock generated
View File

@@ -1,34 +1,36 @@
{
"nodes": {
"disko": {
"anyrun": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": [
"nixpkgs"
]
],
"systems": "systems"
},
"locked": {
"lastModified": 1768920986,
"narHash": "sha256-CNzzBsRhq7gg4BMBuTDObiWDH/rFYHEuDRVOwCcwXw4=",
"owner": "nix-community",
"repo": "disko",
"rev": "de5708739256238fb912c62f03988815db89ec9a",
"lastModified": 1743762088,
"narHash": "sha256-f+oXT9b3xuBDmm4v4nDqJvlHabxxZRB6+pay4Ub/NvA=",
"owner": "anyrun-org",
"repo": "anyrun",
"rev": "786f539d69d5abcefa68978dbaa964ac14536a00",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "v1.13.0",
"repo": "disko",
"owner": "anyrun-org",
"ref": "master",
"repo": "anyrun",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1747046372,
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
"lastModified": 1733328505,
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"type": "github"
},
"original": {
@@ -37,6 +39,45 @@
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"anyrun",
"nixpkgs"
]
},
"locked": {
"lastModified": 1743550720,
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@@ -44,16 +85,16 @@
]
},
"locked": {
"lastModified": 1769580047,
"narHash": "sha256-tNqCP/+2+peAXXQ2V8RwsBkenlfWMERb+Uy6xmevyhM=",
"lastModified": 1745557122,
"narHash": "sha256-eqSo9ugzsqhFgaDFYUZj943nurlX4L6f+AW0skJ4W+M=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "366d78c2856de6ab3411c15c1cb4fb4c2bf5c826",
"rev": "dd26f75fb4ec1c731d4b1396eaf4439ce40a91c1",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-25.11",
"ref": "release-24.11",
"repo": "home-manager",
"type": "github"
}
@@ -65,18 +106,18 @@
]
},
"locked": {
"lastModified": 1769430305,
"narHash": "sha256-ae92wLbdzLAFIHP3EigPCQzG4MSrxN4Nq4QQjQNqPvg=",
"ref": "main",
"rev": "45e302b9ff3835229cf9b76c62bceb11904725d8",
"revCount": 87,
"type": "git",
"url": "https://git.pvv.ntnu.no/oysteikt/nixos-matrix-modules"
"lastModified": 1735857245,
"narHash": "sha256-AKLLPrgXTxgzll3DqVUMa4QlPlRN3QceutgFBmEf8Nk=",
"owner": "dali99",
"repo": "nixos-matrix-modules",
"rev": "da9dc0479ffe22362793c87dc089035facf6ec4d",
"type": "github"
},
"original": {
"ref": "main",
"type": "git",
"url": "https://git.pvv.ntnu.no/oysteikt/nixos-matrix-modules"
"owner": "dali99",
"ref": "0.7.0",
"repo": "nixos-matrix-modules",
"type": "github"
}
},
"maunium-stickerpicker": {
@@ -120,17 +161,17 @@
"minecraft": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs-unstable"
],
"systems": "systems"
]
},
"locked": {
"lastModified": 1770000653,
"narHash": "sha256-QO/twGynxjOSUDtxbqJLshc/Q5/wImLH5O6KV2p9eoE=",
"lastModified": 1745805739,
"narHash": "sha256-ryJ95o+w0hSVm5LkW5dxTbL2e1HCHCPcpNh627D3KHU=",
"owner": "infinidoge",
"repo": "nix-minecraft",
"rev": "6a2ddb643aaf7949caa6158e718c5efc3dda7dc1",
"rev": "ea8fa40a5fbf2762c41efc913c03aed3587ec7fa",
"type": "github"
},
"original": {
@@ -142,11 +183,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1769302137,
"narHash": "sha256-QEDtctEkOsbx8nlFh4yqPEOtr4tif6KTqWwJ37IM2ds=",
"lastModified": 1745503349,
"narHash": "sha256-bUGjvaPVsOfQeTz9/rLTNLDyqbzhl0CQtJJlhFPhIYw=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "a351494b0e35fd7c0b7a1aae82f0afddf4907aa8",
"rev": "f7bee55a5e551bd8e7b5b82c9bc559bc50d868d1",
"type": "github"
},
"original": {
@@ -158,26 +199,26 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1769900590,
"narHash": "sha256-I7Lmgj3owOTBGuauy9FL6qdpeK2umDoe07lM4V+PnyA=",
"lastModified": 1745742390,
"narHash": "sha256-1rqa/XPSJqJg21BKWjzJZC7yU0l/YTVtjRi0RJmipus=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "41e216c0ca66c83b12ab7a98cc326b5db01db646",
"rev": "26245db0cb552047418cfcef9a25da91b222d6c7",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-25.11",
"ref": "nixos-24.11",
"type": "indirect"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1769983348,
"narHash": "sha256-mXYq4h7AFmbLMQtINwejLLL3DiW/ERJbg5UXqMTEV2M=",
"lastModified": 1745377448,
"narHash": "sha256-jhZDfXVKdD7TSEGgzFJQvEEZ2K65UMiqW5YJ2aIqxMA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "eb8d947de7b05897b2b5f4117d184f9c9846cd06",
"rev": "507b63021ada5fee621b6ca371c4fca9ca46f52c",
"type": "github"
},
"original": {
@@ -188,11 +229,11 @@
},
"nixpkgs-yet-unstabler": {
"locked": {
"lastModified": 1770025348,
"narHash": "sha256-nUJyE7QwmFQZ46YpgKdhkvacWnxiPVG0H1u96yTbnGI=",
"lastModified": 1745831704,
"narHash": "sha256-HMoKsZr3POMhCCIN1sFbPmYZ5ZBT/pCeyZnUXnJchdc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0b407490c176a5e0d0af9e105108e534e93bbeeb",
"rev": "7aa91c307d9af07d6900b337cecd02da067e8433",
"type": "github"
},
"original": {
@@ -209,11 +250,11 @@
]
},
"locked": {
"lastModified": 1742203788,
"narHash": "sha256-nRqyf+msCPEXvvXF6bvfiYH/B089dqWPc7ljRXieA7g=",
"lastModified": 1684092181,
"narHash": "sha256-Oi6G8Jx2RkEMi3UndtAnZw61hfgKGEe7l/ILdB9ump4=",
"ref": "refs/heads/master",
"rev": "c4e353e745b4012feb75dd1c4405a71f6318ed02",
"revCount": 51,
"rev": "028ed8774d1cf4650fc15253146cf14451eb608c",
"revCount": 43,
"type": "git",
"url": "file:///home/h7x4/git/osuchan-line-bot"
},
@@ -224,7 +265,7 @@
},
"root": {
"inputs": {
"disko": "disko",
"anyrun": "anyrun",
"home-manager": "home-manager",
"matrix-synapse-next": "matrix-synapse-next",
"maunium-stickerpicker": "maunium-stickerpicker",
@@ -244,11 +285,11 @@
]
},
"locked": {
"lastModified": 1769921679,
"narHash": "sha256-twBMKGQvaztZQxFxbZnkg7y/50BW9yjtCBWwdjtOZew=",
"lastModified": 1745310711,
"narHash": "sha256-ePyTpKEJTgX0gvgNQWd7tQYQ3glIkbqcW778RpHlqgA=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "1e89149dcfc229e7e2ae24a8030f124a31e4f24f",
"rev": "5e3e92b16d6fdf9923425a8d4df7496b2434f39c",
"type": "github"
},
"original": {
@@ -258,6 +299,21 @@
}
},
"systems": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",

107
flake.nix
View File

@@ -1,18 +1,11 @@
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-25.11";
# nixpkgs.url = "nixpkgs/nixos-unstable";
nixpkgs.url = "nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "nixpkgs/nixpkgs-unstable";
nixpkgs-yet-unstabler.url = "github:NixOS/nixpkgs/master";
home-manager = {
url = "github:nix-community/home-manager/release-25.11";
# url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
disko = {
url = "github:nix-community/disko/v1.13.0";
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
@@ -39,7 +32,12 @@
};
matrix-synapse-next = {
url = "git+https://git.pvv.ntnu.no/oysteikt/nixos-matrix-modules?ref=main";
url = "github:dali99/nixos-matrix-modules/0.7.0";
inputs.nixpkgs.follows = "nixpkgs";
};
anyrun = {
url = "github:anyrun-org/anyrun/master";
inputs.nixpkgs.follows = "nixpkgs";
};
};
@@ -50,7 +48,6 @@
nixpkgs-unstable,
nixpkgs-yet-unstabler,
home-manager,
disko,
nixos-hardware,
matrix-synapse-next,
@@ -58,7 +55,7 @@
minecraft,
osuchan,
sops-nix,
# anyrun,
anyrun,
}: let
system = "x86_64-linux";
@@ -66,18 +63,14 @@
inherit system;
config = {
allowUnfreePredicate = pkg: nixpkgs.lib.elem (nixpkgs.lib.getName pkg) [
"discord"
"geogebra"
"ipu6-camera-bins"
"ipu6-camera-bins-unstable"
"ivsc-firmware"
"ivsc-firmware-unstable"
];
allowUnfree = true;
android_sdk.accept_license = true;
segger-jlink.acceptLicense = true;
permittedInsecurePackages = [
"segger-jlink-qt4-810"
"segger-jlink-qt4-796s"
"dotnet-core-combined"
"dotnet-sdk-6.0.428"
"dotnet-sdk-wrapped-6.0.428"
];
};
@@ -151,17 +144,16 @@
nixosModules = {
machineVars = ./modules/machineVars.nix;
socketActivation = ./modules/socketActivation.nix;
duperemove = ./modules/duperemove.nix;
};
homeModules = {
cargo = ./home/modules/programs/cargo;
colors = ./home/modules/colors.nix;
direnv-auto-prune = ./home/modules/programs/direnv/auto-prune.nix;
downloads-sorter = ./home/modules/services/downloads-sorter.nix;
gpg = ./home/modules/programs/gpg;
mpd-auto-updater = ./home/modules/services/mpd.nix;
neovim-auto-clean-swapfiles = ./home/modules/programs/neovim/auto-clean-swapfiles.nix;
newsboat = ./home/modules/programs/newsboat;
nix-index-auto-update-database = ./home/modules/programs/nix-index/auto-update-database.nix;
prism-launcher = ./home/modules/programs/prism-launcher;
shellAliases = ./home/modules/shellAliases.nix;
@@ -192,55 +184,6 @@
};
};
};
pvv = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {
inherit inputs;
inherit unstable-pkgs;
inherit yet-unstabler-pkgs;
inherit (self) extendedLib;
machineName = "pvv-machine";
machineVars = {
headless = true;
# fixDisplayCommand = "echo 'not available'";
gaming = false;
development = true;
laptop = false;
battery = null;
wlanInterface = null;
wayland = false;
};
};
modules = [
./home/home.nix
./modules/machineVars.nix
inputs.sops-nix.homeManagerModules.sops
({ config, pkgs, lib, ... }: {
home = {
username = lib.mkForce "oysteikt";
homeDirectory = lib.mkForce "/home/pvv/d/oysteikt";
stateVersion = "25.05";
packages = [
# NOTE: nix on pvv machines is severely outdated
# putting it in the path of home-manager
# will ensure we use the new one by default
config.nix.package
];
};
nix.package = pkgs.nix;
nix.settings.use-xdg-base-directories = lib.mkForce false;
local.shell.aliases."Nix Stuff" = {
nxr = lib.mkForce "echo \"Local rebuilds are not available on this machine\"";
nxrl = lib.mkForce "echo \"Local rebuilds are not available on this machine\"";
};
})
] ++ (builtins.attrValues self.homeModules);
};
};
nixosConfigurations = let
@@ -284,6 +227,7 @@
sharedModules = [
inputs.sops-nix.homeManagerModules.sops
inputs.anyrun.homeManagerModules.default
] ++ (builtins.attrValues self.homeModules);
users.h7x4.imports = [
@@ -300,6 +244,18 @@
"specialArgs"
]));
in {
dosei = nixSys "dosei" {
modules = [
{
home-manager.users.h7x4.home.uid = 1000;
}
nixos-hardware.nixosModules.common-pc
nixos-hardware.nixosModules.common-pc-ssd
nixos-hardware.nixosModules.common-cpu-intel
nixos-hardware.nixosModules.common-gpu-intel
];
};
kasei = nixSys "kasei" {
modules = [
nixos-hardware.nixosModules.common-pc
@@ -316,17 +272,10 @@
nixos-hardware.nixosModules.common-pc-laptop-ssd
nixos-hardware.nixosModules.common-cpu-intel
nixos-hardware.nixosModules.common-gpu-intel
disko.nixosModules.default
];
};
tsuki = nixSys "tsuki" {
modules = [
nixos-hardware.nixosModules.common-cpu-amd
nixos-hardware.nixosModules.common-pc-ssd
disko.nixosModules.default
matrix-synapse-next.nixosModules.default
osuchan.outputs.nixosModules.default
maunium-stickerpicker.nixosModules.default

View File

@@ -1,192 +0,0 @@
{ config, lib, machineVars, ... }:
let
inherit (lib) mkForce mkIf optionals;
graphics = !machineVars.headless;
in
{
imports = [
./config/gtk.nix
./programs/nix.nix
./programs/ahoviewer.nix
./programs/alacritty.nix
./programs/anki.nix
./programs/anyrun
./programs/aria2.nix
./programs/atuin.nix
./programs/bash.nix
./programs/bat.nix
./programs/beets.nix
./programs/bottom.nix
./programs/cargo.nix
# ./programs/comma.nix
./programs/delta.nix
./programs/direnv
./programs/element-desktop.nix
./programs/emacs
./programs/eza.nix
./programs/fastfetch.nix
./programs/feh.nix
./programs/firefox.nix
./programs/fzf.nix
./programs/gdb.nix
./programs/gh-dash.nix
./programs/gh.nix
./programs/ghci.nix
./programs/git
./programs/gpg.nix
./programs/home-manager.nix
./programs/hyprland
./programs/jq.nix
./programs/less.nix
./programs/man.nix
./programs/meli.nix
./programs/mpv.nix
./programs/ncmpcpp.nix
./programs/neomutt.nix
./programs/neovim
./programs/newsboat
./programs/nix-index
./programs/nushell.nix
./programs/nyxt.nix
./programs/obs-studio.nix
./programs/obsidian.nix
./programs/pandoc.nix
./programs/prism-launcher.nix
./programs/python.nix
./programs/qutebrowser.nix
./programs/rclone.nix
./programs/ripgrep.nix
./programs/rofi
./programs/skim.nix
./programs/sqlite.nix
./programs/ssh
./programs/taskwarrior.nix
./programs/tealdeer
./programs/texlive.nix
./programs/thunderbird.nix
./programs/tmux
./programs/uv.nix
./programs/vscode
./programs/waybar.nix
./programs/yazi.nix
./programs/yt-dlp.nix
./programs/zathura.nix
./programs/zed
./programs/zoxide.nix
./programs/zsh
./services/copyq.nix
./services/dunst.nix
./services/fcitx5.nix
./services/gnome-keyring.nix
./services/mpd.nix
./services/mpris-proxy.nix
./services/network-manager.nix
./services/nix-channel-update.nix
./services/psd.nix
./services/pueue.nix
./services/tumblerd.nix
] ++ (optionals (!machineVars.wayland) [
./programs/xmonad
# ./programs/xmobar
./services/picom.nix
./services/polybar.nix
./services/screen-locker.nix
# ./services/stalonetray.nix
./services/sxhkd.nix
]);
programs.aria2.enable = true;
programs.atuin.enable = true;
programs.bash.enable = true;
programs.bat.enable = true;
programs.beets.enable = true;
programs.bottom.enable = true;
programs.cargo.enable = true;
# programs.comma.enable = true;
programs.direnv.enable = true;
programs.eza.enable = true;
programs.fastfetch.enable = true;
programs.fzf.enable = true;
programs.gdb.enable = true;
programs.gh-dash.enable = true;
programs.gh.enable = true;
programs.ghci.enable = true;
programs.git.enable = true;
programs.gpg.enable = true;
programs.helix.enable = true;
programs.home-manager.enable = true;
programs.jq.enable = true;
programs.less.enable = true;
programs.man.enable = true;
programs.meli.enable = true;
programs.neomutt.enable = true;
programs.neovim.enable = true;
programs.nix-index.enable = true;
programs.nushell.enable = true;
programs.pandoc.enable = true;
programs.python.enable = true;
programs.rclone.enable = true;
programs.ripgrep.enable = true;
programs.skim.enable = true;
programs.sqlite.enable = true;
programs.ssh.enable = true;
programs.tealdeer.enable = true;
programs.tmux.enable = true;
programs.uv.enable = true;
programs.yazi.enable = true;
programs.yt-dlp.enable = true;
programs.zoxide.enable = true;
programs.zsh.enable = true;
services.pueue.enable = true;
gtk.enable = graphics;
programs.ahoviewer.enable = graphics;
programs.alacritty.enable = graphics;
programs.anki.enable = graphics;
programs.chromium.enable = graphics;
programs.element-desktop.enable = graphics;
programs.emacs.enable = graphics;
programs.feh.enable = graphics;
programs.firefox.enable = graphics;
programs.mpv.enable = graphics;
programs.ncmpcpp.enable = graphics;
programs.newsboat.enable = graphics;
programs.nyxt.enable = graphics;
programs.obs-studio.enable = graphics;
programs.obsidian.enable = false;
programs.prism-launcher.enable = graphics;
programs.qutebrowser.enable = graphics;
programs.rofi.enable = graphics;
programs.taskwarrior.enable = graphics;
programs.texlive.enable = graphics;
programs.thunderbird.enable = graphics;
programs.vscode.enable = graphics;
programs.zathura.enable = graphics;
programs.zed-editor.enable = graphics;
services.copyq.enable = graphics;
services.dunst.enable = graphics;
services.gnome-keyring.enable = graphics;
services.kbfs.enable = graphics;
services.keybase.enable = graphics;
services.mpd.enable = graphics;
services.mpris-proxy.enable = graphics;
services.network-manager-applet.enable = graphics;
services.psd.enable = graphics;
services.tumblerd.enable = graphics;
i18n.inputMethod = mkIf graphics {
enable = true;
type = "fcitx5";
};
programs.anyrun.enable = machineVars.wayland;
programs.waybar.enable = machineVars.wayland;
wayland.windowManager.hyprland.enable = machineVars.wayland;
}

View File

@@ -1,129 +0,0 @@
{ config, lib, ... }:
let
cfg = config.services.downloads-sorter;
in
{
services.downloads-sorter = {
enable = true;
mappings = {
"archives" = [
"*.rar"
"*.zip"
"*.7z"
"*.tar"
"*.tar.bz2"
"*.tar.gz"
"*.tar.lz4"
"*.tar.lzma"
"*.tar.sz"
"*.tar.sz"
"*.tar.xz"
"*.tar.zst"
"*.tbz"
"*.tbz2"
"*.tgz"
"*.tlz4"
"*.tlzma"
"*.tsz"
"*.txz"
"*.tzst"
"*.bz2"
"*.gz"
"*.lz4"
"*.lzma"
"*.sz"
"*.sz"
"*.xz"
"*.zst"
];
"pictures" = {
createDirIfNotExists = false;
globs = [
"*.gif"
"*.jpeg"
"*.jpg"
"*.png"
"*.svg"
"*.webp"
];
};
"docs" = {
createDirIfNotExists = false;
globs = [
"*.md"
"*.pdf"
"*.PDF" # why do people do this
"*.docx"
"*.doc"
"*.xlsx"
"*.xls"
"*.ppt"
"*.pptx"
"*.odt"
"*.ods"
"*.odp"
"*.odg"
"*.odf"
];
};
"books" = {
createDirIfNotExists = false;
globs = [ "*.epub" ];
};
"videos" = {
createDirIfNotExists = false;
globs = [
"*.mp4"
"*.webm"
"*.mov"
];
};
"isos" = [
"*.iso"
"*.img"
];
"jars" = [ "*.jar" ];
"txt" = [ "*.txt" ];
"patches" = [
"*.patch"
"*.diff"
];
};
};
systemd.user.tmpfiles.settings."10-downloads-sorter-service" = let
inherit (cfg) downloadsDirectory;
inherit (config.xdg) userDirs;
symlink = link: target: {
"${link}".L = {
user = config.home.username;
mode = "0770";
argument = "${target}";
};
"${target}".d = {
user = config.home.username;
mode = "0770";
};
};
in lib.mkMerge [
(symlink "${downloadsDirectory}/books" "${userDirs.documents}/books/downloads")
(symlink "${downloadsDirectory}/docs" "${userDirs.documents}/downloads")
(symlink "${downloadsDirectory}/pictures" "${userDirs.pictures}/downloads")
(symlink "${downloadsDirectory}/videos" "${userDirs.videos}/downloads")
];
}

View File

@@ -1,46 +1,27 @@
{ config, ... }:
{
systemd.user.tmpfiles.settings."05-homedir" = let
home = config.home.homeDirectory;
user = config.home.username;
let
home = config.home.homeDirectory;
user = config.home.username;
in {
systemd.user.tmpfiles.rules = [
"d ${home}/SD - ${user} - - -"
"d ${home}/ctf - ${user} - - -"
"d ${home}/git - ${user} - - -"
"d ${home}/pvv - ${user} - - -"
"d ${home}/work - ${user} - - -"
defaultDirConf = {
d = {
inherit user;
mode = "0700";
};
};
"d ${home}/pictures/icons - ${user} - - -"
"d ${home}/pictures/photos - ${user} - - -"
"d ${home}/pictures/screenshots - ${user} - - -"
"d ${home}/pictures/stickers - ${user} - - -"
"d ${home}/pictures/wallpapers - ${user} - - -"
symlink = target: {
L = {
inherit user;
argument = target;
mode = "0600";
};
};
in {
"${home}/SD" = defaultDirConf;
"${home}/ctf" = defaultDirConf;
"${home}/git" = defaultDirConf;
"${home}/pvv" = defaultDirConf;
"${home}/tmp" = defaultDirConf;
"${home}/work" = defaultDirConf;
"d ${home}/documents/books - ${user} - - -"
"d ${home}/documents/scans - ${user} - - -"
"${home}/pictures/icons" = defaultDirConf;
"${home}/pictures/photos" = defaultDirConf;
"${home}/pictures/screenshots" = defaultDirConf;
"${home}/pictures/stickers" = defaultDirConf;
"${home}/pictures/wallpapers" = defaultDirConf;
"L ${home}/Downloads - ${user} - - ${home}/downloads"
"${home}/documents/books" = defaultDirConf;
"${home}/documents/manuals" = defaultDirConf;
"${home}/documents/music-sheets" = defaultDirConf;
"${home}/documents/scans" = defaultDirConf;
"${home}/documents/schematics" = defaultDirConf;
"${home}/Downloads" = symlink "${home}/downloads";
"${config.xdg.dataHome}/wallpapers" = symlink "${home}/pictures/wallpapers";
"${config.home.sessionVariables.TEXMFHOME}" = symlink "${home}/git/texmf";
};
"L ${config.xdg.dataHome}/wallpapers - ${user} - - ${home}/pictures/wallpapers"
"L ${config.home.sessionVariables.TEXMFHOME} - ${user} - - ${home}/git/texmf"
];
}

View File

@@ -1,6 +1,7 @@
{ pkgs, config, ... }:
{ pkgs, config, machineVars, ... }:
{
gtk = {
gtk = pkgs.lib.mkIf (!machineVars.headless) {
enable = true;
font.name = "Droid Sans";
iconTheme = {

View File

@@ -1,21 +1,16 @@
{ config, lib, ... }:
let
cfg = config.xdg.userDirs;
in
{
imports = [
./mimetypes.nix
./directory-spec-overrides.nix
];
xdg = {
enable = true;
userDirs = {
enable = true;
desktop = lib.mkDefault "${config.home.homeDirectory}/Desktop";
documents = lib.mkDefault "${config.home.homeDirectory}/documents";
download = lib.mkDefault "${config.home.homeDirectory}/downloads";
download = lib.mkDefault "${config.home.homeDirectory}/Downloads";
music = lib.mkDefault "${config.home.homeDirectory}/music";
pictures = lib.mkDefault "${config.home.homeDirectory}/pictures";
publicShare = lib.mkDefault "${config.home.homeDirectory}/public";
@@ -23,25 +18,4 @@ in
videos = lib.mkDefault "${config.home.homeDirectory}/videos";
};
};
home.sessionVariables.XDG_SCREENSHOTS_DIR = "${cfg.pictures}/screenshots";
systemd.user.tmpfiles.settings."05-xdg-userdirs" = let
dirCfg = {
d = {
user = config.home.username;
mode = "0700";
};
};
in {
"${cfg.desktop}" = dirCfg;
"${cfg.documents}" = dirCfg;
"${cfg.download}" = dirCfg;
"${cfg.music}" = dirCfg;
"${cfg.pictures}" = dirCfg;
"${cfg.publicShare}" = dirCfg;
"${cfg.templates}" = dirCfg;
"${cfg.videos}" = dirCfg;
"${config.home.sessionVariables.XDG_SCREENSHOTS_DIR}" = dirCfg;
};
}

View File

@@ -1,126 +0,0 @@
{ config, lib, pkgs, ... }:
let
cfg = config.accounts.email;
in
{
sops.secrets = {
"email/naniwtf/password" = { };
"email/kyoto-u/password" = { };
"email/pvv/password" = { };
};
accounts.email = {
maildirBasePath = "mail";
accounts = {
"naniwtf" = let
userName = "h7x4";
domain = "nani.wtf";
in {
primary = true;
userName = "${userName}@${domain}";
realName = "h7x4";
address = "${userName}@${domain}";
passwordCommand = "${lib.getExe' pkgs.coreutils "cat"} ${config.sops.secrets."email/naniwtf/password".path}";
imap = {
host = "redbull.mxrouting.net";
port = 993;
authentication = "plain";
tls.enable = true;
};
smtp = {
host = "redbull.mxrouting.net";
port = 465;
authentication = "plain";
tls.enable = true;
};
gpg = {
key = "46B9228E814A2AAC";
signByDefault = true;
};
neomutt.enable = true;
thunderbird.enable = true;
};
"pvv" = let
userName = "oysteikt";
domain = "pvv.ntnu.no";
in {
inherit userName;
realName = "Øystein K Tveit";
address = "${userName}@${domain}";
passwordCommand = "${lib.getExe' pkgs.coreutils "cat"} ${config.sops.secrets."email/pvv/password".path}";
imap = {
host = "imap.${domain}";
port = 993;
authentication = "plain";
tls.enable = true;
};
smtp = {
host = "redbull.mxrouting.net";
port = 587;
authentication = "plain";
tls = {
enable = true;
useStartTls = true;
};
};
gpg = {
key = "";
signByDefault = true;
};
neomutt.enable = true;
thunderbird.enable = true;
};
"kyoto-u" = let
userName = "oysteikt";
domain = "fos.kuis.kyoto-u.ac.jp";
in {
inherit userName;
realName = "";
address = "${userName}@${domain}";
passwordCommand = "${lib.getExe' pkgs.coreutils "cat"} ${config.sops.secrets."email/kyoto-u/password".path}";
imap = {
host = "io.kuis.kyoto-u.ac.jp";
port = 993;
authentication = "plain";
tls.enable = true;
};
smtp = {
host = "io.kuis.kyoto-u.ac.jp";
port = 587;
authentication = "plain";
tls = {
enable = true;
useStartTls = true;
};
};
# gpg = {
# };
neomutt.enable = true;
thunderbird.enable = true;
};
};
};
systemd.user.tmpfiles.settings."10-maildir" = lib.mkIf (lib.any (acct: acct.enable) (lib.attrValues cfg.accounts)) {
"${config.home.homeDirectory}/${cfg.maildirBasePath}".d = {
mode = "0700";
user = config.home.username;
};
};
}

View File

@@ -3,15 +3,96 @@
graphics = !machineVars.headless;
in {
imports = [
./breakerbox.nix
./email.nix
./packages.nix
./shell.nix
./packages.nix
./config/xdg
./config/ensure-homedir-structure.nix
./config/downloads-sorter.nix
];
./programs/aria2.nix
./programs/atuin.nix
./programs/bash.nix
./programs/bat.nix
./programs/beets.nix
./programs/bottom.nix
./programs/cargo.nix
./programs/comma.nix
./programs/direnv
./programs/eza.nix
./programs/fzf.nix
./programs/gdb.nix
./programs/gh-dash.nix
./programs/gh.nix
./programs/git
./programs/gpg.nix
./programs/home-manager.nix
./programs/jq.nix
./programs/less.nix
./programs/man.nix
./programs/neovim
./programs/nix-index
./programs/nix.nix
./programs/nushell.nix
./programs/pandoc.nix
./programs/python.nix
./programs/ripgrep.nix
./programs/skim.nix
./programs/sqlite.nix
./programs/ssh
./programs/tealdeer
./programs/texlive.nix
./programs/thunderbird.nix
./programs/tmux
./programs/uv.nix
./programs/yt-dlp.nix
./programs/zoxide.nix
./programs/zsh
./services/nix-channel-update.nix
./services/pueue.nix
] ++ (optionals graphics [
./config/gtk.nix
./programs/alacritty.nix
./programs/emacs
./programs/feh.nix
./programs/firefox.nix
./programs/mpv.nix
./programs/ncmpcpp.nix
./programs/newsboat
./programs/obs-studio.nix
./programs/prism-launcher.nix
./programs/qutebrowser.nix
./programs/rofi
./programs/taskwarrior.nix
./programs/vscode
./programs/zathura.nix
./programs/zed
./services/copyq.nix
./services/dunst.nix
./services/fcitx5.nix
./services/gnome-keyring.nix
./services/keybase.nix
./services/mpd.nix
./services/mpris-proxy.nix
./services/network-manager.nix
./services/psd.nix
./services/tumblerd.nix
]) ++ (optionals machineVars.wayland [
./programs/hyprland.nix
./programs/waybar.nix
./programs/anyrun
]) ++ (optionals (!machineVars.wayland) [
./programs/xmonad
# ./programs/xmobar
./services/picom.nix
./services/polybar.nix
./services/screen-locker.nix
# ./services/stalonetray.nix
./services/sxhkd.nix
]);
sops.defaultSopsFile = ../secrets/home.yaml;
sops.age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/id_ed25519_home_sops" ];
@@ -34,7 +115,8 @@ in {
package = pkgs.capitaine-cursors;
name = "capitaine-cursors";
size = 16;
dotIcons.enable = false;
# TODO: enable in 25.05
# dotIcons = false;
};
keyboard.options = [ "caps:escape" ];
@@ -54,8 +136,14 @@ in {
xsession = {
enable = !machineVars.wayland;
# TODO: declare using xdg config home
scriptPath = "${config.xdg.configHome}/X11/xsession";
profilePath = "${config.xdg.configHome}/X11/xprofile";
scriptPath = ".config/X11/xsession";
profilePath = ".config/X11/xprofile";
};
xdg.configFile = {
"ghc/ghci.conf".text = ''
:set prompt "${extendedLib.termColors.front.magenta "[GHCi]λ"} "
'';
};
news.display = "silent";

View File

@@ -25,7 +25,6 @@ in
Service = {
Type = "oneshot";
Slice = "background.slice";
CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle";
ExecStart = "${lib.getExe cfg.package} prune";

View File

@@ -32,7 +32,6 @@ in
Service = {
Type = "oneshot";
Slice = "background.slice";
CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle";
ExecStart = "${lib.getExe cfg.package} --refresh-keys";

View File

@@ -32,7 +32,6 @@ in
Service = {
Type = "oneshot";
Slice = "background.slice";
CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle";
ExecStart = "${lib.getExe cfg.package} --update-trustdb";

View File

@@ -31,7 +31,6 @@ in
Service = {
Type = "oneshot";
Slice = "background.slice";
CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle";
ExecStart = lib.getExe (pkgs.writeShellApplication {

View File

@@ -0,0 +1,6 @@
{
imports = [
./vacuum.nix
./fetch-articles.nix
];
}

View File

@@ -0,0 +1,53 @@
{ config, pkgs, lib, ... }:
let
cfg = config.programs.newsboat;
package = pkgs.newsboat;
in
{
options.programs.newsboat.fetch-articles = {
enable = lib.mkEnableOption "automatic article fetcher for newsboat";
onCalendar = lib.mkOption {
type = lib.types.str;
default = "daily";
example = "weekly";
# TODO: link to systemd manpage for format.
description = "How often to fetch new articles.";
};
};
config = lib.mkIf cfg.fetch-articles.enable {
# TODO: wait for internet
systemd.user.services.newsboat-fetch-articles = {
Unit = {
Description = "Automatically fetch new articles for newsboat";
Documentation = [ "man:newsboat(1)" ];
};
Service = {
Type = "oneshot";
CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle";
ExecStart = "${lib.getExe pkgs.flock} %t/newsboat.lock ${lib.getExe package} --execute=reload";
};
};
systemd.user.timers.newsboat-fetch-articles = {
Unit = {
Description = "Automatically fetch new articles for newsboat";
Documentation = [ "man:newsboat(1)" ];
After = [ "network.target" ];
};
Timer = {
Unit = "newsboat-fetch-articles.service";
OnCalendar = cfg.fetch-articles.onCalendar;
Persistent = true;
};
Install = {
WantedBy = [ "timers.target" ];
};
};
};
}

View File

@@ -0,0 +1,51 @@
{ config, pkgs, lib, ... }:
let
cfg = config.programs.newsboat;
package = pkgs.newsboat;
in
{
options.programs.newsboat.vacuum = {
enable = lib.mkEnableOption "automatic cleaning of the newsboat cache";
onCalendar = lib.mkOption {
type = lib.types.str;
default = "weekly";
example = "monthly";
# TODO: link to systemd manpage for format.
description = "How often to run the cleaning.";
};
};
config = lib.mkIf cfg.vacuum.enable {
systemd.user.services.newsboat-vacuum = {
Unit = {
Description = "Automatically clean newsboat cache";
Documentation = [ "man:newsboat(1)" ];
};
Service = {
Type = "oneshot";
CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle";
ExecStart = "${lib.getExe pkgs.flock} %t/newsboat.lock ${lib.getExe package} --vacuum";
};
};
systemd.user.timers.newsboat-vacuum = {
Unit = {
Description = "Automatically clean newsboat cache";
Documentation = [ "man:newsboat(1)" ];
};
Timer = {
Unit = "newsboat-vacuum.service";
OnCalendar = cfg.vacuum.onCalendar;
Persistent = true;
};
Install = {
WantedBy = [ "timers.target" ];
};
};
};
}

View File

@@ -44,7 +44,6 @@ in
Service = {
Type = "oneshot";
Slice = "background.slice";
ExecStart = lib.getExe (pkgs.writeShellApplication {
name = "fetch-nix-index-database";
runtimeInputs = with pkgs; [

View File

@@ -3,10 +3,6 @@ let
cfg = config.programs.prism-launcher;
in
{
imports = [
../../systemd-tmpfiles.nix
];
options.programs.prism-launcher = {
enable = lib.mkEnableOption "PrismLauncher, an open source minecraft launcher";
@@ -61,7 +57,6 @@ in
Unit.Description = "Watchdog that moves screenshots from all prismlauncher minecraft instances into a common dir";
Service = {
Type = "oneshot";
Slice = "background.slice";
ExecStart = lib.getExe (pkgs.writeShellApplication {
name = "prismlauncher-move-minecraft-screenshots.sh";
runtimeInputs = with pkgs; [ coreutils findutils ];
@@ -101,10 +96,8 @@ in
};
};
systemd.user.tmpfiles.settings."10-prismlauncher" = lib.mkIf cfg.screenshotMover.enable {
${cfg.screenshotMover.screenshotDir}.d = {
user = config.home.username;
};
};
systemd.user.tmpfiles.rules = lib.mkIf cfg.screenshotMover.enable [
"'d' '${cfg.screenshotMover.screenshotDir}' - ${config.home.username} - - -"
];
};
}

View File

@@ -1,160 +1,5 @@
{ config, lib, pkgs, ... }:
let
cfg = config.services.downloads-sorter;
in
{ ... }:
{
imports = [
../systemd-tmpfiles.nix
];
options.services.downloads-sorter = {
enable = lib.mkEnableOption "downloads sorter units, path activated units to keep the download dir clean";
downloadsDirectory = lib.mkOption {
type = lib.types.path;
description = "Which directory to keep clean";
default = if config.xdg.userDirs.enable then config.xdg.userDirs.download else "${config.home.homeDirectory}/Downloads";
defaultText = ''
if config.xdg.userDirs.enable then config.xdg.userDirs.download else "''${config.home.homeDirectory}/Downloads"
'';
example = ''
"''${config.home.homeDirectory}/downloads"
'';
};
mappings = lib.mkOption {
type = let
mappingType = lib.types.submodule ({ name, ... }: {
options = {
unitName = lib.mkOption {
type = lib.types.str;
description = ''
The basename of the path/service unit responsible for this mapping
'';
default = "downloads-sorter@${name}";
example = "downloads-sorter@asdf";
};
dir = lib.mkOption {
type = lib.types.path;
description = ''
Absolute path to the directory where matching files should be moved.
'';
default = if builtins.substring 0 1 name == "/" then name else "${cfg.downloadsDirectory}/${name}";
defaultText = ''
if builtins.substring 0 1 name == "/" then name else "''${config.services.downloads-sorter.downloadsDirectory}/''${name}"
'';
};
globs = lib.mkOption {
type = with lib.types; listOf str;
description = ''
A list of globs that match the files that should be moved.
'';
example = [
"*.jpg"
"IMG_*_2020_*.png"
];
apply = map (g: "${cfg.downloadsDirectory}/${g}");
};
createDirIfNotExists = lib.mkOption {
type = lib.types.bool;
description = ''
Whether to create the target directory if it does not exist yet.
Turn this off if you'd like the target directory to be a symlink or similar.
'';
default = true;
example = false;
};
# TODO: allow specifying a dynamic filter together with a system path trigger in an attrset.
};
});
in with lib.types; attrsOf (coercedTo (listOf str) (globs: { inherit globs; }) mappingType);
description = ''
A mapping from a file pattern to the location where it should be moved.
By default, the output mapping is relative to the download dir.
If an absolute path is given, the sorter will move the files out of the downloads dir.
'';
default = { };
example = {
"pictures" = [
"*.png"
"*.jpg"
];
"documents" = {
createDirIfNotExists = false;
globs = [ "*.pdf" ];
};
"/home/<user>/archives" = [ "*.rar" ];
};
};
};
config = lib.mkIf cfg.enable {
systemd.user.paths = lib.mapAttrs' (dir: mapping: {
name = mapping.unitName;
value = {
Install.WantedBy = [ "paths.target" ];
Path = {
PathExistsGlob = mapping.globs;
Unit = "${mapping.unitName}.service";
TriggerLimitIntervalSec = "1s";
TriggerLimitBurst = "1";
};
};
}) cfg.mappings;
# TODO: deduplicate
systemd.user.services = lib.mapAttrs' (dir: mapping: {
name = mapping.unitName;
value = {
Unit.Description = "Downloads directory watchdog, sorts the downloads directory";
Service = {
Type = "oneshot";
Slice = "background.slice";
SyslogIdentifier = mapping.unitName;
ExecStart = let
script = pkgs.writeShellApplication {
name = "downloads-sorter-${dir}.sh";
runtimeInputs = [ pkgs.coreutils ];
text = ''
shopt -s nullglob
FILES=(${builtins.concatStringsSep " " mapping.globs})
for file in "''${FILES[@]}"; do
echo "$file -> ${mapping.dir}"
mv "$file" '${mapping.dir}'
done
'';
};
in lib.getExe script;
PrivateUsers = true;
ProtectSystem = true;
NoNewPrivileges = true;
ProtectKernelTunables = true;
ProtectControlGroups = true;
PrivateNetwork = true;
RestrictNamespaces = true;
};
};
}) cfg.mappings;
systemd.user.tmpfiles.settings."10-downloads-sorter-service" = let
absolutePaths = lib.pipe cfg.mappings [
builtins.attrValues
(builtins.filter (m: m.createDirIfNotExists))
(map (m: m.dir))
];
in lib.genAttrs absolutePaths (_: {
d = {
user = config.home.username;
};
});
};
# TODO: create abstraction over `systemd.path` thingy that looks at incoming files and
# sorts them into subdirs by extension.
}

View File

@@ -36,8 +36,7 @@ in
};
Service = {
Type = "oneshot";
Slice = "background.slice";
ExecStart = "${lib.getExe pkgs.mpc} update --wait";
ExecStart = "${lib.getExe pkgs.mpc-cli} update --wait";
PrivateUsers = true;
ProtectSystem = true;

View File

@@ -25,7 +25,7 @@
};
};
isAlias = v: builtins.isAttrs v && v ? alias;
isAlias = v: builtins.isAttrs v && v ? "alias" && v ? "type";
};
in {
lib = formatLib;
@@ -47,29 +47,6 @@
"grep nix"
];
};
shells = lib.mkOption {
description = "List of shells for which the alias is valid.";
type = with lib.types; listOf (enum [
"bash"
"zsh"
"fish"
"nushell"
]);
default = [
"bash"
"zsh"
"fish"
"nushell"
];
example = [
"bash"
"zsh"
];
};
# TODO:
# subshell = lib.mkEnableOption "" // {
# description = "Whether to run the aliased command in a subshell";
# };
};
};
@@ -78,36 +55,49 @@
type = " ";
alias = [ str ];
};
in addCheck (coercedTo str coerce rawAliasType) (v: builtins.isString v || formatLib.isAlias v);
aliasTreeType = with lib.types; attrsOf (either coercedAliasType aliasTreeType) // {
description = "Alias tree";
in (coercedTo str coerce rawAliasType) // {
check = v: builtins.isString v || formatLib.isAlias v;
};
aliasTreeType = with lib.types; attrsOf (either coercedAliasType aliasTreeType);
in aliasTreeType;
# Alias Tree -> String -> { :: Alias }
generateAttrs = shell: let
generateAttrs' = attrset: lib.pipe attrset [
(attrset: {
right = lib.filterAttrs (_: v: formatLib.isAlias v) attrset;
wrong = lib.filterAttrs (_: v: !(formatLib.isAlias v)) attrset;
})
({ right, wrong }:
# Leaf nodes
(lib.pipe right [
(lib.filterAttrs (_: v: lib.elem shell v.shells))
(builtins.mapAttrs (_: v: formatLib.functors.${v.type}.apply v))
])
//
# Subsets
(lib.pipe wrong [
builtins.attrValues
(map generateAttrs')
(lib.foldr (a: b: a // b) { })
])
)
];
in generateAttrs';
# Alias Tree -> { :: Alias }
generateAttrs = let
inherit (lib) mapAttrs attrValues filterAttrs isAttrs
isString concatStringsSep foldr;
applyFunctor = attrset: formatLib.functors.${attrset.type}.apply attrset;
# TODO: better naming
allAttrValuesAreStrings = attrset: let
# [ {String} ]
filteredAliases = [(filterAttrs (_: isString) attrset)];
# [ {String} ]
remainingFunctors = let
functorSet = filterAttrs (_: formatLib.isAlias) attrset;
appliedFunctorSet = mapAttrs (_: applyFunctor) functorSet;
in [ appliedFunctorSet ];
# [ {AttrSet} ]
remainingAliasSets = attrValues (filterAttrs (_: v: isAttrs v && !formatLib.isAlias v) attrset);
# [ {String} ]
recursedAliasSets = filteredAliases
++ (remainingFunctors)
++ (map allAttrValuesAreStrings remainingAliasSets);
in foldr (a: b: a // b) {} recursedAliasSets;
in
allAttrValuesAreStrings;
# TODO:
# generateAttrs = pipe [
# collect leave nodes
# map apply functor
# ]
# Alias Tree -> String
generateText = aliases: let
@@ -253,20 +243,20 @@ in {
programs = {
zsh = {
shellAliases = shellAliasesFormat.generateAttrs "zsh" cfg.aliases;
shellAliases = shellAliasesFormat.generateAttrs cfg.aliases;
sessionVariables = cfg.variables;
};
bash = {
shellAliases = shellAliasesFormat.generateAttrs "bash" cfg.aliases;
shellAliases = shellAliasesFormat.generateAttrs cfg.aliases;
sessionVariables = cfg.variables;
};
fish = {
shellAliases = shellAliasesFormat.generateAttrs "fish" cfg.aliases;
shellAliases = shellAliasesFormat.generateAttrs cfg.aliases;
# TODO: fish does not support session variables?
# localVariables = cfg.variables;
};
nushell = {
shellAliases = shellAliasesFormat.generateAttrs "nushell" cfg.aliases;
shellAliases = shellAliasesFormat.generateAttrs cfg.aliases;
environmentVariables = cfg.variables;
};
};

View File

@@ -1,4 +1,4 @@
{ pkgs, yet-unstabler-pkgs, config, machineVars, machineName, ... }:
{ pkgs, config, machineVars, machineName, ... }:
{
home.packages = with pkgs; [
bandwhich
@@ -7,7 +7,7 @@
cyme
czkawka
difftastic
# diskonaut
diskonaut
duf
duff
fclones
@@ -35,9 +35,11 @@
lurk
mdcat
mediainfo
meli
mkvtoolnix
mmv
mtr
neofetch
nix-diff
nix-output-monitor
nix-tree
@@ -50,11 +52,13 @@
pipr
progress
pwntools
rclone
rip2
rnr
rsync
# sc-im
# slack-term
skim
slack-term
tea
terminal-parrot
termtosvg
@@ -83,17 +87,21 @@
xorg.xprop
] ++ (
lib.optionals (!machineVars.headless) [
ahoviewer
alsa-utils
kdePackages.ark
anki
ark
calibre
cool-retro-term
darktable
yet-unstabler-pkgs.discord
discord
element-desktop
foliate
geogebra
ghidra
gimp3-with-plugins
gimp
gnome-font-viewer
google-chrome
imhex
imv
inkscape
@@ -102,26 +110,26 @@
kid3
koreader
krita
# kdePackages.ktouch
ktouch
libnotify
libreoffice
light
mission-center
# mopidy
# mopidy-mpd
# mopidy-soundcloud
# mopidy-youtube
mpc
mumble
mopidy
mopidy-mpd
mopidy-soundcloud
mopidy-youtube
mpc_cli
naps2
nsxiv
pcloud
nyxt
obsidian
pdfarranger
pwvucontrol
# scrcpy
seahorse
shellcheck
# slack
slack
# sublime3
# swiPrologWithGui
tagainijisho
@@ -150,12 +158,16 @@
touchegg
] ++ lib.optionals (machineVars.gaming) [
desmume
# osu-lazer
# retroarchFull
# steam
# steam-tui
osu-lazer
retroarchFull
steam
steam-tui
stepmania
# taisei
taisei
] ++ lib.optionals (machineName != "dosei") [
# Source blocked by external firewall on dosei
pcloud
]
);
}

View File

@@ -1,4 +0,0 @@
{ ... }:
{
programs.ahoviewer = { };
}

View File

@@ -1,6 +1,7 @@
{ pkgs, lib, config, ... }:
{
programs.alacritty = {
enable = true;
settings = {
window = {
padding = { x = 15; y = 15; };
@@ -17,16 +18,6 @@
size = 12.0;
};
keyboard.bindings = [
# NOTE: Allows for Ctrl+A Super+Z to work as Ctrl+A Alt+Z in tmux,
# very nice for a keyboard with Alt and Super switched.
{
key = "z";
mods = "Super";
chars = "\\u001bz";
}
];
colors =
let
inherit (lib.attrsets) getAttrs filterAttrs;

View File

@@ -1,4 +0,0 @@
{ ... }:
{
programs.anki = { };
}

View File

@@ -1,18 +1,20 @@
{ pkgs, lib, ... }:
{ pkgs, lib, inputs, ... }:
{
programs.anyrun = {
enable = true;
config = {
y.fraction = 0.3;
width.fraction = 0.25;
plugins = [
"${pkgs.anyrun}/lib/libapplications.so"
inputs.anyrun.packages.${pkgs.system}.applications
];
hidePluginInfo = true;
closeOnClick = true;
showResultsImmediately = true;
};
extraCss = builtins.readFile ./style.css;
extraCss = builtins.readFile (./. + "/style.css");
extraConfigFiles."applications.ron".text = let
preprocess_script = pkgs.writeShellApplication {
@@ -28,10 +30,7 @@
desktop_actions: false,
max_entries: 10,
preprocess_exec_script: Some("${lib.getExe preprocess_script}"),
terminal: Some(Terminal(
command: "${lib.getExe pkgs.alacritty}",
args: "-e {}",
)),
terminal: Some("${lib.getExe pkgs.alacritty}"),
)
'';
};

View File

@@ -1,76 +1,48 @@
@define-color accent #5599d2;
@define-color bg-color #161616;
@define-color fg-color #eeeeee;
@define-color desc-color #cccccc;
* {
all: unset;
font-size: 1.2rem;
}
window {
#window,
#match,
#entry,
#plugin,
#main {
background: transparent;
}
box.main {
padding: 5px;
margin: 10px;
border-radius: 10px;
border: 2px solid @accent;
background-color: @bg-color;
box-shadow: 0 0 5px black;
#match.activatable {
border-radius: 8px;
margin: 4px 0;
padding: 4px;
/* transition: 100ms ease-out; */
}
#match.activatable:first-child {
margin-top: 12px;
}
#match.activatable:last-child {
margin-bottom: 0;
}
text {
min-height: 30px;
padding: 5px;
border-radius: 5px;
color: @fg-color;
#match:hover {
background: rgba(255, 255, 255, 0.05);
}
#match:selected {
background: rgba(255, 255, 255, 0.1);
}
.matches {
background-color: rgba(0, 0, 0, 0);
border-radius: 10px;
#entry {
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 8px;
padding: 4px 8px;
}
box.plugin:first-child {
margin-top: 5px;
}
box.plugin.info {
min-width: 200px;
}
list.plugin {
background-color: rgba(0, 0, 0, 0);
}
label.match {
color: @fg-color;
}
label.match.description {
font-size: 10px;
color: @desc-color;
}
label.plugin.info {
font-size: 14px;
color: @fg-color;
}
.match {
background: transparent;
}
.match:selected {
border-left: 4px solid @accent;
background: transparent;
animation: fade 0.1s linear;
}
@keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
box#main {
background: rgba(0, 0, 0, 0.5);
box-shadow:
inset 0 0 0 1px rgba(255, 255, 255, 0.1),
0 30px 30px 15px rgba(0, 0, 0, 0.5);
border-radius: 20px;
padding: 12px;
}

View File

@@ -1,4 +1,4 @@
{ ... }:
{
programs.aria2 = { };
}
programs.aria2.enable = true;
}

View File

@@ -1,10 +1,11 @@
{ config, lib, ... }:
{ config, ... }:
let
cfg = config.programs.atuin;
xdg_runtime_dir = "/run/user/${toString config.home.uid}";
in
lib.mkIf cfg.enable {
{
programs.atuin = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
enableNushellIntegration = config.programs.nushell.enable;

View File

@@ -1,9 +1,7 @@
{ config, lib, ... }:
let
cfg = config.programs.bash;
in
{ config, ... }:
{
programs.bash = {
enable = true;
historyFile = "${config.xdg.dataHome}/bash_history";
historySize = 100000;
bashrcExtra = ''

View File

@@ -1,4 +1,4 @@
{ ... }:
{
programs.bat = { };
}
programs.bat.enable = true;
}

View File

@@ -1,4 +1,4 @@
{ ... }:
{
programs.beets = { };
programs.beets.enable = true;
}

View File

@@ -1,9 +1,7 @@
{ config, lib, ... }:
let
cfg = config.programs.bottom;
in
{ ... }:
{
programs.bottom = {
enable = true;
settings = {
flags.enable_gpu = true;

View File

@@ -1,10 +1,10 @@
{ pkgs, lib, ... }:
{
"amazondotcom-us".metaData.hidden = true;
"bing".metaData.hidden = true;
"wikipedia".metaData.hidden = true;
"google".metaData.alias = "gg";
"ddg".metaData.alias = "dd";
"Amazon.com".metaData.hidden = true;
"Bing".metaData.hidden = true;
"Wikipedia (en)".metaData.hidden = true;
"Google".metaData.alias = "gg";
"DuckDuckGo".metaData.alias = "dd";
"Arch Package Repository" = {
urls = [{
@@ -95,14 +95,6 @@
definedAliases = [ "hg" ];
};
"Kagi" = {
urls = [{
template = "https://kagi.com/search";
params = [{ name = "q"; value = "{searchTerms}"; }];
}];
definedAliases = "k";
};
"Melpa" = {
urls = [{
template = "https://melpa.org/";
@@ -174,7 +166,7 @@
definedAliases = [ "ut" ];
};
"youtube" = {
"YouTube" = {
urls = [{
template = "https://www.youtube.com/results";
params = [{ name = "search_query"; value = "{searchTerms}"; }];

View File

@@ -1,9 +1,7 @@
{ config, lib, ... }:
let
cfg = config.programs.cargo;
in
lib.mkIf cfg.enable {
{ ... }:
{
programs.cargo = {
enable = true;
settings = {
cargo-new.vcs = "git";
};

View File

@@ -1,11 +0,0 @@
{ ... }:
{
programs.delta = {
enableGitIntegration = true;
options = {
line-numbers = true;
side-by-side = true;
theme = "Monokai Extended Origin";
};
};
}

View File

@@ -1,9 +1,7 @@
{ config, lib, ... }:
let
cfg = config.programs.direnv;
in
{ config, ... }:
{
programs.direnv = {
enable = true;
silent = true;
nix-direnv.enable = true;

View File

@@ -1,4 +0,0 @@
{ ... }:
{
programs.element-desktop = { };
}

View File

@@ -1,6 +1,4 @@
{ config, lib, pkgs, ... }:
let
cfg = config.programs.emacs;
{ pkgs, ... }: let
configEl = pkgs.stdenv.mkDerivation {
name = "config.el";
@@ -16,11 +14,11 @@ let
'';
};
in
lib.mkIf cfg.enable {
in {
xdg.configFile."emacs/init.el".source = configEl.outPath;
programs.emacs = {
enable = true;
extraPackages = epkgs: with epkgs; [
# # package
use-package

View File

@@ -1,9 +1,7 @@
{ config, lib, ... }:
let
cfg = config.programs.eza;
in
{ config, ... }:
{
programs.eza = {
enable = true;
icons = "auto";
enableNushellIntegration = config.programs.nushell.enable;
};

View File

@@ -1,4 +0,0 @@
{ ... }:
{
programs.fastfetch = { };
}

View File

@@ -1,4 +1,4 @@
{ ... }:
{ machineVars, ... }:
{
programs.feh = { };
}
programs.feh.enable = !machineVars.headless;
}

View File

@@ -1,17 +1,15 @@
{ lib, pkgs, ... }:
{
programs.firefox = {
enable = true;
profiles.h7x4 = {
bookmarks = {
force = true;
settings = [{
toolbar = true;
bookmarks = import ./browser/bookmarks.nix;
}];
};
bookmarks = [{
toolbar = true;
bookmarks = import ./browser/bookmarks.nix;
}];
search = {
default = "Kagi";
default = "Google";
engines = import ./browser/engines.nix { inherit pkgs lib; };
force = true;
};
@@ -25,25 +23,18 @@
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
"browser.newtabpage.activity-stream.feeds.telemetry" = false;
"browser.newtabpage.activity-stream.telemetry" = false;
"datareporting.policy.dataSubmissionEnabled" = false;
"datareporting.healthreport.uploadEnabled" = false;
"toolkit.telemetry.archive.enabled" = false;
"toolkit.telemetry.bhrPing.enabled" = false;
"toolkit.telemetry.coverage.opt-out" = true;
"toolkit.telemetry.enabled" = false;
"toolkit.telemetry.firstShutdownPing.enabled" = false;
"toolkit.telemetry.hybridContent.enabled" = false;
"toolkit.telemetry.newProfilePing.enabled" = false;
"toolkit.telemetry.prompted" = 2;
"toolkit.telemetry.rejected" = true;
"toolkit.telemetry.reportingpolicy.firstRun" = false;
"toolkit.telemetry.server" = "data:,";
"toolkit.telemetry.shutdownPingSender.enabled" = false;
"toolkit.telemetry.unified" = false;
"toolkit.telemetry.unifiedIsOptIn" = false;
"toolkit.telemetry.enabled" = false;
"toolkit.telemetry.server" = "data:,";
"toolkit.telemetry.archive.enabled" = false;
"toolkit.telemetry.newProfilePing.enabled" = false;
"toolkit.telemetry.shutdownPingSender.enabled" = false;
"toolkit.telemetry.updatePing.enabled" = false;
"toolkit.telemetry.bhrPing.enabled" = false;
"toolkit.telemetry.firstShutdownPing.enabled" = false;
"toolkit.telemetry.coverage.opt-out" = true;
"toolkit.coverage.opt-out" = true;
"toolkit.coverage.endpoint.base" = "";

View File

@@ -1,9 +1,7 @@
{ config, lib, ... }:
let
cfg = config.programs.fzf;
in
{ ... }:
{
programs.fzf = {
enable = true;
defaultCommand = "fd --type f";
};
}
}

View File

@@ -1,32 +1,25 @@
{ config, lib, pkgs, ... }:
let
cfg = config.programs.gdb;
in
{ pkgs, ... }:
{
options.programs.gdb.enable = lib.mkEnableOption "gdb";
xdg.configFile."gdb/gdbinit".text = ''
# C++ related beautifiers
set print pretty on
set print object on
set print static-members on
set print vtbl on
set print demangle on
set print sevenbit-strings off
set print asm-demangle on
set print elements 0
config = lib.mkIf cfg.enable {
xdg.configFile."gdb/gdbinit".text = ''
# C++ related beautifiers
set print pretty on
set print object on
set print static-members on
set print vtbl on
set print demangle on
set print sevenbit-strings off
set print asm-demangle on
set print elements 0
# Assembly
set disassembly-flavor intel
# Assembly
set disassembly-flavor intel
# Save command history between sessions:
set history save
# Save command history between sessions:
set history save
# Print a beautifully colored prompt:
set prompt \001\033[1;36m\002(gdb) \001\033[0m\002
'';
# Print a beautifully colored prompt:
set prompt \001\033[1;36m\002(gdb) \001\033[0m\002
'';
# local.shell.aliases."System Tool Replacements".gdb = "${pkgs.pwndbg}/bin/pwndbg";
};
local.shell.aliases."System Tool Replacements".gdb = "${pkgs.pwndbg}/bin/pwndbg";
}

View File

@@ -1,4 +1,4 @@
{ ... }:
{
programs.gh-dash = { };
programs.gh-dash.enable = true;
}

View File

@@ -1,6 +1,7 @@
{ pkgs, ... }:
{
programs.gh = {
enable = true;
settings = {
gitProtocol = "ssh";
pager = "${pkgs.bat}/bin/bat";

View File

@@ -1,22 +0,0 @@
{ config, lib, pkgs, extendedLib, ... }:
let
cfg = config.programs.ghci;
in
{
options.programs.ghci = {
enable = lib.mkEnableOption "ghci, interactive haskell shell";
package = lib.mkPackageOption pkgs "ghc" { };
};
config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ];
# Personal config
xdg.configFile = {
"ghc/ghci.conf".text = ''
:set prompt "${extendedLib.termColors.front.magenta "[GHCi]λ"} "
'';
};
};
}

View File

@@ -13,11 +13,18 @@ let
"github.com:"
];
in
lib.mkIf cfg.enable {
{
# TODO: convert to template once nix-sops supports it in hm module
sops.secrets."git/nordicsemi-config" = { };
programs.git = lib.mkMerge [
{
enable = true;
package = pkgs.gitFull;
userName = "h7x4";
userEmail = "h7x4@nani.wtf";
signing = {
key = "46B9228E814A2AAC";
# format = "openpgp";
@@ -28,82 +35,86 @@ lib.mkIf cfg.enable {
lfs.enable = true;
settings = {
user = {
name = "h7x4";
email = "h7x4@nani.wtf";
delta = {
enable = true;
options = {
line-numbers = true;
side-by-side = true;
theme = "Monokai Extended Origin";
};
};
alias = {
aliases = "!git config --get-regexp alias | sed -re 's/alias\\.(\\S*)\\s(.*)$/\\1 = \\2/g'";
authors = "shortlog --summary --numbered --email";
delete-merged = "!git branch --merged | grep -v -e '\\*' -e 'master' -e 'main' | xargs -n 1 git branch -d";
ff = "fixup-fixup";
fi = "fixup-interactive";
forcepush = "push --force-with-lease --force-if-includes";
git = "!git";
pp = "post-pr";
rebase-author = "rebase -i -x \"git commit --amend --reset-author -CHEAD\"";
reset-to-upstream = "!git reset --hard \"origin/$(git rev-parse --abbrev-ref HEAD)\"";
rf = "rebase-fixups";
si = "switch-interactive";
subs = "submodule update --init --recursive";
} // (let
c = c: s: "%C(${c})${s}%C(reset)";
in {
graph = let
fmt = lib.concatStringsSep "" [
" - "
(c "bold blue" "%h")
" - "
(c "bold green" "(%ar)")
" "
(c "white" "> %s")
" "
(c "dim white" "- %an")
(c "bold yellow" "%d")
];
in "log --graph --abbrev-commit --decorate --format=format:'${fmt}' --all";
aliases = {
aliases = "!git config --get-regexp alias | sed -re 's/alias\\.(\\S*)\\s(.*)$/\\1 = \\2/g'";
authors = "shortlog --summary --numbered --email";
delete-merged = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d";
ff = "fixup-fixup";
fi = "fixup-interactive";
forcepush = "push --force-with-lease --force-if-includes";
git = "!git";
pp = "post-pr";
rebase-author = "rebase -i -x \"git commit --amend --reset-author -CHEAD\"";
reset-to-upstream = "!git reset --hard \"origin/$(git rev-parse --abbrev-ref HEAD)\"";
rf = "rebase-fixups";
si = "switch-interactive";
subs = "submodule update --init --recursive";
} // (let
c = c: s: "%C(${c})${s}%C(reset)";
in {
graph = let
fmt = lib.concatStringsSep "" [
" - "
(c "bold blue" "%h")
" - "
(c "bold green" "(%ar)")
" "
(c "white" "> %s")
" "
(c "dim white" "- %an")
(c "bold yellow" "%d")
];
in "log --graph --abbrev-commit --decorate --format=format:'${fmt}' --all";
graphv = let
fmt = lib.concatStringsSep "" [
(c "bold blue" "%h")
" - "
(c "bold cyan" "%aD")
" "
(c "bold green" "(%ar)")
(c "bold yellow" "%d")
"%n"
" "
(c "white" "%s")
" "
(c "dim white" "- %an")
];
in "log --graph --abbrev-commit --decorate --format=format:'${fmt}' --all";
graphv = let
fmt = lib.concatStringsSep "" [
(c "bold blue" "%h")
" - "
(c "bold cyan" "%aD")
" "
(c "bold green" "(%ar)")
(c "bold yellow" "%d")
"%n"
" "
(c "white" "%s")
" "
(c "dim white" "- %an")
];
in "log --graph --abbrev-commit --decorate --format=format:'${fmt}' --all";
l = let
fmt = lib.concatStringsSep "%n" (map (x: if builtins.isList x then lib.concatStringsSep " " x else x) [
[ (c "bold yellow" "%H") (c "auto" "%d") ]
[ (c "bold white" "Author:") (c "bold cyan" "%aN <%aE>") (c "bold green" "(%ah)") ]
[ (c "bold white" "Committer:") (c "bold cyan" "%cN <%cE>") (c "bold green" "(%ah)") ]
[ (c "bold white" "GPG: (%G?)") (c "bold magenta" "%GF") "-" (c "bold cyan" "%GS") (c "bold blue" "(%GT) ") ]
""
(c "bold white" "# %s")
"%+b"
(c "dim yellow" "%+N")
]);
# sedExpressions = let
# colorExpr = "\\x1B\\[([0-9]{1,3}(;[0-9]{1,2};?)?)?[mGK]";
# colorEndExpr = "\\x1B\\[m";
# colored = x: "${colorExpr}${x}${colorEndExpr}";
# in lib.concatMapStringsSep " " (x: "-e '${x}'") [
# "s|${colored "GPG: \\(N\\)"} ${colored "F3CDA86CC55A9F10D7A069819F2F7D8250F35146"} - ${colored "h7x4 <h7x4@nani.wtf>"} ${colored "\\(ultimate\\)"}|GPG: h7x4|"
# "s|${colored "GPG: \\(N\\)"} ${colored ""} - ${colored ""} ${colored "\\(undefined\\)"}||"
# ];
in "log --decorate --format=tformat:'${fmt}'";
# in "!git log --color=always --format=format:'${fmt}' | sed -E ${sedExpressions} | $PAGER";
});
l = let
fmt = lib.concatStringsSep "%n" (map (x: if builtins.isList x then lib.concatStringsSep " " x else x) [
[ (c "bold yellow" "%H") (c "auto" "%d") ]
[ (c "bold white" "Author:") (c "bold cyan" "%aN <%aE>") (c "bold green" "(%ah)") ]
[ (c "bold white" "Committer:") (c "bold cyan" "%cN <%cE>") (c "bold green" "(%ah)") ]
[ (c "bold white" "GPG: (%G?)") (c "bold magenta" "%GF") "-" (c "bold cyan" "%GS") (c "bold blue" "(%GT) ") ]
""
(c "bold white" "# %s")
"%+b"
(c "dim yellow" "%+N")
]);
# sedExpressions = let
# colorExpr = "\\x1B\\[([0-9]{1,3}(;[0-9]{1,2};?)?)?[mGK]";
# colorEndExpr = "\\x1B\\[m";
# colored = x: "${colorExpr}${x}${colorEndExpr}";
# in lib.concatMapStringsSep " " (x: "-e '${x}'") [
# "s|${colored "GPG: \\(N\\)"} ${colored "F3CDA86CC55A9F10D7A069819F2F7D8250F35146"} - ${colored "h7x4 <h7x4@nani.wtf>"} ${colored "\\(ultimate\\)"}|GPG: h7x4|"
# "s|${colored "GPG: \\(N\\)"} ${colored ""} - ${colored ""} ${colored "\\(undefined\\)"}||"
# ];
in "log --decorate --format=tformat:'${fmt}'";
# in "!git log --color=always --format=format:'${fmt}' | sed -E ${sedExpressions} | $PAGER";
});
extraConfig = {
core = {
whitespace = lib.concatStringsSep "," [
"space-before-tab"
@@ -233,7 +244,7 @@ lib.mkIf cfg.enable {
reflogExpireUnreachable = "90 days";
};
web.browser = "firefox";
web.browser = "google-chrome-stable";
"filter \"lfs\"" = {
required = true;
@@ -271,7 +282,7 @@ lib.mkIf cfg.enable {
];
in lib.genAttrs organizations (org: map (uri-prefix: "${uri-prefix}${org}") uri-prefixes);
in {
settings."url \"${lib.head uri-prefixes}\"".insteadOf = lib.tail uri-prefixes;
extraConfig."url \"${lib.head uri-prefixes}\"".insteadOf = lib.tail uri-prefixes;
includes = map (x: {
contentSuffix = "pvv.gitconfig";
@@ -284,6 +295,42 @@ lib.mkIf cfg.enable {
};
}) (lib.flatten (lib.attrValues prefixes-per-org));
})
(let
bitbucket-uri-prefixes = [
# Preferred
"bitbucket-nordicsemi:"
# Alternative
"ssh://git@bitbucket.nordicsemi.no:7999"
"https://projecttools.nordicsemi.no/bitbucket/scm"
];
prefixes-per-org = let
organizations = [
"NordicSemiconductor"
"NordicPlayground"
"nrfconnect"
"oysteintveit-nordicsemi"
];
in lib.genAttrs organizations (org: map (uri-prefix: "${uri-prefix}${org}") (github-uri-prefixes ++ [ "github-nordicsemi:" ]));
in {
extraConfig = lib.mergeAttrs
{
"url \"${lib.head bitbucket-uri-prefixes}\"".insteadOf = lib.tail bitbucket-uri-prefixes;
}
(lib.mapAttrs' (org: uri-prefixes: {
name = "url \"github-nordicsemi:${org}\"";
value.insteadOf = uri-prefixes;
}) prefixes-per-org)
;
includes = map (x: {
contentSuffix = "nordicsemi.gitconfig";
condition = "hasconfig:remote.*.url:${x}/**";
path = config.sops.secrets."git/nordicsemi-config".path;
}) (bitbucket-uri-prefixes ++ (lib.flatten (lib.attrValues prefixes-per-org)));
})
];
systemd.user.services."git-maintenance@".Service = lib.mkIf cfg.maintenance.enable {
@@ -301,7 +348,7 @@ lib.mkIf cfg.enable {
echo "[maintenance]"
for repoLocation in ${repoDirs}; do
for repo in "$repoLocation"/*/.git; do
echo "repo = $('${pkgs.coreutils}/bin/realpath' "''${repo%"/.git"}")"
echo "repo = $("${pkgs.coreutils}/bin/realpath" "''${repo%"/.git"}")"
done
done
} > "$1"
@@ -350,32 +397,8 @@ lib.mkIf cfg.enable {
text = lib.fileContents ./scripts/git-switch-interactive.sh;
excludeShellChecks = [
"SC2001" # (style): See if you can use ${variable//search/replace} instead. (sed invocation)
"SC2155"
];
})
(pkgs.writeShellApplication {
name = "git-author-lines";
runtimeInputs = with pkgs; [ cfg.package gnused gnugrep gawk uutils-coreutils-noprefix ];
text = lib.fileContents ./scripts/git-author-lines.sh;
})
(pkgs.writeShellApplication {
name = "git-all-commits";
runtimeInputs = with pkgs; [ cfg.package gnugrep gawk findutils uutils-coreutils-noprefix ];
text = lib.fileContents ./scripts/git-all-commits.sh;
})
(pkgs.writeShellApplication {
name = "git-diffc";
runtimeInputs = with pkgs; [ cfg.package gawk ];
text = let
printfLiteral = lib.concatStrings [
"\\033[36m%s\\033[0m\\n"
"\\033[32m%s\\033[0m\\n"
"\\033[31m%s\\033[0m\\n"
];
in ''
git --no-pager diff --shortstat "$@" | awk -F',' '{ printf "${printfLiteral}", $1, $2 ? $2 : "", $3 ? $3 : ""; }'
'';
})
((pkgs.writers.writePython3Bin "git-post-pr" {
libraries = with pkgs.python3Packages; [
tkinter

View File

@@ -1,15 +0,0 @@
GIT_ROOT="$(git rev-parse --show-toplevel)"
find "$GIT_ROOT/.git/objects" -type f | \
while read -r file; do
if echo "$file" | grep -Eq '\.idx$'; then
git show-index < "$file" | awk '{print $2}'
elif echo "$file" | grep -Eq '[0-9a-f]{38}$'; then
echo "$(basename "$(dirname "$file")")$(basename "$file")"
fi
done | \
while read -r hash; do
if [ "$(git cat-file -t "$hash")" = commit ]; then
echo "$hash"
fi
done

View File

@@ -1,21 +0,0 @@
set -euo pipefail
if [ -n "${1:-}" ]; then
REF="${1}"
else
REF="HEAD"
fi
# TODO: optionally keep track of which files the authors were present in,
# and print a list of up to N files where the authors contributed the most.
git ls-tree -r "${REF}" \
| while read -r _filemode _objtype _githash filepath; do
if git grep -Il . -- "$filepath" >/dev/null; then
git --no-pager blame --line-porcelain "${filepath}"
fi
done \
| grep --binary-files=without-match '^author ' \
| sed -e 's/author //' \
| awk '{ a[$0]+=1 } END{ for (i in a) { print a[i],i } }' \
| sort --numeric-sort --key 1 --reverse

View File

@@ -1,136 +1,16 @@
set -euo pipefail
if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ] || [ $# -ge 2 ]; then
declare -r ARGV0=$(basename "${0:-git-switch-interactive.sh}")
printf 'Usage: %s [BRANCH]\n' "$ARGV0" >&2
cat <<'EOF' >&2
Interactively choose a local branch, remote branch, or tag to switch to.
Options:
-h, --help Show this help and exit
BRANCH If a single branch/tag/ref is provided, the script will
run git switch BRANCH and exit.
EOF
exit 0
fi
if [ $# -eq 1 ]; then
if [ -n "${1:-}" ]; then
git switch "$1"
exit 0
fi
declare -r BRANCH_COLOR=$'\033[32m'
declare -r REMOTE_COLOR=$'\033[33m'
declare -r ORIGIN_COLOR=$'\033[31m'
declare -r TAG_COLOR=$'\033[35m'
declare -r RESET_COLOR=$'\033[0m'
BRANCHES=$(cat <(git branch) <(git branch --remotes) | grep --invert-match '^\*\|HEAD ->' | sed 's|^\s*||')
CHOSEN_BRANCH=$(sk --reverse --info=inline --preview 'git show --color {}' <<<"$BRANCHES")
if [ -n "${NO_COLOR:-}" ]; then
declare -r BRANCH_COLOR=''
declare -r REMOTE_COLOR=''
declare -r ORIGIN_COLOR=''
declare -r TAG_COLOR=''
declare -r RESET_COLOR=''
fi
CLEAN_BRANCH_NAME=$(sed 's|^\s*||' <<<"$CHOSEN_BRANCH")
for REMOTE in $(git remote); do
CLEAN_BRANCH_NAME=$(sed "s|^${REMOTE}/||" <<<"$CLEAN_BRANCH_NAME")
done
declare -r STRIP_ANSI_SED='s/\x1B\[[0-9;]*[a-zA-Z]//g'
declare -r TRIM_SPACE_SED='s/^[[:space:]]+//; s/[[:space:]]+$//'
declare -r STRIP_SURROUNDING_QUOTES_SED="s/^[[:space:]\"'[]+//; s/[[:space:]\"'\\]]+\$//; s/^\"\\[+//; s/^\\[+//; s/\\]+$//"
sanitize_ref_from_git() {
sed -E \
-e "$STRIP_ANSI_SED" \
-e "$TRIM_SPACE_SED" \
-e "$STRIP_SURROUNDING_QUOTES_SED" <<<"$1"
}
declare -a VISIBLE_ITEMS=()
while IFS= read -r ref; do
[ -z "$ref" ] && continue
VISIBLE_ITEMS+=("${BRANCH_COLOR}(branch)${RESET_COLOR} $(sanitize_ref_from_git "$ref")")
done < <(git for-each-ref --sort=-committerdate --format='%(refname:short)' refs/heads 2>/dev/null)
while IFS= read -r ref; do
[ -z "$ref" ] && continue
case "$ref" in
*/*)
remote_part="$(sanitize_ref_from_git "${ref%%/*}")"
branch_part="$(sanitize_ref_from_git "${ref#*/}")"
if [ -z "$branch_part" ] || [ "$branch_part" = "HEAD" ]; then
continue
fi
VISIBLE_ITEMS+=("${REMOTE_COLOR}(remote)${RESET_COLOR} ${ORIGIN_COLOR}${remote_part}${RESET_COLOR}/${branch_part}")
;;
*)
continue
;;
esac
done < <(git for-each-ref --format='%(refname:short)' refs/remotes 2>/dev/null)
while IFS= read -r ref; do
[ -z "$ref" ] && continue
VISIBLE_ITEMS+=("${TAG_COLOR}(tag)${RESET_COLOR} $(sanitize_ref_from_git "$ref")")
done < <(git for-each-ref --format='%(refname:short)' refs/tags 2>/dev/null)
if [ ${#VISIBLE_ITEMS[@]} -eq 0 ]; then
echo "No branches or tags found." >&2
exit 1
fi
declare -r SKIM_PREVIEW_COMMAND_RAW=$(cat <<'EOF'
raw=$(printf "%s" {} | sed -r 's/\x1B\[[0-9;]*[A-Za-z]//g')
ref=$(printf "%s" "$raw" | sed -n -E 's/^[[:space:]]*\([^)]*\)[[:space:]]*(.*)$/\1/p')
git show --color "$ref" 2>/dev/null || git log -n 50 --color "$ref"
EOF
)
declare -r SKIM_PREVIEW_COMMAND_=${SKIM_PREVIEW_COMMAND_RAW//$'\n'/'; '}
declare -r SKIM_PREVIEW_COMMAND=${SKIM_PREVIEW_COMMAND_%'; '}
CHOSEN=$(printf '%s\n' "${VISIBLE_ITEMS[@]}" | sk --ansi --reverse --info=inline --preview "$SKIM_PREVIEW_COMMAND")
[ -z "${CHOSEN:-}" ] && exit 0
declare -r CLEAN=$(sed -E \
-e "$STRIP_ANSI_SED" \
-e "$TRIM_SPACE_SED" \
<<<"$CHOSEN"
)
declare -r PARSED=$(sed -n -E "s/^[[:space:]]*\(([^)]*)\)[[:space:]]*(.*)$/\1|\2/p" <<<"$CLEAN") || true
if [ -z "$PARSED" ]; then
echo "Failed to parse selection: $CLEAN" >&2
exit 2
fi
declare -r TYPE=${PARSED%%|*}
declare -r RAW_REF=${PARSED#*|}
declare -r REF=$(sanitize_ref_from_git "$RAW_REF")
case "$TYPE" in
tag)
git switch --detach "$REF"
;;
remote)
SWITCH_NAME="$REF"
for R in $(git remote 2>/dev/null); do
if [ "${REF#"${R}"/}" != "$REF" ]; then
CAND=${REF#"${R}"/}
if git show-ref --verify --quiet "refs/heads/$CAND"; then
SWITCH_NAME="$CAND"
break
fi
fi
done
git switch "$SWITCH_NAME"
;;
branch)
git switch "$REF"
;;
*)
git switch "$REF"
;;
esac
exit 0
git switch "${CLEAN_BRANCH_NAME}"

View File

@@ -1,9 +1,7 @@
{ config, lib, pkgs, ... }:
let
cfg = config.programs.gpg;
in
lib.mkIf cfg.enable {
{ config, pkgs, ... }:
{
programs.gpg = {
enable = true;
homedir = "${config.xdg.configHome}/gnupg";
auto-refresh-keys.enable = true;
@@ -28,7 +26,7 @@ lib.mkIf cfg.enable {
services.gpg-agent = {
enable = true;
pinentry.package = pkgs.pinentry-curses;
pinentryPackage = pkgs.pinentry-curses;
enableExtraSocket = true;
enableSshSupport = true;
enableScDaemon = true;

View File

@@ -1,4 +0,0 @@
{ ... }:
{
programs.helix = { };
}

View File

@@ -1,4 +1,4 @@
{ ... }:
{
programs.home-manager = { };
}
programs.home-manager.enable = true;
}

380
home/programs/hyprland.nix Normal file
View File

@@ -0,0 +1,380 @@
{ config, pkgs, lib, ... }:
let
cfg = config.wayland.windowManager.hyprland;
in
{
home.sessionVariables = {
WLR_NO_HARDWARE_CURSORS = "1";
WLR_RENDERER_ALLOW_SOFTWARE = "1";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_DESKTOP = "Hyprland";
XDG_SESSION_TYPE = "wayland";
GDK_BACKEND = "wayland,x11,*";
QT_QPA_PLATFORM = "wayland;xcb";
NIXOS_OZONE_WL = "1";
MOZ_ENABLE_WAYLAND = "1";
SDL_VIDEODRIVER = "wayland";
OZONE_PLATFORM = "wayland";
CLUTTER_BACKEND = "wayland";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
# QT_QPA_PLATFORMTHEME = "qt6ct";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
# LIBVA_DRIVER_NAME = "nvidia";
# GBM_BACKEND = "nvidia-drm";
# __GLX_VENDOR_LIBRARY_NAME = "nvidia";
};
home.packages = with pkgs; [
hyprpolkitagent
wl-clipboard-rs
];
programs.hyprlock = {
enable = true;
settings = {
general = {
disable_loading_bar = true;
grace = 0;
hide_cursor = true;
no_fade_in = false;
};
background = [
{
path = "screenshot";
blur_passes = 3;
blur_size = 8;
}
];
input-field = [
{
size = "200, 50";
position = "0, -80";
monitor = "";
dots_center = true;
fade_on_empty = false;
font_color = "rgb(202, 211, 245)";
inner_color = "rgb(91, 96, 120)";
outer_color = "rgb(24, 25, 38)";
outline_thickness = 5;
placeholder_text = ''Password...'';
shadow_passes = 2;
}
];
auth = {
"pam:enabled" = true;
"pam:module" = "hyprlock";
};
};
};
services.hypridle = {
enable = true;
settings = {
general = {
ignore_dbus_inhibit = false;
lock_cmd = "pidof hyprlock || ${config.programs.hyprlock.package}/bin/hyprlock";
before_sleep_cmd = "${pkgs.systemd}/bin/loginctl lock-session";
after_sleep_cmd = "${cfg.finalPackage}/bin/hyprctl dispatch dpms on";
};
listener = [
{
timeout = 900;
on-timeout = "${config.programs.hyprlock.package}/bin/hyprlock";
}
{
timeout = 1200;
on-timeout = "${cfg.finalPackage}/bin/hyprctl dispatch dpms off";
on-resume = "${cfg.finalPackage}/bin/hyprctl dispatch dpms on";
}
];
};
};
wayland.windowManager.hyprland = {
enable = true;
systemd.enable = false;
systemd.enableXdgAutostart = false;
settings = let
exe = lib.getExe;
scratchpads = [
(rec {
title = "Floating terminal";
class = "floatingTerminal";
command = "uwsm app -- ${exe pkgs.alacritty} --class ${class} -e ${exe pkgs.tmux} new-session -A -s f";
size = { h = 90; w = 95; };
keys = [
"$mod, RETURN"
"$mod, SPACE"
];
})
(rec {
title = "Ncmpcpp";
class = "floatingNcmpcpp";
command = "uwsm app -- ${exe pkgs.alacritty} --class ${class} -e ${exe pkgs.ncmpcpp}";
size = { h = 95; w = 95; };
keys = [ "$mod, Q" ];
})
# "$mod, W, emacs"
# "$mod, E, filebrowser"
# "$mod, X, taskwarriortui"
];
in {
"$mod" = "SUPER";
# https://github.com/xkbcommon/libxkbcommon/blob/master/include/xkbcommon/xkbcommon-keysyms.h
bind = [
"$mod SHIFT, Q, exec, ${pkgs.systemd}/bin/loginctl terminate-user \"\""
"$mod ALT SHIFT, Q, exec, uwsm stop"
"$mod, R, exec, uwsm app -- ${exe config.programs.anyrun.package}"
"$mod, T, togglefloating"
"$mod, F, fullscreenstate, 1"
"$mod SHIFT, F, fullscreenstate, 3"
"$mod, C, exec, ${cfg.finalPackage}/bin/hyprctl reload"
"$mod, BACKSPACE, killactive"
"$mod SHIFT, RETURN, exec, uwsm app -- ${exe pkgs.alacritty} --class termTerminal -e ${exe pkgs.tmux} new-session -A -s term"
"$mod SHIFT, SPACE, exec, uwsm app -- ${exe pkgs.alacritty} --class termTerminal -e ${exe pkgs.tmux} new-session -A -s term"
"$mod, j, layoutmsg,cyclenext"
"$mod, k, layoutmsg,cycleprev"
"$mod SHIFT, j, layoutmsg, swapnext"
"$mod SHIFT, k, layoutmsg, swapprev"
"$mod, 1, focusworkspaceoncurrentmonitor, 1"
"$mod, 2, focusworkspaceoncurrentmonitor, 2"
"$mod, 3, focusworkspaceoncurrentmonitor, 3"
"$mod, 4, focusworkspaceoncurrentmonitor, 4"
"$mod, 5, focusworkspaceoncurrentmonitor, 5"
"$mod, 6, focusworkspaceoncurrentmonitor, 6"
"$mod, 7, focusworkspaceoncurrentmonitor, 7"
"$mod, 8, focusworkspaceoncurrentmonitor, 8"
"$mod, 9, focusworkspaceoncurrentmonitor, 9"
"$mod SHIFT, 1, movetoworkspacesilent, 1"
"$mod SHIFT, 2, movetoworkspacesilent, 2"
"$mod SHIFT, 3, movetoworkspacesilent, 3"
"$mod SHIFT, 4, movetoworkspacesilent, 4"
"$mod SHIFT, 5, movetoworkspacesilent, 5"
"$mod SHIFT, 6, movetoworkspacesilent, 6"
"$mod SHIFT, 7, movetoworkspacesilent, 7"
"$mod SHIFT, 8, movetoworkspacesilent, 8"
"$mod SHIFT, 9, movetoworkspacesilent, 9"
"$mod, b, exec, ${pkgs.fcitx5}/bin/fcitx5-remote -s mozc"
"$mod, n, exec, ${pkgs.fcitx5}/bin/fcitx5-remote -s keyboard-no"
"$mod, m, exec, ${pkgs.fcitx5}/bin/fcitx5-remote -s keyboard-us"
"$mod, l, exec, ${pkgs.systemd}/bin/loginctl lock-session"
# TODO: fix
# "super + minus" = "${pkgs.xcalib}/bin/xcalib -invert -alter"
", Print, exec, ${exe pkgs.grimblast} copy area"
# "SHIFT, Print, exec, ${lib.getExe pkgs.grimblast} copy area"
# "shift + @Print" = "${pkgs.maim}/bin/maim --hidecursor --nokeyboard $SCREENSHOT_DIR/$(date +%s).png"
"$mod, Print, exec, ${exe pkgs.woomer}"
]
++
(lib.pipe scratchpads [
(map ({ keys, command, class, ... }:
(map (key: let
# TODO: rewrite this to take arguments instead of creating n copies
invokeIfNotRunningAndToggleWorkspace = pkgs.writeShellApplication {
name = "hyprland-toggle-scratchpad-${class}";
runtimeInputs = [ cfg.finalPackage pkgs.jq ];
text = ''
SCRATCHPAD_PROGRAM_EXISTS=$(hyprctl clients -j | jq -r '[.[].class]|any(. == "${class}")')
CURRENT_WORKSPACE_ID=$(hyprctl activeworkspace -j | jq -r '.id')
if [ "$SCRATCHPAD_PROGRAM_EXISTS" != "true" ]; then
${command} &
hyprctl dispatch movetoworkspacesilent "''${CURRENT_WORKSPACE_ID},class:${class}"
hyprctl dispatch focuswindow "class:${class}"
else
SCRATCHPAD_PROGRAM_WORKSPACE_ID=$(hyprctl clients -j | jq '.[] | select( .class == "${class}") | .workspace.id')
if [ "$SCRATCHPAD_PROGRAM_WORKSPACE_ID" != "$CURRENT_WORKSPACE_ID" ]; then
hyprctl dispatch movetoworkspacesilent "''${CURRENT_WORKSPACE_ID},class:${class}"
hyprctl dispatch focuswindow "class:${class}"
else
hyprctl dispatch movetoworkspacesilent "special:${class}Ws,class:${class}"
fi
fi
'';
};
in "${key}, exec, ${lib.getExe invokeIfNotRunningAndToggleWorkspace}"
) keys)
))
lib.flatten
]);
bindm = [
"$mod, mouse:272, movewindow"
"$mod, Control_L, movewindow"
"$mod, mouse:273, resizewindow"
"$mod, ALT_L, resizewindow"
];
bindl = [
"$mod, p, exec, ${exe pkgs.mpc_cli} toggle"
",XF86AudioPlay, exec, ${exe pkgs.mpc_cli} toggle"
",XF86AudioPrev, exec, ${exe pkgs.mpc_cli} prev"
",XF86AudioNext, exec, ${exe pkgs.mpc_cli} next"
];
bindle = [
",XF86MonBrightnessUp, exec, ${exe pkgs.brightnessctl} s +5%"
",XF86MonBrightnessDown, exec, ${exe pkgs.brightnessctl} s 5%-"
",XF86AudioLowerVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-"
",XF86AudioRaiseVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+"
"$mod ,F7, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-"
"$mod ,F8, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+"
];
exec-once = [
"uwsm finalize"
];
windowrulev2 = [
"float, class:^(Rofi)$"
"float, class:^(xdg-desktop-portal-gtk)$"
"float, title:^(.*Bitwarden Password Manager.*)$"
"float, title:^(Picture-in-Picture)$"
"tile, class:^(Nsxiv)$"
"float, class: ^(Gimp-2.*)$, title:^(Open Image)$"
"size 70%, class: ^(Gimp-2.*)$, title:^(Open Image)$"
"center, class: ^(Gimp-2.*)$, title:^(Open Image)$"
"dimaround, class:^(xdg-desktop-portal-gtk)$"
"workspace special silent, title:^(Firefox Sharing Indicator)$"
"workspace special silent, title:^(Zen Sharing Indicator)$"
"workspace special silent, title:^(.*is sharing (your screen|a window)\.)$"
"workspace 2, class:^(firefox)$"
"workspace 2, class:^(google-chrome)$"
"workspace 3, class:^(Emacs)$"
"workspace 3, class:^(code)$"
"workspace 3, class:^(code-url-handler)$"
"workspace 3, class:^(dev.zed.Zed)$"
"workspace 5, class:^(discord)$"
"workspace 5, class:^(Element)$"
]
++
(lib.pipe scratchpads [
(map ({ class, size, ... }: [
"workspace special:${class}Ws, class:^${class}$"
"float, class:^${class}$"
"size ${toString size.w}% ${toString size.h}%, class:^${class}$"
"move ${toString ((100 - size.w) / 2)}% ${toString ((100 - size.h) / 2)}%, class:^${class}$"
]))
lib.flatten
]);
monitor = [
# TODO: host specific
"eDP-1, 3840x2400@90.00Hz, 0x0, 2"
# PVV Demiurgen
"desc:Hewlett Packard HP ZR24w CNT01711G6, 1920x1200, 0x-1200, 1"
"desc:Hewlett Packard HP ZR24w CNT018103H, 1920x1200, 1920x-1200, 1"
# PVV Eirin
"desc:Hewlett Packard HP ZR24w CNT01710L4, 1920x1200, 0x-1200, 1"
"desc:Hewlett Packard HP ZR24w CNT0181039, 1920x1200, 1920x-1200, 1"
",preferred,auto,1"
];
general = {
gaps_in = 5;
gaps_out = 15;
border_size = 2;
"col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
"col.inactive_border" = "rgba(595959aa)";
resize_on_border = false;
allow_tearing = false;
layout = "master";
};
decoration = {
rounding = 10;
# Change transparency of focused and unfocused windows
active_opacity = 1.0;
inactive_opacity = 1.0;
# drop_shadow = true;
# shadow_range = 4;
# shadow_render_power = 3;
# "col.shadow" = "rgba(1a1a1aee)";
# https://wiki.hyprland.org/Configuring/Variables/#blur
blur = {
enabled = true;
size = 3;
passes = 1;
vibrancy = 0.1696;
};
};
animations.enabled = false;
master = {
new_status = "slave";
};
misc = {
force_default_wallpaper = 0; # Set to 0 or 1 to disable the anime mascot wallpapers
disable_hyprland_logo = false; # If true disables the random hyprland logo / anime girl background. :(
};
input ={
kb_layout = "us";
kb_variant = "";
kb_model = "";
kb_options = "caps:escape";
kb_rules = "";
follow_mouse = 1;
sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
touchpad = {
natural_scroll = false;
};
};
};
};
services.hyprpaper = {
enable = true;
settings.ipc = true;
};
# UWSM
systemd.user.services = {
hypridle.Unit.After = lib.mkForce "graphical-session.target";
waybar.Unit.After = lib.mkForce "graphical-session.target";
network-manager-applet.Unit.After = lib.mkForce "graphical-session.target";
fcitx5-daemon.Unit.After = lib.mkForce "graphical-session.target";
# hyprpaper.Unit.After = lib.mkForce "graphical-session.target";
};
}

View File

@@ -1,56 +0,0 @@
{ config, pkgs, lib, ... }:
let
cfg = config.wayland.windowManager.hyprland;
in
{
imports = [
./hypridle.nix
./hyprland.nix
./hyprlock.nix
./hyprpaper.nix
./hyprpolkitagent.nix
./keybinds.nix
./scratchpads.nix
./windowrules.nix
./xdg-portals.nix
];
config = lib.mkIf cfg.enable {
home.sessionVariables = {
WLR_NO_HARDWARE_CURSORS = "1";
WLR_RENDERER_ALLOW_SOFTWARE = "1";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_DESKTOP = "Hyprland";
XDG_SESSION_TYPE = "wayland";
GDK_BACKEND = "wayland,x11,*";
QT_QPA_PLATFORM = "wayland;xcb";
NIXOS_OZONE_WL = "1";
MOZ_ENABLE_WAYLAND = "1";
SDL_VIDEODRIVER = "wayland";
OZONE_PLATFORM = "wayland";
CLUTTER_BACKEND = "wayland";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
# QT_QPA_PLATFORMTHEME = "qt6ct";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
# LIBVA_DRIVER_NAME = "nvidia";
# GBM_BACKEND = "nvidia-drm";
# __GLX_VENDOR_LIBRARY_NAME = "nvidia";
};
home.packages = with pkgs; [
wl-clipboard-rs
];
systemd.user.services = {
waybar.Unit.After = lib.mkForce "graphical-session.target";
network-manager-applet.Unit.After = lib.mkForce "graphical-session.target";
fcitx5-daemon = {
Unit.After = lib.mkForce "graphical-session.target";
Service.Slice = "session.slice";
};
};
};
}

View File

@@ -1,36 +0,0 @@
{ config, pkgs, lib, ... }:
let
cfg = config.wayland.windowManager.hyprland;
in
{
config = lib.mkIf cfg.enable {
services.hypridle = {
enable = true;
settings = {
general = {
ignore_dbus_inhibit = false;
lock_cmd = "pidof hyprlock || ${config.programs.hyprlock.package}/bin/hyprlock";
before_sleep_cmd = "${pkgs.systemd}/bin/loginctl lock-session";
after_sleep_cmd = "${cfg.finalPackage}/bin/hyprctl dispatch dpms on";
};
listener = [
{
timeout = 900;
on-timeout = "${config.programs.hyprlock.package}/bin/hyprlock";
}
{
timeout = 1200;
on-timeout = "${cfg.finalPackage}/bin/hyprctl dispatch dpms off";
on-resume = "${cfg.finalPackage}/bin/hyprctl dispatch dpms on";
}
];
};
};
systemd.user.services.hypridle = {
Unit.After = lib.mkForce "graphical-session.target";
Service.Slice = "session.slice";
};
};
}

View File

@@ -1,90 +0,0 @@
{
wayland.windowManager.hyprland = {
systemd.enable = false;
systemd.enableXdgAutostart = false;
settings = {
exec-once = [
"uwsm finalize"
];
monitor = [
# TODO: host specific
"eDP-1, 3840x2400@90.00Hz, 0x0, 2"
# PVV Demiurgen
"desc:Hewlett Packard HP ZR24w CNT01711G6, 1920x1200, 0x-1200, 1"
"desc:Hewlett Packard HP ZR24w CNT018103H, 1920x1200, 1920x-1200, 1"
# PVV Eirin
"desc:Hewlett Packard HP ZR24w CNT01710L4, 1920x1200, 0x-1200, 1"
"desc:Hewlett Packard HP ZR24w CNT0181039, 1920x1200, 1920x-1200, 1"
",preferred,auto,1"
];
general = {
gaps_in = 5;
gaps_out = 15;
border_size = 2;
"col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
"col.inactive_border" = "rgba(595959aa)";
resize_on_border = false;
allow_tearing = false;
layout = "master";
};
decoration = {
rounding = 10;
# Change transparency of focused and unfocused windows
active_opacity = 1.0;
inactive_opacity = 1.0;
# drop_shadow = true;
# shadow_range = 4;
# shadow_render_power = 3;
# "col.shadow" = "rgba(1a1a1aee)";
# https://wiki.hyprland.org/Configuring/Variables/#blur
blur = {
enabled = true;
size = 3;
passes = 1;
vibrancy = 0.1696;
};
};
animations.enabled = false;
master = {
new_status = "slave";
};
misc = {
force_default_wallpaper = 0; # Set to 0 or 1 to disable the anime mascot wallpapers
disable_hyprland_logo = false; # If true disables the random hyprland logo / anime girl background. :(
};
input ={
kb_layout = "us";
kb_variant = "";
kb_model = "";
kb_options = "caps:escape";
kb_rules = "";
follow_mouse = 1;
sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
touchpad = {
natural_scroll = false;
};
};
};
};
}

View File

@@ -1,48 +0,0 @@
{ config, pkgs, lib, ... }:
let
cfg = config.wayland.windowManager.hyprland;
in
{
config = lib.mkIf cfg.enable {
programs.hyprlock = {
enable = true;
settings = {
general = {
disable_loading_bar = true;
grace = 0;
hide_cursor = true;
no_fade_in = false;
};
background = [
{
path = "screenshot";
blur_passes = 3;
blur_size = 8;
}
];
input-field = [
{
size = "200, 50";
position = "0, -80";
monitor = "";
dots_center = true;
fade_on_empty = false;
font_color = "rgb(202, 211, 245)";
inner_color = "rgb(91, 96, 120)";
outer_color = "rgb(24, 25, 38)";
outline_thickness = 5;
placeholder_text = ''Password...'';
shadow_passes = 2;
}
];
auth = {
"pam:enabled" = true;
"pam:module" = "hyprlock";
};
};
};
};
}

View File

@@ -1,17 +0,0 @@
{ config, lib, ... }:
let
cfg = config.wayland.windowManager.hyprland;
in
{
config = lib.mkIf cfg.enable {
services.hyprpaper = {
enable = true;
settings.ipc = true;
};
systemd.user.services.hyprpaper = {
Unit.After = lib.mkForce "graphical-session.target";
Service.Slice = "session.slice";
};
};
}

View File

@@ -1,14 +0,0 @@
{ config, lib, ... }:
let
cfg = config.wayland.windowManager.hyprland;
in
{
config = lib.mkIf cfg.enable {
services.hyprpolkitagent.enable = true;
systemd.user.services.hyprpolkitagent = {
Unit.After = lib.mkForce "graphical-session.target";
Service.Slice = "session.slice";
};
};
}

View File

@@ -1,94 +0,0 @@
{ config, pkgs, lib, ... }:
let
cfg = config.wayland.windowManager.hyprland;
in
{
config = lib.mkIf cfg.enable {
wayland.windowManager.hyprland.settings = let
exe = lib.getExe;
in {
"$mod" = "SUPER";
# https://github.com/xkbcommon/libxkbcommon/blob/master/include/xkbcommon/xkbcommon-keysyms.h
bind = [
"$mod SHIFT, Q, exec, uwsm stop"
"$mod ALT SHIFT, Q, exec, ${pkgs.systemd}/bin/loginctl terminate-user \"${config.home.username}\""
"$mod, R, exec, uwsm app -- ${exe config.programs.anyrun.package}"
"$mod, T, togglefloating"
"$mod, F, fullscreenstate, 1"
"$mod SHIFT, F, fullscreenstate, 3"
"$mod, C, exec, ${cfg.finalPackage}/bin/hyprctl reload"
"$mod, BACKSPACE, killactive"
"$mod SHIFT, RETURN, exec, ${exe pkgs.app2unit} -t service -C -s app-graphical.slice -- ${exe pkgs.alacritty} --class termTerminal -e ${exe pkgs.tmux} new-session -A -s term"
"$mod SHIFT, SPACE, exec, ${exe pkgs.app2unit} -t service -C -s app-graphical.slice -- ${exe pkgs.alacritty} --class termTerminal -e ${exe pkgs.tmux} new-session -A -s term"
"$mod, j, layoutmsg,cyclenext"
"$mod, k, layoutmsg,cycleprev"
"$mod SHIFT, j, layoutmsg, swapnext"
"$mod SHIFT, k, layoutmsg, swapprev"
"$mod, 1, focusworkspaceoncurrentmonitor, 1"
"$mod, 2, focusworkspaceoncurrentmonitor, 2"
"$mod, 3, focusworkspaceoncurrentmonitor, 3"
"$mod, 4, focusworkspaceoncurrentmonitor, 4"
"$mod, 5, focusworkspaceoncurrentmonitor, 5"
"$mod, 6, focusworkspaceoncurrentmonitor, 6"
"$mod, 7, focusworkspaceoncurrentmonitor, 7"
"$mod, 8, focusworkspaceoncurrentmonitor, 8"
"$mod, 9, focusworkspaceoncurrentmonitor, 9"
"$mod SHIFT, 1, movetoworkspacesilent, 1"
"$mod SHIFT, 2, movetoworkspacesilent, 2"
"$mod SHIFT, 3, movetoworkspacesilent, 3"
"$mod SHIFT, 4, movetoworkspacesilent, 4"
"$mod SHIFT, 5, movetoworkspacesilent, 5"
"$mod SHIFT, 6, movetoworkspacesilent, 6"
"$mod SHIFT, 7, movetoworkspacesilent, 7"
"$mod SHIFT, 8, movetoworkspacesilent, 8"
"$mod SHIFT, 9, movetoworkspacesilent, 9"
"$mod, b, exec, ${pkgs.fcitx5}/bin/fcitx5-remote -s mozc"
"$mod, n, exec, ${pkgs.fcitx5}/bin/fcitx5-remote -s keyboard-no"
"$mod, m, exec, ${pkgs.fcitx5}/bin/fcitx5-remote -s keyboard-us"
"$mod, l, exec, ${pkgs.systemd}/bin/loginctl lock-session"
# TODO: fix
# "super + minus" = "${pkgs.xcalib}/bin/xcalib -invert -alter"
", Print, exec, ${exe pkgs.grimblast} copy area"
"SHIFT, Print, exec, ${lib.getExe pkgs.grimblast} save"
# "shift + @Print" = "${pkgs.maim}/bin/maim --hidecursor --nokeyboard $SCREENSHOT_DIR/$(date +%s).png"
"$mod, Print, exec, ${exe pkgs.woomer}"
];
bindm = [
"$mod, mouse:272, movewindow"
"$mod, Control_L, movewindow"
"$mod, mouse:273, resizewindow"
"$mod, ALT_L, resizewindow"
];
bindl = [
"$mod, p, exec, ${exe pkgs.mpc} toggle"
",XF86AudioPlay, exec, ${exe pkgs.mpc} toggle"
",XF86AudioPrev, exec, ${exe pkgs.mpc} prev"
",XF86AudioNext, exec, ${exe pkgs.mpc} next"
];
bindle = [
",XF86MonBrightnessUp, exec, ${exe pkgs.brightnessctl} s +5%"
",XF86MonBrightnessDown, exec, ${exe pkgs.brightnessctl} s 5%-"
",XF86AudioLowerVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-"
",XF86AudioRaiseVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+"
"$mod ,F7, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-"
"$mod ,F8, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+"
];
};
};
}

View File

@@ -1,75 +0,0 @@
{ config, pkgs, lib, ... }:
let
cfg = config.wayland.windowManager.hyprland;
in
{
config = lib.mkIf cfg.enable {
wayland.windowManager.hyprland.settings = let
exe = lib.getExe;
scratchpads = [
(rec {
title = "Floating terminal";
class = "floatingTerminal";
command = "uwsm app -- ${exe pkgs.alacritty} --class ${class} -e ${exe pkgs.tmux} new-session -A -s f";
size = { h = 90; w = 95; };
keys = [
"$mod, RETURN"
"$mod, SPACE"
];
})
(rec {
title = "Ncmpcpp";
class = "floatingNcmpcpp";
command = "uwsm app -- ${exe pkgs.alacritty} --class ${class} -e ${exe pkgs.ncmpcpp}";
size = { h = 95; w = 95; };
keys = [ "$mod, Q" ];
})
# "$mod, W, emacs"
# "$mod, E, filebrowser"
# "$mod, X, taskwarriortui"
];
in {
bind = lib.pipe scratchpads [
(map ({ keys, command, class, ... }:
(map (key: let
# TODO: rewrite this to take arguments instead of creating n copies
invokeIfNotRunningAndToggleWorkspace = pkgs.writeShellApplication {
name = "hyprland-toggle-scratchpad-${class}";
runtimeInputs = [ cfg.finalPackage pkgs.jq ];
text = ''
SCRATCHPAD_PROGRAM_EXISTS=$(hyprctl clients -j | jq -r '[.[].class]|any(. == "${class}")')
CURRENT_WORKSPACE_ID=$(hyprctl activeworkspace -j | jq -r '.id')
if [ "$SCRATCHPAD_PROGRAM_EXISTS" != "true" ]; then
${command} &
hyprctl dispatch movetoworkspacesilent "''${CURRENT_WORKSPACE_ID},class:${class}"
hyprctl dispatch focuswindow "class:${class}"
else
SCRATCHPAD_PROGRAM_WORKSPACE_ID=$(hyprctl clients -j | jq '.[] | select( .class == "${class}") | .workspace.id')
if [ "$SCRATCHPAD_PROGRAM_WORKSPACE_ID" != "$CURRENT_WORKSPACE_ID" ]; then
hyprctl dispatch movetoworkspacesilent "''${CURRENT_WORKSPACE_ID},class:${class}"
hyprctl dispatch focuswindow "class:${class}"
else
hyprctl dispatch movetoworkspacesilent "special:${class}Ws,class:${class}"
fi
fi
'';
};
in "${key}, exec, ${lib.getExe invokeIfNotRunningAndToggleWorkspace}"
) keys)
))
lib.flatten
];
windowrulev2 = lib.pipe scratchpads [
(map ({ class, size, ... }: [
"workspace special:${class}Ws, class:^(${class})$"
"float, class:^${class}$"
"size ${toString size.w}% ${toString size.h}%, class:^(${class})$"
"move ${toString ((100 - size.w) / 2)}% ${toString ((100 - size.h) / 2)}%, class:^(${class})$"
]))
lib.flatten
];
};
};
}

View File

@@ -1,41 +0,0 @@
{ config, lib, ... }:
let
cfg = config.wayland.windowManager.hyprland;
in
{
config = lib.mkIf cfg.enable {
wayland.windowManager.hyprland.settings.windowrulev2 = [
"float, class:^(Rofi)$"
"float, class:^(xdg-desktop-portal-gtk)$"
"float, title:^(.*Bitwarden Password Manager.*)$"
"float, title:^(Picture-in-Picture)$"
"tile, class:^(Nsxiv)$"
"float, class: ^(Gimp-2.*)$, title:^(Open Image)$"
"size 70%, class: ^(Gimp-2.*)$, title:^(Open Image)$"
"center, class: ^(Gimp-2.*)$, title:^(Open Image)$"
"dimaround, class:^(xdg-desktop-portal-gtk)$"
"workspace special silent, title:^(Firefox Sharing Indicator)$"
"workspace special silent, title:^(Zen Sharing Indicator)$"
"workspace special silent, title:^(.*is sharing (your screen|a window)\.)$"
"workspace 2, class:^(firefox)$"
"workspace 2, class:^(chromium)$"
"workspace 3, class:^(Emacs)$"
"workspace 3, class:^(code)$"
"workspace 3, class:^(code-url-handler)$"
"workspace 3, class:^(dev.zed.Zed)$"
"workspace 5, class:^(discord)$"
"workspace 5, class:^(Element)$"
"float, class:^(xdg-desktop-portal-termfilechooser)$"
"float, class:^(anyrun)$"
"size 70% 80%, class:^(xdg-desktop-portal-termfilechooser)$"
"move 15% 10%, class:^(xdg-desktop-portal-termfilechooser)$"
];
};
}

View File

@@ -1,34 +0,0 @@
{ config, pkgs, lib, ... }:
let
cfg = config.wayland.windowManager.hyprland;
in {
config = lib.mkIf cfg.enable {
xdg.portal = {
xdgOpenUsePortal = true;
configPackages = with pkgs; [ gnome-session ];
extraPortals = with pkgs; [
gnome-keyring
xdg-desktop-portal-gtk
xdg-desktop-portal-termfilechooser
];
config.hyprland = {
default = "hyprland;gtk;";
"org.freedesktop.impl.portal.FileChooser" = [ "termfilechooser" ];
"org.freedesktop.impl.portal.OpenURI" = [ "gtk" ];
"org.freedesktop.impl.portal.Notification" = [ "gtk" ];
"org.freedesktop.impl.portal.Secret" = [ "gnome-keyring" ];
};
};
xdg.configFile."xdg-desktop-portal-termfilechooser/config".source =
(pkgs.formats.ini { listsAsDuplicateKeys = true; }).generate "xdg-desktop-portal-termfilechooser.ini" {
filechooser = {
cmd = "${pkgs.xdg-desktop-portal-termfilechooser}/share/xdg-desktop-portal-termfilechooser/yazi-wrapper.sh";
default_dir = "$HOME";
env = [
"TERMCMD=alacritty -T \"Filechooser\" --class \"xdg-desktop-portal-termfilechooser\" --command"
];
};
};
};
}

View File

@@ -1,4 +1,4 @@
{ ... }:
{
programs.jq = { };
programs.jq.enable = true;
}

View File

@@ -1,7 +1,8 @@
{ config, ... }:
{
programs.less = {
config = ''
enable = true;
keys = ''
#env
LESS = -i -R
LESSHISTSIZE=20000

View File

@@ -1,6 +1,7 @@
{ ... }:
{
programs.man = {
enable = true;
generateCaches = true;
};
}
}

View File

@@ -1,8 +0,0 @@
{ pkgs, ... }:
{
programs.meli = {
package = pkgs.meli.overrideAttrs {
doCheck = false;
};
};
}

View File

@@ -1,6 +1,8 @@
{ config, lib, machineVars, ... }:
{
programs.mpv = {
enable = !machineVars.headless;
config = {
screenshot-directory = "${config.xdg.userDirs.pictures}/mpv-screenshots";

View File

@@ -1,6 +1,7 @@
{ config, pkgs, ... }:
{
programs.ncmpcpp = {
enable = true;
package = pkgs.ncmpcpp.override { visualizerSupport = true; };
bindings = [

View File

@@ -1,39 +0,0 @@
{ config, lib, ... }:
let
cfg = config.programs.neomutt;
in lib.mkIf cfg.enable {
programs.neomutt = {
vimKeys = true;
sidebar.enable = true;
settings = {
debug_file = "${config.xdg.dataHome}/neomutt/debug0";
history_file = "${config.xdg.dataHome}/neomutt/history";
mailcap_path = "${config.xdg.configHome}/neomutt/mailcap";
# header_cache = "${config.xdg.cacheHome}/neomutt/headers";
# message_cache_dir = "${config.xdg.cacheHome}/neomutt/messages";
news_cache_dir = "${config.xdg.cacheHome}/neomutt/news";
tmp_dir = "/run/user/${toString config.home.uid}/neomutt";
alias_file = "${config.xdg.dataHome}/neomutt/aliases";
};
extraConfig = ''
source "${config.xdg.dataHome}/neomutt/aliases"
# vim: filetype=neomuttrc
'';
};
xdg.configFile."neomutt/mailcap".text = ''
# vim: filetype=muttrc
text/plain; nvim %s
#PDFs
application/pdf; zathura %s pdf
#Images
image/png; feh %s
image/jpeg; feh %s
'';
}

View File

@@ -1,9 +1,8 @@
{ config, pkgs, lib, machineVars, ... }:
let
cfg = config.programs.neovim;
in
lib.mkIf cfg.enable {
{ pkgs, lib, machineVars, ... }:
{
programs.neovim = {
enable = true;
auto-clean-swapfiles.enable = true;
viAlias = true;

View File

@@ -2,14 +2,19 @@
let
cfg = config.programs.newsboat;
defaultBrowser = "firefox %u";
# package = cfg.package;
package = pkgs.newsboat;
defaultBrowser = "google-chrome-stable %u";
videoViewer = "mpv %u";
in {
imports = [ ./sources.nix ];
programs.newsboat = {
autoFetchArticles.enable = true;
autoVacuum.enable = true;
enable = true;
fetch-articles.enable = true;
vacuum.enable = true;
autoReload = true;
maxItems = 50;
@@ -69,4 +74,11 @@ in {
''
];
};
# systemd.user.slices.app-newsboat = {
# Unit = {
# Description = "Newsboat automation";
# Documentation = [ "man:newsboat(1)" ];
# };
# };
}

View File

@@ -1,6 +1,7 @@
{ ... }:
{
programs.nix-index = {
enable = true;
autoUpdateDatabase.enable = true;
};
}

View File

@@ -1,27 +1,18 @@
{ config, lib, ... }:
{ config, ... }:
{
sops = {
secrets = {
"nix/access-tokens/github" = { sopsFile = ./../../secrets/common.yaml; };
"nix/access-tokens/pvv-git" = { sopsFile = ./../../secrets/common.yaml; };
"nix/access-tokens/github" = { sopsFile = ../../secrets/common.yaml; };
"nix/access-tokens/pvv-git" = { sopsFile = ../../secrets/common.yaml; };
};
templates."nix-access-tokens.conf".content = let
inherit (config.sops) placeholder;
tokens = {
"github.com" = placeholder."nix/access-tokens/github";
"git.pvv.ntnu.no" = placeholder."nix/access-tokens/pvv-git";
};
in "access-tokens = ${lib.pipe tokens [
lib.attrsToList
(builtins.sort (p: q: p.name > q.name))
(map ({ name, value }: "${name}=${value}"))
(builtins.concatStringsSep " ")
]}";
in ''
access-tokens = github.com=${placeholder."nix/access-tokens/github"} git.pvv.ntnu.no=${placeholder."nix/access-tokens/pvv-git"}
'';
};
nix = {
enable = true;
settings.use-xdg-base-directories = true;
extraOptions = ''
!include ${config.sops.templates."nix-access-tokens.conf".path}

View File

@@ -1,4 +1,6 @@
{ ... }:
{
programs.nushell = { };
programs.nushell = {
enable = true;
};
}

View File

@@ -1,4 +0,0 @@
{ ... }:
{
programs.nyxt = { };
}

View File

@@ -1,4 +1,4 @@
{ ... }:
{ machineVars, ... }:
{
programs.obs-studio = { };
}
programs.obs-studio.enable = !machineVars.headless;
}

View File

@@ -1,4 +0,0 @@
{ ... }:
{
programs.obsidian = { };
}

View File

@@ -1,4 +1,4 @@
{ ... }:
{
programs.pandoc = { };
programs.pandoc.enable = true;
}

View File

@@ -1,6 +1,8 @@
{ pkgs, ... }:
{
programs.prism-launcher = {
enable = true;
package = pkgs.prismlauncher.override {
jdk17 = pkgs.jdk21;
};

View File

@@ -1,31 +1,24 @@
{ config, lib, pkgs, extendedLib, ... }:
let
cfg = config.programs.python;
in
{ config, pkgs, extendedLib, ... }:
{
options.programs.python.enable = lib.mkEnableOption "python";
# Python for interactive use
home.packages = [
(pkgs.python3.withPackages (pypkgs: with pypkgs; [
requests
]))
];
config = lib.mkIf cfg.enable {
# Python for interactive use
home.packages = [
(pkgs.python3.withPackages (pypkgs: with pypkgs; [
requests
]))
];
xdg.configFile."python/pyrc".text = ''
#!/usr/bin/env python3
import sys
xdg.configFile."python/pyrc".text = ''
#!/usr/bin/env python3
import sys
# You also need \x01 and \x02 to separate escape sequence, due to:
# https://stackoverflow.com/a/9468954/1147688
sys.ps1='\x01\x1b${extendedLib.termColors.front.blue "[Python]> "}\x02>>>\x01\x1b[0m\x02 ' # bright yellow
sys.ps2='\x01\x1b[1;49;31m\x02...\x01\x1b[0m\x02 ' # bright red
'';
# You also need \x01 and \x02 to separate escape sequence, due to:
# https://stackoverflow.com/a/9468954/1147688
sys.ps1='\x01\x1b${extendedLib.termColors.front.blue "[Python]> "}\x02>>>\x01\x1b[0m\x02 ' # bright yellow
sys.ps2='\x01\x1b[1;49;31m\x02...\x01\x1b[0m\x02 ' # bright red
'';
home.sessionVariables = {
PYTHONSTARTUP = "${config.xdg.configHome}/python/pyrc";
PYTHON_HISTORY = "${config.xdg.dataHome}/python_history";
};
home.sessionVariables = {
PYTHONSTARTUP = "${config.xdg.configHome}/python/pyrc";
PYTHON_HISTORY = "${config.xdg.dataHome}/python_history";
};
}

View File

@@ -1,6 +1,7 @@
{ ... }:
{
programs.qutebrowser = {
enable = true;
aliases = {};
searchEngines = {};
settings = {};

View File

@@ -1,4 +0,0 @@
{ ... }:
{
programs.rclone = { };
}

View File

@@ -1,4 +1,4 @@
{ ... }:
{
programs.ripgrep = { };
programs.ripgrep.enable = true;
}

View File

@@ -1,6 +1,8 @@
{ pkgs, ... }:
{
programs.rofi = {
enable = true;
# plugins = with pkgs; [
# rofi-emoji
# rofi-mpd

View File

@@ -1,6 +1,7 @@
{ ... }:
{
programs.skim = {
enable = true;
defaultCommand = "fd --type f";
};
}

View File

@@ -1,24 +1,17 @@
{ config, lib, pkgs, ... }:
let
cfg = config.programs.sqlite;
in
{ config, pkgs, ... }:
{
options.programs.sqlite.enable = lib.mkEnableOption "sqlite";
xdg.configFile."sqlite3/sqliterc".text = ''
.bail on
.changes on
.headers on
.mode box
.nullvalue '<NULL>'
.timer on
'';
config = lib.mkIf cfg.enable {
xdg.configFile."sqlite3/sqliterc".text = ''
.bail on
.changes on
.headers on
.mode box
.nullvalue '<NULL>'
.timer on
'';
home.packages = [
pkgs.sqlite-interactive
];
home.packages = [
pkgs.sqlite-interactive
];
home.sessionVariables.SQLITE_HISTORY= "${config.xdg.dataHome}/sqlite_history";
};
home.sessionVariables.SQLITE_HISTORY= "${config.xdg.dataHome}/sqlite_history";
}

View File

@@ -1,6 +1,5 @@
{ config, lib, pkgs, ... }:
{ config, pkgs, ... }:
let
cfg = config.programs.ssh;
runtimeDir = "/run/user/${toString config.home.uid}";
controlMastersDir = "${runtimeDir}/ssh";
in
@@ -9,36 +8,32 @@ in
./home.nix
./other.nix
./pvv.nix
./kyoto-u.nix
];
config = lib.mkIf cfg.enable {
sops.secrets."ssh/secret-config" = {
mode = "0444";
sops.secrets."ssh/secret-config" = {
mode = "0444";
};
programs.ssh = {
enable = true;
includes = [
config.sops.secrets."ssh/secret-config".path
"${config.home.homeDirectory}/.ssh/mutable_config"
];
controlMaster = "auto";
controlPersist = "10m";
controlPath = "${controlMastersDir}/%n%C";
};
systemd.user.tmpfiles.settings."10-ssh" = {
${controlMastersDir}.d = {
user = config.home.username;
mode = "0700";
};
programs.ssh = {
includes = [
config.sops.secrets."ssh/secret-config".path
"${config.home.homeDirectory}/.ssh/mutable_config"
];
matchBlocks."*" = {
controlMaster = "auto";
controlPersist = "10m";
controlPath = "${controlMastersDir}/%n%C";
};
};
systemd.user.tmpfiles.settings."10-ssh" = {
${controlMastersDir}.d = {
user = config.home.username;
mode = "0700";
};
"${config.home.homeDirectory}/.ssh/mutable_config".f = {
user = config.home.username;
mode = "0600";
};
"${config.home.homeDirectory}/.ssh/mutable_config".f = {
user = config.home.username;
mode = "0600";
};
};
}

View File

@@ -1,25 +0,0 @@
{ lib, ... }:
let
default = {
user = "oysteikt";
identityFile = [ "~/.ssh/id_ed25519" ];
};
in
{
programs.ssh.matchBlocks = {
"io" = default // {
hostname = "io.kuis.kyoto-u.ac.jp";
# SOCKS proxy for access to internal web.
dynamicForwards = [{ port = 8080; }];
};
} // (lib.genAttrs [
"argo"
"procyon"
"apus"
"vega"
"leo"
] (name: default // {
hostname = "${name}.fos.kuis.kyoto-u.ac.jp";
proxyJump = "io";
}));
}

View File

@@ -11,6 +11,17 @@
hostname = "github.com";
identityFile = [ "~/.ssh/id_rsa" ];
};
"github-nordicsemi" = {
user = "git";
hostname = "github.com";
identityFile = [ "~/.ssh/id_ed25519_nordicsemi" ];
};
"bitbucket-nordicsemi" = {
user = "git";
hostname = "bitbucket.nordicsemi.no";
port = 7999;
identityFile = [ "~/.ssh/id_ed25519_nordicsemi" ];
};
"gitlab.stud.idi.ntnu.no" = {
user = "git";
proxyJump = "pvv";

View File

@@ -11,26 +11,19 @@ let # http://www.pvv.ntnu.no/pvv/Maskiner
proxyJump = lib.mkDefault null;
addressFamily = "inet";
}
"bakke"
[ "bekkalokk" "pvv-web" "pvv-wiki" "pvv-webmail" ]
[ "bicep" "pvv-databases" ]
"bikkje"
"bob"
[ "brzeczyszczykiewicz" "brez" "bokhylle" ]
"buskerud"
"dagali"
"demiurgen"
"eirin"
"georg"
"gluttony"
"ildkule"
"isvegg"
"knutsen"
"kommode"
"lupine-1"
"lupine-2"
"lupine-3"
"lupine-4"
"lupine-5"
{
names = [ "microbel" "pvv-users" "pvv-mail" ];
proxyJump = lib.mkDefault null;
@@ -38,14 +31,10 @@ let # http://www.pvv.ntnu.no/pvv/Maskiner
}
"orchid"
"shark"
"skrott"
"tallulah"
"temmie"
"tom"
"ustetind"
"venture"
"wenche"
"wegonke"
];
rootMachines = [
@@ -59,11 +48,6 @@ let # http://www.pvv.ntnu.no/pvv/Maskiner
names = [ "sleipner" "pvv-salt" ];
user = "oysteikt/admin";
}
"buskerud"
"smask"
[ "blossom" "powerpuff1" "powerpuff" ]
[ "bubbles" "powerpuff2" ]
[ "buttercup" "powerpuff3" ]
];
overrideIfNotExists = b: a: a // (builtins.removeAttrs b (builtins.attrNames a));

View File

@@ -1,9 +1,7 @@
{ config, lib, pkgs, ... }:
let
cfg = config.programs.taskwarrior;
in
lib.mkIf cfg.enable {
{ pkgs, ... }:
{
programs.taskwarrior = {
enable = true;
package = pkgs.taskwarrior3;
config = rec {
report.minimal.filter = "(status:pending or status:waiting)";

View File

@@ -1,8 +1,5 @@
{ config, pkgs, lib, ... }:
let
cfg = config.programs.tealdeer;
in
lib.mkIf cfg.enable {
{ pkgs, lib, ... }:
{
systemd.user.services.update-tldr-db = {
Unit = {
Description = "Update tealdeer database";

View File

@@ -4,5 +4,5 @@
./auto-update-tldr-db.nix
];
programs.tealdeer = { };
programs.tealdeer.enable = true;
}

View File

@@ -1,6 +1,7 @@
{ ... }:
{
programs.texlive = {
enable = true;
# packageSet = pkgs.texlive.combined.scheme-medium;
};
}
}

Some files were not shown because too many files have changed in this diff Show More