nix/flake.nix
2023-07-02 19:16:28 +09:00

80 lines
2.6 KiB
Nix

{
# INFORMATION
# When building for a system, remember to change the hostname variable below
description = "NixOS System Config";
inputs = {
# NixOS packages
stable-nixpkgs.url = "nixpkgs/nixos-23.05";
unstable-nixpkgs.url = "nixpkgs/nixos-unstable";
# Manage dotfiles in a home directory
home-manager.url = "github:nix-community/home-manager/release-23.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# Secureboot Configuration
lanzaboote.url = "github:nix-community/lanzaboote";
lanzaboote.inputs.nixpkgs.follows = "nixpkgs";
# Firefox Overlay
moz_overlay.url = "github:mozilla/nixpkgs-mozilla";
# Nix User Repository
nur.url = "github:nix-community/NUR";
# Encrypted secrets in Nix configuration files
# https://github.com/Mic92/sops-nix
sops-nix.url = "github:Mic92/sops-nix";
};
outputs = { nixpkgs, unstable, home-manager, lanzaboote, moz_overlay, nur, sops-nix, ... }@inputs:
let
# Variables - Remember to set these
hostname = "nixos-laptop";
system = "x86_64-linux";
pkgs = import stable-nixpkgs {
inherit system;
config = { allowUnfree = true; };
};
unstable = import unstable-nixpkgs {
inherit system;
config = { allowUnfree = true; };
};
lib = nixpkgs.lib;
in {
# NixOS Configuration files:
nixosConfigurations = {
# Declare a generic configuration using the $hostname variable:
${hostname} = lib.nixosSystem {
inherit system;
modules = [
# Configuration Imports
./hosts/${hostname}/hardware-configuration.nix # Hardware Configuration
./hosts/${hostname}/configuration.nix # Extra options for the host hardware configuration
./configuration.nix # Common NixOS Configuration
# Flake Imports
sops-nix.nixosModules.sops # Handle secrets
lanzaboote.nixosModules.lanzaboote # SecureBoot Configuration
nur.nixosModules.nur # NixOS User Repository
# Home Manager settings
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.albert = import ./users/albert/home.nix;
home-manager.users.root = import ./users/root/home.nix;
nixpkgs.overlays = [
moz_overlay.overlay
nur.overlay
];
}
]; # modules
}; # lib.nixosSystem - ${hostname}
}; # nixosConfiguration
};
}