2023-07-01 09:48:31 +02:00
|
|
|
{
|
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:48:31 +02:00
|
|
|
description = "NixOS System Config";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
# NixOS packages
|
2023-07-02 12:16:28 +02:00
|
|
|
unstable-nixpkgs.url = "nixpkgs/nixos-unstable";
|
2023-07-01 09:48:31 +02:00
|
|
|
|
|
|
|
# Manage dotfiles in a home directory
|
|
|
|
home-manager.url = "github:nix-community/home-manager/release-23.05";
|
2023-08-14 12:52:57 +02:00
|
|
|
home-manager.inputs.nixpkgs.follows = "unstable-nixpkgs";
|
2023-07-01 09:48:31 +02:00
|
|
|
|
|
|
|
# Secureboot Configuration
|
|
|
|
lanzaboote.url = "github:nix-community/lanzaboote";
|
2023-08-14 12:52:57 +02:00
|
|
|
lanzaboote.inputs.nixpkgs.follows = "unstable-nixpkgs";
|
2023-07-01 17:25:54 +02:00
|
|
|
|
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
|
|
|
|
2023-07-11 13:37:30 +02:00
|
|
|
# Hardware support
|
2023-08-15 09:29:39 +02:00
|
|
|
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
2023-07-11 13:37:30 +02:00
|
|
|
|
2023-07-02 11:14:32 +02:00
|
|
|
# Encrypted secrets in Nix configuration files
|
2023-08-15 11:24:07 +02:00
|
|
|
sops-nix.url = "github:Mic92/sops-nix";
|
2023-07-01 09:48:31 +02:00
|
|
|
};
|
|
|
|
|
2023-08-14 07:55:14 +02:00
|
|
|
outputs = {
|
2023-08-15 09:46:16 +02:00
|
|
|
self,
|
2023-08-14 07:55:14 +02:00
|
|
|
unstable-nixpkgs,
|
|
|
|
home-manager,
|
|
|
|
lanzaboote,
|
|
|
|
nur,
|
|
|
|
sops-nix,
|
2023-08-15 09:29:39 +02:00
|
|
|
nixos-hardware,
|
2023-08-14 07:55:14 +02:00
|
|
|
...
|
|
|
|
}@inputs:
|
2023-07-01 09:48:31 +02:00
|
|
|
let
|
2023-07-01 10:58:43 +02:00
|
|
|
# Variables - Remember to set these
|
2023-08-15 09:29:39 +02:00
|
|
|
hostname = "nixos-laptop"; # Should probably set this in a minimal configuration.nix?
|
2023-07-01 09:48:31 +02:00
|
|
|
system = "x86_64-linux";
|
2023-08-15 11:56:20 +02:00
|
|
|
hmStateVersion = "23.05";
|
2023-07-01 10:58:43 +02:00
|
|
|
|
2023-08-14 07:55:14 +02:00
|
|
|
pkgs = import unstable-nixpkgs {
|
2023-07-01 09:48:31 +02:00
|
|
|
inherit system;
|
|
|
|
config = { allowUnfree = true; };
|
|
|
|
};
|
2023-07-02 12:02:06 +02:00
|
|
|
|
2023-08-14 12:45:21 +02:00
|
|
|
lib = unstable-nixpkgs.lib;
|
2023-07-01 09:48:31 +02:00
|
|
|
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-02 13:19:58 +02:00
|
|
|
inherit system;
|
2023-07-05 06:39:53 +02:00
|
|
|
specialArgs = {
|
2023-07-12 19:10:30 +02:00
|
|
|
inherit hostname;
|
2023-07-05 06:39:53 +02:00
|
|
|
};
|
2023-07-01 09:48:31 +02:00
|
|
|
modules = [
|
2023-07-02 11:26:50 +02:00
|
|
|
# Configuration Imports
|
2023-08-15 11:24:07 +02:00
|
|
|
./configuration.nix # Common NixOS Configuration
|
2023-08-16 14:13:41 +02:00
|
|
|
./hosts/${hostname} # Hardware-specific Configuration
|
2023-07-02 07:12:03 +02:00
|
|
|
|
2023-07-02 11:26:50 +02:00
|
|
|
# Flake Imports
|
2023-07-11 13:37:30 +02:00
|
|
|
sops-nix.nixosModules.sops # Handle secrets
|
|
|
|
lanzaboote.nixosModules.lanzaboote # SecureBoot Configuration
|
|
|
|
nur.nixosModules.nur # NixOS User Repository
|
2023-07-16 10:44:45 +02:00
|
|
|
# nixos-hardware.nixosModules.lenovo-thinkpad-p1 # Thinkpad P1 hardware configuration
|
2023-07-02 11:14:32 +02:00
|
|
|
|
2023-07-02 11:26:50 +02:00
|
|
|
# Home Manager settings
|
2023-07-01 09:48:31 +02:00
|
|
|
home-manager.nixosModules.home-manager {
|
2023-08-15 11:24:07 +02:00
|
|
|
home-manager = {
|
|
|
|
useGlobalPkgs = true;
|
|
|
|
useUserPackages = true;
|
|
|
|
users.albert.imports = [
|
|
|
|
({ config, ... }: import ./users/albert/home.nix {
|
2023-08-15 11:56:20 +02:00
|
|
|
inherit config pkgs hostname hmStateVersion;
|
2023-08-15 11:24:07 +02:00
|
|
|
})
|
|
|
|
];
|
|
|
|
users.root.imports = [
|
|
|
|
({ config, ... }: import ./users/root/home.nix {
|
2023-08-15 11:56:20 +02:00
|
|
|
inherit config pkgs hostname hmStateVersion;
|
2023-08-15 11:24:07 +02:00
|
|
|
})
|
|
|
|
];
|
|
|
|
}; # home-manager
|
2023-07-01 17:25:54 +02:00
|
|
|
nixpkgs.overlays = [
|
2023-07-02 08:58:48 +02:00
|
|
|
nur.overlay
|
2023-07-01 17:25:54 +02:00
|
|
|
];
|
2023-08-14 13:37:36 +02:00
|
|
|
} # home-manager
|
2023-07-01 09:48:31 +02:00
|
|
|
]; # modules
|
2023-07-02 08:58:48 +02:00
|
|
|
}; # lib.nixosSystem - ${hostname}
|
2023-07-01 09:48:31 +02:00
|
|
|
}; # nixosConfiguration
|
2023-08-15 11:24:07 +02:00
|
|
|
}; # in
|
2023-07-01 17:25:54 +02:00
|
|
|
}
|