532JIID6XB4NFSIFUA64VEBKWSEJB4AY5OUBIEFUDMWXO7UAZW2QC
{ pkgs, lib, ...}: let
gpgUpdateTty = pkgs.writeShellScript "gpgUpdateTty" ''
${pkgs.gnupg}/bin/gpg-connect-agent updatestartuptty /bye > /dev/null
'';
writeGpgWrapper = pkg: let
bin = lib.getExe pkg;
binName = lib.last (lib.splitString "/" bin);
in pkgs.writeShellScriptBin binName ''
${gpgUpdateTty}
exec ${bin} "$@"
'';
wrapForGpg = pkg: pkgs.symlinkJoin {
name = "${lib.getName pkg}-wrapped-for-gpg";
paths = [
(writeGpgWrapper pkg)
pkg
];
};
in {
nixpkgs.overlays = [
(final: prev: {
openssh-wrapped = wrapForGpg final.openssh;
git-wrapped = wrapForGpg final.git;
pijul-wrapped = wrapForGpg final.pijul;
})
];
}
{ lib }:
theme:
let
inherit (builtins) isAttrs mapAttrs concatStringsSep;
inherit (lib) flatten removePrefix;
recurse = path: f: val:
if isAttrs val then mapAttrs (n: v: recurse (path + "." + n) f v) val else f path val;
recurse' = recurse "theme";
in
theme // {
noHash = recurse' (_: color: removePrefix "#" color) theme;
}
{ callPackage }:
{
mkTheme = callPackage ./mktheme.nix { };
}
{ pkgs, ... }:
{
home.packages = [ pkgs.xplr ];
xdg.configFile."xplr/init.lua".text = ''
'';
}
{ pkgs
, lib
, config
, ...
}:
let
cfg = config.niko.dev.rust;
rustToolchain = pkgs.fenix.complete.withComponents [
"cargo"
"clippy"
"llvm-tools-preview"
"rust-analyzer-preview"
"rust-src"
"rust-std"
"rustc"
"rustfmt"
];
in
{
options.niko.dev.rust = {
enable = lib.mkEnableOption "Rust toolchain";
package = with lib; mkOption {
type = types.package;
default = rustToolchain;
description = ''
Rust toolchain package to use. It should contain all components you want to use.
By default it will use 'pkgs.fenix.complete'
so fenix overlay has to be enabled if this option isn't going to be changed.
'';
};
mold = with lib; mkOption {
type = types.bool;
default = false;
description = ''
Whether to install and configure mold as the default linker.
(May break some projects, especially when they require linking C libraries)
'';
};
lldb = with lib; mkOption {
type = types.bool;
default = true;
description = ''
Whether to install and configure LLDB.
'';
};
};
config = lib.mkIf cfg.enable
{
home.packages = [
# pkgs.bintools
cfg.package
pkgs.stdenv.cc
]
++ (lib.optional cfg.lldb pkgs.lldb)
++ (lib.optionals cfg.mold [ pkgs.clang pkgs.mold ]);
home.file = lib.mkIf cfg.mold {
".cargo/config.toml".source = (pkgs.formats.toml {}).generate "cargo-config" {
target.x86_64-unknown-linux-gnu = {
linker = "clang";
rustflags = [ "-C" "link-arg=-fuse-ld=${pkgs.mold}/bin/mold" ];
};
};
};
};
}
# Collection of all of my Home manager modules.
#
# Each module should be under `niko` option,
# followed by the folder they're located in.
# Example: niko.dev.rust
{
imports = [
./dev/rust.nix
];
}
use flake