mirror of
https://github.com/nmasur/dotfiles
synced 2025-03-14 12:17:05 +00:00
running vm that mostly works
This commit is contained in:
parent
1b05fa3745
commit
cd0b7debd4
112
flake.nix
112
flake.nix
@ -344,8 +344,6 @@
|
||||
darwinModules = aarch64-darwin-hosts;
|
||||
|
||||
inherit buildDarwin pkgsBySystem;
|
||||
# buildDarwin = buildDarwin;
|
||||
# pkgsBySystem = pkgsBySystem;
|
||||
|
||||
# Contains my full system builds, including home-manager
|
||||
# nixos-rebuild switch --flake .#tempest
|
||||
@ -390,60 +388,64 @@
|
||||
root = import ./disks/root.nix;
|
||||
};
|
||||
|
||||
packages =
|
||||
let
|
||||
staff =
|
||||
system:
|
||||
import ./hosts/staff {
|
||||
inherit
|
||||
inputs
|
||||
globals
|
||||
overlays
|
||||
system
|
||||
;
|
||||
};
|
||||
neovim =
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system overlays; };
|
||||
in
|
||||
import ./modules/common/neovim/package {
|
||||
inherit pkgs;
|
||||
colors = (import ./colorscheme/gruvbox-dark).dark;
|
||||
};
|
||||
in
|
||||
{
|
||||
x86_64-linux.staff = staff "x86_64-linux";
|
||||
x86_64-linux.arrow = inputs.nixos-generators.nixosGenerate rec {
|
||||
system = "x86_64-linux";
|
||||
format = "iso";
|
||||
modules = import ./hosts/arrow/modules.nix { inherit inputs globals overlays; };
|
||||
};
|
||||
x86_64-linux.arrow-aws = inputs.nixos-generators.nixosGenerate rec {
|
||||
system = "x86_64-linux";
|
||||
format = "amazon";
|
||||
modules = import ./hosts/arrow/modules.nix { inherit inputs globals overlays; } ++ [
|
||||
(
|
||||
{ ... }:
|
||||
{
|
||||
boot.kernelPackages = inputs.nixpkgs.legacyPackages.x86_64-linux.linuxKernel.packages.linux_6_6;
|
||||
amazonImage.sizeMB = 16 * 1024;
|
||||
permitRootLogin = "prohibit-password";
|
||||
boot.loader.systemd-boot.enable = inputs.nixpkgs.lib.mkForce false;
|
||||
boot.loader.efi.canTouchEfiVariables = inputs.nixpkgs.lib.mkForce false;
|
||||
services.amazon-ssm-agent.enable = true;
|
||||
users.users.ssm-user.extraGroups = [ "wheel" ];
|
||||
}
|
||||
)
|
||||
];
|
||||
};
|
||||
# packages =
|
||||
# let
|
||||
# staff =
|
||||
# system:
|
||||
# import ./hosts/staff {
|
||||
# inherit
|
||||
# inputs
|
||||
# globals
|
||||
# overlays
|
||||
# system
|
||||
# ;
|
||||
# };
|
||||
# neovim =
|
||||
# system:
|
||||
# let
|
||||
# pkgs = import nixpkgs { inherit system overlays; };
|
||||
# in
|
||||
# import ./modules/common/neovim/package {
|
||||
# inherit pkgs;
|
||||
# colors = (import ./colorscheme/gruvbox-dark).dark;
|
||||
# };
|
||||
# in
|
||||
# {
|
||||
# x86_64-linux.staff = staff "x86_64-linux";
|
||||
# x86_64-linux.arrow = inputs.nixos-generators.nixosGenerate rec {
|
||||
# system = "x86_64-linux";
|
||||
# format = "iso";
|
||||
# modules = import ./hosts/arrow/modules.nix { inherit inputs globals overlays; };
|
||||
# };
|
||||
# x86_64-linux.arrow-aws = inputs.nixos-generators.nixosGenerate rec {
|
||||
# system = "x86_64-linux";
|
||||
# format = "amazon";
|
||||
# modules = import ./hosts/arrow/modules.nix { inherit inputs globals overlays; } ++ [
|
||||
# (
|
||||
# { ... }:
|
||||
# {
|
||||
# boot.kernelPackages = inputs.nixpkgs.legacyPackages.x86_64-linux.linuxKernel.packages.linux_6_6;
|
||||
# amazonImage.sizeMB = 16 * 1024;
|
||||
# permitRootLogin = "prohibit-password";
|
||||
# boot.loader.systemd-boot.enable = inputs.nixpkgs.lib.mkForce false;
|
||||
# boot.loader.efi.canTouchEfiVariables = inputs.nixpkgs.lib.mkForce false;
|
||||
# services.amazon-ssm-agent.enable = true;
|
||||
# users.users.ssm-user.extraGroups = [ "wheel" ];
|
||||
# }
|
||||
# )
|
||||
# ];
|
||||
# };
|
||||
|
||||
# Package Neovim config into standalone package
|
||||
x86_64-linux.neovim = neovim "x86_64-linux";
|
||||
x86_64-darwin.neovim = neovim "x86_64-darwin";
|
||||
aarch64-linux.neovim = neovim "aarch64-linux";
|
||||
aarch64-darwin.neovim = neovim "aarch64-darwin";
|
||||
};
|
||||
# # Package Neovim config into standalone package
|
||||
# x86_64-linux.neovim = neovim "x86_64-linux";
|
||||
# x86_64-darwin.neovim = neovim "x86_64-darwin";
|
||||
# aarch64-linux.neovim = neovim "aarch64-linux";
|
||||
# aarch64-darwin.neovim = neovim "aarch64-darwin";
|
||||
# };
|
||||
|
||||
mypackages = forAllSystems (system: pkgsBySystem.${system}.nmasur);
|
||||
|
||||
packages = mypackages;
|
||||
|
||||
# Programs that can be run by calling this flake
|
||||
apps = forAllSystems (
|
||||
|
@ -16,6 +16,19 @@ rec {
|
||||
gui.enable = true;
|
||||
};
|
||||
nmasur.presets.services.cloudflared.enable = false;
|
||||
nmasur.presets.services.kanata.enable = false;
|
||||
nmasur.presets.services.openssh.enable = true;
|
||||
|
||||
virtualisation.vmVariant = {
|
||||
home-manager.users."noah".nmasur.presets.programs.nix-index.enable = false;
|
||||
virtualisation.forwardPorts = [
|
||||
{
|
||||
from = "host";
|
||||
host.port = 2222;
|
||||
guest.port = 22;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
home-manager.users."noah" = {
|
||||
nmasur.settings = {
|
||||
|
@ -1,16 +1,6 @@
|
||||
_inputs: _final: prev:
|
||||
|
||||
let
|
||||
# TODO: Remove
|
||||
# listToAttrsByField =
|
||||
# field: list:
|
||||
# builtins.listToAttrs (
|
||||
# map (v: {
|
||||
# name = v.${field};
|
||||
# value = v;
|
||||
# }) list
|
||||
# );
|
||||
|
||||
listToAttrsByPnameOrName =
|
||||
list:
|
||||
builtins.listToAttrs (
|
||||
@ -20,7 +10,6 @@ let
|
||||
}) list
|
||||
);
|
||||
lib = prev.lib;
|
||||
# packagesDirectory = lib.filesystem.listFilesRecursive ../pkgs;
|
||||
# [ package1/package.nix package2/package.nix package2/hello.sh ]
|
||||
packages = lib.pipe (lib.filesystem.listFilesRecursive ../pkgs) [
|
||||
# Get only files called package.nix
|
||||
|
@ -1,7 +1,6 @@
|
||||
# Clipboard over SSH
|
||||
|
||||
{
|
||||
lib,
|
||||
buildGoModule,
|
||||
fetchFromGitHub,
|
||||
...
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user