nixos/flake.nix

101 lines
2.7 KiB
Nix
Raw Normal View History

{
description = "NixOS configuration";
inputs = {
2022-06-06 11:47:50 +02:00
nix.url = "github:NixOS/nix";
2023-06-01 00:09:26 +02:00
nixpkgs.url = "nixpkgs/nixos-23.05";
nixpkgs-unstable.url = "nixpkgs/nixos-unstable";
2022-12-25 12:03:56 +01:00
flake-parts.url = "github:hercules-ci/flake-parts";
2022-11-10 20:23:50 +01:00
pre-commit-hooks-nix = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-hardware.url = "github:NixOS/nixos-hardware";
2022-06-03 23:33:25 +02:00
2022-12-04 18:03:44 +01:00
deploy-rs.url = "github:serokell/deploy-rs";
2022-06-03 23:33:25 +02:00
2022-11-10 20:23:50 +01:00
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-06-26 18:15:03 +02:00
2023-03-10 21:41:41 +01:00
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-03-18 16:58:18 +01:00
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-03-10 21:41:41 +01:00
# own flakes
2022-06-26 18:15:03 +02:00
stunkymonkey = {
url = "github:Stunkymonkey/stunkymonkey.de";
2022-11-10 20:23:50 +01:00
inputs.nixpkgs.follows = "nixpkgs";
};
passworts = {
url = "github:Stunkymonkey/passworts";
2022-11-10 20:23:50 +01:00
inputs.nixpkgs.follows = "nixpkgs";
2022-06-26 18:15:03 +02:00
};
};
2022-11-10 20:23:50 +01:00
outputs = inputs@{ self, flake-parts, deploy-rs, ... }:
2022-12-25 12:03:56 +01:00
flake-parts.lib.mkFlake { inherit inputs; } {
2022-07-24 17:37:30 +02:00
imports = [
2022-12-05 20:32:39 +01:00
./machines/configurations.nix
2023-03-12 18:50:22 +01:00
./images/flake-module.nix
inputs.pre-commit-hooks-nix.flakeModule
2022-07-24 17:37:30 +02:00
];
2022-07-24 17:37:30 +02:00
systems = [ "x86_64-linux" "aarch64-linux" ];
perSystem = { self', inputs', config, pkgs, system, ... }: {
2022-07-24 17:37:30 +02:00
# make pkgs available to all `perSystem` functions
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
# prevent rebuilding deploy-rs everytime when nixpkgs changes
overlays = [
deploy-rs.overlay
(self: super: { deploy-rs = { inherit (pkgs) deploy-rs; lib = super.deploy-rs.lib; }; })
];
};
# enable pre-commit checks
pre-commit.settings = {
hooks = {
shellcheck.enable = true;
nixpkgs-fmt.enable = true;
};
};
devShells.default = pkgs.mkShellNoCC {
nativeBuildInputs = [
inputs'.sops-nix.packages.sops-import-keys-hook
inputs'.deploy-rs.packages.deploy-rs
2023-03-18 16:58:18 +01:00
inputs'.disko.packages.disko
2023-03-10 21:41:41 +01:00
# formatters
pkgs.shellcheck
2023-03-10 21:41:41 +01:00
pkgs.nixpkgs-fmt
];
shellHook = ''
${config.pre-commit.installationScript}
'';
};
2022-06-26 22:40:59 +02:00
};
2022-07-24 17:37:30 +02:00
flake = {
# currently disabled, because this causes rebuilds
2023-06-01 00:09:26 +02:00
# checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
2022-12-05 20:32:39 +01:00
deploy = import ./machines/deploy.nix (inputs // {
2022-07-24 17:37:30 +02:00
inherit inputs;
});
};
};
}