mirror of
https://github.com/nmasur/dotfiles
synced 2025-06-22 18:47:58 +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 (
|
generators = builtins.mapAttrs (
|
||||||
|
# x86_64-linux = { arrow = ...; swan = ...; }
|
||||||
system: hosts:
|
system: hosts:
|
||||||
builtins.mapAttrs (name: module: {
|
(lib.concatMapAttrs (name: module: {
|
||||||
aws = lib.generateImage {
|
"${name}-aws" = lib.generateImage {
|
||||||
inherit system module;
|
inherit system module;
|
||||||
format = "amazon";
|
format = "amazon";
|
||||||
specialArgs = { inherit hostnames; };
|
specialArgs = { inherit hostnames; };
|
||||||
};
|
};
|
||||||
iso = lib.generateImage {
|
"${name}-iso" = lib.generateImage {
|
||||||
inherit system module;
|
inherit system module;
|
||||||
format = "iso";
|
format = "iso";
|
||||||
specialArgs = { inherit hostnames; };
|
specialArgs = { inherit hostnames; };
|
||||||
};
|
};
|
||||||
}) hosts
|
}) hosts)
|
||||||
) lib.linuxHosts;
|
) 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 (
|
packages = lib.forAllSystems (
|
||||||
system:
|
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
|
# Share the custom packages that I have placed under the nmasur namespace
|
||||||
lib.pkgsBySystem.${system}.nmasur
|
lib.pkgsBySystem.${system}.nmasur
|
||||||
|
//
|
||||||
|
# Share generated images for each relevant host
|
||||||
|
generators.${system}
|
||||||
);
|
);
|
||||||
|
|
||||||
# Development environments
|
# Development environments
|
||||||
@ -270,6 +274,6 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
# Templates for starting other projects quickly
|
# 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";
|
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 = {
|
amazon = {
|
||||||
aws.enable = true;
|
aws.enable = true;
|
||||||
};
|
};
|
||||||
iso = { };
|
iso = {
|
||||||
|
nmasur.profiles.wsl.enable = lib.mkForce false;
|
||||||
|
boot.loader.grub.enable = lib.mkForce false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
generateImage =
|
generateImage =
|
||||||
@ -201,6 +204,7 @@ lib
|
|||||||
}:
|
}:
|
||||||
inputs.nixos-generators.nixosGenerate {
|
inputs.nixos-generators.nixosGenerate {
|
||||||
inherit system format;
|
inherit system format;
|
||||||
|
pkgs = pkgsBySystem.${system};
|
||||||
modules = [
|
modules = [
|
||||||
inputs.home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
inputs.disko.nixosModules.disko
|
inputs.disko.nixosModules.disko
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
# Sets Neovim colors based on Nix colorscheme
|
# Sets Neovim colors based on Nix colorscheme
|
||||||
|
|
||||||
options.colors = lib.mkOption {
|
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.";
|
description = "Attrset of base16 colorscheme key value pairs.";
|
||||||
default = {
|
default = {
|
||||||
# Nord
|
# Nord
|
||||||
@ -32,7 +32,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = lib.mkIf (config.colors != null) {
|
||||||
plugins = [ pkgs.vimPlugins.base16-nvim ];
|
plugins = [ pkgs.vimPlugins.base16-nvim ];
|
||||||
setup.base16-colorscheme = config.colors;
|
setup.base16-colorscheme = config.colors;
|
||||||
|
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
{
|
{
|
||||||
|
|
||||||
# Terraform optional because non-free
|
# Terraform optional because non-free
|
||||||
options.terraform = lib.mkEnableOption "Whether to enable Terraform LSP";
|
options.enableTerraform = lib.mkEnableOption "Whether to enable Terraform LSP";
|
||||||
options.github = lib.mkEnableOption "Whether to enable GitHub features";
|
options.enableGithub = lib.mkEnableOption "Whether to enable GitHub features";
|
||||||
options.kubernetes = lib.mkEnableOption "Whether to enable Kubernetes features";
|
options.enableKubernetes = lib.mkEnableOption "Whether to enable Kubernetes features";
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
plugins = [
|
plugins = [
|
||||||
@ -54,7 +54,7 @@
|
|||||||
|
|
||||||
use.lspconfig.terraformls.setup = dsl.callWith {
|
use.lspconfig.terraformls.setup = dsl.callWith {
|
||||||
cmd =
|
cmd =
|
||||||
if config.terraform then
|
if config.enableTerraform then
|
||||||
[
|
[
|
||||||
"${pkgs.terraform-ls}/bin/terraform-ls"
|
"${pkgs.terraform-ls}/bin/terraform-ls"
|
||||||
"serve"
|
"serve"
|
||||||
@ -93,7 +93,7 @@
|
|||||||
nix = [ "nixfmt" ];
|
nix = [ "nixfmt" ];
|
||||||
rust = [ "rustfmt" ];
|
rust = [ "rustfmt" ];
|
||||||
sh = [ "shfmt" ];
|
sh = [ "shfmt" ];
|
||||||
terraform = if config.terraform then [ "terraform_fmt" ] else [ ];
|
terraform = if config.enableTerraform then [ "terraform_fmt" ] else [ ];
|
||||||
hcl = [ "hcl" ];
|
hcl = [ "hcl" ];
|
||||||
};
|
};
|
||||||
formatters = {
|
formatters = {
|
||||||
@ -110,7 +110,7 @@
|
|||||||
"-ci"
|
"-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";
|
hcl.command = "${pkgs.hclfmt}/bin/hclfmt";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
lua = ''
|
lua = ''
|
||||||
${builtins.readFile ./toggleterm.lua}
|
${builtins.readFile ./toggleterm.lua}
|
||||||
${if config.github then (builtins.readFile ./github.lua) else ""}
|
${if config.enableGithub then (builtins.readFile ./github.lua) else ""}
|
||||||
${if config.kubernetes then (builtins.readFile ./kubernetes.lua) else ""}
|
${if config.enableKubernetes then (builtins.readFile ./kubernetes.lua) else ""}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,9 @@
|
|||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
colors ? null,
|
colors ? null,
|
||||||
terraform ? false,
|
enableTerraform ? false,
|
||||||
github ? false,
|
enableGithub ? false,
|
||||||
kubernetes ? false,
|
enableKubernetes ? false,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -41,9 +41,9 @@ pkgs.neovimBuilder {
|
|||||||
package = pkgs.neovim-unwrapped;
|
package = pkgs.neovim-unwrapped;
|
||||||
inherit
|
inherit
|
||||||
colors
|
colors
|
||||||
terraform
|
enableTerraform
|
||||||
github
|
enableGithub
|
||||||
kubernetes
|
enableKubernetes
|
||||||
;
|
;
|
||||||
imports = [
|
imports = [
|
||||||
./config/align.nix
|
./config/align.nix
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
fetchFromGitHub,
|
fetchFromGitHub,
|
||||||
nodejs_18,
|
nodejs_20,
|
||||||
buildNpmPackage,
|
buildNpmPackage,
|
||||||
nodePackages,
|
nodePackages,
|
||||||
python3,
|
python3,
|
||||||
@ -29,7 +29,7 @@ buildNpmPackage (finalAttrs: rec {
|
|||||||
npmDepsHash = "sha256-N8xqRYFelolNGTEhG22M7KJ7B5U/uW7o+/XfLF8rHMg=";
|
npmDepsHash = "sha256-N8xqRYFelolNGTEhG22M7KJ7B5U/uW7o+/XfLF8rHMg=";
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
nodejs_18
|
nodejs_20
|
||||||
nodePackages.typescript
|
nodePackages.typescript
|
||||||
python3
|
python3
|
||||||
nodePackages.node-gyp
|
nodePackages.node-gyp
|
||||||
@ -64,7 +64,7 @@ buildNpmPackage (finalAttrs: rec {
|
|||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/{bin,lib}
|
mkdir -p $out/{bin,lib}
|
||||||
cp -r . $out/lib/prometheus-actual-exporter
|
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"
|
--add-flags "$out/lib/prometheus-actual-exporter/dist/app.js"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -21,10 +21,12 @@ in
|
|||||||
virtualisation.diskSize = lib.mkDefault (16 * 1024); # In MB
|
virtualisation.diskSize = lib.mkDefault (16 * 1024); # In MB
|
||||||
|
|
||||||
boot.kernelPackages = lib.mkDefault pkgs.linuxKernel.packages.linux_6_6;
|
boot.kernelPackages = lib.mkDefault pkgs.linuxKernel.packages.linux_6_6;
|
||||||
boot.loader.systemd-boot.enable = false;
|
boot.loader.systemd-boot.enable = lib.mkForce false;
|
||||||
boot.loader.efi.canTouchEfiVariables = false;
|
boot.loader.efi.canTouchEfiVariables = lib.mkForce false; # Default, conflicts with tempest
|
||||||
services.amazon-ssm-agent.enable = lib.mkDefault true;
|
services.amazon-ssm-agent.enable = lib.mkDefault true;
|
||||||
users.users.ssm-user.extraGroups = [ "wheel" ];
|
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
|
# Get only files ending in flake.nix
|
||||||
(builtins.filter (name: lib.hasSuffix "flake.nix" name))
|
(builtins.filter (name: lib.hasSuffix "flake.nix" name))
|
||||||
# Import each template function
|
# Import each template function
|
||||||
map
|
(map (file: rec {
|
||||||
(file: rec {
|
|
||||||
name = builtins.baseNameOf (builtins.dirOf file);
|
name = builtins.baseNameOf (builtins.dirOf file);
|
||||||
value = {
|
value = {
|
||||||
path = builtins.dirOf file;
|
path = builtins.dirOf file;
|
||||||
description = "${name} template";
|
description = "${name} template";
|
||||||
};
|
};
|
||||||
})
|
}))
|
||||||
# Convert to an attrset of template name -> template path and description
|
# Convert to an attrset of template name -> template path and description
|
||||||
(builtins.listToAttrs)
|
(builtins.listToAttrs)
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user