mirror of
https://github.com/nmasur/dotfiles
synced 2025-07-06 02:40: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;
|
||||
|
@ -6,6 +6,7 @@
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (config.nmasur.settings) username;
|
||||
cfg = config.nmasur.presets.services.lightdm;
|
||||
in
|
||||
|
||||
@ -13,10 +14,10 @@ in
|
||||
|
||||
options.nmasur.presets.services.lightdm = {
|
||||
enable = lib.mkEnableOption "Lightdm display manager";
|
||||
wallpaper = {
|
||||
wallpaper = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
description = "Wallpaper background image file";
|
||||
default = "${pkgs.wallpapers}/gruvbox/road.jpg";
|
||||
default = "${pkgs.nmasur.wallpapers}/gruvbox/road.jpg";
|
||||
};
|
||||
gtk.theme = {
|
||||
name = lib.mkOption {
|
||||
@ -29,6 +30,8 @@ in
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
programs.fish.enable = lib.mkIf (config.home-manager.users.${username}.programs.fish.enable) true; # Needed for LightDM to remember username
|
||||
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
|
||||
|
@ -29,6 +29,8 @@ in
|
||||
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
users.users.${username} = {
|
||||
# Use fish by default if enabled in home-manager
|
||||
shell = lib.mkIf (config.home-manager.users.${username}.programs.fish.enable) pkgs.fish;
|
||||
|
||||
# Create a home directory for human user
|
||||
isNormalUser = lib.mkDefault true;
|
||||
@ -59,6 +61,11 @@ in
|
||||
|
||||
};
|
||||
|
||||
# Extending time for home-manager build for things like nix-index cache
|
||||
systemd.services."home-manager-${username}" = {
|
||||
serviceConfig.TimeoutStartSec = lib.mkForce "45m";
|
||||
};
|
||||
|
||||
allowUnfreePackages = config.home-manager.users.${username}.allowUnfreePackages;
|
||||
|
||||
};
|
||||
|
@ -17,6 +17,7 @@ in
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
nmasur.presets.services.kanata.enable = lib.mkDefault true;
|
||||
nmasur.presets.services.lightdm.enable = lib.mkDefault true;
|
||||
|
||||
# Mouse customization
|
||||
services.ratbagd.enable = lib.mkDefault true;
|
||||
@ -34,10 +35,11 @@ in
|
||||
};
|
||||
|
||||
# Enable touchpad support
|
||||
services.libinput.enable = true;
|
||||
services.libinput.enable = lib.mkDefault true;
|
||||
|
||||
services.xserver = {
|
||||
|
||||
enable = lib.mkDefault true;
|
||||
xkb.layout = lib.mkDefault "us";
|
||||
|
||||
# Keyboard responsiveness
|
||||
|
Reference in New Issue
Block a user