nix-config/flake.nix

142 lines
3.3 KiB
Nix
Raw Normal View History

2021-02-05 16:25:39 +01:00
{
2021-03-07 19:30:33 +01:00
description = "NixOS configuration with flakes";
2021-02-05 16:25:39 +01:00
inputs = {
2021-09-25 13:30:51 +02:00
agenix = {
type = "github";
owner = "ryantm";
repo = "agenix";
ref = "main";
2021-09-25 13:30:51 +02:00
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
futils = {
type = "github";
owner = "numtide";
repo = "flake-utils";
ref = "main";
};
home-manager = {
type = "github";
owner = "nix-community";
repo = "home-manager";
ref = "master";
inputs = {
nixpkgs.follows = "nixpkgs";
2022-06-22 11:19:43 +02:00
utils.follows = "futils";
};
};
nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
ref = "nixos-unstable";
};
nur = {
type = "github";
owner = "nix-community";
repo = "NUR";
ref = "master";
};
pre-commit-hooks = {
type = "github";
owner = "cachix";
repo = "pre-commit-hooks.nix";
ref = "master";
inputs = {
flake-utils.follows = "futils";
nixpkgs.follows = "nixpkgs";
nixpkgs-stable.follows = "nixpkgs";
};
};
2021-02-05 16:25:39 +01:00
};
2021-05-31 23:01:21 +02:00
outputs =
inputs @
{ self
2021-09-25 13:30:51 +02:00
, agenix
2021-05-31 23:01:21 +02:00
, futils
, home-manager
, nixpkgs
, nur
, pre-commit-hooks
2021-05-31 23:01:21 +02:00
}:
2021-02-18 21:19:11 +01:00
let
2023-03-07 11:44:29 +01:00
inherit (self) lib;
inherit (futils.lib) eachSystem system;
mySystems = [
system.aarch64-darwin
system.aarch64-linux
system.x86_64-darwin
system.x86_64-linux
];
eachMySystem = eachSystem mySystems;
2021-02-18 21:19:11 +01:00
in
eachMySystem
(system:
2021-05-31 23:01:21 +02:00
rec {
apps = {
diff-flake = futils.lib.mkApp { drv = packages.diff-flake; };
2022-05-31 13:41:42 +02:00
default = apps.diff-flake;
2021-05-31 23:01:21 +02:00
};
2023-03-07 11:49:12 +01:00
checks = import ./flake/checks.nix inputs system;
2023-03-07 11:51:26 +01:00
devShells = import ./flake/dev-shells.nix inputs system;
2023-03-07 11:53:47 +01:00
packages = import ./flake/packages.nix inputs system;
# Work-around for https://github.com/nix-community/home-manager/issues/3075
legacyPackages = {
homeConfigurations = {
ambroisie = home-manager.lib.homeManagerConfiguration {
# Work-around for home-manager
# * not letting me set `lib` as an extraSpecialArgs
# * not respecting `nixpkgs.overlays` [1]
# [1]: https://github.com/nix-community/home-manager/issues/2954
pkgs = import nixpkgs {
inherit system;
overlays = (lib.attrValues self.overlays) ++ [
nur.overlay
];
};
modules = [
./home
{
# The basics
home.username = "ambroisie";
home.homeDirectory = "/home/ambroisie";
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# This is a generic linux install
targets.genericLinux.enable = true;
}
];
extraSpecialArgs = {
# Inject inputs to use them in global registry
inherit inputs;
};
};
};
};
2021-05-31 23:01:21 +02:00
}) // {
2023-03-07 11:44:29 +01:00
lib = import ./flake/lib.nix inputs;
2023-03-07 11:36:27 +01:00
overlays = import ./flake/overlays.nix inputs;
nixosConfigurations = import ./flake/nixos.nix inputs;
2021-02-05 16:25:39 +01:00
};
}