nix/flake.nix

83 lines
2.7 KiB
Nix
Raw Normal View History

{
2023-07-01 09:54:42 +02:00
# INFORMATION
# When building for a system, remember to change the hostname variable below
description = "NixOS System Config";
inputs = {
# NixOS packages
2023-07-02 12:16:28 +02:00
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";
2023-07-02 12:16:42 +02:00
home-manager.inputs.nixpkgs.follows = "stable-nixpkgs";
# Secureboot Configuration
lanzaboote.url = "github:nix-community/lanzaboote";
2023-07-02 12:16:42 +02:00
lanzaboote.inputs.nixpkgs.follows = "stable-nixpkgs";
2023-07-01 17:25:54 +02:00
# Firefox Overlay
moz_overlay.url = "github:mozilla/nixpkgs-mozilla";
2023-07-02 07:12:03 +02:00
# Nix User Repository
nur.url = "github:nix-community/NUR";
2023-07-02 11:14:32 +02:00
# Encrypted secrets in Nix configuration files
2023-07-02 11:21:05 +02:00
# https://github.com/Mic92/sops-nix
sops-nix.url = "github:Mic92/sops-nix";
2023-07-02 11:14:32 +02:00
};
2023-07-02 12:17:32 +02:00
outputs = { stable-nixpkgs, unstable-nixpkgs, home-manager, lanzaboote, moz_overlay, nur, sops-nix, ... }@inputs:
let
2023-07-01 10:58:43 +02:00
# Variables - Remember to set these
2023-07-01 10:02:43 +02:00
hostname = "nixos-laptop";
system = "x86_64-linux";
2023-07-01 10:58:43 +02:00
2023-07-02 12:16:28 +02:00
pkgs = import stable-nixpkgs {
inherit system;
config = { allowUnfree = true; };
};
2023-07-02 12:02:06 +02:00
2023-07-02 12:16:28 +02:00
unstable = import unstable-nixpkgs {
2023-07-02 12:02:06 +02:00
inherit system;
config = { allowUnfree = true; };
};
2023-07-02 12:17:32 +02:00
lib = stable-nixpkgs.lib;
2023-07-02 12:18:38 +02:00
unstable-lib = unstable-nixpkgs.lib;
in {
# NixOS Configuration files:
nixosConfigurations = {
2023-07-01 11:40:59 +02:00
# Declare a generic configuration using the $hostname variable:
2023-07-01 11:39:31 +02:00
${hostname} = lib.nixosSystem {
2023-07-01 10:23:32 +02:00
inherit system;
2023-07-02 12:27:05 +02:00
specialArgs = { inherit unstable; };
modules = [
2023-07-02 11:26:50 +02:00
# 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
2023-07-02 07:12:03 +02:00
2023-07-02 11:26:50 +02:00
# Flake Imports
sops-nix.nixosModules.sops # Handle secrets
lanzaboote.nixosModules.lanzaboote # SecureBoot Configuration
nur.nixosModules.nur # NixOS User Repository
2023-07-02 11:14:32 +02:00
2023-07-02 11:26:50 +02:00
# Home Manager settings
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
2023-07-01 11:58:38 +02:00
home-manager.users.albert = import ./users/albert/home.nix;
home-manager.users.root = import ./users/root/home.nix;
2023-07-01 17:25:54 +02:00
nixpkgs.overlays = [
moz_overlay.overlay
2023-07-02 08:58:48 +02:00
nur.overlay
2023-07-01 17:25:54 +02:00
];
}
]; # modules
2023-07-02 08:58:48 +02:00
}; # lib.nixosSystem - ${hostname}
}; # nixosConfiguration
};
2023-07-01 17:25:54 +02:00
}