nixos/flake.nix

180 lines
5.2 KiB
Nix
Raw Normal View History

2023-08-19 23:40:25 +02:00
{
2023-08-20 00:48:31 +02:00
description = "NixOS configuration of MrDev023";
2023-08-19 23:40:25 +02:00
inputs = {
2024-02-17 14:56:18 +01:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
2024-10-28 20:56:56 +01:00
# Use to clean dependencies
systems.url = "github:nix-systems/default";
flake-utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};
2025-02-16 14:46:30 +01:00
nur = {
url = "github:nix-community/NUR";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-02-17 18:20:01 +01:00
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-02-19 20:17:01 +01:00
2024-04-08 01:15:52 +02:00
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
2024-10-28 20:56:56 +01:00
inputs.systems.follows = "systems";
2024-04-08 01:15:52 +02:00
};
2024-04-04 15:19:40 +02:00
nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.4.1";
2024-05-28 20:46:24 +02:00
# Follow nix-doom-emacs completely when this is merged or fixed
# - https://github.com/nix-community/nix-doom-emacs/issues/409
# - https://github.com/nix-community/nix-straight.el/pull/4
nix-straight = {
url = "github:codingkoi/nix-straight.el?ref=codingkoi/apply-librephoenixs-fix";
flake = false;
};
nix-doom-emacs = {
url = "github:nix-community/nix-doom-emacs";
2024-10-28 20:56:56 +01:00
inputs.nix-straight.follows = "nix-straight";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
2024-10-28 20:51:27 +01:00
};
# To use nixos program on others distros
nixgl = {
url = "github:nix-community/nixGL";
2024-10-28 20:56:56 +01:00
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
2024-05-28 20:46:24 +02:00
};
2025-01-03 23:51:19 +01:00
lanzaboote = {
2025-01-25 01:05:37 +01:00
url = "github:nix-community/lanzaboote/v0.4.2";
2025-01-03 23:51:19 +01:00
inputs.nixpkgs.follows = "nixpkgs";
};
2025-01-29 22:15:35 +01:00
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
2025-02-11 23:20:42 +01:00
nvf = {
url = "github:notashelf/nvf/v0.7";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-08-19 23:40:25 +02:00
};
2025-02-11 23:20:42 +01:00
outputs = inputs @ {
nixpkgs,
2024-10-28 20:51:27 +01:00
flake-utils,
home-manager,
agenix,
2025-01-03 23:51:19 +01:00
lanzaboote,
2025-01-29 22:15:35 +01:00
disko,
2025-02-11 23:20:42 +01:00
nvf,
...
2025-02-11 23:20:42 +01:00
}: let
home-modules = with inputs; [
nix-flatpak.homeManagerModules.nix-flatpak
nix-doom-emacs.hmModule
2025-02-11 23:20:42 +01:00
nvf.homeManagerModules.default
];
2024-10-28 20:51:27 +01:00
overlays = with inputs; [
2024-12-19 23:36:35 +01:00
nur.overlays.default
2024-10-28 20:51:27 +01:00
nixgl.overlay
];
2025-02-11 23:20:42 +01:00
customNixosSystem = {
name,
system,
extraModules ? [],
}:
nixpkgs.lib.nixosSystem {
inherit system;
modules =
[
./hosts/${name}/configuration.nix
home-manager.nixosModules.home-manager
agenix.nixosModules.default
lanzaboote.nixosModules.lanzaboote
disko.nixosModules.disko
{nixpkgs.overlays = overlays;}
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = inputs;
home-manager.users.florian.imports =
home-modules
++ [
./hosts/${name}/home.nix
];
}
]
++ extraModules;
};
in
{
#####################################################################
#####################################################################
# Configure all nixos configurations
#####################################################################
#####################################################################
nixosConfigurations = {
nixos-test = customNixosSystem {
name = "nixos-test";
system = "x86_64-linux";
};
perso-laptop = customNixosSystem {
name = "perso-laptop";
system = "x86_64-linux";
};
perso-desktop = customNixosSystem {
name = "perso-desktop";
system = "x86_64-linux";
};
};
2025-02-11 23:20:42 +01:00
#####################################################################
#####################################################################
# Configure home configuration for all others systems like Arch Linux
#####################################################################
#####################################################################
homeConfigurations = {
perso-home = home-manager.lib.homeManagerConfiguration rec {
pkgs = import nixpkgs {
system = "x86_64-linux";
inherit overlays;
};
modules =
home-modules
++ [
{nix.package = pkgs.nix;}
./hosts/perso-home/home.nix
];
};
};
}
#####################################################################
#####################################################################
2025-02-11 23:20:42 +01:00
# Configure development shell for all systems and merge with all
# previous configurations with //
#####################################################################
#####################################################################
2025-02-11 23:20:42 +01:00
// flake-utils.lib.eachSystem flake-utils.lib.allSystems (system: let
pkgs = import nixpkgs {inherit system;};
in {
devShells = {
default = pkgs.mkShell {
packages = with pkgs; [
2025-02-11 23:20:42 +01:00
nil
];
};
};
});
2024-02-02 21:07:29 +01:00
}