nix/flake.nix

110 lines
3.4 KiB
Nix
Raw Normal View History

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