nixos-config/flake.nix

149 lines
4.7 KiB
Nix
Raw Normal View History

2020-09-23 10:36:46 +02:00
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2021-05-28 00:19:47 +02:00
inputs.nixos-hardware.url = "github:NixOS/nixos-hardware/master";
2020-09-24 12:35:45 +02:00
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
2020-09-23 10:36:46 +02:00
inputs.nur.url = "github:nix-community/NUR/master";
inputs.pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
2020-09-24 12:35:45 +02:00
inputs.nvim-kitty-navigator = {
url = "github:hermitmaster/nvim-kitty-navigator";
flake = false;
};
2021-05-28 00:19:47 +02:00
outputs = { self, nixpkgs, nixos-hardware, flake-utils, home-manager, nur
2022-05-03 20:44:25 +02:00
, pre-commit-hooks, nvim-kitty-navigator }@inputs:
2020-09-23 13:19:19 +02:00
let
2020-10-10 10:03:38 +02:00
overlays = {
neovim = self: super:
2021-11-13 04:23:32 +01:00
let
buildVimPlugin = name: input:
super.pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = name;
version = input.rev;
versionSuffix = "-git";
2021-11-13 04:23:32 +01:00
src = input;
};
2021-11-13 04:23:32 +01:00
in {
vimPlugins = super.vimPlugins // {
nvim-kitty-navigator =
buildVimPlugin "nvim-kitty-navigator" nvim-kitty-navigator;
};
};
2020-10-10 10:03:38 +02:00
deconz = self: super: {
deconz = self.qt5.callPackage ./pkgs/deconz { };
};
};
2022-05-04 10:55:36 +02:00
nixosModules = {
flakeDefaults = import ./modules/flakeDefaults.nix;
emailNotify = import ./modules/emailNotify.nix;
};
2021-08-08 17:44:59 +02:00
homeManagerModules = { git = import ./home/modules/git.nix; };
systemDefaults = {
modules = [ nixosModules.flakeDefaults ];
2022-05-05 17:49:25 +02:00
overlays = [ nur.overlay overlays.neovim overlays.deconz ];
2021-08-08 17:44:59 +02:00
};
lib = rec {
createSystem = hostName:
{ hardwareConfig, config }:
({ pkgs, lib, ... }: {
networking.hostName = hostName;
nixpkgs.overlays = systemDefaults.overlays;
imports = systemDefaults.modules ++ [
hardwareConfig
config
{
# make arguments available to modules
_module.args = { inherit self inputs; };
}
];
});
createUser' = import ./lib/createUser.nix;
createUser = name: args:
({ pkgs, ... }@args2:
(createUser' name args) ({ inherit home-manager; } // args2));
};
in rec {
2021-08-08 17:44:59 +02:00
inherit lib overlays nixosModules homeManagerModules;
2020-09-23 10:36:46 +02:00
2022-02-05 01:24:41 +01:00
nixosConfigurations.home-pc = nixpkgs.lib.nixosSystem {
2020-09-23 13:19:19 +02:00
system = "x86_64-linux";
modules = [
2020-09-23 10:36:46 +02:00
nixpkgs.nixosModules.notDetected
2022-02-05 01:24:41 +01:00
(lib.createSystem "home-pc" {
hardwareConfig = ./hardware/home-pc.nix;
2020-09-23 10:36:46 +02:00
config = ./home-pc.nix;
})
2021-08-08 17:44:59 +02:00
(lib.createUser "felschr" {
user.extraGroups = [ "wheel" "audio" "docker" "disk" ];
modules = [ homeManagerModules.git ];
config = ./home/felschr.nix;
})
2020-09-23 10:36:46 +02:00
];
2020-09-23 13:19:19 +02:00
};
2020-09-23 10:36:46 +02:00
2020-09-23 13:19:19 +02:00
nixosConfigurations.pilot1 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
2020-09-23 10:36:46 +02:00
nixpkgs.nixosModules.notDetected
2021-08-08 17:44:59 +02:00
(lib.createSystem "pilot1" {
2021-08-10 15:53:23 +02:00
hardwareConfig = ./hardware/pilot1.nix;
2020-09-23 10:36:46 +02:00
config = ./work-pc.nix;
})
2021-08-08 17:44:59 +02:00
(lib.createUser "felschr" {
user.extraGroups = [ "wheel" "audio" "docker" "disk" ];
modules = [ homeManagerModules.git ];
config = ./home/felschr-work.nix;
})
2020-09-23 10:36:46 +02:00
];
2020-09-23 13:19:19 +02:00
};
2020-09-23 10:36:46 +02:00
2020-09-27 14:27:25 +02:00
nixosConfigurations.felix-rpi4 = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
nixpkgs.nixosModules.notDetected
2021-05-28 00:19:47 +02:00
nixos-hardware.nixosModules.raspberry-pi-4
2021-08-08 17:44:59 +02:00
(lib.createSystem "felix-rpi4" {
2020-09-27 14:27:25 +02:00
hardwareConfig = ./hardware/rpi4.nix;
config = ./rpi4.nix;
})
2021-08-08 17:44:59 +02:00
(lib.createUser "felschr" {
user = {
extraGroups = [ "wheel" "audio" "disk" "media" ];
2021-10-23 03:06:06 +02:00
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP751vlJUnB7Pfe1KNr6weWkx/rkP4J3lTYpAekHdOgV"
2021-10-23 03:06:06 +02:00
];
2021-08-08 17:44:59 +02:00
};
modules = [ homeManagerModules.git ];
config = ./home/felschr-rpi4.nix;
})
2020-09-27 14:27:25 +02:00
];
};
2020-09-24 12:35:45 +02:00
} // flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
pre-commit-check = pre-commit-hooks.lib.${system}.run {
2020-09-24 12:35:45 +02:00
src = ./.;
hooks = { nixfmt.enable = true; };
};
in {
devShell = pkgs.mkShell { inherit (pre-commit-check) shellHook; };
});
2020-09-23 10:36:46 +02:00
}