flake: Setup a devShell for haskell
This commit is contained in:
parent
bc675f00ac
commit
329b60662a
2 changed files with 201 additions and 44 deletions
132
flake.nix
132
flake.nix
|
|
@ -4,6 +4,9 @@
|
|||
nixpkgs-droid.url = "github:NixOS/nixpkgs/nixos-23.05";
|
||||
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
||||
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager/release-23.11";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
|
@ -45,51 +48,94 @@
|
|||
disko.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = { home-manager, nixpkgs, nixpkgs-unstable, ... }@inputs: {
|
||||
nixosConfigurations."thrall" = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = let
|
||||
postfix-overlay = final: prev: {
|
||||
postfix = nixpkgs-unstable.legacyPackages."x86_64-linux".postfix;
|
||||
};
|
||||
in [
|
||||
({ inputs, lib, ... }: {
|
||||
nixpkgs = {
|
||||
config.allowUnfree = true;
|
||||
overlays = with inputs; [ emacs.overlay postfix-overlay ];
|
||||
outputs = { self, home-manager, nixpkgs, nixpkgs-unstable, pre-commit-hooks
|
||||
, ... }@inputs: {
|
||||
checks."x86_64-linux" = let
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
in {
|
||||
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
||||
src = ./.;
|
||||
settings = { ormolu.defaultExtensions = [ "GHC2021" ]; };
|
||||
tools.fourmolu = pkgs.haskellPackages.fourmolu;
|
||||
hooks = {
|
||||
nixfmt.enable = true;
|
||||
fourmolu.enable = true;
|
||||
hpack.enable = true;
|
||||
hlint.enable = true;
|
||||
};
|
||||
nix.registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
|
||||
})
|
||||
./hosts/thrall
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.alex = import ./home/alex/cli.nix;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nixosConfigurations."dregil" = nixpkgs-unstable.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ ./hosts/dregil ];
|
||||
};
|
||||
|
||||
nixosConfigurations."igor" = nixpkgs-unstable.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ ./hosts/igor ];
|
||||
};
|
||||
|
||||
nixOnDroidConfigurations.default = with inputs;
|
||||
nix-on-droid.lib.nixOnDroidConfiguration {
|
||||
modules = [
|
||||
./hosts/redmi
|
||||
{ nix.registry.nixpkgs.flake = nixpkgs-droid; }
|
||||
{ nix.nixPath = [ "nixpkgs=${nixpkgs-droid}" ]; }
|
||||
nixosConfigurations."thrall" = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = let
|
||||
postfix-overlay = final: prev: {
|
||||
postfix = nixpkgs-unstable.legacyPackages."x86_64-linux".postfix;
|
||||
};
|
||||
in [
|
||||
({ inputs, lib, ... }: {
|
||||
nixpkgs = {
|
||||
config.allowUnfree = true;
|
||||
overlays = with inputs; [ emacs.overlay postfix-overlay ];
|
||||
};
|
||||
nix.registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
|
||||
})
|
||||
./hosts/thrall
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.alex = import ./home/alex/cli.nix;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
nixosConfigurations."dregil" = nixpkgs-unstable.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ ./hosts/dregil ];
|
||||
};
|
||||
|
||||
nixosConfigurations."igor" = nixpkgs-unstable.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ ./hosts/igor ];
|
||||
};
|
||||
|
||||
nixOnDroidConfigurations.default = with inputs;
|
||||
nix-on-droid.lib.nixOnDroidConfiguration {
|
||||
modules = [
|
||||
./hosts/redmi
|
||||
{ nix.registry.nixpkgs.flake = nixpkgs-droid; }
|
||||
{ nix.nixPath = [ "nixpkgs=${nixpkgs-droid}" ]; }
|
||||
];
|
||||
};
|
||||
|
||||
devShells."x86_64-linux".default = let
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
in pkgs.haskellPackages.shellFor {
|
||||
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
||||
|
||||
packages = p: [ p.xmonad p.xmonad-contrib ];
|
||||
|
||||
withHoogle = true;
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
haskellPackages.haskell-language-server
|
||||
haskellPackages.fourmolu
|
||||
haskellPackages.hspec-discover
|
||||
haskellPackages.doctest
|
||||
haskellPackages.xmonad
|
||||
haskellPackages.xmonad-contrib
|
||||
cabal-install
|
||||
ghcid
|
||||
nixfmt
|
||||
hpack
|
||||
hlint
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue