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-02-18 22:27:08 +01:00
|
|
|
home-manager.url = "github:nix-community/home-manager";
|
|
|
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
2021-02-05 16:35:33 +01:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
2021-02-05 16:43:30 +01:00
|
|
|
nur.url = "github:nix-community/NUR";
|
2021-03-07 19:40:54 +01:00
|
|
|
futils.url = "github:numtide/flake-utils";
|
2021-02-05 16:25:39 +01:00
|
|
|
};
|
|
|
|
|
2021-03-10 19:49:12 +01:00
|
|
|
outputs = { self, nixpkgs, nur, home-manager, futils } @ inputs:
|
2021-02-18 21:19:11 +01:00
|
|
|
let
|
2021-03-07 19:40:54 +01:00
|
|
|
inherit (futils.lib) eachDefaultSystem;
|
2021-03-07 19:26:20 +01:00
|
|
|
|
2021-03-10 19:49:12 +01:00
|
|
|
lib = nixpkgs.lib.extend (self: super: {
|
|
|
|
my = import ./lib { inherit inputs; pkgs = nixpkgs; lib = self; };
|
|
|
|
});
|
|
|
|
|
2021-03-07 19:26:20 +01:00
|
|
|
defaultModules = [
|
2021-03-08 19:59:08 +01:00
|
|
|
({ ... }: {
|
2021-03-07 19:26:20 +01:00
|
|
|
# Let 'nixos-version --json' know about the Git revision
|
|
|
|
system.configurationRevision =
|
|
|
|
if self ? rev
|
|
|
|
then self.rev
|
|
|
|
else throw "Refusing to build from a dirty Git tree!";
|
|
|
|
})
|
2021-03-10 19:49:12 +01:00
|
|
|
{ nixpkgs.overlays = [ nur.overlay self.overlay ]; }
|
2021-03-07 19:26:20 +01:00
|
|
|
home-manager.nixosModules.home-manager
|
|
|
|
{
|
|
|
|
home-manager.users.ambroisie = import ./home;
|
|
|
|
# Nix Flakes compatibility
|
|
|
|
home-manager.useGlobalPkgs = true;
|
|
|
|
home-manager.useUserPackages = true;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
buildHost = name: system: lib.nixosSystem {
|
2021-02-18 21:19:11 +01:00
|
|
|
inherit system;
|
2021-03-07 19:26:20 +01:00
|
|
|
modules = defaultModules ++ [
|
2021-02-18 21:19:11 +01:00
|
|
|
(./. + "/${name}.nix")
|
2021-02-05 16:25:39 +01:00
|
|
|
];
|
2021-02-18 21:19:11 +01:00
|
|
|
};
|
|
|
|
in
|
2021-03-07 19:40:54 +01:00
|
|
|
eachDefaultSystem
|
|
|
|
(system:
|
|
|
|
let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
devShell = pkgs.mkShell {
|
|
|
|
name = "NixOS-config";
|
|
|
|
buildInputs = with pkgs; [
|
|
|
|
gitAndTools.pre-commit
|
|
|
|
nixpkgs-fmt
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}) // {
|
2021-03-10 19:49:12 +01:00
|
|
|
overlay = self.overlays.lib;
|
|
|
|
|
|
|
|
overlays = {
|
|
|
|
lib = final: prev: { inherit lib; };
|
|
|
|
};
|
|
|
|
|
2021-03-12 19:21:46 +01:00
|
|
|
nixosConfigurations = lib.mapAttrs buildHost {
|
2021-02-18 21:19:11 +01:00
|
|
|
porthos = "x86_64-linux";
|
|
|
|
};
|
2021-02-05 16:25:39 +01:00
|
|
|
};
|
|
|
|
}
|