nix/flake.nix

78 lines
2.3 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
2023-07-01 09:56:25 +02:00
description = "NixOS System Config";
inputs = {
# NixOS packages
nixpkgs.url = "nixpkgs/nixos-23.05";
# 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";
};
outputs = { nixpkgs, home-manager, lanzaboote, ... }:
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
pkgs = import nixpkgs {
# Tells Flake what OS version we are using
inherit system;
config = { allowUnfree = true; };
};
2023-07-01 10:59:46 +02:00
networking.hostname = "${hostname}";
lib = nixpkgs.lib;
in {
# Set up users with home-manager
homeManagerConfigurations = {
# Configuration for user "Albert"
albert = home-manager.lib.homeManagerConfiguration {
inherit system pkgs;
username = "albert";
homeDirectory = "/home/albert";
2023-07-01 09:54:42 +02:00
configuration.imports = [ ./users/albert/home.nix ];
};
# Configuration for user "root"
root = home-manager.lib.homeManagerConfiguration {
inherit system pkgs;
username = "root";
homeDirectory = "/root";
2023-07-01 10:58:43 +02:00
configuration.imports = [ ./users/root/home.nix ];
};
};
# NixOS Configuration files:
nixosConfigurations = {
2023-07-01 10:01:10 +02:00
# Declare the configuration for my laptop
2023-07-01 11:07:17 +02:00
nixos-p1 = lib.nixosSystem {
2023-07-01 10:23:32 +02:00
inherit system;
modules = [
# Hardware Configuration
2023-07-01 11:08:13 +02:00
./hosts/+"/"+${hostname}+/hardware-configuration.nix
./hosts/+"/"+${hostname}+/configuration.nix
# SecureBoot Configuration
lanzaboote.nixosModules.lanzaboote
2023-07-01 10:23:32 +02:00
# Common NixOS Configuration file
./configuration.nix
# Tell home-manager to use both global and user packages:
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
]; # modules
}; # lib.nixosSystem - nixos-laptop
}; # nixosConfiguration
};
}