1
0
Fork 0
nixos-config/flake.nix

93 lines
2.9 KiB
Nix
Raw Normal View History

2023-01-15 23:30:25 +00:00
{
description = "maralorns configuration";
2023-01-19 03:13:41 +00:00
nixConfig = {
allow-import-from-derivation = true;
};
2023-01-15 23:30:25 +00:00
inputs = {
2023-02-01 02:10:48 +00:00
secrets.url = "git+ssh://git@hera.m-0.eu/config-secrets";
2023-01-31 21:37:18 +00:00
agenix = {
url = "github:ryantm/agenix";
2023-02-02 03:58:37 +00:00
inputs.nixpkgs.follows = "nixos-unstable";
2023-01-31 21:37:18 +00:00
};
2023-02-02 03:58:37 +00:00
nixos-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
2023-02-01 02:10:48 +00:00
nixos-stable.url = "github:nixos/nixpkgs/nixos-22.11";
2023-02-02 03:58:37 +00:00
nixpkgs.follows = "nixos-unstable";
flake-parts.inputs.nixpkgs-lib.follows = "nixos-unstable";
hexa-nur-packages.url = "github:mweinelt/nur-packages";
2023-01-15 23:30:25 +00:00
pre-commit-hooks-nix = {
url = "github:cachix/pre-commit-hooks.nix";
2023-02-01 02:10:48 +00:00
inputs = {
nixpkgs-stable.follows = "nixos-stable";
2023-02-02 03:58:37 +00:00
nixpkgs.follows = "nixos-unstable";
2023-02-01 02:10:48 +00:00
};
2023-01-15 23:30:25 +00:00
};
};
2023-02-02 03:58:37 +00:00
outputs = inputs @ {nixos-hardware, ...}: let
unstable = inputs.nixos-unstable.legacyPackages.x86_64-linux;
inherit (import ./packages {pkgs = unstable;}) haskellPackagesOverlay selectHaskellPackages;
in
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
2023-01-15 23:30:25 +00:00
imports = [
inputs.pre-commit-hooks-nix.flakeModule
];
systems = ["x86_64-linux"];
2023-02-02 03:58:37 +00:00
flake = {
nixosConfigurations = import ./nixos/configurations.nix inputs;
overlays.haskellPackages = haskellPackagesOverlay;
2023-02-01 02:10:48 +00:00
};
2023-01-15 23:30:25 +00:00
perSystem = {
self',
2023-01-31 21:37:18 +00:00
inputs',
2023-01-15 23:30:25 +00:00
pkgs,
config,
2023-01-19 03:13:41 +00:00
lib,
2023-01-15 23:30:25 +00:00
...
2023-01-19 03:13:41 +00:00
}: let
2023-01-31 21:37:18 +00:00
hpkgs = pkgs.haskellPackages.override {
2023-02-02 03:58:37 +00:00
overrides = inputs.self.overlays.haskellPackages;
2023-01-31 21:37:18 +00:00
};
2023-01-19 03:13:41 +00:00
in {
2023-01-31 21:37:18 +00:00
devShells.default = hpkgs.shellFor {
packages = hpkgs: (builtins.attrValues (selectHaskellPackages hpkgs));
2023-01-15 23:30:25 +00:00
shellHook = config.pre-commit.installationScript;
2023-01-31 21:37:18 +00:00
buildInputs = [
hpkgs.haskell-language-server
pkgs.cabal-install
inputs'.agenix.packages.default
];
2023-01-15 23:30:25 +00:00
};
2023-02-02 03:58:37 +00:00
checks = {
system-checks = pkgs.runCommand "system-checks" {} ''
${lib.concatMapStringsSep "\n" (x: "# ${x.config.system.build.toplevel}") (builtins.attrValues inputs.self.nixosConfigurations)}
echo success > $out
'';
};
2023-01-31 21:37:18 +00:00
packages = selectHaskellPackages hpkgs;
2023-01-19 03:13:41 +00:00
2023-01-15 23:30:25 +00:00
pre-commit = {
check.enable = true;
2023-01-16 02:57:11 +00:00
settings = {
settings.ormolu.defaultExtensions = [
"TypeApplications"
"BangPatterns"
"ImportQualifiedPost"
"BlockArguments"
];
hooks = {
hlint.enable = true;
alejandra.enable = true;
nix-linter.enable = false; # Too many false positives for now
statix.enable = true;
fourmolu.enable = true;
shellcheck.enable = true;
2023-01-16 03:26:37 +00:00
cabal-fmt.enable = true;
dhall-format.enable = true;
2023-01-16 02:57:11 +00:00
};
2023-01-15 23:30:25 +00:00
};
};
};
};
}