mirror of
https://github.com/nmasur/dotfiles
synced 2025-06-22 14:05:52 +00:00
fix: nix flake check and packages formatting
This commit is contained in:
parent
ae09296f36
commit
20fc80c259
30
flake.nix
30
flake.nix
@ -200,32 +200,36 @@
|
||||
};
|
||||
|
||||
generators = builtins.mapAttrs (
|
||||
# x86_64-linux = { arrow = ...; swan = ...; }
|
||||
system: hosts:
|
||||
builtins.mapAttrs (name: module: {
|
||||
aws = lib.generateImage {
|
||||
(lib.concatMapAttrs (name: module: {
|
||||
"${name}-aws" = lib.generateImage {
|
||||
inherit system module;
|
||||
format = "amazon";
|
||||
specialArgs = { inherit hostnames; };
|
||||
};
|
||||
iso = lib.generateImage {
|
||||
"${name}-iso" = lib.generateImage {
|
||||
inherit system module;
|
||||
format = "iso";
|
||||
specialArgs = { inherit hostnames; };
|
||||
};
|
||||
}) hosts
|
||||
) lib.linuxHosts;
|
||||
}) hosts)
|
||||
) lib.linuxHosts # x86_64-linux = { arrow = ...; swan = ...; }
|
||||
;
|
||||
|
||||
# packages =
|
||||
# lib.forSystems lib.linuxSystems (
|
||||
# system: generateImagesForHosts system // lib.pkgsBySystem.${system}.nmasur
|
||||
# )
|
||||
# // lib.forSystems lib.darwinSystems (system: lib.pkgsBySystem.${system}.nmasur);
|
||||
|
||||
packages = lib.forAllSystems (
|
||||
system:
|
||||
# Get the configurations that we normally use
|
||||
{
|
||||
inherit nixosConfigurations darwinConfigurations;
|
||||
homeConfigurations = homeConfigurations.${system};
|
||||
generators = generators.${system};
|
||||
}
|
||||
//
|
||||
# Share the custom packages that I have placed under the nmasur namespace
|
||||
lib.pkgsBySystem.${system}.nmasur
|
||||
//
|
||||
# Share generated images for each relevant host
|
||||
generators.${system}
|
||||
);
|
||||
|
||||
# Development environments
|
||||
@ -270,6 +274,6 @@
|
||||
);
|
||||
|
||||
# Templates for starting other projects quickly
|
||||
templates = (import ./templates nixpkgs.lib);
|
||||
templates = (import ./templates { inherit lib; });
|
||||
};
|
||||
}
|
||||
|
@ -31,4 +31,24 @@ rec {
|
||||
|
||||
system.stateVersion = "23.05";
|
||||
|
||||
# This is the root filesystem containing NixOS
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-label/nixos";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
# This is the boot filesystem for Grub
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-label/boot";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
# Not sure what's necessary but too afraid to remove anything
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"ahci"
|
||||
"nvme"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
];
|
||||
}
|
||||
|
@ -189,7 +189,10 @@ lib
|
||||
amazon = {
|
||||
aws.enable = true;
|
||||
};
|
||||
iso = { };
|
||||
iso = {
|
||||
nmasur.profiles.wsl.enable = lib.mkForce false;
|
||||
boot.loader.grub.enable = lib.mkForce false;
|
||||
};
|
||||
};
|
||||
|
||||
generateImage =
|
||||
@ -201,6 +204,7 @@ lib
|
||||
}:
|
||||
inputs.nixos-generators.nixosGenerate {
|
||||
inherit system format;
|
||||
pkgs = pkgsBySystem.${system};
|
||||
modules = [
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
inputs.disko.nixosModules.disko
|
||||
|
@ -9,7 +9,7 @@
|
||||
# Sets Neovim colors based on Nix colorscheme
|
||||
|
||||
options.colors = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.str;
|
||||
type = lib.types.nullOr (lib.types.attrsOf lib.types.str);
|
||||
description = "Attrset of base16 colorscheme key value pairs.";
|
||||
default = {
|
||||
# Nord
|
||||
@ -32,7 +32,7 @@
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
config = lib.mkIf (config.colors != null) {
|
||||
plugins = [ pkgs.vimPlugins.base16-nvim ];
|
||||
setup.base16-colorscheme = config.colors;
|
||||
|
||||
|
@ -8,9 +8,9 @@
|
||||
{
|
||||
|
||||
# Terraform optional because non-free
|
||||
options.terraform = lib.mkEnableOption "Whether to enable Terraform LSP";
|
||||
options.github = lib.mkEnableOption "Whether to enable GitHub features";
|
||||
options.kubernetes = lib.mkEnableOption "Whether to enable Kubernetes features";
|
||||
options.enableTerraform = lib.mkEnableOption "Whether to enable Terraform LSP";
|
||||
options.enableGithub = lib.mkEnableOption "Whether to enable GitHub features";
|
||||
options.enableKubernetes = lib.mkEnableOption "Whether to enable Kubernetes features";
|
||||
|
||||
config = {
|
||||
plugins = [
|
||||
@ -54,7 +54,7 @@
|
||||
|
||||
use.lspconfig.terraformls.setup = dsl.callWith {
|
||||
cmd =
|
||||
if config.terraform then
|
||||
if config.enableTerraform then
|
||||
[
|
||||
"${pkgs.terraform-ls}/bin/terraform-ls"
|
||||
"serve"
|
||||
@ -93,7 +93,7 @@
|
||||
nix = [ "nixfmt" ];
|
||||
rust = [ "rustfmt" ];
|
||||
sh = [ "shfmt" ];
|
||||
terraform = if config.terraform then [ "terraform_fmt" ] else [ ];
|
||||
terraform = if config.enableTerraform then [ "terraform_fmt" ] else [ ];
|
||||
hcl = [ "hcl" ];
|
||||
};
|
||||
formatters = {
|
||||
@ -110,7 +110,7 @@
|
||||
"-ci"
|
||||
];
|
||||
};
|
||||
terraform_fmt.command = if config.terraform then "${pkgs.terraform}/bin/terraform" else "";
|
||||
terraform_fmt.command = if config.enableTerraform then "${pkgs.terraform}/bin/terraform" else "";
|
||||
hcl.command = "${pkgs.hclfmt}/bin/hclfmt";
|
||||
};
|
||||
};
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
lua = ''
|
||||
${builtins.readFile ./toggleterm.lua}
|
||||
${if config.github then (builtins.readFile ./github.lua) else ""}
|
||||
${if config.kubernetes then (builtins.readFile ./kubernetes.lua) else ""}
|
||||
${if config.enableGithub then (builtins.readFile ./github.lua) else ""}
|
||||
${if config.enableKubernetes then (builtins.readFile ./kubernetes.lua) else ""}
|
||||
'';
|
||||
}
|
||||
|
@ -29,9 +29,9 @@
|
||||
{
|
||||
pkgs,
|
||||
colors ? null,
|
||||
terraform ? false,
|
||||
github ? false,
|
||||
kubernetes ? false,
|
||||
enableTerraform ? false,
|
||||
enableGithub ? false,
|
||||
enableKubernetes ? false,
|
||||
...
|
||||
}:
|
||||
|
||||
@ -41,9 +41,9 @@ pkgs.neovimBuilder {
|
||||
package = pkgs.neovim-unwrapped;
|
||||
inherit
|
||||
colors
|
||||
terraform
|
||||
github
|
||||
kubernetes
|
||||
enableTerraform
|
||||
enableGithub
|
||||
enableKubernetes
|
||||
;
|
||||
imports = [
|
||||
./config/align.nix
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
nodejs_18,
|
||||
nodejs_20,
|
||||
buildNpmPackage,
|
||||
nodePackages,
|
||||
python3,
|
||||
@ -29,7 +29,7 @@ buildNpmPackage (finalAttrs: rec {
|
||||
npmDepsHash = "sha256-N8xqRYFelolNGTEhG22M7KJ7B5U/uW7o+/XfLF8rHMg=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
nodejs_18
|
||||
nodejs_20
|
||||
nodePackages.typescript
|
||||
python3
|
||||
nodePackages.node-gyp
|
||||
@ -64,7 +64,7 @@ buildNpmPackage (finalAttrs: rec {
|
||||
installPhase = ''
|
||||
mkdir -p $out/{bin,lib}
|
||||
cp -r . $out/lib/prometheus-actual-exporter
|
||||
makeWrapper ${lib.getExe nodejs_18} $out/bin/prometheus-actual-exporter \
|
||||
makeWrapper ${lib.getExe nodejs_20} $out/bin/prometheus-actual-exporter \
|
||||
--add-flags "$out/lib/prometheus-actual-exporter/dist/app.js"
|
||||
'';
|
||||
|
||||
|
@ -21,10 +21,12 @@ in
|
||||
virtualisation.diskSize = lib.mkDefault (16 * 1024); # In MB
|
||||
|
||||
boot.kernelPackages = lib.mkDefault pkgs.linuxKernel.packages.linux_6_6;
|
||||
boot.loader.systemd-boot.enable = false;
|
||||
boot.loader.efi.canTouchEfiVariables = false;
|
||||
boot.loader.systemd-boot.enable = lib.mkForce false;
|
||||
boot.loader.efi.canTouchEfiVariables = lib.mkForce false; # Default, conflicts with tempest
|
||||
services.amazon-ssm-agent.enable = lib.mkDefault true;
|
||||
users.users.ssm-user.extraGroups = [ "wheel" ];
|
||||
|
||||
services.udisks2.enable = lib.mkForce false; # Off by default already; conflicts with gvfs for nautilus
|
||||
boot.loader.grub.device = lib.mkForce "/dev/xvda"; # Default, conflicts with tempest
|
||||
boot.loader.grub.efiSupport = lib.mkForce false; # Default, conflicts with tempest
|
||||
};
|
||||
}
|
||||
|
@ -6,14 +6,13 @@ lib.pipe (lib.filesystem.listFilesRecursive ./.) [
|
||||
# Get only files ending in flake.nix
|
||||
(builtins.filter (name: lib.hasSuffix "flake.nix" name))
|
||||
# Import each template function
|
||||
map
|
||||
(file: rec {
|
||||
(map (file: rec {
|
||||
name = builtins.baseNameOf (builtins.dirOf file);
|
||||
value = {
|
||||
path = builtins.dirOf file;
|
||||
description = "${name} template";
|
||||
};
|
||||
})
|
||||
}))
|
||||
# Convert to an attrset of template name -> template path and description
|
||||
(builtins.listToAttrs)
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user