diff --git a/flake.nix b/flake.nix index d9f55ee..8385722 100644 --- a/flake.nix +++ b/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 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; }); }; } diff --git a/hosts/x86_64-linux/hydra/default.nix b/hosts/x86_64-linux/hydra/default.nix index a3cb5bf..3da6502 100644 --- a/hosts/x86_64-linux/hydra/default.nix +++ b/hosts/x86_64-linux/hydra/default.nix @@ -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" + ]; } diff --git a/lib/default.nix b/lib/default.nix index ae0f586..0d1b555 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -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 diff --git a/pkgs/applications/editors/neovim/nmasur/neovim/config/colors.nix b/pkgs/applications/editors/neovim/nmasur/neovim/config/colors.nix index 8377d66..11f3227 100644 --- a/pkgs/applications/editors/neovim/nmasur/neovim/config/colors.nix +++ b/pkgs/applications/editors/neovim/nmasur/neovim/config/colors.nix @@ -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; diff --git a/pkgs/applications/editors/neovim/nmasur/neovim/config/lsp.nix b/pkgs/applications/editors/neovim/nmasur/neovim/config/lsp.nix index b882ce3..ca7763f 100644 --- a/pkgs/applications/editors/neovim/nmasur/neovim/config/lsp.nix +++ b/pkgs/applications/editors/neovim/nmasur/neovim/config/lsp.nix @@ -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"; }; }; diff --git a/pkgs/applications/editors/neovim/nmasur/neovim/config/toggleterm.nix b/pkgs/applications/editors/neovim/nmasur/neovim/config/toggleterm.nix index fbd45f3..440d0e5 100644 --- a/pkgs/applications/editors/neovim/nmasur/neovim/config/toggleterm.nix +++ b/pkgs/applications/editors/neovim/nmasur/neovim/config/toggleterm.nix @@ -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 ""} ''; } diff --git a/pkgs/applications/editors/neovim/nmasur/neovim/package.nix b/pkgs/applications/editors/neovim/nmasur/neovim/package.nix index 8119dc7..52ae796 100644 --- a/pkgs/applications/editors/neovim/nmasur/neovim/package.nix +++ b/pkgs/applications/editors/neovim/nmasur/neovim/package.nix @@ -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 diff --git a/pkgs/prometheus-actual-exporter/package.nix b/pkgs/prometheus-actual-exporter/package.nix index e56f38a..86dc202 100644 --- a/pkgs/prometheus-actual-exporter/package.nix +++ b/pkgs/prometheus-actual-exporter/package.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" ''; diff --git a/platforms/generators/aws/default.nix b/platforms/generators/aws/default.nix index d33f6cd..32d8eab 100644 --- a/platforms/generators/aws/default.nix +++ b/platforms/generators/aws/default.nix @@ -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 }; } diff --git a/templates/default.nix b/templates/default.nix index 895e9cd..c17c290 100644 --- a/templates/default.nix +++ b/templates/default.nix @@ -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) ]