mirror of
https://github.com/nmasur/dotfiles
synced 2025-07-06 19:00:14 +00:00
running vm that mostly works
This commit is contained in:
@ -36,9 +36,11 @@ in
|
||||
|
||||
# Always clone dotfiles repository if it doesn't exist
|
||||
cloneDotfiles = config.lib.dag.entryAfter [ "writeBoundary" "loadkey" ] ''
|
||||
if [ ! -d "${cfg.path}" ]; then
|
||||
run mkdir --parents $VERBOSE_ARG $(dirname "${cfg.path}")
|
||||
run ${lib.getExe pkgs.git} clone ${cfg.repo} "${cfg.path}"
|
||||
if [ -f ~/.ssh/id_ed25519 ]; then
|
||||
if [ ! -d "${cfg.path}" ]; then
|
||||
run mkdir --parents $VERBOSE_ARG $(dirname "${cfg.path}")
|
||||
run ${lib.getExe pkgs.git} clone ${cfg.repo} "${cfg.path}"
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
@ -0,0 +1,40 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.nix-index;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.programs.nix-index.enable =
|
||||
lib.mkEnableOption "nix-index caching for command line";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
# Provides "command-not-found" options
|
||||
programs.nix-index = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
|
||||
# Create nix-index if doesn't exist
|
||||
home.activation.createNixIndex =
|
||||
let
|
||||
cacheDir = "${config.xdg.cacheHome}/nix-index";
|
||||
in
|
||||
lib.mkIf config.programs.nix-index.enable (
|
||||
config.lib.dag.entryAfter [ "writeBoundary" ] ''
|
||||
if [ ! -d ${cacheDir} ]; then
|
||||
run ${pkgs.nix-index}/bin/nix-index -f ${pkgs.path}
|
||||
fi
|
||||
''
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -90,66 +90,6 @@ in
|
||||
bind -M default \x11F nix-fzf
|
||||
'';
|
||||
|
||||
# Provides "command-not-found" options
|
||||
programs.nix-index = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
|
||||
# Create nix-index if doesn't exist
|
||||
home.activation.createNixIndex =
|
||||
let
|
||||
cacheDir = "${config.xdg.cacheHome}/nix-index";
|
||||
in
|
||||
lib.mkIf config.programs.nix-index.enable (
|
||||
config.lib.dag.entryAfter [ "writeBoundary" ] ''
|
||||
if [ ! -d ${cacheDir} ]; then
|
||||
$DRY_RUN_CMD ${pkgs.nix-index}/bin/nix-index -f ${pkgs.path}
|
||||
fi
|
||||
''
|
||||
);
|
||||
|
||||
nix = {
|
||||
|
||||
# Set channel to flake packages, used for nix-shell commands
|
||||
nixPath = [ "nixpkgs=${pkgs.path}" ];
|
||||
|
||||
# For security, only allow specific users
|
||||
settings.allowed-users = [
|
||||
"@wheel" # Anyone in the wheel group
|
||||
config.home.username # The current user
|
||||
];
|
||||
|
||||
# Enable features in Nix commands
|
||||
extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
warn-dirty = false
|
||||
'';
|
||||
|
||||
# Set automatic generation cleanup for home-manager
|
||||
gc = {
|
||||
automatic = true;
|
||||
options = "--delete-older-than 10d";
|
||||
};
|
||||
|
||||
settings = {
|
||||
|
||||
# Add community Cachix to binary cache
|
||||
# Don't use at work because blocked by corporate firewall
|
||||
builders-use-substitutes = true;
|
||||
substituters = lib.mkIf (!config.nmasur.profiles.work.enable) [
|
||||
"https://nix-community.cachix.org"
|
||||
];
|
||||
trusted-public-keys = lib.mkIf (!config.nmasur.profiles.work.enable) [
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
];
|
||||
|
||||
# Scans and hard links identical files in the store
|
||||
# Not working with macOS: https://github.com/NixOS/nix/issues/7273
|
||||
auto-optimise-store = lib.mkIf (!pkgs.stdenv.isDarwin) true;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -22,12 +22,15 @@ in
|
||||
if [ ! -d ~/.ssh ]; then
|
||||
run mkdir --parents $VERBOSE_ARG ~/.ssh/
|
||||
fi
|
||||
if [ ! -f ~/.ssh/id_ed25519 ]; then
|
||||
printf "\nEnter the seed phrase for your SSH key...\n"
|
||||
printf "\nThen press ^D when complete.\n\n"
|
||||
mkdir -p ~/.ssh/
|
||||
${pkgs.melt}/bin/melt restore ~/.ssh/id_ed25519
|
||||
printf "\n\nContinuing activation.\n\n"
|
||||
# But only load if using interactive mode
|
||||
if [[ $- == *i* ]]; then
|
||||
if [ ! -f ~/.ssh/id_ed25519 ]; then
|
||||
printf "\nEnter the seed phrase for your SSH key...\n"
|
||||
printf "\nThen press ^D when complete.\n\n"
|
||||
mkdir -p ~/.ssh/
|
||||
${pkgs.melt}/bin/melt restore ~/.ssh/id_ed25519
|
||||
printf "\n\nContinuing activation.\n\n"
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
@ -0,0 +1,62 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.services.nix;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.nmasur.presets.services.nix.enable = lib.mkEnableOption "Nix settings and presets";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
nix = {
|
||||
|
||||
# Set channel to flake packages, used for nix-shell commands
|
||||
nixPath = [ "nixpkgs=${pkgs.path}" ];
|
||||
|
||||
# For security, only allow specific users
|
||||
settings.allowed-users = [
|
||||
"@wheel" # Anyone in the wheel group
|
||||
config.home.username # The current user
|
||||
];
|
||||
|
||||
# Enable features in Nix commands
|
||||
extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
warn-dirty = false
|
||||
'';
|
||||
|
||||
# Set automatic generation cleanup for home-manager
|
||||
gc = {
|
||||
automatic = true;
|
||||
options = "--delete-older-than 10d";
|
||||
};
|
||||
|
||||
settings = {
|
||||
|
||||
# Add community Cachix to binary cache
|
||||
# Don't use at work because blocked by corporate firewall
|
||||
builders-use-substitutes = true;
|
||||
substituters = lib.mkIf (!config.nmasur.profiles.work.enable) [
|
||||
"https://nix-community.cachix.org"
|
||||
];
|
||||
trusted-public-keys = lib.mkIf (!config.nmasur.profiles.work.enable) [
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
];
|
||||
|
||||
# Scans and hard links identical files in the store
|
||||
# Not working with macOS: https://github.com/NixOS/nix/issues/7273
|
||||
auto-optimise-store = lib.mkIf (!pkgs.stdenv.isDarwin) true;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -213,6 +213,7 @@ in
|
||||
label = "%date%";
|
||||
label-foreground = config.theme.colors.base06;
|
||||
# format-background = colors.background;
|
||||
click-right = lib.getExe config.nmasur.presets.services.i3.terminal;
|
||||
};
|
||||
"module/power" = {
|
||||
type = "custom/text";
|
||||
|
@ -35,6 +35,7 @@ in
|
||||
nixpkgs.enable = lib.mkDefault true;
|
||||
};
|
||||
services = {
|
||||
nix.enable = lib.mkDefault true;
|
||||
loadkey.enable = lib.mkDefault true;
|
||||
};
|
||||
};
|
||||
|
@ -57,6 +57,7 @@ in
|
||||
fd.enable = lib.mkDefault true;
|
||||
fish.enable = lib.mkDefault true;
|
||||
fzf.enable = lib.mkDefault true;
|
||||
nix-index.enable = lib.mkDefault true;
|
||||
nixpkgs.enable = lib.mkDefault true;
|
||||
prettyping.enable = lib.mkDefault true;
|
||||
ripgrep.enable = lib.mkDefault true;
|
||||
|
Reference in New Issue
Block a user