templates/system/flake.nix

88 lines
2.5 KiB
Nix
Raw Normal View History

{
description = "A system flake with various options for bootstrapping a complete Aux install.";
inputs = {
# Import Auxolotl libs
auxlib.url = "https://git.auxolotl.org/auxolotl/labs/archive/main.tar.gz?dir=lib";
# Flatpak support
nix-flatpak.url = "github:gmodena/nix-flatpak/v0.4.1";
# Import the desired Nixpkgs repo. Defaults to unstable.
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
# SecureBoot support
lanzaboote.url = "github:nix-community/lanzaboote/v0.4.0";
# NixOS hardware quirks
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
# Add Home-manager support
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs@{
self,
auxlib,
home-manager,
lanzaboote,
nix-flatpak,
nixos-hardware,
nixpkgs,
...
}:
let
forAllSystems =
function:
nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
] (system: function nixpkgs.legacyPackages.${system});
baseModules = [
./modules/autoimport.nix
home-manager.nixosModules.home-manager
lanzaboote.nixosModules.lanzaboote
nix-flatpak.nixosModules.nix-flatpak
# Set global home-manager settings
{
home-manager = {
/*
When running, Home Manager will use the global package cache.
It will also back up any files that it would otherwise overwrite.
The originals will have the extension ".home-manager_backup".
*/
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "home-manager_backup";
};
}
];
###*** IMPORTANT: Please set your system's hostname here ***###
hostName = builtins.abort "Please set the hostName variable in flake.nix";
in
{
nixosConfigurations."${hostName}" = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs;
};
modules = baseModules ++ [
{ networking.hostName = hostName; }
./host/configuration.nix
# NixOS-Hardware
# Add your model from this list: https://github.com/NixOS/nixos-hardware/blob/master/flake.nix
# nixos-hardware.nixosModules.framework-13th-gen-intel
];
};
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
};
}