mirror of
https://github.com/nmasur/dotfiles
synced 2025-03-14 16:57:06 +00:00
add generators and clean up directories
This commit is contained in:
parent
bdf163a50a
commit
a3ad019f4b
95
flake.nix
95
flake.nix
@ -300,63 +300,48 @@
|
||||
root = import ./hosts/x86_64-linux/swan/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" ];
|
||||
# }
|
||||
# )
|
||||
# ];
|
||||
# };
|
||||
|
||||
# # 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";
|
||||
# generators = {
|
||||
# arrow.aws.x86_64-linux = lib.generateImage {
|
||||
# system = "x86_64-linux";
|
||||
# format = "amazon";
|
||||
# specialArgs = { inherit (globals) hostnames; };
|
||||
# };
|
||||
# arrow.iso.x86_64-linux = lib.generateImage {
|
||||
# system = "x86_64-linux";
|
||||
# format = "iso";
|
||||
# specialArgs = { inherit (globals) hostnames; };
|
||||
# };
|
||||
# };
|
||||
|
||||
# Get the custom packages that I have placed under the nmasur namespace
|
||||
packages = lib.forAllSystems (system: lib.pkgsBySystem.${system}.nmasur);
|
||||
generators = builtins.mapAttrs (
|
||||
system: hosts:
|
||||
builtins.mapAttrs (name: module: {
|
||||
aws = lib.generateImage {
|
||||
inherit system module;
|
||||
format = "amazon";
|
||||
specialArgs = { inherit (globals) hostnames; };
|
||||
};
|
||||
iso = lib.generateImage {
|
||||
inherit system module;
|
||||
format = "iso";
|
||||
specialArgs = { inherit (globals) hostnames; };
|
||||
};
|
||||
}) hosts
|
||||
) lib.linuxHosts;
|
||||
|
||||
packages = lib.forAllSystems (
|
||||
system:
|
||||
# Get the configurations that we normally use
|
||||
{
|
||||
nixosConfigurations = nixosConfigurations.${system};
|
||||
darwinConfigurations = darwinConfigurations.${system};
|
||||
homeConfigurations = homeConfigurations.${system};
|
||||
generators = generators.${system};
|
||||
}
|
||||
//
|
||||
# Get the custom packages that I have placed under the nmasur namespace
|
||||
lib.pkgsBySystem.${system}.nmasur
|
||||
);
|
||||
|
||||
# Development environments
|
||||
devShells = lib.forAllSystems (system: {
|
||||
|
@ -102,6 +102,18 @@ lib
|
||||
|
||||
colorscheme = defaultFilesToAttrset ../colorscheme;
|
||||
|
||||
homeModule = {
|
||||
home-manager = {
|
||||
# Include home-manager config in NixOS
|
||||
sharedModules = nixFiles ../platforms/home-manager;
|
||||
# Use the system-level nixpkgs instead of Home Manager's
|
||||
useGlobalPkgs = lib.mkDefault true;
|
||||
# Install packages to /etc/profiles instead of ~/.nix-profile, useful when
|
||||
# using multiple profiles for one user
|
||||
useUserPackages = lib.mkDefault true;
|
||||
};
|
||||
};
|
||||
|
||||
buildHome =
|
||||
{
|
||||
system,
|
||||
@ -111,7 +123,7 @@ lib
|
||||
inputs.home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = pkgsBySystem.${system};
|
||||
modules = [
|
||||
../platforms/home-manager
|
||||
{ imports = (nixFiles ../platforms/home-manager); }
|
||||
module
|
||||
];
|
||||
extraSpecialArgs = {
|
||||
@ -131,7 +143,7 @@ lib
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
inputs.disko.nixosModules.disko
|
||||
inputs.wsl.nixosModules.wsl
|
||||
../platforms/nixos
|
||||
{ imports = (nixFiles ../platforms/nixos); }
|
||||
module
|
||||
{
|
||||
home-manager.extraSpecialArgs = {
|
||||
@ -150,9 +162,46 @@ lib
|
||||
modules = [
|
||||
inputs.home-manager.darwinModules.home-manager
|
||||
inputs.mac-app-util.darwinModules.default
|
||||
./platforms/nix-darwin
|
||||
{ imports = (nixFiles ../platforms/nix-darwin); }
|
||||
module
|
||||
];
|
||||
};
|
||||
|
||||
generatorOptions = {
|
||||
amazon = {
|
||||
aws.enable = true;
|
||||
};
|
||||
iso = { };
|
||||
};
|
||||
|
||||
generateImage =
|
||||
{
|
||||
system,
|
||||
module,
|
||||
format,
|
||||
specialArgs,
|
||||
}:
|
||||
inputs.nixos-generators.nixosGenerate {
|
||||
inherit system format;
|
||||
modules = [
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
inputs.disko.nixosModules.disko
|
||||
inputs.wsl.nixosModules.wsl
|
||||
{
|
||||
imports = (nixFiles ../platforms/nixos) ++ (nixFiles ../platforms/generators);
|
||||
}
|
||||
generatorOptions.${format}
|
||||
module
|
||||
{
|
||||
home-manager = {
|
||||
extraSpecialArgs = {
|
||||
inherit colorscheme;
|
||||
} // specialArgs;
|
||||
} // homeModule.home-manager;
|
||||
}
|
||||
];
|
||||
specialArgs = {
|
||||
} // specialArgs;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -11,6 +11,25 @@
|
||||
options.colors = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.str;
|
||||
description = "Attrset of base16 colorscheme key value pairs.";
|
||||
default = {
|
||||
# Nord
|
||||
base00 = "#2E3440";
|
||||
base01 = "#3B4252";
|
||||
base02 = "#434C5E";
|
||||
base03 = "#4C566A";
|
||||
base04 = "#D8DEE9";
|
||||
base05 = "#E5E9F0";
|
||||
base06 = "#ECEFF4";
|
||||
base07 = "#8FBCBB";
|
||||
base08 = "#88C0D0";
|
||||
base09 = "#81A1C1";
|
||||
base0A = "#5E81AC";
|
||||
base0B = "#BF616A";
|
||||
base0C = "#D08770";
|
||||
base0D = "#EBCB8B";
|
||||
base0E = "#A3BE8C";
|
||||
base0F = "#B48EAD";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
{
|
||||
pkgs,
|
||||
colors ? (import ../../../../../../colorscheme/nord).dark,
|
||||
colors ? null,
|
||||
terraform ? false,
|
||||
github ? false,
|
||||
kubernetes ? false,
|
||||
|
@ -14,17 +14,16 @@ in
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
# AWS settings require this
|
||||
permitRootLogin = "prohibit-password";
|
||||
nmasur.presets.services.openssh-aws.enable = lib.mkDefault true;
|
||||
|
||||
# Make sure disk size is large enough
|
||||
# https://github.com/nix-community/nixos-generators/issues/150
|
||||
amazonImage.sizeMB = 16 * 1024;
|
||||
virtualisation.diskSize = lib.mkDefault (16 * 1024); # In MB
|
||||
|
||||
boot.kernelPackages = pkgs.legacyPackages.x86_64-linux.linuxKernel.packages.linux_6_6;
|
||||
boot.loader.systemd-boot.enable = lib.mkForce false;
|
||||
boot.loader.efi.canTouchEfiVariables = lib.mkForce false;
|
||||
services.amazon-ssm-agent.enable = true;
|
||||
boot.kernelPackages = lib.mkDefault pkgs.linuxKernel.packages.linux_6_6;
|
||||
boot.loader.systemd-boot.enable = false;
|
||||
boot.loader.efi.canTouchEfiVariables = false;
|
||||
services.amazon-ssm-agent.enable = lib.mkDefault true;
|
||||
users.users.ssm-user.extraGroups = [ "wheel" ];
|
||||
|
||||
};
|
||||
|
@ -1,9 +0,0 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
imports = lib.pipe (lib.filesystem.listFilesRecursive ./.) [
|
||||
# Get only files ending in .nix
|
||||
(builtins.filter (name: lib.hasSuffix ".nix" name))
|
||||
# Remove this file
|
||||
(builtins.filter (name: name != ./default.nix))
|
||||
];
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
imports = lib.pipe (lib.filesystem.listFilesRecursive ./.) [
|
||||
# Get only files ending in .nix
|
||||
(builtins.filter (name: lib.hasSuffix ".nix" name))
|
||||
# Remove this file
|
||||
(builtins.filter (name: name != ./default.nix))
|
||||
];
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
imports = lib.pipe (lib.filesystem.listFilesRecursive ./.) [
|
||||
# Get only files ending in .nix
|
||||
(builtins.filter (name: lib.hasSuffix ".nix" name))
|
||||
# Remove this file
|
||||
(builtins.filter (name: name != ./default.nix))
|
||||
];
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
imports = lib.pipe (lib.filesystem.listFilesRecursive ./.) [
|
||||
# Get only files ending in .nix
|
||||
(builtins.filter (name: lib.hasSuffix ".nix" name))
|
||||
# Remove this file
|
||||
(builtins.filter (name: name != ./default.nix))
|
||||
];
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
# SSHD settings for AWS machines
|
||||
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.services.openssh-aws;
|
||||
in
|
||||
{
|
||||
|
||||
options.nmasur.presets.services.openssh-aws = {
|
||||
enable = lib.mkEnableOption "OpenSSH on AWS VMs";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.openssh = {
|
||||
settings = {
|
||||
# AWS settings require this
|
||||
PermitRootLogin = lib.mkForce "prohibit-password";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
@ -52,19 +52,6 @@ in
|
||||
pkgs.curl
|
||||
];
|
||||
|
||||
# Include home-manager config in NixOS
|
||||
home-manager = {
|
||||
sharedModules = [ ../../../../home-manager ];
|
||||
|
||||
# Use the system-level nixpkgs instead of Home Manager's
|
||||
useGlobalPkgs = lib.mkDefault true;
|
||||
|
||||
# Install packages to /etc/profiles instead of ~/.nix-profile, useful when
|
||||
# using multiple profiles for one user
|
||||
useUserPackages = lib.mkDefault true;
|
||||
|
||||
};
|
||||
|
||||
# Extending time for home-manager build for things like nix-index cache
|
||||
systemd.services."home-manager-${username}" = {
|
||||
serviceConfig.TimeoutStartSec = lib.mkForce "45m";
|
||||
|
Loading…
x
Reference in New Issue
Block a user