nixos/flake.nix

139 lines
4.4 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";
};
nur.url = "github:nix-community/NUR";
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
};
2023-08-19 23:40:25 +02:00
};
2023-08-20 00:48:31 +02:00
outputs = inputs@{
nixpkgs,
2024-10-28 20:51:27 +01:00
flake-utils,
home-manager,
agenix,
...
2024-04-08 00:06:14 +02:00
}:
let
2024-04-08 00:43:06 +02:00
systems = [
{ name = "nixos-test"; system = "x86_64-linux"; }
{ name = "perso-laptop"; system = "x86_64-linux"; }
{ name = "perso-desktop"; system = "x86_64-linux"; }
2024-04-08 00:06:14 +02:00
];
home-modules = with inputs; [
nix-flatpak.homeManagerModules.nix-flatpak
nix-doom-emacs.hmModule
];
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
];
2024-04-08 00:06:14 +02:00
in {
#####################################################################
#####################################################################
# Configure all nixos configurations
#####################################################################
#####################################################################
2024-04-08 00:43:06 +02:00
nixosConfigurations = nixpkgs.lib.foldl (c: s:
c // {
${s.name} = nixpkgs.lib.nixosSystem {
2024-04-08 00:45:54 +02:00
inherit (s) system;
2024-04-08 00:43:06 +02:00
modules = [
./hosts/${s.name}/configuration.nix
2024-04-08 00:43:06 +02:00
home-manager.nixosModules.home-manager
2024-04-08 01:15:52 +02:00
agenix.nixosModules.default
2024-10-28 20:51:27 +01:00
{ nixpkgs.overlays = overlays; }
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = inputs;
home-manager.users.florian.imports = home-modules ++ [
2024-05-28 16:05:44 +02:00
./hosts/${s.name}/home.nix
];
}
2024-04-08 00:43:06 +02:00
];
};
}) {} systems;
#####################################################################
#####################################################################
# Configure home configuration for all others systems like Arch Linux
#####################################################################
#####################################################################
homeConfigurations = {
perso-home = home-manager.lib.homeManagerConfiguration rec {
2024-10-28 20:51:27 +01:00
pkgs = import nixpkgs { system = "x86_64-linux"; inherit overlays; };
modules = home-modules ++ [
{ nix.package = pkgs.nix; }
./hosts/perso-home/home.nix
];
};
};
}
#####################################################################
#####################################################################
# Configure development shell for all systems and merge with all
# previous configurations with //
#####################################################################
#####################################################################
// flake-utils.lib.eachSystem flake-utils.lib.allSystems (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
devShells = {
default = pkgs.mkShell {
packages = with pkgs; [
nixd
];
};
};
});
2024-02-02 21:07:29 +01:00
}